]> git.mjollnir.org Git - moodle.git/commitdiff
Fixes Bug MDL-8709 "Javascript: pseudo-protocol in admin tree block is bad"
authornfreear <nfreear>
Thu, 1 Mar 2007 13:06:14 +0000 (13:06 +0000)
committernfreear <nfreear>
Thu, 1 Mar 2007 13:06:14 +0000 (13:06 +0000)
blocks/admin_tree/block_admin_tree.php

index 68c013597219ea9af35c8ce256e1544ed01d62fa..222a104d0cd9e577218213d757273fc3d04e84d7 100644 (file)
@@ -34,9 +34,9 @@ class block_admin_tree extends block_base {
         $strfolderopened = s(get_string('folderopened'));
 
         for ($i = 0; $i < $this->currentdepth; $i++) {
-            $this->tempcontent .= "&nbsp;&nbsp;&nbsp;";
+            $this->tempcontent .= "&nbsp; &nbsp;";
         }
-        $this->tempcontent .= '<a href="javascript:toggle(\'vh_span' . $this->spancounter . '\');">';
+        $this->tempcontent .= '<a href="#" onclick="toggle(\'vh_span' . $this->spancounter . '\');return false">';
         $this->tempcontent .= '<span id="vh_span' . $this->spancounter . 'indicator"><img src="' . $CFG->wwwroot . '/blocks/admin_tree/open.gif" alt="'.$strfolderopened.'" /></span> ';
         $this->tempcontent .= $visiblename . '</a><br /><span id="vh_span' . $this->spancounter . '">' . "\n";
         $this->currentdepth++;
@@ -51,7 +51,7 @@ class block_admin_tree extends block_base {
     function create_item($visiblename,$link,$icon,$class) {
         global $CFG;
         for ($i = 0; $i < $this->currentdepth; $i++) {
-            $this->tempcontent .= "&nbsp;&nbsp;&nbsp;";
+            $this->tempcontent .= "&nbsp; &nbsp;";
         }
         $this->tempcontent .= '<a class="'.$class.'" href="'.$link.'"><img src="'.$icon.'" alt="" />'.
                                $visiblename.'</a><br />'."\n";
@@ -168,7 +168,7 @@ class block_admin_tree extends block_base {
             $this->content->text .= '}' . "\n";
 
             $this->content->text .= 'function collapseall() {' . "\n";
-            $this->content->text .= '  for (i = vh_numspans; i > 0; i=i-1 ) {' . "\n";
+            $this->content->text .= '  for (i = vh_numspans; i > 0; i--) {' . "\n";
             $this->content->text .= '    collapse("vh_span" + String(i));' . "\n";
             $this->content->text .= '  }' . "\n";
             $this->content->text .= '}' . "\n";