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

This commit is contained in:
zero 2007-04-10 03:38:27 +00:00
parent 8833885ea0
commit bf19a8cf2a
15 changed files with 187 additions and 32 deletions

View file

@ -1,6 +1,6 @@
#RewriteEngine On
#RewriteRule ^rss/([[:alnum:]]+)$ ./?mid=$1&act=dispBoardRss [L]
#RewriteRule ^trackback/([[:digit:]]+)$ ./?module=trackback&act=procTrackbackReceive&document_srl=$1 [L]
#RewriteRule ^admin ./?module=admin [L]
#RewriteRule ^([[:digit:]]+)$ ./?document_srl=$1 [L]
#RewriteRule ^([[:alnum:]]+)$ ./?mid=$1 [L]
RewriteEngine On
RewriteRule ^rss/([[:alnum:]]+)$ ./?mid=$1&act=dispBoardRss [L]
RewriteRule ^trackback/([[:digit:]]+)$ ./?module=trackback&act=procTrackbackReceive&document_srl=$1 [L]
RewriteRule ^admin ./?module=admin [L]
RewriteRule ^([[:digit:]]+)$ ./?document_srl=$1 [L]
RewriteRule ^([[:alnum:]]+)$ ./?mid=$1 [L]

View file

@ -32,6 +32,20 @@
fclose($fp);
}
/**
* @brief 특정 디렉토리를 이동
**/
function moveDir($source_dir, $target_dir) {
if(!is_dir($source_dir)) return;
if(!is_dir($target_dir)) {
FileHandler::makeDir($target_dir);
@unlink($target_dir);
}
@rename($source_dir, $target_dir);
}
/**
* @brief $path내의 파일들을 return ('.', '..', '.로 시작하는' 파일들은 제외)
**/

View file

@ -160,6 +160,9 @@
$lang->success_moved = '이동되었습니다';
$lang->success_sended = '발송되었습니다';
$lang->fail_to_delete = '삭제되었습니다';
$lang->fail_to_move = '이동되었습니다';
$lang->failed_voted = '추천하실 수 없습니다';
$lang->fail_to_delete_have_children = '답글이 있어서 삭제할 수 없습니다';

View file

@ -234,17 +234,41 @@
}
/**
* @brief 세션에 담긴 선택글의 이동
* @brief 세션에 담긴 선택글의 이동/ 삭제
**/
function procBoardAdminMoveCheckedDocument() {
$this->setMessage('success_moved');
function procBoardAdminManageCheckedDocument() {
$type = Context::get('type');
$module_srl = Context::get('target_board');
$flag_list = $_SESSION['document_management'][$this->module_srl];
$document_srl_list = array_keys($flag_list);
$oDocumentController = &getController('document');
$document_srl_count = count($document_srl_list);
if($type == 'move') {
if(!$module_srl) return new Object(-1, 'fail_to_move');
else {
$output = $oDocumentController->moveDocumentModule($document_srl_list, $module_srl, $this->module_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
$msg_code = 'success_moved';
$_SESSION['document_management'][$this->module_srl] = null;
}
/**
* @brief 세션에 담긴 선택글의 삭제
**/
function procBoardAdminDeleteCheckedDocument() {
$this->setMessage('success_deleted');
} elseif($type =='delete') {
$oDB = &DB::getInstance();
$oDB->begin();
for($i=0;$i<$document_srl_count;$i++) {
$document_srl = $document_srl_list[$i];
$output = $oDocumentController->deleteDocument($document_srl, true);
if(!$output->toBool()) return new Object(-1, 'fail_to_delete');
}
$oDB->commit();
$msg_code = 'success_deleted';
$_SESSION['document_management'][$this->module_srl] = null;
}
$this->setMessage($msg_code);
}
/**

View file

@ -66,7 +66,6 @@
<action name="procBoardAdminInsertCategory" type="controller" standalone="true" />
<action name="procBoardAdminUpdateCategory" type="controller" standalone="true" />
<action name="procBoardAdminInsertConfig" type="controller" standalone="true" />
<action name="procBoardAdminDeleteCheckedDocument" type="controller" standalone="true" />
<action name="procBoardAdminMoveCheckedDocument" type="controller" standalone="true" />
<action name="procBoardAdminManageCheckedDocument" type="controller" standalone="true" />
</actions>
</module>

View file

@ -49,4 +49,5 @@
$lang->msg_category_is_null = '등록된 분류가 없습니다';
$lang->msg_grant_is_null = '등록된 권한 대상이 없습니다';
$lang->msg_no_checked_document = '선택된 게시물이 없습니다';
$lang->msg_move_failed = '이동 실패하였습니다';
?>

View file

@ -1,5 +1,4 @@
<!--%import("filter/delete_checked_document.xml")-->
<!--%import("filter/move_checked_document.xml")-->
<!--%import("filter/manage_checked_document.xml")-->
<!--%import("js/board_admin.js")-->
<div style="width:400px">
@ -8,19 +7,21 @@
<!--@if(count($document_list))-->
<form action="./" method="get">
<form action="./" method="get" id="fo_management">
<input type="hidden" name="mid" value="{$mid}" />
<input type="hidden" name="type" value="" />
<div>{$lang->checked_count} : {count($document_list)}</div>
<div><a href="#" onclick="delete_checked_document(); return false;">{$lang->cmd_delete}</a></div>
<div><a href="#" onclick="doManageDocument('delete');return false;">{$lang->cmd_delete}</a></div>
<div>
<select name="board_list">
<select name="target_board">
<!--@foreach($board_list as $key => $val)-->
<!--@if($module_srl != $val->module_srl)-->
<option value="{$val->module_srl}">{$val->browser_title} ({$val->mid})</option>
<!--@end-->
<!--@end-->
</select>
<a href="#" onclick="move_checked_document(); return false;">{$lang->cmd_move}</a>
<a href="#" onclick="doManageDocument('move');return false;">{$lang->cmd_move}</a>
</div>
</form>

View file

@ -1,7 +0,0 @@
<filter name="delete_checked_document" module="board" act="procBoardAdminDeleteCheckedDocument" confirm_msg_code="confirm_delete">
<form />
<response callback_func="completeManageDocument">
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -1,4 +1,4 @@
<filter name="move_checked_document" module="board" act="procBoardAdminMoveCheckedDocument" confirm_msg_code="confirm_move">
<filter name="manage_checked_document" module="board" act="procBoardAdminManageCheckedDocument">
<form />
<response callback_func="completeManageDocument">
<tag name="error" />

View file

@ -100,8 +100,17 @@ function doChangeCategory(sel_obj, url) {
else location.href=url+'&module_category_srl='+module_category_srl;
}
/* 선택된 글의 삭제 또는 이동 */
function doManageDocument(type, mid) {
var fo_obj = xGetElementById("fo_management");
fo_obj.type.value = type;
procFilter(fo_obj, manage_checked_document);
}
/* 선택된 글의 삭제 또는 이동 후 */
function completeManageDocument(ret_obj) {
if(opener) opener.location.href = opener.location.href;
alert(ret_obj['message']);
window.close();
}

View file

@ -0,0 +1,11 @@
<query id="updateCommentModule" action="update">
<tables>
<table name="comments" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -285,6 +285,73 @@
return $output;
}
/**
* @brief 특정 게시물들의 소속 모듈 변경 (게시글 이동시에 사용)
**/
function moveDocumentModule($document_srl_list, $module_srl, $source_module_srl) {
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
$oDB = &DB::getInstance();
$oDB->begin();
// 게시물의 이동
$output = executeQuery('document.updateDocumentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 코멘트의 이동
$output = executeQuery('comment.updateCommentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 트랙백의 이동
$output = executeQuery('trackback.updateTrackbackModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 엮인글
$output = executeQuery('tag.updateTagModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 첨부파일의 이동 (다운로드나 본문 첨부의 문제로 인하여 첨부파일은 이동하지 않기로 결정. 차후에 다시 고민)
/*
$image_dir = sprintf('./files/attach/images/%s/%s/', $source_module_srl, $document_srl);
$binary_dir = sprintf('./files/attach/binaries/%s/%s/', $source_module_srl, $document_srl);
$target_image_dir = sprintf('./files/attach/images/%s/%s/', $module_srl, $document_srl);
$target_binary_dir = sprintf('./files/attach/binaries/%s/%s/', $module_srl, $document_srl);
if(is_dir($image_dir)) {
FileHandler::moveDir($image_dir, $target_image_dir);
if(!is_dir($target_image_dir)) {
$oDB->rollback();
return new Object(-1,'fail');
}
}
if(is_dir($binary_dir)) {
FileHandler::moveDir($binary_dir, $target_binary_dir);
if(!is_dir($target_binary_dir)) {
$oDB->rollback();
return new Object(-1,'fail');
}
}
*/
$oDB->commit();
return new Object();
}
/**
* @brief 특정 모듈의 전체 문서 삭제
**/

View file

@ -0,0 +1,11 @@
<query id="updateDocumentModule" action="update">
<tables>
<table name="documents" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateTagModule" action="update">
<tables>
<table name="tags" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,11 @@
<query id="updateTrackbackModule" action="update">
<tables>
<table name="trackbacks" />
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
</conditions>
</query>