diff --git a/include/ajax.config.php b/include/ajax.config.php index c259b6028f2ab42b3d615e0e097c5f5b3db7bb1c..239a7f5a4d687d84fbd6d60f8a913cb232772ddd 100644 --- a/include/ajax.config.php +++ b/include/ajax.config.php @@ -39,7 +39,7 @@ class ConfigAjaxAPI extends AjaxController { $config=array( 'lock_time' => ($cfg->getLockTime()*3600), - 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), + 'html_thread' => (bool) $cfg->isRichTextEnabled(), 'date_format' => $cfg->getDateFormat(true), 'lang' => $lang, 'short_lang' => $sl, @@ -66,7 +66,7 @@ class ConfigAjaxAPI extends AjaxController { } $config=array( - 'html_thread' => (bool) $cfg->isHtmlThreadEnabled(), + 'html_thread' => (bool) $cfg->isRichTextEnabled(), 'lang' => $lang, 'short_lang' => $sl, 'has_rtl' => $rtl, diff --git a/include/ajax.kbase.php b/include/ajax.kbase.php index 3909fd831598a3a23c3a4182cf5a3fb9f469a478..30575ac22b05ee80bcf3aa07d1e52ed9fe5d3b0a 100644 --- a/include/ajax.kbase.php +++ b/include/ajax.kbase.php @@ -26,7 +26,7 @@ class KbaseAjaxAPI extends AjaxController { if(!$id || !($canned=Canned::lookup($id)) || !$canned->isEnabled()) Http::response(404, 'No such premade reply'); - if (!$cfg->isHtmlThreadEnabled()) + if (!$cfg->isRichTextEnabled()) $format .= '.plain'; return $canned->getFormattedResponse($format); diff --git a/include/ajax.tickets.php b/include/ajax.tickets.php index 1e95dde3ec1c033f51fb70b13456739aafea7cfb..1fb4d5bc5bc070b37875b46e335f8ded7890acbd 100644 --- a/include/ajax.tickets.php +++ b/include/ajax.tickets.php @@ -340,7 +340,7 @@ class TicketsAjaxAPI extends AjaxController { $response = "<br/><blockquote>{$response->asVar()}</blockquote><br/>"; // Return text if html thread is not enabled - if (!$cfg->isHtmlThreadEnabled()) + if (!$cfg->isRichTextEnabled()) $response = Format::html2text($response, 90); else $response = Format::viewableImages($response); @@ -349,7 +349,7 @@ class TicketsAjaxAPI extends AjaxController { return Format::json_encode(array('response' => $response)); } - if (!$cfg->isHtmlThreadEnabled()) + if (!$cfg->isRichTextEnabled()) $format.='.plain'; $varReplacer = function (&$var) use($ticket) { diff --git a/include/class.config.php b/include/class.config.php index bbcea4eebc6ab293ff0845dbf1dcf93f3a7fc15b..73b6fc23c18f480aa8bba8ac7babd4721125a14a 100644 --- a/include/class.config.php +++ b/include/class.config.php @@ -365,7 +365,7 @@ class OsticketConfig extends Config { return $this->get('passwd_reset_period'); } - function isHtmlThreadEnabled() { + function isRichTextEnabled() { return $this->get('enable_html_thread'); } @@ -1073,6 +1073,7 @@ class OsticketConfig extends Config { 'system_language'=>$vars['system_language'], 'secondary_langs'=>$secondary_langs, 'max_file_size' => $vars['max_file_size'], + 'enable_html_thread' => isset($vars['enable_html_thread']) ? 1 : 0, )); } @@ -1150,7 +1151,6 @@ class OsticketConfig extends Config { 'show_answered_tickets'=>isset($vars['show_answered_tickets'])?0:1, 'show_related_tickets'=>isset($vars['show_related_tickets'])?1:0, 'hide_staff_name'=>isset($vars['hide_staff_name'])?1:0, - 'enable_html_thread'=>isset($vars['enable_html_thread'])?1:0, 'allow_client_updates'=>isset($vars['allow_client_updates'])?1:0, )); } diff --git a/include/class.forms.php b/include/class.forms.php index be6c35e5b92509c216948a1780b34917db4c1b95..c6b5d6810df9d6ec921535fb31e0c3b3d27402fa 100644 --- a/include/class.forms.php +++ b/include/class.forms.php @@ -2989,7 +2989,7 @@ class ThreadEntryWidget extends Widget { ?>: <span class="error">*</span></span><br/> <textarea style="width:100%;" name="<?php echo $this->field->get('name'); ?>" placeholder="<?php echo Format::htmlchars($this->field->get('hint')); ?>" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" <?php echo $attrs; ?> cols="21" rows="8" style="width:80%;"><?php echo $draft ?: Format::htmlchars($this->value); ?></textarea> diff --git a/include/class.mailer.php b/include/class.mailer.php index 83f097050624924326e9da6b22e90eeb041f5deb..cedb308d7982f29ae20c934ea468c0245e6a9143 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -417,7 +417,7 @@ class Mailer { $isHtml = false; } - if ($isHtml && $cfg && $cfg->isHtmlThreadEnabled()) { + if ($isHtml && $cfg && $cfg->isRichTextEnabled()) { // Pick a domain compatible with pear Mail_Mime $matches = array(); if (preg_match('#(@[0-9a-zA-Z\-\.]+)#', $this->getFromAddress(), $matches)) { diff --git a/include/class.mailfetch.php b/include/class.mailfetch.php index 8a8839a9eaa7e51919066d901b50c098bbab5e08..d1ad8fbec966ce1a9b6b08211d0aacd54afb3930 100644 --- a/include/class.mailfetch.php +++ b/include/class.mailfetch.php @@ -579,7 +579,7 @@ class MailFetcher { function getBody($mid) { global $cfg; - if ($cfg->isHtmlThreadEnabled()) { + if ($cfg->isRichTextEnabled()) { if ($html=$this->getPart($mid, 'text/html', $this->charset)) $body = new HtmlThreadEntryBody($html); elseif ($text=$this->getPart($mid, 'text/plain', $this->charset)) diff --git a/include/class.mailparse.php b/include/class.mailparse.php index 6564a4a22ac9f3190543c18aa4971ac06f1826ab..083e3b26c92818128b3ea8913a0cd267b64f31a8 100644 --- a/include/class.mailparse.php +++ b/include/class.mailparse.php @@ -303,7 +303,7 @@ class Mail_Parse { function getBody(){ global $cfg; - if ($cfg && $cfg->isHtmlThreadEnabled()) { + if ($cfg && $cfg->isRichTextEnabled()) { if ($html=$this->getPart($this->struct,'text/html')) $body = new HtmlThreadEntryBody($html); elseif ($text=$this->getPart($this->struct,'text/plain')) diff --git a/include/class.thread.php b/include/class.thread.php index 75d5a14a396bf1830b0708f89f6a6d0f7caeb72d..bce15899974ffee9e8cf36ae076afd78c14d0cc7 100644 --- a/include/class.thread.php +++ b/include/class.thread.php @@ -612,7 +612,7 @@ implements TemplateVariable { global $cfg; if (!$body instanceof ThreadEntryBody) { - if ($cfg->isHtmlThreadEnabled()) + if ($cfg->isRichTextEnabled()) $body = new HtmlThreadEntryBody($body); else $body = new TextThreadEntryBody($body); @@ -1221,7 +1221,7 @@ implements TemplateVariable { if (!$vars['body'] instanceof ThreadEntryBody) { - if ($cfg->isHtmlThreadEnabled()) + if ($cfg->isRichTextEnabled()) $vars['body'] = new HtmlThreadEntryBody($vars['body']); else $vars['body'] = new TextThreadEntryBody($vars['body']); diff --git a/include/class.ticket.php b/include/class.ticket.php index cde27c4783d845c497f9166bd6cbc4bd90207d84..d571a845db87e4fd9b9b345de29c12750a3aa66b 100644 --- a/include/class.ticket.php +++ b/include/class.ticket.php @@ -2282,7 +2282,7 @@ implements RestrictedAccess, Threadable, TemplateVariable { foreach ($canned->attachments->getAll() as $file) $files[] = $file['id']; - if ($cfg->isHtmlThreadEnabled()) + if ($cfg->isRichTextEnabled()) $response = new HtmlThreadEntryBody( $this->replaceVars($canned->getHtml())); else @@ -3413,7 +3413,7 @@ implements RestrictedAccess, Threadable, TemplateVariable { // Not assigned...save optional note if any if (!$vars['assignId'] && $vars['note']) { - if (!$cfg->isHtmlThreadEnabled()) { + if (!$cfg->isRichTextEnabled()) { $vars['note'] = new TextThreadBody($vars['note']); } $ticket->logNote(_S('New Ticket'), $vars['note'], $thisstaff, false); @@ -3438,7 +3438,7 @@ implements RestrictedAccess, Threadable, TemplateVariable { $message = (string) $ticket->getLastMessage(); if($response) { - $message .= ($cfg->isHtmlThreadEnabled()) ? "<br><br>" : "\n\n"; + $message .= ($cfg->isRichTextEnabled()) ? "<br><br>" : "\n\n"; $message .= $response->getBody(); } diff --git a/include/client/view.inc.php b/include/client/view.inc.php index 4f96855d7fe0822a3c14c7a27877d9c26bd601b3..2aead70b0e28f0bad62c61c7dca9c2546107cae7 100644 --- a/include/client/view.inc.php +++ b/include/client/view.inc.php @@ -197,7 +197,7 @@ if (!$ticket->isClosed() || $ticket->isReopenable()) { ?> <font class="error">* <?php echo $errors['message']; ?></font> </p> <textarea name="message" id="message" cols="50" rows="9" wrap="soft" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft" <?php list($draft, $attrs) = Draft::getDraftAndDataAttrs('ticket.client', $ticket->getId(), $info['message']); echo $attrs; ?>><?php echo $draft ?: $info['message']; diff --git a/include/i18n/en_US/help/tips/settings.system.yaml b/include/i18n/en_US/help/tips/settings.system.yaml index 8e88d0e299b8d503af7193b1b12fa2f2553b79c1..96d1a5e46f023c9cea5a85a9d74009b130f71a49 100644 --- a/include/i18n/en_US/help/tips/settings.system.yaml +++ b/include/i18n/en_US/help/tips/settings.system.yaml @@ -77,6 +77,12 @@ default_name_formatting: - title: Supported Email Template Variables href: http://osticket.com/wiki/Email_templates +enable_richtext: + title: Enable Rich Text + content: > + If enabled, this will permit the use of rich text formatting between + Clients and Agents. + # Date and time options date_time_options: title: Date & Time Options diff --git a/include/i18n/en_US/help/tips/settings.ticket.yaml b/include/i18n/en_US/help/tips/settings.ticket.yaml index 87d25e03633bd863d0841feae2ba991cf2ac9316..d6fac581e81a001f57207f6074ee04ad3dd11db5 100644 --- a/include/i18n/en_US/help/tips/settings.ticket.yaml +++ b/include/i18n/en_US/help/tips/settings.ticket.yaml @@ -122,12 +122,6 @@ staff_identity_masking: If enabled, this will hide the Agent’s name from the Client during any communication. -enable_html_ticket_thread: - title: Enable HTML Ticket Thread - content: > - If enabled, this will permit the use of rich text formatting between - Clients and Agents. - ticket_attachment_settings: title: Ticket Thread Attachments content: > diff --git a/include/staff/settings-system.inc.php b/include/staff/settings-system.inc.php index 4dd7742f3be83f11df1f301acc2d54399a4a3ac7..65a087d557611512a2a840e92a35e3d76fcdaeb8 100644 --- a/include/staff/settings-system.inc.php +++ b/include/staff/settings-system.inc.php @@ -120,6 +120,15 @@ $gmtime = Misc::gmtime(); <i class="help-tip icon-question-sign" href="#default_name_formatting"></i> </td> </tr> + <tr> + <td><?php echo __('Enable Rich Text'); ?>:</td> + <td> + <input type="checkbox" name="enable_html_thread" <?php + echo $config['enable_html_thread']?'checked="checked"':''; ?>> + <?php echo __('Enable html in thread entries and email correspondence.'); ?> + <i class="help-tip icon-question-sign" href="#enable_richtext"></i> + </td> + </tr> <tr> <th colspan="2"> <em><b><?php echo __('Date and Time Options'); ?></b> diff --git a/include/staff/settings-tickets.inc.php b/include/staff/settings-tickets.inc.php index a357b20d03b1a6190757f877d4b3eeb5f0ee8340..d3e1bb8f15fcdd129c22e1113d4fff5e00a56ca5 100644 --- a/include/staff/settings-tickets.inc.php +++ b/include/staff/settings-tickets.inc.php @@ -203,15 +203,6 @@ if(!($maxfileuploads=ini_get('max_file_uploads'))) <i class="help-tip icon-question-sign" href="#staff_identity_masking"></i> </td> </tr> - <tr> - <td><?php echo __('Enable HTML Ticket Thread'); ?>:</td> - <td> - <input type="checkbox" name="enable_html_thread" <?php - echo $config['enable_html_thread']?'checked="checked"':''; ?>> - <?php echo __('Enable rich text in ticket thread and autoresponse emails.'); ?> - <i class="help-tip icon-question-sign" href="#enable_html_ticket_thread"></i> - </td> - </tr> <tr> <th colspan="2"> <em><b><?php echo __('Attachments');?></b>: <?php echo __('Size and maximum uploads setting mainly apply to web tickets.');?></em> diff --git a/include/staff/templates/task-delete.tmpl.php b/include/staff/templates/task-delete.tmpl.php index eea44e19cc1710543a5febab3fefb648e20cb3b3..77cd9df4e6b98e9092be24aca5dadf4d0639fcaf 100644 --- a/include/staff/templates/task-delete.tmpl.php +++ b/include/staff/templates/task-delete.tmpl.php @@ -47,7 +47,7 @@ $action = $info[':action'] ?: ('#tasks/mass/delete'); ?> <textarea name="comments" id="comments" cols="50" rows="3" wrap="soft" style="width:100%" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> no-bar" placeholder="<?php echo $placeholder; ?>"><?php echo $info['comments']; ?></textarea> diff --git a/include/staff/templates/task-status.tmpl.php b/include/staff/templates/task-status.tmpl.php index d741aaafce72089c65299c2e83efd605a85c9086..8aba2d100c0fdaa56b4b77d3961e27bb15f231c7 100644 --- a/include/staff/templates/task-status.tmpl.php +++ b/include/staff/templates/task-status.tmpl.php @@ -76,7 +76,7 @@ $action = $info[':action'] ?: ('#tasks/mass/'. $action); ?> <textarea name="comments" id="comments" cols="50" rows="3" wrap="soft" style="width:100%" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> no-bar" placeholder="<?php echo $placeholder; ?>"><?php echo $info['comments']; ?></textarea> diff --git a/include/staff/templates/thread-entry-edit.tmpl.php b/include/staff/templates/thread-entry-edit.tmpl.php index 24e63230e1c8bf91730369ed35907c5096eabfeb..bab5e4eb65223cb4705a8499a3909ed58a404b7b 100644 --- a/include/staff/templates/thread-entry-edit.tmpl.php +++ b/include/staff/templates/thread-entry-edit.tmpl.php @@ -31,7 +31,7 @@ <?php } ?> name="body" class="large <?php - if ($cfg->isHtmlThreadEnabled() && $this->entry->format == 'html') + if ($cfg->isRichTextEnabled() && $this->entry->format == 'html') echo 'richtext'; ?>"><?php echo Format::viewableImages($this->entry->body); ?></textarea> diff --git a/include/staff/templates/ticket-status.tmpl.php b/include/staff/templates/ticket-status.tmpl.php index 458c6010c5b543ee79dd601af16ae43fa154bfbb..5da0e6619c563f15a7bea49f722f95113fae1ead 100644 --- a/include/staff/templates/ticket-status.tmpl.php +++ b/include/staff/templates/ticket-status.tmpl.php @@ -84,7 +84,7 @@ $action = $info['action'] ?: ('#tickets/status/'. $state); ?> <textarea name="comments" id="comments" cols="50" rows="3" wrap="soft" style="width:100%" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> no-bar" placeholder="<?php echo $placeholder; ?>"><?php echo $info['comments']; ?></textarea> diff --git a/include/staff/ticket-open.inc.php b/include/staff/ticket-open.inc.php index 80f4829e20f950bd81d30f13d5053e7ad0214cfb..65d4e37a089a479817311d01380e34a495678a64 100644 --- a/include/staff/ticket-open.inc.php +++ b/include/staff/ticket-open.inc.php @@ -306,7 +306,7 @@ if ($_POST) if ($thisstaff->getDefaultSignatureType() == 'mine') $signature = $thisstaff->getSignature(); ?> <textarea - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" data-signature="<?php echo Format::htmlchars(Format::viewableImages($signature)); ?>" data-signature-field="signature" data-dept-field="deptId" @@ -378,7 +378,7 @@ print $response_form->getField('attachments')->render(); <tr> <td colspan=2> <textarea - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" placeholder="<?php echo __('Optional internal note (recommended on assignment)'); ?>" name="note" cols="21" rows="6" style="width:80%;" <?php diff --git a/include/staff/ticket-view.inc.php b/include/staff/ticket-view.inc.php index 74407ea1952c951da73f9345baa0dc6fe88ddb5a..60043bd380d004baa06e81abd96b57919bc0c8ac 100644 --- a/include/staff/ticket-view.inc.php +++ b/include/staff/ticket-view.inc.php @@ -576,7 +576,7 @@ $tcount = $ticket->getThreadEntries($types)->count(); 'Start writing your response here. Use canned responses from the drop-down above' ); ?>" rows="9" wrap="soft" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" <?php list($draft, $attrs) = Draft::getDraftAndDataAttrs('ticket.response', $ticket->getId(), $info['response']); echo $attrs; ?>><?php echo $draft ?: $info['response']; @@ -691,7 +691,7 @@ $tcount = $ticket->getThreadEntries($types)->count(); <textarea name="note" id="internal_note" cols="80" placeholder="<?php echo __('Note details'); ?>" rows="9" wrap="soft" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> draft draft-delete" <?php list($draft, $attrs) = Draft::getDraftAndDataAttrs('ticket.note', $ticket->getId(), $info['note']); echo $attrs; ?>><?php echo $draft ?: $info['note']; @@ -786,7 +786,7 @@ $tcount = $ticket->getThreadEntries($types)->count(); <td> <textarea name="transfer_comments" id="transfer_comments" placeholder="<?php echo __('Enter reasons for the transfer'); ?>" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> no-bar" cols="80" rows="7" wrap="soft"><?php echo $info['transfer_comments']; ?></textarea> <span class="error"><?php echo $errors['transfer_comments']; ?></span> @@ -887,7 +887,7 @@ $tcount = $ticket->getThreadEntries($types)->count(); <textarea name="assign_comments" id="assign_comments" cols="80" rows="7" wrap="soft" placeholder="<?php echo __('Enter reasons for the assignment or instructions for assignee'); ?>" - class="<?php if ($cfg->isHtmlThreadEnabled()) echo 'richtext'; + class="<?php if ($cfg->isRichTextEnabled()) echo 'richtext'; ?> no-bar"><?php echo $info['assign_comments']; ?></textarea> <span class="error"><?php echo $errors['assign_comments']; ?></span><br> </td>