[Jaws-commits] r11852 - in trunk/jaws/html: gadgets/Layout include/Jaws

afz at jaws-project.com afz at jaws-project.com
Mon Dec 6 21:38:34 UTC 2010


Author: afz
Date: 2010-12-06 21:38:34 +0000 (Mon, 06 Dec 2010)
New Revision: 11852

Modified:
   trunk/jaws/html/gadgets/Layout/AdminHTML.php
   trunk/jaws/html/include/Jaws/Template.php
Log:
fix an issue when changing theme via layout gadget

Modified: trunk/jaws/html/gadgets/Layout/AdminHTML.php
===================================================================
--- trunk/jaws/html/gadgets/Layout/AdminHTML.php	2010-12-06 21:36:49 UTC (rev 11851)
+++ trunk/jaws/html/gadgets/Layout/AdminHTML.php	2010-12-06 21:38:34 UTC (rev 11852)
@@ -279,7 +279,7 @@
         $theme = $request->get('theme', 'post');
         $mode = $request->get('mode', 'post');
 
-        $tpl = new Jaws_Template();
+        $tpl = new Jaws_Template('', JAWS_OTHERS);
         $layout_file = JAWS_DATA . 'themes/' . $theme . '/layout.html';
         if (!file_exists($layout_file)) {
             $layout_file = JAWS_BASE_DATA . 'themes/' . $theme . '/layout.html';

Modified: trunk/jaws/html/include/Jaws/Template.php
===================================================================
--- trunk/jaws/html/include/Jaws/Template.php	2010-12-06 21:36:49 UTC (rev 11851)
+++ trunk/jaws/html/include/Jaws/Template.php	2010-12-06 21:38:34 UTC (rev 11852)
@@ -48,7 +48,7 @@
      * @param   string $base_type   Template base type(JAWS_OTHERS, JAWS_GADGET, JAWS_PLUGIN)
      * @access  public
      */
-    function Jaws_Template($base_path = '', $base_type = JAWS_OTHERS)
+    function Jaws_Template($base_path = '', $base_type = null)
     {
         $this->IdentifierRegExp = '[0-9A-Za-z_-]+';
         $this->AttributesRegExp = '/(\w+)((\s*=\s*".*?")|(\s*=\s*\'.*?\')|(\s*=\s*\w+)|())/s';
@@ -64,25 +64,27 @@
      * @access  public
      * @param   string  $path Template path (where templates are)
      */
-    function SetPath($base_path = '', $base_type = JAWS_OTHERS)
+    function SetPath($base_path = '', $base_type = null)
     {
-        if (!empty($base_path)) {
-            //for compatible with old versions
-            if (strpos($base_path, 'gadgets/') !== false) {
-                $base_type = JAWS_GADGET;
-                $base_path = str_replace(array('gadgets/', '/templates/'), '', $base_path);
-            }
+        if (is_null($base_type)) {
+            if (!empty($base_path)) {
+                //for compatible with old versions
+                if (strpos($base_path, 'gadgets/') !== false) {
+                    $base_type = JAWS_GADGET;
+                    $base_path = str_replace(array('gadgets/', '/templates/'), '', $base_path);
+                }
 
-            if (strpos($base_path, 'plugins/') !== false) {
-                $base_type = JAWS_PLUGIN;
-                $base_path = str_replace(array('plugins/', '/templates/'), '', $base_path);
-            }
+                if (strpos($base_path, 'plugins/') !== false) {
+                    $base_type = JAWS_PLUGIN;
+                    $base_path = str_replace(array('plugins/', '/templates/'), '', $base_path);
+                }
 
-            if ($base_type == JAWS_OTHERS) {
-                $base_path .= '/';
+                if ($base_type == JAWS_OTHERS) {
+                    $base_path .= '/';
+                }
+            } else {
+                $base_type = JAWS_THEMES;
             }
-        } else {
-            $base_type = JAWS_THEMES;
         }
 
         $this->_BaseType = $base_type;



More information about the Jaws-commits mailing list