Minahito
minah****@users*****
2005年 11月 25日 (金) 00:19:50 JST
Index: xoops2jp/html/modules/comment/class/CommentActionFrame.class.php diff -u xoops2jp/html/modules/comment/class/CommentActionFrame.class.php:1.1.2.1 xoops2jp/html/modules/comment/class/CommentActionFrame.class.php:1.1.2.2 --- xoops2jp/html/modules/comment/class/CommentActionFrame.class.php:1.1.2.1 Thu Nov 24 01:29:30 2005 +++ xoops2jp/html/modules/comment/class/CommentActionFrame.class.php Fri Nov 25 00:19:50 2005 @@ -1,173 +1,173 @@ -<?php -// $Id$ -// ------------------------------------------------------------------------ // -// XOOPS - PHP Content Management System // -// Copyright (c) 2005 XOOPS Cube.org // -// <http://www.xoopscube.org/> // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// You may not change or alter any portion of this comment or credits // -// of supporting developers from this source code or any supporting // -// source code which is considered copyrighted (c) material of the // -// original comment or credit authors. // -// // -// This program is distributed in the hope that it will be useful, // -// but WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // - -require_once XOOPS_ROOT_PATH."/class/XCube_ActionStrategy.class.php"; - -define ("COMMENT_FRAME_PERFORM_SUCCESS",1); -define ("COMMENT_FRAME_PERFORM_FAIL",2); -define ("COMMENT_FRAME_INIT_SUCCESS",3); - -define ("COMMENT_FRAME_VIEW_NONE",1); -define ("COMMENT_FRAME_VIEW_SUCCESS",1); -define ("COMMENT_FRAME_VIEW_ERROR",2); -define ("COMMENT_FRAME_VIEW_INDEX",3); -define ("COMMENT_FRAME_VIEW_INPUT",4); - -/** - * This is simple frame work for misc page controller. - * @package user - */ -class CommentActionFrame extends XCube_ActionStrategy -{ - var $mActionName=""; - var $mAction; - - var $mAdminFlag=false; - - function CommentActionFrame($admin=false) - { - $this->mAdminFlag=$admin; - } - - function setActionName($name) - { - $this->mActionName=$name; - } - - function execute(&$controller) - { - if(!preg_match("/^\w+$/",$this->mActionName)) - die(); - - // - // Create action object by mActionName - // - $className="Comment".ucfirst($this->mActionName)."Action"; - $fileName=null; - if($this->mAdminFlag) { - $fileName=XOOPS_MODULE_PATH."/comment/admin/actions/${className}.class.php"; - } - else { - $fileName=XOOPS_MODULE_PATH."/comment/actions/${className}.class.php"; - } - if(!file_exists($fileName)) - die(); // TODO - - require_once $fileName; - if(class_exists($className)) - $this->mAction=new $className(); - - if(!is_object($this->mAction)) - die(); // TODO - - $this->mAction->prepare($controller,$controller->getXoopsUser()); - - if(xoops_getenv("REQUEST_METHOD")=="POST") { - $viewStatus=$this->mAction->execute($controller,$controller->getXoopsUser()); - } - else { - $viewStatus=$this->mAction->getDefaultView($controller,$controller->getXoopsUser()); - } - - switch($viewStatus) { - case COMMENT_FRAME_VIEW_SUCCESS: - $this->mAction->executeViewSuccess($controller,$controller->getXoopsUser(),$controller->mRenderSystem); - break; - - case COMMENT_FRAME_VIEW_ERROR: - $this->mAction->executeViewError($controller,$controller->getXoopsUser(),$controller->mRenderSystem); - break; - - case COMMENT_FRAME_VIEW_INDEX: - $this->mAction->executeViewIndex($controller,$controller->getXoopsUser(),$controller->mRenderSystem); - break; - - case COMMENT_FRAME_VIEW_INPUT: - $this->mAction->executeViewInput($controller,$controller->getXoopsUser(),$controller->mRenderSystem); - break; - } - } -} - -class CommentAction -{ - var $mClient; - - function CommentAction() - { - } - - function prepare(&$controller,&$xoopsUser) - { - $controller->mRoot->mLanguageManager->loadModuleLanguage("comment"); - $this->_processService($controller); - } - - /** - * @param $controller Base_Controller - * @param $xoopsUser XoopsUserObject - */ - function getDefaultView(&$controller,&$xoopsUser) - { - return COMMENT_FRAME_VIEW_NONE; - } - - function execute() - { - return COMMENT_FRAME_VIEW_NONE; - } - - function _processService($controller) - { - $service=&$controller->mRoot->mServiceManager->searchXCubeService('Comment'); - if($service==null) { - die(); // FIXME - } - - $this->mClient=new XCube_ServiceClient($service); - $parameters=array('rule'=>$controller->mModuleController->getConfig('com_rule')); - $result=&$this->mClient->call("setConfig",$parameters); - } - - function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) - { - } - - function executeViewError(&$controller,&$xoopsUser,&$renderSystem) - { - } - - function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) - { - } - - function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) - { - } -} - +<?php +// $Id$ +// ------------------------------------------------------------------------ // +// XOOPS - PHP Content Management System // +// Copyright (c) 2005 XOOPS Cube.org // +// <http://www.xoopscube.org/> // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// You may not change or alter any portion of this comment or credits // +// of supporting developers from this source code or any supporting // +// source code which is considered copyrighted (c) material of the // +// original comment or credit authors. // +// // +// This program is distributed in the hope that it will be useful, // +// but WITHOUT ANY WARRANTY; without even the implied warranty of // +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // + +require_once XOOPS_ROOT_PATH."/class/XCube_ActionStrategy.class.php"; + +define ("COMMENT_FRAME_PERFORM_SUCCESS",1); +define ("COMMENT_FRAME_PERFORM_FAIL",2); +define ("COMMENT_FRAME_INIT_SUCCESS",3); + +define ("COMMENT_FRAME_VIEW_NONE",1); +define ("COMMENT_FRAME_VIEW_SUCCESS",1); +define ("COMMENT_FRAME_VIEW_ERROR",2); +define ("COMMENT_FRAME_VIEW_INDEX",3); +define ("COMMENT_FRAME_VIEW_INPUT",4); + +/** + * This is simple frame work for misc page controller. + * @package user + */ +class CommentActionFrame extends XCube_ActionStrategy +{ + var $mActionName=""; + var $mAction; + + var $mAdminFlag=false; + + function CommentActionFrame($admin=false) + { + $this->mAdminFlag=$admin; + } + + function setActionName($name) + { + $this->mActionName=$name; + } + + function execute(&$controller) + { + if(!preg_match("/^\w+$/",$this->mActionName)) + die(); + + // + // Create action object by mActionName + // + $className="Comment".ucfirst($this->mActionName)."Action"; + $fileName=null; + if($this->mAdminFlag) { + $fileName=XOOPS_MODULE_PATH."/comment/admin/actions/${className}.class.php"; + } + else { + $fileName=XOOPS_MODULE_PATH."/comment/actions/${className}.class.php"; + } + if(!file_exists($fileName)) + die(); // TODO + + require_once $fileName; + if(class_exists($className)) + $this->mAction=new $className(); + + if(!is_object($this->mAction)) + die(); // TODO + + $this->mAction->prepare($controller,$controller->getXoopsUser()); + + if(xoops_getenv("REQUEST_METHOD")=="POST") { + $viewStatus=$this->mAction->execute($controller,$controller->getXoopsUser()); + } + else { + $viewStatus=$this->mAction->getDefaultView($controller,$controller->getXoopsUser()); + } + + switch($viewStatus) { + case COMMENT_FRAME_VIEW_SUCCESS: + $this->mAction->executeViewSuccess($controller,$controller->getXoopsUser(),$controller->mRenderSystem); + break; + + case COMMENT_FRAME_VIEW_ERROR: + $this->mAction->executeViewError($controller,$controller->getXoopsUser(),$controller->mRenderSystem); + break; + + case COMMENT_FRAME_VIEW_INDEX: + $this->mAction->executeViewIndex($controller,$controller->getXoopsUser(),$controller->mRenderSystem); + break; + + case COMMENT_FRAME_VIEW_INPUT: + $this->mAction->executeViewInput($controller,$controller->getXoopsUser(),$controller->mRenderSystem); + break; + } + } +} + +class CommentAction +{ + var $mClient; + + function CommentAction() + { + } + + function prepare(&$controller,&$xoopsUser) + { + $controller->mRoot->mLanguageManager->loadModuleLanguage("comment"); + $this->_processService($controller); + } + + /** + * @param $controller Base_Controller + * @param $xoopsUser XoopsUserObject + */ + function getDefaultView(&$controller,&$xoopsUser) + { + return COMMENT_FRAME_VIEW_NONE; + } + + function execute() + { + return COMMENT_FRAME_VIEW_NONE; + } + + function _processService($controller) + { + $service=&$controller->mRoot->mServiceManager->searchXCubeService('Comment'); + if($service==null) { + die(); // FIXME + } + + $this->mClient=new XCube_ServiceClient($service); + $parameters=array('rule'=>$controller->mModuleController->getConfig('com_rule')); + $result=&$this->mClient->call("setConfig",$parameters); + } + + function executeViewSuccess(&$controller,&$xoopsUser,&$renderSystem) + { + } + + function executeViewError(&$controller,&$xoopsUser,&$renderSystem) + { + } + + function executeViewIndex(&$controller,&$xoopsUser,&$renderSystem) + { + } + + function executeViewInput(&$controller,&$xoopsUser,&$renderSystem) + { + } +} + ?> \ No newline at end of file