! Reverse the polarity of the neutron flow for admins being excluded from notifications. While we're at it, make sure admins are stripped from the list if by certain circumstances they might otherwise have been added. [Bug 750] ! Added 2.0 final compatibility, removing RC5 compat in the process. As noted there was an editor size issue amongst other things. [Bug 751] ! Notifications options should be turned on by default in a totally fresh install. ! Go up/down is on. It's not optional because I take the view that it's unobtrusive enough that it can stay, and honestly, I'm not sure why it's actually *optional* in SMF anyway... it's sufficiently unobtrusive that those who don't use it won't notice it anyway. [Feature 461]
gruffen

gruffen commited on 2011-06-11 18:41:41
Showing 8 changed files, with 57 additions and 14 deletions.


Well, hopefully my 1000th rev was worth it ;)
... ...
@@ -13,8 +13,8 @@
13 13
 # Any questions, please contact SimpleDesk.net            #
14 14
 #                                                         #
15 15
 ###########################################################
16
-# SimpleDesk Version: 1.0 Felidae                         #
17
-# File Info: install.php / 1.0 Felidae                    #
16
+# SimpleDesk Version: 2.0 Anatidae                        #
17
+# File Info: install.php / 2.0 Anatidae                   #
18 18
 ###########################################################
19 19
 
