Fix a bug found in hold for user preferences Fix button strip complaints from CI
jdarwood007

jdarwood007 commited on 2019-03-09 12:19:46
Showing 12 changed files, with 39 additions and 24 deletions.

... ...
@@ -131,6 +131,7 @@ $txt['shd_pref_block_order_user_block'] = 'Normal ordering of tickets in the "Ti
131 131
 $txt['shd_pref_block_order_closed_block'] = 'Normal ordering of tickets in the "Closed Tickets" block';
132 132
 $txt['shd_pref_block_order_recycle_block'] = 'Normal ordering of tickets in the "Recycled Tickets" block';
133 133
 $txt['shd_pref_block_order_withdeleted_block'] = 'Normal ordering of tickets in the "Tickets with Deleted Replies" block';
134
+$txt['shd_pref_block_order_hold_block'] = 'Normal ordering of tickets in the "Tickets On Hold" block';
134 135
 
135 136
 $txt['shd_pref_block_order_ticketid_asc'] = 'Ticket number - lowest first';
136 137
 $txt['shd_pref_block_order_ticketid_desc'] = 'Ticket number - highest first';
... ...
@@ -20,7 +20,7 @@ function template_shd_frontpage()
20 20
 	echo '
21 21
 		<div class="modbuttons clearfix margintop">';
22 22
 
23
-	template_button_strip($context['navigation'], 'bottom');
23
+	template_shd_button_strip($context['navigation'], 'bottom');
24 24
 
25 25
 	echo '
26 26
 		</div>
... ...
@@ -520,7 +520,7 @@ function shd_save_ticket()
520 520
 	if (!empty($context['ticket_id']) && !empty($ticketinfo) && !empty($ticketinfo['starter_id']))
521 521
 	{
522 522
 		loadMemberData($ticketinfo['starter_id']);
523
-		if (isset($memberContext[$ticketinfo['starter_id']]) && loadMemberContext($ticketinfo['starter_id']))
523
+		if (isset($ticketinfo, $memberContext[$ticketinfo['starter_id']]) && loadMemberContext($ticketinfo['starter_id']))
524 524
 			$context['ticket_form']['member'] = array(
525 525
 				'name' => $ticketinfo['starter_name'],
526 526
 				'id' => $ticketinfo['starter_id'],
... ...
@@ -1412,12 +1412,23 @@ function shd_load_user_prefs($user = 0)
1412 1412
 				'permission' => 'shd_access_recyclebin',
1413 1413
 				'show' => true,
1414 1414
 			),
1415
+			'block_order_hold_block' => array(
1416
+				'default' => 'updated_asc',
1417
+				'type' => 'select',
1418
+				'icon' => 'ticket_hold.png',
1419
+				'group' => 'block_order',
1420
+				'permission' => 'access_helpdesk',
1421
+				'show' => true,
1422
+			),
1415 1423
 		);
1416 1424
 
1417 1425
 		// We want to add the preferences per block. Because we already know what options there are per block elsewhere, let's reuse that.
1418 1426
 		if (!function_exists('shd_get_block_columns'))
1419 1427
 			require_once($sourcedir . '/sd_source/SimpleDesk.php');
1420 1428
 		$blocks = array('assigned', 'new', 'staff', shd_allowed_to('shd_staff', 0) ? 'user_staff' : 'user_user', 'closed', 'recycled', 'withdeleted');
1429
+		if (shd_allowed_to('shd_staff', 0))
1430
+			$blocks[] = 'hold';
1431
+
1421 1432
 		foreach ($blocks as $block)
