* add the feature of hideAll().
This commit is contained in:
@@ -37,18 +37,19 @@ class action extends control
|
||||
$this->session->set('testtaskList', $uri);
|
||||
$this->session->set('docList', $uri);
|
||||
|
||||
/* Header and position. */
|
||||
$this->view->header->title = $this->lang->action->trash;
|
||||
$this->view->position[] = $this->lang->action->trash;
|
||||
|
||||
/* Get deleted objects. */
|
||||
$this->app->loadClass('pager', $static = true);
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
$this->view->trashes = $this->action->getTrashes($orderBy, $pager);
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->users['system'] = 'system';
|
||||
$pager = pager::init($recTotal, $recPerPage, $pageID);
|
||||
$trashes = $this->action->getTrashes($orderBy, $pager);
|
||||
|
||||
/* Title and position. */
|
||||
$this->view->title = $this->lang->action->trash;
|
||||
$this->view->position[] = $this->lang->action->trash;
|
||||
|
||||
$this->view->trashes = $trashes;
|
||||
$this->view->orderBy = $orderBy;
|
||||
$this->view->pager = $pager;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->display();
|
||||
}
|
||||
|
||||
@@ -66,15 +67,35 @@ class action extends control
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide object.
|
||||
* Hide an deleted object.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function hide($actionID)
|
||||
public function hideOne($actionID)
|
||||
{
|
||||
$this->action->hide($actionID);
|
||||
$this->action->hideOne($actionID);
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide all deleted objects.
|
||||
*
|
||||
* @param string $confirm
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function hideAll($confirm = 'no')
|
||||
{
|
||||
if($confirm == 'no')
|
||||
{
|
||||
die(js::confirm($this->lang->action->confirmHideAll, inlink('hideAll', "confirm=yes")));
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->action->hideAll();
|
||||
die(js::reload('parent'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,10 +10,6 @@
|
||||
* @link http://www.zentao.net
|
||||
*/
|
||||
$lang->action->common = '系统日志';
|
||||
$lang->action->trash = '回收站';
|
||||
$lang->action->undelete = '还原';
|
||||
$lang->action->hide = '隐藏';
|
||||
|
||||
$lang->action->product = '产品';
|
||||
$lang->action->project = '项目';
|
||||
$lang->action->objectType = '对象类型';
|
||||
@@ -23,9 +19,16 @@ $lang->action->actor = '操作者';
|
||||
$lang->action->action = '动作';
|
||||
$lang->action->actionID = '记录ID';
|
||||
$lang->action->date = '日期';
|
||||
$lang->action->trashTips = '提示:为了保证系统的完整性,禅道系统的删除都是标记删除。';
|
||||
$lang->action->textDiff = '文本格式';
|
||||
$lang->action->original = '原始格式';
|
||||
|
||||
$lang->action->trash = '回收站';
|
||||
$lang->action->undelete = '还原';
|
||||
$lang->action->hideOne = '隐藏';
|
||||
$lang->action->hideAll = '全部隐藏';
|
||||
|
||||
$lang->action->trashTips = '提示:为了保证系统的完整性,禅道系统的删除都是标记删除。';
|
||||
$lang->action->textDiff = '文本格式';
|
||||
$lang->action->original = '原始格式';
|
||||
$lang->action->confirmHideAll = '您确定要全部隐藏这些记录吗?';
|
||||
|
||||
$lang->action->dynamic = new stdclass();
|
||||
$lang->action->dynamic->today = '今天';
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<?php
|
||||
class actionModel extends model
|
||||
{
|
||||
const CAN_UNDELETED = 1; // The deleted object can be undeleted or not.
|
||||
const BE_UNDELETED = 0; // The deleted object has been undeleted or not.
|
||||
const BE_HIDDEN = 2;
|
||||
const BE_UNDELETED = 0; // The deleted object has been undeleted.
|
||||
const CAN_UNDELETED = 1; // The deleted object can be undeleted.
|
||||
const BE_HIDDEN = 2; // The deleted object has been hidded.
|
||||
|
||||
/**
|
||||
* Create a action.
|
||||
@@ -611,17 +611,54 @@ class actionModel extends model
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide object.
|
||||
* Undelete a record.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function undelete($actionID)
|
||||
{
|
||||
$action = $this->loadModel('action')->getById($actionID);
|
||||
if($action->action != 'deleted') return;
|
||||
|
||||
/* Update deleted field in object table. */
|
||||
$table = $this->config->objectTables[$action->objectType];
|
||||
$this->dao->update($table)->set('deleted')->eq(0)->where('id')->eq($action->objectID)->exec();
|
||||
|
||||
/* Update action record in action table. */
|
||||
$this->dao->update(TABLE_ACTION)->set('extra')->eq(ACTIONMODEL::BE_UNDELETED)->where('id')->eq($actionID)->exec();
|
||||
$this->action->create($action->objectType, $action->objectID, 'undeleted');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide an object.
|
||||
*
|
||||
* @param int $actionID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function hide($actionID)
|
||||
public function hideOne($actionID)
|
||||
{
|
||||
$action = $this->getById($actionID);
|
||||
if($action->action != 'deleted') return;
|
||||
|
||||
$this->dao->update(TABLE_ACTION)->set('extra')->eq(self::BE_HIDDEN)->where('id')->eq($actionID)->exec();
|
||||
$this->create($action->objectType, $action->objectID, 'hidden');
|
||||
}
|
||||
|
||||
/**
|
||||
* Hide all deleted objects.
|
||||
*
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function hideAll()
|
||||
{
|
||||
$this->dao->update(TABLE_ACTION)
|
||||
->set('extra')->eq(self::BE_HIDDEN)
|
||||
->where('action')->eq('deleted')
|
||||
->andWhere('extra')->eq(self::CAN_UNDELETED)
|
||||
->exec();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<td>
|
||||
<?php
|
||||
common::printLink('action', 'undelete', "actionid=$action->id", $lang->action->undelete, 'hiddenwin');
|
||||
common::printLink('action', 'hide', "actionid=$action->id", $lang->action->hide, 'hiddenwin');
|
||||
common::printLink('action', 'hideOne', "actionid=$action->id", $lang->action->hideOne, 'hiddenwin');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -45,7 +45,12 @@
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td colspan='6'>
|
||||
<div class='f-left'><?php echo $lang->action->trashTips;?></div>
|
||||
<?php if($trashes):?>
|
||||
<div class='f-left'>
|
||||
<?php echo html::linkButton($lang->action->hideAll, inlink('hideAll'), 'hiddenwin');?>
|
||||
<?php echo $lang->action->trashTips;?>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
<div><?php $pager->show();?></div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
Reference in New Issue
Block a user