Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
authorDan
Fri, 07 Sep 2007 00:48:51 -0400
changeset 117 7cfdbb2fd17a
parent 116 77c75179bb95
child 118 0c5efda996bf
Bugfix in Special:AllPages; fixed tinyMCE under Opera (finally!)
includes/clientside/static/editor.js
includes/clientside/static/enano-lib-basic.js
includes/clientside/tinymce/tiny_mce_src.js
plugins/SpecialPageFuncs.php
plugins/admin/PageGroups.php
--- a/includes/clientside/static/editor.js	Thu Sep 06 23:03:51 2007 -0400
+++ b/includes/clientside/static/editor.js	Fri Sep 07 00:48:51 2007 -0400
@@ -1,24 +1,25 @@
 // Javascript routines for the page editor
 
+var enano_tinymce_options = {
+  mode : "exact",
+  elements : '',
+  plugins : 'table',
+  theme_advanced_resize_horizontal : false,
+  theme_advanced_resizing : true,
+  theme_advanced_toolbar_location : "top",
+  theme_advanced_toolbar_align : "left",
+  theme_advanced_buttons1_add : "fontselect,fontsizeselect",
+  theme_advanced_buttons3_add_before : "tablecontrols,separator",
+  theme_advanced_statusbar_location : 'bottom'
+};
+
 var initTinyMCE = function(e)
 {
   if ( typeof(tinyMCE) == 'object' )
   {
-    var options = {
-      mode : "exact",
-      elements : '',
-      plugins : 'table',
-      theme_advanced_resize_horizontal : false,
-      theme_advanced_resizing : true,
-      theme_advanced_toolbar_location : "top",
-      theme_advanced_toolbar_align : "left",
-      theme_advanced_buttons1_add : "fontselect,fontsizeselect",
-      theme_advanced_buttons3_add_before : "tablecontrols,separator",
-      theme_advanced_statusbar_location : 'bottom'
-    }
     if ( !KILL_SWITCH )
     {
-      tinyMCE.init(options);
+      tinyMCE.init(enano_tinymce_options);
     }
   }
 }
--- a/includes/clientside/static/enano-lib-basic.js	Thu Sep 06 23:03:51 2007 -0400
+++ b/includes/clientside/static/enano-lib-basic.js	Fri Sep 07 00:48:51 2007 -0400
@@ -35,6 +35,8 @@
 if (checkIt('msie')) IE = true;
 else IE = false;
 
+var is_Opera = ( checkIt('opera') ) ? true : false;
+
 var KILL_SWITCH = false;
 
 if ( IE )
@@ -214,6 +216,39 @@
   }
 }
 
+var onload_hooks = new Array();
+
+function addOnloadHook(func)
+{
+  if ( typeof ( func ) == 'function' )
+  {
+    if ( typeof(onload_hooks.push) == 'function' )
+    {
+      onload_hooks.push(func);
+    }
+    else
+    {
+      onload_hooks[onload_hooks.length] = func;
+    }
+  }
+}
+
+function runOnloadHooks(e)
+{
+  var _errorTrapper = 0;
+  for ( var _oLc = 0; _oLc < onload_hooks.length; _oLc++ )
+  {
+    _errorTrapper++;
+    if ( _errorTrapper >= 1000 )
+      break;
+    var _f = onload_hooks[_oLc];
+    if ( typeof(_f) == 'function' )
+    {
+      _f(e);
+    }
+  }
+}
+
 var head = document.getElementsByTagName('head')[0];
 if ( !KILL_SWITCH )
 {
@@ -270,39 +305,6 @@
   head.appendChild(script);
 }
 
