Hook Request: page_top

Discussions on developing plugins for the Cacti Plugin Architecture

Moderators: Developers, Moderators

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

Hook Request: page_top

Post by Howie »

Completely unrelated to maps or anything, I've been thinking about some unobtrusive javascript things for the cacti UI. To do it really means being able to load new stylesheets and javascript in the <head> section of the pages though. I'd like to be able to load jquery and then mess with the existing page through the DOM.

So the hook is: page_head. Called just before the </head> is output in top_header.php and top_graph_header.php, and wherever else contains a web interface top bit. Allows you to add your own <style> and <script> tags in a nicer, valid, way.

I think it's a two line change, isn't it? One in each file to call do_hook...

Hehe. in fact, I just implemented it too :-) 6 lines. Seems to work OK.
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
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

We are going to implement jquery in the next version of Cacti. It's even debatable to include it in 0.8.6x.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

TheWitness wrote:We are going to implement jquery in the next version of Cacti. It's even debatable to include it in 0.8.6x.

TheWitness
Sure, but even if you did, there would still be a need for a way to add additional CSS or script in the head, which isn't currently possible. It would allow the Cycle plugin to use valid HTML (meta only belongs in the head) for example, or me to use Interface/Draggable to sort the order of weathermaps.
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
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Ah, as a developer anything is possible ;) Do you have any idea how swamped I am right now :( Sick too :(

I thought about reworking the forms engine to allow things such as this, but I don't know where I would slide it in. Too busy.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Howie,

Send you hook request to Jimmy. Let's get it into PIA 1.2. We'll need one for both the to_graph_header.php and top_header.php. I have a few of my own for some neet plugins. (yes, my one of my plugins uses it's own top_**_header.php)

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
cigamit
Developer
Posts: 3369
Joined: Thu Apr 07, 2005 3:29 pm
Location: B/CS Texas
Contact:

Post by cigamit »

[teenage girl voice]
Wow, that like so last Feb 9 when I committed that exact hook into PA v2.0
[/teenage girl voice]

Weird thing is that I even used the exact same name for the hook. Someone has been looking over my shoulder and reading my notes. I haven't back ported it to the v1.2 branch, but that should only take a few minutes. I had even added a hook to allow you to change the Page title.
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

TheWitness wrote:Ah, as a developer anything is possible ;) Do you have any idea how swamped I am right now :( Sick too :(

I thought about reworking the forms engine to allow things such as this, but I don't know where I would slide it in. Too busy.

TheWitness
I know how you feel. I have 4 or 5 projects I'd love to be working on if only Real Work didn't interfere. Long days, big new project and new things to learn.

2 cool weathermap big features, and 3 seperate apps for network stuff. Meh. Still, it pays the mortgage, and I guess that's a good thing :-)
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
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

cigamit wrote:[teenage girl voice]
Wow, that like so last Feb 9 when I committed that exact hook into PA v2.0
[/teenage girl voice]

Weird thing is that I even used the exact same name for the hook. Someone has been looking over my shoulder and reading my notes. I haven't back ported it to the v1.2 branch, but that should only take a few minutes. I had even added a hook to allow you to change the Page title.
Is this any nearer to reality now, cigamit? ;-) I've got another idea for something that could use it...

Incidentally, it'd be really cool (and a small change?) if there were some class= and id= attached to some of the Cacti ui bits (like graphs mainly). class=graphimage id=graph3342 type of thing.
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
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

So, these below in the form's array's right? I would be willing to "rush" that into the Beta2 of 0.8.6k.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Looking at lib/html_form.php, I suggest a more "significant" rewrite while preserving the form arrays. It would take a day or so.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

TheWitness wrote:So, these below in the form's array's right? I would be willing to "rush" that into the Beta2 of 0.8.6k.

Larry
I think I've just made all the changes I was interested in. They're in graph.php, lib/html.php and lib/html_tree.php

Just a simple:

Code: Select all

 class='graphimage' id='graph_$local_graph_id'
(or $graph['local_graph_id']) in about a dozen places.

Add the page_top hook, and it's then easy to add behaviour with jQuery or a similar js library.

What I wanted to make was a 'quicktree' plugin. A tab at the top where you can "park" graphs you are working with at the moment, and the ability to drag graphs onto the tab. It should be as easy as possible to use. Then you can click on the tab to see your working set of graphs, and possibly save them out as a tree for later use.

I'll make the plugin anyway (I've added the hook,class and ids in my own Cacti), but it'd be nice to be able to release it :-)
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
TheWitness
Developer
Posts: 17047
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Howie,

Post your patches. I'll see what I can do.

Larry
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
User avatar
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

If it's a do_hook, it's going to be patching PIA.
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
User avatar
Howie
Cacti Guru User
Posts: 5508
Joined: Thu Sep 16, 2004 5:53 am
Location: United Kingdom
Contact:

Post by Howie »

rony wrote:If it's a do_hook, it's going to be patching PIA.
Yes indeed. That's why I was poking cigamit, initially :-)

Then I looked at the HTML for the graph pages, and realised that attaching handlers to things with javascript would be pretty horrible without a few IDs and CLASSes in places.

Actually, the HTML is not too nice in quite a lot of places in Cacti... tons of nested tables, unclosed bits, there's a </style> with no <style> in the standard page head, hardcoded colours where CSS would be better, etc.
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
rony
Developer/Forum Admin
Posts: 6022
Joined: Mon Nov 17, 2003 6:35 pm
Location: Michigan, USA
Contact:

Post by rony »

Most of that is being addressed in 0.9.0
[size=117][i][b]Tony Roman[/b][/i][/size]
[size=84][i]Experience is what causes a person to make new mistakes instead of old ones.[/i][/size]
[size=84][i]There are only 3 way to complete a project: Good, Fast or Cheap, pick two.[/i][/size]
[size=84][i]With age comes wisdom, what you choose to do with it determines whether or not you are wise.[/i][/size]
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest