! Provide a warning in the admin panel that some things will be broken without JS. (Elsewhere, everything that can have fallbacks should have fallbacks. But in the admin panel, some things will actually be broken.)
gruffen

gruffen commited on 2011-05-26 09:04:21
Showing 3 changed files, with 25 additions and 0 deletions.

... ...
@@ -92,6 +92,8 @@ $txt['shd_closed_tickets'] = 'Closed tickets';
92 92
 $txt['shd_recycled_tickets'] = 'Recycled tickets';
93 93
 $txt['shd_need_support'] = 'Help with SimpleDesk?';
94 94
 $txt['shd_support_start_here'] = 'See our <a href="%1$s">Support Page</a>';
95
+
96
+$txt['shd_helpdesk_nojs'] = 'JavaScript is not enabled in your browser. Some functions may not work properly (or at all) in the administration area.';
95 97
 //@}
96 98
 
97 99
 //! @name Translatable strings for the credits
... ...
@@ -47,6 +47,7 @@ function shd_admin_main()
47 47
 
48 48
 	// Templates and stuff (like hook files)
49 49
 	loadTemplate('sd_template/SimpleDesk-Admin');
50
+	$context['template_layers'][] = 'shd_nojs';
50 51
 	$context['shd_preferences'] = shd_load_user_prefs();
51 52
 	shd_load_plugin_files('hdadmin');
52 53
 	shd_load_plugin_langfiles('hdadmin');
... ...
@@ -723,4 +723,26 @@ function template_shd_support()
723 723
 	<br class="clear" />';
724 724
 }
725 725
 
726
+/**
727
+ *	Displays a header that Javascript should be enabled while in the administration panel area of SimpleDesk.
728
+ *
729
+ *	The helpdesk is disabled to non admins while in maintenance mode, but this template is added to the template layers if the user is an admin and it's in maintenance mode.
730
+ *	@since 2.0
731
+*/
732
+function template_shd_nojs_above()
733
+{
734
+	global $txt, $settings;
735
+	echo '<noscript><div class="errorbox"><img src="', $settings['default_images_url'], '/simpledesk/warning.png" alt="*" class="shd_icon_minihead" /> &nbsp;', $txt['shd_helpdesk_nojs'], '</div></noscript>';
736
+}
737
+
738
+/**
739
+ *	Displays a footer that Javascript should be enabled while in the administration panel area of SimpleDesk.
740
+ *
741
+ *	This template is added to the template layers, because SMF requires a layer have both a layer before and after the main content.
742
+ *	@since 2.0
743
+*/
744
+function template_shd_nojs_below()
745
+{
746
+
747
+}
726 748
 ?>
727 749
\ No newline at end of file
728 750