Module: nagvis
Branch: master
Commit: 6b5461eb756358d5e5ad1db901c0004d60580a16
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/commit/?id=6b5461eb756358d5e5ad1db901c0004d60580a16

Author: Lars Michelsen <[email protected]>
Date:   Fri Aug 14 21:24:04 2009 +0200

#66 Add real links to the maps on overview page instead of onclick events

---

 share/nagvis/includes/js/NagVisMap.js |   33 ++++++++++++++++++++++++---------
 1 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/share/nagvis/includes/js/NagVisMap.js 
b/share/nagvis/includes/js/NagVisMap.js
index 5d2cb13..bbebef8 100755
--- a/share/nagvis/includes/js/NagVisMap.js
+++ b/share/nagvis/includes/js/NagVisMap.js
@@ -39,7 +39,15 @@ var NagVisMap = NagVisStatefulObject.extend({
         * @return      String          HTML code of the label
         * @author      Lars Michelsen <[email protected]>
         */
-        parseOverview: function () {
+       parseOverview: function () {
+               var alt = '';
+               
+               if(this.type == 'service') {
+                       alt = this.conf.name+'-'+this.conf.service_description;
+               } else {
+                       alt = this.conf.name;
+               }
+               
                this.replaceMacros();
                
                var oTd = document.createElement('td');
@@ -49,33 +57,40 @@ var NagVisMap = NagVisStatefulObject.extend({
                oTd.style.width = '200px';
                oTd.style.height = '200px';
                
-               var sUrl = this.conf.overview_url;
-               oTd.onclick = function() { 
-                       location.href = sUrl;
-               };
+               // Link
+               var oLink = document.createElement('a');
+               oLink.href = this.conf.overview_url;
                
+               // Status image
                var oImg = document.createElement('img');
                oImg.align="right";
                oImg.src=this.conf.iconHtmlPath+this.conf.icon;
-               oTd.appendChild(oImg);
+               oImg.alt = this.conf.type+'-'+alt;
+               
+               oLink.appendChild(oImg);
                oImg = null;
                
+               // Title
                var h2 = document.createElement('h2');
                h2.appendChild(document.createTextNode(this.conf.alias));
-               oTd.appendChild(h2);
+               oLink.appendChild(h2);
                h2 = null;
                
                var br = document.createElement('br');
-               oTd.appendChild(br);
+               oLink.appendChild(br);
                br = null;
                
+               // Map thumb
                oImg = document.createElement('img');
                oImg.style.width = '200px';
                oImg.style.height = '150px';
                oImg.src=this.conf.overview_image;
-               oTd.appendChild(oImg);
+               oLink.appendChild(oImg);
                oImg = null;
                
+               oTd.appendChild(oLink);
+               oLink = null;
+               
                return oTd;
        }
 });


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