Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Wed May 24, 2017 2:50 pm

All times are UTC - 5 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: device_edit_top_links
PostPosted: Thu Feb 16, 2012 5:17 am 
Offline

Joined: Wed Feb 23, 2011 11:53 am
Posts: 41
Hy,

i want to add a link in the Host Top links, but this link must have the current host ID.

how to do that ?

Laurent

_________________
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47


Top
 Profile  
 
 Post subject: Re: device_edit_top_links
PostPosted: Sun Feb 19, 2012 1:52 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
Are you talking about the links seen on top, when editing a single host?
Whcih method of adding your custom link do you prefer, by writing a plugin (using a plugin hook) or by simply patching the code?
Which base version of cacti are you using?
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: device_edit_top_links
PostPosted: Mon Feb 20, 2012 4:04 am 
Offline

Joined: Wed Feb 23, 2011 11:53 am
Posts: 41
hello,

gandalf wrote:
Are you talking about the links seen on top, when editing a single host?


yes

gandalf wrote:
Whcih method of adding your custom link do you prefer, by writing a plugin (using a plugin hook) or by simply patching the code?


i want to add this within a plugin, so using plugin hook.

gandalf wrote:
Which base version of cacti are you using?

my cacti version is 0.8.7i

Laurent

_________________
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47


Top
 Profile  
 
 Post subject: Re: device_edit_top_links
PostPosted: Tue Feb 21, 2012 4:16 pm 
Offline
Developer
User avatar

Joined: Thu Dec 02, 2004 2:46 am
Posts: 22461
Location: Muenster, Germany
The relevant part of code is
Code:
            <td class="textInfo" valign="top">
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs_new.php?host_id=" . $host["id"]);?>">Create Graphs for this Host</a><br>
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("data_sources.php?host_id=" . $host["id"] . "&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1");?>">Data Source List</a><br>
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs.php?host_id=" . $host["id"] . "&graph_rows=30&filter=&template_id=-1&page=1");?>">Graph List</a>
               <?php api_plugin_hook('device_edit_top_links'); ?>
            </td>
So you will use the hook device_edit_top_links and may want to use get_request_var("id") as the id of the host. It would be safe to use
Code:
   /* ================= input validation ================= */
   input_validate_input_number(get_request_var("id"));
   /* ==================================================== */
as validation before using the id.
R.

_________________
Official Cacti Documentation
Official Debugging Help
Central Plugin Repository
Central Templates Repository


Top
 Profile  
 
 Post subject: Re: device_edit_top_links
PostPosted: Wed Feb 22, 2012 4:09 am 
Offline

Joined: Wed Feb 23, 2011 11:53 am
Posts: 41
hy,

gandalf wrote:
The relevant part of code is
Code:
            <td class="textInfo" valign="top">
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs_new.php?host_id=" . $host["id"]);?>">Create Graphs for this Host</a><br>
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("data_sources.php?host_id=" . $host["id"] . "&ds_rows=30&filter=&template_id=-1&method_id=-1&page=1");?>">Data Source List</a><br>
               <span style="color: #c16921;">*</span><a href="<?php print htmlspecialchars("graphs.php?host_id=" . $host["id"] . "&graph_rows=30&filter=&template_id=-1&page=1");?>">Graph List</a>
               <?php api_plugin_hook('device_edit_top_links'); ?>
            </td>
So you will use the hook device_edit_top_links and may want to use get_request_var("id") as the id of the host. It would be safe to use
Code:
   /* ================= input validation ================= */
   input_validate_input_number(get_request_var("id"));
   /* ==================================================== */
as validation before using the id.
R.



Great !
thanks a lot Gandalf.

Laurent

_________________
Cacti 0.8.7g - Windows - poller type : spine
php 5.2.14 - MySQL 5.1.47


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

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