diff --git a/module/action/control.php b/module/action/control.php index 61c8f3b71c..35bd340480 100644 --- a/module/action/control.php +++ b/module/action/control.php @@ -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')); + } + } } diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 8831079dec..c9aa49309b 100644 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -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 = '今天'; diff --git a/module/action/model.php b/module/action/model.php index f0048e498a..a25893c2ef 100644 --- a/module/action/model.php +++ b/module/action/model.php @@ -13,9 +13,9 @@ 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(); + } } diff --git a/module/action/view/trash.html.php b/module/action/view/trash.html.php index 1f0e3d169a..7713e3540b 100644 --- a/module/action/view/trash.html.php +++ b/module/action/view/trash.html.php @@ -36,7 +36,7 @@ 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'); ?> @@ -45,7 +45,12 @@ -
action->trashTips;?>
+ +
+ action->hideAll, inlink('hideAll'), 'hiddenwin');?> + action->trashTips;?> +
+
show();?>