From 5b27b9c4648306c68d3f025ed6a08b284e8b7a2e Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 5 Jul 2015 22:03:09 -0400 Subject: [PATCH 01/16] #202 Display HTML-formatted versions of ticket messages Should add conditional to parse the HTML or to leave it alone, depending on the helpdesk's setting --- admin/admin_ticket.php | 4 ++-- ticket.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index cf9d1a84..1faa6e38 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1394,7 +1394,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');

:

-


 

+


 

@@ -1835,7 +1835,7 @@ function hesk_printTicketReplies() {

:

-

+

:

-


 

+


 

@@ -676,7 +676,7 @@ function hesk_printCustomerTicketReplies()

:

-

+

From edae4ffa37e9dd9f646fb107dec34b452c687f7d Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 5 Jul 2015 22:22:05 -0400 Subject: [PATCH 02/16] #202 Add setting for rich text --- install/mods-for-hesk/sql/installSql.php | 7 +++++++ modsForHesk_settings.inc.php | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index ca8e1d3e..d02f8338 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -574,6 +574,13 @@ function execute240FileUpdate() { //-- Column to sort categories by. Can be either \'name\' or \'cat_order\' $modsForHesk_settings[\'category_order_column\'] = \'cat_order\';'; } + if (strpos($file, '$modsForHesk_settings[\'rich_text_for_tickets\']') === false) + { + $file .= ' + + //-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable +$modsForHesk_settings[\'rich_text_for_tickets\'] = 0;'; + } return file_put_contents(HESK_PATH.'modsForHesk_settings.inc.php', $file); } \ No newline at end of file diff --git a/modsForHesk_settings.inc.php b/modsForHesk_settings.inc.php index 0c68bc26..e374e240 100644 --- a/modsForHesk_settings.inc.php +++ b/modsForHesk_settings.inc.php @@ -49,4 +49,7 @@ $modsForHesk_settings['show_number_merged'] = 1; $modsForHesk_settings['request_location'] = 0; //-- Column to sort categories by. Can be either 'name' or 'cat_order' -$modsForHesk_settings['category_order_column'] = 'cat_order'; \ No newline at end of file +$modsForHesk_settings['category_order_column'] = 'cat_order'; + +//-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable +$modsForHesk_settings['rich_text_for_tickets'] = 0; \ No newline at end of file From 035c5f092a4090b3d11db3e07284e10207b7fd7b Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 6 Jul 2015 22:13:50 -0400 Subject: [PATCH 03/16] #202 Add setting for rich text --- admin/admin_settings.php | 21 +++++++++++++++++++++ admin/admin_settings_save.php | 6 +++++- language/en/text.php | 2 ++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/admin/admin_settings.php b/admin/admin_settings.php index ec46f3d7..68a1df02 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -860,6 +860,27 @@ if ( defined('HESK_DEMO') ) ?>
+
+ +
+
    +
+ '; + ?> +
+
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 597fff54..e749b178 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -516,6 +516,7 @@ $set['mfh_attachments'] = empty($_POST['email_attachments']) ? 0 : 1; $set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1; $set['request_location'] = empty($_POST['request_location']) ? 0 : 1; $set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name'; +$set['rich_text_for_tickets'] = empty($_POST['rich_text_for_tickets']) ? 0 : 1; if ($set['customer-email-verification-required']) { @@ -584,7 +585,10 @@ $modsForHesk_settings[\'show_number_merged\'] = '.$set['show_number_merged'].'; $modsForHesk_settings[\'request_location\'] = '.$set['request_location'].'; //-- Column to sort categories by. Can be either \'name\' or \'cat_order\' -$modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\';'; +$modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\'; + +//-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable +$modsForHesk_settings[\'rich_text_for_tickets\'] = '.$set['rich_text_for_tickets'].';'; // Write the file if ( ! file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $modsForHesk_file_content) ) diff --git a/language/en/text.php b/language/en/text.php index a934805c..7b6dfe57 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -32,6 +32,8 @@ $hesklang['quick_help_sections_help'] = 'Check the checkbox to show the "Quick H $hesklang['create_ticket'] = 'Create ticket'; $hesklang['view_ticket_form'] = 'View ticket form'; $hesklang['knowledgebase'] = 'Knowledgebase section'; +$hesklang['allow_rich_text_for_tickets'] = 'Allow rich text for tickets'; +$hesklang['allow_rich_text_for_tickets_help'] = 'Allow staff and customers to use rich text formatting when writing ticket messages / replies.'; // ADDED OR MODIFIED IN Mods for HESK 2.3.0 $hesklang['sm_icon'] = 'Icon'; From fc5b47072be6317020106bfdffe7852d63ba9813 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 7 Jul 2015 22:16:36 -0400 Subject: [PATCH 04/16] #202 Start adding TinyMCE to admin pages. Still need to fix canned responses on admin_ticket though --- admin/admin_ticket.php | 27 +++++++++++++++-- admin/new_ticket.php | 59 ++++++++++++++++++++++++++++++------ modsForHesk_settings.inc.php | 2 +- 3 files changed, 76 insertions(+), 12 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 1faa6e38..d35ff59f 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -34,6 +34,7 @@ define('IN_SCRIPT',1); define('HESK_PATH','../'); +define('WYSIWYG',1); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); @@ -1870,9 +1871,31 @@ function hesk_printTicketReplies() { function hesk_printReplyForm() { - global $hesklang, $hesk_settings, $ticket, $admins, $can_options, $options, $can_assign_self, $isManager; + global $hesklang, $hesk_settings, $ticket, $admins, $can_options, $options, $can_assign_self, $isManager, $modsForHesk_settings; ?> + + +

@@ -1935,7 +1958,7 @@ function hesk_printReplyForm() {
-
+
'; break; @@ -548,6 +571,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); function setMessage(msgid) { + var useHtmlEditor = ; var myMsg=myMsgTxt[msgid]; var mySubject=mySubjectTxt[msgid]; @@ -555,7 +579,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); { if (document.form1.mode[1].checked) { - document.getElementById('message').value = ''; + if (useHtmlEditor) { + tinymce.get("message").setContent(''); + tinymce.get("message").execCommand('mceInsertRawHTML', false, ''); + } + else { + document.getElementById('message').value = ''; + } document.getElementById('subject').value = ''; } return true; @@ -564,16 +594,27 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); { if (document.getElementById('moderep').checked) { - document.getElementById('HeskMsg').innerHTML=''; - document.getElementById('HeskSub').innerHTML=''; + if (useHtmlEditor) { + tinymce.get("message").setContent(''); + tinymce.get("message").execCommand('mceInsertRawHTML', false, myMsg); + } else { + document.getElementById('message').value = myMsg; + } + document.getElementById('subject').value = mySubject; } else { - var oldMsg = document.getElementById('message').value; - document.getElementById('HeskMsg').innerHTML=''; + if (useHtmlEditor) { + var oldMsg = tinymce.get("message").getContent(); + tinymce.get("message").setContent(''); + tinymce.get("message").execCommand('mceInsertRawHTML', false, oldMsg + myMsg); + } else { + var oldMsg = document.getElementById('message').value; + document.getElementById('message').value = oldMsg + myMsg; + } if (document.getElementById('subject').value == '') { - document.getElementById('HeskSub').innerHTML=''; + document.getElementById('subject').value = mySubject; } } } @@ -649,7 +690,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ';} else {echo '
';} ?>
- +
@@ -805,7 +846,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); echo '
-
+
'; break; diff --git a/modsForHesk_settings.inc.php b/modsForHesk_settings.inc.php index e374e240..a1dfcd09 100644 --- a/modsForHesk_settings.inc.php +++ b/modsForHesk_settings.inc.php @@ -52,4 +52,4 @@ $modsForHesk_settings['request_location'] = 0; $modsForHesk_settings['category_order_column'] = 'cat_order'; //-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable -$modsForHesk_settings['rich_text_for_tickets'] = 0; \ No newline at end of file +$modsForHesk_settings['rich_text_for_tickets'] = 1; \ No newline at end of file From 9dd83e9f41576014870087018ac1a0900ce2d5d4 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 9 Jul 2015 21:48:06 -0400 Subject: [PATCH 05/16] #208 Don't use TinyMCE for custom fields --- admin/new_ticket.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/new_ticket.php b/admin/new_ticket.php index b9d52610..8799deac 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -466,7 +466,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); echo '
-
+
'; break; @@ -846,7 +846,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); echo '
-
+
'; break; From f75cc87c104fbf92afa6f874f8c4f03727d623f9 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 9 Jul 2015 22:13:16 -0400 Subject: [PATCH 06/16] #208 Fix rendering of HTML and for signatures --- admin/admin_reply_ticket.php | 16 +++++++++++----- admin/admin_submit_ticket.php | 7 +++++-- admin/admin_ticket.php | 2 +- css/hesk_newStyle.php | 7 ++++++- css/hesk_newStyleRTL.php | 7 ++++++- 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/admin/admin_reply_ticket.php b/admin/admin_reply_ticket.php index 71845a7c..dc1e5d69 100644 --- a/admin/admin_reply_ticket.php +++ b/admin/admin_reply_ticket.php @@ -138,14 +138,20 @@ if (strlen($message)) // Attach signature to the message? if ( ! $submit_as_customer && ! empty($_POST['signature'])) { - $message .= "\n\n" . addslashes($_SESSION['signature']) . "\n"; + if ($modsForHesk_settings['rich_text_for_tickets']) { + $message .= "

