Author:   Lars Michelsen <[email protected]>
Date:     Fri Jan 23 12:55:04 2015 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Fri Jan 23 12:55:04 2015 +0100

URLs of shape images can now be configured via configuration dialog

---

 ChangeLog                                         |    2 ++
 share/server/core/classes/WuiViewMapAddModify.php |   17 +++++++++--------
 share/server/core/mapcfg/default.php              |   17 ++++++++++++-----
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4dba072..6bb38b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,8 @@ Core:
   according to nagios plugin guidelines)
 
 Frontend:
+  * URLs of shape images can now be configured via configuration dialog
+  * FIX: Fixed exception when trying to define Multiple/Other values for 
"sources"
   * FIX: Fixed relative label positioning (center, bottom) on first page load 
sometimes wrong
 
 1.8rc3
diff --git a/share/server/core/classes/WuiViewMapAddModify.php 
b/share/server/core/classes/WuiViewMapAddModify.php
index 2c70a6d..20836db 100644
--- a/share/server/core/classes/WuiViewMapAddModify.php
+++ b/share/server/core/classes/WuiViewMapAddModify.php
@@ -170,7 +170,8 @@ class WuiViewMapAddModify {
 
         $typeDefaults = $this->MAPCFG->getTypeDefaults($type);
 
-        if($objId == 0) {
+        list($isInherited, $sources) = $this->getAttr($typeDefaults, $update, 
'sources', false);
+        if($objId == 0 && $sources != '<<<other>>>') {
             // Special handling for the global section:
             // It might contain some source related parameters (if some 
sources are enabled).
             // Another speciality ist that the dialog can be opened in 
"view_params" mode
@@ -246,14 +247,14 @@ class WuiViewMapAddModify {
 
             $ret .= '<tr class="'.implode(' ', $rowClasses).'"'.$rowHide.'><td 
class=tdlabel>'.$propname.'</td><td class=tdbox>';
 
-            $multiple = $fieldType == 'dropdown' && isset($prop['multiple']) 
&& $prop['multiple'];
+            $other = $fieldType == 'dropdown' && isset($prop['other']) && 
$prop['other'];
 
             $onChange = '';
             // Submit the form when an attribute which has dependant 
attributes is changed
             if($this->MAPCFG->hasDependants($type, $propname)) {
                 $onChange = 
'document.getElementById(\'update\').value=\'1\';document.getElementById(\'commit\').click();';
             }
-            elseif ($onChange == '' && (($multiple && $value !== 
'<<<multiple>>>')
+            elseif ($onChange == '' && (($other && $value !== '<<<other>>>')
                                         || ($type == 'service' && $propname == 
'host_name'))) {
                 // If var is backend_id or var is host_name in service objects 
submit the form
                 // to update the depdant lists.
@@ -337,21 +338,21 @@ class WuiViewMapAddModify {
                         // Fallback to an input field when the attribute has 
an value which is not
                         // an option in the select field
                         if($value != '' && !isset($options[$value])) {
-                            // In case of multiple selected the single objects 
can not be found, this is ok.
-                            if (!$array) {
+                            // In case of "other" selected, the single objects 
can not be found, this is ok.
+                            if (!$other) {
                                 $this->setError(new FieldInputError($propname,
                                     l('Current value is not a known option - 
falling back to input field.')));
                             }
 
-                            if ($array && $multiple && $value === 
'<<<multiple>>>')
+                            if ($other && $value === '<<<other>>>')
                                 $value = '';
 
                             $ret .= $this->inputField($propname, $value, 
$hideField);
                             break;
                         }
 
-                        if($array && $multiple) {
-                            $options['<<<multiple>>>'] = l('>>> Select 
multiple');
+                        if($other) {
+                            $options['<<<other>>>'] = l('>>> Specify other');
                         }
 
                         $ret .= $this->selectField($propname, $options, 
$value, $hideField, $onChange);
diff --git a/share/server/core/mapcfg/default.php 
b/share/server/core/mapcfg/default.php
index ef510e4..371b253 100644
--- a/share/server/core/mapcfg/default.php
+++ b/share/server/core/mapcfg/default.php
@@ -92,7 +92,7 @@ function getObjectNames($type, $MAPCFG, $objId, $attrs) {
         $backendIds = $MAPCFG->getValue($objId, 'backend_id');
 
     // Return simply nothing when a user just choosen to insert multiple 
backends
-    if(isset($attrs['backend_id']) && $attrs['backend_id'] == '<<<multiple>>>')
+    if(isset($attrs['backend_id']) && $attrs['backend_id'] == '<<<other>>>')
         return array();
 
     // Initialize the backend
@@ -152,13 +152,19 @@ function listTemplateNames() {
     return Array();
 }
 
-function listShapes() {
+function listShapes($MAPCFG, $objId, $attrs) {
     global $CORE;
+    // Return simply nothing when a user just choosen to insert "other" icon
+    if(isset($attrs['icon']) && $attrs['icon'] == '<<<other>>>')
+        return array();
     return $CORE->getAvailableShapes();
 }
 
-function listSources() {
+function listSources($MAPCFG, $objId, $attrs) {
     global $CORE;
+    // Return simply nothing when a user just choosen to insert "other" sources
+    if(isset($attrs['sources']) && $attrs['sources'] == '<<<other>>>')
+        return array();
     return $CORE->getSelectableSources();
 }
 
@@ -189,7 +195,7 @@ $mapConfigVars = Array(
         'must'       => 0,
         'default'    => array(),
         'array'      => true,
-       'multiple'   => true,
+       'other'      => true,
         'match'      => MATCH_STRING,
         'field_type' => 'dropdown',
         'list'       => 'listSources',
@@ -199,7 +205,7 @@ $mapConfigVars = Array(
         'default'    => cfg('defaults', 'backend'),
         'match'      => MATCH_BACKEND_ID,
         'array'      => true,
-       'multiple'   => true,
+       'other'      => true,
         'field_type' => 'dropdown',
         'list'       => 'listBackendIds',
     ),
@@ -835,6 +841,7 @@ $mapConfigVars = Array(
         'must'       => 1,
         'match'      => MATCH_PNG_GIF_JPG_FILE_OR_URL,
         'field_type' => 'dropdown',
+       'other'      => true,
         'list'       => 'listShapes',
     ),
     'enable_refresh' => Array(


------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to