diff --git a/htdocs/admin/mails_templates.php b/htdocs/admin/mails_templates.php index 51c35a615be..13545002911 100644 --- a/htdocs/admin/mails_templates.php +++ b/htdocs/admin/mails_templates.php @@ -1061,7 +1061,7 @@ if ($num) { $obj = $db->fetch_object($resql); if ($obj) { - if ($action == 'edit' && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { + if (($action == 'edit' || $action == 'preview') && ($rowid == (!empty($obj->rowid) ? $obj->rowid : $obj->code))) { print ''; $tmpaction = 'edit'; @@ -1075,21 +1075,25 @@ if ($num) { print ''; print ''; print ''; - print ''; + if ($action == 'edit') { + print ''; + } print '
'; print ''; print ''; } // Show main fields if (empty($reshook)) { - fieldList($fieldlist, $obj, $tabname[$id], 'edit'); + fieldList($fieldlist, $obj, $tabname[$id], $action); } // Action column if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print ''; print ''; print ''; - print ''; + if ($action == 'edit') { + print ''; + } print '
'; print ''; print ''; @@ -1113,18 +1117,18 @@ if ($num) { if ($showfield) { // Show line for topic, joinfiles and content if ($tmpfieldlist == 'topic') { - print ''.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; + print '
'.$form->textwithpicto($langs->trans("Topic"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print ''; print '
'."\n"; } if ($tmpfieldlist == 'email_from') { - print ''.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print ''; + print '
'.$form->textwithpicto($langs->trans("MailFrom"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print ''; print '
'."\n"; } if ($tmpfieldlist == 'joinfiles') { - print ''.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).' '; - print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, false, 0, 1); + print '
'.$form->textwithpicto($langs->trans("FilesAttachedToEmail"), $tabhelp[$id][$tmpfieldlist], 1, 'help', '', 0, 2, $tmpfieldlist).'
'; + print $form->selectyesno($tmpfieldlist.'-'.$rowid, (isset($obj->$tmpfieldlist) ? $obj->$tmpfieldlist : '0'), 1, ($action != 'edit'), 0, 1); print '
'."\n"; } @@ -1134,7 +1138,7 @@ if ($num) { if (!getDolGlobalString('FCKEDITOR_ENABLE_MAIL')) { $okforextended = false; } - $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%'); + $doleditor = new DolEditor($tmpfieldlist.'-'.$rowid, (!empty($obj->{$tmpfieldlist}) ? $obj->{$tmpfieldlist} : ''), '', 500, 'dolibarr_mailings', 'In', 0, $acceptlocallinktomedia, $okforextended, ROWS_6, '90%', ($action != 'edit' ? 1 : 0)); print $doleditor->Create(1); } if ($tmpfieldlist == 'content_lines') { @@ -1201,6 +1205,8 @@ if ($num) { print ''; if ($canbemodified) { print ''.img_edit().''; + } else { + print ''.img_view().''; } if ($iserasable) { print ''.img_delete().''; @@ -1351,7 +1357,7 @@ $db->close(); * @param array $fieldlist Array of fields * @param Object $obj If we show a particular record, obj is filled with record fields * @param string $tabname Name of SQL table - * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'hide'=Output field for the "add form" but we don't want it to be rendered + * @param string $context 'add'=Output field for the "add form", 'edit'=Output field for the "edit form", 'preview'=show in readonly the template, 'hide'=Output field for the "add form" but we don't want it to be rendered * @return void */ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') @@ -1368,7 +1374,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; } elseif ($value == 'fk_user') { print ''; - if ($user->admin) { + if ($user->admin && $context != 'preview') { print $form->select_dolusers(empty($obj->$value) ? '' : $obj->$value, 'fk_user', 1, null, 0, ($user->admin ? '' : 'hierarchyme'), null, 0, 0, 0, '', 0, '', 'minwidth75 maxwidth100'); } else { if ($context == 'add') { // I am not admin and we show the add form @@ -1390,7 +1396,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') print ''; } elseif ($value == 'lang') { print ''; - if (getDolGlobalInt('MAIN_MULTILANGS')) { + if (getDolGlobalInt('MAIN_MULTILANGS') && $context != 'preview') { $selectedlang = GETPOSTISSET('langcode') ? GETPOST('langcode', 'aZ09') : $langs->defaultlang; if ($context == 'edit') { $selectedlang = $obj->lang; @@ -1410,7 +1416,7 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } elseif ($value == 'type_template') { // Le type de template print ''; - if ($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) { + if (($context == 'edit' && !empty($obj->type_template) && !in_array($obj->type_template, array_keys($elementList))) || $context == 'preview') { // Current template type is an unknown type, so we must keep it as it is. print ''; print $obj->type_template; @@ -1422,6 +1428,8 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') //print ''; } elseif ($context == 'edit' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { print ''; + } elseif ($context == 'preview' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { + print ''; } elseif ($context == 'hide' && in_array($value, array('topic', 'joinfiles', 'content', 'content_lines'))) { //print ''; } else { @@ -1451,14 +1459,14 @@ function fieldList($fieldlist, $obj = null, $tabname = '', $context = '') } print ''; - if ($value == 'private') { + if ($value == 'private' && $context != 'preview') { if (empty($user->admin)) { print $form->selectyesno($value, '1', 1); } else { print $form->selectyesno($value, (isset($obj->$value) ? $obj->$value : ''), 1); } } else { - print ''; + print ''; } print ''; } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 59c89d462c6..cad52fff5c9 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -9489,16 +9489,16 @@ class Form /** * Return an html string with a select combo box to choose yes or no * - * @param string $htmlname Name of html select field - * @param string $value Pre-selected value - * @param int $option 0 return yes/no, 1 return 1/0 - * @param bool $disabled true or false - * @param int $useempty 1=Add empty line - * @param int $addjscombo 1=Add js beautifier on combo box - * @param string $morecss More CSS - * @param string $labelyes Label for Yes - * @param string $labelno Label for No - * @return string See option + * @param string $htmlname Name of html select field + * @param string $value Pre-selected value + * @param int $option 0 return yes/no, 1 return 1/0 + * @param bool $disabled true or false + * @param int $useempty 1=Add empty line + * @param int $addjscombo 1=Add js beautifier on combo box + * @param string $morecss More CSS + * @param string $labelyes Label for Yes + * @param string $labelno Label for No + * @return string See option */ public function selectyesno($htmlname, $value = '', $option = 0, $disabled = false, $useempty = 0, $addjscombo = 0, $morecss = '', $labelyes = 'Yes', $labelno = 'No') { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index d9534099fd7..b044c997903 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1032,7 +1032,7 @@ body[class*="colorblind-"] .text-success{ color : } -.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, +.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, .editfielda span.fa-eye, .editfieldlang { color: #ccc !important; } diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 4ccaacce016..e91845038f4 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1289,7 +1289,7 @@ body[class*="colorblind-"] .text-success{ color : } -.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, +.editfielda span.fa-pencil-alt, .editfielda span.fa-pencil-ruler, .editfielda span.fa-trash, .editfielda span.fa-crop, .editfielda span.fa-eye, .editfieldlang { color: #ccc !important; }