" . nl2br($_SESSION['signature']) . "
"; + } else { + $message .= "\n\n" . addslashes($_SESSION['signature']) . "\n"; + } } - // Make links clickable - $message = hesk_makeURL($message); + if (!$modsForHesk_settings['rich_text_for_tickets']) { + // Make links clickable + $message = hesk_makeURL($message); - // Turn newlines into
tags - $message = nl2br($message); + // Turn newlines into
tags + $message = nl2br($message); + } } else { diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index c3ad79a0..e166aaaa 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -37,6 +37,7 @@ define('HESK_PATH','../'); // Get all the required files and functions require(HESK_PATH . 'hesk_settings.inc.php'); +require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -269,8 +270,10 @@ if ($hesk_settings['attachments']['use'] && !empty($attachments)) } } -$tmpvar['message']=hesk_makeURL($tmpvar['message']); -$tmpvar['message']=nl2br($tmpvar['message']); +if (!$modsForHesk_settings['rich_text_for_tickets']) { + $tmpvar['message']=hesk_makeURL($tmpvar['message']); + $tmpvar['message']=nl2br($tmpvar['message']); +} $tmpvar['latitude'] = hesk_POST('latitude', 'E-4'); $tmpvar['longitude'] = hesk_POST('longitude', 'E-4'); diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index d35ff59f..d937fd17 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1395,7 +1395,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');

:

-


 

+
diff --git a/css/hesk_newStyle.php b/css/hesk_newStyle.php index f9dd3585..2b8ffef2 100644 --- a/css/hesk_newStyle.php +++ b/css/hesk_newStyle.php @@ -193,11 +193,16 @@ font-size: 15px; background-color: #fff; } -.ticketMessageBottom > p.message { +.ticketMessageBottom > .message { margin-bottom: 0px; } +.message > ul { + margin-top: 0; + margin-bottom: 0; +} + .ticketMessage { margin-left: 238px; background: #fff; diff --git a/css/hesk_newStyleRTL.php b/css/hesk_newStyleRTL.php index 82541dc0..a467f342 100644 --- a/css/hesk_newStyleRTL.php +++ b/css/hesk_newStyleRTL.php @@ -196,11 +196,16 @@ font-size: 15px; background-color: #fff; } -.ticketMessageBottom > p.message { +.ticketMessageBottom > .message { margin-bottom: 0px; } +.ticketMessageBottom > ul { + margin-top: 0; + margin-bottom: 0; +} + .ticketMessage { margin-right: 238px; background: #fff; From ffabc4e67d0464dd89d9c3f3facddbfcb7681de5 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 12 Jul 2015 22:10:58 -0400 Subject: [PATCH 07/16] #202 Only decode HTML if rich text is enabled --- admin/admin_ticket.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index d937fd17..e555637e 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1395,7 +1395,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');

:

-
+
+ +
@@ -1836,7 +1842,11 @@ function hesk_printTicketReplies() {

:

-

+

Date: Tue, 14 Jul 2015 22:13:58 -0400 Subject: [PATCH 08/16] #208 Fix print view --- print.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/print.php b/print.php index f3a564d7..5dc2a851 100644 --- a/print.php +++ b/print.php @@ -159,7 +159,7 @@ $random=mt_rand(10000,99999); // Print ticket head echo ' -

'.$ticket[subject].'

+

'.$ticket['subject'].'


From 5068c5ba2d809fb3b4104267f5d00fba55217fcd Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 14 Jul 2015 22:21:28 -0400 Subject: [PATCH 09/16] #208 Add TinyMCE to client side and fix edit post for admin --- admin/admin_ticket.php | 2 +- admin/edit_post.php | 29 ++++++++++++++++++++++++++++- css/hesk_newStyle.php | 2 +- css/hesk_newStyleRTL.php | 2 +- inc/header.inc.php | 2 +- index.php | 25 ++++++++++++++++++++++++- print.php | 23 ++++++++++++++++++++--- ticket.php | 37 ++++++++++++++++++++++++++++++++----- 8 files changed, 108 insertions(+), 14 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index e555637e..ffeafc61 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1815,7 +1815,7 @@ function print_form() function hesk_printTicketReplies() { - global $hesklang, $hesk_settings, $result, $reply, $isManager; + global $hesklang, $hesk_settings, $result, $reply, $isManager, $modsForHesk_settings; $i = $hesk_settings['new_top'] ? 0 : 1; diff --git a/admin/edit_post.php b/admin/edit_post.php index 7e281b4f..2a399819 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -34,9 +34,11 @@ define('IN_SCRIPT',1); define('HESK_PATH','../'); +define('WYSIWYG',1); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); +require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -453,7 +455,10 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
- + +
@@ -478,6 +483,28 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
+ + + ul { +.message > * { margin-top: 0; margin-bottom: 0; } diff --git a/css/hesk_newStyleRTL.php b/css/hesk_newStyleRTL.php index a467f342..86541710 100644 --- a/css/hesk_newStyleRTL.php +++ b/css/hesk_newStyleRTL.php @@ -201,7 +201,7 @@ } -.ticketMessageBottom > ul { +.message > * { margin-top: 0; margin-bottom: 0; } diff --git a/inc/header.inc.php b/inc/header.inc.php index 1f57b1a7..14a67eb0 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -97,7 +97,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php'); if (defined('WYSIWYG') && $hesk_settings['kb_wysiwyg']) { ?> - +
- + + + +
diff --git a/print.php b/print.php index 5dc2a851..47af6670 100644 --- a/print.php +++ b/print.php @@ -98,12 +98,20 @@ $replies = hesk_dbNumRows($res); <?php echo $hesk_settings['hesk_title']; ?>