-var onload_hooks = new Array();
-
-function addOnloadHook(func)
-{
-  if ( typeof ( func ) == 'function' )
-  {
-    if ( typeof(onload_hooks.push) == 'function' )
-    {
-      onload_hooks.push(func);
-    }
-    else
-    {
-      onload_hooks[onload_hooks.length] = func;
-    }
-  }
-}
-
-function runOnloadHooks(e)
-{
-  var _errorTrapper = 0;
-  for ( var _oLc = 0; _oLc < onload_hooks.length; _oLc++ )
-  {
-    _errorTrapper++;
-    if ( _errorTrapper >= 1000 )
-      break;
-    var _f = onload_hooks[_oLc];
-    if ( typeof(_f) == 'function' )
-    {
-      _f(e);
-    }
-  }
-}
-
 addOnloadHook(function() {
   if ( $_REQUEST['do'] )
   {
--- a/includes/clientside/tinymce/tiny_mce_src.js	Thu Sep 06 23:03:51 2007 -0400
+++ b/includes/clientside/tinymce/tiny_mce_src.js	Fri Sep 07 00:48:51 2007 -0400
@@ -559,7 +559,8 @@
 
 	addMCEControl : function(replace_element, form_element_name, target_document) {
 		var id = "mce_editor_" + tinyMCE.idCounter++;
-		var inst = new TinyMCE_Control(tinyMCE.settings);
+    
+    var inst = new TinyMCE_Control(tinyMCE.settings);
 
 		inst.editorId = id;
 		this.instances[id] = inst;
@@ -2494,11 +2495,12 @@
 /* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */
 
 function TinyMCE_Control(settings) {
+  
 	var t, i, to, fu, p, x, fn, fu, pn, s = settings;
 
 	this.undoRedoLevel = true;
 	this.isTinyMCE_Control = true;
-
+  
 	// Default settings
 	this.settings = s;
 	this.settings['theme'] = tinyMCE.getParam("theme", "default");
--- a/plugins/SpecialPageFuncs.php	Thu Sep 06 23:03:51 2007 -0400
+++ b/plugins/SpecialPageFuncs.php	Fri Sep 07 00:48:51 2007 -0400
@@ -206,18 +206,24 @@
   static $rowtracker = 0;
   static $tdclass = 'row2';
   static $per_row = 2;
+  static $first = true;
   $return = '';
-  if ( $crap === false && $row === false )
+  if ( $id === false && $row === false )
   {
     $rowtracker = 0;
+    $first = true;
     return false;
   }
   $rowtracker++;
-  if ( $rowtracker == $per_row )
+  if ( $rowtracker == $per_row || $first )
   {
     $rowtracker = 0;
     $tdclass = ( $tdclass == 'row2' ) ? 'row1' : 'row2';
   }
+  if ( $rowtracker == 0 && !$first )
+    $return .= "</tr>\n<tr>";
+  
+  $first = false;
   
   preg_match('/^ns=(' . implode('|', array_keys($paths->nslist)) . ');pid=(.*?)$/i', $id, $match);
   $namespace =& $match[1];
@@ -232,9 +238,6 @@
   
   $return .= $td;
   
-  if ( $rowtracker == ($per_row - 1) )
-    $return .= "</tr>\n<tr>";
-  
   return $return;
 }
 
@@ -251,6 +254,24 @@
     $db->_die();
   $row = $db->fetchrow_num();
   $count = $row[0];
+  
+  switch($count % 4)
+  {
+    case 0:
+    case 2:
+      // even number of results; do nothing
+      $last_cell = '';
+      break;
+    case 1:
+      // odd number of results and odd number of rows, use row1
+      $last_cell = '<td class="row1"></td>';
+      break;
+    case 3:
+      // odd number of results and even number of rows, use row2
+      $last_cell = '<td class="row2"></td>';
+      break;
+  }
+  
   $db->free_result();
   
   $q = $db->sql_unbuffered_query('SELECT CONCAT("ns=",namespace,";pid=",urlname) AS identifier, name FROM '.table_prefix.'pages WHERE visible!=0 ORDER BY name ASC;');
@@ -273,7 +294,7 @@
       '<div class="tblholder">
          <table border="0" cellspacing="1" cellpadding="4">
            <tr>',          // print at start
-      '    </tr>
+      '    ' . $last_cell . '</tr>
          </table>
        </div>'             // print at end
        );
--- a/plugins/admin/PageGroups.php	Thu Sep 06 23:03:51 2007 -0400
+++ b/plugins/admin/PageGroups.php	Fri Sep 07 00:48:51 2007 -0400
@@ -259,6 +259,10 @@
         $catlist .= '</select>';
       }
       
+      echo '<script type="text/javascript">
+              var __pg_edit_submitAuthorized = true;
+            </script>';
+      
       echo '<form action="'.makeUrl($paths->nslist['Special'].'Administration', 'module='.$paths->cpage['module']).'" method="post" onsubmit="if(!submitAuthorized || !__pg_edit_submitAuthorized) return false;" enctype="multipart/form-data">';
       
       echo '<div class="tblholder">