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

Author: Lars Michelsen <[email protected]>
Date:   Sat Oct 17 14:09:26 2009 +0200

The automap will be rendered again after a config change now

---

 share/frontend/nagvis-js/js/frontend.js |   21 +++++++++++++++++++--
 share/server/core/ajax_handler.php      |   29 +++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 9f9678e..61565e3 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -1403,6 +1403,18 @@ function getStateProperties() {
 }
 
 /**
+ * automapParse()
+ *
+ * Parses the automap background image
+ *
+ * @return  Boolean  Success?
+ * @author     Lars Michelsen <[email protected]>
+ */
+function automapParse(mapName) {
+       return 
getSyncRequest(oGeneralProperties.path_htmlserver+'?action=parseAutomap&n1='+escapeUrlValues(mapName))
+}
+
+/**
  * parseMap()
  *
  * Parses the map on initial page load or changed map configuration
@@ -1806,8 +1818,13 @@ function workerUpdate(iCount, sType, sIdentifier) {
                
                // Check for changed map configuration
                if(oCurrentFileAges && 
checkMapCfgChanged(oCurrentFileAges[oPageProperties.map_name], 
oPageProperties.map_name)) {
-                       // FIXME: Render new background image and dot file
-                       // FIXME: Set new background image (renew random value 
at the end)
+                       // Render new background image and dot file
+                       automapParse(oPageProperties.map_name);
+                       
+                       // Update background image for automap
+                       if(oPageProperties.view_type === 'automap') {
+                               
setMapBackgroundImage(oPageProperties.background_image+iNow);
+                       }
                        
                        // Reparse the automap on changed map configuration
                        eventlog("worker", "info", "Automap configuration file 
was updated. Reparsing the map.");
diff --git a/share/server/core/ajax_handler.php 
b/share/server/core/ajax_handler.php
index 0c279ea..68ae876 100644
--- a/share/server/core/ajax_handler.php
+++ b/share/server/core/ajax_handler.php
@@ -245,6 +245,35 @@ switch($_GET['action']) {
                $OVERVIEW = new GlobalIndexPage($CORE, $BACKEND);
                echo $OVERVIEW->parseRotationsJson();
        break;
+       case 'parseAutomap':
+               if(!isset($_GET['n1']) || $_GET['n1'] == '') {
+                       echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');
+               } else {
+                       $MAPCFG = new NagVisAutomapCfg($CORE, $_GET['n1']);
+                       $MAPCFG->readMapConfig();
+                       
+                       // FIXME: Maybe should be recoded?
+                       // FIXME: What about the options given in URL when 
calling the map?
+                       $opts = Array();
+                       // Fetch option array from defaultparams string 
(extract variable
+                       // names and values)
+                       $params = explode('&', 
$CORE->MAINCFG->getValue('automap','defaultparams'));
+                       unset($params[0]);
+                       foreach($params AS &$set) {
+                               $arrSet = explode('=',$set);
+                               $opts[$arrSet[0]] = $arrSet[1];
+                       }
+                       // Save the automap name to use
+                       $opts['automap'] = $_GET['n1'];
+                       // Save the preview mode
+                       $opts['preview'] = 1;
+                       
+                       $MAP = new NagVisAutoMap($CORE, $MAPCFG, $BACKEND, 
$opts);
+                       $MAP->renderMap();
+                       
+                       echo json_encode(true);
+               }
+       break;
        case 'getAutomapProperties':
                if(!isset($_GET['objName1']) || $_GET['objName1'] == '') {
                        echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');


------------------------------------------------------------------------------
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