mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
게시판 관리자가 분류를 추가/삭제/이동/수정 하지 못하는 권한 문제 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6015 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d5d2220df4
commit
658bafbd46
10 changed files with 270 additions and 246 deletions
|
|
@ -1018,6 +1018,191 @@
|
|||
Context::addHtmlHeader($js_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 카테고리 추가
|
||||
**/
|
||||
function procDocumentInsertCategory($args = null) {
|
||||
// 입력할 변수 정리
|
||||
if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','title','expand','group_srls','color');
|
||||
|
||||
// 권한 체크
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
|
||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
||||
|
||||
if($args->expand !="Y") $args->expand = "N";
|
||||
$args->group_srls = str_replace('|@|',',',$args->group_srls);
|
||||
$args->parent_srl = (int)$args->parent_srl;
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// 이미 존재하는지를 확인
|
||||
if($args->category_srl) {
|
||||
$category_info = $oDocumentModel->getCategory($args->category_srl);
|
||||
if($category_info->category_srl != $args->category_srl) $args->category_srl = null;
|
||||
}
|
||||
|
||||
// 존재하게 되면 update를 해준다
|
||||
if($args->category_srl) {
|
||||
$output = $this->updateCategory($args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// 존재하지 않으면 insert를 해준다
|
||||
} else {
|
||||
$output = $this->insertCategory($args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
// XML 파일을 갱신하고 위치을 넘겨 받음
|
||||
$xml_file = $this->makeCategoryFile($args->module_srl);
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$this->add('xml_file', $xml_file);
|
||||
$this->add('module_srl', $args->module_srl);
|
||||
$this->add('category_srl', $args->category_srl);
|
||||
$this->add('parent_srl', $args->parent_srl);
|
||||
}
|
||||
|
||||
|
||||
function procDocumentMoveCategory() {
|
||||
$source_category_srl = Context::get('source_srl');
|
||||
|
||||
// parent_srl 이 있으면 첫 자식으로 들어간다
|
||||
$parent_category_srl = Context::get('parent_srl');
|
||||
|
||||
// target_srl 이 있으면 target_srl 아래로 형제로 들어간다
|
||||
$target_category_srl = Context::get('target_srl');
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
$source_category = $oDocumentModel->getCategory($source_category_srl);
|
||||
|
||||
// 권한 체크
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl);
|
||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
||||
|
||||
//parent_category_srl 의 첫 자식으로 넣자
|
||||
if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0)){
|
||||
$parent_category = $oDocumentModel->getCategory($parent_category_srl);
|
||||
|
||||
$args->module_srl = $source_category->module_srl;
|
||||
$args->parent_srl = $parent_category_srl;
|
||||
$output = executeQuery('document.getChildCategoryMinListOrder', $args);
|
||||
|
||||
if(!$output->toBool()) return $output;
|
||||
$args->list_order = (int)$output->data->list_order;
|
||||
if(!$args->list_order) $args->list_order = 0;
|
||||
$args->list_order--;
|
||||
|
||||
|
||||
$source_args->category_srl = $source_category_srl;
|
||||
$source_args->parent_srl = $parent_category_srl;
|
||||
$source_args->list_order = $args->list_order;
|
||||
$output = $this->updateCategory($source_args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
|
||||
// $target_category_srl의 아래동생으로
|
||||
}else if($target_category_srl > 0){
|
||||
$target_category = $oDocumentModel->getCategory($target_category_srl);
|
||||
|
||||
//$target_category의 아래 동생을 모두 내린다
|
||||
$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
|
||||
$source_args->category_srl = $source_category_srl;
|
||||
$source_args->parent_srl = $target_category->parent_srl;
|
||||
$source_args->list_order = $target_category->list_order+1;
|
||||
$output = $this->updateCategory($source_args);
|
||||
if(!$output->toBool()) return $output;
|
||||
}
|
||||
|
||||
// xml파일 재생성
|
||||
$xml_file = $this->makeCategoryFile($source_category->module_srl);
|
||||
|
||||
// return 변수 설정
|
||||
$this->add('xml_file', $xml_file);
|
||||
$this->add('source_category_srl', $source_category_srl);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 카테고리 삭제
|
||||
**/
|
||||
function procDocumentDeleteCategory() {
|
||||
// 변수 정리
|
||||
$args = Context::gets('module_srl','category_srl');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
// 권한 체크
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
|
||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
||||
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
// 원정보를 가져옴
|
||||
$category_info = $oDocumentModel->getCategory($args->category_srl);
|
||||
if($category_info->parent_srl) $parent_srl = $category_info->parent_srl;
|
||||
|
||||
// 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력
|
||||
if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child');
|
||||
|
||||
// DB에서 삭제
|
||||
$output = $this->deleteCategory($args->category_srl);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
// XML 파일을 갱신하고 위치을 넘겨 받음
|
||||
$xml_file = $this->makeCategoryFile($args->module_srl);
|
||||
|
||||
$oDB->commit();
|
||||
|
||||
$this->add('xml_file', $xml_file);
|
||||
$this->add('category_srl', $parent_srl);
|
||||
$this->setMessage('success_deleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief xml 파일을 갱신
|
||||
* 관리자페이지에서 메뉴 구성 후 간혹 xml파일이 재생성 안되는 경우가 있는데\n
|
||||
* 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n
|
||||
* 개발 중간의 문제인 것 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능
|
||||
**/
|
||||
function procDocumentMakeXmlFile() {
|
||||
// 입력값을 체크
|
||||
$module_srl = Context::get('module_srl');
|
||||
|
||||
// 권한 체크
|
||||
$oModuleModel = &getModel('module');
|
||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
||||
|
||||
$xml_file = $this->makeCategoryFile($module_srl);
|
||||
|
||||
// return 값 설정
|
||||
$this->add('xml_file',$xml_file);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 카테고리를 캐시 파일로 저장
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue