! Fixed a few plugin errors. + Added a version for css/scripts allowing for easier updating. ! Fixed New Icons not working on ticket index. ! Fixed Page Index not showing the correct pages (Fixes #31)
jdarwood007

jdarwood007 commited on 2015-12-10 17:34:00
Showing 12 changed files, with 68 additions and 36 deletions.


Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>
... ...
@@ -135,6 +135,18 @@ dd#assigned_button
135 135
 	padding: 1px 0;
136 136
 }
137 137
 
138
+span.shd_new_tickets
139
+{
140
+	margin-left: 5px;
141
+    padding: 1px 5px 3px 4px;
142
+}
143
+
144
+/* The page index color looks ugly with our theme. */
145
+.shd_main_hd .cat_bar .current_page
146
+{
147
+	color: #fff;
148
+}
149
+
138 150
 /**********************************
139 151
 * Stuff used within the actual tickets 	*
140 152
 ***********************************/
... ...
@@ -102,3 +102,19 @@ function shd_ticket_total_information()
102 102
 	else
103 103
 		infocontainer.style.display = 'none';
104 104
 }
105
+
106
+// Modified, SMF 2.0 ToggleItem
107
+function toggleItem(itemID, theme_url, txt_on, txt_off)
108
+{
109
+	// Toggle the hidden item.
110
+	var itemValueHandle = document.getElementById("feature_" + itemID);
111
+	itemValueHandle.value = itemValueHandle.value == 1 ? 0 : 1;
112
+
113
+	// Change the image, alternative text and the title.
114
+	document.getElementById("switch_" + itemID).src = theme_url + '/simpledesk/switch_' + (itemValueHandle.value == 1 ? 'on' : 'off') + '.png';
115
+	document.getElementById("switch_" + itemID).alt = itemValueHandle.value == 1 ? txt_off : txt_on;
116
+	document.getElementById("switch_" + itemID).title = itemValueHandle.value == 1 ? txt_off : txt_on;
117
+
118
+	// Don't reload.
119
+	return false;
120
+}
... ...
@@ -456,7 +456,7 @@ $txt['shd_dept_autoclose_days_note'] = 'Use 0 to indicate that tickets in this d
456 456
 
457 457
 //! Plugins
458 458
 //@{
459
-$txt['shd_admin_plugins_packman'] = 'SimpleDesk Plugins';
459
+$txt['sdplugin_package'] = 'SimpleDesk Plugins';
460 460
 $txt['shd_install_plugin'] = 'Install Plugin';
461 461
 $txt['shd_admin_plugins_homedesc'] = 'This area allows you to manage any additional components for SimpleDesk. They are installed through the Package Manager as regular mods, and configured from here.';
462 462
 $txt['shd_admin_plugins_none'] = 'No plugins are currently installed.';
... ...
@@ -464,6 +464,8 @@ $txt['shd_admin_plugins_writtenby'] = 'Written by';
464 464
 $txt['shd_admin_plugins_website'] = 'Website';
465 465
 $txt['shd_admin_plugins_wrong_version'] = 'Not supported by this version!';
466 466
 $txt['shd_admin_plugins_versions_avail'] = 'Supported by the plugin';
467
+$txt['shd_admin_plugins_on'] = 'On';
468
+$txt['shd_admin_plugins_off'] = 'Off';
467 469
 $txt['shd_admin_plugins_languages'] = 'Available languages';
468 470
 $txt['shd_admin_plugins_lang_albanian'] = 'Albanian';
469 471
 $txt['shd_admin_plugins_lang_arabic'] = 'Arabic';
... ...
@@ -54,9 +54,9 @@ function shd_admin_main()
54 54
 
55 55
 	// Load some extra CSS
56 56
 	$context['html_headers'] .= '
57
-	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_admin.css" />
58
-	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk.css" />
59
-	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/helpdesk_admin.js?rc2"></script>';
57
+	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_admin.css?' . $context['shd_css_version'] . '" />
58
+	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk.css?' . $context['shd_css_version'] . '" />
59
+	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/helpdesk_admin.js?' . $context['shd_scripts_version'] . '"></script>';
60 60
 	$context['page_title'] = $txt['shd_admin_title'];
61 61
 
62 62
 	// We need this for later
... ...
@@ -293,16 +293,16 @@ function shd_main()
293 293
 		$context['html_headers'] = '';
294 294
 
295 295
 	$context['html_headers'] .= '
296
-	<link rel="stylesheet" type="text/css" href="' . (file_exists($settings['theme_dir'] . '/css/helpdesk.css') ? $settings['theme_url'] . '/css/helpdesk.css' : $settings['default_theme_url'] . '/css/helpdesk.css') . '" />
297
-	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/helpdesk.js?rc2"></script>';
296
+	<link rel="stylesheet" type="text/css" href="' . (file_exists($settings['theme_dir'] . '/css/helpdesk.css') ? $settings['theme_url'] . '/css/helpdesk.css' : $settings['default_theme_url'] . '/css/helpdesk.css') . '?' . $context['shd_css_version'] . '" />
297
+	<script type="text/javascript" src="' . $settings['default_theme_url'] . '/scripts/helpdesk.js?' .$context['shd_scripts_version'] . '"></script>';
298 298
 
299 299
 	// A custom css?
300 300
 	if (file_exists($settings['default_theme_url'] . '/css/helpdesk_custom.css'))
301 301
 		$context['html_headers'] .= '
302
-	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_custom.css" />';
302
+	<link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_custom.css?' . $context['shd_css_version'] . '" />';
303 303
 	if (file_exists($settings['theme_dir'] . '/css/helpdesk_custom.css'))
304 304
 		$context['html_headers'] .= '
305
-	<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/css/helpdesk_custom.css" />';
305
+	<link rel="stylesheet" type="text/css" href="' . $settings['theme_url'] . '/css/helpdesk_custom.css?' . $context['shd_css_version'] . '" />';
306 306
 
307 307
 	// Int hooks - after we basically set everything up (so it's manipulatable by the hook, but before we do the last bits of finalisation)
308 308
 	call_integration_hook('shd_hook_helpdesk', array(&$subactions));
... ...
@@ -740,26 +740,6 @@ function shd_helpdesk_listing()
740 740
 	if (!empty($context['shd_permission']))
741 741
 		shd_is_allowed_to($context['shd_permission']);
742 742
 
743
-	// So, we want the [new] icon. Where is it?
744
-	$newimgpaths = array(
745
-		$settings['theme_dir'] . '/images/' . $language => $settings['lang_images_url'],
746
-		$settings['theme_dir'] . '/images/english' => $settings['images_url'] . '/english',
747
-		$settings['default_theme_dir'] . '/images/' . $language => $settings['default_images_url'] . '/' . $language,
748
-	);
749
-	$files = array('new.gif', 'new.png');
750
-	$context['new_posts_image'] = $settings['default_images_url'] . '/english/new.gif'; // likely default, but we'll check the theme etc first just in case.
751
-	foreach ($newimgpaths as $physicalpath => $urlpath)
752
-	{
753
-		foreach ($files as $file)
754
-		{
755
-			if (file_exists($physicalpath . '/' . $file))
756
-			{
757
-				$context['new_posts_image'] = $urlpath . '/' . $file;
758
-				break 2;
759
-			}
760
-		}
761
-	}
762
-
763 743
 	$block_list = array_keys($context['ticket_blocks']);
764 744
 	$primary_url = '?action=helpdesk;sa=' . $_REQUEST['sa'];
765 745
 
... ...
@@ -111,6 +111,14 @@ function shd_init()
111 111
 	define('ROLEPERM_ALLOW', 1);
112 112
 	define('ROLEPERM_DENY', 2);
113 113
 
114
+	$context['shd_scripts_version'] = 'beta1';
115
+	$context['shd_css_version'] = 'beta1';
116
+
117
+	// Load up developer stuff if we need to.
118
+	$context['shd_developer_mode'] = isset($modSettings['shd_developer_mode']);
119
+	if ($context['shd_developer_mode'])
120
+		$context['shd_scripts_version'] = $context['shd_css_version'] = 'dev' . time();
121
+
114 122
 	// How many digits should we show for ticket numbers? Normally we pad to 5 digits, e.g. 00001 - this is how we set that width.
115 123
 	if (empty($modSettings['shd_zerofill']) || $modSettings['shd_zerofill'] < 0)
116 124
 		$modSettings['shd_zerofill'] = 0;
