Add Empty Trash option.

This commit is contained in:
BJRambo 2016-05-18 23:24:33 +09:00
parent 16c7392d9a
commit 3edeb1ef0a
3 changed files with 32 additions and 7 deletions

View file

@ -12,7 +12,7 @@ $lang->fail_empty = '휴지통을 비우지 못했습니다.';
$lang->success_restore = '복원했습니다.';
$lang->fail_restore = '복원하지 못했습니다.';
$lang->origin_module_type = '타입';
$lang->remove_all_trash_item = '휴지통을 완전히 비웁니다. 실행 후에는 복원이 불가능합니다.';
$lang->remove_all_trash_item = '선택한 항목의 휴지통 리스트들을 완전히 비웁니다. 실행 후에는 복원이 불가능합니다.';
$lang->title = '제목';
$lang->content = '내용';
$lang->trasher = '삭제자';
@ -20,3 +20,5 @@ $lang->origin_info = '원문 정보';
$lang->delete_info = '삭제 정보';
$lang->cmd_restore = '복원';
$lang->cmd_trash_list = '휴지통 목록';
$lang->cmd_trash_type = '휴지통비우기 타입';
$lang->trash_warning = '주의!';

View file

@ -9,9 +9,21 @@ var no_text_comment = '{$lang->no_text_comment}';
<input type="hidden" name="act" value="procTrashAdminEmptyTrash" />
<input type="hidden" name="page" value="{$page}" />
<input type="hidden" name="is_all" value="true" />
<div class="x_control-group">
<h2>{$lang->cmd_trash_type}</h2>
<div class="x_controls">
<label class="x_inline">
<input type="radio" name="is_type" value="document" /> {$lang->document}
</label>
<label class="x_inline">
<input type="radio" name="is_type" value="comment" /> {$lang->comment}
</label>
</div>
</div>
<p>
<button type="submit" class="x_btn x_btn-warning x_btn-primary" name="is_all" value="true">{$lang->empty_trash_all}</button>
&nbsp;{$lang->remove_all_trash_item}
&nbsp;<span class="x_label x_label-important">{$lang->trash_warning}</span>{$lang->remove_all_trash_item}
</p>
<table id="trashListTable" class="x_table x_table-striped x_table-hover">
<caption>

View file

@ -47,16 +47,23 @@ class trashAdminController extends trash
$isAll = Context::get('is_all');
$originModule = Context::get('origin_module');
$tmpTrashSrls = Context::get('cart');
$is_type = Context::get('is_type');
$trashSrls = array();
if($isAll != 'true')
{
if(is_array($tmpTrashSrls)) $trashSrls = $tmpTrashSrls;
else $trashSrls = explode('|@|', $tmpTrashSrls);
if(is_array($tmpTrashSrls))
{
$trashSrls = $tmpTrashSrls;
}
else
{
$trashSrls = explode('|@|', $tmpTrashSrls);
}
}
//module relation data delete...
$output = $this->_relationDataDelete($isAll, $trashSrls);
$output = $this->_relationDataDelete($isAll, $is_type, $trashSrls);
if(!$output->toBool()) return new Object(-1, $output->message);
if(!$this->_emptyTrash($trashSrls)) return new Object(-1, $lang->fail_empty);
@ -70,15 +77,19 @@ class trashAdminController extends trash
/**
* Empty trash - private method
* @param string $isAll
* @param string $is_type
* @param array trashSrls
* @return Object
*/
function _relationDataDelete($isAll, &$trashSrls)
function _relationDataDelete($isAll, $is_type, &$trashSrls)
{
$oTrashModel = getModel('trash');
if($isAll == 'true')
{
$output = $oTrashModel->getTrashAllList(array());
$args = new stdClass();
$args->originModule = $is_type;
$output = $oTrashModel->getTrashAllList($args);
if(!$output->toBool())
{
return new Object(-1, $output->message);