Author: Lars Michelsen <[email protected]>
Date: Thu Jan 19 15:51:56 2012 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Thu Jan 19 15:51:56 2012 +0100
Handling centron style host links during automap parsing (host_name=)
---
ChangeLog | 1 +
share/frontend/nagvis-js/js/nagvis.js | 4 ++--
share/server/core/classes/NagVisAutoMap.php | 5 ++++-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8f9e636..5f2a679 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,7 @@ Frontend
* Bugfix: Fixed problem with the hover menu when using the hover_delay
parameter
Automap
+ * Handling centron style host links during automap parsing (host_name=)
* Bugfix: Added missing view_type=line parameter to automap exported maps
* Bugfix: filterByState was always enabled after modifying the automap
parameters via web form
diff --git a/share/frontend/nagvis-js/js/nagvis.js
b/share/frontend/nagvis-js/js/nagvis.js
index 2baeae2..4a5e471 100644
--- a/share/frontend/nagvis-js/js/nagvis.js
+++ b/share/frontend/nagvis-js/js/nagvis.js
@@ -1075,13 +1075,13 @@ function pxToInt(v) {
}
function isRelativeCoord(v) {
- return (!isInt(v) && !isFloat(v)) || v.length === 6;
+ return (!isInt(v) && !isFloat(v)) || v.length === 6;
}
function getKeys(o) {
var a = [];
for(var key in o)
- a.push(key);
+ a.push(key);
return a;
}
diff --git a/share/server/core/classes/NagVisAutoMap.php
b/share/server/core/classes/NagVisAutoMap.php
index 8e8d3bc..c89a545 100644
--- a/share/server/core/classes/NagVisAutoMap.php
+++ b/share/server/core/classes/NagVisAutoMap.php
@@ -465,6 +465,9 @@ class NagVisAutoMap extends GlobalMap {
* And there might also be a space after the coords parameter
* <area shape="rect"
href="/test1/check_mk/view.py?view_name=host&site=&host=test"
target="_self" title="host_a94a8f" alt="" coords="5,5,21,21" />
*
+ * Aaaaand also handle centreon param host_name:
+ * <area shape="rect" id="node1"
href="/centreon/main.php?p=201&o=hd&host_name=localhost" target="_self"
title="host_334389" alt="" coords="4,4,20,20"/>
+ *
* Coord description:
* For a rectangle, you map the top left and bottom right corners. All
* coordinates are listed as x,y (over,up). So, for upper left corner
@@ -479,7 +482,7 @@ class NagVisAutoMap extends GlobalMap {
$sLine = str_replace('-', '-', $sLine);
// Extract the area objects
// Only parsing rect/polys at the moment
-
if(preg_match('/^<area\sshape="(rect|poly)"\s(id="[^"]+"\s)?href=".+[?&;]host=([^"]+)"(?:\starget="[a-zA-Z-_]*")?\stitle="[^"]+"\salt=""\scoords="([^"]+)"\s?\/>$/i',
$sLine, $aMatches)) {
+
if(preg_match('/^<area\sshape="(rect|poly)"\s(id="[^"]+"\s)?href=".+[?&;](?:host|host_name)=([^"]+)"(?:\starget="[a-zA-Z-_]*")?\stitle="[^"]+"\salt=""\scoords="([^"]+)"\s?\/>$/i',
$sLine, $aMatches)) {
if(isset($aMatches[1]) && isset($aMatches[2]) &&
isset($aMatches[3]) && isset($aMatches[4])) {
$type = $aMatches[1];
$name1 = str_replace('-', '-', trim($aMatches[3]));
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins