mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@162 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c054d03df0
commit
ad4cfd30f4
4 changed files with 126 additions and 108 deletions
|
|
@ -90,7 +90,7 @@
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
// 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴
|
// 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴
|
||||||
$xml_info = $oModuleModel->getModuleXmlInfo($this->module);
|
$xml_info = $oModuleModel->getModuleActionXml($this->module);
|
||||||
|
|
||||||
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용
|
// 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용
|
||||||
if(!$this->act || !$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act;
|
if(!$this->act || !$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act;
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,10 @@
|
||||||
$downloaded_list = FileHandler::readDir('./files/modules');
|
$downloaded_list = FileHandler::readDir('./files/modules');
|
||||||
$installed_list = FileHandler::readDir('./modules');
|
$installed_list = FileHandler::readDir('./modules');
|
||||||
$searched_list = array_merge($downloaded_list, $installed_list);
|
$searched_list = array_merge($downloaded_list, $installed_list);
|
||||||
if(!count($searched_list)) return;
|
$searched_count = count($searched_list);
|
||||||
|
if(!$searched_count) return;
|
||||||
|
|
||||||
for($i=0;$i<count($searched_list);$i++) {
|
for($i=0;$i<$searched_count;$i++) {
|
||||||
// 모듈의 이름
|
// 모듈의 이름
|
||||||
$module_name = $searched_list[$i];
|
$module_name = $searched_list[$i];
|
||||||
|
|
||||||
|
|
@ -48,13 +49,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// 해당 모듈의 정보를 구함
|
// 해당 모듈의 정보를 구함
|
||||||
$info = $oModuleModel->loadModuleXml($path);
|
$info = $oModuleModel->getModuleInfoXml($module_name);
|
||||||
unset($obj);
|
unset($obj);
|
||||||
|
|
||||||
$info->module = $module_name;
|
$info->module = $module_name;
|
||||||
$info->created_table_count = $created_table_count;
|
$info->created_table_count = $created_table_count;
|
||||||
$info->table_count = $table_count;
|
$info->table_count = $table_count;
|
||||||
$info->path = $path;
|
$info->path = $path;
|
||||||
|
$info->admin_index_act = $info->admin_index_act;
|
||||||
|
|
||||||
$list[] = $info;
|
$list[] = $info;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,20 +3,28 @@
|
||||||
<td>{$lang->module_name}</td>
|
<td>{$lang->module_name}</td>
|
||||||
<td>{$lang->module_version}</td>
|
<td>{$lang->module_version}</td>
|
||||||
<td>{$lang->module_author}</td>
|
<td>{$lang->module_author}</td>
|
||||||
|
<td>{$lang->module_date}</td>
|
||||||
<td>{$lang->module_table_count}</td>
|
<td>{$lang->module_table_count}</td>
|
||||||
<td>{$lang->module_installed_path}</td>
|
<td>{$lang->module_installed_path}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!--@foreach($module_list as $key => $val)-->
|
<!--@foreach($module_list as $key => $val)-->
|
||||||
<tr>
|
<tr>
|
||||||
<td rowspan="2"><a href="#" onclick="location.href='{getUrl('mo',$val->module)}'">{$val->title}</a> <br /> ({$val->module})</td>
|
<td rowspan="2">
|
||||||
|
<!--@if($val->admin_index_act)-->
|
||||||
|
<a href="#" onclick="location.href='{getUrl('mo',$val->module,'ac',$val->admin_index_act)}'">{$val->title}</a> <br /> ({$val->module})
|
||||||
|
<!--@else-->
|
||||||
|
{$val->title} <br />
|
||||||
|
({$val->module})
|
||||||
|
<!--@end-->
|
||||||
|
</td>
|
||||||
<td>{$val->version}</td>
|
<td>{$val->version}</td>
|
||||||
<td><a href="#" onclick="window.open('{$val->author->homepage}')">{$val->author->name}</a></td>
|
<td><a href="#" onclick="window.open('{$val->author->homepage}')">{$val->author->name}</a></td>
|
||||||
|
<td>{$val->author->date}</td>
|
||||||
<td>{$val->created_table_count}/{$val->table_count}</td>
|
<td>{$val->created_table_count}/{$val->table_count}</td>
|
||||||
<td>{$val->path}</td>
|
<td>{$val->path}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">
|
<td colspan="5">
|
||||||
{$val->author->date}
|
|
||||||
{nl2br($val->author->description)}
|
{nl2br($val->author->description)}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
||||||
|
|
@ -13,106 +13,6 @@
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief module의 conf/module.xml 을 통해 grant(권한) 및 action 데이터를 return
|
|
||||||
*
|
|
||||||
* module.xml 파일의 경우 파싱하는데 시간이 걸리기에 캐싱을 한다...
|
|
||||||
* 캐싱을 할때 바로 include 할 수 있도록 역시 코드까지 추가하여 캐싱을 한다.
|
|
||||||
* 이게 퍼포먼스 상으로는 좋은데 어떤 부정적인 결과를 유도할지는 잘 모르겠...
|
|
||||||
**/
|
|
||||||
function getModuleXmlInfo($module) {
|
|
||||||
// 요청된 모듈의 경로를 구한다. 없으면 return
|
|
||||||
$class_path = ModuleHandler::getModulePath($module);
|
|
||||||
if(!$class_path) return;
|
|
||||||
|
|
||||||
// 해당 경로에 module.xml 파일이 있는지 체크한다. 없으면 return
|
|
||||||
$xml_file = sprintf("%sconf/module.xml", $class_path);
|
|
||||||
if(!file_exists($xml_file)) return;
|
|
||||||
|
|
||||||
// 캐시된 파일이 있는지 확인
|
|
||||||
$cache_file = sprintf("./files/cache/module_info/%s.php", $module);
|
|
||||||
|
|
||||||
// 캐시 파일이 없거나 캐시 파일이 xml 파일보다 오래되었으면 내용 다시 갱신
|
|
||||||
if(!file_exists($cache_file) || filectime($cache_file)<filectime($xml_file)) {
|
|
||||||
|
|
||||||
$buff = ""; ///< 캐시 파일에 쓸 buff 변수 설정
|
|
||||||
|
|
||||||
$xml_obj = XmlParser::loadXmlFile($xml_file); ///< xml 파일을 읽어서 xml object로 변환
|
|
||||||
|
|
||||||
if(!count($xml_obj->module)) return; ///< xml 내용중에 module 태그가 없다면 오류;;
|
|
||||||
|
|
||||||
$grants = $xml_obj->module->grants->grant; ///< 권한 정보 (없는 경우도 있음)
|
|
||||||
$actions = $xml_obj->module->actions->action; ///< action list (필수)
|
|
||||||
|
|
||||||
$default_index = $admin_index = '';
|
|
||||||
|
|
||||||
// 권한 정보의 정리
|
|
||||||
if($grants) {
|
|
||||||
if(is_array($grants)) $grant_list = $grants;
|
|
||||||
else $grant_list[] = $grants;
|
|
||||||
|
|
||||||
foreach($grant_list as $grant) {
|
|
||||||
$name = $grant->attrs->name;
|
|
||||||
$default = $grant->attrs->default?$grant->attrs->default:'guest';
|
|
||||||
$title = $grant->title->body;
|
|
||||||
|
|
||||||
$info->grant->{$name}->title = $title;
|
|
||||||
$info->grant->{$name}->default = $default;
|
|
||||||
|
|
||||||
$buff .= sprintf('$info->grant->%s->title=\'%s\';', $name, $title);
|
|
||||||
$buff .= sprintf('$info->grant->%s->default=\'%s\';', $name, $default);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// actions 정리
|
|
||||||
if($actions) {
|
|
||||||
if(is_array($actions)) $action_list = $actions;
|
|
||||||
else $action_list[] = $actions;
|
|
||||||
|
|
||||||
foreach($action_list as $action) {
|
|
||||||
$name = $action->attrs->name;
|
|
||||||
|
|
||||||
$type = $action->attrs->type;
|
|
||||||
$grant = $action->attrs->grant?$action->attrs->grant:'guest';
|
|
||||||
$standalone = $action->attrs->standalone=='true'?'true':'false';
|
|
||||||
|
|
||||||
$index = $action->attrs->index;
|
|
||||||
$admin_index = $action->attrs->admin_index;
|
|
||||||
|
|
||||||
$output->action->{$name}->type = $type;
|
|
||||||
$output->action->{$name}->grant = $grant;
|
|
||||||
$output->action->{$name}->standalone= $standalone;
|
|
||||||
|
|
||||||
$info->action->{$name}->type = $type;
|
|
||||||
$info->action->{$name}->grant = $grant;
|
|
||||||
$info->action->{$name}->standalone = $standalone=='true'?true:false;
|
|
||||||
|
|
||||||
$buff .= sprintf('$info->action->%s->type=\'%s\';', $name, $type);
|
|
||||||
$buff .= sprintf('$info->action->%s->grant=\'%s\';', $name, $grant);
|
|
||||||
$buff .= sprintf('$info->action->%s->standalone=%s;', $name, $standalone);
|
|
||||||
|
|
||||||
if($index=='true') {
|
|
||||||
$default_index_act = $name;
|
|
||||||
$info->default_index_act = $name;
|
|
||||||
}
|
|
||||||
if($admin_index=='true') {
|
|
||||||
$admin_index_act = $name;
|
|
||||||
$info->admin_index_act = $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$buff = sprintf('<?php if(!__ZB5__) exit();$info->default_index_act = \'%s\';$info->admin_index_act = \'%s\';%s?>', $default_index_act, $admin_index_act, $buff);
|
|
||||||
|
|
||||||
FileHandler::writeFile($cache_file, $buff);
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
include $cache_file;
|
|
||||||
|
|
||||||
return $info;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief document_srl로 모듈의 정보르 구함
|
* @brief document_srl로 모듈의 정보르 구함
|
||||||
|
|
@ -281,10 +181,114 @@
|
||||||
return $skin_info;
|
return $skin_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief module의 conf/module.xml 을 통해 grant(권한) 및 action 데이터를 return
|
||||||
|
*
|
||||||
|
* module.xml 파일의 경우 파싱하는데 시간이 걸리기에 캐싱을 한다...
|
||||||
|
* 캐싱을 할때 바로 include 할 수 있도록 역시 코드까지 추가하여 캐싱을 한다.
|
||||||
|
* 이게 퍼포먼스 상으로는 좋은데 어떤 부정적인 결과를 유도할지는 잘 모르겠...
|
||||||
|
**/
|
||||||
|
function getModuleActionXml($module) {
|
||||||
|
// 요청된 모듈의 경로를 구한다. 없으면 return
|
||||||
|
$class_path = ModuleHandler::getModulePath($module);
|
||||||
|
if(!$class_path) return;
|
||||||
|
|
||||||
|
// 해당 경로에 module.xml 파일이 있는지 체크한다. 없으면 return
|
||||||
|
$xml_file = sprintf("%sconf/module.xml", $class_path);
|
||||||
|
if(!file_exists($xml_file)) return;
|
||||||
|
|
||||||
|
// 캐시된 파일이 있는지 확인
|
||||||
|
$cache_file = sprintf("./files/cache/module_info/%s.php", $module);
|
||||||
|
|
||||||
|
// 캐시 파일이 없거나 캐시 파일이 xml 파일보다 오래되었으면 내용 다시 갱신
|
||||||
|
if(!file_exists($cache_file) || filectime($cache_file)<filectime($xml_file)) {
|
||||||
|
|
||||||
|
$buff = ""; ///< 캐시 파일에 쓸 buff 변수 설정
|
||||||
|
|
||||||
|
$xml_obj = XmlParser::loadXmlFile($xml_file); ///< xml 파일을 읽어서 xml object로 변환
|
||||||
|
|
||||||
|
if(!count($xml_obj->module)) return; ///< xml 내용중에 module 태그가 없다면 오류;;
|
||||||
|
|
||||||
|
$grants = $xml_obj->module->grants->grant; ///< 권한 정보 (없는 경우도 있음)
|
||||||
|
$actions = $xml_obj->module->actions->action; ///< action list (필수)
|
||||||
|
|
||||||
|
$default_index = $admin_index = '';
|
||||||
|
|
||||||
|
// 권한 정보의 정리
|
||||||
|
if($grants) {
|
||||||
|
if(is_array($grants)) $grant_list = $grants;
|
||||||
|
else $grant_list[] = $grants;
|
||||||
|
|
||||||
|
foreach($grant_list as $grant) {
|
||||||
|
$name = $grant->attrs->name;
|
||||||
|
$default = $grant->attrs->default?$grant->attrs->default:'guest';
|
||||||
|
$title = $grant->title->body;
|
||||||
|
|
||||||
|
$info->grant->{$name}->title = $title;
|
||||||
|
$info->grant->{$name}->default = $default;
|
||||||
|
|
||||||
|
$buff .= sprintf('$info->grant->%s->title=\'%s\';', $name, $title);
|
||||||
|
$buff .= sprintf('$info->grant->%s->default=\'%s\';', $name, $default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// actions 정리
|
||||||
|
if($actions) {
|
||||||
|
if(is_array($actions)) $action_list = $actions;
|
||||||
|
else $action_list[] = $actions;
|
||||||
|
|
||||||
|
foreach($action_list as $action) {
|
||||||
|
$name = $action->attrs->name;
|
||||||
|
|
||||||
|
$type = $action->attrs->type;
|
||||||
|
$grant = $action->attrs->grant?$action->attrs->grant:'guest';
|
||||||
|
$standalone = $action->attrs->standalone=='true'?'true':'false';
|
||||||
|
|
||||||
|
$index = $action->attrs->index;
|
||||||
|
$admin_index = $action->attrs->admin_index;
|
||||||
|
|
||||||
|
$output->action->{$name}->type = $type;
|
||||||
|
$output->action->{$name}->grant = $grant;
|
||||||
|
$output->action->{$name}->standalone= $standalone;
|
||||||
|
|
||||||
|
$info->action->{$name}->type = $type;
|
||||||
|
$info->action->{$name}->grant = $grant;
|
||||||
|
$info->action->{$name}->standalone = $standalone=='true'?true:false;
|
||||||
|
|
||||||
|
$buff .= sprintf('$info->action->%s->type=\'%s\';', $name, $type);
|
||||||
|
$buff .= sprintf('$info->action->%s->grant=\'%s\';', $name, $grant);
|
||||||
|
$buff .= sprintf('$info->action->%s->standalone=%s;', $name, $standalone);
|
||||||
|
|
||||||
|
if($index=='true') {
|
||||||
|
$default_index_act = $name;
|
||||||
|
$info->default_index_act = $name;
|
||||||
|
}
|
||||||
|
if($admin_index=='true') {
|
||||||
|
$admin_index_act = $name;
|
||||||
|
$info->admin_index_act = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$buff = sprintf('<?php if(!__ZB5__) exit();$info->default_index_act = \'%s\';$info->admin_index_act = \'%s\';%s?>', $default_index_act, $admin_index_act, $buff);
|
||||||
|
|
||||||
|
FileHandler::writeFile($cache_file, $buff);
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
include $cache_file;
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
|
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
|
||||||
**/
|
**/
|
||||||
function loadModuleXml($module_path) {
|
function getModuleInfoXml($module) {
|
||||||
|
// 요청된 모듈의 경로를 구한다. 없으면 return
|
||||||
|
$module_path = ModuleHandler::getModulePath($module);
|
||||||
|
if(!$module_path) return;
|
||||||
|
|
||||||
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
|
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
|
||||||
$xml_file = sprintf("%s/conf/info.xml", $module_path);
|
$xml_file = sprintf("%s/conf/info.xml", $module_path);
|
||||||
if(!file_exists($xml_file)) return;
|
if(!file_exists($xml_file)) return;
|
||||||
|
|
@ -319,6 +323,10 @@
|
||||||
$module_info->history[] = $obj;
|
$module_info->history[] = $obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// action 정보를 얻어서 admin_index를 추가
|
||||||
|
$action_info = $this->getModuleActionXml($module);
|
||||||
|
$module_info->admin_index_act = $action_info->admin_index_act;
|
||||||
|
|
||||||
return $module_info;
|
return $module_info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue