#127 #152 게시물의 복사 기능 추가 & 이동/복사시 카테고리 지정 가능하도록 변경 & 기본 게시판 스킨에서 페이지의 게시물 토글 기능 추가 & 관리 선택된 게시물의 목록 노출 & 기본 게시판 스킨의 항목 숨김/열람 기능 모두 적용

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2737 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-10-11 09:13:02 +00:00
parent 72dcf54069
commit 14550e198f
41 changed files with 678 additions and 396 deletions

View file

@ -1,6 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<module>
<grants />
<permissions>
<permission action="dispDocumentAdminManageDocument" target="manager" />
<permission action="getDocumentCategories" target="manager" />
<permission action="procDocumentAdminAddCart" target="manager" />
<permission action="procDocumentAdminManageCheckedDocument" target="manager" />
</permissions>
<actions>
<action name="dispDocumentPrint" type="view" standalone="true" />
<action name="dispDocumentPreview" type="view" standalone="true" />
@ -8,6 +14,13 @@
<action name="dispDocumentAdminList" type="view" admin_index="true" standalone="true" />
<action name="dispDocumentAdminConfig" type="view" standalone="true" />
<action name="dispDocumentAdminManageDocument" type="view" standalone="true"/>
<action name="getDocumentCategories" type="model" standalone="true"/>
<action name="procDocumentAdminAddCart" type="controller" standalone="true" />
<action name="procDocumentAdminManageCheckedDocument" type="controller" standalone="true" />
<action name="procDocumentAdminDeleteChecked" type="controller" standalone="true" />
<action name="procDocumentAdminInsertConfig" type="controller" standalone="true" />
<action name="procDocumentAdminDeleteAllThumbnail" type="controller" standalone="true" />

View file

