Module: nagvis
Branch: master
Commit: 368cbd215e62b193e359edcc7266c5d48bc88617
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=368cbd215e62b193e359edcc7266c5d48bc88617

Author: Lars Michelsen <[email protected]>
Date:   Sun Oct 25 19:38:06 2009 +0100

Added missing new line objects

---

 share/frontend/nagvis-js/js/NagVisLine.js        |  133 ++++++++++++++++++++++
 share/server/core/classes/objects/NagVisLine.php |   84 ++++++++++++++
 2 files changed, 217 insertions(+), 0 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisLine.js 
b/share/frontend/nagvis-js/js/NagVisLine.js
new file mode 100644
index 0000000..beb1559
--- /dev/null
+++ b/share/frontend/nagvis-js/js/NagVisLine.js
@@ -0,0 +1,133 @@
+/*****************************************************************************
+ *
+ * NagVisLine.js - This class handles the visualisation of stateless line
+ *                 objects in the NagVis js frontend
+ *
+ * Copyright (c) 2004-2009 NagVis Project (Contact: [email protected])
+ *
+ * License:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *****************************************************************************/
+ 
+/**
+ * @author     Lars Michelsen <[email protected]>
+ */
+
+
+var NagVisLine = NagVisStatelessObject.extend({
+       constructor: function(oConf) {
+               // Call parent constructor;
+               this.base(oConf);
+       },
+       
+       /**
+        * PUBLIC parse()
+        *
+        * Parses the object
+        *
+        * @return      String          HTML code of the object
+        * @author      Lars Michelsen <[email protected]>
+        */
+       parse: function () {
+               var oContainerDiv;
+               
+               // Create container div
+               oContainerDiv = document.createElement('div');
+               oContainerDiv.setAttribute('id', this.conf.object_id);
+               
+               var oLine = this.parseLine();
+               oContainerDiv.appendChild(oLine);
+               oShape = null;
+               
+               // Append child to map and save reference in parsedObject
+               var oMap = document.getElementById('map');
+               this.parsedObject = oMap.appendChild(oContainerDiv);
+               oContainerDiv = null;
+               oMap = null;
+               
+               this.drawLine();
+       },
+       
+       /**
+        * Parses the HTML-Code of a line
+        *
+        * @return      String          HTML code
+        * @author      Lars Michelsen <[email protected]>
+        */
+       parseLine: function () {
+               var ret = '';
+               var link = '';
+               
+               // Create container div
+               var oContainerDiv = document.createElement('div');
+               oContainerDiv.setAttribute('id', 
this.conf.object_id+'-linediv');
+               
+               // Create line div
+               var oLineDiv = document.createElement('div');
+               oLineDiv.setAttribute('id', this.conf.object_id+'-line');
+               oLineDiv.style.zIndex = this.conf.z;
+               
+               oContainerDiv.appendChild(oLineDiv);
+               oLineDiv = null;
+               
+               // Parse hover/link area only when needed
+               if((this.conf.url && this.conf.url !== '') || 
(this.conf.hover_menu && this.conf.hover_menu !== '')) {
+                       var oLinkDiv = document.createElement('div');
+                       
+                       oLinkDiv.setAttribute('id', 
this.conf.object_id+'-linelinkdiv');
+                       oLinkDiv.style.zIndex = (this.conf.z+1);
+                       var sUrl = this.conf.url;
+                       var sUrlTarget = this.conf.url_target;
+                       oLinkDiv.onclick = function() { window.open(sUrl, 
sUrlTarget, ""); };
+                       
+                       oContainerDiv.appendChild(oLinkDiv);
+                       oLinkDiv = null;
+               }
+               
+               return oContainerDiv;
+       },
+       
+       /**
+        * Draws the NagVis lines on the already added divs.
+        *
+        * @return      String          HTML code
+        * @author      Lars Michelsen <[email protected]>
+        */
+       drawLine: function() {
+               var x = this.conf.x.split(',');
+               var y = this.conf.y.split(',');
+               
+               var width = this.conf.line_width;
+               
+               var colorFill = this.conf.line_color;
+               var colorBorder = this.conf.line_color_border;
+               
+               // Parse the line object
+               drawNagVisLine(this.conf.object_id, this.conf.line_type, x[0], 
y[0], x[1], y[1], this.conf.z, width, colorFill, colorBorder, ((this.conf.url 
&& this.conf.url !== '') || (this.conf.hover_menu && this.conf.hover_menu !== 
'')));
+       },
+       
+       parseHoverMenu: function () {
+               var oObj;
+               
+               // Get the object to apply the hover menu to
+               oObj = document.getElementById(this.conf.object_id+'-icon');
+               
+               // Create hover menu
+               this.getHoverMenu(oObj);
+               
+               oObj = null;
+       }
+});
diff --git a/share/server/core/classes/objects/NagVisLine.php 
b/share/server/core/classes/objects/NagVisLine.php
new file mode 100644
index 0000000..1e0e992
--- /dev/null
+++ b/share/server/core/classes/objects/NagVisLine.php
@@ -0,0 +1,84 @@
+<?php
+/*****************************************************************************
+ *
+ * NagVisLine.php - Class of a Stateless line in NagVis with all necessary 
+ *                  information which belong to the object handling in NagVis
+ *
+ * Copyright (c) 2004-2009 NagVis Project (Contact: [email protected])
+ *
+ * License:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *****************************************************************************/
+ 
+/**
+ * @author     Lars Michelsen <[email protected]>
+ */
+class NagVisLine extends NagVisStatelessObject {
+       /**
+        * Class constructor
+        *
+        * @param               Object          Object of class GlobalMainCfg
+        * @param               Object          Object of class 
GlobalBackendMgmt
+        * @param               Object          Object of class GlobalLanguage
+        * @param               String          Image of the shape
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function __construct($CORE) {
+               $this->type = 'line';
+               parent::__construct($CORE);
+       }
+       
+       /**
+        * PUBLIC parseJson()
+        *
+        * Parses the object in json format
+        *
+        * @return      String          JSON code of the object
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function parseJson() {
+               return parent::parseJson();
+       }
+       
+       /**
+        * PUBLIC getHoverMenu()
+        *
+        *Gets the hover menu of a shape if it is requested by configuration
+        *
+        * @return      String  The Link
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function getHoverMenu() {
+               if(isset($this->hover_url) && $this->hover_url != '') {
+                       parent::getHoverMenu();
+               }
+       }
+       
+       /**
+        * PUBLIC fetchIcon()
+        *
+        * Just a dummy here (Shape won't need an icon)
+        *
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function fetchIcon() {
+               // Nothing to do here, icon is set in constructor
+       }
+       
+       # End public methods
+       # 
#########################################################################
+}
+?>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to