From b4917d7027de51e945ebc2eeb6371fadafcd370f Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 1 Nov 2023 14:27:26 +0800 Subject: [PATCH] * Optimize code of sorting dtable in bug::browse. --- module/bug/config/table.php | 42 ++++++++++++++++++++--------------- module/bug/ui/browse.html.php | 6 +++-- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/module/bug/config/table.php b/module/bug/config/table.php index 09027ac583..6d945d37b1 100644 --- a/module/bug/config/table.php +++ b/module/bug/config/table.php @@ -65,10 +65,11 @@ $config->bug->dtable->fieldList['openedBy']['type'] = 'user'; $config->bug->dtable->fieldList['openedBy']['show'] = true; $config->bug->dtable->fieldList['openedBy']['group'] = 4; -$config->bug->dtable->fieldList['openedDate']['title'] = $lang->bug->abbr->openedDate; -$config->bug->dtable->fieldList['openedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['openedDate']['show'] = true; +$config->bug->dtable->fieldList['openedDate']['title'] = $lang->bug->abbr->openedDate; +$config->bug->dtable->fieldList['openedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['openedDate']['show'] = true; $config->bug->dtable->fieldList['openedDate']['group'] = 4; +$config->bug->dtable->fieldList['openedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['confirmed']['title'] = $lang->bug->confirmed; $config->bug->dtable->fieldList['confirmed']['type'] = 'category'; @@ -83,9 +84,10 @@ $config->bug->dtable->fieldList['assignedTo']['assignLink'] = array('module' => $config->bug->dtable->fieldList['assignedTo']['show'] = true; $config->bug->dtable->fieldList['assignedTo']['group'] = 5; -$config->bug->dtable->fieldList['assignedDate']['title'] = $lang->bug->assignedDate; -$config->bug->dtable->fieldList['assignedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['assignedDate']['group'] = 5; +$config->bug->dtable->fieldList['assignedDate']['title'] = $lang->bug->assignedDate; +$config->bug->dtable->fieldList['assignedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['assignedDate']['group'] = 5; +$config->bug->dtable->fieldList['assignedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['deadline']['title'] = $lang->bug->deadline; $config->bug->dtable->fieldList['deadline']['type'] = 'date'; @@ -106,9 +108,10 @@ $config->bug->dtable->fieldList['toTaskName']['type'] = 'text'; $config->bug->dtable->fieldList['toTaskName']['link'] = array('module' => 'task', 'method' => 'view', 'params' => 'taskID={toTask}'); $config->bug->dtable->fieldList['toTaskName']['group'] = 6; -$config->bug->dtable->fieldList['resolvedDate']['title'] = $lang->bug->abbr->resolvedDate; -$config->bug->dtable->fieldList['resolvedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['resolvedDate']['group'] = 6; +$config->bug->dtable->fieldList['resolvedDate']['title'] = $lang->bug->abbr->resolvedDate; +$config->bug->dtable->fieldList['resolvedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['resolvedDate']['group'] = 6; +$config->bug->dtable->fieldList['resolvedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['resolvedBuild']['title'] = $lang->bug->resolvedBuild; $config->bug->dtable->fieldList['resolvedBuild']['type'] = 'text'; @@ -128,9 +131,10 @@ $config->bug->dtable->fieldList['activatedCount']['title'] = $lang->bug->abbr->a $config->bug->dtable->fieldList['activatedCount']['type'] = 'count'; $config->bug->dtable->fieldList['activatedCount']['group'] = 8; -$config->bug->dtable->fieldList['activatedDate']['title'] = $lang->bug->activatedDate; -$config->bug->dtable->fieldList['activatedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['activatedDate']['group'] = 8; +$config->bug->dtable->fieldList['activatedDate']['title'] = $lang->bug->activatedDate; +$config->bug->dtable->fieldList['activatedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['activatedDate']['group'] = 8; +$config->bug->dtable->fieldList['activatedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['storyName']['title'] = $lang->bug->story; $config->bug->dtable->fieldList['storyName']['type'] = 'text'; @@ -154,17 +158,19 @@ $config->bug->dtable->fieldList['lastEditedBy']['title'] = $lang->bug->lastEdite $config->bug->dtable->fieldList['lastEditedBy']['type'] = 'user'; $config->bug->dtable->fieldList['lastEditedBy']['group'] = 10; -$config->bug->dtable->fieldList['lastEditedDate']['title'] = $lang->bug->abbr->lastEditedDate; -$config->bug->dtable->fieldList['lastEditedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['lastEditedDate']['group'] = 10; +$config->bug->dtable->fieldList['lastEditedDate']['title'] = $lang->bug->abbr->lastEditedDate; +$config->bug->dtable->fieldList['lastEditedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['lastEditedDate']['group'] = 10; +$config->bug->dtable->fieldList['lastEditedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['closedBy']['title'] = $lang->bug->closedBy; $config->bug->dtable->fieldList['closedBy']['type'] = 'user'; $config->bug->dtable->fieldList['closedBy']['group'] = 10; -$config->bug->dtable->fieldList['closedDate']['title'] = $lang->bug->closedDate; -$config->bug->dtable->fieldList['closedDate']['type'] = 'date'; -$config->bug->dtable->fieldList['closedDate']['group'] = 10; +$config->bug->dtable->fieldList['closedDate']['title'] = $lang->bug->closedDate; +$config->bug->dtable->fieldList['closedDate']['type'] = 'date'; +$config->bug->dtable->fieldList['closedDate']['group'] = 10; +$config->bug->dtable->fieldList['closedDate']['sortType'] = 'date'; $config->bug->dtable->fieldList['actions']['title'] = $lang->actions; $config->bug->dtable->fieldList['actions']['type'] = 'actions'; diff --git a/module/bug/ui/browse.html.php b/module/bug/ui/browse.html.php index e4ab1f7fde..d632826cd8 100644 --- a/module/bug/ui/browse.html.php +++ b/module/bug/ui/browse.html.php @@ -173,9 +173,11 @@ $cols = $this->loadModel('datatable')->getSetting('bug'); if(isset($cols['branch'])) $cols['branch']['map'] = $branchTagOption; if(isset($cols['project'])) $cols['project']['map'] = $projectPairs; if(isset($cols['execution'])) $cols['execution']['map'] = $executions; -foreach($cols as $colName => $col) $cols[$colName]['sortType'] = true; - if($product->type == 'normal') unset($cols['branch']); +foreach($cols as $colName => $col) +{ + if(!isset($col['sortType'])) $cols[$colName]['sortType'] = true; +} $bugs = initTableData($bugs, $cols, $this->bug);