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

This commit is contained in:
zero 2007-04-19 07:29:25 +00:00
parent 69f30ea239
commit 6f8106b90d
7 changed files with 185 additions and 1 deletions

View file

@ -30,6 +30,9 @@
$oModuleController->insertActionForward('blog', 'view', 'dispBlogAdminGrantInfo');
$oModuleController->insertActionForward('blog', 'controller', 'procBlogAdminUpdateSkinInfo');
// 캐쉬로 사용할 디렉토리 생성
FileHandler::makeDir('./files/cache/blog_category');
return new Object();
}

View file

@ -0,0 +1,95 @@
<?php
/**
* @class blogModel
* @author zero (zero@nzeo.com)
* @version 0.1
* @brief blog 모듈의 Model class
**/
class blogModel extends blog {
/**
* @brief 초기화
**/
function init() {
}
/**
* @brief DB 생성된 카테고리 정보를 구함
* 생성된 메뉴의 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;
}
/**
* @brief 특정 카테고리의 정보를 return
* 정보중에 group_srls의 경우는 , 연결되어 들어가며 사용시에는 explode를 통해 array로 변환 시킴
**/
function getCategoryInfo($category_srl) {
// category_srl이 있으면 해당 메뉴의 정보를 가져온다
$args->category_srl= $menu_item_srl;
$output = executeQuery('blog.getCategoryInfo', $args);
$node = $output->data;
if($node->group_srls) $node->group_srls = explode(',',$node->group_srls);
else $node->group_srls = array();
return $node;
}
/**
* @brief 특정 카테고리의 정보를 이용하여 템플릿을 구한후 return
* 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 html을 직접 return
**/
function getCategoryAdminTplInfo() {
// 해당 메뉴의 정보를 가져오기 위한 변수 설정
$category_srl = Context::get('category_srl');
$parent_srl = Context::get('parent_srl');
// 회원 그룹의 목록을 가져옴
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// parent_srl이 있고 category_srl 이 없으면 하부 메뉴 추가임
if(!$category_srl && $parent_srl) {
// 상위 메뉴의 정보를 가져옴
$parent_info = $this->getCategoryInfo($parent_srl);
// 추가하려는 메뉴의 기본 변수 설정
$category_info->category_srl = getNextSequence();
$category_info->parent_srl = $parent_srl;
$category_info->parent_category_name = $parent_info->name;
// root에 메뉴 추가하거나 기존 메뉴의 수정일 경우
} else {
// category_srl 이 있으면 해당 메뉴의 정보를 가져온다
if($category_srl) $category_info = $this->getCategoryInfo($category_srl);
// 찾아진 값이 없다면 신규 메뉴 추가로 보고 category_srl값만 구해줌
if(!$category_info->category_srl) {
$category_info->category_srl = getNextSequence();
}
}
Context::set('category_info', $category_info);
// template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다.
require_once("./classes/template/TemplateHandler.class.php");
$oTemplate = new TemplateHandler();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'category_info');
// return 할 변수 설정
$this->add('tpl', $tpl);
}
}
?>

View file

@ -530,10 +530,15 @@
* @brief 카테고리의 정보 출력
**/
function dispBlogAdminCategoryInfo() {
// module_srl을 구함
$module_srl = Context::get('module_srl');
// 메뉴의 정보를 가져옴
$oMenuModel = &getModel('blog');
$category_info = $oMenuModel->getCategory($module_srl);
Context::set('category_info', $category_info);
$this->setTemplateFile('category_list');
}

View file

@ -13,12 +13,17 @@
$lang->cmd_manage_grant = '권한관리';
$lang->cmd_manage_skin = '스킨관리';
$lang->cmd_manage_document = '게시글 관리';
$lang->cmd_make_child = '하위 카테고리 추가';
// 항목
$lang->header_text = '상단 내용';
$lang->footer_text = '하단 내용';
$lang->use_category = '분류 사용';
$lang->category_title = '분류명';
$lang->parent_category_name = '상위 카테고리명';
$lang->category_name = '카테고리명';
$lang->expand = '펼침';
$lang->category_group_srls = '그룹제한';
$lang->checked_count = '선택된 글 수';
$lang->skin_default_info = '스킨 기본정보';
@ -44,6 +49,10 @@
$lang->about_admin_id = '해당 모듈에 대해 최고 권한을 가지는 관리자를 지정할 수 있습니다.<br />,(콤마)로 다수 아이디 지정이 가능합니다. (관리자페이지 접근은 불가능)';
$lang->about_grant = '특정 권한의 대상을 모두 해제하시면 로그인하지 않은 회원까지 권한을 가질 수 있습니다';
$lang->about_category_name = '카테고리 이름을 입력해주세요';
$lang->about_expand = '선택하시면 늘 펼쳐진 상태로 있게 합니다';
$lang->category_group_srls = '선택하신 그룹만 현재 카테고리가 보이게 됩니다. (xml파일을 직접 열람하면 노출이 됩니다)';
$lang->msg_new_module = '모듈 생성';
$lang->msg_update_module = '모듈 수정';
$lang->msg_category_is_null = '등록된 분류가 없습니다';

View file

@ -0,0 +1,11 @@
<query id="getCategory" 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>
</query>

View file

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

View file

@ -0,0 +1,50 @@
<input type="hidden" name="category_srl" value="{$category_info->category_srl}" />
<input type="hidden" name="parent_srl" value="{$category_info->parent_srl}" />
<table border="1" width="100%">
<col width="100" />
<col width="*" />
<!--@if($category_info->parent_category_name)-->
<tr>
<th>{$lang->parent_category_name}</th>
<td>{$category_info->parent_category_name}</td>
</tr>
<!--@end-->
<tr>
<th rowspan="2">{$lang->category_name}</th>
<td><input type="text" name="name" value="{htmlspecialchars($category_info->name)}" /></td>
</tr>
<tr>
<td>{$lang->about_category_name}</td>
</tr>
<tr>
<th rowspan="2">{$lang->expand}</th>
<td><input type="checkbox" name="expand" value="Y" <!--@if($category_info->expand=="Y")-->checked="true"<!--@end--> /></td>
</tr>
<tr>
<td>{$lang->about_expand}</td>
</tr>
<tr>
<th rowspan="2">{$lang->category_group_srls}</th>
<td>
<!--@foreach($group_list as $key=>$val)-->
<input type="checkbox" name="group_srls" value="{$key}" id="group_{$key}" <!--@if(is_array($category_info->group_srls)&&in_array($key, $category_info->group_srls))-->checked="true"<!--@end-->/>
<label for="group_{$key}">{$val->title}</label>
<!--@end-->
</td>
</tr>
<tr>
<td>{$lang->about_category_group_srls}</td>
</tr>
<tr>
<td colspan="2">
<!--@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" />
<!--@else-->
<input type="submit" value="{$lang->cmd_submit}" />
<!--@end-->
</td>
</tr>
</table>