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

Author: Lars Michelsen <[email protected]>
Date:   Wed Aug 19 18:59:39 2009 +0200

#15: Added map specific stylesheets

---

 docs/en_US/map_config_format_description.html    |    3 ++
 docs/en_US/nagvis_config_format_description.html |    3 ++
 etc/nagvis.ini.php-sample                        |    3 ++
 install.sh                                       |   23 ++++++++++++++-------
 share/nagvis/includes/classes/GlobalMainCfg.php  |   11 +++++++++-
 share/nagvis/includes/classes/GlobalMapCfg.php   |    3 ++
 share/nagvis/includes/classes/NagVisFrontend.php |    6 +++++
 7 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/docs/en_US/map_config_format_description.html 
b/docs/en_US/map_config_format_description.html
index 4e10e30..2e42f28 100644
--- a/docs/en_US/map_config_format_description.html
+++ b/docs/en_US/map_config_format_description.html
@@ -158,6 +158,9 @@
                <td> show_in_lists </td><td> inherited (<a 
href="nagvis_config_format_description.html">nagvis.ini.php</a>) </td><td> Show 
the maps in lists (dropdowns, index page, ...) </td>

                </tr>

                <tr>

+               <td>stylesheet</td><td>inherited (<a 
href="nagvis_config_format_description.html">nagvis.ini.php</a>)</td><td>Filename
 of the custom stylesheet to use on the maps (The file needs to be located in 
the share/nagvis/styles directory)</td>

+               </tr>

+               <tr>

                <td> url_target </td><td> _self </td><td> Target of the Icon 
link, this option adapts &lt;a target=""> (_self is same window) </td>

                </tr>

                <tr>

diff --git a/docs/en_US/nagvis_config_format_description.html 
b/docs/en_US/nagvis_config_format_description.html
index b2cc917..b3ffe44 100644
--- a/docs/en_US/nagvis_config_format_description.html
+++ b/docs/en_US/nagvis_config_format_description.html
@@ -174,6 +174,9 @@
                <td> showinlists </td><td> 1 </td><td> Show the maps in lists 
(dropdowns,index page,...) </td>

                </tr>

                <tr>

+               <td>stylesheet</td><td></td><td>Filename of the custom 
stylesheet to use on the maps (The file needs to be located in the 
share/nagvis/styles directory)</td>

+               </tr>

+               <tr>

                <td> urltarget </td><td> _self </td><td> Target of the Icon 
link, this option adapts <code>&lt;a target=""></code> (_self is same window) 
</td>

                </tr>

                <tr>

diff --git a/etc/nagvis.ini.php-sample b/etc/nagvis.ini.php-sample
index c349ff1..f0e1fb8 100644
--- a/etc/nagvis.ini.php-sample
+++ b/etc/nagvis.ini.php-sample
@@ -92,6 +92,9 @@
 ;recognizeservices=1
 ; show map in lists (dropdowns, index page, ...)
 ;showinlists=1
+; Name of the custom stylesheet to use on the maps (The file needs to be 
located
+; in the share/nagvis/styles directory)
+;stylesheet=""
 ; target for the icon links
 ;urltarget="_self"
 ; URL template for host object links
diff --git a/install.sh b/install.sh
index b4a9f8d..6785fcc 100755
--- a/install.sh
+++ b/install.sh
@@ -803,6 +803,10 @@ fi
 
 text
 if [ "$INSTALLER_ACTION" = "update" -a "$NAGVIS_VER_OLD" != "UNKNOWN" ]; then
+       # Gather path prefix
+       NAGVIS_DIR="nagvis"
+       [ $NAGVIS_TAG -ge 01050000 ] && NAGVIS_DIR="share/nagvis"
+
        LINE="Restoring main configuration file..."
        copy "" "$NAGVIS_CONF" "main configuration file"
        
@@ -810,28 +814,31 @@ if [ "$INSTALLER_ACTION" = "update" -a "$NAGVIS_VER_OLD" 
!= "UNKNOWN" ]; then
        copy "demo.cfg:demo2.cfg" "etc/maps" "map configuration files"
        
        LINE="Restoring custom map images..."
-       copy "nagvis-demo.png" "nagvis/images/maps" "map image files"
+       copy "nagvis-demo.png" "$NAGVIS_DIR/images/maps" "map image files"
        
        LINE="Restoring custom iconsets..."
-       copy "20x20.png:configerror_*.png:error.png:std_*.png" 
"nagvis/images/iconsets" "iconset files"
+       copy "20x20.png:configerror_*.png:error.png:std_*.png" 
"$NAGVIS_DIR/images/iconsets" "iconset files"
        
        LINE="Restoring custom shapes..."
-       copy "" "nagvis/images/shapes" "shapes"
+       copy "" "$NAGVIS_DIR/images/shapes" "shapes"
        
        LINE="Restoring custom header templates..."
-       copy "tmpl.default*" "nagvis/templates/header" "header templates"
+       copy "tmpl.default*" "$NAGVIS_DIR/templates/header" "header templates"
        
        LINE="Restoring custom hover templates..."
