Author:   Lars Michelsen <[email protected]>
Date:     Sun Sep 25 12:00:21 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Sep 25 12:00:21 2011 +0200

Fixed adding stateless line objects

---

 share/frontend/nagvis-js/js/edit.js           |    8 +++---
 share/server/core/mapcfg/default.php          |   26 +++++++++++++++++++-----
 share/userfiles/templates/default.header.html |    4 +-
 3 files changed, 26 insertions(+), 12 deletions(-)

diff --git a/share/frontend/nagvis-js/js/edit.js 
b/share/frontend/nagvis-js/js/edit.js
index 8d8064e..70b37b0 100644
--- a/share/frontend/nagvis-js/js/edit.js
+++ b/share/frontend/nagvis-js/js/edit.js
@@ -270,7 +270,7 @@ function getNearestObject(id, x, y) {
             continue;
 
         // FIXME: Also handle lines
-        if(obj.conf.view_type !== 'icon')
+        if(obj.conf.view_type !== 'icon' || obj.conf.type == 'line')
             continue;
 
         var objX = obj.parseCoord(obj.conf.x, 'x');
@@ -424,7 +424,7 @@ function addClick(e) {
     pos = null;
 
     // Draw a line to illustrate the progress of drawing the current line
-    if(addViewType === 'line' || addObjType === 'textbox') {
+    if(addViewType === 'line' || addObjType === 'textbox' || addObjType === 
'line') {
         addShape = new jsGraphics('map');
 
         addShape.setColor('#06B606');
@@ -456,7 +456,7 @@ function addClick(e) {
                + '&x=' + addX.join(',')
                + '&y=' + addY.join(',');
 
-    if(addViewType != 'icon')
+    if(addViewType != 'icon' && addViewType != '')
         sUrl += '&view_type=' + addViewType;
 
     if(addAction == 'clone' && objid !== -1)
@@ -494,7 +494,7 @@ function addFollowing(e) {
 
     addShape.clear();
 
-    if(addViewType === 'line')
+    if(addViewType === 'line' || addObjType === 'line')
         addShape.drawLine(addX[0], addY[0], pos[0] - getSidebarWidth(), 
pos[1]);
     else
         addShape.drawRect(addX[0], addY[0], (pos[0] - getSidebarWidth() - 
addX[0]), (pos[1] - addY[0]));
diff --git a/share/server/core/mapcfg/default.php 
b/share/server/core/mapcfg/default.php
index d904328..9043e2c 100644
--- a/share/server/core/mapcfg/default.php
+++ b/share/server/core/mapcfg/default.php
@@ -417,14 +417,18 @@ $mapConfigVars = Array(
         'depends_on' => 'view_type',
         'depends_value' => 'line'),
     'line_color' => Array(
-        'must' => 0,
-        'default' => '#ffffff',
-        'match' => MATCH_COLOR
+        'must'          => 0,
+        'default'       => '#ffffff',
+        'match'         => MATCH_COLOR,
+        'depends_on'    => 'view_type',
+        'depends_value' => 'line',
     ),
     'line_color_border' => Array(
-        'must' => 0,
-        'default' => '#000000',
-        'match' => MATCH_COLOR
+        'must'          => 0,
+        'default'       => '#000000',
+        'match'         => MATCH_COLOR,
+        'depends_on'    => 'view_type',
+        'depends_value' => 'line',
     ),
     'line_cut' => Array(
         'must'          => 0,
@@ -740,6 +744,15 @@ $mapConfigVars = Array(
         'match' => MATCH_STRING_NO_SPACE,
         'list'  => 'listTemplateNames',
     ),
+    
+    // STATELESS LINE SPECIFIC OPTIONS
+    
+    'view_type_line' => Array(
+        'must'          => 1,
+        'default'       => 'line',
+        'match'         => MATCH_VIEW_TYPE,
+        'field_type'    => 'hidden',
+    ),
 );
 
 //
@@ -1032,6 +1045,7 @@ $mapConfigVarMap['line'] = Array(
     'x' => null,
     'y' => null,
     'z' => null,
+    'view_type_line' => 'view_type',
     'line_type' => null,
     'line_cut' => null,
     'line_width' => null,
diff --git a/share/userfiles/templates/default.header.html 
b/share/userfiles/templates/default.header.html
index efcac68..bbea54a 100644
--- a/share/userfiles/templates/default.header.html
+++ b/share/userfiles/templates/default.header.html
@@ -84,8 +84,8 @@
             <li onmouseover="ddMenu('map-addspecial',1,1)" 
onmouseout="ddMenuHide(['map-addspecial'])" class="dropdown subdropdown">
                 <a class="submenu-link" id="map-addspecial-ddheader" 
href="#">{$langMapAddSpecial}</a>
                 <ul id="map-addspecial-ddcontent">
-                       <li><a class="topline topline" href="#" 
onclick="addObject(event, 'shape', 'icon', 1, 
'add');ddMenuHide(['map-addspecial','map']);">{$langShape}</a></li>
-                       <li><a class="topline" href="#" 
onclick="addObject(event, 'textbox', 'icon', 2, 
'add');ddMenuHide(['map-addspecial','map']);">{$langTextbox}</a></li>
+                       <li><a class="topline topline" href="#" 
onclick="addObject(event, 'shape', '', 1, 
'add');ddMenuHide(['map-addspecial','map']);">{$langShape}</a></li>
+                       <li><a class="topline" href="#" 
onclick="addObject(event, 'textbox', '', 2, 
'add');ddMenuHide(['map-addspecial','map']);">{$langTextbox}</a></li>
                        <li><a class="topline underline" href="#" 
onclick="addObject(event, 'line', 'line', 2, 
'add');ddMenuHide(['map-addspecial','map']);">{$langStateless} 
{$langLine}</a></li>
                 </ul>
             </li>


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to