From d60057da3759ed2a38806c5811dd5cf0140e42f7 Mon Sep 17 00:00:00 2001 From: zero Date: Tue, 6 Mar 2007 04:17:57 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@284 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- layouts/sample_layout/conf/info.xml | 4 +- modules/admin/admin.view.php | 11 ++ modules/admin/conf/module.xml | 1 + modules/layout/addon.class.php | 13 -- modules/layout/addon.controller.php | 74 --------- modules/layout/addon.model.php | 145 ------------------ modules/layout/addon.view.php | 31 ---- modules/layout/conf/info.xml | 8 +- modules/layout/conf/module.xml | 2 +- modules/layout/lang/ko.lang.php | 10 ++ modules/layout/layout.class.php | 11 ++ modules/layout/layout.controller.php | 17 ++ modules/layout/layout.model.php | 118 ++++++++++++++ modules/layout/layout.view.php | 31 ++++ modules/layout/queries/deleteAddon.xml | 8 - .../layout/queries/getAddonIsActivated.xml | 11 -- modules/layout/queries/getAddons.xml | 8 - modules/layout/queries/insertAddon.xml | 9 -- modules/layout/schemas/addons.xml | 4 - modules/layout/schemas/layouts.xml | 6 + modules/layout/tpl.admin/addon_list.html | 43 ------ .../filter/toggle_activate_addon.xml | 9 -- modules/layout/tpl.admin/js/addon.js | 9 -- modules/layout/tpl.admin/layout_list.html | 29 ++++ 24 files changed, 241 insertions(+), 371 deletions(-) delete mode 100644 modules/layout/addon.class.php delete mode 100644 modules/layout/addon.controller.php delete mode 100644 modules/layout/addon.model.php delete mode 100644 modules/layout/addon.view.php create mode 100644 modules/layout/lang/ko.lang.php create mode 100644 modules/layout/layout.class.php create mode 100644 modules/layout/layout.controller.php create mode 100644 modules/layout/layout.model.php create mode 100644 modules/layout/layout.view.php delete mode 100644 modules/layout/queries/deleteAddon.xml delete mode 100644 modules/layout/queries/getAddonIsActivated.xml delete mode 100644 modules/layout/queries/getAddons.xml delete mode 100644 modules/layout/queries/insertAddon.xml delete mode 100644 modules/layout/schemas/addons.xml create mode 100644 modules/layout/schemas/layouts.xml delete mode 100644 modules/layout/tpl.admin/addon_list.html delete mode 100644 modules/layout/tpl.admin/filter/toggle_activate_addon.xml delete mode 100644 modules/layout/tpl.admin/js/addon.js create mode 100644 modules/layout/tpl.admin/layout_list.html diff --git a/layouts/sample_layout/conf/info.xml b/layouts/sample_layout/conf/info.xml index 752d17635..82c5ada52 100644 --- a/layouts/sample_layout/conf/info.xml +++ b/layouts/sample_layout/conf/info.xml @@ -1,5 +1,5 @@ - + 견본 레이아웃 sample layout @@ -23,4 +23,4 @@ 1 - + diff --git a/modules/admin/admin.view.php b/modules/admin/admin.view.php index 2cbab8cbe..fdffb5511 100644 --- a/modules/admin/admin.view.php +++ b/modules/admin/admin.view.php @@ -85,6 +85,17 @@ $this->setTemplateFile($oAddonView->getTemplateFile()); } + /** + * @brief 레이아웃의 목록을 보여줌 + **/ + function dispLayoutList() { + $oLayoutView = &getView('layout'); + $oLayoutView->dispLayoutList(); + + $this->setTemplatePath($oLayoutView->getTemplatePath()); + $this->setTemplateFile($oLayoutView->getTemplateFile()); + } + /** * @brief 관리자 로그인 페이지 출력 **/ diff --git a/modules/admin/conf/module.xml b/modules/admin/conf/module.xml index a67895fec..a7914429c 100644 --- a/modules/admin/conf/module.xml +++ b/modules/admin/conf/module.xml @@ -4,6 +4,7 @@ + diff --git a/modules/layout/addon.class.php b/modules/layout/addon.class.php deleted file mode 100644 index f88b2a2eb..000000000 --- a/modules/layout/addon.class.php +++ /dev/null @@ -1,13 +0,0 @@ - diff --git a/modules/layout/addon.controller.php b/modules/layout/addon.controller.php deleted file mode 100644 index e650f39eb..000000000 --- a/modules/layout/addon.controller.php +++ /dev/null @@ -1,74 +0,0 @@ -isActivatedAddon($addon)) $this->doDeactivate($addon); - - // 비활성화 되어 있으면 활성화 시킴 - else $this->doActivate($addon); - } - - // 모듈에서 애드온을 사용하기 위한 캐시 파일 생성 - $buff = ""; - $addon_list = $oAddonModel->getActivatedAddons(); - $addon_count = count($addon_list); - for($i=0;$i<$addon_count;$i++) { - $addon = trim($addon_list[$i]); - if(!$addon) continue; - - $buff .= sprintf(' include("./addons/%s/%s.addon.php"); ', $addon, $addon); - } - - $buff = sprintf('', $buff); - - FileHandler::writeFile($this->cache_file, $buff); - - // 페이지를 애드온 목록으로 이동 - $this->setRedirectUrl("./?module=admin&act=dispAddonList"); - } - - /** - * @brief 애드온 활성화 - * - * addons라는 테이블에 애드온의 이름을 등록하는 것으로 활성화를 시키게 된다 - **/ - function doActivate($addon) { - $oDB = &DB::getInstance(); - $args->addon = $addon; - return $oDB->executeQuery('addon.insertAddon', $args); - } - - /** - * @brief 애드온 비활성화 - * - * addons라는 테이블에 애드온의 이름을 제거하는 것으로 비활성화를 시키게 된다 - **/ - function doDeactivate($addon) { - $oDB = &DB::getInstance(); - $args->addon = $addon; - return $oDB->executeQuery('addon.deleteAddon', $args); - } - - } -?> diff --git a/modules/layout/addon.model.php b/modules/layout/addon.model.php deleted file mode 100644 index fe6ac6ea3..000000000 --- a/modules/layout/addon.model.php +++ /dev/null @@ -1,145 +0,0 @@ -getActivatedAddons(); - - // DB 객체 생성 - $oDB = &DB::getInstance(); - - // 다운받은 애드온과 설치된 애드온의 목록을 구함 - $downloaded_list = FileHandler::readDir('./files/addons'); - $installed_list = FileHandler::readDir('./addons'); - $searched_list = array_merge($downloaded_list, $installed_list); - $searched_count = count($searched_list); - if(!$searched_count) return; - - for($i=0;$i<$searched_count;$i++) { - // 애드온의 이름 - $addon_name = $searched_list[$i]; - - // 애드온의 경로 (files/addons가 우선) - $path = $this->getAddonPath($addon_name); - - // 해당 애드온의 정보를 구함 - $info = $this->getAddonInfoXml($addon_name); - unset($obj); - - $info->addon = $addon_name; - $info->path = $path; - - if(in_array($addon_name, $activated_addons)) $info->activated = true; - else $info->activated = false; - - $list[] = $info; - } - return $list; - } - - /** - * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 - **/ - function getAddonInfoXml($addon) { - // 요청된 모듈의 경로를 구한다. 없으면 return - $addon_path = $this->getAddonPath($addon); - if(!$addon_path) return; - - // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 - $xml_file = sprintf("%sconf/info.xml", $addon_path); - if(!file_exists($xml_file)) return; - - $oXmlParser = new XmlParser(); - $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); - $xml_obj = $tmp_xml_obj->addon; - - if(!$xml_obj) return; - - $info->title = $xml_obj->title->body; - - // 작성자 정보 - $addon_info->title = $xml_obj->title->body; - $addon_info->version = $xml_obj->attrs->version; - $addon_info->author->name = $xml_obj->author->name->body; - $addon_info->author->email_address = $xml_obj->author->attrs->email_address; - $addon_info->author->homepage = $xml_obj->author->attrs->link; - $addon_info->author->date = $xml_obj->author->attrs->date; - $addon_info->author->description = $xml_obj->author->description->body; - - // history - if(!is_array($xml_obj->history->author)) $history[] = $xml_obj->history->author; - else $history = $xml_obj->history->author; - - foreach($history as $item) { - unset($obj); - $obj->name = $item->name->body; - $obj->email_address = $item->attrs->email_address; - $obj->homepage = $item->attrs->link; - $obj->date = $item->attrs->date; - $obj->description = $item->description->body; - $addon_info->history[] = $obj; - } - - return $addon_info; - } - - /** - * @brief 활성화된 애드온 목록을 구해옴 - **/ - function getActivatedAddons() { - $oDB = &DB::getInstance(); - $args->list_order = 'addon'; - $output = $oDB->executeQuery('addon.getAddons', $args); - if(!$output->data) return array(); - if(!is_array($output->data)) $output->data = array($output->data); - - $activated_count = count($output->data); - for($i=0;$i<$activated_count;$i++) { - $addon = $output->data[$i]; - $addon_list[] = $addon->addon; - } - return $addon_list; - } - - /** - * @brief 애드온이 활성화 되어 있는지 체크 - **/ - function isActivatedAddon($addon) { - $oDB = &DB::getInstance(); - $args->addon = $addon; - $output = $oDB->executeQuery('addon.getAddonIsActivated', $args); - if($output->data->count>0) return true; - return false; - } - - - } -?> diff --git a/modules/layout/addon.view.php b/modules/layout/addon.view.php deleted file mode 100644 index 0ca412d9b..000000000 --- a/modules/layout/addon.view.php +++ /dev/null @@ -1,31 +0,0 @@ -setTemplatePath($this->module_path.'tpl.admin'); - } - - /** - * @brief 애드온 목록을 보여줌 - **/ - function dispAddonList() { - // 애드온 목록을 세팅 - $oAddonModel = &getModel('addon'); - $addon_list = $oAddonModel->getAddonList(); - Context::set('addon_list', $addon_list); - - $this->setTemplateFile('addon_list'); - } - - - } -?> diff --git a/modules/layout/conf/info.xml b/modules/layout/conf/info.xml index dd61ab1ed..830bd046d 100644 --- a/modules/layout/conf/info.xml +++ b/modules/layout/conf/info.xml @@ -1,11 +1,11 @@ - 애드온 관리 - addon management + 레이아웃 관리 + layout management 제로 zero - 애드온 관리 모듈 - addon management + 레이아웃 관리 모듈 + layout management diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml index 000a88e93..00c0afd64 100644 --- a/modules/layout/conf/module.xml +++ b/modules/layout/conf/module.xml @@ -1,6 +1,6 @@ - + diff --git a/modules/layout/lang/ko.lang.php b/modules/layout/lang/ko.lang.php new file mode 100644 index 000000000..d8df0669b --- /dev/null +++ b/modules/layout/lang/ko.lang.php @@ -0,0 +1,10 @@ + + * @brief 레이아웃(layout) 모듈의 기본 언어팩 + **/ + + $lang->layout_name = '레이아웃 이름'; + $lang->menu_count = '메뉴의 수'; +?> diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php new file mode 100644 index 000000000..06107c3ee --- /dev/null +++ b/modules/layout/layout.class.php @@ -0,0 +1,11 @@ + diff --git a/modules/layout/layout.controller.php b/modules/layout/layout.controller.php new file mode 100644 index 000000000..583182406 --- /dev/null +++ b/modules/layout/layout.controller.php @@ -0,0 +1,17 @@ + diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php new file mode 100644 index 000000000..1d091f573 --- /dev/null +++ b/modules/layout/layout.model.php @@ -0,0 +1,118 @@ +getLayoutPath($layout_name); + + // 해당 레이아웃의 정보를 구함 + $info = $this->getLayoutInfoXml($layout_name); + unset($obj); + + $info->layout = $layout_name; + $info->path = $path; + + $list[] = $info; + } + return $list; + } + + /** + * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 + **/ + function getLayoutInfoXml($layout) { + // 요청된 모듈의 경로를 구한다. 없으면 return + $layout_path = $this->getLayoutPath($layout); + if(!$layout_path) return; + + // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 + $xml_file = sprintf("%sconf/info.xml", $layout_path); + if(!file_exists($xml_file)) return; + + $oXmlParser = new XmlParser(); + $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); + $xml_obj = $tmp_xml_obj->layout; + + if(!$xml_obj) return; + + $info->title = $xml_obj->title->body; + + // 작성자 정보 + $layout_info->title = $xml_obj->title->body; + $layout_info->version = $xml_obj->attrs->version; + $layout_info->author->name = $xml_obj->author->name->body; + $layout_info->author->email_address = $xml_obj->author->attrs->email_address; + $layout_info->author->homepage = $xml_obj->author->attrs->link; + $layout_info->author->date = $xml_obj->author->attrs->date; + $layout_info->author->description = $xml_obj->author->description->body; + + // history + if(!is_array($xml_obj->history->author)) $history[] = $xml_obj->history->author; + else $history = $xml_obj->history->author; + + foreach($history as $item) { + unset($obj); + $obj->name = $item->name->body; + $obj->email_address = $item->attrs->email_address; + $obj->homepage = $item->attrs->link; + $obj->date = $item->attrs->date; + $obj->description = $item->description->body; + $layout_info->history[] = $obj; + } + + // navigations + if(!is_array($xml_obj->navigations->navigation)) $navigations[] = $xml_obj->navigations->navigation; + else $navigations = $xml_obj->navigations->navigation; + + unset($item); + foreach($navigations as $item) { + unset($obj); + $obj->id = $item->attrs->id; + $obj->name = $item->name->body; + $obj->maxdepth = $item->maxdepth->body; + $layout_info->navigations[] = $obj; + } + + return $layout_info; + } + } +?> diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php new file mode 100644 index 000000000..3a1d0e9cd --- /dev/null +++ b/modules/layout/layout.view.php @@ -0,0 +1,31 @@ +setTemplatePath($this->module_path.'tpl.admin'); + } + + /** + * @brief 레이아웃 목록을 보여줌 + **/ + function dispLayoutList() { + // 레이아웃 목록을 세팅 + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getDownloadedLayoutList(); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('layout_list'); + } + + + } +?> diff --git a/modules/layout/queries/deleteAddon.xml b/modules/layout/queries/deleteAddon.xml deleted file mode 100644 index e80b07b87..000000000 --- a/modules/layout/queries/deleteAddon.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/modules/layout/queries/getAddonIsActivated.xml b/modules/layout/queries/getAddonIsActivated.xml deleted file mode 100644 index 63c925c4f..000000000 --- a/modules/layout/queries/getAddonIsActivated.xml +++ /dev/null @@ -1,11 +0,0 @@ - - -
- - - - - - - - diff --git a/modules/layout/queries/getAddons.xml b/modules/layout/queries/getAddons.xml deleted file mode 100644 index a27f481bb..000000000 --- a/modules/layout/queries/getAddons.xml +++ /dev/null @@ -1,8 +0,0 @@ - - -
- - - - - diff --git a/modules/layout/queries/insertAddon.xml b/modules/layout/queries/insertAddon.xml deleted file mode 100644 index 066af5694..000000000 --- a/modules/layout/queries/insertAddon.xml +++ /dev/null @@ -1,9 +0,0 @@ - - -
- - - - - - diff --git a/modules/layout/schemas/addons.xml b/modules/layout/schemas/addons.xml deleted file mode 100644 index 37230d0cd..000000000 --- a/modules/layout/schemas/addons.xml +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
diff --git a/modules/layout/schemas/layouts.xml b/modules/layout/schemas/layouts.xml new file mode 100644 index 000000000..dadcc53d6 --- /dev/null +++ b/modules/layout/schemas/layouts.xml @@ -0,0 +1,6 @@ + + + + + +
diff --git a/modules/layout/tpl.admin/addon_list.html b/modules/layout/tpl.admin/addon_list.html deleted file mode 100644 index 4dcb09863..000000000 --- a/modules/layout/tpl.admin/addon_list.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - -
- -
- - - - - - - - - - - - - - - - - - - - - - - - -
{$lang->addon_name}{$lang->version}{$lang->author}{$lang->date}{$lang->installed_path}{$lang->use}
- {$val->title}
- ({$val->addon}) -
{$val->version}{$val->author->name}{$val->author->date}{$val->path} - - {$lang->notuse} - - {$lang->use} - -
- {nl2br($val->author->description)} -
diff --git a/modules/layout/tpl.admin/filter/toggle_activate_addon.xml b/modules/layout/tpl.admin/filter/toggle_activate_addon.xml deleted file mode 100644 index e18e2f683..000000000 --- a/modules/layout/tpl.admin/filter/toggle_activate_addon.xml +++ /dev/null @@ -1,9 +0,0 @@ - -
- - - - - - -
diff --git a/modules/layout/tpl.admin/js/addon.js b/modules/layout/tpl.admin/js/addon.js deleted file mode 100644 index e1cedd536..000000000 --- a/modules/layout/tpl.admin/js/addon.js +++ /dev/null @@ -1,9 +0,0 @@ -/** - * @brief 애드온의 활성/비활성 토글용 함수 - * fo_addon이라는 id를 가지는 form에 인자로 주어진 addon값을 세팅후 실행 - **/ -function doToggleAddon(addon) { - var fo_obj = xGetElementById('fo_addon'); - fo_obj.addon.value = addon; - procFilter(fo_obj, toggle_activate_addon); -} diff --git a/modules/layout/tpl.admin/layout_list.html b/modules/layout/tpl.admin/layout_list.html new file mode 100644 index 000000000..be7a5221a --- /dev/null +++ b/modules/layout/tpl.admin/layout_list.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->layout_name}{$lang->version}{$lang->author}{$lang->menu_count}{$lang->date}{$lang->installed_path}
+ {$val->title}
+ ({$val->layout}) +
{$val->version}{$val->author->name}{count($val->navigations)}{$val->author->date}{$val->path}
+ {nl2br($val->author->description)} +