-       copy "tmpl.default*" "nagvis/templates/hover" "hover templates"
+       copy "tmpl.default*" "$NAGVIS_DIR/templates/hover" "hover templates"
        
        LINE="Restoring custom header template images..."
-       copy "tmpl.default*" "nagvis/images/templates/header" "header template 
images"
+       copy "tmpl.default*" "$NAGVIS_DIR/images/templates/header" "header 
template images"
 
        LINE="Restoring custom hover template images..."
-       copy "tmpl.default*" "nagvis/images/templates/hover" "hover template 
images"
+       copy "tmpl.default*" "$NAGVIS_DIR/images/templates/hover" "hover 
template images"
 
        LINE="Restoring custom gadgets..."
-       copy "gadgets_core.php:std_*.php" "nagvis/gadgets" "gadgets"
+       copy "gadgets_core.php:std_*.php" "$NAGVIS_DIR/gadgets" "gadgets"
+
+       LINE="Restoring custom stylesheets..."
+  copy "" "$NAGVIS_DIR/styles" "stylesheets"
 fi
 text
 
diff --git a/share/nagvis/includes/classes/GlobalMainCfg.php 
b/share/nagvis/includes/classes/GlobalMainCfg.php
index 570276d..c920fc4 100644
--- a/share/nagvis/includes/classes/GlobalMainCfg.php
+++ b/share/nagvis/includes/classes/GlobalMainCfg.php
@@ -81,6 +81,10 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => 'default',
                                        'match' => MATCH_STRING_NO_SPACE),
+                               'stylesheet' => Array('must' => 0,
+                                       'editable' => 1,
+                                       'default' => '',
+                                       'match' => MATCH_STRING_NO_SPACE),
                                'eventbackground' => Array('must' => 0,
                                        'editable' => 1,
                                        'default' => '0',
@@ -325,7 +329,11 @@ class GlobalMainCfg {
                                        'editable' => 0,
                                        'default' => '',
                                        'match' => MATCH_STRING_PATH),
-                               'htmlsound' => Array('must' => 0,
+                               'htmlsounds' => Array('must' => 0,
+                                       'editable' => 0,
+                                       'default' => '',
+                                       'match' => MATCH_STRING_PATH),
+                               'htmlstyles' => Array('must' => 0,
                                        'editable' => 0,
                                        'default' => '',
                                        'match' => MATCH_STRING_PATH),
@@ -537,6 +545,7 @@ class GlobalMainCfg {
                $this->validConfig['paths']['htmlmap']['default'] = 
$htmlBase.'/nagvis/images/maps/';
                $this->validConfig['paths']['htmlsharedvar']['default'] = 
$htmlBase.'/var/';
                $this->validConfig['paths']['htmlsounds']['default'] = 
$htmlBase.'/nagvis/sounds/';
+               $this->validConfig['paths']['htmlstyles']['default'] = 
$htmlBase.'/nagvis/styles/';
                $this->validConfig['paths']['htmlgadgets']['default'] = 
$htmlBase.'/nagvis/gadgets/';
        }
        
diff --git a/share/nagvis/includes/classes/GlobalMapCfg.php 
b/share/nagvis/includes/classes/GlobalMapCfg.php
index 006e888..238d129 100755
--- a/share/nagvis/includes/classes/GlobalMapCfg.php
+++ b/share/nagvis/includes/classes/GlobalMapCfg.php
@@ -247,6 +247,9 @@ class GlobalMapCfg {
                                        'default' => 
$this->CORE->MAINCFG->getValue('defaults', 'showinlists'),
                                        'match' => MATCH_BOOLEAN,
                                        'field_type' => 'boolean'),
+                               'stylesheet' => Array('must' => 0,
+                                       'default' => 
$this->CORE->MAINCFG->getValue('defaults', 'stylesheet'),
+                                       'match' => MATCH_STRING_NO_SPACE),
                                'url_target' => Array('must' => 0,
                                        'default' => 
$this->CORE->MAINCFG->getValue('defaults', 'urltarget'),
                                        'match' => MATCH_STRING_NO_SPACE),
diff --git a/share/nagvis/includes/classes/NagVisFrontend.php 
b/share/nagvis/includes/classes/NagVisFrontend.php
index 95599c9..6cde823 100644
--- a/share/nagvis/includes/classes/NagVisFrontend.php
+++ b/share/nagvis/includes/classes/NagVisFrontend.php
@@ -88,6 +88,12 @@ class NagVisFrontend extends GlobalPage {
                // Only do this, when a map needs to be displayed
                if(get_class($this->MAPCFG) != '') {
                        $prop['allowedUsers'] = 
$this->MAPCFG->getValue('global',0, 'allowed_user');
+                       
+                       // Load custom (map specific) stylesheets
+                       $customStylesheet = $this->MAPCFG->getValue('global',0, 
'stylesheet');
+                       if($customStylesheet !== '') {
+                               $prop['cssIncludes'][] = 
$CORE->MAINCFG->getValue('paths','htmlstyles') . $customStylesheet;
+                       }
                }
                
                parent::__construct($CORE, $prop);


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