@ -36,25 +36,134 @@
$this->setMessage( sprintf(Context::getLang('msg_checked_document_is_deleted'), $document_count) );
}
/**
* @brief 관리자가 선택시 세션에 담음
**/
function procDocumentAdminAddCart() {
$document_srl = Context::get('srl');
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) return;
$oDocument->doCart();
}
/**
* @brief 세션에 담긴 선택글의 이동/ 삭제
**/
function procDocumentAdminManageCheckedDocument() {
$type = Context::get('type');
$module_srl = Context::get('target_module');
$category_srl = Context::get('target_category');
$message_content = Context::get('message_content');
if($message_content) $message_content = nl2br($message_content);
$cart = Context::get('cart');
if($cart) $document_srl_list = explode('|@|', $cart);
else $document_srl_list = array();
$document_srl_count = count($document_srl_list);
// 쪽지 발송
if($message_content) {
$oMemberController = &getController('member');
$oDocumentModel = &getModel('document');
$logged_info = Context::get('logged_info');
$title = cut_str($message_content,10,'...');
$sender_member_srl = $logged_info->member_srl;
for($i=0;$i<$document_srl_count;$i++) {
$document_srl = $document_srl_list[$i];
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue;
if($type=='move') $purl = sprintf("<a href=\"%s\" onclick=\"window.open(this.href);return false;\">%s</a>", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl());
else $purl = "";
$content .= sprintf("<div>%s</div><hr />%s<div style=\"font-weight:bold\">%s</div>%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent());
$oMemberController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false);
}
}
if($type == 'move') {
if(!$module_srl) return new Object(-1, 'fail_to_move');
$output = $this->moveDocumentModule($document_srl_list, $module_srl, $category_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
$msg_code = 'success_moved';
} elseif($type == 'copy') {
if(!$module_srl) return new Object(-1, 'fail_to_move');
$output = $this->copyDocumentModule($document_srl_list, $module_srl, $category_srl);
if(!$output->toBool()) return new Object(-1, 'fail_to_move');
$msg_code = 'success_registed';
} elseif($type =='delete') {
$oDB = &DB::getInstance();
$oDB->begin();
$oDocumentController = &getController('document');
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'] = array();
$this->setMessage($msg_code);
}
/**
* @brief 특정 게시물들의 소속 모듈 변경 (게시글 이동시에 사용)
**/
function moveDocumentModule($document_srl_list, $module_srl, $source_module_srl) {
function moveDocumentModule($document_srl_list, $module_srl, $category_srl) {
if(!count($document_srl_list)) return;
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
$oDB = &DB::getInstance();
$oDB->begin();
// 게시물의 이동
$output = executeQuery('document.updateDocumentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
for($i=0;$i<count($document_srl_list);$i++) {
$document_srl = $document_srl_list[$i];
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;
$source_category_srl = $oDocument->get('category_srl');
unset($document_args);
$document_args->module_srl = $module_srl;
$document_args->category_srl = $category_srl;
$document_args->document_srl = $document_srl;
// 게시물의 모듈 이동
$output = executeQuery('document.updateDocumentModule', $document_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅
if($source_category_srl != $category_srl) {
if($source_category_srl) $oDocumentController->updateCategoryCount($source_category_srl);
if($category_srl) $oDocumentController->updateCategoryCount($category_srl);
}
}
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
// 댓글의 이동
$output = executeQuery('comment.updateCommentModule', $args);
if(!$output->toBool()) {
@ -75,31 +184,53 @@
$oDB->rollback();
return $output;
}
$oDB->commit();
return new Object();
}
// 첨부파일의 이동 (다운로드나 본문 첨부의 문제로 인하여 첨부파일은 이동하지 않기로 결정. 차후에 다시 고민)
/*
$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);
/**
* @brief 게시글의 복사
**/
function copyDocumentModule($document_srl_list, $module_srl, $category_srl) {
if(!count($document_srl_list)) return;
$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);
$oDocumentModel = &getModel('document');
$oDocumentController = &getController('document');
$oFileController = &getController('file');
if(is_dir($image_dir)) {
FileHandler::moveDir($image_dir, $target_image_dir);
if(!is_dir($target_image_dir)) {
$oDB = &DB::getInstance();
$oDB->begin();
for($i=0;$i<count($document_srl_list);$i++) {
$document_srl = $document_srl_list[$i];
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;
$obj = null;
$obj = $oDocument->getObjectVars();
$obj->document_srl = getNextSequence();
$obj->category_srl = $category_srl;
$obj->password_is_hashed = true;
// 첨부파일 미리 등록
if($oDocument->hasUploadedFiles()) {
$files = $oDocument->getUploadedFiles();
foreach($files as $key => $val) {
$file_info = array();
$file_info['tmp_name'] = $val->uploaded_filename;
$file_info['name'] = $val->source_filename;
$oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
}
}
// 글의 등록
$output = $oDocumentController->insertDocument($obj, true);
if(!$output->toBool()) {
$oDB->rollback();
return new Object(-1,'fail');
return $output;
}
}
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();
@ -292,5 +423,6 @@
}
$directory->close();
}
}
?>

View file

@ -90,5 +90,40 @@
$this->setTemplateFile('document_config');
}
/**
* @brief 관리자가 선택한 문서에 대한 관리
**/
function dispDocumentAdminManageDocument() {
// 선택한 목록을 세션에서 가져옴
$flag_list = $_SESSION['document_management'];
if(count($flag_list)) {
foreach($flag_list as $key => $val) {
if(!is_bool($val)) continue;
$document_srl_list[] = $key;
}
}
if(count($document_srl_list)) {
$oDocumentModel = &getModel('document');
$document_list = $oDocumentModel->getDocuments($document_srl_list, $this->grant->is_admin);
Context::set('document_list', $document_list);
}
// 모듈의 목록을 가져옴
$args->select_module = "'board','blog'";
$output = executeQuery('document.getAllModules', $args);
$module_list = $output->data;
if($module_list && !is_array($module_list)) $module_list = array($module_list);
Context::set('module_list', $module_list);
// 팝업 레이아웃 선택
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('checked_list');
}
}
?>

View file

@ -60,9 +60,10 @@
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
/**
* 2007. 10. 11 : 관리자 페이지의 기본 설정 Action 추가
* 2007. 10. 11 : 관리자 페이지의 기본 설정 Action 추가, 게시글 관리 action 추가
**/
if(!$oModuleModel->getActionForward('dispDocumentAdminConfig')) return true;
if(!$oModuleModel->getActionForward('dispDocumentAdminManageDocument')) return true;
return false;
}
@ -112,10 +113,12 @@
}
/**
* 2007. 10. 11 : 관리자 페이지의 기본 설정 Action 추가
* 2007. 10. 11 : 관리자 페이지의 기본 설정 Action 추가, 게시글 관리 action 추가
**/
if(!$oModuleModel->getActionForward('dispDocumentAdminConfig'))
$oModuleController->insertActionForward('document', 'view', 'dispDocumentAdminConfig');
if(!$oModuleModel->getActionForward('dispDocumentAdminManageDocument'))
$oModuleController->insertActionForward('document', 'view', 'dispDocumentAdminManageDocument');
return new Object(0,'success_updated');
}

