[Jaws-commits] r13395 - branches/0.8/html/include

afz at jaws-project.com afz at jaws-project.com
Sun Aug 12 21:50:20 UTC 2012


Author: afz
Date: 2012-08-12 21:50:20 +0000 (Sun, 12 Aug 2012)
New Revision: 13395

Modified:
   branches/0.8/html/include/Jaws.php
Log:
Added support splitting Model/AdminModel too

Modified: branches/0.8/html/include/Jaws.php
===================================================================
--- branches/0.8/html/include/Jaws.php	2012-08-12 18:02:28 UTC (rev 13394)
+++ branches/0.8/html/include/Jaws.php	2012-08-12 21:50:20 UTC (rev 13395)
@@ -614,28 +614,39 @@
         $filename = trim($filename);
         if (!empty($filename)) {
             if (!isset($this->_Gadgets[$gadget][$type]['files'][$filename])) {
-                $action_class_name = $type_class_name. '_'. $filename;
-                $file = JAWS_PATH. "gadgets/$gadget/actions/$type/$filename.php";
+                switch ($type) {
+                    case 'HTML':
+                    case 'AdminHTML':
+                        $file = JAWS_PATH. "gadgets/$gadget/Actions/$type/$filename.php";
+                        break;
+
+                    case 'Model':
+                    case 'AdminModel':
+                        $file = JAWS_PATH. "gadgets/$gadget/Model/$filename.php";
+                        break;
+                }
+
                 if (file_exists($file)) {
                     include_once $file;
                 }
 
-                if (!Jaws::classExists($action_class_name)) {
+                $file_class_name = $type_class_name. '_'. $filename;
+                if (!Jaws::classExists($file_class_name)) {
                     // return a error
-                    $error = new Jaws_Error(_t('GLOBAL_ERROR_CLASS_DOES_NOT_EXIST', $action_class_name),
+                    $error = new Jaws_Error(_t('GLOBAL_ERROR_CLASS_DOES_NOT_EXIST', $file_class_name),
                                             'Gadget class check');
                     return $error;
                 }
 
-                $objAction = new $action_class_name();
-                if (Jaws_Error::IsError($objAction)) {
-                    $error = new Jaws_Error(_t('GLOBAL_ERROR_FAILED_CREATING_INSTANCE', $file, $action_class_name),
+                $objFile = new $file_class_name();
+                if (Jaws_Error::IsError($objFile)) {
+                    $error = new Jaws_Error(_t('GLOBAL_ERROR_FAILED_CREATING_INSTANCE', $file, $file_class_name),
                                             'Gadget file loading');
                     return $error;
                 }
 
-                $this->_Gadgets[$gadget][$type]['files'][$filename] = $objAction;
-                $GLOBALS['log']->Log(JAWS_LOG_DEBUG, "Loaded gadget action: $gadget, Type: $type, File: $filename");
+                $this->_Gadgets[$gadget][$type]['files'][$filename] = $objFile;
+                $GLOBALS['log']->Log(JAWS_LOG_DEBUG, "Loaded gadget file: $gadget, Type: $type, File: $filename");
             }
 
             return $this->_Gadgets[$gadget][$type]['files'][$filename];



More information about the Jaws-commits mailing list