Module: nagvis Branch: master Commit: f9adaa3b683dcda4ae3da862fd4a06e241ca7ec2 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=f9adaa3b683dcda4ae3da862fd4a06e241ca7ec2
Author: Lars Michelsen <[email protected]> Date: Mon Oct 19 19:32:23 2009 +0200 The url module works now as it should --- share/frontend/nagvis-js/js/frontend.js | 32 ++++++++++++++++++++++++++++- share/server/core/classes/CoreModUrl.php | 11 +++++++++- share/server/core/classes/NagVisUrl.php | 19 +++++++++++++++++ 3 files changed, 59 insertions(+), 3 deletions(-) diff --git a/share/frontend/nagvis-js/js/frontend.js b/share/frontend/nagvis-js/js/frontend.js index 41218e9..5607fdc 100644 --- a/share/frontend/nagvis-js/js/frontend.js +++ b/share/frontend/nagvis-js/js/frontend.js @@ -1391,7 +1391,7 @@ function getOverviewRotations() { * @author Lars Michelsen <[email protected]> */ function getAutomapProperties(mapName) { - return getSyncRequest(oGeneralProperties.path_server+'?mod=AutoMap&act=getAutomapProperties&show='+mapName) + return getSyncRequest(oGeneralProperties.path_server+'?mod=AutoMap&act=getAutomapProperties&show='+escapeUrlValues(mapName)) } /** @@ -1403,7 +1403,19 @@ function getAutomapProperties(mapName) { * @author Lars Michelsen <[email protected]> */ function getMapProperties(mapName) { - return getSyncRequest(oGeneralProperties.path_server+'?mod=Map&act=getMapProperties&show='+mapName) + return getSyncRequest(oGeneralProperties.path_server+'?mod=Map&act=getMapProperties&show='+escapeUrlValues(mapName)) +} + +/** + * getUrlProperties() + * + * Fetches the current url properties from the core + * + * @return Boolean Success? + * @author Lars Michelsen <[email protected]> + */ +function getUrlProperties(sUrl) { + return getSyncRequest(oGeneralProperties.path_server+'?mod=Url&act=getProperties&show='+escapeUrlValues(sUrl)) } /** @@ -1694,8 +1706,18 @@ function workerInitialize(iCount, sType, sIdentifier) { eventlog("worker", "info", "Finished parsing overview"); } else if(sType === 'url') { + // Load the map properties + eventlog("worker", "debug", "Loading the url properties"); + oPageProperties = getUrlProperties(sIdentifier); + oPageProperties.view_type = sType; + // Fetches the contents from the server and prints it to the page + eventlog("worker", "debug", "Parsing url page"); parseUrl(sIdentifier); + + // Load the file ages of the important configuration files + eventlog("worker", "debug", "Loading the file ages"); + oFileAges = getCfgFileAges(); } else if(sType == 'automap') { // Loading a simple map eventlog("worker", "debug", "Parsing automap: " + sIdentifier); @@ -1934,6 +1956,12 @@ function workerUpdate(iCount, sType, sIdentifier) { } bStateChanged = null; + } else if(sType === 'url') { + + // Fetches the contents from the server and prints it to the page + eventlog("worker", "debug", "Reparsing url page"); + parseUrl(oPageProperties.url); + } else if(sType === 'overview') { //FIXME: Map configuration(s) changed? diff --git a/share/server/core/classes/CoreModUrl.php b/share/server/core/classes/CoreModUrl.php index 25164eb..6720e81 100644 --- a/share/server/core/classes/CoreModUrl.php +++ b/share/server/core/classes/CoreModUrl.php @@ -37,7 +37,8 @@ class CoreModUrl extends CoreModule { // Register valid actions $this->aActions = Array( - 'getContents' => REQUIRES_AUTHORISATION + 'getContents' => REQUIRES_AUTHORISATION, + 'getProperties' => REQUIRES_AUTHORISATION ); } @@ -49,6 +50,9 @@ class CoreModUrl extends CoreModule { case 'getContents': $sReturn = $this->getContents(); break; + case 'getProperties': + $sReturn = $this->getProperties(); + break; } } @@ -59,5 +63,10 @@ class CoreModUrl extends CoreModule { $URL = new NagVisUrl($this->CORE, $this->url); return json_encode(Array('content' => $URL->getContents())); } + + private function getProperties() { + $URL = new NagVisUrl($this->CORE, $this->url); + return $URL->parsePropertiesJson(); + } } ?> diff --git a/share/server/core/classes/NagVisUrl.php b/share/server/core/classes/NagVisUrl.php index ab0d53e..7d836f6 100644 --- a/share/server/core/classes/NagVisUrl.php +++ b/share/server/core/classes/NagVisUrl.php @@ -86,5 +86,24 @@ class NagVisUrl { return $this->strContents; } + + /** + * Parses the url options in json format + * + * @return String String with JSON Code + * @author Lars Michelsen <[email protected]> + */ + public function parsePropertiesJson() { + $arr = Array(); + $arr['url'] = $this->strUrl; + /*$arr['name'] = $this->MAPCFG->getName(); + $arr['alias'] = $this->MAPCFG->getValue('global', 0, 'alias'); + $arr['background_image'] = $this->getBackgroundJson(); + $arr['background_color'] = $this->MAPCFG->getValue('global', 0, 'background_color'); + $arr['favicon_image'] = $this->getFavicon(); + $arr['page_title'] = $this->MAPCFG->getValue('global', 0, 'alias').' ('.$this->MAPOBJ->getSummaryState().') :: '.$this->CORE->MAINCFG->getValue('internal', 'title');*/ + + return json_encode($arr); + } } ?> ------------------------------------------------------------------------------ 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
