mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@145 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
853c469c67
commit
99c88fee14
12 changed files with 60 additions and 16 deletions
|
|
@ -68,6 +68,13 @@
|
|||
// 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴
|
||||
$xml_info = $oModuleModel->getModuleXmlInfo($module);
|
||||
|
||||
// module_info가 없고(mid가 없다는 의미) standalone이 false이면 오류 표시
|
||||
if(!$module_info&&!$xml_info->standalone) {
|
||||
$module = 'message';
|
||||
Context::set('message', Context::getLang('msg_invalid_request_module'));
|
||||
$xml_info = $oModuleModel->getModuleXmlInfo($module);
|
||||
}
|
||||
|
||||
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용
|
||||
if(!$act || !$xml_info->action->{$act}) $act = $xml_info->default_action;
|
||||
|
||||
|
|
@ -83,14 +90,15 @@
|
|||
// 모듈 객체 생성
|
||||
$oModule = &$this->getModuleInstance($module, $type);
|
||||
|
||||
// 모듈에 act값을 세팅
|
||||
$oModule->setAct($act);
|
||||
|
||||
// 모듈 정보 세팅
|
||||
$oModule->setModuleInfo($module_info, $xml_info);
|
||||
|
||||
if(!is_object($oModule)) return;
|
||||
|
||||
$act = Context::get('act');
|
||||
$oModule->proc($act);
|
||||
$oModule->proc();
|
||||
|
||||
$this->oModule = $oModule;
|
||||
}
|
||||
|
|
@ -160,6 +168,7 @@
|
|||
|
||||
// 생성된 객체에 자신이 호출된 위치를 세팅해줌
|
||||
$oModule->setModulePath($class_path);
|
||||
$oModule->init();
|
||||
|
||||
// GLOBALS 변수에 생성된 객체 저장
|
||||
$GLOBALS['_loaded_module'][$module][$type] = $oModule;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@
|
|||
* @class ModuleObject
|
||||
* @author zero (zero@nzeo.com)
|
||||
* @brief module의 abstract class
|
||||
*
|
||||
* @todo 모듈에서 mid가 꼭 필요한지를 체크하는 단계가 필요 (admin은 mid불필요, board는 필요.., 미설정시 필요함으로.. 기본)
|
||||
*
|
||||
**/
|
||||
|
||||
class ModuleObject extends Object {
|
||||
|
|
@ -25,6 +22,8 @@
|
|||
var $layout_path = './common/tpl/'; ///< 레이아웃 경로
|
||||
var $layout_file = 'default_layout.html'; ///< 레이아웃 파일
|
||||
|
||||
var $stop_proc = false; ///< action 수행중 dispMessage를 호출하면 ModuleObject::proc()를 수행하지 않음
|
||||
|
||||
/**
|
||||
* @brief 현재 모듈의 path를 지정
|
||||
**/
|
||||
|
|
@ -42,6 +41,13 @@
|
|||
$this->add('redirect_url', $url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief act값 지정
|
||||
**/
|
||||
function setAct($act) {
|
||||
$this->act = $act;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 모듈의 정보 세팅
|
||||
**/
|
||||
|
|
@ -110,6 +116,26 @@
|
|||
$this->init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 메세지 출력
|
||||
**/
|
||||
function dispMessage($msg_code) {
|
||||
// proc 수행을 중지 시키기 위한 플래그 세팅
|
||||
$this->stop_proc = true;
|
||||
|
||||
// RequestMethod가 XMLRPC일 경우를 대비
|
||||
if(Context::getRequestMethod()=='XMLRPC') {
|
||||
$this->setError(-1);
|
||||
$this->setMessage($msg_code);
|
||||
} else {
|
||||
Context::set('message', Context::getLang($msg_code));
|
||||
$oMessageView = &getView('message');
|
||||
$oMessageView->dispMessage();
|
||||
$this->setTemplatePath($oMessageView->getTemplatePath());
|
||||
$this->setTemplateFile($oMessageView->getTemplateFile());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief template 파일 지정
|
||||
**/
|
||||
|
|
@ -129,8 +155,8 @@
|
|||
* @brief template 경로 지정
|
||||
**/
|
||||
function setTemplatePath($path) {
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
if(substr($path,0,2)!='./') $path = './'.$path;
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
$this->template_path = $path;
|
||||
}
|
||||
|
||||
|
|
@ -178,13 +204,15 @@
|
|||
*
|
||||
* $act값에 의해서 $action_list에 선언된 것들을 실행한다
|
||||
**/
|
||||
function proc($act) {
|
||||
function proc() {
|
||||
// stop_proc==true이면 그냥 패스
|
||||
if($this->stop_proc==true) return;
|
||||
|
||||
// 기본 act조차 없으면 return
|
||||
if(!method_exists($this, $act)) return false;
|
||||
if(!method_exists($this, $this->act)) return;
|
||||
|
||||
// act값으로 method 실행
|
||||
$output = call_user_method($act, $this);
|
||||
// this->act값으로 method 실행
|
||||
$output = call_user_method($this->act, $this);
|
||||
|
||||
if(is_a($output, 'Object') || is_subclass_of($output, 'Object')) {
|
||||
$this->setError($output->getError());
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@
|
|||
$lang->msg_call_server = '서버에 요청중입니다. 잠시만 기다려주세요.';
|
||||
$lang->msg_db_not_setted = 'DB설정이 되어 있지 않습니다';
|
||||
$lang->msg_mid_not_exists = '설정이 되어 있지 않습니다. 관리자 페이지에서 기본 설정을 해주시기 바랍니다.';
|
||||
$lang->msg_invalid_request_module = '잘못된 모듈 요청입니다';
|
||||
$lang->msg_invalid_queryid = 'Query ID값이 잘못 지정되었습니다';
|
||||
$lang->msg_not_permitted = '권한이 없습니다';
|
||||
$lang->msg_input_password = '비밀번호를 입력하여 주세요';
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispAdminIndex" management_action="">
|
||||
<module standalone="true" default_action="dispAdminIndex" management_action="">
|
||||
<actions>
|
||||
<action name="dispAdminIndex" type="view" grant="root" />
|
||||
<action name="dispLogin" type="view" grant="guest" />
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" management_action="dispAdminContent">
|
||||
<module standalone="false" default_action="dispContent" management_action="dispAdminContent">
|
||||
<grants>
|
||||
<grant name="list" default="guest">
|
||||
<title xml:lang="ko">목록</title>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispIntroduce">
|
||||
<module standalone="true" default_action="dispIntroduce">
|
||||
<grants />
|
||||
<actions>
|
||||
<action name="dispIntroduce" type="view" grant="guest" />
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@
|
|||
* @brief 초기화
|
||||
**/
|
||||
function init() {
|
||||
// 설치가 되어 있으면 오류
|
||||
if(Context::isInstalled()) return $this->dispMessage('msg_already_installed');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@
|
|||
// template 경로를 지정
|
||||
$this->setTemplatePath($this->module_path."tpl");
|
||||
|
||||
// 설치가 되어 있으면 오류
|
||||
if(Context::isInstalled()) return $this->dispMessage('msg_already_installed');
|
||||
|
||||
// 컨트롤러 생성
|
||||
$oController = &getController('install');
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module version="0.1" default_action="viewIntroduce" management_action="" >
|
||||
<module standalone="false" version="0.1" default_action="viewIntroduce" management_action="" >
|
||||
<actions>
|
||||
<action name="viewIntroduce" type="view" />
|
||||
<action name="viewDBInfoForm" type="view" />
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
* @brief 초기화
|
||||
**/
|
||||
function init() {
|
||||
$this->setTemplatePath(
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module default_action="dispContent" management_action="">
|
||||
<module standalone="false" default_action="dispContent" management_action="">
|
||||
<actions>
|
||||
<action name="dispContent" type="view" grant="root" />
|
||||
</actions>
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
$xml_obj = XmlParser::loadXmlFile($xml_file);
|
||||
if(!count($xml_obj->module)) return;
|
||||
|
||||
$output->standalone = $xml_obj->module->attrs->standalone=='true'?true:false; ///< 모듈 자체적으로 실행이 가능한지에 대한 값 (기본=false)
|
||||
$output->default_action = $xml_obj->module->attrs->default_action; ///< 별도의 action이 지정되지 않으면 호출될 action
|
||||
$output->management_action = $xml_obj->module->attrs->management_action; ///< 관리자용으로 사용될 기본 action
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue