Editor: completely moved wiki edit notice to AJAX fetch, so it's not shipped with the page anymore.
authorDan
Fri, 17 Jul 2009 20:48:53 -0400
changeset 1068 4bcefa85649c
parent 1067 4058c844ee38
child 1069 d54e7620bd3e
Editor: completely moved wiki edit notice to AJAX fetch, so it's not shipped with the page anymore.
ajax.php
includes/clientside/jsres.php
includes/clientside/static/editor.js
includes/pageprocess.php
includes/template.php
--- a/ajax.php	Fri Jul 17 20:28:24 2009 -0400
+++ b/ajax.php	Fri Jul 17 20:48:53 2009 -0400
@@ -163,6 +163,7 @@
       
       $template->load_theme();
       $return['toolbar_templates'] = $template->extract_vars('toolbar.tpl');
+      $return['edit_notice'] = $template->get_wiki_edit_notice();
       
       echo enano_json_encode($return);
       break;
--- a/includes/clientside/jsres.php	Fri Jul 17 20:28:24 2009 -0400
+++ b/includes/clientside/jsres.php	Fri Jul 17 20:48:53 2009 -0400
@@ -13,7 +13,7 @@
  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
  */
 
-define('ENANO_JS_DEBUG', 1);
+// define('ENANO_JS_DEBUG', 1);
 
 // if Enano's already loaded, we've been included from a helper script
 if ( defined('ENANO_CONFIG_FETCHED') )
--- a/includes/clientside/static/editor.js	Fri Jul 17 20:28:24 2009 -0400
+++ b/includes/clientside/static/editor.js	Fri Jul 17 20:48:53 2009 -0400
@@ -419,10 +419,10 @@
   tblholder.appendChild(metatable);
   
   // Edit disclaimer/notice
-  if ( editNotice ) // This is set globally in {JS_DYNAMIC_VARS}.
+  if ( response.edit_notice )
   {
     var en_div = document.createElement('div');
-    en_div.innerHTML = editNotice;
+    en_div.innerHTML = response.edit_notice;
     en_div.className = 'usermessage';
     en_div.style.margin = '10px 0 0 0';
   }
@@ -445,7 +445,7 @@
   form.innerHTML += '<div style="margin: 10px 0 0 0;">' + toolbar + '</div>';
   edcon.appendChild(form);
   
-  if ( editNotice && !readonly )
+  if ( response.edit_notice && !readonly )
   {
     edcon.appendChild(en_div);
   }
--- a/includes/pageprocess.php	Fri Jul 17 20:28:24 2009 -0400
+++ b/includes/pageprocess.php	Fri Jul 17 20:48:53 2009 -0400
@@ -1122,52 +1122,6 @@
   }
   
   /**
-   * Pushes to the redirect stack and resets the instance. This depends on the page ID and namespace already being validated and sanitized, and does not check the size of the redirect stack.
-   * @param string Page ID to redirect to
-   * @param string Namespace to redirect to
-   * @access private
-   */
-  
-  /*
-  function _handle_redirect($page_id, $namespace)
-  {
-    global $db, $session, $paths, $template, $plugins; // Common objects
-    global $lang;
-    $arr_pid = array($this->page_id, $this->namespace);
-    if ( $namespace == 'Special' || $namespace == 'Admin' )
-    {
-      return ;
-    }
-    $looped = false;
-    foreach ( $this->redirect_stack as $page )
-    {
-      if ( $page[0] == $arr_pid[0] && $page[1] == $arr_pid[1] )
-      {
-        $looped = true;
-        break;
-      }
-    }
-    if ( $looped )
-    {
-      return ;
-    }
-    $page_id_key = $paths->nslist[ $namespace ] . sanitize_page_id($page_id);
-    if ( !isPage($page_id_key) )
-    {
-      return $lang->get('page_err_redirect_to_nonexistent');
-    }
-    $this->redirect_stack[] = $arr_pid;
-    
-    
-    // Nuke the text cache to avoid infinite loops, gah...
-    $this->text_cache = '';
-    $this->_setup($page_id, $namespace, 0);
-    $this->send();
-    return true;
-  }
-  */
-  
-  /**
    * Send the error message to the user that the access to this page is denied.
    * @access private
    */
--- a/includes/template.php	Fri Jul 17 20:28:24 2009 -0400
+++ b/includes/template.php	Fri Jul 17 20:48:53 2009 -0400
@@ -1232,8 +1232,7 @@
       var AES_BLOCKSIZE = '.AES_BLOCKSIZE.';
       var pagepass = \''. ( ( isset($_REQUEST['pagepass']) ) ? sha1($_REQUEST['pagepass']) : '' ) .'\';
       var ENANO_LANG_ID = ' . $lang->lang_id . ';
-      var ENANO_PAGE_TYPE = "' . addslashes($this->namespace_string) . '";
-      var editNotice = \'' . $this->get_wiki_edit_notice() . '\';';
+      var ENANO_PAGE_TYPE = "' . addslashes($this->namespace_string) . '";';
     
     foreach($paths->nslist as $k => $c)
     {
@@ -2618,15 +2617,7 @@
     if ( getConfig('wiki_edit_notice', 0) != 1 )
       return '';
     
-    if ( $cached = $cache->fetch('wiki_edit_notice') )
-      return $cached;
-    
     $notice = RenderMan::render(getConfig('wiki_edit_notice_text'));
-    $notice = trim($notice);
-    $notice = addslashes($notice);
-    $notice = str_replace("\n\n", "\n", $notice);
-    $notice = str_replace("\n", "\\\n", $notice);
-    $cache->store('wiki_edit_notice', $notice, 60);
     return $notice;
   }