diff --git a/e107_admin/includes/tabbed.php b/e107_admin/includes/tabbed.php index 220ddb22f..e183c0aa4 100644 --- a/e107_admin/includes/tabbed.php +++ b/e107_admin/includes/tabbed.php @@ -16,73 +16,158 @@ if (!defined('e107_INIT')) { exit; } -$mes = e107::getMessage(); +new tabbed; -$admin_cat = e107::getNav()->adminCats(); - -$text = "
-
- "; - - - -foreach ($admin_cat['id'] as $cat_key => $cat_id) +class tabbed { - $text_check = FALSE; + protected $links = array(); + + function __construct() + { + $core = e107::getNav()->adminLinks('assoc'); + $plugs = e107::getNav()->pluginLinks(E_16_PLUGMANAGER, "array"); + + $this->links = array_merge($core,$plugs); + require_once(e_HANDLER."admin_handler.php"); + $this->links = multiarray_sort($this->links,'title'); //XXX Move this function in e107_class? + $this->render(); + } + + + function render() + { + $ns = e107::getRender(); + $mes = e107::getMessage(); + $admin_cat = e107::getNav()->adminCats(); - $text_cat = "
-
-
".$admin_cat['title'][$cat_key]."
- "; + $text = "
"; + $text .= ""; + // print_a($this->links); + $text .= "
"; + foreach ($admin_cat['id'] as $id => $cat_id) + { + $cls = ($id == 1) ? "active" : ""; + $text .= "
".$this->renderCat($id)."
"; + } + $text .= "
"; + $text .= "
"; + + + + + + + + + + $ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text); + + + + } + + + function renderCat($cat) + { + $text = ""; + foreach($this->links as $val) + { + if($val['cat'] != $cat) + { + // echo "
".$funcinfo['cat']." != ".$cat; + continue; + } + + $text .= e107::getNav()->renderAdminButton($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div"); + } + + return $text; + + } + + + + function render2() + { + $mes = e107::getMessage(); + + $admin_cat = e107::getNav()->adminCats(); + + $text = "
+ + "; + + $text .= "
"; + + print_a($admin_cat); + + foreach ($admin_cat['id'] as $cat_key => $cat_id) + { + $text_check = FALSE; + + $text_cat = ""; + + + if ($cat_key != 5) // Note the Plugin category. + { + foreach ($newarray as $key => $funcinfo) + { + if ($funcinfo[4] == $cat_key) + { + $text_rend = e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'div'); + if ($text_rend) + { + $text_check = TRUE; + } + $text_cat .= $text_rend; + } + } + } + else // Plugin category. + { + $text_rend = e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "div"); + + if ($text_rend) + { + $text_check = TRUE; + } + $text_cat .= $text_rend; + } + //$text_cat .= render_clean(); + + if ($text_check) + { + $text .= "
\n"; + $text .= "
".$admin_cat['title'][$cat_key]."
"; + $text .= $text_cat ; + $text .= "
"; + } + + + + } - - if ($cat_key != 5) // Note the Plugin category. - { - foreach ($newarray as $key => $funcinfo) - { - if ($funcinfo[4] == $cat_key) - { - $text_rend = e107::getNav()->renderAdminButton($funcinfo[0], $funcinfo[1], $funcinfo[2], $funcinfo[3], $funcinfo[6], 'classis'); - if ($text_rend) - { - $text_check = TRUE; - } - $text_cat .= $text_rend; - } - } - } - else // Plugin category. - { - $text_rend = e107::getNav()->pluginLinks(E_32_PLUGMANAGER, "classis"); - - if ($text_rend) - { - $text_check = TRUE; - } - $text_cat .= $text_rend; - } - $text_cat .= render_clean(); - $text_cat .= "
-
"; - - if ($text_check) - { - $text .= $text_cat; - } + + + $text .= "
"; + + $ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text); + + } } - - - -$text .= ""; - -$ns->tablerender(ADLAN_47." ".ADMINNAME, $mes->render().$text); - - ?> \ No newline at end of file diff --git a/e107_handlers/admin_handler.php b/e107_handlers/admin_handler.php index 5bc470b96..ce69ae9d0 100644 --- a/e107_handlers/admin_handler.php +++ b/e107_handlers/admin_handler.php @@ -71,159 +71,3 @@ if (!function_exists('multiarray_sort')) { } } -/** - * Experiment - * Most basic & performance wise solution for admin icons override - */ -class e_admin_icons -{ - /** - * @var string icons absolute URL path - */ - protected $path; - - /** - * @var string icons relative server path - */ - protected $relpath; - - /** - * Constructor - * - * @return void - */ - function __construct() - { - //XXX maybe we should use admintheme pref instead THEME here? - if(is_readable(THEME.'icons/admin/')) - { - $this->path = THEME_ABS.'icons/admin/'; - $this->relpath = THEME.'icons/admin/'; - } - else - { - $this->path = e_IMAGE_ABS.'admin_images/'; - $this->relpath = e_IMAGE.'admin_images/'; - } - } - - /** - * Get icon absolute path (url, without domain) - * - * @param string $name without size and extension e.g. 'edit' - * @param integer size pixel , default 16 - * @param string $extension without leading dot, default 'png' - * @return string icon url without domain - */ - public function url($name, $size = 16, $extension = 'png') - { - if($size) - { - $name .= '_'.$size; - } - return $this->path.$name.'.'.$extension; - } - - /** - * Get image tag of an icon - * - * @param string $name without size and extension e.g. 'edit' - * @param integer $size default 16 - * @param string $class default empty - * @param string $alt default empty - * @param string $extension default 'png' - * @return string img tag - */ - public function tag($name, $size = 16, $class='', $alt = '', $extension = 'png') - { - $_class = 'icon'; - if($size) - { - $_class .= ' S'.$size; - } - if($class) - { - $_class .= ' '.$class; - } - $src = $this->url($name, $size, $extension); - - return ''.$alt.''; - } - - /** - * Get icon relative server path - * - * @param string $name without size and extension e.g. 'edit' - * @param integer size pixel , default 16 - * @param string $extension without leading dot, default 'png' - * @return string icon relative server path - */ - public function path($name, $size = 16, $extension = 'png') - { - if($size) - { - $name .= '_'.$size; - } - return $this->relpath.$name.'.'.$extension; - } -} - -/** - * Convenient proxy to e_admin_icons::url() - * Get icon absolute path (url, without domain) - * Example: - * - * echo _I('edit'); - * // If icon path is overloaded by current admin theme: - * // '/e107_themes/current_theme/icons/admin/edit_16.png' - * // else - * // '/e107_images/admin_images/edit_16.png' - * - * - * @param string $name without size and extension e.g. 'edit' - * @param integer size pixel , default 16 - * @param string $extension without leading dot, default 'png' - * @return string icon url without domain - */ -function _I($name, $size = 16, $extension = 'png') -{ - return e107::getSingleton('e_admin_icons')->url($name, $size, $extension); -} - -/** - * Convenient proxy to e_admin_icons::tag() - * Get image tag of an icon - * Example: echo _ITAG('edit'); - * @see _I() - * @param string $name without size and extension e.g. 'edit' - * @param integer $size default 16 - * @param string $class default empty - * @param string $alt default empty - * @param string $extension default 'png' - * @return string img tag - */ -function _ITAG($name, $size = 16, $class = '', $alt = '', $extension = 'png') -{ - return e107::getSingleton('e_admin_icons')->tag($name, $size, $class, $alt, $extension); -} - -/** - * Convenient proxy to e_admin_icons::path() - * Get icon relative server path - * - * echo _IPATH('edit'); - * // If icon path is overloaded by current admin theme: - * // '../e107_themes/current_theme/icons/admin/edit_16.png' - * // else - * // '../e107_images/admin_images/edit_16.png' - * - * - * @param string $name without size and extension e.g. 'edit' - * @param integer size pixel , default 16 - * @param string $extension without leading dot, default 'png' - * @return string icon relative server path - */ -function _IPATH($name, $size = 16, $extension = 'png') -{ - return e107::getSingleton('e_admin_icons')->path($name, $size, $extension); -} diff --git a/e107_handlers/sitelinks_class.php b/e107_handlers/sitelinks_class.php index e2c560ea7..351876d19 100644 --- a/e107_handlers/sitelinks_class.php +++ b/e107_handlers/sitelinks_class.php @@ -743,6 +743,7 @@ class e_navigation $val['title'] = $val[1]; $val['link'] = $val[0]; $val['caption'] = $val['2']; + $val['cat'] = $val['4']; $val['perms'] = $val['3']; $array_functions_assoc[$key] = $val; } @@ -750,6 +751,24 @@ class e_navigation return $array_functions_assoc; } + + /** + * Convert from plugin category found in plugin.xml to Navigation Category ID number. + */ + function plugCatToCoreCat($cat) + { + $convert = array( + 'settings' => array(1,'setMenu'), + 'users' => array(2,'userMenu'), + 'content' => array(3,'contMenu'), + 'tools' => array(4,'toolMenu'), + 'manage' => array(6,'managMenu'), + 'misc' => array(7,'miscMenu'), + 'help' => array(20,'helpMenu') + ); + + return (int) vartrue($convert[$cat][0]); + } // Function renders all the plugin links according to the required icon size and layout style // - common to the various admin layouts such as infopanel, classis etc. @@ -785,9 +804,11 @@ class e_navigation $plugin_path = $plug; $name = $plugs->plug_vars['@attributes']['name']; - - /* echo "

".$name." ($plug)

"; - print_a($plugs->plug_vars);*/ + /* + echo "

".$name." ($plug)

"; + print_a($plugs->plug_vars); + */ + if(!varset($plugs->plug_vars['adminLinks']['link'])) { continue; @@ -815,7 +836,14 @@ class e_navigation $eplug_name = $tp->toHTML($eplug_name,FALSE,"defs, emotes_off"); $plugin_icon = $eplug_icon_small ? "" : E_16_PLUGIN; $plugin_icon_32 = $eplug_icon ? "" : E_32_PLUGIN; - $plugin_array['p-'.$plugin_path] = array('link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, 'title' => $eplug_name, 'caption' => $eplug_caption, 'perms' => "P".varset($plug_id[$plugin_path]), 'icon' => $plugin_icon, 'icon_32' => $plugin_icon_32); + $plugin_array['p-'.$plugin_path] = array( + 'link' => e_PLUGIN.$plugin_path."/".$eplug_conffile, + 'title' => $eplug_name, 'caption' => $eplug_caption, + 'perms' => "P".varset($plug_id[$plugin_path]), + 'icon' => $plugin_icon, + 'icon_32' => $plugin_icon_32, + 'cat' => $this->plugCatToCoreCat($plugs->plug_vars['category']) + ); } } }