From 869f0f3366f16d983f95599171fdbbfa9f87158f Mon Sep 17 00:00:00 2001 From: tianshujie Date: Fri, 27 Oct 2023 13:19:10 +0800 Subject: [PATCH] * Refactor task list of the operation management interface. --- extension/lite/datatable/ext/model/lite.php | 36 +++++++++++++------ .../execution/ext/ui/task.lite.html.hook.php | 3 ++ module/execution/ui/task.html.php | 2 +- 3 files changed, 30 insertions(+), 11 deletions(-) create mode 100644 extension/lite/execution/ext/ui/task.lite.html.hook.php diff --git a/extension/lite/datatable/ext/model/lite.php b/extension/lite/datatable/ext/model/lite.php index 8ae5bf5f27..ac22cb04f3 100644 --- a/extension/lite/datatable/ext/model/lite.php +++ b/extension/lite/datatable/ext/model/lite.php @@ -9,25 +9,40 @@ */ public function getFieldList($module, $method = '') { + /* Load corresponding module. */ if(!isset($this->config->$module)) $this->loadModel($module); $config = $this->config->$module; if(!empty($method) && isset($config->$method) && isset($config->$method->dtable)) $config = $config->$method; $fieldList = $config->dtable->fieldList; - if($this->session->currentProductType === 'normal') unset($fieldList['branch']); - foreach($fieldList as $field => $items) + + /* If doesn't need product, remove 'product' field. */ + if($this->session->hasProduct == 0 && (strpos($this->config->datatable->noProductModule, ",$module,") !== false)) { - if($field === 'branch') - { - if($this->session->currentProductType === 'branch') $fieldList[$field]['title'] = $this->lang->dtable->branch; - if($this->session->currentProductType === 'platform') $fieldList[$field]['title'] = $this->lang->dtable->platform; - continue; - } - $title = zget($this->lang->$module, $items['title'], zget($this->lang, $items['title'], $items['title'])); - $fieldList[$field]['title'] = $title; + $productIndex = array_search('product', $config->dtable->defaultField); + if($productIndex) unset($config->dtable->defaultField[$productIndex]); + if(isset($fieldList['product'])) unset($fieldList['product']); } + /* Nomal product without 'branch' field. */ + if($this->session->currentProductType === 'normal') unset($config->fieldList['branch']); + + foreach($fieldList as $fieldName => $items) + { + /* Translate field title. */ + if(!isset($items['title'])) $items['title'] = $fieldName; + $title = zget($this->lang->$module, $items['title'], zget($this->lang, $items['title'], $items['title'])); + $fieldList[$fieldName]['title'] = $title; + + /* Set col config default value. */ + if(!empty($items['type']) && isset($this->config->datatable->defaultColConfig[$items['type']])) + { + $fieldList[$fieldName] = array_merge($this->config->datatable->defaultColConfig[$items['type']], $fieldList[$fieldName]); + } + } + + /* Logic except open source version .*/ if($this->config->edition != 'open' and $module != 'story') { $fields = $this->loadModel('workflowfield')->getList($module); @@ -40,5 +55,6 @@ public function getFieldList($module, $method = '') $fieldList[$field->field]['required'] = 'no'; } } + return $fieldList; } diff --git a/extension/lite/execution/ext/ui/task.lite.html.hook.php b/extension/lite/execution/ext/ui/task.lite.html.hook.php new file mode 100644 index 0000000000..3395f45a7d --- /dev/null +++ b/extension/lite/execution/ext/ui/task.lite.html.hook.php @@ -0,0 +1,3 @@ + diff --git a/module/execution/ui/task.html.php b/module/execution/ui/task.html.php index 03fcbc6621..0638fbd64c 100644 --- a/module/execution/ui/task.html.php +++ b/module/execution/ui/task.html.php @@ -45,7 +45,7 @@ if(common::canModify('execution', $execution)) if($canImportTask && $execution->multiple) $importItems[] = array('text' => $lang->execution->importTask, 'url' => $this->createLink('execution', 'importTask', "execution={$execution->id}")); if($canImportBug && $execution->lifetime != 'ops' && !in_array($execution->attribute, array('request', 'review'))) { - $importItems[] = array('text' => $lang->execution->importBug, 'url' => $this->createLink('execution', 'importBug', "execution={$execution->id}")); + $importItems[] = array('text' => $lang->execution->importBug, 'url' => $this->createLink('execution', 'importBug', "execution={$execution->id}"), 'className' => 'importBug'); } }