Cacti (home)ForumsRepositoryDocumentation
Cacti: offical forums and support  

 FAQFAQ   SearchSearch   MemberlistMemberlist    RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in    


Editor - link VIA button

 
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map)
Author Message
Zdolny



Joined: 14 Oct 2008
Posts: 5

PostPosted: Tue Oct 14, 2008 6:50 am    Post subject: Editor - link VIA button Reply with quote

Hi,

I made small patch on weathermap editor which add VIA button for link propertis.

Code:

--- editor.php  Mon Mar 17 21:43:00 2008
+++ editor.php  Tue Oct 14 13:28:51 2008
@@ -491,6 +492,21 @@
                $map->WriteConfig($mapfile);
                break;

+
+        case "via_link":
+                $x = intval($_REQUEST['x']);
+                $y = intval($_REQUEST['y']);
+               $link_name = $_REQUEST['link_name'];
+
+                $map->ReadConfig($mapfile);
+
+               $map->links[$link_name]->vialist = array(array(0 =>$x, 1=>$y));
+
+                $map->WriteConfig($mapfile);
+                break;
+
+
+
        case "move_node":
                $x = intval($_REQUEST['x']);
                $y = intval($_REQUEST['y']);
@@ -985,7 +1001,9 @@
                          <td><a class="dlgTitlebar" id="link_delete">Delete
                          Link</a><a class="dlgTitlebar" id="link_edit">Edit</a><a
                             class="dlgTitlebar" id="link_vert">Vert</a><a
-                            class="dlgTitlebar" id="link_horiz">Horiz</a>
+                            class="dlgTitlebar" id="link_horiz">Horiz</a>
+                           <a class="dlgTitlebar" id="link_via">Via</a>
+
                         </td>
                        </tr>
                  </table>

--- editor.js   Mon Mar 17 21:47:00 2008
+++ editor.js   Tue Oct 14 12:07:15 2008
@@ -205,6 +205,9 @@
     addEvent(document.getElementById('link_vert'), 'click', align_link_v);
     addEvent(document.getElementById('link_horiz'), 'click', align_link_h);

+
+    addEvent(document.getElementById('link_via'), 'click', via_link)
+
     addEvent(document.getElementById('tb_map_cancel'), 'click', cancel_op);
     addEvent(document.getElementById('tb_map_submit'), 'click', do_submit);

@@ -574,6 +577,16 @@
     document.getElementById('action').value = "move_node";
     mapmode('xy');
     }
+
+function via_link()
+    {
+    hide_dialog('dlgLinkProperties');
+    document.getElementById('tb_help').innerText = 'Click on the map via which point you whant to redirect link.';
+    document.getElementById('action').value = "via_link";
+    mapmode('xy');
+    }
+
+

 function add_link()
     {



untitled.JPG
 Description:
 Filesize:  29.61 KB
 Viewed:  1652 Time(s)

untitled.JPG



patch2.patch
 Description:

Download
 Filename:  patch2.patch
 Filesize:  896 Bytes
 Downloaded:  153 Time(s)


patch1.patch
 Description:

Download
 Filename:  patch1.patch
 Filesize:  1.06 KB
 Downloaded:  143 Time(s)

Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 3772
Location: United Kingdom

PostPosted: Tue Oct 14, 2008 8:25 am    Post subject: Reply with quote

Cool

I'll add it into the next test release, thanks.

To go with this, there is a 'secret' feature in the editor.php near the top - you can set $use_overlay=TRUE to make the editor show little markers for where VIAs are positioned (not clickable though).

Actually - this patch would wipe out any existing VIA, so maybe I'll modify it a little
Back to top
Zdolny



Joined: 14 Oct 2008
Posts: 5

PostPosted: Wed Oct 15, 2008 7:49 am    Post subject: Reply with quote

If you can, plse also add editor.php: width=100%

Code:

@@ -942,7 +966,7 @@

                <input size="6" name="link_name" type="hidden" />

-                 <table>
+                 <table width=100%>
                        <tr>
                          <th>Maximum Bandwidth<br />
                          Into '<span id="link_nodename1a">%NODE1%</span>'</th>


and for editor.css:
Code:

.dlgProperties { ^M
                width: 400px;^M
                background: #077; ^M
                margin: 5px; ^M
                font-size: 8pt;^M
                color: white;^M
                }^M


width: 400px; --> width: 600px;
Back to top
Howie
Cacti Guru User


Joined: 16 Sep 2004
Posts: 3772
Location: United Kingdom

PostPosted: Wed Feb 10, 2010 4:42 pm    Post subject: Reply with quote

This is now in SVN, and will be in 0.97a. Sorry it took so long!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Cacti Forum Index -> Plugin: (Network Weather Map) All times are GMT - 5 Hours
Page 1 of 1

 



Powered by phpBB © 2001, 2005 phpBB Group