diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index d9d04c975..5392367f0 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -90,7 +90,7 @@ $oModuleModel = &getModel('module'); // 해당 모듈의 conf/action.xml 을 분석하여 action 정보를 얻어옴 - $xml_info = $oModuleModel->getModuleXmlInfo($this->module); + $xml_info = $oModuleModel->getModuleActionXml($this->module); // 현재 요청된 act가 있으면 $xml_info에서 type을 찾음, 없다면 기본 action을 이용 if(!$this->act || !$xml_info->action->{$this->act}) $this->act = $xml_info->default_index_act; diff --git a/modules/admin/admin.model.php b/modules/admin/admin.model.php index 3bd9ed24d..0aa352ef6 100644 --- a/modules/admin/admin.model.php +++ b/modules/admin/admin.model.php @@ -27,9 +27,10 @@ $downloaded_list = FileHandler::readDir('./files/modules'); $installed_list = FileHandler::readDir('./modules'); $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;$iloadModuleXml($path); + $info = $oModuleModel->getModuleInfoXml($module_name); unset($obj); $info->module = $module_name; $info->created_table_count = $created_table_count; $info->table_count = $table_count; $info->path = $path; + $info->admin_index_act = $info->admin_index_act; $list[] = $info; } diff --git a/modules/admin/tpl/module_list.html b/modules/admin/tpl/module_list.html index a98762cc0..7c7aff736 100644 --- a/modules/admin/tpl/module_list.html +++ b/modules/admin/tpl/module_list.html @@ -3,20 +3,28 @@ {$lang->module_name} {$lang->module_version} {$lang->module_author} + {$lang->module_date} {$lang->module_table_count} {$lang->module_installed_path} - {$val->title}
({$val->module}) + + + {$val->title}
({$val->module}) + + {$val->title}
+ ({$val->module}) + + {$val->version} {$val->author->name} + {$val->author->date} {$val->created_table_count}/{$val->table_count} {$val->path} - - {$val->author->date} + {nl2br($val->author->description)} diff --git a/modules/module/module.model.php b/modules/module/module.model.php index 2e025348d..7447d1996 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -13,106 +13,6 @@ 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)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('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로 모듈의 정보르 구함 @@ -281,10 +181,114 @@ 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)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('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 을 읽어서 정보를 구함 **/ - function loadModuleXml($module_path) { + function getModuleInfoXml($module) { + // 요청된 모듈의 경로를 구한다. 없으면 return + $module_path = ModuleHandler::getModulePath($module); + if(!$module_path) return; + // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 $xml_file = sprintf("%s/conf/info.xml", $module_path); if(!file_exists($xml_file)) return; @@ -319,6 +323,10 @@ $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; }