diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index 4d2b99d3b..256cacd18 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -382,7 +382,7 @@ **/ function procBoardAdminInsertBoard() { // 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리 - $args = Context::gets('module_srl','layout_srl','module_category_srl','board_name','skin','browser_title','description','is_default','header_text','footer_text','admin_id'); + $args = Context::gets('module_srl','module_category_srl','board_name','skin','browser_title','description','is_default','header_text','footer_text','admin_id'); $args->module = 'board'; $args->mid = $args->board_name; unset($args->board_name); diff --git a/modules/board/board.view.php b/modules/board/board.view.php index c76b94cf5..4af582fa9 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -485,11 +485,6 @@ $skin_list = $oModuleModel->getSkins($this->module_path); Context::set('skin_list',$skin_list); - // 레이아웃 목록을 구해옴 - $oLayoutMode = &getModel('layout'); - $layout_list = $oLayoutMode->getLayoutList(); - Context::set('layout_list', $layout_list); - // 템플릿 파일 지정 $this->setTemplateFile('board_insert'); } diff --git a/modules/board/tpl/board_insert.html b/modules/board/tpl/board_insert.html index 1d7fa296c..0ba0aabae 100644 --- a/modules/board/tpl/board_insert.html +++ b/modules/board/tpl/board_insert.html @@ -49,20 +49,6 @@ {$lang->about_browser_title} - - {$lang->layout} - - - - - - {$lang->about_layout} - {$lang->skin} diff --git a/modules/layout/conf/module.xml b/modules/layout/conf/module.xml index 8d627421a..d43f47355 100644 --- a/modules/layout/conf/module.xml +++ b/modules/layout/conf/module.xml @@ -3,19 +3,11 @@ - - - - - - - - diff --git a/modules/layout/lang/ko.lang.php b/modules/layout/lang/ko.lang.php index 8835f62e7..9de8cbea9 100644 --- a/modules/layout/lang/ko.lang.php +++ b/modules/layout/lang/ko.lang.php @@ -8,44 +8,14 @@ $lang->cmd_layout_management = '레이아웃 설정'; $lang->layout_name = '레이아웃 이름'; - $lang->menu_count = '메뉴의 수'; - $lang->menu_management = '메뉴 관리'; - $lang->depth = '단계'; - $lang->parent_menu_name = '상위 메뉴명'; - $lang->menu_name = '메뉴명'; - $lang->menu_srl = '메뉴의 고유 번호'; - $lang->menu_id = '메뉴의 이름'; - $lang->menu_url = '연결 url'; - $lang->menu_open_window = '새창 열기'; - $lang->menu_expand = '펼침'; - $lang->menu_img_btn = '이미지 버튼'; - $lang->menu_normal_btn = '일반'; - $lang->menu_hover_btn = '마우스오버'; - $lang->menu_active_btn = '선택시'; - $lang->menu_group_srls = '그룹 제한'; $lang->layout_maker = "레이아웃 제작자"; $lang->layout_history = "변경 사항 "; $lang->layout_info = "레이아웃 정보"; $lang->layout_list = '레이아웃 목록'; $lang->downloaded_list = '다운로드 목록'; - $lang->limit_menu_depth = '표시 가능'; - $lang->cmd_make_child = '하부 메뉴 추가'; - $lang->cmd_remake_cache = "캐시파일 재생성"; $lang->cmd_move_to_installed_list = "생성된 목록 보기"; - $lang->cmd_enable_move_menu = "메뉴 옮기기 (선택후 위 메뉴를 드래그하세요)"; - $lang->cmd_search_mid = "mid 찾기"; $lang->about_downloaded_layouts = "다운로드 되어 있는 레이아웃 목록"; $lang->about_title = '모듈에 연결시 쉽게 구분할 수 있는 제목을 입력해주세요'; - $lang->about_menu_management = "메뉴관리는 선택하신 레이아웃에서 사용하는 메뉴를 구성할 수 있도록 합니다.\n정해진 단계까지 메뉴를 구성 가능하며 입력하신 메뉴를 클릭하시면 상세 정보를 입력할 수 있습니다.\n폴더그림을 클릭하시면 메뉴를 확장하실 수 있습니다.\n간혹 메뉴가 정상적으로 나타나지 않으면 \"캐시파일 재생성\" 버튼을 눌러서 정보를 갱신하세요.\n* 정해진 단계 이상의 메뉴는 제대로 표시되지 않을 수 있습니다."; - - $lang->about_menu_name = '관리 및 이미지 버튼이 아닐경우 메뉴 명으로 나타날 제목입니다'; - $lang->about_menu_url = "메뉴를 선택시 이동한 URL입니다.
다른 mid를 연결하고자 할때는 \"module=모듈명\" 또는 \"mid=모듈\"등으로
입력하시면 됩니다.
내용이 없을시 메뉴를 선택하여도 아무런 동작이 없게 됩니다."; - $lang->about_menu_open_window = '메뉴 선택시 새창으로 띄울 것인지를 정할 수 있습니다'; - $lang->about_menu_expand = '트리메뉴(tree_menu.js)를 사용시 늘 펼쳐진 상태로 있게 합니다'; - $lang->about_menu_img_btn = '이미지 버튼을 등록하시면 레이아웃에서 자동으로 이미지 버튼으로 교체되어 표시가 됩니다.'; - $lang->about_menu_group_srls = '그룹을 선택하시면 해당 그룹의 사용자만 메뉴가 보이게 됩니다. (xml파일을 직접 열람하면 노출이 됩니다)'; - - $lang->msg_cannot_delete_for_child = '하부 메뉴가 있는 메뉴는 삭제하실 수 없습니다'; ?> diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php index 16524b231..d5abe6f1b 100644 --- a/modules/layout/layout.class.php +++ b/modules/layout/layout.class.php @@ -15,20 +15,9 @@ $oModuleController = &getController('module'); $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminContent'); $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInsert'); - $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminMenu'); $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminDownloadedList'); $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInfo'); - //$oModuleController->insertActionForward('layout', 'model', 'getLayoutAdminMenuTplInfo'); - - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminInsert'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminUpdate'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminDelete'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminInsertMenu'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminDeleteMenu'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminMakeXmlFile'); - //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminMoveMenu'); - // 레이아웃에서 사용할 디렉토리 생성 FileHandler::makeDir('./files/cache/layout'); diff --git a/modules/layout/layout.controller.php b/modules/layout/layout.controller.php index 34edfcf06..be0e7ed25 100644 --- a/modules/layout/layout.controller.php +++ b/modules/layout/layout.controller.php @@ -67,13 +67,6 @@ } } - // DB에서 삭제 - - // 레이아웃 메뉴 삭제 - $args->layout_srl = $layout_srl; - $output = executeQuery("layout.deleteLayoutMenus", $args); - if(!$output->toBool()) return $output; - // 레이아웃 삭제 $output = executeQuery("layout.deleteLayout", $args); if(!$output->toBool()) return $output; @@ -81,325 +74,5 @@ $this->setMessage('success_deleted'); } - /** - * @brief 레이아웃에 메뉴 추가 - **/ - function procLayoutAdminInsertMenu() { - // 입력할 변수 정리 - $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); - - // 존재하게 되면 update를 해준다 - if($menu_info->menu_srl == $args->menu_srl) { - $output = executeQuery('layout.updateLayoutMenu', $args); - if(!$output->toBool()) return $output; - - // 존재하지 않으면 insert를 해준다 - } else { - $args->listorder = -1*$args->menu_srl; - $output = 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 = executeQuery("module.updateModuleLayout", $target_args); - if(!$output->toBool()) return $output; - } - } - - /** - * @brief 레이아웃 메뉴 삭제 - **/ - function procLayoutAdminDeleteMenu() { - // 변수 정리 - $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; - - // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 - $output = 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 = 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 procLayoutAdminMoveMenu() { - // 변수 설정 - $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 값을 입력 - $source_args->menu_srl = $source_node_srl; - $source_args->parent_srl = $target_node->parent_srl; - $source_args->listorder = $target_node->listorder; - $output = 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 = 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 procLayoutAdminMakeXmlFile() { - // 입력값을 체크 - $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순으로 구해옴 - $args->layout_srl = $layout_srl; - $args->menu_id = $menu_id; - $output = 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=\'\' url=\'\' 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/layout/layout.model.php b/modules/layout/layout.model.php index f98714eee..770573d6a 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -14,55 +14,6 @@ function init() { } - /** - * @brief 특정 menu_srl의 정보를 이용하여 템플릿을 구한후 return - * 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 된 html을 직접 return - **/ - function getLayoutAdminMenuTplInfo() { - // 해당 메뉴의 정보를 가져오기 위한 변수 설정 - $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); - - // 추가하려는 메뉴의 기본 변수 설정 - $menu_info->menu_srl = 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) { - $menu_info->menu_srl = 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', 'layout_menu_info'); - - // return 할 변수 설정 - $this->add('menu_id', $menu_id); - $this->add('tpl', $tpl); - } - /** * @brief DB 에 생성된 레이아웃의 목록을 구함 * 생성되었다는 것은 DB에 등록이 되었다는 것을 의미 @@ -218,20 +169,5 @@ return $layout_info; } - /** - * @brief 특정 menu_srl의 정보를 return - * 이 정보중에 group_srls의 경우는 , 로 연결되어 들어가며 사용시에는 explode를 통해 array로 변환 시킴 - **/ - function getLayoutMenuInfo($menu_srl) { - // menu_srl 이 있으면 해당 메뉴의 정보를 가져온다 - $args->menu_srl = $menu_srl; - $output = executeQuery('layout.getLayoutMenu', $args); - if(!$output->toBool()) return $output; - - $node = $output->data; - if($node->group_srls) $node->group_srls = explode(',',$node->group_srls); - else $node->group_srls = array(); - return $node; - } } ?> diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php index 9a84aea91..bf9df2297 100644 --- a/modules/layout/layout.view.php +++ b/modules/layout/layout.view.php @@ -73,22 +73,6 @@ $this->setTemplateFile('layout_detail_info'); } - /** - * @brief 레이아웃에서 선택할 수 있는 mid목록을 보여줌 - **/ - function dispLayoutAdminMidList() { - // mid 목록을 구해옴 - $oModuleModel = &getModel('module'); - $mid_list = $oModuleModel->getMidList(); - Context::set('mid_list', $mid_list); - - // 레이아웃을 팝업으로 지정 - $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 - $this->setTemplateFile('mid_list'); - } - /** * @brief 레이아웃 목록을 보여줌 **/ diff --git a/modules/layout/tpl/js/layout_admin.js b/modules/layout/tpl/js/layout_admin.js index 0cea141a2..ef266da91 100644 --- a/modules/layout/tpl/js/layout_admin.js +++ b/modules/layout/tpl/js/layout_admin.js @@ -5,19 +5,6 @@ function completeInsertLayout(ret_obj) { location.href = url; } -/* 레이아웃메뉴 입력후 */ -function completeInsertLayoutMenu(ret_obj) { - var menu_id = ret_obj['menu_id']; - var xml_file = ret_obj['xml_file']; - var menu_title = ret_obj['menu_title']; - var menu_srl = ret_obj['menu_srl']; - - if(!xml_file) return; - loadTreeMenu(xml_file, menu_id, "menu_zone_"+menu_id, menu_title, doGetMenuInfo, menu_srl, doMoveTree); - - if(!menu_srl) xInnerHtml("menu_zone_info_"+menu_id, ""); -} - /* 레이아웃 삭제 */ function doDeleteLayout(layout_srl) { var fo_obj = xGetElementById("fo_layout"); @@ -26,121 +13,3 @@ function doDeleteLayout(layout_srl) { procFilter(fo_obj, delete_layout); } - -/* 레이아웃 메뉴 삭제 */ -function doDeleteLayoutMenu(menu_srl, menu_id) { - var fo_obj = xGetElementById("fo_"+menu_id); - if(!fo_obj) return; - - procFilter(fo_obj, delete_layout_menu); -} - -/* 레이아웃 메뉴에를 클릭시 적용할 함수 */ -function doGetMenuInfo(menu_id, obj) { - // layout, menu_id, node_srl을 추출 - var fo_obj = xGetElementById("fo_layout"); - var layout = fo_obj.layout.value; - var node_srl = 0; - var parent_srl = 0; - if(typeof(obj.getAttribute)!="undefined") { - node_srl = obj.getAttribute("node_srl"); - } else { - node_srl = obj.node_srl; - parent_srl = obj.parent_srl; - } - - var params = new Array(); - params["menu_id"] = menu_id; - params["layout"] = layout; - params["menu_srl"] = node_srl; - params["parent_srl"] = parent_srl; - - // 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다. - var response_tags = new Array('error','message','menu_id', 'tpl'); - exec_xml('layout', 'getLayoutAdminMenuTplInfo', params, completeGetMenuInfo, response_tags, params); -} - -/* 메뉴를 드래그하여 이동한 후 실행할 함수 , 이동하는 node_srl과 대상 node_srl을 받음 */ -function doMoveTree(menu_id, source_node_srl, target_node_srl) { - var fo_obj = xGetElementById("fo_move_menu"); - fo_obj.menu_id.value = menu_id; - fo_obj.source_node_srl.value = source_node_srl; - fo_obj.target_node_srl.value = target_node_srl; - - // 이동 취소를 선택하였을 경우 다시 그림;; - if(!procFilter(fo_obj, move_layout_menu)) { - var params = new Array(); - params["menu_id"] = menu_id; - params["source_node_srl"] = source_node_srl; - completeMoveLayoutMenu(params); - } -} - -function completeMoveLayoutMenu(ret_obj) { - var menu_id = ret_obj['menu_id']; - var source_node_srl = ret_obj['source_node_srl']; - - var fo_menu = xGetElementById("fo_"+menu_id); - if(!fo_menu) return; - - var params = new Array(); - params["menu_id"] = menu_id; - params["layout"] = fo_menu.layout.value; - params["layout_srl"] = fo_menu.layout_srl.value; - var xml_file = fo_menu.xml_file.value; - var menu_title = fo_menu.menu_title.value; - var tmp = source_node_srl.split('_'); - var menu_srl = tmp[tmp.length-1]; - loadTreeMenu(xml_file, menu_id, "menu_zone_"+menu_id, menu_title, doGetMenuInfo, menu_srl, doMoveTree); -} - -/* 서버로부터 받아온 메뉴 정보를 출력 */ -function completeGetMenuInfo(ret_obj, response_tags) { - var menu_id = ret_obj['menu_id']; - var tpl = ret_obj['tpl']; - xInnerHtml("menu_zone_info_"+menu_id, ""); - xInnerHtml("menu_zone_info_"+menu_id, tpl); - - var fo_obj = xGetElementById("fo_"+menu_id); - fo_obj.menu_name.focus(); -} - -/* 빈 메뉴 추가시 사용 */ -function doInsertLayoutMenu(menu_id, parent_srl) { - if(typeof(parent_srl)=='undefined') parent_srl = 0; - var params = {node_srl:0, parent_srl:parent_srl} - doGetMenuInfo(menu_id, params); - deSelectNode(); -} - -/* 메뉴 목록 갱신 */ -function doReloadTreeMenu(menu_id) { - var fo_obj = xGetElementById("fo_"+menu_id); - if(!fo_obj) return; - - var params = new Array(); - params["menu_id"] = menu_id; - params["layout"] = fo_obj.layout.value; - params["layout_srl"] = fo_obj.layout_srl.value; - - // 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다. - var response_tags = new Array('error','message','menu_id', 'xml_file', 'menu_title'); - exec_xml('layout', 'procLayoutAdminMakeXmlFile', params, completeInsertLayoutMenu, response_tags, params); -} - -/* 레이아웃의 메뉴에 mid 추가 */ -function doInsertMid(mid, menu_id) { - if(!opener) { - window.close(); - return; - } - - var fo_obj = opener.xGetElementById("fo_"+menu_id); - if(!fo_obj) { - window.close(); - return; - } - - fo_obj.menu_url.value = "mid="+mid; - window.close(); -} diff --git a/modules/layout/tpl/layout_info.html b/modules/layout/tpl/layout_info.html index 085b2c146..bd01c16c4 100644 --- a/modules/layout/tpl/layout_info.html +++ b/modules/layout/tpl/layout_info.html @@ -1,17 +1,7 @@ - - - - -
- - - -
-
@@ -84,46 +74,3 @@ - -
-
-

{$lang->menu_management}

-
{nl2br($lang->about_menu_management)}
-
- - -
- - - - - - -
- - - - - - -
- -
- -
-
- - - - -
-
- -
- - -
- -
diff --git a/modules/menu/conf/info.xml b/modules/menu/conf/info.xml new file mode 100644 index 000000000..2e701c3ab --- /dev/null +++ b/modules/menu/conf/info.xml @@ -0,0 +1,8 @@ + + + 메뉴 관리 + + 제로 + 레이아웃, 모듈을 연결하는 메뉴를 생성/관리하는 모듈입니다. + + diff --git a/modules/menu/conf/module.xml b/modules/menu/conf/module.xml new file mode 100644 index 000000000..a1c06d53f --- /dev/null +++ b/modules/menu/conf/module.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + diff --git a/modules/menu/lang/ko.lang.php b/modules/menu/lang/ko.lang.php new file mode 100644 index 000000000..60c1d0b23 --- /dev/null +++ b/modules/menu/lang/ko.lang.php @@ -0,0 +1,50 @@ + + * @brief 메뉴(menu) 모듈의 기본 언어팩 + **/ + + $lang->cmd_menu_management = '메뉴 설정'; + + $lang->layout_name = '레이아웃 이름'; + $lang->menu_count = '메뉴의 수'; + $lang->menu_management = '메뉴 관리'; + $lang->depth = '단계'; + $lang->parent_menu_name = '상위 메뉴명'; + $lang->menu_name = '메뉴명'; + $lang->menu_srl = '메뉴의 고유 번호'; + $lang->menu_id = '메뉴의 이름'; + $lang->menu_url = '연결 url'; + $lang->menu_open_window = '새창 열기'; + $lang->menu_expand = '펼침'; + $lang->menu_img_btn = '이미지 버튼'; + $lang->menu_normal_btn = '일반'; + $lang->menu_hover_btn = '마우스오버'; + $lang->menu_active_btn = '선택시'; + $lang->menu_group_srls = '그룹 제한'; + $lang->layout_maker = "레이아웃 제작자"; + $lang->layout_history = "변경 사항 "; + $lang->layout_info = "레이아웃 정보"; + $lang->layout_list = '레이아웃 목록'; + $lang->downloaded_list = '다운로드 목록'; + $lang->limit_menu_depth = '표시 가능'; + + $lang->cmd_make_child = '하부 메뉴 추가'; + $lang->cmd_remake_cache = "캐시파일 재생성"; + $lang->cmd_move_to_installed_list = "생성된 목록 보기"; + $lang->cmd_enable_move_menu = "메뉴 옮기기 (선택후 위 메뉴를 드래그하세요)"; + $lang->cmd_search_mid = "mid 찾기"; + + $lang->about_title = '모듈에 연결시 쉽게 구분할 수 있는 제목을 입력해주세요'; + $lang->about_menu_management = "메뉴관리는 선택하신 레이아웃에서 사용하는 메뉴를 구성할 수 있도록 합니다.\n정해진 단계까지 메뉴를 구성 가능하며 입력하신 메뉴를 클릭하시면 상세 정보를 입력할 수 있습니다.\n폴더그림을 클릭하시면 메뉴를 확장하실 수 있습니다.\n간혹 메뉴가 정상적으로 나타나지 않으면 \"캐시파일 재생성\" 버튼을 눌러서 정보를 갱신하세요.\n* 정해진 단계 이상의 메뉴는 제대로 표시되지 않을 수 있습니다."; + + $lang->about_menu_name = '관리 및 이미지 버튼이 아닐경우 메뉴 명으로 나타날 제목입니다'; + $lang->about_menu_url = "메뉴를 선택시 이동한 URL입니다.
다른 mid를 연결하고자 할때는 \"module=모듈명\" 또는 \"mid=모듈\"등으로
입력하시면 됩니다.
내용이 없을시 메뉴를 선택하여도 아무런 동작이 없게 됩니다."; + $lang->about_menu_open_window = '메뉴 선택시 새창으로 띄울 것인지를 정할 수 있습니다'; + $lang->about_menu_expand = '트리메뉴(tree_menu.js)를 사용시 늘 펼쳐진 상태로 있게 합니다'; + $lang->about_menu_img_btn = '이미지 버튼을 등록하시면 레이아웃에서 자동으로 이미지 버튼으로 교체되어 표시가 됩니다.'; + $lang->about_menu_group_srls = '그룹을 선택하시면 해당 그룹의 사용자만 메뉴가 보이게 됩니다. (xml파일을 직접 열람하면 노출이 됩니다)'; + + $lang->msg_cannot_delete_for_child = '하부 메뉴가 있는 메뉴는 삭제하실 수 없습니다'; +?> diff --git a/modules/menu/layout.class.php b/modules/menu/layout.class.php new file mode 100644 index 000000000..16524b231 --- /dev/null +++ b/modules/menu/layout.class.php @@ -0,0 +1,52 @@ +insertActionForward('layout', 'view', 'dispLayoutAdminContent'); + $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInsert'); + $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminMenu'); + $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminDownloadedList'); + $oModuleController->insertActionForward('layout', 'view', 'dispLayoutAdminInfo'); + + //$oModuleController->insertActionForward('layout', 'model', 'getLayoutAdminMenuTplInfo'); + + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminInsert'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminUpdate'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminDelete'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminInsertMenu'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminDeleteMenu'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminMakeXmlFile'); + //$oModuleController->insertActionForward('layout', 'controller', 'procLayoutAdminMoveMenu'); + + // 레이아웃에서 사용할 디렉토리 생성 + FileHandler::makeDir('./files/cache/layout'); + + return new Object(); + } + + /** + * @brief 설치가 이상이 없는지 체크하는 method + **/ + function moduleIsInstalled() { + return new Object(); + } + + /** + * @brief 업데이트 실행 + **/ + function moduleUpdate() { + return new Object(); + } + } +?> diff --git a/modules/menu/layout.controller.php b/modules/menu/layout.controller.php new file mode 100644 index 000000000..34edfcf06 --- /dev/null +++ b/modules/menu/layout.controller.php @@ -0,0 +1,405 @@ +layout_srl = getNextSequence(); + $args->layout = Context::get('layout'); + $args->title = Context::get('title'); + + $output = executeQuery("layout.insertLayout", $args); + if(!$output->toBool()) return $output; + + $this->add('layout_srl', $args->layout_srl); + } + + /** + * @brief 레이아웃 정보 변경 + * 생성된 레이아웃의 제목과 확장변수(extra_vars)를 적용한다 + **/ + function procLayoutAdminUpdate() { + // 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); + + $output = executeQuery('layout.updateLayout', $args); + if(!$output->toBool()) return $output; + + $this->setMessage('success_updated'); + } + + /** + * @brief 레이아웃 삭제 + * 삭제시 메뉴 xml 캐시 파일도 삭제 + **/ + function procLayoutAdminDelete() { + $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에서 삭제 + + // 레이아웃 메뉴 삭제 + $args->layout_srl = $layout_srl; + $output = executeQuery("layout.deleteLayoutMenus", $args); + if(!$output->toBool()) return $output; + + // 레이아웃 삭제 + $output = executeQuery("layout.deleteLayout", $args); + if(!$output->toBool()) return $output; + + $this->setMessage('success_deleted'); + } + + /** + * @brief 레이아웃에 메뉴 추가 + **/ + function procLayoutAdminInsertMenu() { + // 입력할 변수 정리 + $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); + + // 존재하게 되면 update를 해준다 + if($menu_info->menu_srl == $args->menu_srl) { + $output = executeQuery('layout.updateLayoutMenu', $args); + if(!$output->toBool()) return $output; + + // 존재하지 않으면 insert를 해준다 + } else { + $args->listorder = -1*$args->menu_srl; + $output = 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 = executeQuery("module.updateModuleLayout", $target_args); + if(!$output->toBool()) return $output; + } + } + + /** + * @brief 레이아웃 메뉴 삭제 + **/ + function procLayoutAdminDeleteMenu() { + // 변수 정리 + $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; + + // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 + $output = 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 = 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 procLayoutAdminMoveMenu() { + // 변수 설정 + $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 값을 입력 + $source_args->menu_srl = $source_node_srl; + $source_args->parent_srl = $target_node->parent_srl; + $source_args->listorder = $target_node->listorder; + $output = 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 = 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 procLayoutAdminMakeXmlFile() { + // 입력값을 체크 + $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순으로 구해옴 + $args->layout_srl = $layout_srl; + $args->menu_id = $menu_id; + $output = 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=\'\' url=\'\' 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/menu/layout.model.php b/modules/menu/layout.model.php new file mode 100644 index 000000000..f98714eee --- /dev/null +++ b/modules/menu/layout.model.php @@ -0,0 +1,237 @@ +getGroups(); + Context::set('group_list', $group_list); + + // parent_srl이 있고 menu_srl이 없으면 하부 메뉴 추가임 + if(!$menu_srl && $parent_srl) { + // 상위 메뉴의 정보를 가져옴 + $parent_info = $this->getLayoutMenuInfo($parent_srl); + + // 추가하려는 메뉴의 기본 변수 설정 + $menu_info->menu_srl = 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) { + $menu_info->menu_srl = 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', 'layout_menu_info'); + + // return 할 변수 설정 + $this->add('menu_id', $menu_id); + $this->add('tpl', $tpl); + } + + /** + * @brief DB 에 생성된 레이아웃의 목록을 구함 + * 생성되었다는 것은 DB에 등록이 되었다는 것을 의미 + **/ + function getLayoutList() { + $output = 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에서 정보를 가져옴 + $args->layout_srl = $layout_srl; + $output = 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 레이아웃의 경로를 구함 + **/ + function getLayoutPath($layout_name) { + $class_path = sprintf('./layouts/%s/', $layout_name); + if(is_dir($class_path)) return $class_path; + + return ""; + } + + /** + * @brief 레이아웃의 종류와 정보를 구함 + * 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미) + **/ + function getDownloadedLayoutList() { + // 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함 + $searched_list = FileHandler::readDir('./layouts'); + $searched_count = count($searched_list); + if(!$searched_count) return; + + // 찾아진 레이아웃 목록을 loop돌면서 필요한 정보를 간추려 return + for($i=0;$i<$searched_count;$i++) { + // 레이아웃의 이름 + $layout = $searched_list[$i]; + + // 해당 레이아웃의 정보를 구함 + $layout_info = $this->getLayoutInfo($layout); + + $list[] = $layout_info; + } + return $list; + } + + /** + * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 + * 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다.. + **/ + function getLayoutInfo($layout, $layout_srl = 0, $layout_title = "", $vars = null) { + // 요청된 모듈의 경로를 구한다. 없으면 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; + + // cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return + $cache_file = sprintf('./files/cache/layout/%s.%s.cache.php', $layout, Context::getLangType()); + if(file_exists($cache_file)&&filectime($cache_file)>filectime($xml_file)) { + include $cache_file; + return $layout_info; + } + + // cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return + $oXmlParser = new XmlParser(); + $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); + $xml_obj = $tmp_xml_obj->layout; + 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('$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); + + // 추가 변수 (템플릿에서 사용할 제작자 정의 변수) + 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); + for($i=0;$i<$extra_var_count;$i++) { + unset($var); + unset($options); + $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('$layout_info->extra_var->%s->description = "%s";', $var->attrs->id, str_replace('"','\"',$var->description->body)); + + $options = $var->options; + if(!$options) continue; + + if(!is_array($options)) $options = array($options); + $options_count = count($options); + for($j=0;$j<$options_count;$j++) { + $buff .= sprintf('$layout_info->extra_var->%s->options["%s"] = "%s";', $var->attrs->id, $options[$j]->value->body, $options[$j]->name->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; + if($menus[$i]->attrs->default == "true") $buff .= sprintf('$layout_info->default_menu = "%s";', $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) { + // menu_srl 이 있으면 해당 메뉴의 정보를 가져온다 + $args->menu_srl = $menu_srl; + $output = executeQuery('layout.getLayoutMenu', $args); + if(!$output->toBool()) return $output; + + $node = $output->data; + if($node->group_srls) $node->group_srls = explode(',',$node->group_srls); + else $node->group_srls = array(); + return $node; + } + } +?> diff --git a/modules/menu/layout.view.php b/modules/menu/layout.view.php new file mode 100644 index 000000000..9a84aea91 --- /dev/null +++ b/modules/menu/layout.view.php @@ -0,0 +1,104 @@ +setTemplatePath($this->module_path.'tpl'); + } + + /** + * @brief 레이아웃 관리의 첫 페이지 + **/ + function dispLayoutAdminContent() { + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getLayoutList(); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('index'); + } + + /** + * @brief 레이아웃 등록 페이지 + * 1차적으로 레이아웃만 선택한 후 DB 에 빈 값을 넣고 그 후 상세 값 설정하는 단계를 거침 + **/ + function dispLayoutAdminInsert() { + // 레이아웃 목록을 세팅 + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getDownloadedLayoutList(); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('insert_layout'); + } + + /** + * @brief 레이아웃 세부 정보 입력 + **/ + function dispLayoutAdminMenu() { + // 선택된 레이아웃의 정보르 구해서 세팅 + $layout_srl = Context::get('layout_srl'); + + // 레이아웃의 정보를 가져옴 + $oLayoutModel = &getModel('layout'); + $layout_info = $oLayoutModel->getLayout($layout_srl); + + // 등록된 레이아웃이 없으면 오류 표시 + if(!$layout_info) return $this->dispLayoutAdminContent(); + + Context::set('layout_info', $layout_info); + + $this->setTemplateFile('layout_info'); + } + + /** + * @brief 레이아웃의 상세 정보(conf/info.xml)를 팝업 출력 + **/ + function dispLayoutAdminInfo() { + // 선택된 레이아웃 정보를 구함 + $oLayoutModel = &getModel('layout'); + $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); + Context::set('layout_info', $layout_info); + + // 레이아웃을 팝업으로 지정 + $this->setLayoutFile('popup_layout'); + + // 템플릿 파일 지정 + $this->setTemplateFile('layout_detail_info'); + } + + /** + * @brief 레이아웃에서 선택할 수 있는 mid목록을 보여줌 + **/ + function dispLayoutAdminMidList() { + // mid 목록을 구해옴 + $oModuleModel = &getModel('module'); + $mid_list = $oModuleModel->getMidList(); + Context::set('mid_list', $mid_list); + + // 레이아웃을 팝업으로 지정 + $this->setLayoutFile('popup_layout'); + + // 템플릿 파일 지정 + $this->setTemplateFile('mid_list'); + } + + /** + * @brief 레이아웃 목록을 보여줌 + **/ + function dispLayoutAdminDownloadedList() { + // 레이아웃 목록을 세팅 + $oLayoutModel = &getModel('layout'); + $layout_list = $oLayoutModel->getDownloadedLayoutList(); + Context::set('layout_list', $layout_list); + + $this->setTemplateFile('downloaded_layout_list'); + } + } +?> diff --git a/modules/layout/queries/deleteLayoutMenu.xml b/modules/menu/queries/deleteLayoutMenu.xml similarity index 100% rename from modules/layout/queries/deleteLayoutMenu.xml rename to modules/menu/queries/deleteLayoutMenu.xml diff --git a/modules/layout/queries/deleteLayoutMenus.xml b/modules/menu/queries/deleteLayoutMenus.xml similarity index 100% rename from modules/layout/queries/deleteLayoutMenus.xml rename to modules/menu/queries/deleteLayoutMenus.xml diff --git a/modules/layout/queries/getChildMenuCount.xml b/modules/menu/queries/getChildMenuCount.xml similarity index 100% rename from modules/layout/queries/getChildMenuCount.xml rename to modules/menu/queries/getChildMenuCount.xml diff --git a/modules/layout/queries/getLayoutMenu.xml b/modules/menu/queries/getLayoutMenu.xml similarity index 100% rename from modules/layout/queries/getLayoutMenu.xml rename to modules/menu/queries/getLayoutMenu.xml diff --git a/modules/layout/queries/getLayoutMenuList.xml b/modules/menu/queries/getLayoutMenuList.xml similarity index 100% rename from modules/layout/queries/getLayoutMenuList.xml rename to modules/menu/queries/getLayoutMenuList.xml diff --git a/modules/layout/queries/insertLayoutMenu.xml b/modules/menu/queries/insertLayoutMenu.xml similarity index 100% rename from modules/layout/queries/insertLayoutMenu.xml rename to modules/menu/queries/insertLayoutMenu.xml diff --git a/modules/layout/queries/updateLayoutMenu.xml b/modules/menu/queries/updateLayoutMenu.xml similarity index 100% rename from modules/layout/queries/updateLayoutMenu.xml rename to modules/menu/queries/updateLayoutMenu.xml diff --git a/modules/layout/queries/updateLayoutMenuParent.xml b/modules/menu/queries/updateLayoutMenuParent.xml similarity index 100% rename from modules/layout/queries/updateLayoutMenuParent.xml rename to modules/menu/queries/updateLayoutMenuParent.xml diff --git a/modules/layout/schemas/layout_menu.xml b/modules/menu/schemas/layout_menu.xml similarity index 100% rename from modules/layout/schemas/layout_menu.xml rename to modules/menu/schemas/layout_menu.xml diff --git a/modules/menu/tpl/downloaded_layout_list.html b/modules/menu/tpl/downloaded_layout_list.html new file mode 100644 index 000000000..3231995c4 --- /dev/null +++ b/modules/menu/tpl/downloaded_layout_list.html @@ -0,0 +1,39 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$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)} +
+
diff --git a/modules/menu/tpl/filter/delete_layout.xml b/modules/menu/tpl/filter/delete_layout.xml new file mode 100644 index 000000000..1e2961876 --- /dev/null +++ b/modules/menu/tpl/filter/delete_layout.xml @@ -0,0 +1,9 @@ + +
+ + + + + + +
diff --git a/modules/layout/tpl/filter/delete_layout_menu.xml b/modules/menu/tpl/filter/delete_layout_menu.xml similarity index 100% rename from modules/layout/tpl/filter/delete_layout_menu.xml rename to modules/menu/tpl/filter/delete_layout_menu.xml diff --git a/modules/menu/tpl/filter/insert_layout.xml b/modules/menu/tpl/filter/insert_layout.xml new file mode 100644 index 000000000..9b5b52c1a --- /dev/null +++ b/modules/menu/tpl/filter/insert_layout.xml @@ -0,0 +1,14 @@ + +
+ + + + + + + + + + + +
diff --git a/modules/layout/tpl/filter/insert_layout_menu.xml b/modules/menu/tpl/filter/insert_layout_menu.xml similarity index 100% rename from modules/layout/tpl/filter/insert_layout_menu.xml rename to modules/menu/tpl/filter/insert_layout_menu.xml diff --git a/modules/layout/tpl/filter/move_layout_menu.xml b/modules/menu/tpl/filter/move_layout_menu.xml similarity index 100% rename from modules/layout/tpl/filter/move_layout_menu.xml rename to modules/menu/tpl/filter/move_layout_menu.xml diff --git a/modules/menu/tpl/filter/update_layout_info.xml b/modules/menu/tpl/filter/update_layout_info.xml new file mode 100644 index 000000000..1cf5f5dc6 --- /dev/null +++ b/modules/menu/tpl/filter/update_layout_info.xml @@ -0,0 +1,9 @@ + +
+ + + + + + +
diff --git a/modules/menu/tpl/header.html b/modules/menu/tpl/header.html new file mode 100644 index 000000000..c905d679f --- /dev/null +++ b/modules/menu/tpl/header.html @@ -0,0 +1,8 @@ + + + +
+ style="font-weight:bold">[{$lang->layout_list}] + style="font-weight:bold">[{$lang->downloaded_list}] +
+ diff --git a/modules/menu/tpl/index.html b/modules/menu/tpl/index.html new file mode 100644 index 000000000..5c7f4dfb9 --- /dev/null +++ b/modules/menu/tpl/index.html @@ -0,0 +1,41 @@ + + + + +
+ {$lang->total_count} {number_format(count($layout_list))} +
+ + +
+ +
+ + +
+ + + + + + + + + + + + + + + + + + + +
{$lang->no}{$lang->layout}{$lang->title}{$lang->regdate}{$lang->cmd_delete}
{$no+1}{$val->layout}{htmlspecialchars($val->title)}{zdate($val->regdate,"Y-m-d")}{$lang->cmd_delete}
+
+ + +
+ [{$lang->cmd_make}] +
diff --git a/modules/menu/tpl/insert_layout.html b/modules/menu/tpl/insert_layout.html new file mode 100644 index 000000000..50a4ef471 --- /dev/null +++ b/modules/menu/tpl/insert_layout.html @@ -0,0 +1,33 @@ + + + + +
+
+ + + + + + + + + + + + + + + +
{$lang->layout_name} + +
{$lang->title}
{$lang->about_title}
+ + +
+
+
diff --git a/modules/menu/tpl/js/layout_admin.js b/modules/menu/tpl/js/layout_admin.js new file mode 100644 index 000000000..0cea141a2 --- /dev/null +++ b/modules/menu/tpl/js/layout_admin.js @@ -0,0 +1,146 @@ +/* 레이아웃 신규 생성시 완료 후 요청하는 함수 */ +function completeInsertLayout(ret_obj) { + var layout_srl = ret_obj['layout_srl']; + var url = location.href.setQuery('act','dispLayoutAdminMenu').setQuery('layout_srl',layout_srl); + location.href = url; +} + +/* 레이아웃메뉴 입력후 */ +function completeInsertLayoutMenu(ret_obj) { + var menu_id = ret_obj['menu_id']; + var xml_file = ret_obj['xml_file']; + var menu_title = ret_obj['menu_title']; + var menu_srl = ret_obj['menu_srl']; + + if(!xml_file) return; + loadTreeMenu(xml_file, menu_id, "menu_zone_"+menu_id, menu_title, doGetMenuInfo, menu_srl, doMoveTree); + + if(!menu_srl) xInnerHtml("menu_zone_info_"+menu_id, ""); +} + +/* 레이아웃 삭제 */ +function doDeleteLayout(layout_srl) { + var fo_obj = xGetElementById("fo_layout"); + if(!fo_obj) return; + fo_obj.layout_srl.value = layout_srl; + + procFilter(fo_obj, delete_layout); +} + +/* 레이아웃 메뉴 삭제 */ +function doDeleteLayoutMenu(menu_srl, menu_id) { + var fo_obj = xGetElementById("fo_"+menu_id); + if(!fo_obj) return; + + procFilter(fo_obj, delete_layout_menu); +} + +/* 레이아웃 메뉴에를 클릭시 적용할 함수 */ +function doGetMenuInfo(menu_id, obj) { + // layout, menu_id, node_srl을 추출 + var fo_obj = xGetElementById("fo_layout"); + var layout = fo_obj.layout.value; + var node_srl = 0; + var parent_srl = 0; + if(typeof(obj.getAttribute)!="undefined") { + node_srl = obj.getAttribute("node_srl"); + } else { + node_srl = obj.node_srl; + parent_srl = obj.parent_srl; + } + + var params = new Array(); + params["menu_id"] = menu_id; + params["layout"] = layout; + params["menu_srl"] = node_srl; + params["parent_srl"] = parent_srl; + + // 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다. + var response_tags = new Array('error','message','menu_id', 'tpl'); + exec_xml('layout', 'getLayoutAdminMenuTplInfo', params, completeGetMenuInfo, response_tags, params); +} + +/* 메뉴를 드래그하여 이동한 후 실행할 함수 , 이동하는 node_srl과 대상 node_srl을 받음 */ +function doMoveTree(menu_id, source_node_srl, target_node_srl) { + var fo_obj = xGetElementById("fo_move_menu"); + fo_obj.menu_id.value = menu_id; + fo_obj.source_node_srl.value = source_node_srl; + fo_obj.target_node_srl.value = target_node_srl; + + // 이동 취소를 선택하였을 경우 다시 그림;; + if(!procFilter(fo_obj, move_layout_menu)) { + var params = new Array(); + params["menu_id"] = menu_id; + params["source_node_srl"] = source_node_srl; + completeMoveLayoutMenu(params); + } +} + +function completeMoveLayoutMenu(ret_obj) { + var menu_id = ret_obj['menu_id']; + var source_node_srl = ret_obj['source_node_srl']; + + var fo_menu = xGetElementById("fo_"+menu_id); + if(!fo_menu) return; + + var params = new Array(); + params["menu_id"] = menu_id; + params["layout"] = fo_menu.layout.value; + params["layout_srl"] = fo_menu.layout_srl.value; + var xml_file = fo_menu.xml_file.value; + var menu_title = fo_menu.menu_title.value; + var tmp = source_node_srl.split('_'); + var menu_srl = tmp[tmp.length-1]; + loadTreeMenu(xml_file, menu_id, "menu_zone_"+menu_id, menu_title, doGetMenuInfo, menu_srl, doMoveTree); +} + +/* 서버로부터 받아온 메뉴 정보를 출력 */ +function completeGetMenuInfo(ret_obj, response_tags) { + var menu_id = ret_obj['menu_id']; + var tpl = ret_obj['tpl']; + xInnerHtml("menu_zone_info_"+menu_id, ""); + xInnerHtml("menu_zone_info_"+menu_id, tpl); + + var fo_obj = xGetElementById("fo_"+menu_id); + fo_obj.menu_name.focus(); +} + +/* 빈 메뉴 추가시 사용 */ +function doInsertLayoutMenu(menu_id, parent_srl) { + if(typeof(parent_srl)=='undefined') parent_srl = 0; + var params = {node_srl:0, parent_srl:parent_srl} + doGetMenuInfo(menu_id, params); + deSelectNode(); +} + +/* 메뉴 목록 갱신 */ +function doReloadTreeMenu(menu_id) { + var fo_obj = xGetElementById("fo_"+menu_id); + if(!fo_obj) return; + + var params = new Array(); + params["menu_id"] = menu_id; + params["layout"] = fo_obj.layout.value; + params["layout_srl"] = fo_obj.layout_srl.value; + + // 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다. + var response_tags = new Array('error','message','menu_id', 'xml_file', 'menu_title'); + exec_xml('layout', 'procLayoutAdminMakeXmlFile', params, completeInsertLayoutMenu, response_tags, params); +} + +/* 레이아웃의 메뉴에 mid 추가 */ +function doInsertMid(mid, menu_id) { + if(!opener) { + window.close(); + return; + } + + var fo_obj = opener.xGetElementById("fo_"+menu_id); + if(!fo_obj) { + window.close(); + return; + } + + fo_obj.menu_url.value = "mid="+mid; + window.close(); +} diff --git a/modules/menu/tpl/layout_detail_info.html b/modules/menu/tpl/layout_detail_info.html new file mode 100644 index 000000000..7bff986fa --- /dev/null +++ b/modules/menu/tpl/layout_detail_info.html @@ -0,0 +1,56 @@ + +++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->layout_maker}
{$lang->title}{$layout_info->title} ver {$layout_info->version}
{$lang->author}{$layout_info->author->name}
{$lang->homepage}{$layout_info->author->homepage}
{$lang->regdate}{$layout_info->author->date}
{$lang->description}{nl2br($layout_info->author->description)}
{$lang->layout_history}
{$lang->name}{$history->name}
{$lang->homepage}{$history->homepage}
{$lang->regdate}{$history->date}
{$lang->description}{nl2br($history->description)}
+ {$lang->cmd_close} +
diff --git a/modules/menu/tpl/layout_info.html b/modules/menu/tpl/layout_info.html new file mode 100644 index 000000000..085b2c146 --- /dev/null +++ b/modules/menu/tpl/layout_info.html @@ -0,0 +1,129 @@ + + + + + + + + +
+ + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
{$lang->layout}{$layout_info->title} ver {$layout_info->version} ({$layout_info->layout})
{$lang->path}{$layout_info->path}
{$lang->author}{$layout_info->author->name}
{$lang->description}{nl2br($layout_info->author->description)}
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
{$lang->title}
{$var->name} + +
{$var->description}
+ + + + + + +
+ +
+
+ +
+
+

{$lang->menu_management}

+
{nl2br($lang->about_menu_management)}
+
+ + +
+ + + + + + + + + + + + + +
+ +
+ +
+
+ + + + +
+
+ +
+
+ +
+ +
diff --git a/modules/layout/tpl/layout_menu_info.html b/modules/menu/tpl/layout_menu_info.html similarity index 100% rename from modules/layout/tpl/layout_menu_info.html rename to modules/menu/tpl/layout_menu_info.html diff --git a/modules/layout/tpl/mid_list.html b/modules/menu/tpl/mid_list.html similarity index 100% rename from modules/layout/tpl/mid_list.html rename to modules/menu/tpl/mid_list.html diff --git a/modules/module/queries/insertModule.xml b/modules/module/queries/insertModule.xml index 123a0b8d1..5d9ce8375 100644 --- a/modules/module/queries/insertModule.xml +++ b/modules/module/queries/insertModule.xml @@ -15,7 +15,6 @@ - diff --git a/modules/module/queries/updateModule.xml b/modules/module/queries/updateModule.xml index db781d1f2..3412f9015 100644 --- a/modules/module/queries/updateModule.xml +++ b/modules/module/queries/updateModule.xml @@ -13,7 +13,6 @@ - diff --git a/modules/page/page.controller.php b/modules/page/page.controller.php index 53c1e15e2..946d4f0ec 100644 --- a/modules/page/page.controller.php +++ b/modules/page/page.controller.php @@ -18,7 +18,7 @@ **/ function procPageAdminInsert() { // 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리 - $args = Context::gets('module_srl','layout_srl','module_category_srl','page_name','browser_title','content','is_default'); + $args = Context::gets('module_srl','module_category_srl','page_name','browser_title','content','is_default'); $args->module = 'page'; $args->mid = $args->page_name; unset($args->page_name); diff --git a/modules/page/page.view.php b/modules/page/page.view.php index 306af1a14..df3d9499f 100644 --- a/modules/page/page.view.php +++ b/modules/page/page.view.php @@ -121,10 +121,6 @@ * @brief 페이지 추가 폼 출력 **/ function dispPageAdminInsert() { - // 레이아웃 목록을 구해옴 - $oLayoutMode = &getModel('layout'); - $layout_list = $oLayoutMode->getLayoutList(); - Context::set('layout_list', $layout_list); // GET parameter에서 module_srl을 가져옴 $module_srl = Context::get('module_srl'); diff --git a/modules/page/tpl/page_insert.html b/modules/page/tpl/page_insert.html index 9ff54455f..8f6700e53 100644 --- a/modules/page/tpl/page_insert.html +++ b/modules/page/tpl/page_insert.html @@ -45,20 +45,6 @@ {$lang->about_browser_title} - - {$lang->layout} - - - - - - {$lang->about_layout} -