2
0
forked from Wavyzz/dolibarr

Copy-Paste works also for hidden fields

This commit is contained in:
Laurent Destailleur
2021-05-12 11:51:39 +02:00
parent ce8c606132
commit a665ff5bda
4 changed files with 58 additions and 27 deletions

View File

@@ -3505,7 +3505,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next', 'margin', 'map-marker-alt', 'member', 'meeting', 'money-bill-alt', 'movement', 'mrp', 'note', 'next',
'off', 'on', 'order', 'off', 'on', 'order',
'paiment', 'paragraph', 'play', 'pdf', 'phone', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip', 'paiment', 'paragraph', 'play', 'pdf', 'phone', 'playdisabled', 'previous', 'poll', 'pos', 'printer', 'product', 'propal', 'stock', 'resize', 'service', 'stats', 'trip',
'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench', 'security', 'setup', 'share-alt', 'sign-out', 'split', 'stripe', 'stripe-s', 'switch_off', 'switch_on', 'tools', 'unlink', 'uparrow', 'user', 'vcard', 'wrench',
'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp', 'github', 'jabber', 'skype', 'twitter', 'facebook', 'linkedin', 'instagram', 'snapchat', 'youtube', 'google-plus-g', 'whatsapp',
'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies', 'chevron-left', 'chevron-right', 'chevron-down', 'chevron-top', 'commercial', 'companies',
'generic', 'home', 'hrm', 'members', 'products', 'invoicing', 'generic', 'home', 'hrm', 'members', 'products', 'invoicing',
@@ -3556,7 +3556,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge', 'reception'=>'dolly', 'recruitmentjobposition'=>'id-card-alt', 'recruitmentcandidature'=>'id-badge',
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature', 'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'resource'=>'laptop-house', 'refresh'=>'redo', 'resource'=>'laptop-house',
'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt', 'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach', 'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt', 'title_agenda'=>'calendar-alt',
@@ -3656,7 +3656,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'other'=>'#ddd', 'other'=>'#ddd',
'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba', 'partnership'=>'#6c6aa8', 'playdisabled'=>'#ccc', 'printer'=>'#444', 'projectpub'=>'#986c6a', 'reception'=>'#a69944', 'resize'=>'#444', 'rss'=>'#cba',
//'shipment'=>'#a69944', //'shipment'=>'#a69944',
'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555', 'security'=>'#999', 'stats'=>'#444', 'switch_off'=>'#999', 'technic'=>'#999', 'timespent'=>'#555',
'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa', 'uncheck'=>'#800', 'uparrow'=>'#555', 'user-cog'=>'#999', 'country'=>'#aaa', 'globe-americas'=>'#aaa',
'website'=>'#304', 'workstation'=>'#a69944' 'website'=>'#304', 'workstation'=>'#a69944'
); );
@@ -10232,14 +10232,20 @@ function readfileLowMemory($fullpath_original_file_osencoded, $method = -1)
} }
/** /**
* Create a button to copy $valuetoprint in the clipboard * Create a button to copy $valuetocopy in the clipboard
* *
* @param string $valuetoprint The value to print * @param string $valuetocopy The value to print
* @param int $showonlyonhover Show the copypaste button only on hover * @param int $showonlyonhover Show the copy-paste button only on hover
* @param string $texttoshow Replace the value to show with this text
* @return string The string to print for the button * @return string The string to print for the button
*/ */
function showValueWithClipboardCPButton($valuetoprint, $showonlyonhover = 1) function showValueWithClipboardCPButton($valuetocopy, $showonlyonhover = 1, $texttoshow = '')
{ {
$result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue">'.$valuetoprint.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>'; if ($texttoshow) {
$result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue hidewithsize">'.$valuetocopy.'</span><span class="clipboardCPValueToPrint">'.$texttoshow.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>';
} else {
$result = '<span class="clipboardCP'.($showonlyonhover ? ' clipboardCPShowOnHover' : '').'"><span class="clipboardCPValue">'.$valuetocopy.'</span><span class="clipboardCPButton far fa-clipboard opacitymedium paddingleft paddingright"></span><span class="clipboardCPText opacitymedium"></span></span>';
}
return $result; return $result;
} }

View File