1422 1433
 		{
1423 1434
 			$items = shd_get_block_columns($block);
... ...
@@ -1430,7 +1441,7 @@ function shd_load_user_prefs($user = 0)
1430 1441
 				$block = 'recycle';
1431 1442
 			$block_id = 'block_order_' . $block . '_block';
1432 1443
 			$base_prefs[$block_id]['options'] = array();
1433
-			foreach ($items as $item)
1444
+			foreach ($items as $item => $width)
1434 1445
 			{
1435 1446
 				if ($item != 'actions')
1436 1447
 				{
... ...
@@ -26,7 +26,7 @@ function template_assign()
26 26
 	if (empty($context['shd_return_to']))
27 27
 		$context['shd_return_to'] = 'ticket';
28 28
 
29
-		template_button_strip(array($context['navigation']['back']));
29
+		template_shd_button_strip(array($context['navigation']['back']));
30 30
 
31 31
 	echo '
32 32
 	<div class="cat_bar">
... ...
@@ -28,10 +28,10 @@ function template_viewticket()
28 28
 
29 29
 	// SMF style icons go first.
30 30
 	if ($modSettings['shd_ticketnav_style'] == 'smf')
31
-		template_button_strip($context['ticket_navigation'], 'right');
31
+		template_shd_button_strip($context['ticket_navigation'], 'right');
32 32
 
33 33
 	// Back to the helpdesk.
34
-	template_button_strip(array($context['navigation']['back'], $context['navigation']['replies'], $context['navigation']['ticketlog']));
34
+	template_shd_button_strip(array($context['navigation']['back'], $context['navigation']['replies'], $context['navigation']['ticketlog']));
35 35
 
36 36
 	echo '
37 37
 		<div class="cat_bar">
... ...
@@ -24,7 +24,7 @@ function template_movedept()
24 24
 		$context['shd_return_to'] = 'ticket';
25 25
 
26 26
 	// Back to the helpdesk.
27
-	template_button_strip(array($context['navigation']['back']), 'bottom');
27
+	template_shd_button_strip(array($context['navigation']['back']), 'bottom');
28 28
 
29 29
 	echo '
30 30
 	<div class="cat_bar">
... ...
@@ -19,7 +19,7 @@ function template_ticket_post()
19 19
 {
20 20
 	global $context;
21 21
 
22
-	template_button_strip(array($context['navigation']['back']));
22
+	template_shd_button_strip(array($context['navigation']['back']));
23 23
 	template_preview();
24 24
 	template_ticket_info();
25 25
 	template_ticket_subjectbox();
... ...
@@ -305,7 +305,7 @@ function template_shd_profile_show_tickets()
305 305
 				</div>';
306 306
 
307 307
 	// The navigation.
308
-	template_button_strip($context['show_tickets_navigation']);
308
+	template_shd_button_strip($context['show_tickets_navigation']);
309 309
 
310 310
 	// Pagination
311 311
 	echo '
... ...
@@ -370,7 +370,7 @@ function template_shd_profile_show_notify_override()
370 370
 				</div>';
371 371
 
372 372
 	// The navigation.
373
-	template_button_strip($context['show_tickets_navigation']);
373
+	template_shd_button_strip($context['show_tickets_navigation']);
374 374
 
375 375
 	echo '
376 376
 				<table class="table_grid">
... ...
@@ -19,7 +19,7 @@ function template_search()
19 19
 	global $context, $txt, $scripturl, $settings, $modSettings;
20 20
 
21 21
 	// Back to the helpdesk.
22
-	template_button_strip(array($context['navigation']['back']));
22
+	template_shd_button_strip(array($context['navigation']['back']));
23 23
 
24 24
 	if (!empty($modSettings['shd_new_search_index']))
25 25
 		echo '
... ...
@@ -155,7 +155,7 @@ function template_search_no_results()
155 155
 	global $context, $txt, $scripturl, $settings, $modSettings;
156 156
 
157 157
 	// Back to the helpdesk.
158
-	template_button_strip(array($context['navigation']['back'], $context['navigation']['search']));
158
+	template_shd_button_strip(array($context['navigation']['back'], $context['navigation']['search']));
159 159
 
160 160
 	echo '
161 161
 	<div class="cat_bar">
... ...
@@ -268,7 +268,7 @@ function template_search_results()
268 268
 	global $context, $txt, $scripturl, $settings, $modSettings, $smcFunc;
269 269
 
270 270
 	// Back to the helpdesk.
271
-	template_button_strip(array($context['navigation']['back'], $context['navigation']['search']));
271
+	template_shd_button_strip(array($context['navigation']['back'], $context['navigation']['search']));
272 272
 
273 273
 	echo '
274 274
 	<div class="cat_bar">
... ...
@@ -26,7 +26,7 @@ function template_shd_tickettotopic()
26 26
 {
27 27
 	global $txt, $settings, $context, $scripturl, $modSettings;
28 28
 
29
-	template_button_strip(array($context['navigation']['back']));
29
+	template_shd_button_strip(array($context['navigation']['back']));
30 30
 
31 31
 	echo '
32 32
 		<div class="cat_bar">
... ...
@@ -24,7 +24,7 @@ function template_main()
24 24
 {
25 25
 	global $context, $txt, $settings, $scripturl;
26 26
 
27
-	template_button_strip($context['navigation'], 'bottom');
27
+	template_shd_button_strip($context['navigation'], 'bottom');
28 28
 
29 29
 	echo '
30 30
 		<div class="title_bar">
... ...
@@ -97,7 +97,7 @@ function template_shd_depts()
97 97
 {
98 98
 	global $context, $txt, $settings, $scripturl;
99 99
 
100
-	template_button_strip($context['navigation'], 'bottom');
100
+	template_shd_button_strip($context['navigation'], 'bottom');
101 101
 
102 102
 	echo '
103 103
 		<div class="title_bar">
... ...
@@ -175,7 +175,7 @@ function template_closedtickets()
175 175
 {
176 176
 	global $context, $txt, $settings, $scripturl;
177 177
 
178
-	template_button_strip($context['navigation'], 'bottom');
178
+	template_shd_button_strip($context['navigation'], 'bottom');
179 179
 
180 180
 	echo '
181 181
 		<div class="title_bar">
... ...
@@ -241,7 +241,7 @@ function template_recyclebin()
241 241
 {
242 242
 	global $context, $txt, $settings, $scripturl;
243 243
 
244
-	template_button_strip($context['navigation'], 'bottom');
244
+	template_shd_button_strip($context['navigation'], 'bottom');
245 245
 
246 246
 	echo '
247 247
 		<div class="title_bar">
... ...
@@ -575,13 +575,16 @@ function template_shd_maintenance_above()
575 575
 */
576 576
 function template_shd_maintenance_below()
577 577
 {
578
-
579 578
 }
580 579
 
581
-// Provide a placeholder in the event template_button_strip isn't defined (like in the mobile templates)
582
-if (!function_exists('template_button_strip'))
583
-{
584
-	function template_button_strip()
580
+/**
581
+ *	Wrapper for the button_strip.
582
+ *
583
+ *	@since 2.1
584
+*/
585
+function template_shd_button_strip($button_strip, $direction = '', $strip_options = array())
585 586
 {
586
-	}
587
+	// If SMF version exists, use it.
588
+	if (function_exists('template_button_strip'))
589
+		template_button_strip($button_strip, $direction = '', $strip_options = array());
587 590
 }
588 591
\ No newline at end of file
589 592