Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Mon May 27, 2019 12:16 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Enable Sub-Menus for plugins
PostPosted: Mon Mar 10, 2008 4:15 am 
Offline
Cacti Guru User
User avatar

Joined: Thu Jan 31, 2008 6:39 am
Posts: 2710
Location: Kressbronn, Germany
Hi,

For plugins it would be great to be able to also generate sub-menus like the "Graph Management". Unfortunately, the draw_menu code functions ( /lib/html.php) prevents this by doing the following:

Code:
/* if the current page exists in the sub-items array, draw each sub-item */
if (array_key_exists(basename($_SERVER["PHP_SELF"]), $item_title) == true) {
    $draw_sub_items = true;
}else{
    $draw_sub_items = false;
}


due to the usage of basename, it is not possible to have a menu like this:

Code:
    $temp = array(
        "plugins/nmidPhpip/display.php" => array(
            "plugins/nmidPhpip/display.php" => "NMID phpIP",
            "plugins/nmidPhpip/cidr_add.php" => "CIDR Add",
            "plugins/nmidPhpip/cidr_remove.php" => "CIDR Remove",
            "plugins/nmidPhpip/cidr_desc.php" => "CIDR Description",
            "plugins/nmidPhpip/prefix_add.php" => "Prefix Add",
            "plugins/nmidPhpip/prefix_remove.php" => "Prefix Remove",
            "plugins/nmidPhpip/prefix_desc.php" => "Prefix Description",
            "plugins/nmidPhpip/subnetSummary.php" => "Subnet Summary",
            ),
    );

   if (isset($menu["NMID"]))
      $menu["NMID"] = array_merge($temp, $menu["NMID"]);
   else
      $menu["NMID"] = $temp;



can it be changed to something like ( only works with 0.8.7b ):
Code:
$current_url = preg_replace("/(^\/(cacti\/)?)()/","$3",$_SERVER["PHP_SELF"]);

if (array_key_exists($current_url, $item_title) == true) {
      $draw_sub_items = true;
}else{
      $draw_sub_items = false;
}




so plugins can also use sub-menus ? This would make the menu to the left more user-friendly.


Attachments:
nmid_submenu.jpg
nmid_submenu.jpg [ 13.43 KiB | Viewed 4017 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group