git-svn-id: http://xe-core.googlecode.com/svn/trunk@310 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-03-07 12:10:44 +00:00
parent 6ebf9a84f3
commit 42bc6d7daa
10 changed files with 82 additions and 8 deletions

View file

@ -39,6 +39,8 @@
$lang->cmd_unselect_all = "모두해제";
$lang->cmd_close_all = "모두닫기";
$lang->cmd_open_all = "모두열기";
$lang->cmd_reload = "다시읽기";
$lang->cmd_remake_cache = "캐시파일 재생성";
$lang->enable = '가능';
$lang->disable = '불가능';

View file

@ -11,5 +11,6 @@
<action name="procInsertLayout" type="controller" standalone="true" />
<action name="procInsertLayoutMenu" type="controller" standalone="true" />
<action name="procDeleteLayoutMenu" type="controller" standalone="true" />
<action name="procMakeXmlFile" type="controller" standalone="true" />
</actions>
</module>

View file

@ -4,6 +4,7 @@
* @author zero <zero@nzeo.com>
* @brief 레이아웃(layout) 모듈의 기본 언어팩
**/
$lang->cmd_make_child = '하부 메뉴 추가';
$lang->layout = '레이아웃';
$lang->layout_name = '레이아웃 이름';

View file

@ -39,9 +39,11 @@
unset($source_args->act);
if($source_args->menu_open_window!="Y") $source_args->menu_open_window = "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;
@ -122,6 +124,36 @@
$this->add('menu_title', $menu_title);
}
/**
* @brief xml 파일을 갱싱
**/
function procMakeXmlFile() {
// 입력값을 체크
$menu_id = Context::get('menu_id');
$layout = Context::get('layout');
$layout_srl = Context::get('layout_srl');
// 해당 메뉴의 정보를 구함
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfoXml($layout);
$navigations = $layout_info->navigations;
if(count($navigations)) {
foreach($navigations as $key => $val) {
if($menu_id == $val->id) {
$menu_title = $val->name;
}
}
}
// xml파일 재생성
$xml_file = $this->makeXmlFile($layout_srl);
// return 값 설정
$this->add('menu_id',$menu_id);
$this->add('menu_title',$menu_title);
$this->add('xml_file',$xml_file[$menu_id]);
}
/**
* @brief 메뉴의 xml 파일을 만들고 위치를 return
**/
@ -148,7 +180,8 @@
foreach($node_list as $node) {
$buff .= sprintf('<node node_srl="%s" text="%s" />', $node->menu_srl, $node->name);
}
$buff = "<root>".$buff."</root>";
if($buff) $buff = "<root>".$buff."</root>";
else $buff = "<root />";
$xml_file[$menu_id] = sprintf("./files/cache/layout/%s_%s.xml", $layout_srl, $menu_id);
FileHandler::writeFile($xml_file[$menu_id], $buff);

View file

@ -168,19 +168,28 @@
$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);
// menu_srl 이 있으면 해당 메뉴의 정보를 가져온다
if($menu_srl) $menu_info = $this->getLayoutMenuInfo($menu_srl);
if(!$menu_info->menu_srl) {
// parent_srl이 있고 menu_srl이 없으면 하부 메뉴 추가임
if(!$menu_srl && $parent_srl) {
$oDB = &DB::getInstance();
$menu_info->menu_srl = $oDB->getNextSequence();
$menu_info->parent_srl = $parent_srl;
} else {
// menu_srl 이 있으면 해당 메뉴의 정보를 가져온다
if($menu_srl) $menu_info = $this->getLayoutMenuInfo($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한다.

View file

@ -4,6 +4,7 @@
</tables>
<columns>
<column name="menu_srl" var="menu_srl" filter="number" notnull="notnull" />
<column name="parent_srl" var="parent_srl" filter="number" default="0" />
<column name="layout_srl" var="layout_srl" filter="number" notnull="notnull" />
<column name="menu_id" var="menu_id" filter="number" notnull="notnull" />
<column name="name" var="name" notnull="notnull" />

View file

@ -1,5 +1,6 @@
<table name="layout_menu">
<column name="menu_srl" type="number" size="12" notnull="notnull" primary_key="primary_key" />
<column name="parent_srl" type="number" size="12" notnull="notnull" default="0" />
<column name="layout_srl" type="number" size="12" notnull="notnull" index="idx_layout_menu" />
<column name="menu_id" type="varchar" size="250" notnull="notnull" index="idx_layout_menu" />
<column name="name" type="varchar" size="250" />

View file

@ -10,6 +10,8 @@ function completeInsertLayoutMenu(ret_obj) {
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);
if(!menu_srl) {
@ -31,25 +33,44 @@ function doGetMenuInfo(menu_id, obj) {
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', 'getMenuTplInfo', params, completeGetMenuInfo, response_tags, params);
}
/* 메뉴 목록 갱신 */
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', 'procMakeXmlFile', params, completeInsertLayoutMenu, response_tags, params);
}
/* 빈 메뉴 추가시 사용 */
function doInsertLayoutMenu(menu_id) {
var params = {node_srl:0}
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();
}
@ -58,5 +79,6 @@ function doInsertLayoutMenu(menu_id) {
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);
}

View file

@ -63,6 +63,7 @@
<input type="button" value="{$lang->cmd_insert}" onclick="doInsertLayoutMenu('{$val->id}');return false;" />
<input type="button" value="{$lang->cmd_open_all}" onclick="openAllTreeMenu('{$val->id}');return false;" />
<input type="button" value="{$lang->cmd_close_all}" onclick="closeAllTreeMenu('{$val->id}');return false;" />
<input type="button" value="{$lang->cmd_remake_cache}" onclick="doReloadTreeMenu('{$val->id}');return false;" />
</div>
</td>
<td>

View file

@ -1,4 +1,6 @@
<input type="hidden" name="menu_srl" value="{$menu_info->menu_srl}" />
<input type="hidden" name="parent_srl" value="{$menu_info->parent_srl}" />
<table border="1" width="100%">
<col width="100" />
<col width="*" />
@ -56,7 +58,8 @@
<td colspan="2">
<input type="submit" value="{$lang->cmd_submit}" />
<!--@if($menu_info->name)-->
<input type="button" value="{$lang->cmd_delete}" onclick="doDeleteLayoutMenu('{$menu_srl}','{$menu_info->menu_id}');return false"/>
<input type="button" value="{$lang->cmd_make_child}" onclick="doInsertLayoutMenu('{$menu_info->menu_id}','{$menu_info->menu_srl}');return false" />
<input type="button" value="{$lang->cmd_delete}" onclick="doDeleteLayoutMenu('{$menu_srl}','{$menu_info->menu_id}');return false" />
<!--@end-->
</td>
</tr>