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

Author: Lars Michelsen <[email protected]>
Date:   Sun Sep 19 22:13:22 2010 +0200

Fixed hover menu of automaps on overview page; Minor code cleanups

---

 share/frontend/nagvis-js/js/NagVisMap.js      |    8 ++----
 share/frontend/nagvis-js/js/frontend.js       |   30 ++++++++----------------
 share/server/core/classes/GlobalIndexPage.php |    2 +-
 3 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisMap.js 
b/share/frontend/nagvis-js/js/NagVisMap.js
index 3ee7f98..4f1d266 100644
--- a/share/frontend/nagvis-js/js/NagVisMap.js
+++ b/share/frontend/nagvis-js/js/NagVisMap.js
@@ -42,11 +42,10 @@ var NagVisMap = NagVisStatefulObject.extend({
        parseOverview: function () {
                var alt = '';
                
-               if(this.type == 'service') {
+               if(this.type == 'service')
                        alt = this.conf.name+'-'+this.conf.service_description;
-               } else {
+               else
                        alt = this.conf.name;
-               }
                
                this.replaceMacros();
                
@@ -58,9 +57,8 @@ var NagVisMap = NagVisStatefulObject.extend({
                oTd.style.margin = '0';
                
                // Only show map thumb when configured
-               if(oPageProperties.showmapthumbs == 1) {
+               if(oPageProperties.showmapthumbs == 1)
                        oTd.style.height = '200px';
-               }
                
                // Link
                var oLink = document.createElement('a');
diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 9508435..93e19b1 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -328,27 +328,22 @@ function setMapHoverUrls() {
                // Ignore objects which
                // a) have a disabled hover menu
                // b) do use hover_url
-               if(aMapObjects[a].conf.hover_menu && 
aMapObjects[a].conf.hover_menu == 1 && aMapObjects[a].conf.hover_url && 
aMapObjects[a].conf.hover_url !== '') {
+               if(aMapObjects[a].conf.hover_menu && 
aMapObjects[a].conf.hover_menu == 1 && aMapObjects[a].conf.hover_url && 
aMapObjects[a].conf.hover_url !== '')
                        oHoverUrls[aMapObjects[a].conf.hover_url] = '';
-               }
        }
        
        // Build string for bulk fetching the templates
-       for(var i in oHoverUrls) {
-               if(i != 'Inherits') {
+       for(var i in oHoverUrls)
+               if(i != 'Inherits')
                        aUrlParts.push('&url[]='+escapeUrlValues(i));
-               }
-       }
        
        // Get the needed templates via bulk request
        aTemplateObjects = 
getBulkRequest(oGeneralProperties.path_server+'?mod=General&act=getHoverUrl', 
aUrlParts, oWorkerProperties.worker_request_max_length, true);
        
        // Set the code to global object oHoverTemplates
-       if(aTemplateObjects.length > 0) {
-               for(var i = 0, len = aTemplateObjects.length; i < len; i++) {
+       if(aTemplateObjects.length > 0)
+               for(var i = 0, len = aTemplateObjects.length; i < len; i++)
                        oHoverUrls[aTemplateObjects[i].url] = 
aTemplateObjects[i].code;
-               }
-       }
 }
 
 /**
@@ -361,11 +356,9 @@ function setMapHoverUrls() {
  * @author     Lars Michelsen <[email protected]>
  */
 function parseHoverMenus(aObjs) {
-       for(var a = 0; a < aObjs.length; a++) {
-               if(aObjs[a].conf.hover_menu && aObjs[a].conf.hover_menu !== 
'0') {
+       for(var a = 0; a < aObjs.length; a++)
+               if(aObjs[a].conf.hover_menu && aObjs[a].conf.hover_menu !== '0')
                        aObjs[a].parseHoverMenu();
-               }
-       }
 }
 
 /**
@@ -384,9 +377,8 @@ function getHoverTemplates(aObjs) {
                // Ignore objects which
                // a) have a disabled hover menu
                // b) do not use hover_url
-               if(aObjs[a].conf.hover_menu && aObjs[a].conf.hover_menu == '1' 
&& (!aObjs[a].conf.hover_url || aObjs[a].conf.hover_url === '')) {
+               if(aObjs[a].conf.hover_menu && aObjs[a].conf.hover_menu == '1' 
&& (!aObjs[a].conf.hover_url || aObjs[a].conf.hover_url === ''))
                        oHoverTemplates[aObjs[a].conf.hover_template] = '';
-               }
        }
        
        // Build string for bulk fetching the templates
@@ -410,11 +402,9 @@ function getHoverTemplates(aObjs) {
        aTemplateObjects = 
getBulkRequest(oGeneralProperties.path_server+'?mod=General&act=getHoverTemplate',
 aUrlParts, oWorkerProperties.worker_request_max_length, true);
        
        // Set the code to global object oHoverTemplates
-       if(aTemplateObjects.length > 0) {
-               for(var i = 0, len = aTemplateObjects.length; i < len; i++) {
+       if(aTemplateObjects.length > 0)
+               for(var i = 0, len = aTemplateObjects.length; i < len; i++)
                        oHoverTemplates[aTemplateObjects[i].name] = 
aTemplateObjects[i].code;
-               }
-       }
 }
 
 /**
diff --git a/share/server/core/classes/GlobalIndexPage.php 
b/share/server/core/classes/GlobalIndexPage.php
index cda7964..a407575 100644
--- a/share/server/core/classes/GlobalIndexPage.php
+++ b/share/server/core/classes/GlobalIndexPage.php
@@ -104,7 +104,7 @@ class GlobalIndexPage {
                        $objConf = $MAPCFG->getTypeDefaults('global');
                        $objConf['type'] = 'map';
                        $objConf['map_name'] = $MAPCFG->getName();
-                       $objConf['object_id'] = $object_id;
+                       $objConf['object_id'] = $type.'-'.$object_id;
                        // Enable the hover menu in all cases - maybe make it 
configurable
                        $objConf['hover_menu'] = 1;
                        $objConf['hover_childs_show'] = 1;


------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to