One word: Internet Explorer 6. This includes a rewrite of $paths->parseAdminTree() that encodes to JSON instead of manually generating JS, so good-bye to stupid parser problems I hope.
authorDan
Sat, 11 Jul 2009 20:25:50 -0400
changeset 1053 bdbb49cf6f1b
parent 1052 374d08d176cb
child 1054 e6b14d33ac55
One word: Internet Explorer 6. This includes a rewrite of $paths->parseAdminTree() that encodes to JSON instead of manually generating JS, so good-bye to stupid parser problems I hope.
includes/clientside/jsres.php
includes/clientside/static/ajax.js
includes/clientside/static/autofill.js
includes/clientside/static/fadefilter.js
includes/clientside/static/functions.js
includes/clientside/static/tinymce-init.js
includes/paths.php
includes/template.php
--- a/includes/clientside/jsres.php	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/jsres.php	Sat Jul 11 20:25:50 2009 -0400
@@ -197,7 +197,7 @@
       $file_contents = file_get_contents("includes/clientside/static/$js_file");
       $everything .= jsres_cache_check($js_file, $file_contents) . ' loaded_components[\'' . $js_file . '\'] = true;';
     }
-    $everything .= 'if ( onload_complete ) { console.debug("running hooks from jsres"); runOnloadHooks(); onload_hooks = []; };';
+    $everything .= 'if ( onload_complete ) { runOnloadHooks(); onload_hooks = []; };';
   }
   else
   {
@@ -210,7 +210,7 @@
     $apex = filemtime("includes/clientside/static/$js_file");
     
     $file_contents = file_get_contents("includes/clientside/static/$js_file");
-    $everything = jsres_cache_check($js_file, $file_contents) . ' loaded_components[\'' . $js_file . '\'] = true; if ( onload_complete ) { console.debug("running hooks from jsres"); runOnloadHooks(); onload_hooks = []; };';
+    $everything = jsres_cache_check($js_file, $file_contents) . ' loaded_components[\'' . $js_file . '\'] = true; if ( onload_complete ) { runOnloadHooks(); onload_hooks = []; };';
   }
 }
 else
--- a/includes/clientside/static/ajax.js	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/static/ajax.js	Sat Jul 11 20:25:50 2009 -0400
@@ -1658,7 +1658,7 @@
                   text: $lang.get('acppl_btn_install'),
                   color: 'red',
                   style: {
-                    fontWeight: 'bold',
+                    fontWeight: 'bold'
                   },
                   onclick: function() {
                     ajaxPluginAction(action + '_confirm', plugin_filename, btnobj, true);
--- a/includes/clientside/static/autofill.js	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/static/autofill.js	Sat Jul 11 20:25:50 2009 -0400
@@ -38,7 +38,7 @@
         },
         tableHeader: '<tr><th>' + $lang.get('user_autofill_heading_suggestions') + '</th></tr>',
         showWhenNoResults: true,
-        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>',
+        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>'
     });
   }
 }
@@ -55,7 +55,7 @@
           return html;
         },
         showWhenNoResults: true,
-        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>',
+        noResultsHTML: '<tr><td class="row1" style="font-size: smaller;">' + $lang.get('user_autofill_msg_no_suggestions') + '</td></tr>'
     });
   }
 }
@@ -491,7 +491,12 @@
       
       if ( options.tableHeader )
       {
-        ul.innerHTML = options.tableHeader;
+        // fails in IE6
+        try
+        {
+          ul.innerHTML = options.tableHeader;
+        }
+        catch ( e ) {};
       }
       
       if ( num == 0 )
--- a/includes/clientside/static/fadefilter.js	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/static/fadefilter.js	Sat Jul 11 20:25:50 2009 -0400
@@ -71,7 +71,7 @@
     thediv.style.filter = 'alpha(opacity=0)';
     thediv.style.backgroundColor = '#000000';
     thediv.style.width =  '100%';
-    thediv.style.height = '100%';
+    thediv.style.height = IE ? h + 'px' : '100%';
     thediv.style.zIndex = getHighestZ() + 1;
     thediv.id = layerid;
     thediv.myOpacVal = opacVal;
--- a/includes/clientside/static/functions.js	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/static/functions.js	Sat Jul 11 20:25:50 2009 -0400
@@ -940,7 +940,7 @@
 // Included only for API-compatibility
 function ajaxPromptAdminAuth(call_on_ok, level)
 {
-  ajaxLogonInit(call_on_ok, level);
+  ajaxLoginInit(call_on_ok, level);
 }
 
 /**
--- a/includes/clientside/static/tinymce-init.js	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/clientside/static/tinymce-init.js	Sat Jul 11 20:25:50 2009 -0400
@@ -47,7 +47,7 @@
   theme_advanced_statusbar_location : 'bottom',
   noneditable_noneditable_class : 'mce_readonly',
   content_css : css_url,
-  spellchecker_rpc_url : scriptPath + '/includes/clientside/tinymce/plugins/spellchecker/rpc.php',
+  spellchecker_rpc_url : scriptPath + '/includes/clientside/tinymce/plugins/spellchecker/rpc.php'
 };
 
 var enano_tinymce_gz_options = {
--- a/includes/paths.php	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/paths.php	Sat Jul 11 20:25:50 2009 -0400
@@ -491,14 +491,20 @@
     $i = 0;
     $ret = '';
     $icon = $this->make_sprite_icon(4, 2);
-    $icon = addslashes($icon);
-    $ret .= "var TREE_ITEMS = [\n  ['$icon" . $lang->get('adm_btn_home') . "', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n    ";
+    $ret .= "var TREE_ITEMS = ";
+    $tree = array(
+        array($icon . $lang->get('adm_btn_home'), "javascript:ajaxPage('{$this->nslist['Admin']}Home');")
+      );
+    
+    $root =& $tree[0];
+    
     foreach($k as $key)
     {
       $i++;
       $name = $lang->get($key);
-      $ret .= "['".$name."', 'javascript:trees[0].toggle($i)', \n";
-      foreach($this->admin_tree[$key] as $c)
+      $group = array($name, "javascript:trees[0].toggle($i)");
+      
+      foreach($this->admin_tree[$key] as $nodeid => $c)
       {
         $i++;
         $name = $lang->get($c['name']);
@@ -519,20 +525,29 @@
         {
           $icon = '';
         }
-        $icon = addslashes($icon);
-        $ret .= "        ['$icon$name', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n";
+        $group[] = array("$icon$name", "javascript:ajaxPage('{$this->nslist['Admin']}{$c['pageid']}');");
       }
-      $ret .= "      ],\n";
+      
+      $root[] = $group;
     }
     $icon = $this->make_sprite_icon(1, 1);
-    $icon = addslashes($icon);
-    $ret .= "    ['$icon" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n";
-    $ret .= "    ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', 
-                   ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();']
-                 ],\n";
+    $root[] = array(
+        $icon . $lang->get('adm_btn_logout'),
+        "javascript:ajaxPage('{$this->nslist['Admin']}AdminLogout');"
+      );
+    $root[] = array(
+        "<span id=\"keepalivestat\">" . $lang->get('adm_btn_keepalive_loading') . "</span>",
+        "javascript:ajaxToggleKeepalive();",
+        array(
+            $lang->get('adm_btn_keepalive_about'),
+            "javascript:aboutKeepAlive();"
+          )
+      );
+    
+    $ret .= enano_json_encode($tree) . ';';
+    
     // I used this while I painstakingly wrote the Runt code that auto-expands certain nodes based on the value of a bitfield stored in a cookie. *shudders*
     // $ret .= "    ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n";
-    $ret .= "]\n];";
     return $ret;
   }
   
--- a/includes/template.php	Sat Jul 11 20:24:19 2009 -0400
+++ b/includes/template.php	Sat Jul 11 20:25:50 2009 -0400
@@ -479,45 +479,6 @@
     global $lang;
     global $email;
     
-    // IE PNG fixing code
-    if ( isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE') )
-    {
-      $this->add_header('
-        <!--[if lt IE 7]>
-        <script language="JavaScript">
-        function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
-        {
-           var arVersion = navigator.appVersion.split("MSIE");
-           var version = parseFloat(arVersion[1]);
-           if (version >= 5.5 && typeof(document.body.filters) == "object")
-           {
-              for(var i=0; i<document.images.length; i++)
-              {
-                 var img = document.images[i];
-                 continue;
-                 var imgName = img.src.toUpperCase();
-                 if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
-                 {
-                    var imgID = (img.id) ? "id=\'" + img.id + "\' " : "";
-                    var imgClass = (img.className) ? "class=\'" + img.className + "\' " : "";
-                    var imgTitle = (img.title) ? "title=\'" + img.title + "\' " : "title=\'" + img.alt + "\' ";
-                    var imgStyle = "display:inline-block;" + img.style.cssText;
-                    if (img.align == "left") imgStyle = "float:left;" + imgStyle;
-                    if (img.align == "right") imgStyle = "float:right;" + imgStyle;
-                    if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle;
-                    var strNewHTML = "<span " + imgID + imgClass + imgTitle + " style=\\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" + "(src=\\\'" + img.src + "\\\', sizingMethod=\'scale\');\\"></span>";
-                    img.outerHTML = strNewHTML;
-                    i = i-1;
-                 }
-              }
-           }   
-        }
-        window.attachEvent("onload", correctPNG);
-        </script>
-        <![endif]-->
-        ');
-    }
-    
     $is_opera = (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'Opera')) ? true : false;
     $is_msie = (isset($_SERVER['HTTP_USER_AGENT']) && strstr($_SERVER['HTTP_USER_AGENT'], 'MSIE')) ? true : false;