add "left menu" to new Page

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

Post Reply
ebini
Posts: 21
Joined: Mon Mar 23, 2009 9:55 am

add "left menu" to new Page

Post by ebini »

Hi,

i just want to add an entry to the left menu under Management. This was not a Problem:

Code: Select all

function plugin_test_install() {
        global $config;
        api_plugin_register_hook('test', 'config_arrays', 'test_config_arrays', 'setup.php');
        api_plugin_register_hook('test', 'draw_navigation_text', 'test_draw_navigation_text', 'setup.php');
}
...
function test_draw_navigation_text ($nav) {
  $nav["test.php:"] = array("title" => "test","mapping"=>"index.php:","url"=>"test.php","level"=>"1");
  return $nav;
}

function test_config_arrays () {
    global $user_auth_realms, $user_auth_realm_filenames, $menu;

    /* register all realms */
    api_plugin_register_realm('test', 'test.php', 'Plugin -> test: view', 1);

    /* show additional menu entries if plugin is enabled */
    if(api_plugin_is_enabled('test')) {
        $menu["Management"]['plugins/test/test.php']  = "Edit Tree";

    }
}
The Menu entry shows, and i can click on my "dummy"-Page test.php

But when i click on my new left menu entry (with my own php-page) i want to see the left menu.

Code: Select all

<?php
$guest_account = true;
global $config;
chdir("../../");
include("./include/auth.php");
include_once("./include/top_graph_header.php");
print "No content Yet!";
include_once("./include/bottom_footer.php");
?>
But, the left side menu doesn't show.

What do i need to do, that this menu shows when i include top_headers.php?


/Ebini
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

Yes, you need to include top_headers.php
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
ebini
Posts: 21
Joined: Mon Mar 23, 2009 9:55 am

Post by ebini »

i added top_headers.

The tabs are shown, but what is needed to enable the left (console) menu?

Thanks

Ebini
mcutting
Cacti Guru User
Posts: 1884
Joined: Mon Oct 16, 2006 5:57 am
Location: United Kingdom
Contact:

Post by mcutting »

ebini wrote:i added top_headers.

The tabs are shown, but what is needed to enable the left (console) menu?

Thanks

Ebini
My bad - include top_graph_header.php
Cacti Version 0.8.8b
Cacti OS Ubuntu LTS
RRDTool Version RRDTool 1.4.7
Poller Information
Type SPINE 0.8.8b
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

You should use the provided PIA interfaces to add your own stuff.
PIA will be part of core cacti starting with 088
R.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

gandalf wrote:You should use the provided PIA interfaces to add your own stuff.
PIA will be part of core cacti starting with 088
R.
And what is the PIA interface for using the standard Cacti page layout?
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Spoke too soon. The method given above is the recommended one. I was confused by the additional code apart from the "core" $menu-handling
R.
ebini
Posts: 21
Joined: Mon Mar 23, 2009 9:55 am

Post by ebini »

Sorry,

i don't know what the problem was (or what i have changed(?))

The left menu is shown.

But i don't understand what is necessary for cacti to decide to show the left menu or not (?)

Perhaps someone has a hint for me

THanks

Ebini
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

ebini wrote:Sorry,

i don't know what the problem was (or what i have changed(?))

The left menu is shown.

But i don't understand what is necessary for cacti to decide to show the left menu or not (?)

Perhaps someone has a hint for me

THanks

Ebini
There are two files: top_graph_header.php and top_header.php. One has the menu, one doesn't. I think it's top_graph_header.php that doesn't have the menu, because it's the one your users would see.
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
ebini
Posts: 21
Joined: Mon Mar 23, 2009 9:55 am

Post by ebini »

o.k. thank you....

:oops:
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest