Author:   Lars Michelsen <[email protected]>
Date:     Sat Jul 20 13:14:12 2013 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sat Jul 20 13:14:12 2013 +0200

Several view parameter handling cleanup

---

 share/server/core/classes/GlobalCore.php   |    9 +++++++++
 share/server/core/classes/GlobalMapCfg.php |   11 ++++++++++-
 share/server/core/mapcfg/default.php       |    2 +-
 share/server/core/sources/automap.php      |    8 ++++++++
 share/server/core/sources/dynmap.php       |    4 ++++
 share/server/core/sources/filter.php       |    6 +-----
 share/server/core/sources/general.php      |    5 -----
 share/server/core/sources/geomap.php       |    8 ++++++++
 8 files changed, 41 insertions(+), 12 deletions(-)

diff --git a/share/server/core/classes/GlobalCore.php 
b/share/server/core/classes/GlobalCore.php
index 79dea2a..71d7377 100644
--- a/share/server/core/classes/GlobalCore.php
+++ b/share/server/core/classes/GlobalCore.php
@@ -35,6 +35,7 @@ class GlobalCore {
 
     private static $instance = null;
     protected $iconsetTypeCache = Array();
+    protected $selectable_sources = array();
 
     public $statelessObjectTypes = Array(
         'textbox'   => true,
@@ -728,5 +729,13 @@ class GlobalCore {
         }
         return null;
     }
+
+    public function addSelectableSource($source_name) {
+        $this->selectable_sources[$source_name] = $source_name;
+    }
+
+    public function getSelectableSources() {
+        return $this->selectable_sources;
+    }
 }
 ?>
diff --git a/share/server/core/classes/GlobalMapCfg.php 
b/share/server/core/classes/GlobalMapCfg.php
index 7e174e6..cdef34a 100644
--- a/share/server/core/classes/GlobalMapCfg.php
+++ b/share/server/core/classes/GlobalMapCfg.php
@@ -482,6 +482,7 @@ class GlobalMapCfg {
         foreach($CORE->getAvailableSources() AS $source_name) {
             $viewParams = array();
             $configVars = array();
+            $selectable = false;
 
             if(file_exists(path('sys', 'local', 'sources'))) {
                 include_once(path('sys', 'local', 'sources') . '/'. 
$source_name . '.php');
@@ -503,6 +504,11 @@ class GlobalMapCfg {
                 // Mark this option as source parameter. Save the source file 
in the value
                 self::$validConfig['global'][$key]['source_param']  = 
$source_name;
             }
+
+            // Register the slectable source
+            if ($selectable) {
+                $CORE->addSelectableSource($source_name);
+            }
         }
     }
 
@@ -562,7 +568,10 @@ class GlobalMapCfg {
             // Maybe convert the type, if requested
             if(isset(self::$validConfig['global'][$key]['array'])
                && self::$validConfig['global'][$key]['array'] === true) {
-                $val = explode(',', $_REQUEST[$key]);
+                if ($_REQUEST[$key] !== '')
+                    $val = explode(',', $_REQUEST[$key]);
+                else
+                    $val = array();
             } else {
                 $val = $_REQUEST[$key];
             }
diff --git a/share/server/core/mapcfg/default.php 
b/share/server/core/mapcfg/default.php
index 6f6ca40..14820fa 100644
--- a/share/server/core/mapcfg/default.php
+++ b/share/server/core/mapcfg/default.php
@@ -175,7 +175,7 @@ function listBackendIds($CORE) {
 }
 
 function listSources($CORE) {
-    return $CORE->getAvailableSources();
+    return $CORE->getSelectableSources();
 }
 
 $mapConfigVars = Array(
diff --git a/share/server/core/sources/automap.php 
b/share/server/core/sources/automap.php
index b02c4a7..b815498 100644
--- a/share/server/core/sources/automap.php
+++ b/share/server/core/sources/automap.php
@@ -1,5 +1,9 @@
 <?php
 
+// Register this source as being selectable by the user
+global $selectable;
+$selectable = true;
+
 // options to be modyfiable by the user(url)
 global $viewParams;
 $viewParams = array(
@@ -7,8 +11,12 @@ $viewParams = array(
         'root',
         'render_mode',
         'backend_id',
+        'width',
+        'height',
+        'iconset',
         'filter_by_state',
         'filter_by_ids',
+        'filter_group',
         'child_layers',
         'parent_layers',
         'ignore_hosts',
diff --git a/share/server/core/sources/dynmap.php 
b/share/server/core/sources/dynmap.php
index 56d0760..068af45 100644
--- a/share/server/core/sources/dynmap.php
+++ b/share/server/core/sources/dynmap.php
@@ -46,6 +46,10 @@ function dynmap_program_start($p) {
     return $newest;
 }
 
+// Register this source as being selectable by the user
+global $selectable;
+$selectable = true;
+
 // options to be modifiable by the user(url)
 global $viewParams;
 $viewParams = array(
diff --git a/share/server/core/sources/filter.php 
b/share/server/core/sources/filter.php
index 859e011..3624cad 100644
--- a/share/server/core/sources/filter.php
+++ b/share/server/core/sources/filter.php
@@ -15,11 +15,7 @@ $filter_processed = false;
 
 // options to be modyfiable by the user(url)
 global $viewParams;
-$viewParams = array(
-    '*' => array(
-        'filter_group',
-    )
-);
+$viewParams = array();
 
 // Config variables to be registered for this source
 global $configVars;
diff --git a/share/server/core/sources/general.php 
b/share/server/core/sources/general.php
index 14dae8c..f29e7a3 100644
--- a/share/server/core/sources/general.php
+++ b/share/server/core/sources/general.php
@@ -5,11 +5,6 @@ global $viewParams;
 $viewParams = array(
     '*' => array(
         'sources',
-        'backend_id',
-        'iconset',
-
-        'width',
-        'height',
 
         'header_menu',
         'hover_menu',
diff --git a/share/server/core/sources/geomap.php 
b/share/server/core/sources/geomap.php
index f55e114..01ebbae 100644
--- a/share/server/core/sources/geomap.php
+++ b/share/server/core/sources/geomap.php
@@ -144,6 +144,10 @@ function list_geomap_source_files($CORE) {
     return $CORE->getAvailableGeomapSourceFiles();
 }
 
+// Register this source as being selectable by the user
+global $selectable;
+$selectable = true;
+
 // options to be modifiable by the user(url)
 global $viewParams;
 $viewParams = array(
@@ -154,7 +158,11 @@ $viewParams = array(
         'geomap_border',
         'source_type',
         'source_file',
+        'width',
+        'height',
+        'iconset',
         'label_show',
+        'filter_group',
     )
 );
 


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to