View file

@ -100,6 +100,23 @@
return $this->get('notify_message')=='Y' ? true : false;
}
function doCart() {
if($this->isCarted()) $this->removeCart();
else $this->addCart();
}
function addCart() {
$_SESSION['document_management'][$this->document_srl] = true;
}
function removeCart() {
unset($_SESSION['document_management'][$this->document_srl]);
}
function isCarted() {
return $_SESSION['document_management'][$this->document_srl];
}
function notify($type, $content) {
// useNotify가 아니면 return
if(!$this->useNotify()) return;

View file

@ -313,6 +313,21 @@
return $output;
}
/**
* @brief 특정 모듈의 분류를 구함
**/
function getDocumentCategories() {
$module_srl = Context::get('module_srl');
$categories= $this->getCategoryList($module_srl);
if(!$categories) return;
$output = '';
foreach($categories as $category_srl => $category) {
$output .= sprintf("%d,%s\n",$category_srl, $category->title);
}
$this->add('categories', $output);
}
/**
* @brief 문서 설정 정보를 구함
**/

View file

@ -10,6 +10,7 @@
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Ratio';
$lang->cmd_delete_all_thumbnail = 'Delete all thumbnails';
$lang->move_target_module = "Target module for changing position";
$lang->cmd_toggle_checked_document = '선택항목 반전';
$lang->cmd_delete_checked_document = 'Delete selected';

View file

@ -10,6 +10,7 @@
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Ratio';
$lang->cmd_delete_all_thumbnail = 'Delete all thumbnails';
$lang->move_target_module = "Módulo para cambiar de posición";
$lang->cmd_toggle_checked_document = '선택항목 반전';
$lang->cmd_delete_checked_document = 'Eliminar lo seleccionado';

View file

@ -10,6 +10,7 @@
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Ratio';
$lang->cmd_delete_all_thumbnail = 'Delete all thumbnails';
$lang->move_target_module = "移動対象モジュール";
$lang->cmd_toggle_checked_document = '선택항목 반전';
$lang->cmd_delete_checked_document = '選択項目削除';

View file

@ -19,6 +19,8 @@
$lang->msg_is_secret = '비밀글입니다';
$lang->msg_checked_document_is_deleted = '%d개의 글이 삭제되었습니다';
$lang->move_target_module = "이동 대상 모듈";
// 관리자 페이지에서 검색할 대상
$lang->search_target_list = array(
'title' => '제목',

View file

@ -10,6 +10,7 @@
$lang->thumbnail_crop = 'Crop';
$lang->thumbnail_ratio = 'Ratio';
$lang->cmd_delete_all_thumbnail = 'Delete all thumbnails';
$lang->move_target_module = "移动目标模块";
$lang->cmd_toggle_checked_document = '反选';
$lang->cmd_delete_checked_document = '删除所选';

View file

@ -0,0 +1,14 @@
<query id="getAllModules" action="select">
<tables>
<table name="modules" />
</tables>
<columns>
<column name="*" />
</columns>
<conditions>
<condition operation="in" column="module" var="select_module" />
</conditions>
<navigation>
<index var="sort_index" default="mid" order="asc" />
</navigation>
</query>

View file

@ -4,8 +4,9 @@
</tables>
<columns>
<column name="module_srl" var="module_srl" filter="number" default="0" />
<column name="category_srl" var="category_srl" filter="number" default="0" />
</columns>
<conditions>
<condition operation="in" column="document_srl" var="document_srls" notnull="notnull" />
<condition operation="equal" column="document_srl" var="document_srl" notnull="notnull" />
</conditions>
</query>

View file

@ -0,0 +1,74 @@
<!--%import("filter/manage_checked_document.xml")-->
<!--%import("js/document_admin.js")-->
<!--%import("css/document.css")-->
<div id="popHeadder">
<h1>{$lang->cmd_manage_document}</h1>
</div>
<form action="./" method="get" id="fo_management">
<input type="hidden" name="type" value="" />
<div id="popBody">
<table cellspacing="0" class="tableType5">
<col width="150" />
<col />
<tr>
<th scope="row"><label for="textfield1">{$lang->checked_count} ({count($document_list)})</label></th>
<td>
<!--@if(count($document_list))-->
<input type="checkbox" onclick="checkboxSelectAll(this.form, 'cart'); return false;" /> {$lang->cmd_select}
<ul class="document_list_box">
<!--@foreach($document_list as $key => $document)-->
<li class="document_list"><input type="checkbox" checked="checked" name="cart" value="{$document->document_srl}" onclick="doAddDocumentCart(this);"/> <address>{$document->getNickName()}</address> <span class="document_title">{$document->getTitle()}</li>
<!--@end-->
</ul>
<!--@else-->
&nbsp;
<!--@end-->
</td>
</tr>
<!--@if(count($document_list) && count($module_list)>1)-->
<tr>
<th scope="row">{$lang->move_target_module}</th>
<td>
<select id="target_module" name="target_module" class="w100" onchange="doGetCategoryFromModule(this); return false;">
<!--@foreach($module_list as $key => $val)-->
<option value="{$val->module_srl}">{$val->browser_title} ({$val->mid})</option>
<!--@end-->
</select>
</td>
</tr>
<tr>
<th scope="row">{$lang->category}</th>
<td>
<select id="target_category" name="target_category" class="w100">
</select>
</td>
</tr>
<tr>
<th scope="row">{$lang->cmd_send_message}</th>
<td>
<textarea name="message_content" class="inputTypeTextArea w400" cols="45" rows="5"></textarea>
</td>
</tr>
<!--@end-->
</table>
</div>
<div id="popFooter">
<div class="tRight gap1">
<!--@if(count($document_list))-->
<a href="#" onclick="doManageDocument('move');return false;" class="button"><span>{$lang->cmd_move}</span></a>
<a href="#" onclick="doManageDocument('copy');return false;" class="button"><span>{$lang->cmd_copy}</span></a>
<a href="#" onclick="doManageDocument('delete');return false;" class="button"><span>{$lang->cmd_delete}</span></a>
<!--@end-->
<a href="#" onclick="window.close(); return false;" class="button"><span>{$lang->cmd_close}</span></a>
</div>
</div>
<script type="text/javascript">
xAddEventListener(window,'load',function() { doGetCategoryFromModule(xGetElementById('target_module')); } );
</script>
</form>

View file

@ -1 +1,5 @@
body { margin:10px; font-size:.75em; font-family:sans-serif;}
.document_list_box { height:300px; overflow-y:scroll; overflow-x:hidden;}
.document_list { margin-top:.5em; overflow:hidden; white-space:nowrap; clear:both;}
.document_list input { float:left; margin-right:10px; }
.document_list address { float:left; width:100px; margin-right:10px; overflow:hidden; white-space:nowrap;}
.document_list .document_title { }

View file

@ -0,0 +1,7 @@
<filter name="manage_checked_document" module="document" act="procDocumentAdminManageCheckedDocument">
<form />
<response callback_func="completeManageDocument">
<tag name="error" />
<tag name="message" />
</response>
</filter>

View file

@ -19,3 +19,52 @@ function completeDeleteAllThumbnail(ret_obj) {
alert(ret_obj['message']);
location.reload();
}
/* 선택된 글의 삭제 또는 이동 */
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();
}
/* 선택된 모듈의 카테고리 목록을 가져오는 함수 */
function doGetCategoryFromModule(obj) {
var module_srl = obj.options[obj.selectedIndex].value;
var params = new Array();
params['module_srl'] = module_srl;
var response_tags = new Array('error','message','categories');
exec_xml('document','getDocumentCategories',params, completeGetCategoryFromModules, response_tags);
}
function completeGetCategoryFromModules(ret_obj, response_tags) {
var obj = xGetElementById('target_category');
var length = obj.options.length;
for(var i=0;i<length;i++) obj.remove(0);
var categories = ret_obj['categories'];
if(!categories) return;
var category_list = categories.split("\n");
for(var i=0;i<category_list.length;i++) {
var item = category_list[i];
var pos = item.indexOf(',');
var category_srl = item.substr(0,pos);
var category_title = item.substr(pos+1,item.length);
if(!category_srl || !category_title) continue;
var opt = new Option(category_title, category_srl, false, false);
obj.options[obj.options.length] = opt;
}
}