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

Author: Lars Michelsen <[email protected]>
Date:   Fri Oct  9 20:22:17 2009 +0200

#68 Added gadget specific option param gadget_opts

---

 .../docs/en_US/map_config_format_description.html  |    3 +++
 nagvis/nagvis/includes/classes/GlobalMapCfg.php    |    5 +++++
 nagvis/nagvis/includes/js/NagVisService.js         |    8 +++++++-
 nagvis/wui/includes/classes/WuiMap.php             |    7 ++++++-
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/nagvis/docs/en_US/map_config_format_description.html 
b/nagvis/docs/en_US/map_config_format_description.html
index cf17a13..7001c5a 100644
--- a/nagvis/docs/en_US/map_config_format_description.html
+++ b/nagvis/docs/en_US/map_config_format_description.html
@@ -317,6 +317,9 @@
                <td> gadget_scale </td><td>100</td><td> The scale of the 
gadget. Default scale is 100. The gadgets should be able to be resized by this 
parameter <font color="#ff0000">(New in 1.4.2)</font> </td>

                </tr>

                <tr>

+               <td> gadget_opts </td><td></td><td> Optional gadget specific 
params. The contents can be free defined for each gadget. The value is 
processed as GET param &quot;opts&quot;. We reccomend to use a var/val format 
like this: key1=val1,key2=val2. Then you can easily split this string to an 
array in the gadget. <font color="#ff0000">(New in 1.4.4)</font> </td>

+               </tr>

+               <tr>

                <td> hover_menu </td><td> inherited (<a 
href="nagvis_config_format_description.html">nagvis.ini.php</a>) </td><td> 
Enable/Disable the hover menu </td>

                </tr>

                <tr>

diff --git a/nagvis/nagvis/includes/classes/GlobalMapCfg.php 
b/nagvis/nagvis/includes/classes/GlobalMapCfg.php
index 92eee13..29ee378 100644
--- a/nagvis/nagvis/includes/classes/GlobalMapCfg.php
+++ b/nagvis/nagvis/includes/classes/GlobalMapCfg.php
@@ -616,6 +616,11 @@ class GlobalMapCfg {
                                        'match' => MATCH_INTEGER,
                                        'depends_on' => 'view_type',
                                        'depends_value' => 'gadget'),
+                               'gadget_opts' => Array('must' => 0,
+                                       'default' => '',
+                                       'match' => MATCH_STRING_NO_SPACE,
+                                       'depends_on' => 'view_type',
+                                       'depends_value' => 'gadget'),
                                
                                'context_menu' => Array('must' => 0,
                                        'match' => MATCH_BOOLEAN,
diff --git a/nagvis/nagvis/includes/js/NagVisService.js 
b/nagvis/nagvis/includes/js/NagVisService.js
index e83343b..f425b77 100644
--- a/nagvis/nagvis/includes/js/NagVisService.js
+++ b/nagvis/nagvis/includes/js/NagVisService.js
@@ -53,7 +53,13 @@ var NagVisService = NagVisStatefulObject.extend({
                        sParams = '&';
                }
                
-               sParams = sParams + 'name1=' + this.conf.name + '&name2=' + 
escapeUrlValues(this.conf.service_description) + '&scale=' + 
escapeUrlValues(this.conf.gadget_scale.toString()) + '&state=' + 
this.conf.state + '&stateType=' + this.conf.state_type + '&perfdata=' + 
this.conf.perfdata.replace(/\&quot\;|\&\#145\;/g,'%22');
+               // Process the optional gadget_opts param
+               var sGadgetOpts = '';
+               if(this.conf.gadget_opts && this.conf.gadget_opts != '') {
+                       sGadgetOpts = '&opts=' + 
escapeUrlValues(this.conf.gadget_opts.toString());
+               }
+               
+               sParams = sParams + 'name1=' + this.conf.name + '&name2=' + 
escapeUrlValues(this.conf.service_description) + '&scale=' + 
escapeUrlValues(this.conf.gadget_scale.toString()) + '&state=' + 
this.conf.state + '&stateType=' + this.conf.state_type + '&perfdata=' + 
this.conf.perfdata.replace(/\&quot\;|\&\#145\;/g,'%22') + sGadgetOpts;
                
                var oIcon = document.createElement('img');
                oIcon.setAttribute('id', this.conf.object_id+'-icon');
diff --git a/nagvis/wui/includes/classes/WuiMap.php 
b/nagvis/wui/includes/classes/WuiMap.php
index 797e2b8..5891bf5 100644
--- a/nagvis/wui/includes/classes/WuiMap.php
+++ b/nagvis/wui/includes/classes/WuiMap.php
@@ -253,8 +253,13 @@ class WuiMap extends GlobalMap {
                                                if(strpos($obj['gadget_url'], 
'?') === false) {
                                                        $sDelim = '?';
                                                }
+
+                                               $sGadgetOpts = '';
+                                               if(isset($obj['gadget_opts']) 
&& $obj['gadget_opts'] != '') {
+                                                       $sGadgetOpts = '&opts=' 
. urlencode($obj['gadget_opts']);
+                                               }
                                                
-                                               $obj['iconParams'] = $sDelim . 
'name1=dummyHost&name2=dummyService&state=OK&stateType=HARD&conf=1&scale=' . 
$obj['gadget_scale'];
+                                               $obj['iconParams'] = $sDelim . 
'name1=dummyHost&name2=dummyService&state=OK&stateType=HARD&conf=1&scale=' . 
$obj['gadget_scale'] . $sGadgetOpts;
                                        } else {
                                                $obj['iconParams'] = '';
                                        }


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