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

Author: Lars Michelsen <[email protected]>
Date:   Wed Sep  9 18:20:06 2009 +0200

#8 Made better split of overview page frontend/server component

---

 share/frontend/nagvis-js/js/frontend.js            |   43 ++++++++++++++++++-
 share/server/core/ajax_handler.php                 |   13 +++++-
 share/server/core/classes/GlobalIndexPage.php      |   36 ----------------
 .../core}/classes/NagVisAutoMap.php                |    0
 .../core}/classes/NagVisAutomapCfg.php             |    0
 .../core}/classes/NagVisRotation.php               |    0
 6 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 455bb24..aca085a 100755
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -1183,6 +1183,42 @@ function getOverviewProperties(mapName) {
 }
 
 /**
+ * getOverviewMaps()
+ *
+ * Fetches all maps to be shown on the overview page
+ *
+ * @return  Array of maps
+ * @author     Lars Michelsen <[email protected]>
+ */
+function getOverviewMaps() {
+       return 
getSyncRequest(oGeneralProperties.path_htmlserver+'?action=getOverviewMaps')
+}
+
+/**
+ * getOverviewAutomaps()
+ *
+ * Fetches all automaps to be shown on the overview page
+ *
+ * @return  Array of maps
+ * @author     Lars Michelsen <[email protected]>
+ */
+function getOverviewAutomaps() {
+       return 
getSyncRequest(oGeneralProperties.path_htmlserver+'?action=getOverviewAutomaps')
+}
+
+/**
+ * getOverviewRotations()
+ *
+ * Fetches all rotations to be shown on the overview page
+ *
+ * @return  Array of rotations
+ * @author     Lars Michelsen <[email protected]>
+ */
+function getOverviewRotations() {
+       return 
getSyncRequest(oGeneralProperties.path_htmlserver+'?action=getOverviewRotations')
+}
+
+/**
  * getMapProperties()
  *
  * Fetches the current map properties from the core
@@ -1336,6 +1372,7 @@ function runWorker(iCount, sType, sIdentifier) {
                        eventlog("worker", "debug", "Loading the file ages");
                        oFileAges = getCfgFileAges(sIdentifier);
                        
+                       // Parse the map
                        if(parseMap(oFileAges[sIdentifier], sIdentifier) === 
false) {
                                eventlog("worker", "error", "Problem while 
parsing the map on page load");
                        }
@@ -1358,16 +1395,16 @@ function runWorker(iCount, sType, sIdentifier) {
                        oFileAges = getCfgFileAges();
                        
                        eventlog("worker", "debug", "Parsing maps");
-                       parseOverviewMaps(aInitialMaps);
+                       parseOverviewMaps(getOverviewMaps());
                        
                        eventlog("worker", "debug", "Parsing automaps");
-                       parseOverviewAutomaps(aInitialAutomaps);
+                       parseOverviewAutomaps(getOverviewAutomaps());
                        
                        eventlog("worker", "debug", "Parsing geomap");
                        parseOverviewGeomap();
 
                        eventlog("worker", "debug", "Parsing rotations");
-                       parseOverviewRotations(aInitialRotations);
+                       parseOverviewRotations(getOverviewRotations());
                        
                        // Bulk get all hover templates which are needed on the 
overview page
                        eventlog("worker", "debug", "Fetching hover templates");
diff --git a/share/server/core/ajax_handler.php 
b/share/server/core/ajax_handler.php
index 548c3db..3190b1e 100755
--- a/share/server/core/ajax_handler.php
+++ b/share/server/core/ajax_handler.php
@@ -198,10 +198,21 @@ switch($_GET['action']) {
                echo json_encode($aReturn);
        break;
        case 'getOverviewProperties':
-               // Initialize map configuration
                $OVERVIEW = new GlobalIndexPage($CORE, $BACKEND);
                echo $OVERVIEW->parseIndexPropertiesJson();
        break;
+       case 'getOverviewMaps':
+               $OVERVIEW = new GlobalIndexPage($CORE, $BACKEND);
+               echo $OVERVIEW->parseMapsJson();
+       break;
+       case 'getOverviewAutomaps':
+               $OVERVIEW = new GlobalIndexPage($CORE, $BACKEND);
+               echo $OVERVIEW->parseAutomapsJson();
+       break;
+       case 'getOverviewRotations':
+               $OVERVIEW = new GlobalIndexPage($CORE, $BACKEND);
+               echo $OVERVIEW->parseRotationsJson();
+       break;
        case 'getMapProperties':
                if(!isset($_GET['objName1']) || $_GET['objName1'] == '') {
                        echo 'Error: 
'.$CORE->LANG->getText('parameterObjName1NotSet');
diff --git a/share/server/core/classes/GlobalIndexPage.php 
b/share/server/core/classes/GlobalIndexPage.php
index 6bb4025..44d2e89 100755
--- a/share/server/core/classes/GlobalIndexPage.php
+++ b/share/server/core/classes/GlobalIndexPage.php
@@ -47,42 +47,6 @@ class GlobalIndexPage {
        }
        
        /**
-        * Parses the information for json
-        *
-        * @return      String  String with Html Code
-        * @author      Lars Michelsen <[email protected]>
-        */
-       public function parseJson() {
-               $ret = '';
-               $ret .= 
'oGeneralProperties='.$this->CORE->MAINCFG->parseGeneralProperties().';'."\n";
-               $ret .= 
'oWorkerProperties='.$this->CORE->MAINCFG->parseWorkerProperties().';'."\n";
-               $ret .= 'aInitialMaps='.$this->parseMapsJson().';'."\n";
-               $ret .= 'aInitialAutomaps='.$this->parseAutomapsJson().';'."\n";
-               $ret .= 
'aInitialRotations='.$this->parseRotationsJson().';'."\n";
-               $ret .= 'aMaps=Array();'."\n";
-               $ret .= 'aRotations=Array();'."\n";
-               
-               // Kick of the worker
-               $ret .= 'addDOMLoadEvent(function(){runWorker(0, 
\'overview\')});';
-               
-               return $ret;
-       }
-       
-       /**
-        * Parses the config file ages
-        *
-        * @return      String  JSON Code
-        * @author      Lars Michelsen <[email protected]>
-        */
-       public function parseFileAges() {
-               $arr = Array();
-               
-               $arr['main_config'] = $this->CORE->MAINCFG->getConfigFileAge();
-               
-               return json_encode($arr);
-       }
-       
-       /**
         * Parses the automaps for the overview page
         *
         * @return      String  Json Code
diff --git a/share/frontend/nagvis-js/classes/NagVisAutoMap.php 
b/share/server/core/classes/NagVisAutoMap.php
similarity index 100%
rename from share/frontend/nagvis-js/classes/NagVisAutoMap.php
rename to share/server/core/classes/NagVisAutoMap.php
diff --git a/share/frontend/nagvis-js/classes/NagVisAutomapCfg.php 
b/share/server/core/classes/NagVisAutomapCfg.php
similarity index 100%
rename from share/frontend/nagvis-js/classes/NagVisAutomapCfg.php
rename to share/server/core/classes/NagVisAutomapCfg.php
diff --git a/share/frontend/nagvis-js/classes/NagVisRotation.php 
b/share/server/core/classes/NagVisRotation.php
similarity index 100%
rename from share/frontend/nagvis-js/classes/NagVisRotation.php
rename to share/server/core/classes/NagVisRotation.php


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to