gruffen commited on 2011-03-16 09:02:55
Showing 6 changed files, with 125 additions and 1 deletions.
... | ... |
@@ -49,6 +49,7 @@ $txt['shd_admin_standalone_options'] = 'Standalone Mode'; |
49 | 49 |
$txt['shd_admin_actionlog'] = 'Action Log'; |
50 | 50 |
$txt['shd_admin_support'] = 'Support'; |
51 | 51 |
$txt['shd_admin_helpdesklog'] = 'Helpdesk Log'; |
52 |
+$txt['shd_admin_emaillog'] = 'Email Log'; |
|
52 | 53 |
$txt['shd_admin_permissions'] = 'Permissions'; |
53 | 54 |
|
54 | 55 |
$txt['shd_admin_options_display'] = 'Display Options'; |
... | ... |
@@ -70,6 +71,9 @@ $txt['shd_admin_options_standalone_desc'] = 'This area manages the standalone mo |
70 | 71 |
$txt['shd_admin_options_actionlog_desc'] = 'This area allows you to configure what items can be logged within the helpdesk action log.'; |
71 | 72 |
$txt['shd_admin_options_notifications_desc'] = 'This area allows you to configure email notifications being sent to users when their tickets change.'; |
72 | 73 |
$txt['shd_admin_actionlog_desc'] = 'This is a list of all actions, such as resolved tickets, edited tickets and more, carried out in the helpdesk.'; |
74 |
+$txt['shd_admin_emaillog_desc'] = 'This is a record of the emails sent from the helpdesk, such as notifications.'; |
|
75 |
+$txt['shd_admin_emaillog_title'] = 'Helpdesk Emails Log'; |
|
76 |
+$txt['shd_notify_log_disabled'] = '<strong>Note:</strong> Logging of helpdesk emails is currently <strong>disabled</strong>, so no new log entries will be added.'; |
|
73 | 77 |
$txt['shd_admin_support_desc'] = 'This area will help you get through to SimpleDesk.net quickly and effectively - the post will include some information helpful for our Support team, about your installation (like SMF version and SimpleDesk version).'; |
74 | 78 |
$txt['shd_admin_help'] = 'This is the administration panel for the helpdesk. Here you can manage settings, get news and updates on this modification, and view helpdesk logs.'; |
75 | 79 |
//@} |
... | ... |
@@ -142,6 +142,11 @@ function shd_admin_info() |
142 | 142 |
'icon' => 'log.png', |
143 | 143 |
'title' => $txt['shd_admin_actionlog_title'], |
144 | 144 |
), |
145 |
+ 'emaillog' => array( |
|
146 |
+ 'function' => 'shd_admin_email_log', |
|
147 |
+ 'icon' => 'mail.png', |
|
148 |
+ 'title' => $txt['shd_admin_emaillog'], |
|
149 |
+ ), |
|
145 | 150 |
'support' => array( |
146 | 151 |
'function' => 'shd_admin_support', |
147 | 152 |
'icon' => 'support.png', |
... | ... |
@@ -160,6 +165,9 @@ function shd_admin_info() |
160 | 165 |
'actionlog' => array( |
161 | 166 |
'description' => $txt['shd_admin_actionlog_desc'] . '<br />' . (!empty($modSettings['shd_disable_action_log']) ? '<span class="smalltext">' . $txt['shd_action_log_disabled'] . '</span>' : ''), |
162 | 167 |
), |
168 |
+ 'emaillog' => array( |
|
169 |
+ 'description' => $txt['shd_admin_emaillog_desc'] . '<br />' . (empty($modSettings['shd_notify_log']) ? '<span class="smalltext">' . $txt['shd_notify_log_disabled'] . '</span>' : ''), |
|
170 |
+ ), |
|
163 | 171 |
'support' => array( |
164 | 172 |
'description' => $txt['shd_admin_support_desc'], |
165 | 173 |
), |
... | ... |
@@ -605,6 +613,7 @@ function shd_modify_notifications_options($return_config) |
605 | 613 |
global $context, $modSettings, $txt; |
606 | 614 |
|
607 | 615 |
$config_vars = array( |
616 |
+ array('check', 'shd_notify_log'), |
|
608 | 617 |
array('check', 'shd_notify_new_ticket'), |
609 | 618 |
array('check', 'shd_notify_new_reply_own'), |
610 | 619 |
array('check', 'shd_notify_new_reply_assigned'), |
... | ... |
@@ -705,11 +714,60 @@ function shd_admin_action_log() |
705 | 714 |
// Get all action log entries |
706 | 715 |
$context['actions'] = shd_load_action_log_entries($context['start'], $context['displaypage'], $context['sort'], $context['order']); |
707 | 716 |
|
708 |
- $context['page_index'] = shd_no_expand_pageindex($scripturl . '?action=admin;area=helpdesk_info;sa=actionlog' . $context['url_sort'] . $context['url_order'], $_REQUEST['start'], shd_count_action_log_entries(), $context['displaypage']); |
|
717 |
+ $context['page_index'] = shd_no_expand_pageindex($scripturl . '?action=admin;area=helpdesk_info;sa=actionlog' . $context['url_sort'] . $context['url_order'], $context['start'], shd_count_action_log_entries(), $context['displaypage']); |
|
709 | 718 |
|
710 | 719 |
$context['sub_template'] = 'shd_action_log'; |
711 | 720 |
} |
712 | 721 |
|
722 |
+/** |
|
723 |
+ * Initialises the email log. |
|
724 |
+ * |
|
725 |
+ * @since 1.1 |
|
726 |
+*/ |
|
727 |
+function shd_admin_email_log() |
|
728 |
+{ |
|
729 |
+ global $context, $settings, $scripturl, $txt, $sourcedir, $smcFunc; |
|
730 |
+ |
|
731 |
+ $context['displaypage'] = 15; |
|
732 |
+ $context['start'] = isset($_REQUEST['start']) ? $_REQUEST['start'] : 0; |
|
733 |
+ $context['sub_template'] = 'shd_email_log'; |
|
734 |
+ |
|
735 |
+ // First, how many items, total? |
|
736 |
+ $request = $smcFunc['db_query']('', ' |
|
737 |
+ SELECT COUNT(id_email) |
|
738 |
+ FROM {db_prefix}helpdesk_log_email', |
|
739 |
+ array() |
|
740 |
+ ); |
|
741 |
+ list($total_rows) = $smcFunc['db_fetch_row']($request); |
|
742 |
+ $smcFunc['db_free_result']($request); |
|
743 |
+ |
|
744 |
+ // Do the page index thang, which will also clean up pagination splendidly. |
|
745 |
+ $context['page_index'] = shd_no_expand_pageindex($scripturl . '?action=admin;area=helpdesk_info;sa=emaillog', $context['start'], $total_rows, $context['displaypage']); |
|
746 |
+ |
|
747 |
+ // Get the results |
|
748 |
+ $context['emails'] = array(); |
|
749 |
+ $request = $smcFunc['db_query']('', ' |
|
750 |
+ SELECT id_email, lang, timestamp, id_recipient, IFNULL(mem.real_name, {string:empty}) AS member_name, hle.email_address, subject, body |
|
751 |
+ FROM {db_prefix}helpdesk_log_email AS hle |
|
752 |
+ LEFT JOIN {db_prefix}members AS mem ON (hle.id_recipient = mem.id_member) |
|
753 |
+ ORDER BY id_email DESC |
|
754 |
+ LIMIT {int:start}, {int:limit}', |
|
755 |
+ array( |
|
756 |
+ 'empty' => '', |
|
757 |
+ 'limit' => $context['displaypage'], |
|
758 |
+ 'start' => $context['start'], |
|
759 |
+ ) |
|
760 |
+ ); |
|
761 |
+ while ($row = $smcFunc['db_fetch_assoc']($request)) |
|
762 |
+ { |
|
763 |
+ $row['time'] = timeformat($row['timestamp']); |
|
764 |
+ $row['language'] = str_replace('-utf8', '', $row['lang']); |
|
765 |
+ $row['body'] = str_replace("\n", '<br />', $row['body']); |
|
766 |
+ $context['emails'][$row['id_email']] = $row; |
|
767 |
+ } |
|
768 |
+ $smcFunc['db_free_result']($request); |
|
769 |
+} |
|
770 |
+ |
|
713 | 771 |
/** |
714 | 772 |
* Loads the support page for users to submit support requests directly to SimpleDesk.net |
715 | 773 |
* |
... | ... |
@@ -240,6 +240,7 @@ function shd_admin_bootstrap(&$admin_areas) |
240 | 240 |
'subsections' => array( |
241 | 241 |
'main' => array($txt['shd_admin_info']), |
242 | 242 |
'actionlog' => array($txt['shd_admin_actionlog'], 'enabled' => empty($modSettings['shd_disable_action_log'])), |
243 |
+ 'emaillog' => array($txt['shd_admin_emaillog'], 'enabled' => !empty($modSettings['shd_notify_log'])), |
|
243 | 244 |
'support' => array($txt['shd_admin_support']), |
244 | 245 |
), |
245 | 246 |
), |
... | ... |
@@ -638,6 +638,62 @@ function template_shd_action_log() |
638 | 638 |
</div>'; |
639 | 639 |
} |
640 | 640 |
|
641 |
+/** |
|
642 |
+ * Displays the email log. |
|
643 |
+ * |
|
644 |
+ * @see shd_admin_email_log() |
|
645 |
+ * @since 1.1 |
|
646 |
+*/ |
|
647 |
+function template_shd_email_log() |
|
648 |
+{ |
|
649 |
+ global $settings, $txt, $context, $scripturl, $sort_types, $modSettings; |
|
650 |
+ |
|
651 |
+ $use_bg2 = false; |
|
652 |
+ |
|
653 |
+ echo ' |
|
654 |
+ <div class="tborder"> |
|
655 |
+ <div class="cat_bar grid_header"> |
|
656 |
+ <h3 class="catbg"> |
|
657 |
+ <span class="floatright smalltext">', $txt['pages'], ': ', $context['page_index'], '</span> |
|
658 |
+ <img src="', $settings['default_images_url'], '/simpledesk/read.png" class="icon" alt="*" /> |
|
659 |
+ ', $txt['shd_admin_emaillog_title'], ' |
|
660 |
+ </h3> |
|
661 |
+ </div> |
|
662 |
+ <table class="shd_ticketlist" id="error_log" cellspacing="0" width="100%">'; |
|
663 |
+ |
|
664 |
+ foreach ($context['emails'] as $email) |
|
665 |
+ { |
|
666 |
+ echo ' |
|
667 |
+ <tr class="windowbg', $use_bg2 ? '2' : '', '"> |
|
668 |
+ <td rowspan="2" class="checkbox_column"> |
|
669 |
+ <input type="checkbox" name="delete[]" value="', $email['id_email'], '" /> |
|
670 |
+ </td> |
|
671 |
+ <td class="half_width">'; |
|
672 |
+ |
|
673 |
+ if (!empty($email['id_recipient'])) |
|
674 |
+ echo ' |
|
675 |
+ <img src="', $settings['default_images_url'], '/simpledesk/user.png" class="icon" alt="*" /> ', shd_profile_link($email['member_name'], $email['id_recipient']), '<br />'; |
|
676 |
+ |
|
677 |
+ echo ' |
|
678 |
+ <img src="', $settings['default_images_url'], '/simpledesk/unread.png" class="icon" alt="*" /> ', $email['email_address'], ' |
|
679 |
+ </td> |
|
680 |
+ <td class="half_width"> |
|
681 |
+ ', $email['time'], '<br /> |
|
682 |
+ ', $txt['subject'], ': ', $email['subject'], ' <img src="', $settings['default_images_url'], '/simpledesk/flags/', $email['language'], '.png" class="icon" alt="*" /> |
|
683 |
+ </td> |
|
684 |
+ </tr> |
|
685 |
+ <tr class="windowbg', $use_bg2 ? '2' : '', '"> |
|
686 |
+ <td colspan="2"> |
|
687 |
+ ', $email['body'], ' |
|
688 |
+ </td> |
|
689 |
+ </tr>'; |
|
690 |
+ $use_bg2 = !$use_bg2; |
|
691 |
+ } |
|
692 |
+ echo ' |
|
693 |
+ </table> |
|
694 |
+ </div>'; |
|
695 |
+} |
|
696 |
+ |
|
641 | 697 |
/** |
642 | 698 |
* Displays the get-support form for posting directly to the SimpleDesk support board. |
643 | 699 |
* |
644 | 700 |