From 55b5b91d635b480fe33caa61fce309d0b4e436d8 Mon Sep 17 00:00:00 2001 From: zero Date: Thu, 15 Feb 2007 06:11:46 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@43 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/module/ModuleHandler.class.php | 39 ++++++++++++++++++-------- modules/install/conf/action.xml | 8 +++--- 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 3598837af..f3f8ebfb6 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -54,8 +54,18 @@ Context::set('message', Context::getLang('msg_mid_not_exists')); } - // 해당 모듈의 conf/action.xml 을 분석하여 act 값을 체크 - $type = $this->getActionType($module, $act); + // 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴 + $action_info = $this->getActionInfo($module); + + // 현재 요청된 act가 있으면 $action_info에서 type을 찾음, 없다면 기본 action을 이용 + if(!$act || !$action_info->{$act}) $act = $action_info->default_action; + + // type, grant 값 구함 + $type = $action_info->{$act}->type; + $grant = $action_info->{$act}->grant; + + // act값을 Context에 세팅 + Context::set('act', $act, true); // 모듈 객체 생성 $oModule = &$this->getModuleInstance($module, $type, $module_info); @@ -127,26 +137,31 @@ /** * @brief module의 conf/action.xml 을 통해 act값에 해당하는 action type을 return **/ - function getActionType($module, &$act) { + function getActionInfo($module) { $class_path = $this->getModulePath($module); if(!$class_path) return; $action_xml_file = sprintf("%sconf/action.xml", $class_path); if(!file_exists($action_xml_file)) return; - $oXml = XmlParser::loadXmlFile($action_xml_file); + $xml_obj = XmlParser::loadXmlFile($action_xml_file); + if(!count($xml_obj->module)) return; - if(!count($oXml->module->action)) return; + $output->default_action = $xml_obj->module->attrs->default_action; + $output->manage_action = $xml_obj->module->attrs->manage_action; - foreach($oXml->module->action as $action) { - if($action->attrs->default) $default_act = $action; - if($action->attrs->name == $act) return $action->attrs->type; + if(is_array($xml_obj->module->action)) $action_list = $xml_obj->module->action; + else $action_list[] = $xml_obj->module->action; + + foreach($action_list as $action) { + $name = $action->attrs->name; + $type = $action->attrs->type; + $grant = $action->attrs->grant; + $output->{$name}->type = $type; + $output->{$name}->grant = $grant; } - if($default_act) { - $act = $default_act->attrs->name; - return $default_act->attrs->type; - } + return $output; } /** diff --git a/modules/install/conf/action.xml b/modules/install/conf/action.xml index d11593cee..0ad99172a 100644 --- a/modules/install/conf/action.xml +++ b/modules/install/conf/action.xml @@ -1,6 +1,6 @@ - - - - + + + +