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

Author: LaMi <[email protected]>
Date:   Wed Nov 18 20:53:05 2009 +0100

WUI: Fixed header template detection

---

 share/server/core/classes/GlobalCore.php |   32 ++++++++++++++++++++++++++++-
 share/server/core/defines/matches.php    |    1 +
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/share/server/core/classes/GlobalCore.php 
b/share/server/core/classes/GlobalCore.php
index 7fab7a3..07535d2 100644
--- a/share/server/core/classes/GlobalCore.php
+++ b/share/server/core/classes/GlobalCore.php
@@ -274,6 +274,34 @@ class GlobalCore {
        }
        
        /**
+        * Reads available themes
+        *
+        * @return      Array list
+        * @author      Lars Michelsen <[email protected]>
+        */
+       public function getAvailableThemes() {
+               $themes = Array();
+               
+               // Get themes from template path and
+               if ($handle = opendir(self::getMainCfg()->getValue('paths', 
'pagetemplate'))) {
+                       while (false !== ($path = readdir($handle))) {
+                               // Assume each directory is a theme
+                               if(is_dir($path)) {
+                                       $themes[$arrRet[1]] = true;
+                               }
+                       }
+                       
+                       if ($themes) {
+                               natcasesort($themes);
+                       }
+                       
+                       closedir($handle);
+               }
+               
+               return $themes;
+       }
+       
+       /**
         * Reads all header templates
         *
         * @return      Array list
@@ -282,9 +310,9 @@ class GlobalCore {
        public function getAvailableHeaderTemplates() {
                $files = Array();
                
-               if ($handle = opendir(self::getMainCfg()->getValue('paths', 
'headertemplate'))) {
+               if ($handle = opendir(self::getMainCfg()->getValue('paths', 
'pagetemplate'))) {
                        while (false !== ($file = readdir($handle))) {
-                               if(preg_match(MATCH_HTML_TEMPLATE_FILE, $file, 
$arrRet)) {
+                               if(preg_match(MATCH_HEADER_TEMPLATE_FILE, 
$file, $arrRet)) {
                                        $files[] = $arrRet[1];
                                }
                        }
diff --git a/share/server/core/defines/matches.php 
b/share/server/core/defines/matches.php
index 391d81e..2683047 100644
--- a/share/server/core/defines/matches.php
+++ b/share/server/core/defines/matches.php
@@ -66,6 +66,7 @@ define('MATCH_URI_PART', '/^[a-zA-Z0-9-_]*$/');
 define('MATCH_CFG_FILE', '/^(.+)\.cfg$/i');
 define('MATCH_MP3_FILE', '/^(.+)\.mp3$/i');
 define('MATCH_HTML_TEMPLATE_FILE', '/^tmpl\.(.+)\.html$/i');
+define('MATCH_HEADER_TEMPLATE_FILE', '/^(.+)\.header\.html$/i');
 define('MATCH_PHP_FILE', '/^(.+\.php)$/i');
 define('MATCH_INTEGER_PRESIGN', '/^[\+\-]?[0-9]+$/');
 define('MATCH_ORDER', '/^(?:asc|desc)$/');


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