mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/trunk@323 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
e8392161fe
commit
c32a8400d3
10 changed files with 107 additions and 51 deletions
|
|
@ -8,6 +8,7 @@
|
|||
<action name="getLayoutMenuSrl" type="model" standalone="true" />
|
||||
<action name="getMenuTplInfo" type="model" standalone="true" />
|
||||
<action name="procInsertLayout" type="controller" standalone="true" />
|
||||
<action name="procUpdateLayout" type="controller" standalone="true" />
|
||||
<action name="procDeleteLayout" type="controller" standalone="true" />
|
||||
<action name="procInsertLayoutMenu" type="controller" standalone="true" />
|
||||
<action name="procDeleteLayoutMenu" type="controller" standalone="true" />
|
||||
|
|
|
|||
|
|
@ -30,6 +30,30 @@
|
|||
$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 캐시 파일도 삭제
|
||||
|
|
@ -105,7 +129,7 @@
|
|||
}
|
||||
|
||||
// 해당 메뉴의 정보를 구함
|
||||
$layout_info = $oLayoutModel->getLayoutInfoXml($layout);
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($layout);
|
||||
$menu_title = $layout_info->menu->{$args->menu_id}->name;
|
||||
|
||||
// XML 파일을 갱신하고 위치을 넘겨 받음
|
||||
|
|
@ -143,7 +167,7 @@
|
|||
if(!$output->toBool()) return $output;
|
||||
|
||||
// 해당 메뉴의 정보를 구함
|
||||
$layout_info = $oLayoutModel->getLayoutInfoXml($args->layout);
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($args->layout);
|
||||
$menu_title = $layout_info->menu->{$args->menu_id}->name;
|
||||
|
||||
// XML 파일을 갱신하고 위치을 넘겨 받음
|
||||
|
|
@ -169,7 +193,7 @@
|
|||
|
||||
// 해당 메뉴의 정보를 구함
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayoutInfoXml($layout);
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($layout);
|
||||
$menu_title = $layout_info->menu->{$menu_id}->name;
|
||||
|
||||
// xml파일 재생성
|
||||
|
|
|
|||
|
|
@ -29,15 +29,22 @@
|
|||
|
||||
/**
|
||||
* @brief DB 에 생성된 한개의 레이아웃 정보를 구함
|
||||
* 생성된 레이아웃의 DB정보를 return
|
||||
* 생성된 레이아웃의 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 $output->data;
|
||||
return $this->getLayoutInfo($layout, $layout_srl, $layout_title, $vars);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -72,7 +79,7 @@
|
|||
$layout = $searched_list[$i];
|
||||
|
||||
// 해당 레이아웃의 정보를 구함
|
||||
$layout_info = $this->getLayoutInfoXml($layout);
|
||||
$layout_info = $this->getLayoutInfo($layout);
|
||||
|
||||
$list[] = $layout_info;
|
||||
}
|
||||
|
|
@ -83,7 +90,7 @@
|
|||
* @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함
|
||||
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
|
||||
**/
|
||||
function getLayoutInfoXml($layout, $layout_srl = 0) {
|
||||
function getLayoutInfo($layout, $layout_srl = 0, $layout_title = "", $vars = null) {
|
||||
// 요청된 모듈의 경로를 구한다. 없으면 return
|
||||
$layout_path = $this->getLayoutPath($layout);
|
||||
if(!$layout_path) return;
|
||||
|
|
@ -112,6 +119,8 @@
|
|||
$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);
|
||||
|
|
@ -129,15 +138,16 @@
|
|||
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->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);
|
||||
|
||||
$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('$layout_info->extra_var->%s->options[] = "%s";', $var->attrs->id, $options[$i]->body);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,21 +45,12 @@
|
|||
// 선택된 레이아웃의 정보르 구해서 세팅
|
||||
$layout_srl = Context::get('layout_srl');
|
||||
|
||||
// DB에 등록된 레이아웃의 정보를 가져옴
|
||||
// 레이아웃의 정보를 가져옴
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($layout_srl);
|
||||
|
||||
// 등록된 레이아웃이 없으면 오류 표시
|
||||
if(!$layout_info) return $this->dispContent();
|
||||
$layout_title = $layout_info->title;
|
||||
|
||||
// xml 정보를 가져옴
|
||||
$layout = $layout_info->layout;
|
||||
$layout_info = $oLayoutModel->getLayoutInfoXml($layout, $layout_srl);
|
||||
|
||||
// 기본 layout_info에 세부 정보를 입력할 layout_srl, layout_title을 추가
|
||||
$layout_info->layout_srl = $layout_srl;
|
||||
$layout_info->layout_title = $layout_title;
|
||||
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
|
|
|
|||
12
modules/layout/queries/updateLayout.xml
Normal file
12
modules/layout/queries/updateLayout.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<query id="updateLayout" action="update">
|
||||
<tables>
|
||||
<table name="layouts" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="title" var="title" notnull="notnull" />
|
||||
<column name="extra_vars" var="extra_vars" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="layout_srl" var="layout_srl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
|
|
@ -2,6 +2,6 @@
|
|||
<column name="layout_srl" type="number" size="12" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="layout" type="varchar" size="250" />
|
||||
<column name="title" type="varchar" size="250" />
|
||||
<column name="config" type="text" />
|
||||
<column name="extra_vars" type="text" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
</table>
|
||||
|
|
|
|||
9
modules/layout/tpl.admin/filter/update_layout_info.xml
Normal file
9
modules/layout/tpl.admin/filter/update_layout_info.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<filter name="update_layout_info" module="layout" act="procUpdateLayout" confirm_msg_code="confirm_submit">
|
||||
<form>
|
||||
<node target="title" required="true" />
|
||||
</form>
|
||||
<response>
|
||||
<tag name="error" />
|
||||
<tag name="message" />
|
||||
</response>
|
||||
</filter>
|
||||
|
|
@ -19,6 +19,15 @@ function completeInsertLayoutMenu(ret_obj) {
|
|||
}
|
||||
}
|
||||
|
||||
/* 레이아웃 삭제 */
|
||||
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);
|
||||
|
|
@ -52,6 +61,25 @@ function doGetMenuInfo(menu_id, obj) {
|
|||
exec_xml('layout', 'getMenuTplInfo', params, completeGetMenuInfo, response_tags, params);
|
||||
}
|
||||
|
||||
/* 서버로부터 받아온 메뉴 정보를 출력 */
|
||||
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);
|
||||
|
|
@ -66,28 +94,3 @@ function doReloadTreeMenu(menu_id) {
|
|||
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, 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 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);
|
||||
}
|
||||
|
||||
/* 레이아웃 삭제 */
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
<!--%import("js/admin.js")-->
|
||||
<!--%import("filter/update_layout_info.xml")-->
|
||||
<!--%import("filter/insert_layout_menu.xml")-->
|
||||
<!--%import("filter/delete_layout_menu.xml")-->
|
||||
|
||||
|
|
@ -26,7 +27,7 @@
|
|||
</div>
|
||||
|
||||
<div style="margin-bottom:10px;">
|
||||
<form id="fo_layout" action="./" method="post" enctype="multipart/form-data">
|
||||
<form id="fo_layout" action="./" method="get" onsubmit="return procFilter(this, update_layout_info)">
|
||||
<input type="hidden" name="layout_srl" value="{$layout_srl}" />
|
||||
<input type="hidden" name="layout" value="{$layout_info->layout}" />
|
||||
|
||||
|
|
@ -41,19 +42,24 @@
|
|||
<tr>
|
||||
<th>{$var->name}</th>
|
||||
<!--@if($var->type == "text")-->
|
||||
<td><input type="text" name="{$id}" value="" /></td>
|
||||
<td><input type="text" name="{$id}" value="{$var->value}" /></td>
|
||||
<!--@elseif($var->type == "textarea")-->
|
||||
<td><textarea name="{$id}"></textarea></td>
|
||||
<td><textarea name="{$id}">{$var->value}</textarea></td>
|
||||
<!--@elseif($var->type == "select")-->
|
||||
<td>
|
||||
<select name="{$id}">
|
||||
<!--@foreach($var->options as $key => $val)-->
|
||||
<option value="{$val}">{$val}</option>
|
||||
<option value="{$val}" <!--@if($val==$var->value)-->selected="true"<!--@end-->>{$val}</option>
|
||||
<!--@end-->
|
||||
</select>
|
||||
<!--@end-->
|
||||
</tr>
|
||||
<!--@end-->
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" value="{$lang->cmd_save}" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
</form>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue