diff --git a/classes/plugin/Plugin.class.php b/classes/plugin/PluginHandler.class.php
similarity index 66%
rename from classes/plugin/Plugin.class.php
rename to classes/plugin/PluginHandler.class.php
index 8146c6b52..96a265f2c 100644
--- a/classes/plugin/Plugin.class.php
+++ b/classes/plugin/PluginHandler.class.php
@@ -1,12 +1,12 @@
-
+
diff --git a/modules/plugin/plugin.class.php b/modules/plugin/plugin.class.php
index 91a3e50eb..b002ed160 100644
--- a/modules/plugin/plugin.class.php
+++ b/modules/plugin/plugin.class.php
@@ -1,21 +1,21 @@
layout_srl = $oDB->getNextSequence();
- $args->layout = Context::get('layout');
- $args->title = Context::get('title');
-
- $output = $oDB->executeQuery("layout.insertLayout", $args);
- if(!$output->toBool()) return $output;
-
- $this->add('layout_srl', $args->layout_srl);
- }
-
- /**
- * @brief 레이아웃 정보 변경
- * 생성된 레이아웃의 제목과 확장변수(extra_vars)를 적용한다
- **/
- function procUpdateLayout() {
- // module, act, layout_srl, layout, title을 제외하면 확장변수로 판단.. 좀 구리다..
- $extra_vars = Context::getRequestVars();
- unset($extra_vars->module);
- unset($extra_vars->act);
- unset($extra_vars->layout_srl);
- unset($extra_vars->layout);
- unset($extra_vars->title);
-
- // DB에 입력하기 위한 변수 설정
- $args = Context::gets('layout_srl','title');
- $args->extra_vars = serialize($extra_vars);
-
- $oDB = &DB::getInstance();
- $output = $oDB->executeQuery('layout.updateLayout', $args);
- if(!$output->toBool()) return $output;
-
- $this->setMessage('success_updated');
- }
-
- /**
- * @brief 레이아웃 삭제
- * 삭제시 메뉴 xml 캐시 파일도 삭제
- **/
- function procDeleteLayout() {
- $layout_srl = Context::get('layout_srl');
-
- // 캐시 파일 삭제
- $cache_list = FileHandler::readDir("./files/cache/layout","",false,true);
- if(count($cache_list)) {
- foreach($cache_list as $cache_file) {
- $pos = strpos($cache_file, $layout_srl.'_');
- if($pos>0) unlink($cache_file);
- }
- }
-
- // DB에서 삭제
- $oDB = &DB::getInstance();
-
- // 레이아웃 메뉴 삭제
- $args->layout_srl = $layout_srl;
- $output = $oDB->executeQuery("layout.deleteLayoutMenus", $args);
- if(!$output->toBool()) return $output;
-
- // 레이아웃 삭제
- $output = $oDB->executeQuery("layout.deleteLayout", $args);
- if(!$output->toBool()) return $output;
-
- $this->setMessage('success_deleted');
- }
-
- /**
- * @brief 레이아웃에 메뉴 추가
- **/
- function procInsertLayoutMenu() {
- // 입력할 변수 정리
- $source_args = Context::getRequestVars();
- unset($source_args->module);
- unset($source_args->act);
- if($source_args->menu_open_window!="Y") $source_args->menu_open_window = "N";
- if($source_args->menu_expand !="Y") $source_args->menu_expand = "N";
- $source_args->group_srls = str_replace('|@|',',',$source_args->group_srls);
- $source_args->parent_srl = (int)$source_args->parent_srl;
-
- // 변수를 다시 정리 (form문의 column과 DB column이 달라서)
- $args->menu_srl = $source_args->menu_srl;
- $args->parent_srl = $source_args->parent_srl;
- $args->layout_srl = $source_args->layout_srl;
- $args->menu_id = $source_args->menu_id;
- $args->name = $source_args->menu_name;
- $args->url = trim($source_args->menu_url);
- $args->open_window = $source_args->menu_open_window;
- $args->expand = $source_args->menu_expand;
- $args->normal_btn = $source_args->menu_normal_btn;
- $args->hover_btn = $source_args->menu_hover_btn;
- $args->active_btn = $source_args->menu_active_btn;
- $args->group_srls = $source_args->group_srls;
-
- $layout = Context::get('layout');
-
- // 이미 존재하는지를 확인
- $oLayoutModel = &getModel('layout');
- $menu_info = $oLayoutModel->getLayoutMenuInfo($args->menu_srl);
-
- $oDB = &DB::getInstance();
-
- // 존재하게 되면 update를 해준다
- if($menu_info->menu_srl == $args->menu_srl) {
- $output = $oDB->executeQuery('layout.updateLayoutMenu', $args);
- if(!$output->toBool()) return $output;
-
- // 존재하지 않으면 insert를 해준다
- } else {
- $args->listorder = -1*$args->menu_srl;
- $output = $oDB->executeQuery('layout.insertLayoutMenu', $args);
- if(!$output->toBool()) return $output;
- }
-
- // 해당 메뉴의 정보를 구함
- $layout_info = $oLayoutModel->getLayoutInfo($layout);
- $menu_title = $layout_info->menu->{$args->menu_id}->name;
-
- // XML 파일을 갱신하고 위치을 넘겨 받음
- $xml_file = $this->makeXmlFile($args->layout_srl, $args->menu_id);
-
- $this->add('xml_file', $xml_file);
- $this->add('menu_srl', $args->menu_srl);
- $this->add('menu_id', $args->menu_id);
- $this->add('menu_title', $menu_title);
-
- // 현재 mid에 해당하는 모듈의 layout_srl 을 무조건 변경
- if(eregi("^mid=", $args->url)) {
- $target_args->layout_srl = $args->layout_srl;
- $target_args->mid = substr($args->url,4);
- $output = $oDB->executeQuery("module.updateModuleLayout", $target_args);
- if(!$output->toBool()) return $output;
- }
- }
-
- /**
- * @brief 레이아웃 메뉴 삭제
- **/
- function procDeleteLayoutMenu() {
- // 변수 정리
- $args = Context::gets('layout_srl','layout','menu_srl','menu_id');
-
- $oLayoutModel = &getModel('layout');
-
- // 원정보를 가져옴
- $node_info = $oLayoutModel->getLayoutMenuInfo($args->menu_srl);
- if($node_info->parent_srl) $parent_srl = $node_info->parent_srl;
-
- $oDB = &DB::getInstance();
-
- // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력
- $output = $oDB->executeQuery('layout.getChildMenuCount', $args);
- if(!$output->toBool()) return $output;
- if($output->data->count>0) return new Object(-1, msg_cannot_delete_for_child);
-
- // DB에서 삭제
- $output = $oDB->executeQuery("layout.deleteLayoutMenu", $args);
- if(!$output->toBool()) return $output;
-
- // 해당 메뉴의 정보를 구함
- $layout_info = $oLayoutModel->getLayoutInfo($args->layout);
- $menu_title = $layout_info->menu->{$args->menu_id}->name;
-
- // XML 파일을 갱신하고 위치을 넘겨 받음
- $xml_file = $this->makeXmlFile($args->layout_srl, $args->menu_id);
-
- $this->add('xml_file', $xml_file);
- $this->add('menu_id', $args->menu_id);
- $this->add('menu_title', $menu_title);
- $this->add('menu_srl', $parent_srl);
- }
-
- /**
- * @brief 레이아웃의 메뉴를 이동
- **/
- function procMoveLayoutMenu() {
- // 변수 설정
- $menu_id = Context::get('menu_id');
- $source_node_srl = str_replace('menu_'.$menu_id.'_','',Context::get('source_node_srl'));
- $target_node_srl = str_replace('menu_'.$menu_id.'_','',Context::get('target_node_srl'));
-
- // target_node 의 값을 구함
- $oLayoutModel = &getModel('layout');
- $target_node = $oLayoutModel->getLayoutMenuInfo($target_node_srl);
-
- // source_node에 target_node_srl의 parent_srl, listorder 값을 입력
- $oDB = &DB::getInstance();
- $source_args->menu_srl = $source_node_srl;
- $source_args->parent_srl = $target_node->parent_srl;
- $source_args->listorder = $target_node->listorder;
- $output = $oDB->executeQuery('layout.updateLayoutMenuParent', $source_args);
- if(!$output->toBool()) return $output;
-
- // target_node의 listorder값을 +1해 준다
- $target_args->menu_srl = $target_node_srl;
- $target_args->parent_srl = $target_node->parent_srl;
- $target_args->listorder = $target_node->listorder -1;
- $output = $oDB->executeQuery('layout.updateLayoutMenuParent', $target_args);
- if(!$output->toBool()) return $output;
-
- // xml파일 재생성
- $xml_file = $this->makeXmlFile($target_node->layout_srl, $menu_id);
-
- // return 변수 설정
- $this->add('menu_id', $menu_id);
- $this->add('source_node_srl', Context::get('source_node_srl'));
- }
-
- /**
- * @brief xml 파일을 갱신
- * 관리자페이지에서 메뉴 구성 후 간혹 xml파일이 재생성 안되는 경우가 있는데\n
- * 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n
- * 개발 중간의 문제인 것 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능
- **/
- function procMakeXmlFile() {
- // 입력값을 체크
- $menu_id = Context::get('menu_id');
- $layout = Context::get('layout');
- $layout_srl = Context::get('layout_srl');
-
- // 해당 메뉴의 정보를 구함
- $oLayoutModel = &getModel('layout');
- $layout_info = $oLayoutModel->getLayoutInfo($layout);
- $menu_title = $layout_info->menu->{$menu_id}->name;
-
- // xml파일 재생성
- $xml_file = $this->makeXmlFile($layout_srl, $menu_id);
-
- // return 값 설정
- $this->add('menu_id',$menu_id);
- $this->add('menu_title',$menu_title);
- $this->add('xml_file',$xml_file);
- }
-
- /**
- * @brief 메뉴의 xml 파일을 만들고 위치를 return
- **/
- function makeXmlFile($layout_srl, $menu_id) {
- // xml파일 생성시 필요한 정보가 없으면 그냥 return
- if(!$layout_srl || !$menu_id) return;
-
- // DB에서 layout_srl에 해당하는 메뉴 목록을 listorder순으로 구해옴
- $oDB = &DB::getInstance();
- $args->layout_srl = $layout_srl;
- $args->menu_id = $menu_id;
- $output = $oDB->executeQuery("layout.getLayoutMenuList", $args);
- if(!$output->toBool()) return;
-
- // 캐시 파일의 이름을 지정
- $xml_file = sprintf("./files/cache/layout/%s_%s.xml.php", $layout_srl, $menu_id);
- $php_file = sprintf("./files/cache/layout/%s_%s.php", $layout_srl, $menu_id);
-
- // 구해온 데이터가 없다면 노드데이터가 없는 xml 파일만 생성
- $list = $output->data;
- if(!$list) {
- $xml_buff = "";
- FileHandler::writeFile($xml_file, $xml_buff);
- return $xml_file;
- }
-
- // 구해온 데이터가 하나라면 array로 바꾸어줌
- if(!is_array($list)) $list = array($list);
-
- // 루프를 돌면서 tree 구성
- $list_count = count($list);
- for($i=0;$i<$list_count;$i++) {
- $node = $list[$i];
- $menu_srl = $node->menu_srl;
- $parent_srl = $node->parent_srl;
-
- $tree[$parent_srl][$menu_srl] = $node;
- }
-
- // xml 캐시 파일 생성
- $xml_buff = sprintf('%s', $this->getXmlTree($tree[0], $tree));
-
- // php 캐시 파일 생성
- $php_output = $this->getPhpCacheCode($tree[0], $tree);
- $php_buff = sprintf('list = array(%s); ?>', $php_output['buff']);
-
- // 파일 저장
- FileHandler::writeFile($xml_file, $xml_buff);
- FileHandler::writeFile($php_file, $php_buff);
- return $xml_file;
- }
-
- /**
- * @brief array로 정렬된 노드들을 parent_srl을 참조하면서 recursive하게 돌면서 xml 데이터 생성
- * 메뉴 xml파일은 node라는 tag가 중첩으로 사용되며 이 xml doc으로 관리자 페이지에서 메뉴를 구성해줌\n
- * (tree_menu.js 에서 xml파일을 바로 읽고 tree menu를 구현)
- **/
- function getXmlTree($source_node, $tree) {
- if(!$source_node) return;
- foreach($source_node as $menu_srl => $node) {
- $child_buff = "";
-
- // 자식 노드의 데이터 가져옴
- if($menu_srl&&$tree[$menu_srl]) $child_buff = $this->getXmlTree($tree[$menu_srl], $tree);
-
- // 변수 정리
- $name = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->name);
- $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url);
- $open_window = $node->open_window;
- $expand = $node->expand;
- $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn);
- $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn);
- $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn);
- $group_srls = $node->group_srls;
-
- // node->group_srls값이 있으면
- if($group_srls) $group_check_code = sprintf('($_SESSION["is_admin"]==true||(is_array($_SESSION["group_srls"])&&count(array_intersect($_SESSION["group_srls"], array(%s)))))',$group_srls);
- else $group_check_code = "true";
- $attribute = sprintf(
- 'node_srl="%s" text=\'=(%s?"%s":"")?>\' url=\'=(%s?"%s":"")?>\' open_window="%s" expand="%s" normal_btn="%s" hover_btn="%s" active_btn="%s" ',
- $menu_srl,
- $group_check_code,
- $name,
- $group_check_code,
- $url,
- $open_window,
- $expand,
- $normal_btn,
- $hover_btn,
- $active_btn
- );
-
- if($child_buff) $buff .= sprintf('%s', $attribute, $child_buff);
- else $buff .= sprintf('', $attribute);
- }
- return $buff;
- }
-
- /**
- * @brief array로 정렬된 노드들을 php code로 변경하여 return
- * 레이아웃에서 메뉴를 tpl에 사용시 xml데이터를 사용할 수도 있지만 별도의 javascript 사용이 필요하기에
- * php로 된 캐시파일을 만들어서 db이용없이 바로 메뉴 정보를 구할 수 있도록 한다
- * 이 캐시는 ModuleHandler::displayContent() 에서 include하여 Context::set() 한다
- **/
- function getPhpCacheCode($source_node, $tree) {
- $output = array("buff"=>"", "url_list"=>array());
- if(!$source_node) return $output;
-
- foreach($source_node as $menu_srl => $node) {
- // 자식 노드가 있으면 자식 노드의 데이터를 먼저 얻어옴
- if($menu_srl&&$tree[$menu_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_srl], $tree);
- else $child_output = array("buff"=>"", "url_list"=>array());
-
- // 노드의 url에 ://가 있으면 바로 링크, 아니면 제로보드의 링크를 설정한다 ($node->href가 완성된 url)
- if($node->url && !strpos($node->url, '://')) $node->href = "./?".$node->url;
- else $node->href = $node->url;
-
- // 현재 노드의 url값이 공란이 아니라면 url_list 배열값에 입력
- if($node->url) $child_output['url_list'][] = $node->url;
- $output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
-
- // node->group_srls값이 있으면
- if($node->group_srls) $group_check_code = sprintf('($_SESSION["is_admin"]==true||(is_array($_SESSION["group_srls"])&&count(array_intersect($_SESSION["group_srls"], array(%s)))))',$node->group_srls);
- else $group_check_code = "true";
-
- // 변수 정리
- $name = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->name);
- $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href);
- $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url);
- $open_window = $node->open_window;
- $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn);
- $hover_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->hover_btn);
- $active_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->active_btn);
- $selected = '"'.implode('","',$child_output['url_list']).'"';
- $child_buff = $child_output['buff'];
-
- // 속성을 생성한다 ( url_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;)
- $attribute = sprintf(
- '"node_srl"=>"%s","text"=>(%s?"%s":""),"href"=>(%s?"%s":""),"url"=>(%s?"%s":""),"open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(in_array(Context::get("zbxe_url"),array(%s))?1:0),"list"=>array(%s)',
- $node->menu_srl,
- $group_check_code,
- $name,
- $group_check_code,
- $href,
- $group_check_code,
- $url,
- $open_window,
- $normal_btn,
- $hover_btn,
- $active_btn,
- $selected,
- $child_buff
- );
-
- // buff 데이터를 생성한다
- $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_srl, $attribute);
- }
- return $output;
- }
}
?>
diff --git a/modules/plugin/plugin.model.php b/modules/plugin/plugin.model.php
index b48b1c7cf..b65420766 100644
--- a/modules/plugin/plugin.model.php
+++ b/modules/plugin/plugin.model.php
@@ -1,12 +1,12 @@
executeQuery('layout.getLayoutList');
- if(!$output->data) return;
-
- if(is_array($output->data)) return $output->data;
- return array($output->data);
- }
-
- /**
- * @brief DB 에 생성된 한개의 레이아웃 정보를 구함
- * 생성된 레이아웃의 DB정보+XML정보를 return
- **/
- function getLayout($layout_srl) {
- // 일단 DB에서 정보를 가져옴
- $oDB = &DB::getInstance();
- $args->layout_srl = $layout_srl;
- $output = $oDB->executeQuery('layout.getLayout', $args);
- if(!$output->data) return;
-
- // layout, extra_vars를 정리한 후 xml 파일 정보를 불러옴 (불러올때 결합)
- $info = $output->data;
- $layout_title = $info->title;
- $layout = $info->layout;
- $vars = unserialize($info->extra_vars);
-
- return $this->getLayoutInfo($layout, $layout_srl, $layout_title, $vars);
- }
-
- /**
- * @brief 레이아웃의 경로를 구함
- * 기본으로는 ./layouts에 있지만 웹관리기능으로 다운로드시 ./files/layouts에 존재함
- **/
- function getLayoutPath($layout_name) {
- $class_path = sprintf('./files/layouts/%s/', $layout_name);
+ function getPluginPath($plugin_name) {
+ $class_path = sprintf('./files/plugins/%s/', $plugin_name);
if(is_dir($class_path)) return $class_path;
- $class_path = sprintf('./layouts/%s/', $layout_name);
+ $class_path = sprintf('./plugins/%s/', $plugin_name);
if(is_dir($class_path)) return $class_path;
return "";
}
/**
- * @brief 레이아웃의 종류와 정보를 구함
- * 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미)
+ * @brief 플러그인의 종류와 정보를 구함
+ * 다운로드되어 있는 플러그인의 종류 (생성과 다른 의미)
**/
- function getDownloadedLayoutList() {
- // 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함
- $downloaded_list = FileHandler::readDir('./files/layouts');
- $installed_list = FileHandler::readDir('./layouts');
+ function getDownloadedPluginList() {
+ // 다운받은 플러그인과 설치된 플러그인의 목록을 구함
+ $downloaded_list = FileHandler::readDir('./files/plugins');
+ $installed_list = FileHandler::readDir('./plugins');
$searched_list = array_merge($downloaded_list, $installed_list);
$searched_count = count($searched_list);
if(!$searched_count) return;
- // 찾아진 레이아웃 목록을 loop돌면서 필요한 정보를 간추려 return
+ // 찾아진 플러그인 목록을 loop돌면서 필요한 정보를 간추려 return
for($i=0;$i<$searched_count;$i++) {
- // 레이아웃의 이름
- $layout = $searched_list[$i];
+ // 플러그인의 이름
+ $plugin = $searched_list[$i];
- // 해당 레이아웃의 정보를 구함
- $layout_info = $this->getLayoutInfo($layout);
+ // 해당 플러그인의 정보를 구함
+ $plugin_info = $this->getPluginInfo($plugin);
- $list[] = $layout_info;
+ $list[] = $plugin_info;
}
return $list;
}
@@ -90,158 +57,67 @@
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
**/
- function getLayoutInfo($layout, $layout_srl = 0, $layout_title = "", $vars = null) {
+ function getPluginInfo($plugin, $plugin_srl = 0, $plugin_title = "", $vars = null) {
// 요청된 모듈의 경로를 구한다. 없으면 return
- $layout_path = $this->getLayoutPath($layout);
- if(!$layout_path) return;
+ $plugin_path = $this->getPluginPath($plugin);
+ if(!$plugin_path) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
- $xml_file = sprintf("%sconf/info.xml", $layout_path);
+ $xml_file = sprintf("%sconf/info.xml", $plugin_path);
if(!file_exists($xml_file)) return;
- // cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return
- $cache_file = sprintf('./files/cache/layout/%s.cache.php', $layout);
+ // cache 파일을 비교하여 문제 없으면 include하고 $plugin_info 변수를 return
+ $cache_file = sprintf('./files/cache/plugin/%s.cache.php', $plugin);
if(file_exists($cache_file)&&filectime($cache_file)>filectime($xml_file)) {
include $cache_file;
- return $layout_info;
+ return $plugin_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
- $xml_obj = $tmp_xml_obj->layout;
+ $xml_obj = $tmp_xml_obj->plugin;
if(!$xml_obj) return;
$buff = '';
- // 레이아웃의 제목, 버전
- $buff .= sprintf('$layout_info->layout = "%s";', $layout);
- $buff .= sprintf('$layout_info->path = "%s";', $layout_path);
- $buff .= sprintf('$layout_info->title = "%s";', $xml_obj->title->body);
- $buff .= sprintf('$layout_info->version = "%s";', $xml_obj->attrs->version);
- $buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
- $buff .= sprintf('$layout_info->layout_title = $layout_title;');
+ // 플러그인의 제목, 버전
+ $buff .= sprintf('$plugin_info->plugin = "%s";', $plugin);
+ $buff .= sprintf('$plugin_info->path = "%s";', $plugin_path);
+ $buff .= sprintf('$plugin_info->title = "%s";', $xml_obj->title->body);
+ $buff .= sprintf('$plugin_info->version = "%s";', $xml_obj->attrs->version);
+ $buff .= sprintf('$plugin_info->plugin_srl = $plugin_srl;');
+ $buff .= sprintf('$plugin_info->plugin_title = $plugin_title;');
// 작성자 정보
- $buff .= sprintf('$layout_info->author->name = "%s";', $xml_obj->author->name->body);
- $buff .= sprintf('$layout_info->author->email_address = "%s";', $xml_obj->author->attrs->email_address);
- $buff .= sprintf('$layout_info->author->homepage = "%s";', $xml_obj->author->attrs->link);
- $buff .= sprintf('$layout_info->author->date = "%s";', $xml_obj->author->attrs->date);
- $buff .= sprintf('$layout_info->author->description = "%s";', $xml_obj->author->description->body);
+ $buff .= sprintf('$plugin_info->author->name = "%s";', $xml_obj->author->name->body);
+ $buff .= sprintf('$plugin_info->author->email_address = "%s";', $xml_obj->author->attrs->email_address);
+ $buff .= sprintf('$plugin_info->author->homepage = "%s";', $xml_obj->author->attrs->link);
+ $buff .= sprintf('$plugin_info->author->date = "%s";', $xml_obj->author->attrs->date);
+ $buff .= sprintf('$plugin_info->author->description = "%s";', $xml_obj->author->description->body);
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
if(!is_array($xml_obj->extra_vars->var)) $extra_vars[] = $xml_obj->extra_vars->var;
else $extra_vars = $xml_obj->extra_vars->var;
$extra_var_count = count($extra_vars);
- $buff .= sprintf('$layout_info->extra_var_count = "%s";', $extra_var_count);
+ $buff .= sprintf('$plugin_info->extra_var_count = "%s";', $extra_var_count);
for($i=0;$i<$extra_var_count;$i++) {
unset($var);
$var = $extra_vars[$i];
- $buff .= sprintf('$layout_info->extra_var->%s->name = "%s";', $var->attrs->id, $var->name->body);
- $buff .= sprintf('$layout_info->extra_var->%s->type = "%s";', $var->attrs->id, $var->type->body);
- $buff .= sprintf('$layout_info->extra_var->%s->value = $vars->%s;', $var->attrs->id, $var->attrs->id);
+ $buff .= sprintf('$plugin_info->extra_var->%s->name = "%s";', $var->attrs->id, $var->name->body);
+ $buff .= sprintf('$plugin_info->extra_var->%s->type = "%s";', $var->attrs->id, $var->type->body);
+ $buff .= sprintf('$plugin_info->extra_var->%s->value = $vars->%s;', $var->attrs->id, $var->attrs->id);
$options = $var->options->value;
if(!$options) continue;
if(!is_array($options)) $options = array($options);
$options_count = count($options);
for($i=0;$i<$options_count;$i++) {
- $buff .= sprintf('$layout_info->extra_var->%s->options[] = "%s";', $var->attrs->id, $options[$i]->body);
+ $buff .= sprintf('$plugin_info->extra_var->%s->options[] = "%s";', $var->attrs->id, $options[$i]->body);
}
}
-
- // 메뉴
- if(!is_array($xml_obj->menus->menu)) $menus[] = $xml_obj->menus->menu;
- else $menus = $xml_obj->menus->menu;
-
- $menu_count = count($menus);
- $buff .= sprintf('$layout_info->menu_count = "%s";', $menu_count);
- for($i=0;$i<$menu_count;$i++) {
- $id = $menus[$i]->attrs->id;
-
- $buff .= sprintf('$layout_info->menu->{%s}->id = "%s";',$id, $menus[$i]->attrs->id);
- $buff .= sprintf('$layout_info->menu->{%s}->name = "%s";',$id, $menus[$i]->name->body);
- $buff .= sprintf('$layout_info->menu->{%s}->maxdepth = "%s";',$id, $menus[$i]->maxdepth->body);
- $buff .= sprintf('$layout_info->menu->{%s}->xml_file = "./files/cache/layout/".$layout_srl."_%s.xml.php";',$id, $id);
- $buff .= sprintf('$layout_info->menu->{%s}->php_file = "./files/cache/layout/".$layout_srl."_%s.php";',$id, $id);
- }
-
- $buff = '';
- FileHandler::writeFile($cache_file, $buff);
-
- if(file_exists($cache_file)) include $cache_file;
- return $layout_info;
- }
-
- /**
- * @brief 특정 menu_srl의 정보를 return
- * 이 정보중에 group_srls의 경우는 , 로 연결되어 들어가며 사용시에는 explode를 통해 array로 변환 시킴
- **/
- function getLayoutMenuInfo($menu_srl) {
- $oDB = &DB::getInstance();
-
- // menu_srl 이 있으면 해당 메뉴의 정보를 가져온다
- $args->menu_srl = $menu_srl;
- $output = $oDB->executeQuery('layout.getLayoutMenu', $args);
- if(!$output->toBool()) return $output;
-
- $node = $output->data;
- if($node->group_srls) $node->group_srls = explode(',',$node->group_srls);
- return $node;
- }
-
- /**
- * @brief 특정 menu_srl의 정보를 이용하여 템플릿을 구한후 return
- * 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 된 html을 직접 return
- **/
- function getMenuTplInfo() {
- // 해당 메뉴의 정보를 가져오기 위한 변수 설정
- $menu_id = Context::get('menu_id');
- $menu_srl = Context::get('menu_srl');
- $layuot = Context::get('layout');
- $parent_srl = Context::get('parent_srl');
-
- // 회원 그룹의 목록을 가져옴
- $oMemberModel = &getModel('member');
- $group_list = $oMemberModel->getGroups();
- Context::set('group_list', $group_list);
-
- // parent_srl이 있고 menu_srl이 없으면 하부 메뉴 추가임
- if(!$menu_srl && $parent_srl) {
- // 상위 메뉴의 정보를 가져옴
- $parent_info = $this->getLayoutMenuInfo($parent_srl);
-
- // 추가하려는 메뉴의 기본 변수 설정
- $oDB = &DB::getInstance();
- $menu_info->menu_srl = $oDB->getNextSequence();
- $menu_info->parent_srl = $parent_srl;
- $menu_info->parent_menu_name = $parent_info->name;
-
- // root에 메뉴 추가하거나 기존 메뉴의 수정일 경우
- } else {
- // menu_srl 이 있으면 해당 메뉴의 정보를 가져온다
- if($menu_srl) $menu_info = $this->getLayoutMenuInfo($menu_srl);
-
- // 찾아진 값이 없다면 신규 메뉴 추가로 보고 menu_srl값만 구해줌
- if(!$menu_info->menu_srl) {
- $oDB = &DB::getInstance();
- $menu_info->menu_srl = $oDB->getNextSequence();
- }
- }
-
- Context::set('menu_info', $menu_info);
-
- // template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다.
- require_once("./classes/template/TemplateHandler.class.php");
- $oTemplate = new TemplateHandler();
- $tpl = $oTemplate->compile($this->module_path.'tpl.admin', 'layout_menu_info');
-
- // return 할 변수 설정
- $this->add('menu_id', $menu_id);
- $this->add('tpl', $tpl);
- }
}
?>
diff --git a/modules/plugin/plugin.view.php b/modules/plugin/plugin.view.php
index 093d32d6d..8ffe3b167 100644
--- a/modules/plugin/plugin.view.php
+++ b/modules/plugin/plugin.view.php
@@ -1,11 +1,11 @@
getLayoutList();
- Context::set('layout_list', $layout_list);
-
- $this->setTemplateFile('index');
- }
-
/**
- * @brief 레이아웃 등록 페이지
- * 1차적으로 레이아웃만 선택한 후 DB 에 빈 값을 넣고 그 후 상세 값 설정하는 단계를 거침
+ * @brief 플러그인의 상세 정보(conf/info.xml)를 팝업 출력
**/
- function dispInsertLayout() {
- // 레이아웃 목록을 세팅
- $oLayoutModel = &getModel('layout');
- $layout_list = $oLayoutModel->getDownloadedLayoutList();
- Context::set('layout_list', $layout_list);
-
- $this->setTemplateFile('insert_layout');
- }
-
- /**
- * @brief 레이아웃 세부 정보 입력
- **/
- function dispLayoutMenu() {
- // 선택된 레이아웃의 정보르 구해서 세팅
- $layout_srl = Context::get('layout_srl');
-
- // 레이아웃의 정보를 가져옴
- $oLayoutModel = &getModel('layout');
- $layout_info = $oLayoutModel->getLayout($layout_srl);
-
- // 등록된 레이아웃이 없으면 오류 표시
- if(!$layout_info) return $this->dispContent();
-
- Context::set('layout_info', $layout_info);
-
- $this->setTemplateFile('layout_info');
- }
-
- /**
- * @brief 레이아웃의 상세 정보(conf/info.xml)를 팝업 출력
- **/
- function dispLayoutInfo() {
+ function dispPluginInfo() {
// 모듈 목록을 구해서
- $oLayoutModel = &getModel('layout');
- $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
- Context::set('layout_info', $layout_info);
+ $oPluginModel = &getModel('plugin');
+ $plugin_info = $oPluginModel->getPluginInfo(Context::get('selected_plugin'));
+ Context::set('plugin_info', $plugin_info);
- // 레이아웃을 팝업으로 지정
- $this->setLayoutFile('popup_layout');
+ // 플러그인을 팝업으로 지정
+ $this->setPluginFile('popup_plugin');
// 템플릿 파일 지정
- $this->setTemplateFile('layout_detail_info');
+ $this->setTemplateFile('plugin_detail_info');
}
/**
- * @brief 레이아웃 목록을 보여줌
+ * @brief 플러그인 목록을 보여줌
**/
- function dispDownloadedLayoutList() {
- // 레이아웃 목록을 세팅
- $oLayoutModel = &getModel('layout');
- $layout_list = $oLayoutModel->getDownloadedLayoutList();
- Context::set('layout_list', $layout_list);
+ function dispDownloadedPluginList() {
+ // 플러그인 목록을 세팅
+ $oPluginModel = &getModel('plugin');
+ $plugin_list = $oPluginModel->getDownloadedPluginList();
+ Context::set('plugin_list', $plugin_list);
- $this->setTemplateFile('downloaded_layout_list');
+ $this->setTemplateFile('downloaded_plugin_list');
}
diff --git a/modules/plugin/tpl.admin/downloaded_layout_list.html b/modules/plugin/tpl.admin/downloaded_layout_list.html
new file mode 100644
index 000000000..786a49ee4
--- /dev/null
+++ b/modules/plugin/tpl.admin/downloaded_layout_list.html
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+ | {$lang->layout_name} |
+ {$lang->version} |
+ {$lang->author} |
+ {$lang->menu_count} |
+ {$lang->date} |
+ {$lang->path} |
+ {$lang->layout_info} |
+ {$lang->cmd_make} |
+
+
+
+
+ {$val->title}
+ ({$val->layout})
+ |
+ {$val->version} |
+ {$val->author->name} |
+ {$val->menu_count} |
+ {$val->author->date} |
+ {$val->path} |
+ {$lang->cmd_view} |
+ {$lang->cmd_make} |
+
+
+ |
+ {nl2br($val->author->description)}
+ |
+
+
+
+