mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 17:21:39 +09:00
#19745697 trash module makem
document, comment module modify, because object in to trash and trash restore to object feature git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@8388 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
9e04e84a65
commit
8f3df45a2a
30 changed files with 949 additions and 34 deletions
|
|
@ -189,6 +189,7 @@
|
|||
|
||||
// get type, kind
|
||||
$type = $xml_info->action->{$this->act}->type;
|
||||
$ruleset = $xml_info->action->{$this->act}->ruleset;
|
||||
$kind = strpos(strtolower($this->act),'admin')!==false?'admin':'';
|
||||
if(!$kind && $this->module == 'admin') $kind = 'admin';
|
||||
if($this->module_info->use_mobile != "Y") Mobile::setMobile(false);
|
||||
|
|
@ -289,6 +290,18 @@
|
|||
}
|
||||
}
|
||||
|
||||
//TODO ruleset check...
|
||||
if(!empty($ruleset))
|
||||
{
|
||||
$rulesetFile = $oModuleModel->getValidatorFilePath($this->module, $ruleset);
|
||||
if(!empty($rulesetFile))
|
||||
{
|
||||
$Validator = new Validator($rulesetFile);
|
||||
if(!$Validator->validate())
|
||||
return $Validator->getLastError();
|
||||
}
|
||||
}
|
||||
|
||||
$oModule->setAct($this->act);
|
||||
|
||||
$this->module_info->module_type = $type;
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@
|
|||
$lang->browser_title = '브라우저 제목';
|
||||
$lang->title = '제목';
|
||||
$lang->title_content = '제목+내용';
|
||||
$lang->untitle = '제목없슴';
|
||||
$lang->topic = '주제';
|
||||
$lang->replies = '댓글';
|
||||
$lang->content = '내용';
|
||||
|
|
@ -165,6 +166,7 @@
|
|||
$lang->not_exists = '없음';
|
||||
$lang->public = '공개';
|
||||
$lang->private = '비공개';
|
||||
$lang->etc = '기타';
|
||||
$lang->unit_sec = '초';
|
||||
$lang->unit_min = '분';
|
||||
$lang->unit_hour = '시';
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@
|
|||
require(_XE_PATH_.'classes/mail/Mail.class.php');
|
||||
require(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||
require(_XE_PATH_.'classes/mobile/Mobile.class.php');
|
||||
require(_XE_PATH_.'classes/validator/Validator.class.php');
|
||||
if(__DEBUG__) $GLOBALS['__elapsed_class_load__'] = getMicroTime() - __ClassLoadStartTime__;
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
* @brief Delete the selected comment from the administrator page
|
||||
**/
|
||||
function procCommentAdminDeleteChecked() {
|
||||
$isTrash = Context::get('is_trash');
|
||||
|
||||
// Error display if none is selected
|
||||
$cart = Context::get('cart');
|
||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||
|
|
@ -24,23 +26,65 @@
|
|||
$comment_count = count($comment_srl_list);
|
||||
if(!$comment_count) return $this->stop('msg_cart_is_null');
|
||||
|
||||
$oCommentController = &getController('comment');
|
||||
$oCommentController = &getController('comment');
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
$deleted_count = 0;
|
||||
// Delete the comment posting
|
||||
for($i=0;$i<$comment_count;$i++) {
|
||||
$comment_srl = trim($comment_srl_list[$i]);
|
||||
if(!$comment_srl) continue;
|
||||
// comment into trash
|
||||
if($isTrash == 'true') $this->_moveCommentToTrash($comment_srl_list, &$oCommentController, &$oDB);
|
||||
|
||||
$output = $oCommentController->deleteComment($comment_srl, true);
|
||||
if(!$output->toBool()) continue;
|
||||
$deleted_count = 0;
|
||||
// Delete the comment posting
|
||||
for($i=0;$i<$comment_count;$i++) {
|
||||
$comment_srl = trim($comment_srl_list[$i]);
|
||||
if(!$comment_srl) continue;
|
||||
|
||||
$deleted_count ++;
|
||||
}
|
||||
$output = $oCommentController->deleteComment($comment_srl, true, $isTrash);
|
||||
if(!$output->toBool())
|
||||
{
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
$deleted_count ++;
|
||||
}
|
||||
$oDB->commit();
|
||||
|
||||
$this->setMessage( sprintf(Context::getLang('msg_checked_comment_is_deleted'), $deleted_count) );
|
||||
}
|
||||
|
||||
function _moveCommentToTrash($commentSrlList, &$oCommentController, &$oDB)
|
||||
{
|
||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||
|
||||
if(is_array($commentSrlList))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
$oCommentModel = &getModel('comment');
|
||||
$commentItemList = $oCommentModel->getComments($commentSrlList);
|
||||
$oTrashController = &getController('trash');
|
||||
|
||||
foreach($commentItemList AS $key=>$oComment)
|
||||
{
|
||||
$oTrashVO = new TrashVO();
|
||||
$oTrashVO->setTrashSrl(getNextSequence());
|
||||
$oTrashVO->setTitle(trim(strip_tags($oComment->variables['content'])));
|
||||
$oTrashVO->setOriginModule('comment');
|
||||
$oTrashVO->setSerializedObject(serialize($oComment->variables));
|
||||
$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
|
||||
$oTrashVO->setRemoverSrl($logged_info->member_srl);
|
||||
$oTrashVO->setRegdate(date('YmdHis'));
|
||||
|
||||
$output = $oTrashController->insertTrash($oTrashVO);
|
||||
if (!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief cancel the blacklist of abused comments reported by other users
|
||||
**/
|
||||
|
|
@ -66,5 +110,49 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief restore comment from trash module, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
function restoreTrash($originObject)
|
||||
{
|
||||
if(is_array($originObject)) $originObject = (object)$originObject;
|
||||
|
||||
$obj->document_srl = $originObject->document_srl;
|
||||
$obj->comment_srl = $originObject->comment_srl;
|
||||
$obj->parent_srl = $originObject->parent_srl;
|
||||
$obj->content = $originObject->content;
|
||||
$obj->password = $originObject->password;
|
||||
$obj->nick_name = $originObject->nick_name;
|
||||
$obj->member_srl = $originObject->member_srl;
|
||||
$obj->email_address = $originObject->email_address;
|
||||
$obj->homepage = $originObject->homepage;
|
||||
$obj->is_secret = $originObject->is_secret;
|
||||
$obj->notify_message = $originObject->notify_message;
|
||||
$obj->module_srl = $originObject->module_srl;
|
||||
|
||||
$oCommentController = &getController('comment');
|
||||
$output = $oCommentController->insertComment($obj);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty comment in trash, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
function emptyTrash($originObject)
|
||||
{
|
||||
$originObject = unserialize($originObject);
|
||||
if(is_array($originObject)) $originObject = (object) $originObject;
|
||||
|
||||
$oComment = new commentItem();
|
||||
$oComment->setAttribute($originObject);
|
||||
|
||||
//already comment deleted, therefore only comment log delete
|
||||
$oCommentController = &getController('comment');
|
||||
$output = $oCommentController->deleteCommentLog($oComment->get('comment_srl'));
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -322,7 +322,7 @@
|
|||
/**
|
||||
* @brief Delete comment
|
||||
**/
|
||||
function deleteComment($comment_srl, $is_admin = false) {
|
||||
function deleteComment($comment_srl, $is_admin = false, $isMoveToTrash = false) {
|
||||
// create the comment model object
|
||||
$oCommentModel = &getModel('comment');
|
||||
// check if comment already exists
|
||||
|
|
@ -369,8 +369,11 @@
|
|||
}
|
||||
}
|
||||
|
||||
$this->_deleteDeclaredComments($args);
|
||||
$this->_deleteVotedComments($args);
|
||||
if(!$isMoveToTrash)
|
||||
{
|
||||
$this->_deleteDeclaredComments($args);
|
||||
$this->_deleteVotedComments($args);
|
||||
}
|
||||
|
||||
// commit
|
||||
$oDB->commit();
|
||||
|
|
@ -379,6 +382,15 @@
|
|||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief remove all comment relation log
|
||||
**/
|
||||
function deleteCommentLog()
|
||||
{
|
||||
$this->_deleteDeclaredComments($args);
|
||||
$this->_deleteVotedComments($args);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief remove all comments of the article
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
$lang->comment_list = '댓글 목록';
|
||||
$lang->cmd_toggle_checked_comment = '선택항목 반전';
|
||||
$lang->cmd_delete_checked_comment = '선택항목 삭제';
|
||||
$lang->cmd_trash = '휴지통으로 이동';
|
||||
$lang->comment_count = '댓글 수';
|
||||
$lang->about_comment_count = '댓글을 정해진 수 만큼만 표시하고 그 이상일 경우 목록으로 이동할 수 있게 합니다.';
|
||||
$lang->msg_cart_is_null = '삭제할 글을 선택해주세요.';
|
||||
|
|
|
|||
|
|
@ -23,11 +23,13 @@
|
|||
|
||||
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<input type="hidden" name="is_trash" value="false" />
|
||||
|
||||
<!-- 모듈 선택 -->
|
||||
<div class="fr">
|
||||
<a href="{getUrl('','module','module','act','dispModuleSelectList','id','target_module','type','single')}" onclick="popopen(this.href,'ModuleSelect');return false;" class="button green"><span>{$lang->cmd_find_module}</span></a>
|
||||
<span class="button red"><input type="submit" value="{$lang->cmd_delete_checked_comment}" /></span>
|
||||
<span class="button red"><input type="submit" name="delete" value="{$lang->cmd_delete_checked_comment}" onclick="this.form.is_trash.value=false" /></span>
|
||||
<span class="button red"><input type="submit" name="trash" value="{$lang->cmd_trash}" onclick="this.form.is_trash.value=true" /></span>
|
||||
</div>
|
||||
|
||||
<!-- 목록 -->
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, delete_checked)">
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<input type="hidden" name="is_trash" value="false" />
|
||||
|
||||
<!-- 목록 -->
|
||||
<table cellspacing="0" class="crossTable">
|
||||
|
|
@ -33,7 +34,8 @@
|
|||
<a href="#" onclick="doCancelDeclare();return false;" class="button strong black"><span>{$lang->cmd_cancel_declare}</span></a>
|
||||
<a href="javascript:XE.checkboxToggleAll({ checked:true })" class="button"><span>{$lang->cmd_select_all}</span></a>
|
||||
<a href="javascript:XE.checkboxToggleAll()" class="button"><span>{$lang->cmd_reverse_all}</span></a>
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_delete_checked_comment}" /></span>
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_delete_checked_comment}" onclick="this.form.is_trash.value=false" /></span>
|
||||
<span class="button"><input type="submit" name="trash" value="{$lang->cmd_trash}" onclick="this.form.is_trash.value=true" /></span>
|
||||
</th>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
|||
|
|
@ -467,7 +467,7 @@
|
|||
$this->restoreTrash($trash_srl);
|
||||
}
|
||||
|
||||
function restoreTrash($trash_srl){
|
||||
/*function restoreTrash($trash_srl){
|
||||
$oDB = &DB::getInstance();
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
|
|
@ -516,7 +516,63 @@
|
|||
// commit
|
||||
$oDB->commit();
|
||||
return $output;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @brief restore document from trash module, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
function restoreTrash($originObject)
|
||||
{
|
||||
if(is_array($originObject)) $originObject = (object)$originObject;
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$oDocumentModel = &getModel('document');
|
||||
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
//DB restore
|
||||
$output = $oDocumentController->insertDocument($originObject, false, true);
|
||||
|
||||
//FILE restore
|
||||
$oDocument = $oDocumentModel->getDocument($originObject->document_srl);
|
||||
// If the post was not temorarily saved, set the attachment's status to be valid
|
||||
if($oDocument->hasUploadedFiles() && $originObject->member_srl != $originObject->module_srl) {
|
||||
$args->upload_target_srl = $oDocument->document_srl;
|
||||
$args->isvalid = 'Y';
|
||||
$output = executeQuery('file.updateFileValid', $args);
|
||||
}
|
||||
|
||||
// call a trigger (after)
|
||||
if($output->toBool()) {
|
||||
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $originObject);
|
||||
if(!$trigger_output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $trigger_output;
|
||||
}
|
||||
}
|
||||
|
||||
// commit
|
||||
$oDB->commit();
|
||||
return new Object(0, 'success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty document in trash, called by trash module
|
||||
* this method is passived
|
||||
**/
|
||||
function emptyTrash($originObject)
|
||||
{
|
||||
$originObject = unserialize($originObject);
|
||||
if(is_array($originObject)) $originObject = (object) $originObject;
|
||||
|
||||
$oDocument = new documentItem();
|
||||
$oDocument->setAttribute($originObject);
|
||||
|
||||
$oDocumentController = &getController('document');
|
||||
$output = $oDocumentController->deleteDocument($oDocument->get('document_srl'), true, true, $oDocument);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class documentController extends document {
|
|||
/**
|
||||
* @brief Insert the document
|
||||
**/
|
||||
function insertDocument($obj, $manual_inserted = false) {
|
||||
function insertDocument($obj, $manual_inserted = false, $isRestore = false) {
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
|
@ -147,10 +147,10 @@ class documentController extends document {
|
|||
if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N';
|
||||
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
|
||||
if($obj->notify_message != 'Y') $obj->notify_message = 'N';
|
||||
$obj->ipaddress = $_SERVER['REMOTE_ADDR']; //board에서 form key값으로 ipaddress를 사용하면 엄한 ip가 등록됨. 필터와는 상관없슴
|
||||
if(!$isRestore) $obj->ipaddress = $_SERVER['REMOTE_ADDR']; //board에서 form key값으로 ipaddress를 사용하면 엄한 ip가 등록됨. 필터와는 상관없슴
|
||||
|
||||
// Serialize the $extra_vars
|
||||
$obj->extra_vars = serialize($obj->extra_vars);
|
||||
if(!$isRestore) $obj->extra_vars = serialize($obj->extra_vars);
|
||||
// Remove the columns for automatic saving
|
||||
unset($obj->_saved_doc_srl);
|
||||
unset($obj->_saved_doc_title);
|
||||
|
|
@ -170,11 +170,12 @@ class documentController extends document {
|
|||
}
|
||||
// Set the read counts and update order.
|
||||
if(!$obj->readed_count) $obj->readed_count = 0;
|
||||
$obj->update_order = $obj->list_order = getNextSequence() * -1;
|
||||
if(!$isRestore) $obj->update_order = $obj->list_order = getNextSequence() * -1;
|
||||
else $obj->update_order = $obj->list_order;
|
||||
// Check the status of password hash for manually inserting. Apply md5 hashing for otherwise.
|
||||
if($obj->password && !$obj->password_is_hashed) $obj->password = md5($obj->password);
|
||||
// Insert member's information only if the member is logged-in and not manually registered.
|
||||
if(Context::get('is_logged')&&!$manual_inserted) {
|
||||
if(Context::get('is_logged') && !$manual_inserted && !$isRestore) {
|
||||
$logged_info = Context::get('logged_info');
|
||||
$obj->member_srl = $logged_info->member_srl;
|
||||
$obj->user_id = $logged_info->user_id;
|
||||
|
|
@ -391,7 +392,7 @@ class documentController extends document {
|
|||
/**
|
||||
* @brief Deleting Documents
|
||||
**/
|
||||
function deleteDocument($document_srl, $is_admin = false) {
|
||||
function deleteDocument($document_srl, $is_admin = false, $isEmptyTrash = false, $oDocument = null) {
|
||||
// Call a trigger (before)
|
||||
$trigger_obj->document_srl = $document_srl;
|
||||
$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
|
||||
|
|
@ -400,19 +401,31 @@ class documentController extends document {
|
|||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
// get model object of the document
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Check if the documnet exists
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
|
||||
|
||||
if(!$isEmptyTrash)
|
||||
{
|
||||
// get model object of the document
|
||||
$oDocumentModel = &getModel('document');
|
||||
// Check if the documnet exists
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin);
|
||||
debugPrint('normal');
|
||||
}
|
||||
else if($isEmptyTrash && $oDocument == null) return new Object(-1, 'document is not exists');
|
||||
|
||||
if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document');
|
||||
// Check if a permossion is granted
|
||||
if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
|
||||
// Delete the document
|
||||
|
||||
//if empty trash, document already deleted, therefore document not delete
|
||||
$args->document_srl = $document_srl;
|
||||
$output = executeQuery('document.deleteDocument', $args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
if(!$isEmptyTrash)
|
||||
{
|
||||
// Delete the document
|
||||
$output = executeQuery('document.deleteDocument', $args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$this->deleteDocumentAliasByDocument($document_srl);
|
||||
|
|
@ -512,18 +525,43 @@ class documentController extends document {
|
|||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
$output = executeQuery('document.insertTrash', $trash_args);
|
||||
/*$output = executeQuery('document.insertTrash', $trash_args);
|
||||
if (!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}*/
|
||||
|
||||
// new trash module
|
||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||
$oTrashVO = new TrashVO();
|
||||
$oTrashVO->setTrashSrl(getNextSequence());
|
||||
$oTrashVO->setTitle($oDocument->variables['title']);
|
||||
$oTrashVO->setOriginModule('document');
|
||||
$oTrashVO->setSerializedObject(serialize($oDocument->variables));
|
||||
$oTrashVO->setDescription($obj->description);
|
||||
$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
|
||||
$oTrashVO->setRemoverSrl($logged_info->member_srl);
|
||||
$oTrashVO->setRegdate(date('YmdHis'));
|
||||
|
||||
$oTrashController = &getController('trash');
|
||||
$output = $oTrashController->insertTrash($oTrashVO);
|
||||
if (!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
$output = executeQuery('document.updateDocument', $document_args);
|
||||
if (!$output->toBool()) {
|
||||
$output = executeQuery('document.deleteDocument', $trash_args);
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}
|
||||
|
||||
/*$output = executeQuery('document.updateDocument', $document_args);
|
||||
if (!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return $output;
|
||||
}*/
|
||||
|
||||
// update category
|
||||
if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl'));
|
||||
|
||||
|
|
|
|||
|
|
@ -515,6 +515,7 @@
|
|||
$type = $action->attrs->type;
|
||||
$grant = $action->attrs->grant?$action->attrs->grant:'guest';
|
||||
$standalone = $action->attrs->standalone=='true'?'true':'false';
|
||||
$ruleset = $action->attrs->ruleset?$action->attrs->ruleset:'';
|
||||
|
||||
$index = $action->attrs->index;
|
||||
$admin_index = $action->attrs->admin_index;
|
||||
|
|
@ -527,10 +528,12 @@
|
|||
$info->action->{$name}->type = $type;
|
||||
$info->action->{$name}->grant = $grant;
|
||||
$info->action->{$name}->standalone = $standalone=='true'?true:false;
|
||||
$info->action->{$name}->ruleset = $ruleset;
|
||||
|
||||
$buff .= sprintf('$info->action->%s->type=\'%s\';', $name, $type);
|
||||
$buff .= sprintf('$info->action->%s->grant=\'%s\';', $name, $grant);
|
||||
$buff .= sprintf('$info->action->%s->standalone=%s;', $name, $standalone);
|
||||
$buff .= sprintf('$info->action->%s->ruleset=\'%s\';', $name, $ruleset);
|
||||
|
||||
if($index=='true') {
|
||||
$default_index_act = $name;
|
||||
|
|
@ -1280,5 +1283,22 @@
|
|||
function getModuleFileBoxPath($module_filebox_srl){
|
||||
return sprintf("./files/attach/filebox/%s",getNumberingPath($module_filebox_srl,3));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return ruleset cache file path
|
||||
* @param module, act
|
||||
**/
|
||||
function getValidatorFilePath($module, $ruleset) {
|
||||
// Get a path of the requested module. Return if not exists.
|
||||
$class_path = ModuleHandler::getModulePath($module);
|
||||
if(!$class_path) return;
|
||||
|
||||
// Check if module.xml exists in the path. Return if not exist
|
||||
$xml_file = sprintf("%sruleset/%s.xml", $class_path, $ruleset);
|
||||
if(!file_exists($xml_file)) return;
|
||||
|
||||
return $xml_file;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
20
modules/trash/conf/info.xml
Normal file
20
modules/trash/conf/info.xml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module version="0.2">
|
||||
<title xml:lang="ko">휴지통</title>
|
||||
<title xml:lang="en">trash</title>
|
||||
<description xml:lang="ko">문서, 댓글 등을 완전히 삭제하지 않고 복구 가능한 상태로 만들어 관리하는 모듈입니다. </description>
|
||||
<version>0.1</version>
|
||||
<date>2011-05-12</date>
|
||||
<category>content</category>
|
||||
<author email_address="developers@xpressengine.com" link="http://xpressengine.com/">
|
||||
<name xml:lang="ko">NHN</name>
|
||||
<name xml:lang="en">NHN</name>
|
||||
<name xml:lang="vi">NHN</name>
|
||||
<name xml:lang="es">NHN</name>
|
||||
<name xml:lang="zh-CN">NHN</name>
|
||||
<name xml:lang="jp">NHN</name>
|
||||
<name xml:lang="ru">NHN</name>
|
||||
<name xml:lang="zh-TW">NHN</name>
|
||||
<name xml:lang="tr">NHN</name>
|
||||
</author>
|
||||
</module>
|
||||
13
modules/trash/conf/module.xml
Normal file
13
modules/trash/conf/module.xml
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module>
|
||||
<grants />
|
||||
<permissions>
|
||||
</permissions>
|
||||
<actions>
|
||||
<action name="dispTrash" type="view" standalone="true" />
|
||||
<action name="dispTrashAdminList" type="view" standalone="true" admin_index="true" />
|
||||
|
||||
<action name="procTrashAdminEmptyTrash" type="controller" standalone="true" />
|
||||
<action name="procTrashAdminRestore" type="controller" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
23
modules/trash/lang/ko.lang.php
Normal file
23
modules/trash/lang/ko.lang.php
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
/**
|
||||
* @file modules/document/lang/ko.lang.php
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief Document (document) of the basic language modules
|
||||
**/
|
||||
$lang->cmd_trash = '휴지통';
|
||||
$lang->cmd_restore = '복원';
|
||||
$lang->cmd_restore_all = '모두 복원';
|
||||
$lang->in_trash = '휴지통';
|
||||
$lang->trash_nick_name = '삭제자 닉네임';
|
||||
$lang->trash_date = '삭제 날짜';
|
||||
$lang->trash_description = '설명';
|
||||
$lang->trash_type = '원본 종류';
|
||||
$lang->success_trashed = '휴지통으로 이동되었습니다.';
|
||||
$lang->empty_trash_selected = '선택 비우기';
|
||||
$lang->empty_trash_all = '휴지통 비우기';
|
||||
$lang->confirm_restore = '복원하시겠습니까?';
|
||||
$lang->success_empty = '성공적으로 비웠습니다.';
|
||||
$lang->fail_empty = '휴지통 비우기에 실패하였습니다.';
|
||||
$lang->success_restore = '성공적으로 복원하였습니다.';
|
||||
$lang->fail_restore = '복원에 실패하였습니다.';
|
||||
?>
|
||||
103
modules/trash/model/TrashVO.php
Normal file
103
modules/trash/model/TrashVO.php
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
class TrashVO
|
||||
{
|
||||
var $trashSrl;
|
||||
var $title;
|
||||
var $originModule;
|
||||
var $serializedObject;
|
||||
var $description;
|
||||
var $ipaddress;
|
||||
var $removerSrl;
|
||||
var $userId;
|
||||
var $nickName;
|
||||
var $regdate;
|
||||
|
||||
function getTrashSrl()
|
||||
{
|
||||
return $this->trashSrl;
|
||||
}
|
||||
function setTrashSrl($trashSrl)
|
||||
{
|
||||
$this->trashSrl = $trashSrl;
|
||||
}
|
||||
function getTitle()
|
||||
{
|
||||
if(empty($this->title)) return $lang->untitle;
|
||||
return $this->title;
|
||||
}
|
||||
function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
function getOriginModule()
|
||||
{
|
||||
if(empty($this->originModule)) return 'document';
|
||||
return $this->originModule;
|
||||
}
|
||||
function setOriginModule($originModule)
|
||||
{
|
||||
$this->originModule = $originModule;
|
||||
}
|
||||
function getSerializedObject()
|
||||
{
|
||||
return $this->serializedObject;
|
||||
}
|
||||
function setSerializedObject($serializedObject)
|
||||
{
|
||||
$this->serializedObject = $serializedObject;
|
||||
}
|
||||
function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
function getIpaddress()
|
||||
{
|
||||
return $this->ipaddress;
|
||||
}
|
||||
function setIpaddress($ipaddress)
|
||||
{
|
||||
$this->ipaddress = $ipaddress;
|
||||
}
|
||||
function getRemoverSrl()
|
||||
{
|
||||
return $this->removerSrl;
|
||||
}
|
||||
function setRemoverSrl($removerSrl)
|
||||
{
|
||||
$this->removerSrl = $removerSrl;
|
||||
}
|
||||
function getUserId()
|
||||
{
|
||||
return $this->userId;
|
||||
}
|
||||
function setUserId($userId)
|
||||
{
|
||||
$this->userId = $userId;
|
||||
}
|
||||
function getNickName()
|
||||
{
|
||||
return $this->nickName;
|
||||
}
|
||||
function setNickName($nickName)
|
||||
{
|
||||
$this->nickName = $nickName;
|
||||
}
|
||||
function getRegdate()
|
||||
{
|
||||
if(empty($this->regdate)) return date('YmdHis');
|
||||
|
||||
return $this->regdate;
|
||||
}
|
||||
function setRegdate($regdate)
|
||||
{
|
||||
$this->regdate = $regdate;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file Trash.php */
|
||||
/* Location: ./modules/trash/model/Trash.php */
|
||||
9
modules/trash/queries/deleteTrash.xml
Normal file
9
modules/trash/queries/deleteTrash.xml
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<query id="deleteTrash" action="delete">
|
||||
<tables>
|
||||
<table name="trash" />
|
||||
</tables>
|
||||
<conditions>
|
||||
<condition operation="equal" column="trash_srl" var="trashSrl" filter="number" />
|
||||
<condition operation="in" column="trash_srl" var="trashSrls" filter="number" />
|
||||
</conditions>
|
||||
</query>
|
||||
11
modules/trash/queries/getTrash.xml
Normal file
11
modules/trash/queries/getTrash.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="getTrash" action="select">
|
||||
<tables>
|
||||
<table name="trash" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="trash_srl" var="trashSrl" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
21
modules/trash/queries/getTrashList.xml
Normal file
21
modules/trash/queries/getTrashList.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<query id="getTrashList" action="select">
|
||||
<tables>
|
||||
<table name="trash" alias="T" />
|
||||
<table name="member" alias="M" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="T.*" />
|
||||
<column name="M.user_id" />
|
||||
<column name="M.nick_name" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="equal" column="T.remover_srl" default="M.member_srl" notnull="notnull" />
|
||||
<condition operation="equal" column="trash_srl" var="trashSrl" filter="number" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="trash_srl" order="desc" />
|
||||
<list_count var="list_count" default="20" />
|
||||
<page_count var="page_count" default="10" />
|
||||
<page var="page" default="1" />
|
||||
</navigation>
|
||||
</query>
|
||||
15
modules/trash/queries/insertTrash.xml
Normal file
15
modules/trash/queries/insertTrash.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<query id="insertTrash" action="insert">
|
||||
<tables>
|
||||
<table name="trash" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="trash_srl" var="trashSrl" filter="number" notnull="notnull" />
|
||||
<column name="title" var="title" notnull="notnull" />
|
||||
<column name="origin_module" var="originModule" notnull="notnull" default="document" />
|
||||
<column name="serialized_object" var="serializedObject" />
|
||||
<column name="description" var="description" />
|
||||
<column name="ipaddress" var="ipaddress" default="ipaddress()" />
|
||||
<column name="remover_srl" var="removerSrl" default="0" filter="number" />
|
||||
<column name="regdate" var="regdate" default="curdate()" />
|
||||
</columns>
|
||||
</query>
|
||||
10
modules/trash/schemas/trash.xml
Normal file
10
modules/trash/schemas/trash.xml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<table name="trash">
|
||||
<column name="trash_srl" type="number" size="11" notnull="notnull" primary_key="primary_key" />
|
||||
<column name="title" type="varchar" size="250" />
|
||||
<column name="origin_module" type="varchar" size="250" default="document" notnull="notnull" />
|
||||
<column name="serialized_object" type="bigtext" notnull="notnull" />
|
||||
<column name="description" type="text" />
|
||||
<column name="ipaddress" type="varchar" size="128" notnull="notnull" />
|
||||
<column name="remover_srl" type="number" size="11" notnull="notnull" />
|
||||
<column name="regdate" type="date" index="idx_regdate" />
|
||||
</table>
|
||||
12
modules/trash/tpl/filter/emptyTrash.xml
Normal file
12
modules/trash/tpl/filter/emptyTrash.xml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
<filter name="emptyTrash" module="trash" act="procTrashAdminEmptyTrash" confirm_msg_code="confirm_delete">
|
||||
<form>
|
||||
<node target="trash_srl" />
|
||||
</form>
|
||||
<parameter>
|
||||
<param name="trash_srl" target="trash_srl" />
|
||||
</parameter>
|
||||
<response callback_func="completeEmptyTrash">
|
||||
<tag name="error" />
|
||||
<tag name="message" />
|
||||
</response>
|
||||
</filter>
|
||||
2
modules/trash/tpl/header.html
Normal file
2
modules/trash/tpl/header.html
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
<!--%import("js/trash_admin.js")-->
|
||||
<h3 class="xeAdmin">{$lang->cmd_trash} <span class="gray">{$lang->cmd_management}</span></h3>
|
||||
33
modules/trash/tpl/js/trash_admin.js
Normal file
33
modules/trash/tpl/js/trash_admin.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* @file modules/trash/js/trash_admin.js
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief trash 모듈의 관리자용 javascript
|
||||
**/
|
||||
|
||||
|
||||
/* 휴지통 비우기 후 */
|
||||
function completeEmptyTrash(ret_obj) {
|
||||
var error = ret_obj['error'];
|
||||
var message = ret_obj['message'];
|
||||
|
||||
alert(message);
|
||||
if(error == '0') window.location.reload();
|
||||
}
|
||||
|
||||
function goRestore(trash_srl)
|
||||
{
|
||||
if(confirm(confirm_restore_msg))
|
||||
{
|
||||
var params = {'trash_srl':trash_srl};
|
||||
exec_xml('admin', 'procTrashAdminRestore', params, completeRestore);
|
||||
}
|
||||
}
|
||||
|
||||
function completeRestore(ret_obj)
|
||||
{
|
||||
var error = ret_obj['error'];
|
||||
var message = ret_obj['message'];
|
||||
|
||||
alert(message);
|
||||
if(error == '0') window.location.reload();
|
||||
}
|
||||
69
modules/trash/tpl/trash_list.html
Normal file
69
modules/trash/tpl/trash_list.html
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
<script>
|
||||
var confirm_restore_msg = '{$lang->confirm_restore}';
|
||||
</script>
|
||||
<!--%import("filter/emptyTrash.xml")-->
|
||||
<!--#include("header.html")-->
|
||||
|
||||
<form id="fo_list" action="./" method="get" onsubmit="return procFilter(this, emptyTrash)">
|
||||
<input type="hidden" name="page" value="{$page}" />
|
||||
<input type="hidden" name="is_all" value="false" />
|
||||
|
||||
<!-- 목록 -->
|
||||
<table cellspacing="0" class="rowTable clear">
|
||||
<caption>Total {number_format($total_count)}, Page {number_format($page)}/{number_format($total_page)}</caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><div>{$lang->no}</div></th>
|
||||
<th scope="col"><div><input type="checkbox" onclick="XE.checkboxToggleAll('trash_srls[]');" /></div></th>
|
||||
<th scope="col" class="wide"><div>{$lang->document} ({$lang->trash_type})</div></th>
|
||||
<th scope="col"><div>{$lang->trash_nick_name}</div></th>
|
||||
<th scope="col"><div>{$lang->trash_date}</div></th>
|
||||
<th scope="col"><div>{$lang->ipaddress}</div></th>
|
||||
<th scope="col"><dib>{$lang->trash_description}</div></th>
|
||||
<th scope="col"><div>{$lang->cmd_restore}</div></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<!--@foreach($trash_list as $no => $oTrashVO)-->
|
||||
<tr>
|
||||
<td class="number center">{$no}</td>
|
||||
<td><div><input type="checkbox" name="trash_srls[]" value="{$oTrashVO->getTrashSrl()}" /></div></t>
|
||||
<td class="left subject">
|
||||
{$oTrashVO->getTitle()} (
|
||||
<!--@if($oTrashVO->getOriginModule() == 'document')-->
|
||||
{$lang->document}
|
||||
<!--@else if($oTrashVO->getOriginModule() == 'comment')-->
|
||||
{$lang->replies}
|
||||
<!--@else-->
|
||||
{$lang->etc}
|
||||
<!--@end-->
|
||||
)
|
||||
</td>
|
||||
<td class="nowrap"><span class="member_{$oTrashVO->getMemberSrl()">{htmlspecialchars($oTrashVO->getNickName())}</span></td>
|
||||
<td class="date center nowrap">{zdate($oTrashVO->getRegdate(), "Y-m-d H:i:s")}</td>
|
||||
<td class="number center nowrap">{$oTrashVO->getIpaddress()}</td>
|
||||
<td class="left">{$oTrashVO->getDescription()}</td>
|
||||
<td class="center"><a href="#" onclick="goRestore({$oTrashVO->getTrashSrl()})">{$lang->cmd_restore}</a></td>
|
||||
</tr>
|
||||
<!--@end-->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="fr">
|
||||
<span class="button green"><input type="submit" value="{$lang->empty_trash_selected}" onclick="this.form.is_all.value=false" /></span>
|
||||
<span class="button blue"><input type="submit" value="{$lang->empty_trash_all}" onclick="this.form.is_all.value=true" /></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<!-- 페이지 네비게이션 -->
|
||||
<div class="pagination a1">
|
||||
<a href="{getUrl('page','','module_srl',$module_srl)}" class="prevEnd">{$lang->first_page}</a>
|
||||
<!--@while($page_no = $page_navigation->getNextPage())-->
|
||||
<!--@if($page == $page_no)-->
|
||||
<strong>{$page_no}</strong>
|
||||
<!--@else-->
|
||||
<a href="{getUrl('page',$page_no,'module_srl',$module_srl)}">{$page_no}</a>
|
||||
<!--@end-->
|
||||
<!--@end-->
|
||||
<a href="{getUrl('page',$page_navigation->last_page,'module_srl',$module_srl)}" class="nextEnd">{$lang->last_page}</a>
|
||||
</div>
|
||||
140
modules/trash/trash.admin.controller.php
Normal file
140
modules/trash/trash.admin.controller.php
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's controller class
|
||||
**/
|
||||
class trashAdminController extends trash
|
||||
{
|
||||
/**
|
||||
* @brief object insert to trash
|
||||
**/
|
||||
function insertTrash($obj)
|
||||
{
|
||||
if(Context::get('is_logged'))
|
||||
{
|
||||
$logged_info = Context::get('logged_info');
|
||||
|
||||
$oTrashVO = new TrashVO();
|
||||
$oTrashVO->setTrashSrl(getNextSequence());
|
||||
$oTrashVO->setTitle($obj->title);
|
||||
$oTrashVO->setOriginModule($obj->trashType);
|
||||
$oTrashVO->setSerializedObject(serialize($obj->originObject));
|
||||
$oTrashVO->setDescription($obj->description);
|
||||
$oTrashVO->setIpaddress($_SERVER['REMOTE_ADDR']);
|
||||
$oTrashVO->setRemoverSrl($logged_info->member_srl);
|
||||
$oTrashVO->setRegdate(date('YmdHis'));
|
||||
|
||||
$output = executeQuery('trash.insertTrash', $oTrashVO);
|
||||
return $output;
|
||||
}
|
||||
return new Object(-1, 'msg_not_permitted');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty trash
|
||||
* @param trashSrls : trash_srl in array
|
||||
**/
|
||||
function procTrashAdminEmptyTrash()
|
||||
{
|
||||
global $lang;
|
||||
$isAll = Context::get('is_all');
|
||||
$trashSrls = explode('|@|', Context::get('trash_srls'));
|
||||
|
||||
$oTrashModel = &getModel('trash');
|
||||
if($isAll == 'true')
|
||||
{
|
||||
$trashSrls = array();
|
||||
|
||||
//module relation data delete...
|
||||
$output = $oTrashModel->getTrashList($args);
|
||||
if(!$output->toBool()) return new Object(-1, $output->message);
|
||||
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$oTrashVO)
|
||||
{
|
||||
//class file check
|
||||
$classPath = ModuleHandler::getModulePath($oTrashVO->getOriginModule());
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
|
||||
|
||||
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $oTrashVO->getOriginModule());
|
||||
$classFile = FileHandler::getRealPath($classFile);
|
||||
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
|
||||
|
||||
$oAdminController = &getAdminController($oTrashVO->getOriginModule());
|
||||
if(!method_exists($oAdminController, 'emptyTrash')) return new Object(-1, 'not exist restore method in module class file');
|
||||
|
||||
$output = $oAdminController->emptyTrash($oTrashVO->getSerializedObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->_emptyTrash($trashSrls))
|
||||
return new Object(-1, $lang->fail_empty);
|
||||
|
||||
return new Object(0, $lang->success_empty);
|
||||
}
|
||||
|
||||
function procTrashAdminRestore()
|
||||
{
|
||||
global $lang;
|
||||
$trashSrl = Context::get('trash_srl');
|
||||
|
||||
$oTrashModel = &getModel('trash');
|
||||
$output = $oTrashModel->getTrash($trashSrl);
|
||||
if(!$output->toBool()) return new Object(-1, $output->message);
|
||||
|
||||
//class file check
|
||||
$classPath = ModuleHandler::getModulePath($output->data->getOriginModule());
|
||||
if(!is_dir(FileHandler::getRealPath($classPath))) return new Object(-1, 'not exist restore module directory');
|
||||
|
||||
$classFile = sprintf('%s%s.admin.controller.php', $classPath, $output->data->getOriginModule());
|
||||
$classFile = FileHandler::getRealPath($classFile);
|
||||
if(!file_exists($classFile)) return new Object(-1, 'not exist restore module class file');
|
||||
|
||||
$oAdminController = &getAdminController($output->data->getOriginModule());
|
||||
if(!method_exists($oAdminController, 'restoreTrash')) return new Object(-1, 'not exist restore method in module class file');
|
||||
|
||||
// begin transaction
|
||||
$oDB = &DB::getInstance();
|
||||
$oDB->begin();
|
||||
|
||||
$originObject = unserialize($output->data->getSerializedObject());
|
||||
$output = $oAdminController->restoreTrash($originObject);
|
||||
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return new Object(-1, $output->message);
|
||||
}
|
||||
else
|
||||
{
|
||||
Context::set('is_all', 'false');
|
||||
Context::set('trash_srls', $trashSrl);
|
||||
$output = $this->procTrashAdminEmptyTrash();
|
||||
if(!$output->toBool()) {
|
||||
$oDB->rollback();
|
||||
return new Object(-1, $output->message);
|
||||
}
|
||||
}
|
||||
$oDB->commit();
|
||||
return new Object(0, $lang->success_restore);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty trash
|
||||
* @param trashSrls : trash_srl in array
|
||||
**/
|
||||
function _emptyTrash($trashSrls)
|
||||
{
|
||||
if(!is_array($trashSrls)) return false;
|
||||
$args->trashSrls = $trashSrls;
|
||||
$output = executeQuery('trash.deleteTrash', $args);
|
||||
if(!$output->toBool()) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file trash.controller.php */
|
||||
/* Location: ./modules/trash/trash.controller.php */
|
||||
36
modules/trash/trash.admin.view.php
Normal file
36
modules/trash/trash.admin.view.php
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
<?php
|
||||
/**
|
||||
* @class trashView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of the module trash
|
||||
**/
|
||||
|
||||
class trashAdminView extends trash {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
// 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음)
|
||||
$template_path = sprintf("%stpl/",$this->module_path);
|
||||
$this->setTemplatePath($template_path);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief trash list
|
||||
**/
|
||||
function dispTrashAdminList() {
|
||||
$oTrashModel = getModel('trash');
|
||||
$output = $oTrashModel->getTrashList($args);
|
||||
|
||||
Context::set('trash_list', $output->data);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
Context::set('page', $output->page);
|
||||
Context::set('page_navigation', $output->page_navigation);
|
||||
|
||||
// 템플릿 파일 지정
|
||||
$this->setTemplateFile('trash_list');
|
||||
}
|
||||
}
|
||||
?>
|
||||
39
modules/trash/trash.class.php
Normal file
39
modules/trash/trash.class.php
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
/**
|
||||
* @class document
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's high class
|
||||
**/
|
||||
|
||||
require_once(_XE_PATH_.'modules/trash/model/TrashVO.php');
|
||||
|
||||
class trash extends ModuleObject {
|
||||
/**
|
||||
* @brief Implement if additional tasks are necessary when installing
|
||||
**/
|
||||
function moduleInstall() {
|
||||
return new Object();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief a method to check if successfully installed
|
||||
**/
|
||||
function checkUpdate() {
|
||||
//$oDB = &DB::getInstance();
|
||||
//$oModuleModel = &getModel('module');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Execute update
|
||||
**/
|
||||
function moduleUpdate() {
|
||||
//$oDB = &DB::getInstance();
|
||||
//$oModuleModel = &getModel('module');
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
|
||||
}
|
||||
}
|
||||
?>
|
||||
31
modules/trash/trash.controller.php
Normal file
31
modules/trash/trash.controller.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
/**
|
||||
* @class documentController
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief document the module's controller class
|
||||
**/
|
||||
class trashController extends trash
|
||||
{
|
||||
/**
|
||||
* @brief object insert to trash
|
||||
**/
|
||||
function insertTrash($oTrashVO)
|
||||
{
|
||||
$output = executeQuery('trash.insertTrash', $oTrashVO);
|
||||
debugPrint($output);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief empty trash
|
||||
* @param trashSrls : trash_srl in array
|
||||
**/
|
||||
function emptyTrash($trashSrls)
|
||||
{
|
||||
if(!is_array($trashSrls)) return false;
|
||||
executeQuery('trash.deleteTrash', $trashSrls);
|
||||
}
|
||||
}
|
||||
|
||||
/* End of file trash.controller.php */
|
||||
/* Location: ./modules/trash/trash.controller.php */
|
||||
58
modules/trash/trash.model.php
Normal file
58
modules/trash/trash.model.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
class trashModel extends trash
|
||||
{
|
||||
/**
|
||||
* @brief get one trash object
|
||||
**/
|
||||
function getTrash($trashSrl, $columnList = array())
|
||||
{
|
||||
$oTrashVO = new TrashVO();
|
||||
if(!$trashSrl) return $oTrashVO;
|
||||
|
||||
$args->trashSrl = $trashSrl;
|
||||
$output = executeQuery('trash.getTrash', $args, $columnList);
|
||||
|
||||
$this->_setTrashObject(&$oTrashVO, $output->data);
|
||||
$output->data = $oTrashVO;
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get trash object list
|
||||
**/
|
||||
function getTrashList($args, $columnList = array())
|
||||
{
|
||||
$output = executeQueryArray('trash.getTrashList', $args, $columnList);
|
||||
|
||||
if(is_array($output->data))
|
||||
{
|
||||
foreach($output->data AS $key=>$value)
|
||||
{
|
||||
$oTrashVO = new TrashVO();
|
||||
$this->_setTrashObject(&$oTrashVO, $value);
|
||||
$output->data[$key] = $oTrashVO;
|
||||
}
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief set trash object from std object
|
||||
**/
|
||||
function _setTrashObject(&$oTrashVO, $stdObject)
|
||||
{
|
||||
$oTrashVO->setTrashSrl($stdObject->trash_srl);
|
||||
$oTrashVO->setTitle($stdObject->title);
|
||||
$oTrashVO->setOriginModule($stdObject->origin_module);
|
||||
$oTrashVO->setSerializedObject($stdObject->serialized_object);
|
||||
$oTrashVO->setDescription($stdObject->description);
|
||||
$oTrashVO->setIpaddress($stdObject->ipaddress);
|
||||
$oTrashVO->setRemoverSrl($stdObject->remover_srl);
|
||||
$oTrashVO->setUserId($stdObject->user_id);
|
||||
$oTrashVO->setNickName($stdObject->nick_name);
|
||||
$oTrashVO->setRegdate($stdObject->regdate);
|
||||
}
|
||||
}
|
||||
|
||||
35
modules/trash/trash.view.php
Normal file
35
modules/trash/trash.view.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* @class trashView
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
* @brief View class of the module trash
|
||||
**/
|
||||
|
||||
class trashView extends trash {
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
**/
|
||||
function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
**/
|
||||
function dispTrash() {
|
||||
$trashSrl = Context::get('trashSrl');
|
||||
debugPrint($trashSrl);
|
||||
|
||||
$oWastebasketModel = getModel('trash');
|
||||
$output = $oWastebasketModel->getTrash($trashSrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief
|
||||
**/
|
||||
function dispTrashList() {
|
||||
$oWastebasketModel = getModel('trash');
|
||||
$output = $oWastebasketModel->getTrashList();
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue