|
|
| Author |
Message |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Tue Mar 20, 2007 9:56 am Post subject: Hook Request: page_top |
|
|
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. |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Tue Mar 20, 2007 7:50 pm Post subject: |
|
|
We are going to implement jquery in the next version of Cacti. It's even debatable to include it in 0.8.6x.
TheWitness |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Wed Mar 21, 2007 12:44 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Wed Mar 21, 2007 9:11 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Wed Mar 21, 2007 9:14 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
cigamit Developer
Joined: 07 Apr 2005 Posts: 945 Location: B/CS Texas
|
Posted: Wed Mar 21, 2007 10:06 pm Post subject: |
|
|
[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. |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Thu Mar 22, 2007 3:38 am Post subject: |
|
|
| 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  |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Wed Jul 25, 2007 12:32 pm Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Wed Jul 25, 2007 10:13 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Wed Jul 25, 2007 10:32 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Thu Jul 26, 2007 8:11 am Post subject: |
|
|
| 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: |
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  |
|
| Back to top |
|
 |
TheWitness Developer
Joined: 14 May 2002 Posts: 9671 Location: MI, USA
|
Posted: Thu Jul 26, 2007 10:04 am Post subject: |
|
|
Howie,
Post your patches. I'll see what I can do.
Larry |
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5443 Location: Wisconsin, USA
|
Posted: Thu Jul 26, 2007 10:07 am Post subject: |
|
|
| If it's a do_hook, it's going to be patching PIA. |
|
| Back to top |
|
 |
Howie Cacti Guru User
Joined: 16 Sep 2004 Posts: 2132 Location: United Kingdom
|
Posted: Thu Jul 26, 2007 10:14 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
rony Developer/Forum Admin
Joined: 17 Nov 2003 Posts: 5443 Location: Wisconsin, USA
|
Posted: Thu Jul 26, 2007 10:18 am Post subject: |
|
|
| Most of that is being addressed in 0.9.0 |
|
| Back to top |
|
 |
|