489 |
489 |
490 $k = array_keys($this->admin_tree); |
490 $k = array_keys($this->admin_tree); |
491 $i = 0; |
491 $i = 0; |
492 $ret = ''; |
492 $ret = ''; |
493 $icon = $this->make_sprite_icon(4, 2); |
493 $icon = $this->make_sprite_icon(4, 2); |
494 $icon = addslashes($icon); |
494 $ret .= "var TREE_ITEMS = "; |
495 $ret .= "var TREE_ITEMS = [\n ['$icon" . $lang->get('adm_btn_home') . "', 'javascript:ajaxPage(\'".$this->nslist['Admin']."Home\');',\n "; |
495 $tree = array( |
|
496 array($icon . $lang->get('adm_btn_home'), "javascript:ajaxPage('{$this->nslist['Admin']}Home');") |
|
497 ); |
|
498 |
|
499 $root =& $tree[0]; |
|
500 |
496 foreach($k as $key) |
501 foreach($k as $key) |
497 { |
502 { |
498 $i++; |
503 $i++; |
499 $name = $lang->get($key); |
504 $name = $lang->get($key); |
500 $ret .= "['".$name."', 'javascript:trees[0].toggle($i)', \n"; |
505 $group = array($name, "javascript:trees[0].toggle($i)"); |
501 foreach($this->admin_tree[$key] as $c) |
506 |
|
507 foreach($this->admin_tree[$key] as $nodeid => $c) |
502 { |
508 { |
503 $i++; |
509 $i++; |
504 $name = $lang->get($c['name']); |
510 $name = $lang->get($c['name']); |
505 if ( $c['icon'] && $c['icon'] != cdnPath . '/images/spacer.gif' ) |
511 if ( $c['icon'] && $c['icon'] != cdnPath . '/images/spacer.gif' ) |
506 { |
512 { |
517 } |
523 } |
518 else |
524 else |
519 { |
525 { |
520 $icon = ''; |
526 $icon = ''; |
521 } |
527 } |
522 $icon = addslashes($icon); |
528 $group[] = array("$icon$name", "javascript:ajaxPage('{$this->nslist['Admin']}{$c['pageid']}');"); |
523 $ret .= " ['$icon$name', 'javascript:ajaxPage(\\'".$this->nslist['Admin'].$c['pageid']."\\');'],\n"; |
529 } |
524 } |
530 |
525 $ret .= " ],\n"; |
531 $root[] = $group; |
526 } |
532 } |
527 $icon = $this->make_sprite_icon(1, 1); |
533 $icon = $this->make_sprite_icon(1, 1); |
528 $icon = addslashes($icon); |
534 $root[] = array( |
529 $ret .= " ['$icon" . $lang->get('adm_btn_logout') . "', 'javascript:ajaxPage(\\'".$this->nslist['Admin']."AdminLogout\\');'],\n"; |
535 $icon . $lang->get('adm_btn_logout'), |
530 $ret .= " ['<span id=\\'keepalivestat\\'>" . $lang->get('adm_btn_keepalive_loading') . "</span>', 'javascript:ajaxToggleKeepalive();', |
536 "javascript:ajaxPage('{$this->nslist['Admin']}AdminLogout');" |
531 ['" . $lang->get('adm_btn_keepalive_about') . "', 'javascript:aboutKeepAlive();'] |
537 ); |
532 ],\n"; |
538 $root[] = array( |
|
539 "<span id=\"keepalivestat\">" . $lang->get('adm_btn_keepalive_loading') . "</span>", |
|
540 "javascript:ajaxToggleKeepalive();", |
|
541 array( |
|
542 $lang->get('adm_btn_keepalive_about'), |
|
543 "javascript:aboutKeepAlive();" |
|
544 ) |
|
545 ); |
|
546 |
|
547 $ret .= enano_json_encode($tree) . ';'; |
|
548 |
533 // 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* |
549 // 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* |
534 // $ret .= " ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n"; |
550 // $ret .= " ['(debug) Clear menu bitfield', 'javascript:createCookie(\\'admin_menu_state\\', \\'1\\', 365);'],\n"; |
535 $ret .= "]\n];"; |
|
536 return $ret; |
551 return $ret; |
537 } |
552 } |
538 |
553 |
539 /** |
554 /** |
540 * Internal function to generate HTML code for an icon in the admin panel tree which is sprited. |
555 * Internal function to generate HTML code for an icon in the admin panel tree which is sprited. |