[geeklog-cvs] geeklog: Added COM_NoScript and noscript.thtml to allow core and...

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Mon Apr 11 10:47:34 EDT 2011


changeset 8223:efe112a34ef1
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/efe112a34ef1
user: Tom <websitemaster at cogeco.net>
date: Mon Apr 11 10:45:58 2011 -0400
description:
Added COM_NoScript and noscript.thtml to allow core and plugins to have a common way to display JavaScript disabled warnings.
Updated Story, Comments, Profile, Configuration and Staticpage plugin to use new function BUG #1282

diffstat:

 language/english.php                                                       |    8 +-
 language/english_utf-8.php                                                 |    8 +-
 plugins/staticpages/templates/admin/editor_advanced.thtml                  |    8 +-
 public_html/admin/plugins/staticpages/index.php                            |   18 +-
 public_html/admin/story.php                                                |    4 +-
 public_html/layout/professional/admin/config/configuration.thtml           |  125 +++++----
 public_html/layout/professional/admin/story/storyeditor_advanced.thtml     |    9 +-
 public_html/layout/professional/comment/commentform_advanced.thtml         |    3 +
 public_html/layout/professional/noscript.thtml                             |    6 +
 public_html/layout/professional/preferences/profile.thtml                  |    3 +-
 public_html/layout/professional_css/admin/config/configuration.thtml       |  127 +++++----
 public_html/layout/professional_css/admin/story/storyeditor_advanced.thtml |    7 +-
 public_html/layout/professional_css/comment/commentform_advanced.thtml     |  127 +++++----
 public_html/layout/professional_css/noscript.thtml                         |    6 +
 public_html/layout/professional_css/preferences/profile.thtml              |    2 +-
 public_html/lib-common.php                                                 |   40 +++
 public_html/usersettings.php                                               |    3 +-
 system/classes/config.class.php                                            |    8 +-
 system/lib-comment.php                                                     |   14 +-
 19 files changed, 303 insertions(+), 223 deletions(-)

diffs (truncated from 734 to 300 lines):

diff -r ae6bb80e1f0b -r efe112a34ef1 language/english.php
--- a/language/english.php	Sun Apr 10 14:00:35 2011 -0400
+++ b/language/english.php	Mon Apr 11 10:45:58 2011 -0400
@@ -176,7 +176,11 @@
     132 => 'Information',
     133 => 'Critical',
     134 => 'Help',
-    135 => 'Warning'
+    135 => 'Warning',
+    136 => 'Warning: Javascript recommended for enhanced functionality',
+    137 => 'Warning: Javascript required to enable functionality',
+    138 => "Click <a href=\"{$_CONF['site_url']}/usersettings.php\" rel=\"nofollow\">here</a> to disable the advanced editor and use the default editor which does not require JavaScript",
+    139 => "Click <a href=\"{$_CONF['site_url']}/\" rel=\"nofollow\">here</a> to return to the homepage"
 );
 
 ###############################################################################
@@ -382,7 +386,7 @@
     147 => 'Password fields for non-remote accounts only. Edit your account password, email and autologin feature. You will need to enter the same password or email address twice as a confirmation.',
     148 => 'User Information',
     149 => 'Modify your user information that will be shown to other users.<ul><li>The signature will be added to any comments or forum posts you made</li><li>The BIO is a brief summary of yourself to share</li><li>Share your PGP Key</li></ul>',
-    150 => 'Warning: Javascript recommended for enhanced functionality',
+    150 => '',
     156 => 'Delete Account',
     157 => 'Delete Option',
     158 => 'Time Zone',
diff -r ae6bb80e1f0b -r efe112a34ef1 language/english_utf-8.php
--- a/language/english_utf-8.php	Sun Apr 10 14:00:35 2011 -0400
+++ b/language/english_utf-8.php	Mon Apr 11 10:45:58 2011 -0400
@@ -176,7 +176,11 @@
     132 => 'Information',
     133 => 'Critical',
     134 => 'Help',
-    135 => 'Warning'
+    135 => 'Warning',
+    136 => 'Warning: Javascript recommended for enhanced functionality',
+    137 => 'Warning: Javascript required to enable functionality',
+    138 => "Click <a href=\"{$_CONF['site_url']}/usersettings.php\" rel=\"nofollow\">here</a> to disable the advanced editor and use the default editor which does not require JavaScript",
+    139 => "Click <a href=\"{$_CONF['site_url']}/\" rel=\"nofollow\">here</a> to return to the homepage"
 );
 
 ###############################################################################
@@ -382,7 +386,7 @@
     147 => 'Password fields for non-remote accounts only. Edit your account password, email and autologin feature. You will need to enter the same password or email address twice as a confirmation.',
     148 => 'User Information',
     149 => 'Modify your user information that will be shown to other users.<ul><li>The signature will be added to any comments or forum posts you made</li><li>The BIO is a brief summary of yourself to share</li><li>Share your PGP Key</li></ul>',
-    150 => 'Warning: Javascript recommended for enhanced functionality',
+    150 => '',
     156 => 'Delete Account',
     157 => 'Delete Option',
     158 => 'Time Zone',
diff -r ae6bb80e1f0b -r efe112a34ef1 plugins/staticpages/templates/admin/editor_advanced.thtml
--- a/plugins/staticpages/templates/admin/editor_advanced.thtml	Sun Apr 10 14:00:35 2011 -0400
+++ b/plugins/staticpages/templates/admin/editor_advanced.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -1,8 +1,5 @@
-<!-- Hide the Advanced Editor as JavaScript is required. If JS is not enabled then the message below in the <nonscript> tags will be displayed -->
-<noscript>
-    <div class="pluginAlert" style="border:1px dashed #ccc;text-align:center;margin-top:10px;padding:15px;">{lang_nojavascript}</div>
-</noscript>
-
+{noscript}
+<div id="advanced_editor" style="display:none;">
   {start_block_editor}
   <form action="{site_admin_url}/plugins/staticpages/index.php" method="post" onsubmit='set_postcontent();'>
       <table border="0" cellspacing="0" cellpadding="3" width="100%">
@@ -195,3 +192,4 @@
       </table>
   </form>
   {end_block}
+</div>
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/admin/plugins/staticpages/index.php
--- a/public_html/admin/plugins/staticpages/index.php	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/admin/plugins/staticpages/index.php	Mon Apr 11 10:45:58 2011 -0400
@@ -67,7 +67,7 @@
 function staticpageeditor_form($A, $error = false)
 {
     global $_CONF, $_TABLES, $_USER, $_GROUPS, $_SP_CONF, $mode, $sp_id,
-           $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG24,
+           $LANG21, $LANG_STATIC, $LANG_ACCESS, $LANG_ADMIN, $LANG01, $LANG24,
            $LANG_postmodes, $MESSAGE, $_IMAGE_TYPE, $_SCRIPTS;
 
     $template_path = staticpages_templatePath('admin');
@@ -95,9 +95,19 @@
     if ($_CONF['advanced_editor'] && $_USER['advanced_editor']) {
         $sp_template->set_file('form', 'editor_advanced.thtml');
         
-        $js = '// Setup editor path for FCKeditor JS Functions
-            geeklogEditorBasePath = "' . $_CONF['site_url'] . '/fckeditor/";';
-        $_SCRIPTS->setJavaScript($js, true);        
+        // Shouldn't really have to check if anonymous user but who knows...
+        if (COM_isAnonUser()) {
+            $link_message = "";
+        } else {
+            $link_message = $LANG01[138];    
+        } 
+        $sp_template->set_var('noscript', COM_NoScript(false, '', $link_message));        
+        
+        // Add JavaScript
+        $js = 'geeklogEditorBasePath = "' . $_CONF['site_url'] . '/fckeditor/";';
+        // Hide the Advanced Editor as Javascript is required. If JS is enabled then the JS below will un-hide it
+        $js .= 'document.getElementById("advanced_editor").style.display="";';                 
+        $_SCRIPTS->setJavaScript($js, true);
         $_SCRIPTS->setJavaScriptFile('staticpages_fckeditor', '/javascript/staticpages_fckeditor.js');
 
         $sp_template->set_var('lang_expandhelp', $LANG24[67]);
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/admin/story.php
--- a/public_html/admin/story.php	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/admin/story.php	Mon Apr 11 10:45:58 2011 -0400
@@ -668,8 +668,8 @@
     $story_templates->set_var('lang_bodytext', $LANG24[17]);
     $story_templates->set_var('lang_postmode', $LANG24[4]);
     $story_templates->set_var('lang_publishoptions',$LANG24[76]);
-    $story_templates->set_var('lang_nojavascript',$LANG24[77]);
-    $story_templates->set_var('no_javascript_return_link',sprintf($LANG24[78],$_CONF['site_admin_url'], $sid));
+    $story_templates->set_var('noscript', COM_NoScript(false, $LANG24[77], sprintf($LANG24[78],$_CONF['site_admin_url'], $sid)));
+    
     $post_options = COM_optionList($_TABLES['postmodes'],'code,name',$story->EditElements('postmode'));
 
     // If Advanced Mode - add post option and set default if editing story created with Advanced Editor
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional/admin/config/configuration.thtml
--- a/public_html/layout/professional/admin/config/configuration.thtml	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/layout/professional/admin/config/configuration.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -1,62 +1,65 @@
-<form method="post" action="{site_admin_url}/configuration.php" name="group">
-<input type="hidden" value="{open_group}" name="conf_group"{xhtml}>
-<input type="hidden" value="" name="subgroup"{xhtml}>
-<input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
-</form>
-<table>
-    <tr>
-        <td class="block-featured-left" style="vertical-align:top;">
-            <div class="block-bg-left"> {config_menu} </div>
-        </td>
-        <td style="vertical-align:top; width: 100%">
-        
-            <div class="saved_message pluginInfo{error_validation_class}" style="display:{show_changeblock}">
-                {lang_changes_made}
-                {lang_error_validation_occurs}
-                {change_block}
-            </div>
+{noscript}
+<div id="advanced_editor" style="display:none;">
+    <form method="post" action="{site_admin_url}/configuration.php" name="group">
+    <input type="hidden" value="{open_group}" name="conf_group"{xhtml}>
+    <input type="hidden" value="" name="subgroup"{xhtml}>
+    <input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
+    </form>
+    <table>
+        <tr>
+            <td class="block-featured-left" style="vertical-align:top;">
+                <div class="block-bg-left"> {config_menu} </div>
+            </td>
+            <td style="vertical-align:top; width: 100%">
             
-            <div id="search-configuration-container" style="text-align: right">
-                <label for="search-configuration">{search_configuration_label}</label>
-                <input name="search-configuration" id="search-configuration" value="{search_configuration_value}"{xhtml}>
-                <input name="tab-id" id="tab-id" type="hidden" value="{tab_id_value}"{xhtml}>
-            </div>
-
-            <form action="{site_admin_url}/configuration.php" method="post" name="subgroup">
-            <input type="hidden" name="conf_group" value="{open_group}"{xhtml}>
-            <input type="hidden" name="sub_group" value="{open_sg}"{xhtml}>
-            <input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
-
-            <div id="tabs">
-            
-            {tab_li}
-
-            <!-- BEGIN tab -->
-            <div style="margin-top:10px;" id="{tab_id}">
-            
-            <!-- BEGIN notes -->
-            <div class="notes">
-             <h4>{tab_display}</h4>
-             <p class="last">{tab_help}</p>
-             <span class="warningsmall">{tab_warning}</span>
-            </div>
-            <!-- END notes -->
-
-            {tab_contents}
-            
-            </div>
-            <!-- END tab -->
-            
-            </div>
-
-
-            <input type="hidden" name="form_submit" value="true"{xhtml}>
-            <div id="bottom_buttons" class="aligncenter">
-                <input type="submit" id="save_changes" value="{lang_save_changes}"{xhtml}>
-                <input type="submit" id="form_reset" name="form_reset" value="{lang_reset_form}"{xhtml}>
-            </div>
-            </form>
-
-        </td>
-    </tr>
-</table>
+                <div class="saved_message pluginInfo{error_validation_class}" style="display:{show_changeblock}">
+                    {lang_changes_made}
+                    {lang_error_validation_occurs}
+                    {change_block}
+                </div>
+                
+                <div id="search-configuration-container" style="text-align: right">
+                    <label for="search-configuration">{search_configuration_label}</label>
+                    <input name="search-configuration" id="search-configuration" value="{search_configuration_value}"{xhtml}>
+                    <input name="tab-id" id="tab-id" type="hidden" value="{tab_id_value}"{xhtml}>
+                </div>
+    
+                <form action="{site_admin_url}/configuration.php" method="post" name="subgroup">
+                <input type="hidden" name="conf_group" value="{open_group}"{xhtml}>
+                <input type="hidden" name="sub_group" value="{open_sg}"{xhtml}>
+                <input type="hidden" name="{gltoken_name}" value="{gltoken}"{xhtml}>
+    
+                <div id="tabs">
+                
+                {tab_li}
+    
+                <!-- BEGIN tab -->
+                <div style="margin-top:10px;" id="{tab_id}">
+                
+                <!-- BEGIN notes -->
+                <div class="notes">
+                 <h4>{tab_display}</h4>
+                 <p class="last">{tab_help}</p>
+                 <span class="warningsmall">{tab_warning}</span>
+                </div>
+                <!-- END notes -->
+    
+                {tab_contents}
+                
+                </div>
+                <!-- END tab -->
+                
+                </div>
+    
+    
+                <input type="hidden" name="form_submit" value="true"{xhtml}>
+                <div id="bottom_buttons" class="aligncenter">
+                    <input type="submit" id="save_changes" value="{lang_save_changes}"{xhtml}>
+                    <input type="submit" id="form_reset" name="form_reset" value="{lang_reset_form}"{xhtml}>
+                </div>
+                </form>
+    
+            </td>
+        </tr>
+    </table>
+</div>
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional/admin/story/storyeditor_advanced.thtml
--- a/public_html/layout/professional/admin/story/storyeditor_advanced.thtml	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/layout/professional/admin/story/storyeditor_advanced.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -1,11 +1,4 @@
-<!-- Hide the Advanced Editor as Javascript is required. If JS is not enabled then the message below in the <nonscript> tags will be displayed -->
-<noscript>
-    <div class="pluginAlert aligncenter" style="border:1px dashed #ccc;margin-top:10px;padding:15px;">{lang_nojavascript}
-    <p>{no_javascript_return_link}</p>
-    </div>
-</noscript>
-
-<br{xhtml}>
+{noscript}
 <div id="advanced_editor" style="display:none;">
     {navbar}
     <form name="frmstory" action="{site_admin_url}/story.php" method="post" enctype="multipart/form-data" onsubmit='set_postcontent();'>
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional/comment/commentform_advanced.thtml
--- a/public_html/layout/professional/comment/commentform_advanced.thtml	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/layout/professional/comment/commentform_advanced.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -1,3 +1,5 @@
+                                {noscript}
+                                <div id="advanced_editor" style="display:none;">
                                 {start_block_postacomment}
                                             <form action="{form_url}" method="post" onsubmit='set_postcontent();'>
                                                 <table cellspacing="0" cellpadding="3" width="100%">
@@ -59,3 +61,4 @@
                                                 </table>
                                             </form>
                                 {end_block}
+                                </div>
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional/noscript.thtml
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/public_html/layout/professional/noscript.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -0,0 +1,6 @@
+<noscript>
+    <div class="pluginAlert aligncenter" style="border:1px dashed #ccc;margin-top:10px;padding:15px;">{lang_nojavascript}
+    <span{hide_link}><p>{no_javascript_return_link}</p></span>
+    </div>
+    <br{xhtml}>
+</noscript>
\ No newline at end of file
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional/preferences/profile.thtml
--- a/public_html/layout/professional/preferences/profile.thtml	Sun Apr 10 14:00:35 2011 -0400
+++ b/public_html/layout/professional/preferences/profile.thtml	Mon Apr 11 10:45:58 2011 -0400
@@ -1,5 +1,4 @@
-<noscript><div class="pluginAlert" style="padding:10px;">{no_javascript_warning}</div></noscript>
-
+{noscript}
 <div id="pe_navbar" style="display:none">
 {navbar}
 </div>
diff -r ae6bb80e1f0b -r efe112a34ef1 public_html/layout/professional_css/admin/config/configuration.thtml



More information about the geeklog-cvs mailing list