Author: Lars Michelsen <[email protected]>
Date: Sat Apr 2 13:24:07 2011 +0200
Committer: Lars Michelsen <[email protected]>
Commit-Date: Sat Apr 2 13:24:07 2011 +0200
Fixed parsing/dragging of stateless lines; automap exported lines are now
attached to their host icons - this makes them draggable with the icons
---
share/frontend/nagvis-js/js/NagVisLine.js | 4 +-
share/frontend/nagvis-js/js/NagVisObject.js | 30 ++++++++++++++++++++
.../frontend/nagvis-js/js/NagVisStatefulObject.js | 21 --------------
share/server/core/classes/NagVisAutoMap.php | 6 ++--
share/server/core/classes/objects/NagVisObject.php | 3 +-
5 files changed, 37 insertions(+), 27 deletions(-)
diff --git a/share/frontend/nagvis-js/js/NagVisLine.js
b/share/frontend/nagvis-js/js/NagVisLine.js
index e0c20f6..125947f 100644
--- a/share/frontend/nagvis-js/js/NagVisLine.js
+++ b/share/frontend/nagvis-js/js/NagVisLine.js
@@ -106,8 +106,8 @@ var NagVisLine = NagVisStatelessObject.extend({
* @author Lars Michelsen <[email protected]>
*/
drawLine: function() {
- var x = this.conf.x.split(',');
- var y = this.conf.y.split(',');
+ var x = this.parseCoords(this.conf.x, 'x');
+ var y = this.parseCoords(this.conf.y, 'y');
var width = this.conf.line_width;
diff --git a/share/frontend/nagvis-js/js/NagVisObject.js
b/share/frontend/nagvis-js/js/NagVisObject.js
index f0ded49..332e3ce 100644
--- a/share/frontend/nagvis-js/js/NagVisObject.js
+++ b/share/frontend/nagvis-js/js/NagVisObject.js
@@ -668,5 +668,35 @@ var NagVisObject = Base.extend({
}
},
+ /**
+ * Entry point for repositioning objects in NagVis frontend
+ * Handles whole redrawing of the object while moving
+ *
+ * Author: Lars Michelsen <[email protected]>
+ */
+ reposition: function() {
+ if(this.conf.view_type === 'line' || this.conf.type === 'line')
+ this.drawLine();
+ else
+ this.moveIcon();
+
+ // Move the objects label when enabled
+ if(this.conf.label_show && this.conf.label_show == '1')
+ this.moveLabel();
+
+ // Move child objects
+ for(var i = 0, l = this.childs.length; i < l; i++)
+ this.childs[i].reposition();
+
+ // redraw the controls
+ if(!this.bIsLocked) {
+ if(typeof(this.removeControls) == 'function')
+ this.removeControls();
+ if(typeof(this.parseControls) == 'function')
+ this.parseControls();
+ }
+ },
+
highlight: function(show) {}
+
});
diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 649013a..df15536 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -962,27 +962,6 @@ var NagVisStatefulObject = NagVisObject.extend({
oControls = null;
},
- reposition: function() {
- if(this.conf.view_type === 'line')
- this.drawLine();
- else
- this.moveIcon();
-
- // Move the objects label when enabled
- if(this.conf.label_show && this.conf.label_show == '1')
- this.moveLabel();
-
- // Move child objects
- for(var i = 0, l = this.childs.length; i < l; i++)
- this.childs[i].reposition();
-
- // redraw the controls
- if(!this.bIsLocked) {
- this.removeControls();
- this.parseControls();
- }
- },
-
/**
* Handler for the move event
*
diff --git a/share/server/core/classes/NagVisAutoMap.php
b/share/server/core/classes/NagVisAutoMap.php
index dcd10a3..20c2b8d 100644
--- a/share/server/core/classes/NagVisAutoMap.php
+++ b/share/server/core/classes/NagVisAutoMap.php
@@ -426,8 +426,8 @@ class NagVisAutoMap extends GlobalMap {
$LINE = new NagVisLine($this->CORE);
$LINE->setObjectId($objIds[$lineKey]);
- $LINE->setMapCoords(Array('x' => ($S->getX() + $sWidth
/ 2) . ',' . ($E->getX() + $eWidth / 2),
- 'y' => ($S->getY() + $sHeight
/ 2) . ',' . ($E->getY() + $eHeight / 2)));
+ $LINE->setMapCoords(Array('x' => $objIds[$start] . "%+"
. ($sWidth / 2) . ',' . $objIds[$end] . "%+" . ($eWidth / 2),
+ 'y' => $objIds[$start] . "%+"
. ($sHeight / 2) . ',' . $objIds[$end] . "%+" . ($eHeight / 2)));
$LINE->setConfiguration($aConf);
$lines[] = $LINE;
}
@@ -573,7 +573,7 @@ class NagVisAutoMap extends GlobalMap {
}
}
unset($validOpts['hover_timeout']);
-
+
$ret = "define global {\n";
foreach($validOpts AS $key => $val) {
$ret .= ' '.$key.'='.$val."\n";
diff --git a/share/server/core/classes/objects/NagVisObject.php
b/share/server/core/classes/objects/NagVisObject.php
index dbbb255..07b5dce 100644
--- a/share/server/core/classes/objects/NagVisObject.php
+++ b/share/server/core/classes/objects/NagVisObject.php
@@ -459,7 +459,8 @@ class NagVisObject {
public function parseMapCfg($globalOpts = Array()) {
$ret = 'define '.$this->type." {\n";
if($this->type === 'host')
- $ret .= 'host_name='.$this->host_name."\n";
+ $ret .= ' host_name='.$this->host_name."\n";
+ $ret .= ' object_id='.$this->object_id."\n";
foreach($this->getObjectConfiguration(false) AS $key => $val) {
// Only set options which are different to global option
if((!isset($globalOpts[$key]) || $globalOpts[$key] !=
$val) && $val != '') {
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself;
WebMatrix provides all the features you need to develop and
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins