diff --git a/module/action/config.php b/module/action/config.php
index caa2de9145..b5c5f0c8c0 100755
--- a/module/action/config.php
+++ b/module/action/config.php
@@ -60,3 +60,9 @@ $config->action->majorList['execution'] = array('opened', 'edited');
$config->action->needGetProjectType = 'build,task,bug,case,testcase,caselib,testtask,testsuite,testreport,doc,issue,release,risk,design,opportunity,trainplan,gapanalysis,researchplan,researchreport,';
$config->action->needGetRelateField = ',story,productplan,release,task,build,bug,testcase,case,testtask,testreport,doc,doclib,issue,risk,opportunity,trainplan,gapanalysis,team,whitelist,researchplan,researchreport,meeting,kanbanlane,kanbancolumn,';
$config->action->noLinkModules = ',doclib,module,webhook,gitlab,sonarqube,pipeline,jenkins,kanban,kanbanspace,kanbancolumn,kanbanlane,kanbanregion,kanbancard,execution,project,traincategory,apistruct,program,product,';
+
+$config->action->preferredTypeNum = 10;
+
+$config->action->preferredType = new stdclass();
+$config->action->preferredType->new = array('user', 'story', 'task', 'bug', 'case', 'doc', 'program', 'product', 'project', 'execution');
+$config->action->preferredType->classic = array('user', 'story', 'task', 'bug', 'case', 'doc', 'product', 'execution', 'productplan', 'build');
diff --git a/module/action/control.php b/module/action/control.php
index 7a143d26ba..1057f4fc8a 100755
--- a/module/action/control.php
+++ b/module/action/control.php
@@ -14,6 +14,7 @@ class action extends control
/**
* Trash.
*
+ * @param string $browseType
* @param string $type all|hidden
* @param string $orderBy
* @param int $recTotal
@@ -22,7 +23,7 @@ class action extends control
* @access public
* @return void
*/
- public function trash($type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
+ public function trash($browseType = 'all', $type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1)
{
$this->loadModel('backup');
@@ -60,18 +61,37 @@ class action extends control
$pager = pager::init($recTotal, $recPerPage, $pageID);
/* Append id for secend sort. */
- $sort = common::appendOrder($orderBy);
- $trashes = $this->action->getTrashes($type, $sort, $pager);
+ $sort = common::appendOrder($orderBy);
+ $trashes = $this->action->getTrashes($browseType, $type, $sort, $pager);
+ $objectTypeList = $this->action->getTrashObjectTypes($type);
+ $objectTypeList = array_keys($objectTypeList);
+
+ $preferredType = array();
+ $moreType = array();
+ $preferredTypeConfig = $this->config->systemMode == 'new' ? $this->config->action->preferredType->new : $this->config->action->preferredType->classic;
+ foreach($objectTypeList as $objectType)
+ {
+ in_array($objectType, $preferredTypeConfig) ? $preferredType[$objectType] = $objectType : $moreType[$objectType] = $objectType;
+ }
+ if(count($preferredType) < $this->config->action->preferredTypeNum)
+ {
+ $toPreferredType = array_splice($moreType, 0, $this->config->action->preferredTypeNum - count($preferredType));
+ $preferredType = $preferredType + $toPreferredType;
+ }
/* Title and position. */
$this->view->title = $this->lang->action->trash;
$this->view->position[] = $this->lang->action->trash;
- $this->view->trashes = $trashes;
- $this->view->type = $type;
- $this->view->orderBy = $orderBy;
- $this->view->pager = $pager;
- $this->view->users = $this->loadModel('user')->getPairs('noletter');
+ $this->view->trashes = $trashes;
+ $this->view->type = $type;
+ $this->view->currentObjectType = $browseType;
+ $this->view->orderBy = $orderBy;
+ $this->view->pager = $pager;
+ $this->view->users = $this->loadModel('user')->getPairs('noletter');
+ $this->view->preferredType = $preferredType;
+ $this->view->moreType = $moreType;
+ $this->view->preferredTypeConfig = $preferredTypeConfig;
$this->display();
}
diff --git a/module/action/css/trash.css b/module/action/css/trash.css
index afbfc580cc..2f9190111c 100755
--- a/module/action/css/trash.css
+++ b/module/action/css/trash.css
@@ -1,3 +1,7 @@
.table-footer .table-actions {width: auto; visibility: visible; opacity: 1;}
.table-footer .table-actions .text {line-height: 28px;}
table tbody tr td {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
+
+#mainMenu .btn-toolbar .btn-group .dropdown-menu .btn-active-text:hover .text {color: #fff}
+
+.dropdown-menu .btn-active-text:hover .text:after {border-bottom: 0px;}
diff --git a/module/action/model.php b/module/action/model.php
index bbea80d598..2791f3ee01 100755
--- a/module/action/model.php
+++ b/module/action/model.php
@@ -610,17 +610,19 @@ class actionModel extends model
/**
* Get deleted objects.
*
+ * @param string $objectType
* @param string $type all|hidden
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
- public function getTrashes($type, $orderBy, $pager)
+ public function getTrashes($objectType, $type, $orderBy, $pager)
{
- $extra = $type == 'hidden' ? self::BE_HIDDEN : self::CAN_UNDELETED;
+ $extra = $type == 'hidden' ? self::BE_HIDDEN : self::CAN_UNDELETED;
$trashes = $this->dao->select('*')->from(TABLE_ACTION)
->where('action')->eq('deleted')
+ ->beginIF($objectType != 'all')->andWhere('objectType')->eq($objectType)->fi()
->andWhere('extra')->eq($extra)
->andWhere('vision')->eq($this->config->vision)
->orderBy($orderBy)->page($pager)->fetchAll();
@@ -665,9 +667,23 @@ class actionModel extends model
$trash->objectName = isset($objectNames[$objectType][$trash->objectID]) ? $objectNames[$objectType][$trash->objectID] : '';
}
+
return $trashes;
}
+ /**
+ * Get object type list of trashes.
+ *
+ * @param string $type
+ * @access public
+ * @return array
+ */
+ public function getTrashObjectTypes($type)
+ {
+ $extra = $type == 'hidden' ? self::BE_HIDDEN : self::CAN_UNDELETED;
+ return $this->dao->select('objectType')->from(TABLE_ACTION)->where('action')->eq('deleted')->andWhere('extra')->eq($extra)->andWhere('vision')->eq($this->config->vision)->fetchAll('objectType');
+ }
+
/**
* Get histories of an action.
*
diff --git a/module/action/view/trash.html.php b/module/action/view/trash.html.php
index 2651f5754a..fa646c1fc9 100755
--- a/module/action/view/trash.html.php
+++ b/module/action/view/trash.html.php
@@ -12,6 +12,50 @@
?>