@@ -4674,7 +4674,7 @@ table.dp {
/* ============================================================================== */ /* ============================================================================== */
/* Afficher/cacher */ /* Show/Hide */
/* ============================================================================== */ /* ============================================================================== */
div.visible { div.visible {
@@ -6763,9 +6763,15 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
/* ============================================================================== */ /* ============================================================================== */
/* For copypaste feature */ /* For copy-paste feature */
/* ============================================================================== */ /* ============================================================================== */
span.clipboardCPValue.hidewithsize {
width: 0 !important;
display: inline-block;
color: transparent;
}
.clipboardCPShowOnHover .clipboardCPButton { .clipboardCPShowOnHover .clipboardCPButton {
display: none; display: none;
} }

View File

@@ -4583,7 +4583,7 @@ table.dp {
/* ============================================================================== */ /* ============================================================================== */
/* Afficher/cacher */ /* Show/Hide */
/* ============================================================================== */ /* ============================================================================== */
div.visible { div.visible {
@@ -6606,6 +6606,21 @@ div.phpdebugbar-widgets-templates a.phpdebugbar-widgets-editor-link:before
} }
/* ============================================================================== */
/* For copy-paste feature */
/* ============================================================================== */
span.clipboardCPValue.hidewithsize {
width: 0 !important;
display: inline-block;
color: transparent;
}
.clipboardCPShowOnHover .clipboardCPButton {
display: none;
}
/* ============================================================================== */ /* ============================================================================== */
/* CSS style used for small screen */ /* CSS style used for small screen */
/* ============================================================================== */ /* ============================================================================== */

View File

@@ -1573,7 +1573,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Color user // Color user
if (!empty($conf->agenda->enabled)) { if (!empty($conf->agenda->enabled)) {
print '<tr><td>'.$langs->trans("ColorUser").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("ColorUser").'</td>';
print '<td>'; print '<td>';
print $formother->showColor($object->color, ''); print $formother->showColor($object->color, '');
print '</td>'; print '</td>';
@@ -1582,7 +1582,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Categories // Categories
if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) { if (!empty($conf->categorie->enabled) && !empty($user->rights->categorie->lire)) {
print '<tr><td>'.$langs->trans("Categories").'</td>'; print '<tr><td class="titlefield">'.$langs->trans("Categories").'</td>';
print '<td colspan="3">'; print '<td colspan="3">';
print $form->showCategories($object->id, Categorie::TYPE_USER, 1); print $form->showCategories($object->id, Categorie::TYPE_USER, 1);
print '</td></tr>'; print '</td></tr>';
@@ -1591,7 +1591,7 @@ if ($action == 'create' || $action == 'adduserldap') {
// Default language // Default language
if (!empty($conf->global->MAIN_MULTILANGS)) { if (!empty($conf->global->MAIN_MULTILANGS)) {
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
print '<tr><td>'.$langs->trans("DefaultLang").'</td><td>'; print '<tr><td class="titlefield">'.$langs->trans("DefaultLang").'</td><td>';
//$s=picto_from_langcode($object->default_lang); //$s=picto_from_langcode($object->default_lang);
//print ($s?$s.' ':''); //print ($s?$s.' ':'');
$langs->load("languages"); $langs->load("languages");
@@ -1606,14 +1606,6 @@ if ($action == 'create' || $action == 'adduserldap') {
print "</tr>\n"; print "</tr>\n";
} }
print '<tr><td class="titlefield">'.$langs->trans("LastConnexion").'</td>';
print '<td>'.dol_print_date($object->datelastlogin, "dayhour").'</td>';
print "</tr>\n";
print '<tr><td>'.$langs->trans("PreviousConnexion").'</td>';
print '<td>'.dol_print_date($object->datepreviouslogin, "dayhour").'</td>';
print "</tr>\n";
// Multicompany // Multicompany
if (!empty($conf->multicompany->enabled) && is_object($mc)) { if (!empty($conf->multicompany->enabled) && is_object($mc)) {
// This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module // This is now done with hook formObjectOptions. Keep this code for backward compatibility with old multicompany module
@@ -1698,13 +1690,13 @@ if ($action == 'create' || $action == 'adduserldap') {
print "</table>\n"; print "</table>\n";
// Credentials
print '<div class="div-table-responsive-no-min">'; print '<div class="div-table-responsive-no-min">';
print '<table class="border tableforfield centpercent">'; print '<table class="border tableforfield margintable centpercent">';
print '<tr class="liste_titre"><td class="liste_titre">'; print '<tr class="liste_titre"><td class="liste_titre">';
print $langs->trans("Credentials"); print img_picto('', 'security', 'class="paddingleft pictofixedwidth"').$langs->trans("Credentials");
print '</td>'; print '</td>';
print '<td></td>'; print '<td class="liste_titre"></td>';
print '</tr>'; print '</tr>';
// Date login validity // Date login validity
@@ -1779,13 +1771,25 @@ if ($action == 'create' || $action == 'adduserldap') {
print '<tr><td>'.$langs->trans("ApiKey").'</td>'; print '<tr><td>'.$langs->trans("ApiKey").'</td>';
print '<td>'; print '<td>';
if (!empty($object->api_key)) { if (!empty($object->api_key)) {
print '<span class="opacitymedium">'.preg_replace('/./', '*', $object->api_key).'</span>'; print '<span class="opacitymedium">';
print showValueWithClipboardCPButton($object->api_key, 1, $langs->trans("Hidden"));
print '</span>';
} }
if ($user->admin || $user->id == $object->id) { if ($user->admin || $user->id == $object->id) {
// TODO Add a feature to reveal the hash // TODO Add a feature to reveal the hash
} }
print '</td></tr>'; print '</td></tr>';
} }
print '<tr><td class="titlefield">'.$langs->trans("LastConnexion").'</td>';
print '<td>';
if ($object->datepreviouslogin) {
print dol_print_date($object->datepreviouslogin, "dayhour").' <span class="opacitymedium">('.$langs->trans("Previous").')</span>, ';
}
print dol_print_date($object->datelastlogin, "dayhour").' <span class="opacitymedium">('.$langs->trans("Current").')</span>';
print '</td>';
print "</tr>\n";
print '</table></div>'; print '</table></div>';
print '</div>'; print '</div>';