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

This commit is contained in:
zero 2007-04-19 08:39:57 +00:00
parent 312976465c
commit d0f90bf3c9
17 changed files with 164 additions and 66 deletions

View file

@ -397,25 +397,15 @@
**/
function procBlogAdminInsertCategory() {
// 입력할 변수 정리
$source_args = Context::getRequestVars();
unset($source_args->module);
unset($source_args->act);
$args = Context::gets('module_srl','category_srl','parent_srl','name','expand','group_srls');
if($source_args->expand !="Y") $source_args->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->module_srl = $source_args->module_srl;
$args->category_srl = $source_args->category_srl;
$args->parent_srl = $source_args->parent_srl;
$args->name = $source_args->menu_name;
$args->expand = $source_args->menu_expand;
$args->group_srls = $source_args->group_srls;
if($args->expand !="Y") $args->expand = "N";
$args->group_srls = str_replace('|@|',',',$args->group_srls);
$args->parent_srl = (int)$args->parent_srl;
// 이미 존재하는지를 확인
$oBlogModel = &getModel('blog');
$category_info = $oMenuModel->getCategoryInfo($args->category_srl);
$category_info = $oBlogModel->getCategoryInfo($args->category_srl);
// 존재하게 되면 update를 해준다
if($category_info->category_srl == $args->category_srl) {
@ -433,12 +423,58 @@
$xml_file = $this->makeXmlFile($args->module_srl);
$this->add('xml_file', $xml_file);
$this->add('module_srl', $args->menu_srl);
$this->add('category_srl', $args->menu_item_srl);
$this->add('category_title', $category_title);
$this->add('module_srl', $args->module_srl);
$this->add('category_srl', $args->category_srl);
$this->add('parent_srl', $args->parent_srl);
}
/**
* @brief 카테고리 삭제
**/
function procBlogAdminDeleteCategory() {
// 변수 정리
$args = Context::gets('module_srl','category_srl');
$oBlogModel = &getModel('blog');
// 원정보를 가져옴
$category_info = $oBlogModel->getCategoryInfo($args->category_srl);
if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
// 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력
$output = executeQuery('blog.getChildCategoryCount', $args);
if(!$output->toBool()) return $output;
if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
// DB에서 삭제
$output = executeQuery("blog.deleteCategory", $args);
if(!$output->toBool()) return $output;
// XML 파일을 갱신하고 위치을 넘겨 받음
$xml_file = $this->makeXmlFile($args->module_srl);
$this->add('xml_file', $xml_file);
$this->add('category_srl', $parent_srl);
$this->setMessage('success_deleted');
}
/**
* @brief xml 파일을 갱신
* 관리자페이지에서 메뉴 구성 간혹 xml파일이 재생성 안되는 경우가 있는데\n
* 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n
* 개발 중간의 문제인 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능
**/
function procBlogAdminMakeXmlFile() {
// 입력값을 체크
$module_srl = Context::get('module_srl');
// xml파일 재생성
$xml_file = $this->makeXmlFile($module_srl);
// return 값 설정
$this->add('xml_file',$xml_file);
}
/**
* @brief 블로그 카테고리를 xml파일로 저장
**/

View file

@ -20,14 +20,7 @@
* 생성된 메뉴의 DB정보+XML정보를 return
**/
function getCategory($module_srl) {
// 일단 DB에서 정보를 가져옴
$args->module_srl = $module_srl;
$output = executeQuery('blog.getCategory', $args);
if(!$output->data) return;
$category_info = $output->data;
$category_info->xml_file = sprintf('./files/cache/blog_category/%s.xml.php',$module_srl);
$category_info->php_file = sprintf('./files/cache/blog_category/%s.php',$module_srl);
return $category_info;
}
@ -37,7 +30,7 @@
**/
function getCategoryInfo($category_srl) {
// category_srl이 있으면 해당 메뉴의 정보를 가져온다
$args->category_srl= $menu_item_srl;
$args->category_srl= $category_srl;
$output = executeQuery('blog.getCategoryInfo', $args);
$node = $output->data;
if($node->group_srls) $node->group_srls = explode(',',$node->group_srls);

View file

@ -531,11 +531,11 @@
**/
function dispBlogAdminCategoryInfo() {
// module_srl을 구함
$module_srl = Context::get('module_srl');
$module_srl = $this->module_info->module_srl;
// 메뉴의 정보를 가져옴
$oMenuModel = &getModel('blog');
$category_info = $oMenuModel->getCategory($module_srl);
// 카테고리 정보를 가져옴
$oBlogModel = &getModel('blog');
$category_info = $oBlogModel->getCategory($module_srl);
Context::set('category_info', $category_info);

View file

@ -62,5 +62,7 @@
<action name="procBlogAdminInsertBlog" type="controller" standalone="true" />
<action name="procBlogAdminDeleteBlog" type="controller" standalone="true" />
<action name="procBlogAdminInsertCategory" type="controller" standalone="true" />
<action name="procBlogAdminDeleteCategory" type="controller" standalone="true" />
<action name="procBlogAdminMakeXmlFile" type="controller" standalone="true" />
</actions>
</module>

View file

@ -59,4 +59,5 @@
$lang->msg_grant_is_null = '등록된 권한 대상이 없습니다';
$lang->msg_no_checked_document = '선택된 게시물이 없습니다';
$lang->msg_move_failed = '이동 실패하였습니다';
$lang->msg_cannot_delete_for_child = '하부 카테고리가 있는 카테고리는 삭제하실 수 없습니다';
?>

View file

@ -0,0 +1,8 @@
<query id="deleteCategory" action="delete">
<tables>
<table name="blog_category" />
</tables>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,14 @@
<query id="getBlogCategories" action="select">
<tables>
<table name="blog_category" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="equal" column="module_srl" var="module_srl" filter="number" notnull="notnull" />
</conditions>
<navigation>
<index var="sort_index" default="listorder" order="desc" />
</navigation>
</query>

View file

@ -0,0 +1,11 @@
<query id="getChildCategoryCount" action="select">
<tables>
<table name="blog_category" />
</tables>
<columns>
<column name="count(*)" alias="count" />
</columns>
<conditions>
<condition operation="equal" column="parent_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,15 @@
<query id="insertCategory" action="insert">
<tables>
<table name="blog_category" />
</tables>
<columns>
<column name="category_srl" var="category_srl" filter="number" notnull="notnull" />
<column name="parent_srl" var="parent_srl" filter="number" default="0" />
<column name="module_srl" var="module_srl" filter="number" notnull="notnull" />
<column name="name" var="name" notnull="notnull" />
<column name="expand" var="expand" />
<column name="group_srls" var="group_srls" />
<column name="listorder" var="listorder" notnull="notnull" />
<column name="regdate" var="regdate" default="curdate()" />
</columns>
</query>

View file

@ -0,0 +1,13 @@
<query id="updateCategory" action="update">
<tables>
<table name="blog_category" />
</tables>
<columns>
<column name="name" var="name" notnull="notnull" />
<column name="expand" var="expand" />
<column name="group_srls" var="group_srls" />
</columns>
<conditions>
<condition operation="equal" column="category_srl" var="category_srl" filter="number" notnull="notnull" />
</conditions>
</query>

View file

@ -1,7 +1,7 @@
<table name="blog_category">
<column name="module_srl" type="number" size="12" notnull="notnull" primary_key="primary_key" />
<column name="category_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="category_srl" type="number" size="12" notnull="notnull" index="idx_menu_srl" />
<column name="module_srl" type="number" size="12" notnull="notnull" index="idx_module_srl" />
<column name="name" type="varchar" size="250" />
<column name="expand" type="char" size="1" default="N" />
<column name="group_srls" type="text" />

View file

@ -12,7 +12,7 @@
<!--@end-->
<tr>
<th rowspan="2">{$lang->category_name}</th>
<td><input type="text" name="name" value="{htmlspecialchars($category_info->name)}" /></td>
<td><input type="text" name="category_name" value="{htmlspecialchars($category_info->name)}" /></td>
</tr>
<tr>
<td>{$lang->about_category_name}</td>
@ -41,7 +41,7 @@
<!--@if($category_info->name)-->
<input type="submit" value="{$lang->cmd_save}" />
<input type="button" value="{$lang->cmd_make_child}" onclick="doInsertCategory('{$category_info->category_srl}');return false" />
<input type="button" value="{$lang->cmd_delete}" onclick="doDeleteCategoryItem('{$category_srl->category_srl}');return false" />
<input type="button" value="{$lang->cmd_delete}" onclick="doDeleteCategory('{$category_srl->category_srl}');return false" />
<!--@else-->
<input type="submit" value="{$lang->cmd_submit}" />
<!--@end-->

View file

@ -3,38 +3,39 @@
<!--%import("filter/move_category.xml")-->
<!--#include("./header.html")-->
<script type="text/javascript">
var category_title = "{$lang->category}";
</script>
<!-- 카테고리의 위/아래, 삭제와 관련된 form -->
<form id="fo_move_category" action="./" method="get">
<input type="hidden" name="category_id" />
<input type="hidden" name="source_category_srl" />
<input type="hidden" name="target_category_srl" />
</form>
<div style="margin-bottom:10px;">
<form id="fo_category" action="./" method="get" onsubmit="return procFilter(this, insert_category)">
<input type="hidden" name="category_title" value="category" />
<input type="hidden" name="module_srl" value="{$category_info->module_srl}" />
<input type="hidden" name="module_srl" value="{$module_info->module_srl}" />
<input type="hidden" name="xml_file" value="{$category_info->xml_file}" />
<input type="hidden" name="php_file" value="{$category_info->php_file}" />
<table border="1" width="100%">
<col width="320" />
<col width="*" />
<tr valign="top">
<td>
<div id="category_zone_category"></div>
<div id="zone_category"></div>
<div>
<input type="checkbox" id="category_enable_move" /> <label for="category_enable_move">{$lang->cmd_enable_move_category}</label>
<input type="checkbox" id="menu_enable_move" /> <label for="menu_enable_move">{$lang->cmd_enable_move_category}</label>
</div>
<div>
<input type="button" value="{$lang->cmd_insert}" onclick="doInsertCategory(0);return false;" />
<input type="button" value="{$lang->cmd_open_all}" onclick="openAllTreeMenu('category');return false;" />
<input type="button" value="{$lang->cmd_close_all}" onclick="closeAllTreeMenu('category');return false;" />
<input type="button" value="{$lang->cmd_remake_cache}" onclick="doReloadTreeCategory('{$category_info->category_srl}');return false;" />
<input type="button" value="{$lang->cmd_remake_cache}" onclick="doReloadTreeCategory('{$module_info->module_srl}');return false;" />
</div>
</td>
<td>
<div id="category_zone_info"></div>
<div id="category_info"></div>
</td>
</tr>
</table>
@ -42,6 +43,6 @@
</form>
<script type="text/javascript">
loadTreeMenu("{$category_info->xml_file}", "category", "category_zone_category", "{$lang->category}", doGetCategoryInfo, 0, doMoveTree);
loadTreeMenu("{$category_info->xml_file}", "category", "zone_category", category_title, doGetCategoryInfo, 0, doMoveTree);
</script>
</div>

View file

@ -2,12 +2,10 @@
<form>
<node target="category_srl" required="true" />
</form>
<response callback_func="completeDeleteBlogItem">
<response callback_func="completeDeleteCategory">
<tag name="error" />
<tag name="message" />
<tag name="category_title" />
<tag name="xml_file" />
<tag name="module_srl" />
<tag name="category_srl" />
</response>
</filter>

View file

@ -1,14 +1,23 @@
<filter name="insert_category" module="blog" act="procBlogAdminInsertCategory" confirm_msg_code="confirm_submit">
<form>
<node target="module_srl" required="true" />
<node target="category_srl" required="true" />
<node target="category_name" required="true" />
</form>
<parameter>
<param name="module_srl" target="module_srl" />
<param name="category_srl" target="category_srl" />
<param name="parent_srl" target="parent_srl" />
<param name="name" target="category_name" />
<param name="expand" target="expand" />
<param name="group_srls" target="group_srls" />
</parameter>
<response callback_func="completeInsertCategory">
<tag name="error" />
<tag name="message" />
<tag name="module_srl" />
<tag name="xml_file" />
<tag name="category_title" />
<tag name="category_srl" />
<tag name="parent_srl" />
<tag name="xml_file" />
</response>
</filter>

View file

@ -1,7 +1,7 @@
<filter name="move_category" module="menu" act="procBlogAdminMoveItem" confirm_msg_code="confirm_move">
<filter name="move_category" module="menu" act="procBlogAdminMoveCategory" confirm_msg_code="confirm_move">
<form />
<parameter />
<response callback_func="completeMoveBlogItem">
<response callback_func="completeMoveBlogCategory">
<tag name="error" />
<tag name="message" />
<tag name="xml_file" />

View file

@ -123,7 +123,7 @@ function completeManageDocument(ret_obj) {
function doInsertCategory(parent_srl) {
if(typeof(parent_srl)=='undefined') parent_srl = 0;
var params = {node_srl:0, parent_srl:parent_srl}
doGetCategoryInfo('category', params);
doGetCategoryInfo(null, params);
deSelectNode();
}
@ -155,28 +155,26 @@ function doGetCategoryInfo(category_id, obj) {
/* 서버로부터 받아온 카테고리 정보를 출력 */
function completeGetCategoryTplInfo(ret_obj, response_tags) {
var tpl = ret_obj['tpl'];
xInnerHtml("category_zone_info", tpl);
xInnerHtml("category_info", tpl);
var fo_obj = xGetElementById("fo_category");
fo_obj.name.focus();
fo_obj.category_name.focus();
}
/* 카테고리 아이템 입력후 */
function completeInsertCategory(ret_obj) {
var category_id = ret_obj['category_id'];
var xml_file = ret_obj['xml_file'];
var category_title = ret_obj['category_title'];
var category_srl = ret_obj['category_srl'];
var category_category_srl = ret_obj['category_category_srl'];
var module_srl = ret_obj['module_srl'];
var parent_srl = ret_obj['parent_srl'];
if(!xml_file) return;
loadTreeMenu(xml_file, 'category', 'category_zone_category', category_title, doGetCategoryInfo, category_category_srl, doMoveTree);
loadTreeMenu(xml_file, 'category', 'zone_category', category_title, doGetCategoryInfo, category_srl, doMoveTree);
if(!category_srl) xInnerHtml("category_zone_info", "");
if(!category_srl) xInnerHtml("category_info", "");
else {
var params = {node_srl:category_zone_info, parent_srl:parent_srl}
doGetCategoryInfo('category', params)
var params = {node_srl:category_srl, parent_srl:parent_srl}
doGetCategoryInfo(null, params)
}
}
@ -209,17 +207,17 @@ function completeMoveCategory(ret_obj) {
}
/* 카테고리 목록 갱신 */
function doReloadTreeMenu(module_srl) {
function doReloadTreeCategory(module_srl) {
var params = new Array();
params["module_srl"] = module_srl;
// 서버에 요청하여 해당 노드의 정보를 수정할 수 있도록 한다.
var response_tags = new Array('error','message', 'xml_file', 'category_title');
var response_tags = new Array('error','message', 'xml_file');
exec_xml('blog', 'procBlogAdminMakeXmlFile', params, completeInsertCategory, response_tags, params);
}
/* 카테고리 삭제 */
function doDeleteCategoryItem(category_srl) {
function doDeleteCategory(category_srl) {
var fo_obj = xGetElementById("fo_category");
if(!fo_obj) return;
@ -228,13 +226,12 @@ function doDeleteCategoryItem(category_srl) {
/* 카테고리 아이템 삭제 후 */
function completeDeleteCategory(ret_obj) {
var category_title = ret_obj['category_title'];
var module_srl = ret_obj['module_srl'];
var category_srl = ret_obj['category_srl'];
var xml_file = ret_obj['xml_file'];
alert(ret_obj['message']);
loadTreeMenu(xml_file, 'category', 'category_zone_category', category_title, doGetCategoryInfo, category_srl, doMoveTree);
xInnerHtml("category_zone_info", "");
loadTreeMenu(xml_file, 'category', 'zone_category', category_title, doGetCategoryInfo, category_srl, doMoveTree);
xInnerHtml("category_info", "");
}