... ...
@@ -1059,7 +1067,9 @@ function shd_determine_status($action, $starter_id = 0, $replier_id = 0, $replie
1059 1067
 */
1060 1068
 function shd_no_expand_pageindex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
1061 1069
 {
1062
-	return preg_replace('~<span([^<]+)~i', '<span style="font-weight: bold;"> ... ', constructPageIndex($base_url, $start, $max_value, $num_per_page, $flexible_start));
1070
+	
1071
+//	return constructPageIndex($base_url, $start, $max_value, $num_per_page, $flexible_start);
1072
+	return preg_replace('~<span class="expand_pages"([^<]+)~i', '<span style="font-weight: bold;"> ... ', constructPageIndex($base_url, $start, $max_value, $num_per_page, $flexible_start));
1063 1073
 }
1064 1074
 
1065 1075
 /**
... ...
@@ -1708,7 +1718,7 @@ function shd_main_menu(&$menu_buttons)
1708 1718
 
1709 1719
     // Load some extra CSS
1710 1720
     $context['html_headers'] .= '
1711
-    <link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_icons.css" />';
1721
+    <link rel="stylesheet" type="text/css" href="' . $settings['default_theme_url'] . '/css/helpdesk_icons.css?' . $context['shd_css_version'] . '" />';
1712 1722
 
1713 1723
 	// Stuff we'll always do in SD if active
1714 1724
 	$helpdesk_admin = $context['user']['is_admin'] || shd_allowed_to('admin_helpdesk', 0);
... ...
@@ -1886,7 +1896,7 @@ function shd_main_menu(&$menu_buttons)
1886 1896
 		$menu_buttons['profile']['show'] = true;
1887 1897
 		$menu_buttons['profile']['sub_buttons']['hd_profile'] = array(
1888 1898
 			'title' => $txt['shd_helpdesk_profile'],
1889
-			'href' => $scripturl . '?action=profile;area=helpdesk',
1899
+			'href' => $scripturl . '?action=profile;area=hd_profile',
1890 1900
 			'show' => true,
1891 1901
 			'is_last' => true,
1892 1902
 		);
... ...
@@ -39,7 +39,7 @@ function shd_packages_sort_id(&$sort_id, &$packages)
39 39
 {
40 40
 	global $context;
41 41
 
42
-	$sort_id[] = 'sdplugin';
42
+	$sort_id['sdplugin'] = 1;
43 43
 	$packages['sdplugin'] = array();
44 44
 	$context['available_sdplugin'] = array();
45 45
 }
... ...
@@ -69,3 +69,15 @@ function shd_package_upload()
69 69
 	if ($context['package']['type'] == 'sdplugin')
70 70
 		$context['package']['install']['link'] = '<a href="' . $scripturl . '?action=admin;area=packages;sa=install;package=' . $context['package']['filename'] . '">[ ' . $txt['shd_install_plugin'] . ' ]</a>';
71 71
 }
72
+
73
+/**
74
+ *	Sets up the browse section for plugins.
75
+ *
76
+ *	@since 2.1
77
+*/
78
+function shd_modification_types()
79
+{
80
+	global $context, $txt;
81
+
82
+	$context['modification_types'][] = 'sdplugin';
83
+}
72 84
\ No newline at end of file
... ...
@@ -61,8 +61,8 @@ function template_shd_plugin_listing()
61 61
 		if (!empty($plugin['installable']))
62 62
 			echo '
63 63
 					<div class="features_switch" id="js_feature_', $id, '" style="display: none;">
64
-						<a href="', $scripturl, '?action=admin;area=helpdesk_plugins;save;', $context['session_var'], '=', $context['session_id'], ';toggle=', $id, ';state=', $plugin['enabled'] ? 0 : 1, '" onclick="return toggleItem(\'', $id, '\');">
65
-							<input type="hidden" name="feature_', $id, '" id="feature_', $id, '" value="', $plugin['enabled'] ? 1 : 0, '" /><img src="', $settings['images_url'], '/admin/switch_', $plugin['enabled'] ? 'on' : 'off', '.png" id="switch_', $id, '" style="margin-top: 1.3em;" alt="', $txt['core_settings_switch_' . ($plugin['enabled'] ? 'off' : 'on')], '" title="', $txt['core_settings_switch_' . ($plugin['enabled'] ? 'off' : 'on')], '" />
64
+						<a href="', $scripturl, '?action=admin;area=helpdesk_plugins;save;', $context['session_var'], '=', $context['session_id'], ';toggle=', $id, ';state=', $plugin['enabled'] ? 0 : 1, '" onclick="return toggleItem(\'', $id, '\', \'', $settings['images_url'], '\', \'', $txt['shd_admin_plugins_on'], '\',  \'', $txt['shd_admin_plugins_off'], '\');">
65
+							<input type="hidden" name="feature_', $id, '" id="feature_', $id, '" value="', $plugin['enabled'] ? 1 : 0, '" /><img src="', $settings['images_url'], '/simpledesk/switch_', $plugin['enabled'] ? 'on' : 'off', '.png" id="switch_', $id, '" style="margin-top: 1.3em;" alt="', $txt['shd_admin_plugins_' . ($plugin['enabled'] ? 'off' : 'on')], '" title="', $txt['shd_admin_plugins_' . ($plugin['enabled'] ? 'off' : 'on')], '" />
66 66
 						</a>
67 67
 					</div>';
68 68
 		else
... ...
@@ -856,7 +856,7 @@ function template_ticket_do_replies()
856 856
 							', $reply['body'], '
857 857
 							<br /><br />';
858 858
 
859
-			if ($settings['show_modify'] && !empty($reply['modified']))
859
+			if (!empty($settings['show_modify']) && !empty($reply['modified']))
860 860
 			{
861 861
 				echo '
862 862
 							<div class="smalltext shd_modified" style="margin-top:20px;">
... ...
@@ -500,7 +500,7 @@ function template_ticket_block()
500 500
 							<td class="smalltext">', $ticket['dept_link'], $ticket['link'];
501 501
 
502 502
 						if ($ticket['is_unread'] && !empty($ticket['new_href']))
503
-							echo ' <a href="', $ticket['new_href'], '"><img src="', $context['new_posts_image'], '" class="new_posts" alt="', $txt['new'], '" /></a>';
503
+							echo ' <a href="', $ticket['new_href'], '"><span class="new_posts shd_new_tickets">', $txt['new'], '</span></a>';
504 504
 
505 505
 						echo '</td>';
506 506
 						break;
507 507