20 20
 /**
... ...
@@ -77,6 +77,15 @@ $new_settings = array(
77 77
 	'shd_logopt_editposts' => 1,
78 78
 	'shd_thank_you_post' => 1,
79 79
 	'shd_zerofill' => 5,
80
+	'shd_notify_log' => 1,
81
+	'shd_notify_with_body' => 1,
82
+	'shd_notify_new_ticket' => 1,
83
+	'shd_notify_new_reply_own' => 1,
84
+	'shd_notify_new_reply_assigned' => 1,
85
+	'shd_notify_new_reply_previous' => 1,
86
+	'shd_notify_new_reply_any' => 1,
87
+	'shd_notify_assign_me' => 1,
88
+	'shd_notify_assign_own' => 1,
80 89
 );
81 90
 
82 91
 foreach ($new_settings as $k => $v)
... ...
@@ -6,11 +6,11 @@
6 6
 	<version>2.0</version>
7 7
 	<type>modification</type>
8 8
 
9
-	<install for="1.1.*, 2.0 RC2, 2.0 RC3, 2.0 RC4">
10
-		<readme lang="english" parsebbc="true" type="inline">This mod is [b]not compatible[/b] with your version of SMF, it requires facilities only in 2.0 RC5 and above.</readme>
9
+	<install for="1.1.*, 2.0 RC2, 2.0 RC3, 2.0 RC4, 2.0 RC5">
10
+		<readme lang="english" parsebbc="true" type="inline">This mod is [b]not compatible[/b] with your version of SMF, it requires 2.0 final or later.</readme>
11 11
 	</install>
12 12
 
13
-	<install for="2.0 RC5">
13
+	<install for="2.0">
14 14
 		<!-- readme files -->
15 15
 		<readme lang="english" parsebbc="true" type="file">language-readme/readme.english.txt</readme>
16 16
 
... ...
@@ -56,7 +56,7 @@
56 56
 		<redirect url="?action=admin;area=corefeatures#js_feature_shd" />
57 57
 	</install>
58 58
 
59
-	<uninstall for="2.0 RC5">
59
+	<uninstall for="2.0">
60 60
 		<!-- database changes, undone -->
61 61
 		<database>uninstall-optional.php</database>
62 62
 		<code type="file">uninstall-required.php</code>
... ...
@@ -218,6 +218,9 @@ $txt['shd_ticket_private'] = 'Private';
218 218
 $txt['shd_ticket_change'] = 'Change';
219 219
 $txt['shd_ticket_ip'] = 'IP address';
220 220
 $txt['shd_back_to_hd'] = 'Back to the helpdesk';
221
+$txt['shd_go_to_replies'] = 'Go to Replies';
222
+$txt['shd_go_to_action_log'] = 'Go to Action Log';
223
+$txt['shd_go_to_replies_start'] = 'Go to the first reply';
221 224
 
222 225
 $txt['shd_ticket_has_been_deleted'] = 'This ticket is currently in the recycle bin and cannot be altered without being returned to the helpdesk.';
223 226
 $txt['shd_ticket_replies_deleted'] = 'This ticket has had replies deleted from it previously.';
... ...
@@ -623,7 +623,7 @@ function shd_ajax_notify()
623 623
 	);
624 624
 
625 625
 	// Let's get all the possible actual people. The possible people who can be notified... well, they're staff.
626
-	$staff = shd_get_visible_list($ticket['id_dept'], $ticket['private'], $ticket['id_member_started'], !empty($modSettings['shd_admins_not_assignable']), false);
626
+	$staff = shd_get_visible_list($ticket['id_dept'], $ticket['private'], $ticket['id_member_started'], empty($modSettings['shd_admins_not_assignable']), false);
627 627
 
628 628
 	// Let's start figuring it out then! First, get the big ol' lists.
629 629
 	$query = $smcFunc['db_query']('', '
... ...
@@ -637,6 +637,14 @@ function shd_ajax_notify()
637 637
 	while ($row = $smcFunc['db_fetch_assoc']($query))
638 638
 		$notify_list[$row['notify_state'] == NOTIFY_NEVER ? 'optional_butoff' : 'being_notified'][$row['id_member']] = true;
639 639
 
640
+	// Did we exclude admins? If we did, we would have scooped the list of admins. If they're in the 'not being notified but you can...' list, remove them.
641
+	if (!empty($context['list_admin_exclude']))
642
+	{
643
+		foreach ($context['list_admin_exclude'] as $user_id)
644
+			if (isset($notify_list['optional_butoff'][$user_id]))
645
+				unset($notify_list['optional_butoff'][$user_id]);
646
+	}
647
+
640 648
 	// Now we get the list by preferences. This is where it starts to get complicated.
641 649
 	$possible_members = array();
642 650
 	// People who want replies to their own ticket, without including the ticket starter because they'd know about it...
... ...
@@ -636,6 +636,19 @@ function shd_view_ticket()
636 636
 		'text' => 'shd_ticket_move_to_topic',
637 637
 	);
638 638
 
639
+	// While we're at it, set up general navigation for this ticket. We'll sort out access to the action log later.
640
+	$context['navigation']['replies'] = array(
641
+		'text' => 'shd_go_to_replies',
642
+		'lang' => true,
643
+		'url' => '#replies',
644
+	);
645
+	$context['navigation']['ticketlog'] = array(
646
+		'text' => 'shd_go_to_action_log',
647
+		'test' => 'display_ticket_log',
648
+		'lang' => true,
649
+		'url' => '#ticket_log_header',
650
+	);
651
+
639 652
 	// If we are going SMF style with the navigation, we need to rework the structure a wee bit.
640 653
 	// No sense making a new array, mind, just fix up the existing one a touch, and don't do this on the master as we don't always need it.
641 654
 	if (empty($modSettings['shd_ticketnav_style']) || !in_array($modSettings['shd_ticketnav_style'], array('sd', 'sdcompact', 'smf')))
... ...
@@ -35,7 +35,7 @@ function shd_notifications_notify_newticket(&$msgOptions, &$ticketOptions, &$pos
35 35
 		return;
36 36
 
37 37
 	// So, we're getting the list of people that are being affected by this ticket being posted. Basically, that's a list of staff on new ticket, less people who've set preferences otherwise.
38
-	$members = shd_get_visible_list($ticketOptions['dept'], $ticketOptions['private'], false, !empty($modSettings['shd_admins_not_assignable']), false);
38
+	$members = shd_get_visible_list($ticketOptions['dept'], $ticketOptions['private'], false, empty($modSettings['shd_admins_not_assignable']), false);
39 39
 	if (empty($members))
40 40
 		return;
41 41
 
... ...
@@ -98,7 +98,7 @@ function shd_notifications_notify_newreply(&$msgOptions, &$ticketOptions, &$post
98 98
 	// We're doing various things here, so grab some general details, not just what we may have been passed before.
99 99
 	$ticketinfo = shd_load_ticket($ticketOptions['id']);
100 100
 	// $staff is the sum total of staff + ticket starter, subject to visibility of the ticket.
101
-	$staff = shd_get_visible_list($ticketOptions['dept'], $ticketinfo['private'], $ticketinfo['starter_id'], !empty($modSettings['shd_admins_not_assignable']), false);
101
+	$staff = shd_get_visible_list($ticketOptions['dept'], $ticketinfo['private'], $ticketinfo['starter_id'], empty($modSettings['shd_admins_not_assignable']), false);
102 102
 
103 103
 	// Might as well kick this off here.
104 104
 	$notify_data = array(
... ...
@@ -792,12 +792,12 @@ function shd_get_visible_list($dept, $private, $ticket_starter = 0, $include_adm
792 792
 			array()
793 793
 		);
794 794
 
795
-		$admins = array();
795
+		$context['list_admin_exclude'] = array();
796 796
 		while ($row = $smcFunc['db_fetch_row']($query))
797
-			$admins[] = $row[0];
797
+			$context['list_admin_exclude'][] = $row[0];
798 798
 
799 799
 		$smcFunc['db_free_result']($query);
800
-		$people = array_diff($people, $admins);
800
+		$people = array_diff($people, $context['list_admin_exclude']);
801 801
 	}
802 802
 
803 803
 	if (!$include_current_user)
... ...
@@ -27,7 +27,7 @@ function template_viewticket()
27 27
 	global $context, $txt, $scripturl, $settings, $modSettings, $options;
28 28
 
29 29
 	// Back to the helpdesk.
30
-	echo '<div class="floatleft">', template_button_strip(array($context['navigation']['back']), 'bottom'), '</div>', ($modSettings['shd_ticketnav_style'] != 'smf' ? '<br class="clear" /><br />' : ''), '';
30
+	echo '<div class="floatleft">', template_button_strip(array($context['navigation']['back'], $context['navigation']['replies'], $context['navigation']['ticketlog']), 'bottom'), '</div>', ($modSettings['shd_ticketnav_style'] != 'smf' ? '<br class="clear" /><br />' : ''), '';
31 31
 
32 32
 	if ($modSettings['shd_ticketnav_style'] == 'smf')
33 33
 	{
... ...
@@ -884,7 +884,7 @@ function template_viewreplies()
884 884
 								</span>
885 885
 								<a href="', $reply['link'], '">', sprintf($txt['shd_reply_written'], $reply['time']), '</a>
886 886
 							</div>
887
-							<hr class="clearfix" />
887
+							<hr />
888 888
 							', $reply['body'], '
889 889
 							<br /><br />';
890 890
 
... ...
@@ -950,6 +950,7 @@ function template_viewreplies()
950 950
 
951 951
 	echo '
952 952
 				</div>
953
+				<span class="floatleft shd_nowrap"><a href="#replies" title="', $txt['shd_go_to_replies_start'], '"><img src="', $settings['default_images_url'], '/simpledesk/move_up.png" alt="" /><img src="', $settings['default_images_url'], '/simpledesk/replies.png" alt="" /></a></span>
953 954
 				<span class="floatright smalltext">', $txt['pages'], ': ', $context['page_index'], '</span>
954 955
 				<br class="clear" />
955 956
 			</div>
... ...
@@ -1101,6 +1102,7 @@ function template_ticketactionlog()
1101 1102
 		echo '
1102 1103
 						<tr class="titlebg">
1103 1104
 							<td colspan="3">
1105
+								<span class="floatright shd_nowrap"><a href="#replies" title="', $txt['shd_go_to_replies_start'], '"><img src="', $settings['default_images_url'], '/simpledesk/move_up.png" alt="" /><img src="', $settings['default_images_url'], '/simpledesk/replies.png" alt="" /></a></span>
1104 1106
 								', !empty($context['ticket_full_log']) ? '<span class="smalltext shd_main_log"><img src="' . $settings['default_images_url'] . '/simpledesk/browse.png" alt="" /> <a href="' . $scripturl . '?action=admin;area=helpdesk_info;sa=actionlog">' . $txt['shd_ticket_log_full'] . '</a></span>' : '', '
1105 1107
 							</td>
1106 1108
 						</tr>
... ...
@@ -518,6 +518,14 @@ function template_ticket_postbox()
518 518
 						<div id="shd_bbcbox"', ((empty($modSettings['shd_allow_ticket_bbc']) || !empty($context['shd_display'])) ? ' style="display:none;"' : ''), '></div>
519 519
 						<div id="shd_smileybox"', ((empty($modSettings['shd_allow_ticket_smileys']) || !empty($context['shd_display'])) ? ' style="display:none;"' : ''), '></div>';
520 520
 
521
+	if ($editor_context['width'] == ((int) $editor_context['width']) . '%')
522
+	{
523
+		$width = round(((int) $editor_context['width']) / 0.988, 1);
524
+		echo '
525
+						<div style="width: ', $width, '%;">', template_control_richedit($context['post_box_name'], 'shd_smileybox', 'shd_bbcbox'), '</div>';
526
+	}
527
+	// Editor width isn't proportional, presumably we don't care.
528
+	else
521 529
 		echo template_control_richedit($context['post_box_name'], 'shd_smileybox', 'shd_bbcbox');
522 530
 
523 531
 	// Custom fields
524 532