OSDN Git Service

- some more fix for view updates
authorfujimoto <fujimoto@2ef88817-412d-0410-a32c-8029a115e976>
Thu, 9 Dec 2004 02:58:24 +0000 (02:58 +0000)
committerfujimoto <fujimoto@2ef88817-412d-0410-a32c-8029a115e976>
Thu, 9 Dec 2004 02:58:24 +0000 (02:58 +0000)
- adding pre/post trigger filter (underway)

class/Ethna_Controller.php
class/Ethna_SkeltonGenerator.php
skel/app.controller.php
skel/skel.view.php

index 0db12a7..64b92fa 100644 (file)
@@ -49,6 +49,7 @@ class Ethna_Controller
        var $directory = array(
                'action'                => 'app/action',
                'etc'                   => 'etc',
+               'filter'                => 'app/filter',
                'locale'                => 'locale',
                'log'                   => 'log',
                'plugins'               => array(),
@@ -658,7 +659,7 @@ class Ethna_Controller
        function main($class_name, $action_name = "", $fallback_action_name = "")
        {
                $c =& new $class_name;
-               $c->trigger($action_name, $fallback_action_name);
+               $c->trigger('www', $action_name, $fallback_action_name);
        }
 
        /**
@@ -673,7 +674,7 @@ class Ethna_Controller
        {
                $c =& new $class_name;
                $c->action[$action_name] = array();
-               $c->trigger($action_name);
+               $c->trigger('www', $action_name);
        }
 
        /**
@@ -687,7 +688,7 @@ class Ethna_Controller
        {
                $c =& new $class_name;
                $c->setClientType(CLIENT_TYPE_SOAP);
-               $c->trigger_SOAP();
+               $c->trigger('soap');
        }
 
        /**
@@ -701,22 +702,49 @@ class Ethna_Controller
        {
                $c =& new $class_name;
                $c->setClientType(CLIENT_TYPE_AMF);
-               $c->trigger_AMF();
+               $c->trigger('amf');
        }
 
        /**
         *      ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò³«»Ï¤¹¤ë
         *
+        *      @access public
+        *      @param  strint  $type                                   ½èÍý¥¿¥¤¥×(WWW/SOAP/AMF)
+        *      @param  mixed   $default_action_name    »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾
+        *      @param  mixed   $fallback_action_name   ¥¢¥¯¥·¥ç¥ó̾¤¬·èÄê¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¥¢¥¯¥·¥ç¥ó̾
+        *      @return mixed   0:Àµ¾ï½ªÎ» Ethna_Error:¥¨¥é¡¼
+        */
+       function trigger($type, $default_action_name = "", $fallback_action_name = "")
+       {
+               // ¥Õ¥£¥ë¥¿¡¼¤ÎÀ¸À®
+
+               // prefilter
+
+               // trigger
+               if ($type == 'www') {
+                       $this->_trigger($default_action_name, $fallback_action_name);
+               } else if ($type == 'soap') {
+                       $this->_trigger_SOAP();
+               } else if ($type == 'amf') {
+                       $this->_trigger_AMF();
+               }
+
+               // postfilter
+       }
+
+       /**
+        *      ¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë(WWW)
+        *
         *      °ú¿ô$default_action_name¤ËÇÛÎ󤬻ØÄꤵ¤ì¤¿¾ì¹ç¡¢¤½¤ÎÇÛÎó¤Ç»ØÄꤵ¤ì¤¿
         *      ¥¢¥¯¥·¥ç¥ó°Ê³°¤Ï¼õ¤±ÉÕ¤±¤Ê¤¤(¤½¤ì°Ê³°¤Î¥¢¥¯¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢
         *      ÇÛÎó¤ÎÀèƬ¤Ç»ØÄꤵ¤ì¤¿¥¢¥¯¥·¥ç¥ó¤¬¼Â¹Ô¤µ¤ì¤ë)
         *
-        *      @access public
+        *      @access private
         *      @param  mixed   $default_action_name    »ØÄê¤Î¥¢¥¯¥·¥ç¥ó̾
         *      @param  mixed   $fallback_action_name   ¥¢¥¯¥·¥ç¥ó̾¤¬·èÄê¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¼Â¹Ô¤µ¤ì¤ë¥¢¥¯¥·¥ç¥ó̾
         *      @return mixed   0:Àµ¾ï½ªÎ» Ethna_Error:¥¨¥é¡¼
         */
-       function trigger($default_action_name = "", $fallback_action_name = "")
+       function _trigger($default_action_name = "", $fallback_action_name = "")
        {
                // ¥¢¥¯¥·¥ç¥ó̾¤Î¼èÆÀ
                $action_name = $this->_getActionName($default_action_name, $fallback_action_name);
@@ -768,11 +796,13 @@ class Ethna_Controller
        }
 
        /**
-        *  SOAP¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò³«»Ï¤¹¤ë
+        *  SOAP¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë
+        *
+        *      (experimental)
         *
-        *  @access public
+        *  @access private
         */
-       function trigger_SOAP()
+       function _trigger_SOAP()
        {
                // ¥¢¥¯¥·¥ç¥ó¥¹¥¯¥ê¥×¥È¤ò¥¤¥ó¥¯¥ë¡¼¥É
                $this->_includeActionScript();
@@ -789,11 +819,13 @@ class Ethna_Controller
        }
 
        /**
-        *      AMF(Flash Remoting)¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò³«»Ï¤¹¤ë
+        *      AMF(Flash Remoting)¥Õ¥ì¡¼¥à¥ï¡¼¥¯¤Î½èÍý¤ò¼Â¹Ô¤¹¤ë
+        *
+        *      (experimental)
         *
         *      @access public
         */
-       function trigger_AMF()
+       function _trigger_AMF()
        {
                include_once('ethna/contrib/amfphp/app/Gateway.php');
 
index ac83e7b..a790b56 100644 (file)
@@ -85,8 +85,8 @@ class Ethna_SkeltonGenerator
                $macro['action_name'] = '{$action_name}';
                $macro['action_path'] = '{$action_path}';
                $macro['forward_name'] = '{$forward_name}';
-               $macro['preforward_name'] = '{$preforward_name}';
-               $macro['preforward_path'] = '{$preforward_path}';
+               $macro['view_name'] = '{$view_name}';
+               $macro['view_path'] = '{$view_path}';
 
                if ($this->_generateFile("www.index.php", "$basedir/www/index.php", $macro) == false ||
                        $this->_generateFile("www.info.php", "$basedir/www/info.php", $macro) == false ||
index 7d760ba..b45596b 100644 (file)
@@ -48,7 +48,7 @@ class {$project_id}_Controller extends Ethna_Controller
                 *      µ­½ÒÎ㡧
                 *
                 *      'index'                 => array(
-                *              'preforward_name'       => '{$project_id}_View_Index',
+                *              'view_name'     => '{$project_id}_View_Index',
                 *      ),
                 */
        );
@@ -177,15 +177,21 @@ class {$project_id}_Controller extends Ethna_Controller
         *      @access protected
         *      @param  object  Smarty  $smarty ¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¥ª¥Ö¥¸¥§¥¯¥È
         */
-       function _setDefaultMacro(&$smarty)
+       function _setDefaultTemplateEngine(&$smarty)
        {
-               $smarty->assign_by_ref('session_name', session_name());
-               $smarty->assign_by_ref('session_id', session_id());
-
-               /* ¥í¥°¥¤¥ó¥Õ¥é¥°(true/false) */
-               if ($this->session->isStart()) {
-                       $smarty->assign_by_ref('login', $this->session->isStart());
-               }
+               /*
+                *      TODO: ¤³¤³¤Ç¥Æ¥ó¥×¥ì¡¼¥È¥¨¥ó¥¸¥ó¤Î½é´üÀßÄê¤ä
+                *  Á´¤Æ¤Î¥Ó¥å¡¼¤Ë¶¦Ä̤ʥƥó¥×¥ì¡¼¥ÈÊÑ¿ô¤òÀßÄꤷ¤Þ¤¹
+                *
+                *      µ­½ÒÎ㡧
+                * $smarty->assign_by_ref('session_name', session_name());
+                * $smarty->assign_by_ref('session_id', session_id());
+                *
+                * // ¥í¥°¥¤¥ó¥Õ¥é¥°(true/false)
+                * if ($this->session->isStart()) {
+                *      $smarty->assign_by_ref('login', $this->session->isStart());
+                * }
+                */
        }
 }
 ?>
index 4ee82e8..b2b7646 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- *     {$preforward_path}.php
+ *     {$view_path}.php
  *
  *     @package        {$project_id}
  *
@@ -14,7 +14,7 @@
  *     @access         public
  *     @package        {$project_id}
  */
-class {$project_id}_View_{$preforward_name} extends Ethna_ViewClass
+class {$project_id}_View_{$view_name} extends Ethna_ViewClass
 {
        /**
         *      Á«°ÜÁ°½èÍý