From be07c40bf79e17184b924119bdfae2378b214a38 Mon Sep 17 00:00:00 2001 From: wangyidong Date: Mon, 28 Mar 2016 09:27:09 +0800 Subject: [PATCH] * code for task #2561. --- module/bug/config.php | 108 ++++++++++++ module/bug/control.php | 2 + module/bug/model.php | 105 +++++++++++ module/bug/view/browse.html.php | 95 +--------- module/bug/view/browsedata.html.php | 97 ++++++++++ module/bug/view/datatabledata.html.php | 29 +++ module/common/view/datatable.fix.html.php | 36 ++++ module/common/view/datatable.html.php | 138 +++++++++++++++ module/datatable/config.php | 4 + module/datatable/control.php | 83 +++++++++ module/datatable/lang/en.php | 15 ++ module/datatable/lang/zh-cn.php | 15 ++ module/datatable/model.php | 161 +++++++++++++++++ module/datatable/view/custom.html.php | 185 ++++++++++++++++++++ module/dev/lang/en.php | 1 + module/dev/lang/zh-cn.php | 1 + module/group/lang/resource.php | 3 + module/product/control.php | 3 + module/product/view/browse.html.php | 75 +------- module/product/view/browsedata.html.php | 77 ++++++++ module/product/view/datatabledata.html.php | 29 +++ module/project/control.php | 1 + module/project/view/datatabledata.html.php | 29 +++ module/project/view/task.html.php | 117 ++----------- module/project/view/taskdata.html.php | 107 +++++++++++ module/story/config.php | 98 +++++++++++ module/story/model.php | 108 ++++++++++++ module/task/config.php | 123 +++++++++++++ module/task/model.php | 121 +++++++++++++ module/testcase/config.php | 73 ++++++++ module/testcase/control.php | 2 + module/testcase/lang/en.php | 4 + module/testcase/lang/zh-cn.php | 4 + module/testcase/model.php | 87 +++++++++ module/testcase/view/browse.html.php | 69 +------- module/testcase/view/browsedata.html.php | 75 ++++++++ module/testcase/view/datatabledata.html.php | 29 +++ module/testtask/config.php | 3 + module/testtask/control.php | 4 +- module/testtask/model.php | 88 ++++++++++ module/testtask/view/cases.html.php | 71 ++------ module/testtask/view/casesdata.html.php | 70 ++++++++ module/testtask/view/datatabledata.html.php | 36 ++++ module/upgrade/model.php | 25 +++ 44 files changed, 2228 insertions(+), 378 deletions(-) create mode 100644 module/bug/view/browsedata.html.php create mode 100644 module/bug/view/datatabledata.html.php create mode 100644 module/common/view/datatable.fix.html.php create mode 100644 module/common/view/datatable.html.php create mode 100644 module/datatable/config.php create mode 100644 module/datatable/control.php create mode 100644 module/datatable/lang/en.php create mode 100644 module/datatable/lang/zh-cn.php create mode 100644 module/datatable/model.php create mode 100644 module/datatable/view/custom.html.php create mode 100644 module/product/view/browsedata.html.php create mode 100644 module/product/view/datatabledata.html.php create mode 100644 module/project/view/datatabledata.html.php create mode 100644 module/project/view/taskdata.html.php create mode 100644 module/testcase/view/browsedata.html.php create mode 100644 module/testcase/view/datatabledata.html.php create mode 100644 module/testtask/view/casesdata.html.php create mode 100644 module/testtask/view/datatabledata.html.php diff --git a/module/bug/config.php b/module/bug/config.php index f84abe7e2f..bd7de7f9b0 100644 --- a/module/bug/config.php +++ b/module/bug/config.php @@ -134,3 +134,111 @@ $config->bug->search['params']['assignedDate'] = array('operator' => '>=', $config->bug->search['params']['resolvedDate'] = array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->search['params']['closedDate'] = array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->bug->search['params']['lastEditedDate']= array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date'); + +$config->bug->datatable = new stdclass(); +$config->bug->datatable->defaultField = array('id', 'severity', 'pri', 'title', 'status', 'openedBy', 'openedDate', 'assignedTo', 'resolvedBy', 'resolution', 'resolvedDate', 'actions'); + +$config->bug->datatable->fieldList['id']['title'] = 'idAB'; +$config->bug->datatable->fieldList['id']['fixed'] = 'left'; +$config->bug->datatable->fieldList['id']['width'] = '70'; +$config->bug->datatable->fieldList['id']['required'] = 'yes'; + +$config->bug->datatable->fieldList['severity']['title'] = 'severityAB'; +$config->bug->datatable->fieldList['severity']['fixed'] = 'left'; +$config->bug->datatable->fieldList['severity']['width'] = '50'; +$config->bug->datatable->fieldList['severity']['required'] = 'no'; + +$config->bug->datatable->fieldList['pri']['title'] = 'P'; +$config->bug->datatable->fieldList['pri']['fixed'] = 'left'; +$config->bug->datatable->fieldList['pri']['width'] = '40'; +$config->bug->datatable->fieldList['pri']['required'] = 'no'; + +$config->bug->datatable->fieldList['title']['title'] = 'title'; +$config->bug->datatable->fieldList['title']['fixed'] = 'left'; +$config->bug->datatable->fieldList['title']['width'] = 'auto'; +$config->bug->datatable->fieldList['title']['required'] = 'yes'; + +$config->bug->datatable->fieldList['type']['title'] = 'type'; +$config->bug->datatable->fieldList['type']['fixed'] = 'no'; +$config->bug->datatable->fieldList['type']['width'] = '90'; +$config->bug->datatable->fieldList['type']['required'] = 'no'; + +$config->bug->datatable->fieldList['status']['title'] = 'statusAB'; +$config->bug->datatable->fieldList['status']['fixed'] = 'no'; +$config->bug->datatable->fieldList['status']['width'] = '80'; +$config->bug->datatable->fieldList['status']['required'] = 'no'; + +$config->bug->datatable->fieldList['activatedCount']['title'] = 'activatedCountAB'; +$config->bug->datatable->fieldList['activatedCount']['fixed'] = 'no'; +$config->bug->datatable->fieldList['activatedCount']['width'] = '80'; +$config->bug->datatable->fieldList['activatedCount']['required'] = 'no'; + +$config->bug->datatable->fieldList['openedBy']['title'] = 'openedByAB'; +$config->bug->datatable->fieldList['openedBy']['fixed'] = 'no'; +$config->bug->datatable->fieldList['openedBy']['width'] = '80'; +$config->bug->datatable->fieldList['openedBy']['required'] = 'no'; + +$config->bug->datatable->fieldList['openedDate']['title'] = 'openedDateAB'; +$config->bug->datatable->fieldList['openedDate']['fixed'] = 'no'; +$config->bug->datatable->fieldList['openedDate']['width'] = '90'; +$config->bug->datatable->fieldList['openedDate']['required'] = 'no'; + +$config->bug->datatable->fieldList['openedBuild']['title'] = 'openedBuild'; +$config->bug->datatable->fieldList['openedBuild']['fixed'] = 'no'; +$config->bug->datatable->fieldList['openedBuild']['width'] = '120'; +$config->bug->datatable->fieldList['openedBuild']['required'] = 'no'; + +$config->bug->datatable->fieldList['assignedTo']['title'] = 'assignedTo'; +$config->bug->datatable->fieldList['assignedTo']['fixed'] = 'no'; +$config->bug->datatable->fieldList['assignedTo']['width'] = '80'; +$config->bug->datatable->fieldList['assignedTo']['required'] = 'no'; + +$config->bug->datatable->fieldList['assignedDate']['title'] = 'assignedDate'; +$config->bug->datatable->fieldList['assignedDate']['fixed'] = 'no'; +$config->bug->datatable->fieldList['assignedDate']['width'] = '90'; +$config->bug->datatable->fieldList['assignedDate']['required'] = 'no'; + +$config->bug->datatable->fieldList['resolvedBy']['title'] = 'resolvedByAB'; +$config->bug->datatable->fieldList['resolvedBy']['fixed'] = 'no'; +$config->bug->datatable->fieldList['resolvedBy']['width'] = '80'; +$config->bug->datatable->fieldList['resolvedBy']['required'] = 'no'; + +$config->bug->datatable->fieldList['resolution']['title'] = 'resolutionAB'; +$config->bug->datatable->fieldList['resolution']['fixed'] = 'no'; +$config->bug->datatable->fieldList['resolution']['width'] = '80'; +$config->bug->datatable->fieldList['resolution']['required'] = 'no'; + +$config->bug->datatable->fieldList['resolvedDate']['title'] = 'resolvedDateAB'; +$config->bug->datatable->fieldList['resolvedDate']['fixed'] = 'no'; +$config->bug->datatable->fieldList['resolvedDate']['width'] = '90'; +$config->bug->datatable->fieldList['resolvedDate']['required'] = 'no'; + +$config->bug->datatable->fieldList['resolvedBuild']['title'] = 'resolvedBuild'; +$config->bug->datatable->fieldList['resolvedBuild']['fixed'] = 'no'; +$config->bug->datatable->fieldList['resolvedBuild']['width'] = '120'; +$config->bug->datatable->fieldList['resolvedBuild']['required'] = 'no'; + +$config->bug->datatable->fieldList['closedBy']['title'] = 'closedBy'; +$config->bug->datatable->fieldList['closedBy']['fixed'] = 'no'; +$config->bug->datatable->fieldList['closedBy']['width'] = '80'; +$config->bug->datatable->fieldList['closedBy']['required'] = 'no'; + +$config->bug->datatable->fieldList['closedDate']['title'] = 'closedDate'; +$config->bug->datatable->fieldList['closedDate']['fixed'] = 'no'; +$config->bug->datatable->fieldList['closedDate']['width'] = '90'; +$config->bug->datatable->fieldList['closedDate']['required'] = 'no'; + +$config->bug->datatable->fieldList['lastEditedDate']['title'] = 'lastEditedDateAB'; +$config->bug->datatable->fieldList['lastEditedDate']['fixed'] = 'no'; +$config->bug->datatable->fieldList['lastEditedDate']['width'] = '90'; +$config->bug->datatable->fieldList['lastEditedDate']['required'] = 'no'; + +$config->bug->datatable->fieldList['actions']['title'] = 'actions'; +$config->bug->datatable->fieldList['actions']['fixed'] = 'right'; +$config->bug->datatable->fieldList['actions']['width'] = '140'; +$config->bug->datatable->fieldList['actions']['required'] = 'yes'; + +$config->bug->datatable->fieldList['branch']['title'] = 'branch'; +$config->bug->datatable->fieldList['branch']['fixed'] = 'left'; +$config->bug->datatable->fieldList['branch']['width'] = '100'; +$config->bug->datatable->fieldList['branch']['required'] = 'no'; diff --git a/module/bug/control.php b/module/bug/control.php index cc6e71f5f8..b263cbb57f 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -64,6 +64,8 @@ class bug extends control */ public function browse($productID = 0, $branch = '', $browseType = 'unclosed', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->loadModel('datatable'); + /* Set browseType, productID, moduleID, queryID and branch. */ $browseType = strtolower($browseType); $productID = $this->product->saveState($productID, $this->products); diff --git a/module/bug/model.php b/module/bug/model.php index 6c51f423f6..abeb39805b 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -1920,4 +1920,109 @@ class bugModel extends model return true; } + + /** + * Print cell data. + * + * @param object $col + * @param object $bug + * @param array $users + * @param array $builds + * @param array $branches + * @access public + * @return void + */ + public function printCell($col, $bug, $users, $builds, $branches) + { + $bugLink = inlink('view', "bugID=$bug->id"); + $account = $this->app->user->account; + $id = $col->id; + if($col->show) + { + $class = ''; + if($id == 'status') $class .= ' bug-' . $bug->status; + if($id == 'title') $class .= ' text-left'; + if($id == 'assignedTo' && $bug->assignedTo == $account) $class .= ' red'; + + echo ""; + switch ($id) + { + case 'id': + echo html::a($bugLink, sprintf('%03d', $bug->id)); + break; + case 'severity': + echo ""; + echo zget($this->lang->bug->severityList, $bug->severity, $bug->severity); + echo ""; + break; + case 'pri': + echo ""; + echo zget($this->lang->bug->priList, $bug->pri, $bug->pri); + echo ""; + break; + case 'title': + $class = 'confirm' . $bug->confirmed; + echo "[{$this->lang->bug->confirmedList[$bug->confirmed]}] " . html::a($bugLink, $bug->title); + break; + case 'branch': + echo $branches[$bug->branch]; + break; + case 'type': + echo zget($this->lang->bug->typeList, $bug->type); + break; + case 'status': + echo zget($this->lang->bug->statusList, $bug->status); + break; + case 'activatedCount': + echo $bug->activatedCount; + break; + case 'openedBy': + echo zget($users, $bug->openedBy, $bug->openedBy); + break; + case 'openedDate': + echo substr($bug->openedDate, 5, 11); + break; + case 'openedBuild': + foreach(explode(',', $bug->openedBuild) as $build) echo zget($builds, $build, $build) . '
'; + break; + case 'assignedTo': + echo zget($users, $bug->assignedTo, $bug->assignedTo); + break; + case 'assignedDate': + echo substr($bug->assignedDate, 5, 11); + break; + case 'resolvedBy': + echo zget($users, $bug->resolvedBy, $bug->resolvedBy); + break; + case 'resolution': + echo $this->lang->bug->resolutionList[$bug->resolution]; + break; + case 'resolvedDate': + echo substr($bug->resolvedDate, 5, 11); + break; + case 'resolvedBuild': + echo $bug->resolvedBuild; + break; + case 'closedBy': + echo zget($users, $bug->closedBy, $bug->closedBy); + break; + case 'lastEditedDate': + echo substr($bug->lastEditedDate, 5, 11); + break; + case 'closedDate': + echo substr($bug->closedDate, 5, 11); + break; + case 'actions': + $params = "bugID=$bug->id"; + common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); + common::printIcon('bug', 'assignTo', $params, '', 'list', '', '', 'iframe', true); + common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); + common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); + common::printIcon('bug', 'edit', $params, $bug, 'list'); + common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy'); + break; + } + echo ''; + } + } } diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 95e5ce541b..2332081a07 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -12,6 +12,7 @@ ?> @@ -79,92 +80,12 @@ js::set('moduleID', $moduleID);
- - recTotal}&recPerPage={$pager->recPerPage}"; ?> - - - - - - - - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - - - id");?> - - - - - - confirmed;?> - - - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - cookie->windowWidth >= $this->config->wideSize):?> - - - - - - - - + moduleName . $this->methodName; + $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); + $vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; + include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php'; + ?> '>
- +
createLink('bug', 'batchEdit', "productID=$productID&branch=$branch"); diff --git a/module/bug/view/browsedata.html.php b/module/bug/view/browsedata.html.php new file mode 100644 index 0000000000..7780f0740f --- /dev/null +++ b/module/bug/view/browsedata.html.php @@ -0,0 +1,97 @@ + + * @package bug + * @version $Id$ + * @link http://www.zentao.net + */ +?> +
idAB);?> bug->severityAB);?> priAB);?> bug->title);?> bug->statusAB);?>bug->story);?>actions;?>openedByAB);?>bug->openedDateAB);?>assignedToAB);?>bug->resolvedByAB);?>bug->resolutionAB);?>bug->resolvedDateAB);?>actions;?>
- - id));?> - bug->severityList, $bug->severity, $bug->severity);?>'>bug->severityList, $bug->severity, $bug->severity);?>bug->priList, $bug->pri, $bug->pri);?>'>bug->priList, $bug->pri, $bug->pri);?> - [{$lang->bug->confirmedList[$bug->confirmed]}] "; - if($bug->branch)echo "{$branches[$bug->branch]}"; - echo html::a($bugLink, $bug->title); - ?> - needconfirm ? "{$lang->story->changed}" : $lang->bug->statusList[$bug->status];?>createLink('story', 'view', "stoyID=$bug->story"), $bug->storyTitle, '_blank');?>bug->confirmStoryChange = $lang->confirm; common::printIcon('bug', 'confirmStoryChange', "bugID=$bug->id", '', 'list', '', 'hiddenwin')?>openedBy, $bug->openedBy);?>openedDate, 5, 11)?>assignedTo == $this->app->user->account) echo 'class="red"';?>>assignedTo, $bug->assignedTo);?>resolvedBy, $bug->resolvedBy)?>bug->resolutionList[$bug->resolution];?>resolvedDate, 5, 11)?> - id"; - common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); - common::printIcon('bug', 'assignTo', $params, '', 'list', '', '', 'iframe', true); - common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); - common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); - common::printIcon('bug', 'edit', $params, $bug, 'list'); - common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy'); - ?> -
+ + + + + + + + + + + + + + + cookie->windowWidth >= $this->config->wideSize):?> + + + + + + + + cookie->windowWidth >= $this->config->wideSize):?> + + + + + + + + + + id");?> + + + + + + confirmed;?> + + + + + + + + + + cookie->windowWidth >= $this->config->wideSize):?> + + + + + + + + cookie->windowWidth >= $this->config->wideSize):?> + + + + + + + + diff --git a/module/bug/view/datatabledata.html.php b/module/bug/view/datatabledata.html.php new file mode 100644 index 0000000000..dffd748940 --- /dev/null +++ b/module/bug/view/datatabledata.html.php @@ -0,0 +1,29 @@ + + * @package bug + * @version $Id$ + * @link http://www.zentao.net + */ +?> +datatable->getSetting('bug'); +$widths = $this->datatable->setFixedFieldWidth($setting); +extract($widths); +?> +
idAB);?> bug->severityAB);?> priAB);?> bug->title);?> bug->statusAB);?>bug->story);?>actions;?>openedByAB);?>bug->openedDateAB);?>assignedToAB);?>bug->resolvedByAB);?>bug->resolutionAB);?>bug->resolvedDateAB);?>actions;?>
+ + id));?> + bug->severityList, $bug->severity, $bug->severity);?>'>bug->severityList, $bug->severity, $bug->severity);?>bug->priList, $bug->pri, $bug->pri);?>'>bug->priList, $bug->pri, $bug->pri);?> + [{$lang->bug->confirmedList[$bug->confirmed]}] "; + if($bug->branch)echo "{$branches[$bug->branch]}"; + echo html::a($bugLink, $bug->title); + ?> + needconfirm ? "{$lang->story->changed}" : $lang->bug->statusList[$bug->status];?>createLink('story', 'view', "stoyID=$bug->story"), $bug->storyTitle, '_blank');?>bug->confirmStoryChange = $lang->confirm; common::printIcon('bug', 'confirmStoryChange', "bugID=$bug->id", '', 'list', '', 'hiddenwin')?>openedBy, $bug->openedBy);?>openedDate, 5, 11)?>assignedTo == $this->app->user->account) echo 'class="red"';?>>assignedTo, $bug->assignedTo);?>resolvedBy, $bug->resolvedBy)?>bug->resolutionList[$bug->resolution];?>resolvedDate, 5, 11)?> + id"; + common::printIcon('bug', 'confirmBug', $params, $bug, 'list', 'search', '', 'iframe', true); + common::printIcon('bug', 'assignTo', $params, '', 'list', '', '', 'iframe', true); + common::printIcon('bug', 'resolve', $params, $bug, 'list', '', '', 'iframe', true); + common::printIcon('bug', 'close', $params, $bug, 'list', '', '', 'iframe', true); + common::printIcon('bug', 'edit', $params, $bug, 'list'); + common::printIcon('bug', 'create', "product=$bug->product&branch=$bug->branch&extra=bugID=$bug->id", $bug, 'list', 'copy'); + ?> +
+ + $value) $this->datatable->printHead($value, $orderBy, $vars);?> + + + + + $value) $this->bug->printCell($value, $bug, $users, $builds, $branches);?> + + + diff --git a/module/common/view/datatable.fix.html.php b/module/common/view/datatable.fix.html.php new file mode 100644 index 0000000000..b8451ca875 --- /dev/null +++ b/module/common/view/datatable.fix.html.php @@ -0,0 +1,36 @@ + +moduleName . $this->methodName;?> + diff --git a/module/common/view/datatable.html.php b/module/common/view/datatable.html.php new file mode 100644 index 0000000000..f9433308b2 --- /dev/null +++ b/module/common/view/datatable.html.php @@ -0,0 +1,138 @@ +getExtViewFile(__FILE__)){include $extView; return helper::cd();}?> +debug) +{ + css::import($jsRoot . 'datatable/min.css'); + js::import($jsRoot . 'datatable/min.js'); +} +?> +datatable)):?> + + + + diff --git a/module/datatable/config.php b/module/datatable/config.php new file mode 100644 index 0000000000..bf9b23a669 --- /dev/null +++ b/module/datatable/config.php @@ -0,0 +1,4 @@ +datatable->moduleAlias['product'] = 'story'; +$config->datatable->moduleAlias['project'] = 'task'; +$config->datatable->moduleAlias['testtask'] = 'testcase'; diff --git a/module/datatable/control.php b/module/datatable/control.php new file mode 100644 index 0000000000..1b4bec7d79 --- /dev/null +++ b/module/datatable/control.php @@ -0,0 +1,83 @@ + + * @package datatable + * @version $Id$ + * @link http://www.zentao.net + */ +class datatable extends control +{ + /** + * Construct function, set menu. + * + * @access public + * @return void + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Save config + * + * @access public + * @return void + */ + public function ajaxSave() + { + if(!empty($_POST)) + { + $account = $this->app->user->account; + if($account == 'guest') + { + $this->send(array('result' => 'fail', 'target' => $target, 'message' => 'guest.')); + return; + } + $name = $account . '.datatable.' . $this->post->target . '.' . $this->post->name; + $this->loadModel('setting')->setItem($name, $this->post->value); + if(dao::isError()) + { + $this->send(array('result' => 'fail', 'message' => 'dao error.')); + } + else + { + $this->send(array('result' => 'success')); + } + } + } + + /** + * Save config + * + * @access public + * @return void + */ + public function custom($module, $method) + { + $account = $this->app->user->account; + $name = 'owner=' . $account . '&module=datatable§ion=' . $module . $method . '&key=cols'; + if($module == 'testtask') + { + $this->loadModel('testcase'); + $this->app->loadConfig('testtask'); + $this->config->testcase->datatable->defaultField = $this->config->testtask->datatable->defaultField; + $this->config->testcase->datatable->fieldList['assignedTo']['title'] = 'assignedTo'; + $this->config->testcase->datatable->fieldList['assignedTo']['fixed'] = 'no'; + $this->config->testcase->datatable->fieldList['assignedTo']['width'] = '80'; + $this->config->testcase->datatable->fieldList['assignedTo']['required'] = 'no'; + $this->config->testcase->datatable->fieldList['actions']['width'] = '100'; + } + + $module = zget($this->config->datatable->moduleAlias, $module, $module); + $this->view->cols = $this->datatable->getFieldList($module); + $this->view->setting = $this->loadModel('setting')->getItem($name); + if(empty($this->view->setting)) $this->view->setting = json_encode($this->config->$module->datatable->defaultField); + + $this->display(); + } +} diff --git a/module/datatable/lang/en.php b/module/datatable/lang/en.php new file mode 100644 index 0000000000..4b25d1b8e6 --- /dev/null +++ b/module/datatable/lang/en.php @@ -0,0 +1,15 @@ +datatable = new stdclass(); +$lang->datatable->common = 'Data table'; +$lang->datatable->width = 'Width'; +$lang->datatable->show = 'Show'; +$lang->datatable->hide = 'Hide'; + +$lang->datatable->custom = 'Custom columns'; +$lang->datatable->customTip = 'Check columns to display'; +$lang->datatable->switchToTable = 'Switch to table'; +$lang->datatable->switchToDatatable = 'Switch to datatable'; +$lang->datatable->required = 'Required'; + +$lang->datatable->branch = 'Branch'; +$lang->datatable->platform = 'Platform'; diff --git a/module/datatable/lang/zh-cn.php b/module/datatable/lang/zh-cn.php new file mode 100644 index 0000000000..0ec2eda412 --- /dev/null +++ b/module/datatable/lang/zh-cn.php @@ -0,0 +1,15 @@ +datatable = new stdclass(); +$lang->datatable->common = '数据表格'; +$lang->datatable->width = '宽度'; +$lang->datatable->show = '显示'; +$lang->datatable->hide = '隐藏'; + +$lang->datatable->custom = '自定义列'; +$lang->datatable->customTip = '勾选需要显示的列'; +$lang->datatable->switchToTable = '切换到简单表格'; +$lang->datatable->switchToDatatable = '切换到高级表格'; +$lang->datatable->required = '必选'; + +$lang->datatable->branch = '分支'; +$lang->datatable->platform = '平台'; diff --git a/module/datatable/model.php b/module/datatable/model.php new file mode 100644 index 0000000000..c09a1f046c --- /dev/null +++ b/module/datatable/model.php @@ -0,0 +1,161 @@ + + * @package datatable + * @version $Id$ + * @link http://www.zentao.net + */ +?> +config->$module)) $this->loadModel($module); + if($this->session->currentProductType === 'normal') unset($this->config->$module->datatable->fieldList['branch']); + foreach($this->config->$module->datatable->fieldList as $field => $items) + { + if($field === 'branch') + { + if($this->session->currentProductType === 'branch') $this->config->$module->datatable->fieldList[$field]['title'] = $this->lang->datatable->branch; + if($this->session->currentProductType === 'platform') $this->config->$module->datatable->fieldList[$field]['title'] = $this->lang->datatable->platform; + continue; + } + $title = zget($this->lang->$module, $items['title'], zget($this->lang, $items['title'], $items['title'])); + $this->config->$module->datatable->fieldList[$field]['title'] = $title; + } + return $this->config->$module->datatable->fieldList; + } + + /** + * Get save setting field. + * + * @param string $module + * @access public + * @return object + */ + public function getSetting($module) + { + $datatableId = $module . $this->app->getMethodName(); + + $module = zget($this->config->datatable->moduleAlias, $module, $module); + if(!isset($this->config->$module)) $this->loadModel($module); + if(isset($this->config->datatable->$datatableId->cols)) $setting = json_decode($this->config->datatable->$datatableId->cols); + + $fieldList = $this->getFieldList($module); + if(empty($setting)) + { + $setting = $this->config->$module->datatable->defaultField; + $order = 1; + foreach($setting as $key => $value) + { + $id = $value; + $set = new stdclass();; + $set->order = $order++; + $set->id = $id; + $set->show = true; + $set->width = $fieldList[$id]['width']; + $set->fixed = $fieldList[$id]['fixed']; + $set->title = $fieldList[$id]['title']; + $setting[$key] = $set; + } + } + else + { + foreach($setting as $key => $set) + { + if($this->session->currentProductType === 'normal' and $set->id === 'branch') + { + unset($setting[$key]); + continue; + } + $set->title = $fieldList[$set->id]['title']; + } + } + + usort($setting, array('datatableModel', 'sortCols')); + + return $setting; + } + + /** + * Sort cols. + * + * @param int $a + * @param int $b + * @static + * @access public + * @return void + */ + public static function sortCols($a, $b) + { + if(!isset($a->order)) return 0; + return $a->order - $b->order; + } + + /** + * Print table head. + * + * @param object $col + * @param string $orderBy + * @param string $vars + * @access public + * @return void + */ + public function printHead($col, $orderBy, $vars) + { + $id = $col->id; + if($col->show) + { + echo "'; + } + } + + /** + * Set fixed field width + * + * @param object $setting + * @param int $minLeftWidth + * @param int $minRightWidth + * @access public + * @return array + */ + public function setFixedFieldWidth($setting, $minLeftWidth = '550', $minRightWidth = '140') + { + $widths['leftWidth'] = 0; + $widths['rightWidth'] = 0; + foreach($setting as $key => $value) + { + if($value->fixed != 'no') + { + $widthKey = $value->fixed . 'Width'; + if(!isset($widths[$widthKey])) $widths[$widthKey] = 0; + $widths[$widthKey] += (int)trim($value->width, 'px'); + } + } + if($widths['leftWidth'] <= 550) $widths['leftWidth'] = 550; + if($widths['rightWidth'] <= 0) $widths['rightWidth'] = 140; + + return $widths; + } +} diff --git a/module/datatable/view/custom.html.php b/module/datatable/view/custom.html.php new file mode 100644 index 0000000000..b55daf57ad --- /dev/null +++ b/module/datatable/view/custom.html.php @@ -0,0 +1,185 @@ + + * @package datatable + * @version $Id$ + * @link http://www.zentao.net + */ +?> + + + diff --git a/module/dev/lang/en.php b/module/dev/lang/en.php index 4f3fad00e0..7b0214b48d 100644 --- a/module/dev/lang/en.php +++ b/module/dev/lang/en.php @@ -81,6 +81,7 @@ $lang->dev->tableList['tree'] = 'Tree'; $lang->dev->tableList['upgrade'] = 'Upgrade'; $lang->dev->tableList['cron'] = 'Cron'; $lang->dev->tableList['mailqueue'] = 'Mail queue'; +$lang->dev->tableList['datatable'] = 'Data table'; $lang->dev->groupList['my'] = 'Dashboard'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/dev/lang/zh-cn.php b/module/dev/lang/zh-cn.php index 4b8eb2af57..1ee5092e95 100644 --- a/module/dev/lang/zh-cn.php +++ b/module/dev/lang/zh-cn.php @@ -81,6 +81,7 @@ $lang->dev->tableList['tree'] = '模块关系'; $lang->dev->tableList['upgrade'] = '更新'; $lang->dev->tableList['cron'] = '定时任务'; $lang->dev->tableList['mailqueue'] = '邮件队列'; +$lang->dev->tableList['datatable'] = '数据表格'; $lang->dev->groupList['my'] = '我的地盘'; $lang->dev->groupList['product'] = $lang->productCommon; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 221ccd3209..8344aa28eb 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -895,6 +895,9 @@ $lang->resource->dev->db = 'db'; $lang->dev->methodOrder[5] = 'api'; $lang->dev->methodOrder[10] = 'db'; +$lang->resource->datatable = new stdclass(); +$lang->resource->datatable->custom = 'custom'; + /* Every version of new privilege. */ $lang->changelog['1.0.1'][] = 'project-computeBurn'; diff --git a/module/product/control.php b/module/product/control.php index 36ad991d29..d7811939fd 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -111,6 +111,9 @@ class product extends control /* Lower browse type. */ $browseType = strtolower($browseType); + /* Load datatable. */ + $this->loadModel('datatable'); + /* Save session. */ $this->session->set('storyList', $this->app->getURI(true)); $this->session->set('productList', $this->app->getURI(true)); diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 0118ab8417..b269668298 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -11,6 +11,7 @@ */ ?> +
-
"; + if($id == 'actions') + { + echo $this->lang->actions; + } + else + { + common::printOrderLink($id, $orderBy, $vars, $col->title); + } + echo '
- - - recTotal}&recPerPage={$pager->recPerPage}";?> - - - - - - - - - - - - - - - $story):?> - createLink('story', 'view', "storyID=$story->id"); - $canView = common::hasPriv('story', 'view'); - ?> - - - - - - - - - - - - - - - + moduleName . $this->methodName; + $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); + $vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$moduleID&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; + include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php'; + ?>
idAB);?> priAB);?> story->title);?> story->planAB);?> story->source);?> openedByAB);?> assignedToAB);?>story->estimateAB);?> statusAB);?> story->stageAB);?>actions;?>
- - id)); else printf('%03d', $story->id);?> - story->priList, $story->pri, $story->pri);?>'>story->priList, $story->pri, $story->pri)?> - branch) echo "{$branches[$story->branch]}"?> - title);?> - planTitle;?>story->sourceList[$story->source];?>openedBy, $story->openedBy);?>assignedTo, $story->assignedTo);?>estimate;?>story->statusList[$story->status];?> - id]) ? " class='popoverStage' data-toggle='popover' data-placement='bottom' data-target='\$next'" : '') . "'>"; - echo $lang->story->stageList[$story->stage]; - if(isset($storyStages[$story->id])) echo ""; - echo ''; - if(isset($storyStages[$story->id])) - { - echo "
"; - foreach($storyStages[$story->id] as $storyBranch => $storyStage) echo $branches[$storyBranch] . ": " . $lang->story->stageList[$storyStage->stage] . '
'; - echo "
"; - } - ?> -
- id}"; - common::printIcon('story', 'change', $vars, $story, 'list', 'random'); - common::printIcon('story', 'review', $vars, $story, 'list', 'search'); - common::printIcon('story', 'close', $vars, $story, 'list', 'off', '', 'iframe', true); - common::printIcon('story', 'edit', $vars, $story, 'list', 'pencil'); - common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); - ?> -
- + + * @package product + * @version $Id$ + * @link http://www.zentao.net + */ +?> + + + + + + + + + + + + + + + + + + $story):?> + createLink('story', 'view', "storyID=$story->id"); + $canView = common::hasPriv('story', 'view'); + ?> + + + + + + + + + + + + + + + diff --git a/module/product/view/datatabledata.html.php b/module/product/view/datatabledata.html.php new file mode 100644 index 0000000000..5e669c2179 --- /dev/null +++ b/module/product/view/datatabledata.html.php @@ -0,0 +1,29 @@ + + * @package product + * @version $Id$ + * @link http://www.zentao.net + */ +?> +datatable->getSetting('product'); +$widths = $this->datatable->setFixedFieldWidth($setting); +extract($widths); +?> +
idAB);?> priAB);?> story->title);?> story->planAB);?> story->source);?> openedByAB);?> assignedToAB);?>story->estimateAB);?> statusAB);?> story->stageAB);?>actions;?>
+ + id)): sprintf('%03d', $story->id);?> + story->priList, $story->pri, $story->pri);?>'>story->priList, $story->pri, $story->pri)?> + branch) echo "{$branches[$story->branch]}"?> + title);?> + planTitle;?>story->sourceList[$story->source];?>openedBy, $story->openedBy);?>assignedTo, $story->assignedTo);?>estimate;?>story->statusList[$story->status];?> + id]) ? " class='popoverStage' data-toggle='popover' data-placement='bottom' data-target='\$next'" : '') . "'>"; + echo $lang->story->stageList[$story->stage]; + if(isset($storyStages[$story->id])) echo ""; + echo ''; + if(isset($storyStages[$story->id])) + { + echo "
"; + foreach($storyStages[$story->id] as $storyBranch => $storyStage) echo $branches[$storyBranch] . ": " . $lang->story->stageList[$storyStage->stage] . '
'; + echo "
"; + } + ?> +
+ id}"; + common::printIcon('story', 'change', $vars, $story, 'list', 'random'); + common::printIcon('story', 'review', $vars, $story, 'list', 'search'); + common::printIcon('story', 'close', $vars, $story, 'list', 'off', '', 'iframe', true); + common::printIcon('story', 'edit', $vars, $story, 'list', 'pencil'); + common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); + ?> +
+ + $value) $this->datatable->printHead($value, $orderBy, $vars);?> + + + + + $value) $this->story->printCell($value, $story, $users, $branches, $storyStages);?> + + + diff --git a/module/project/control.php b/module/project/control.php index 75dfd0ee34..2def3cf761 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -127,6 +127,7 @@ class project extends control $this->loadModel('tree'); $this->loadModel('search'); $this->loadModel('task'); + $this->loadModel('datatable'); /* Set browseType, productID, moduleID and queryID. */ $browseType = strtolower($status); diff --git a/module/project/view/datatabledata.html.php b/module/project/view/datatabledata.html.php new file mode 100644 index 0000000000..0004cfd19b --- /dev/null +++ b/module/project/view/datatabledata.html.php @@ -0,0 +1,29 @@ + + * @package project + * @version $Id$ + * @link http://www.zentao.net + */ +?> +datatable->getSetting('project'); +$widths = $this->datatable->setFixedFieldWidth($setting); +extract($widths); +?> +
+ + $value) $this->datatable->printHead($value, $orderBy, $vars);?> + + + + + $value) $this->task->printCell($value, $task, $memberPairs, $browseType);?> + + + diff --git a/module/project/view/task.html.php b/module/project/view/task.html.php index 9f1326c539..b32862018f 100644 --- a/module/project/view/task.html.php +++ b/module/project/view/task.html.php @@ -10,12 +10,15 @@ * @link http://www.zentao.net */ ?> - - - - - - +
@@ -37,102 +40,12 @@
-
- id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; ?> - - - - - - - - - cookie->windowWidth > $this->config->wideSize):?> - - - - - - - cookie->windowWidth > $this->config->wideSize):?> - - - - - - - type == 'sprint') print '';?> - - - - - - assignedTo == $app->user->account ? 'style=color:red' : ''; ?> - - - - - - - - cookie->windowWidth > $this->config->wideSize):?> - - - - - - - cookie->windowWidth > $this->config->wideSize):?> - - - - - - - type == 'sprint') - { - echo ''; - } - ?> - - - - + moduleName . $this->methodName; + $useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); + $vars = "projectID=$project->id&status=$status&parma=$param&orderBy=%s&recTotal=$recTotal&recPerPage=$recPerPage"; + include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/taskdata.html.php'; + ?> cookie->windowWidth > $this->config->wideSize ? 14 : 12) - ($project->type == 'sprint' ? 0 : 1);?> diff --git a/module/project/view/taskdata.html.php b/module/project/view/taskdata.html.php new file mode 100644 index 0000000000..42c64e2deb --- /dev/null +++ b/module/project/view/taskdata.html.php @@ -0,0 +1,107 @@ + + * @package project + * @version $Id$ + * @link http://www.zentao.net + */ +?> +
idAB);?> priAB);?> task->name);?>statusAB);?> task->deadlineAB);?> task->openedDateAB);?> task->assignedToAB);?> task->finishedByAB);?> task->finishedDateAB);?> task->estimateAB);?> task->consumedAB);?> task->leftAB);?>' and common::printOrderLink('story', $orderBy, $vars, $lang->task->story) and print 'actions;?>
- - id", sprintf('%03d', $task->id))) printf('%03d', $task->id);?> - task->priList, $task->pri, $task->pri)?>'>task->priList, $task->pri, $task->pri);?> - product][$task->branch])) echo "" . $branchGroups[$task->product][$task->branch] . '';?> - id", $task->name)) echo $task->name; - if($task->fromBug) echo html::a($this->createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); - ?> - - storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion); - $storyChanged ? print("{$lang->story->changed} ") : print($lang->task->statusList[$task->status]); - ?> - deadline, 0, 4) > 0) echo substr($task->deadline, 5, 6);?>openedDate, 5, 6);?>>assignedTo == 'closed' ? 'Closed' : $task->assignedToRealName;?>finishedBy, $task->finishedBy);?>finishedDate, 5, 6);?>estimate;?>consumed;?>left;?>'; - if($task->storyID) - { - if(!common::printLink('story', 'view', "storyid=$task->storyID", $task->storyTitle)) print $task->storyTitle; - } - echo ' - project&taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - - common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); - if($browseType == 'needconfirm') - { - $lang->task->confirmStoryChange = $lang->confirm; - common::printIcon('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin'); - } - common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); - common::printIcon('task', 'edit',"taskID=$task->id", '', 'list'); - ?> -
+ + + + + + + + + cookie->windowWidth > $this->config->wideSize):?> + + + + + + + cookie->windowWidth > $this->config->wideSize):?> + + + + + + + type == 'sprint') print '';?> + + + + + + assignedTo == $app->user->account ? 'style=color:red' : ''; ?> + + + + + + + + cookie->windowWidth > $this->config->wideSize):?> + + + + + + + cookie->windowWidth > $this->config->wideSize):?> + + + + + + + type == 'sprint') + { + echo ''; + } + ?> + + + + diff --git a/module/story/config.php b/module/story/config.php index 45392b203b..2748af8e1f 100644 --- a/module/story/config.php +++ b/module/story/config.php @@ -39,3 +39,101 @@ $config->story->list->exportFields = ' closedBy, closedDate, closedReason, lastEditedBy, lastEditedDate, childStories, linkStories, duplicateStory, files'; + +$config->story->datatable = new stdclass(); +$config->story->datatable->defaultField = array('id', 'pri', 'title', 'plan', 'source', 'openedBy', 'assignedTo', 'estimate', 'status', 'stage', 'actions'); + +$config->story->datatable->fieldList['id']['title'] = 'idAB'; +$config->story->datatable->fieldList['id']['fixed'] = 'left'; +$config->story->datatable->fieldList['id']['width'] = '70'; +$config->story->datatable->fieldList['id']['required'] = 'yes'; + +$config->story->datatable->fieldList['pri']['title'] = 'priAB'; +$config->story->datatable->fieldList['pri']['fixed'] = 'left'; +$config->story->datatable->fieldList['pri']['width'] = '40'; +$config->story->datatable->fieldList['pri']['required'] = 'no'; + +$config->story->datatable->fieldList['title']['title'] = 'title'; +$config->story->datatable->fieldList['title']['fixed'] = 'left'; +$config->story->datatable->fieldList['title']['width'] = 'auto'; +$config->story->datatable->fieldList['title']['required'] = 'yes'; + +$config->story->datatable->fieldList['plan']['title'] = 'planAB'; +$config->story->datatable->fieldList['plan']['fixed'] = 'no'; +$config->story->datatable->fieldList['plan']['width'] = '90'; +$config->story->datatable->fieldList['plan']['required'] = 'no'; + +$config->story->datatable->fieldList['source']['title'] = 'source'; +$config->story->datatable->fieldList['source']['fixed'] = 'no'; +$config->story->datatable->fieldList['source']['width'] = '90'; +$config->story->datatable->fieldList['source']['required'] = 'no'; + +$config->story->datatable->fieldList['status']['title'] = 'statusAB'; +$config->story->datatable->fieldList['status']['fixed'] = 'no'; +$config->story->datatable->fieldList['status']['width'] = '80'; +$config->story->datatable->fieldList['status']['required'] = 'no'; + +$config->story->datatable->fieldList['estimate']['title'] = 'estimateAB'; +$config->story->datatable->fieldList['estimate']['fixed'] = 'no'; +$config->story->datatable->fieldList['estimate']['width'] = '80'; +$config->story->datatable->fieldList['estimate']['required'] = 'no'; + +$config->story->datatable->fieldList['stage']['title'] = 'stageAB'; +$config->story->datatable->fieldList['stage']['fixed'] = 'no'; +$config->story->datatable->fieldList['stage']['width'] = '90'; +$config->story->datatable->fieldList['stage']['required'] = 'no'; + +$config->story->datatable->fieldList['openedBy']['title'] = 'openedByAB'; +$config->story->datatable->fieldList['openedBy']['fixed'] = 'no'; +$config->story->datatable->fieldList['openedBy']['width'] = '80'; +$config->story->datatable->fieldList['openedBy']['required'] = 'no'; + +$config->story->datatable->fieldList['openedDate']['title'] = 'openedDate'; +$config->story->datatable->fieldList['openedDate']['fixed'] = 'no'; +$config->story->datatable->fieldList['openedDate']['width'] = '90'; +$config->story->datatable->fieldList['openedDate']['required'] = 'no'; + +$config->story->datatable->fieldList['assignedTo']['title'] = 'assignedToAB'; +$config->story->datatable->fieldList['assignedTo']['fixed'] = 'no'; +$config->story->datatable->fieldList['assignedTo']['width'] = '80'; +$config->story->datatable->fieldList['assignedTo']['required'] = 'no'; + +$config->story->datatable->fieldList['assignedDate']['title'] = 'assignedDate'; +$config->story->datatable->fieldList['assignedDate']['fixed'] = 'no'; +$config->story->datatable->fieldList['assignedDate']['width'] = '90'; +$config->story->datatable->fieldList['assignedDate']['required'] = 'no'; + +$config->story->datatable->fieldList['reviewedBy']['title'] = 'reviewedBy'; +$config->story->datatable->fieldList['reviewedBy']['fixed'] = 'no'; +$config->story->datatable->fieldList['reviewedBy']['width'] = '80'; +$config->story->datatable->fieldList['reviewedBy']['required'] = 'no'; + +$config->story->datatable->fieldList['reviewedDate']['title'] = 'reviewedDate'; +$config->story->datatable->fieldList['reviewedDate']['fixed'] = 'no'; +$config->story->datatable->fieldList['reviewedDate']['width'] = '90'; +$config->story->datatable->fieldList['reviewedDate']['required'] = 'no'; + +$config->story->datatable->fieldList['closedBy']['title'] = 'closedBy'; +$config->story->datatable->fieldList['closedBy']['fixed'] = 'no'; +$config->story->datatable->fieldList['closedBy']['width'] = '80'; +$config->story->datatable->fieldList['closedBy']['required'] = 'no'; + +$config->story->datatable->fieldList['closedDate']['title'] = 'closedDate'; +$config->story->datatable->fieldList['closedDate']['fixed'] = 'no'; +$config->story->datatable->fieldList['closedDate']['width'] = '90'; +$config->story->datatable->fieldList['closedDate']['required'] = 'no'; + +$config->story->datatable->fieldList['closedReason']['title'] = 'closedReason'; +$config->story->datatable->fieldList['closedReason']['fixed'] = 'no'; +$config->story->datatable->fieldList['closedReason']['width'] = '90'; +$config->story->datatable->fieldList['closedReason']['required'] = 'no'; + +$config->story->datatable->fieldList['actions']['title'] = 'actions'; +$config->story->datatable->fieldList['actions']['fixed'] = 'right'; +$config->story->datatable->fieldList['actions']['width'] = '140'; +$config->story->datatable->fieldList['actions']['required'] = 'yes'; + +$config->story->datatable->fieldList['branch']['title'] = 'branch'; +$config->story->datatable->fieldList['branch']['fixed'] = 'left'; +$config->story->datatable->fieldList['branch']['width'] = '100'; +$config->story->datatable->fieldList['branch']['required'] = 'no'; diff --git a/module/story/model.php b/module/story/model.php index 8a3353e734..95c0b8d54b 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2022,4 +2022,112 @@ class storyModel extends model $this->dao->sqlobj->sql = $query; return $stories; } + + /** + * Print cell data + * + * @param object $col + * @param object $story + * @param array $users + * @param array $branches + * @param array $storyStages + * @access public + * @return void + */ + public function printCell($col, $story, $users, $branches, $storyStages) + { + $storyLink = helper::createLink('story', 'view', "storyID=$story->id"); + $account = $this->app->user->account; + $id = $col->id; + if($col->show) + { + $class = ''; + if($id == 'status') $class .= ' story-' . $story->status; + if($id == 'title') $class .= ' text-left'; + if($id == 'assignedTo' && $story->assignedTo == $account) $class .= ' red'; + + $title = ''; + if($id == 'title') $title = $story->title; + if($id == 'plan') $title = $story->planTitle; + + echo "'; + } + } } diff --git a/module/task/config.php b/module/task/config.php index 6ee29e4ea7..b884dfb1ee 100644 --- a/module/task/config.php +++ b/module/task/config.php @@ -40,3 +40,126 @@ $config->task->exportFields = ' closedBy, closedDate, closedReason, lastEditedBy, lastEditedDate,files '; + +$config->task->datatable = new stdclass(); +$config->task->datatable->defaultField = array('id', 'pri', 'name', 'status', 'deadline', 'openedDate', 'assignedTo', 'finishedBy', 'finishedDate', 'estimate', 'consumed', 'left', 'story', 'actions'); + +$config->task->datatable->fieldList['id']['title'] = 'idAB'; +$config->task->datatable->fieldList['id']['fixed'] = 'left'; +$config->task->datatable->fieldList['id']['width'] = '70'; +$config->task->datatable->fieldList['id']['required'] = 'yes'; + +$config->task->datatable->fieldList['pri']['title'] = 'priAB'; +$config->task->datatable->fieldList['pri']['fixed'] = 'left'; +$config->task->datatable->fieldList['pri']['width'] = '40'; +$config->task->datatable->fieldList['pri']['required'] = 'no'; + +$config->task->datatable->fieldList['name']['title'] = 'name'; +$config->task->datatable->fieldList['name']['fixed'] = 'left'; +$config->task->datatable->fieldList['name']['width'] = 'auto'; +$config->task->datatable->fieldList['name']['required'] = 'yes'; + +$config->task->datatable->fieldList['type']['title'] = 'type'; +$config->task->datatable->fieldList['type']['fixed'] = 'no'; +$config->task->datatable->fieldList['type']['width'] = '80'; +$config->task->datatable->fieldList['type']['required'] = 'no'; + +$config->task->datatable->fieldList['status']['title'] = 'statusAB'; +$config->task->datatable->fieldList['status']['fixed'] = 'no'; +$config->task->datatable->fieldList['status']['width'] = '60'; +$config->task->datatable->fieldList['status']['required'] = 'no'; + +$config->task->datatable->fieldList['estimate']['title'] = 'estimateAB'; +$config->task->datatable->fieldList['estimate']['fixed'] = 'no'; +$config->task->datatable->fieldList['estimate']['width'] = '40'; +$config->task->datatable->fieldList['estimate']['required'] = 'no'; + +$config->task->datatable->fieldList['consumed']['title'] = 'consumedAB'; +$config->task->datatable->fieldList['consumed']['fixed'] = 'no'; +$config->task->datatable->fieldList['consumed']['width'] = '50'; +$config->task->datatable->fieldList['consumed']['required'] = 'no'; + +$config->task->datatable->fieldList['left']['title'] = 'leftAB'; +$config->task->datatable->fieldList['left']['fixed'] = 'no'; +$config->task->datatable->fieldList['left']['width'] = '40'; +$config->task->datatable->fieldList['left']['required'] = 'no'; + +$config->task->datatable->fieldList['deadline']['title'] = 'deadlineAB'; +$config->task->datatable->fieldList['deadline']['fixed'] = 'no'; +$config->task->datatable->fieldList['deadline']['width'] = '70'; +$config->task->datatable->fieldList['deadline']['required'] = 'no'; + +$config->task->datatable->fieldList['openedBy']['title'] = 'openedByAB'; +$config->task->datatable->fieldList['openedBy']['fixed'] = 'no'; +$config->task->datatable->fieldList['openedBy']['width'] = '70'; +$config->task->datatable->fieldList['openedBy']['required'] = 'no'; + +$config->task->datatable->fieldList['openedDate']['title'] = 'openedDateAB'; +$config->task->datatable->fieldList['openedDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['openedDate']['width'] = '90'; +$config->task->datatable->fieldList['openedDate']['required'] = 'no'; + +$config->task->datatable->fieldList['estStarted']['title'] = 'estStarted'; +$config->task->datatable->fieldList['estStarted']['fixed'] = 'no'; +$config->task->datatable->fieldList['estStarted']['width'] = '90'; +$config->task->datatable->fieldList['estStarted']['required'] = 'no'; + +$config->task->datatable->fieldList['realStarted']['title'] = 'realStarted'; +$config->task->datatable->fieldList['realStarted']['fixed'] = 'no'; +$config->task->datatable->fieldList['realStarted']['width'] = '90'; +$config->task->datatable->fieldList['realStarted']['required'] = 'no'; + +$config->task->datatable->fieldList['assignedTo']['title'] = 'assignedTo'; +$config->task->datatable->fieldList['assignedTo']['fixed'] = 'no'; +$config->task->datatable->fieldList['assignedTo']['width'] = '80'; +$config->task->datatable->fieldList['assignedTo']['required'] = 'no'; + +$config->task->datatable->fieldList['assignedDate']['title'] = 'assignedDate'; +$config->task->datatable->fieldList['assignedDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['assignedDate']['width'] = '90'; +$config->task->datatable->fieldList['assignedDate']['required'] = 'no'; + +$config->task->datatable->fieldList['finishedBy']['title'] = 'finishedByAB'; +$config->task->datatable->fieldList['finishedBy']['fixed'] = 'no'; +$config->task->datatable->fieldList['finishedBy']['width'] = '80'; +$config->task->datatable->fieldList['finishedBy']['required'] = 'no'; + +$config->task->datatable->fieldList['finishedDate']['title'] = 'finishedDateAB'; +$config->task->datatable->fieldList['finishedDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['finishedDate']['width'] = '80'; +$config->task->datatable->fieldList['finishedDate']['required'] = 'no'; + +$config->task->datatable->fieldList['canceledBy']['title'] = 'canceledBy'; +$config->task->datatable->fieldList['canceledBy']['fixed'] = 'no'; +$config->task->datatable->fieldList['canceledBy']['width'] = '80'; +$config->task->datatable->fieldList['canceledBy']['required'] = 'no'; + +$config->task->datatable->fieldList['canceledDate']['title'] = 'canceledDate'; +$config->task->datatable->fieldList['canceledDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['canceledDate']['width'] = '80'; +$config->task->datatable->fieldList['canceledDate']['required'] = 'no'; + +$config->task->datatable->fieldList['closedBy']['title'] = 'closedBy'; +$config->task->datatable->fieldList['closedBy']['fixed'] = 'no'; +$config->task->datatable->fieldList['closedBy']['width'] = '80'; +$config->task->datatable->fieldList['closedBy']['required'] = 'no'; + +$config->task->datatable->fieldList['closedDate']['title'] = 'closedDate'; +$config->task->datatable->fieldList['closedDate']['fixed'] = 'no'; +$config->task->datatable->fieldList['closedDate']['width'] = '90'; +$config->task->datatable->fieldList['closedDate']['required'] = 'no'; + +$config->task->datatable->fieldList['closedReason']['title'] = 'closedReason'; +$config->task->datatable->fieldList['closedReason']['fixed'] = 'no'; +$config->task->datatable->fieldList['closedReason']['width'] = '80'; +$config->task->datatable->fieldList['closedReason']['required'] = 'no'; + +$config->task->datatable->fieldList['story']['title'] = 'story'; +$config->task->datatable->fieldList['story']['fixed'] = 'no'; +$config->task->datatable->fieldList['story']['width'] = '80'; +$config->task->datatable->fieldList['story']['required'] = 'no'; + +$config->task->datatable->fieldList['actions']['title'] = 'actions'; +$config->task->datatable->fieldList['actions']['fixed'] = 'right'; +$config->task->datatable->fieldList['actions']['width'] = '140'; +$config->task->datatable->fieldList['actions']['required'] = 'yes'; diff --git a/module/task/model.php b/module/task/model.php index 767c1153d2..d7f8b54db4 100644 --- a/module/task/model.php +++ b/module/task/model.php @@ -1453,4 +1453,125 @@ class taskModel extends model { $this->dao->insert(TABLE_TASKESTIMATE)->data($data)->autoCheck()->exec(); } + + /** + * Print cell data. + * + * @param object $col + * @param object $task + * @param array $users + * @param string $browseType + * @access public + * @return void + */ + public function printCell($col, $task, $users, $browseType) + { + $taskLink = helper::createLink('task', 'view', "taskID=$task->id"); + $account = $this->app->user->account; + $id = $col->id; + if($col->show) + { + $class = ''; + if($id == 'status') $class .= ' task-' . $task->status; + if($id == 'name' or $id == 'story') $class .= ' text-left'; + if($id == 'deadline' and isset($task->delay)) $class .= ' delayed'; + if($id == 'assignedTo' && $task->assignedTo == $account) $class .= ' red'; + + echo "'; + } + } } diff --git a/module/testcase/config.php b/module/testcase/config.php index 1be6d0c5d4..49a6445003 100644 --- a/module/testcase/config.php +++ b/module/testcase/config.php @@ -58,3 +58,76 @@ $config->testcase->search['params']['stage'] = array('operator' => 'inclu $config->testcase->search['params']['openedDate'] = array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date'); $config->testcase->search['params']['lastEditedDate'] = array('operator' => '>=', 'control' => 'input', 'values' => '', 'class' => 'date'); + +$config->testcase->datatable = new stdclass(); +$config->testcase->datatable->defaultField = array('id', 'pri', 'title', 'type', 'openedBy', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'actions'); + +$config->testcase->datatable->fieldList['id']['title'] = 'idAB'; +$config->testcase->datatable->fieldList['id']['fixed'] = 'left'; +$config->testcase->datatable->fieldList['id']['width'] = '70'; +$config->testcase->datatable->fieldList['id']['required'] = 'yes'; + +$config->testcase->datatable->fieldList['pri']['title'] = 'priAB'; +$config->testcase->datatable->fieldList['pri']['fixed'] = 'left'; +$config->testcase->datatable->fieldList['pri']['width'] = '40'; +$config->testcase->datatable->fieldList['pri']['required'] = 'no'; + +$config->testcase->datatable->fieldList['title']['title'] = 'title'; +$config->testcase->datatable->fieldList['title']['fixed'] = 'left'; +$config->testcase->datatable->fieldList['title']['width'] = 'auto'; +$config->testcase->datatable->fieldList['title']['required'] = 'yes'; + +$config->testcase->datatable->fieldList['type']['title'] = 'type'; +$config->testcase->datatable->fieldList['type']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['type']['width'] = '90'; +$config->testcase->datatable->fieldList['type']['required'] = 'no'; + +$config->testcase->datatable->fieldList['stage']['title'] = 'stage'; +$config->testcase->datatable->fieldList['stage']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['stage']['width'] = '110'; +$config->testcase->datatable->fieldList['stage']['required'] = 'no'; + +$config->testcase->datatable->fieldList['status']['title'] = 'statusAB'; +$config->testcase->datatable->fieldList['status']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['status']['width'] = '80'; +$config->testcase->datatable->fieldList['status']['required'] = 'no'; + +$config->testcase->datatable->fieldList['openedBy']['title'] = 'openedByAB'; +$config->testcase->datatable->fieldList['openedBy']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['openedBy']['width'] = '80'; +$config->testcase->datatable->fieldList['openedBy']['required'] = 'no'; + +$config->testcase->datatable->fieldList['openedDate']['title'] = 'openedDate'; +$config->testcase->datatable->fieldList['openedDate']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['openedDate']['width'] = '90'; +$config->testcase->datatable->fieldList['openedDate']['required'] = 'no'; + +$config->testcase->datatable->fieldList['lastRunner']['title'] = 'lastRunner'; +$config->testcase->datatable->fieldList['lastRunner']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['lastRunner']['width'] = '80'; +$config->testcase->datatable->fieldList['lastRunner']['required'] = 'no'; + +$config->testcase->datatable->fieldList['lastRunDate']['title'] = 'lastRunDate'; +$config->testcase->datatable->fieldList['lastRunDate']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['lastRunDate']['width'] = '90'; +$config->testcase->datatable->fieldList['lastRunDate']['required'] = 'no'; + +$config->testcase->datatable->fieldList['lastRunResult']['title'] = 'lastRunResult'; +$config->testcase->datatable->fieldList['lastRunResult']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['lastRunResult']['width'] = '80'; +$config->testcase->datatable->fieldList['lastRunResult']['required'] = 'no'; + +$config->testcase->datatable->fieldList['story']['title'] = 'story'; +$config->testcase->datatable->fieldList['story']['fixed'] = 'no'; +$config->testcase->datatable->fieldList['story']['width'] = '90'; +$config->testcase->datatable->fieldList['story']['required'] = 'no'; + +$config->testcase->datatable->fieldList['actions']['title'] = 'actions'; +$config->testcase->datatable->fieldList['actions']['fixed'] = 'right'; +$config->testcase->datatable->fieldList['actions']['width'] = '140'; +$config->testcase->datatable->fieldList['actions']['required'] = 'yes'; + +$config->testcase->datatable->fieldList['branch']['title'] = 'branch'; +$config->testcase->datatable->fieldList['branch']['fixed'] = 'left'; +$config->testcase->datatable->fieldList['branch']['width'] = '100'; +$config->testcase->datatable->fieldList['branch']['required'] = 'no'; diff --git a/module/testcase/control.php b/module/testcase/control.php index 6ce084a754..d5a6ea76f3 100644 --- a/module/testcase/control.php +++ b/module/testcase/control.php @@ -54,6 +54,8 @@ class testcase extends control */ public function browse($productID = 0, $branch = '', $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->loadModel('datatable'); + /* Set browseType, productID, moduleID and queryID. */ $browseType = strtolower($browseType); $productID = $this->product->saveState($productID, $this->products); diff --git a/module/testcase/lang/en.php b/module/testcase/lang/en.php index 555f20e957..637ff6d58f 100644 --- a/module/testcase/lang/en.php +++ b/module/testcase/lang/en.php @@ -32,6 +32,10 @@ $lang->testcase->unlinkCase = 'unlink related case'; $lang->testcase->stage = 'Stage'; $lang->testcase->lastEditedByAB = 'Last edited by'; $lang->testcase->lastEditedDateAB = 'Last edited date'; +$lang->testcase->lastRunner = 'Runner'; +$lang->testcase->lastRunDate = 'Run date'; +$lang->testcase->assignedTo = 'Assigned to'; +$lang->testcase->lastRunResult = 'Result'; $lang->testcase->allProduct = "All {$lang->productCommon}"; $lang->testcase->fromBug = 'From bug'; $lang->testcase->toBug = 'To bug'; diff --git a/module/testcase/lang/zh-cn.php b/module/testcase/lang/zh-cn.php index aa1a93d2d3..cb0da94946 100644 --- a/module/testcase/lang/zh-cn.php +++ b/module/testcase/lang/zh-cn.php @@ -32,6 +32,10 @@ $lang->testcase->unlinkCase = '移除相关用例'; $lang->testcase->stage = '适用阶段'; $lang->testcase->lastEditedByAB = '修改者'; $lang->testcase->lastEditedDateAB = '修改日期'; +$lang->testcase->lastRunner = '执行人'; +$lang->testcase->lastRunDate = '执行时间'; +$lang->testcase->assignedTo = '指派给'; +$lang->testcase->lastRunResult = '结果'; $lang->testcase->allProduct = "所有{$lang->productCommon}"; $lang->testcase->fromBug = '来源Bug'; $lang->testcase->toBug = '生成Bug'; diff --git a/module/testcase/model.php b/module/testcase/model.php index 27be94519b..3d5af55060 100644 --- a/module/testcase/model.php +++ b/module/testcase/model.php @@ -859,4 +859,91 @@ class testcaseModel extends model $this->loadModel('search')->setSearchParams($this->config->testcase->search); } + + /** + * Print cell data + * + * @param object $col + * @param object $case + * @param array $users + * @param array $branches + * @access public + * @return void + */ + public function printCell($col, $case, $users, $branches) + { + $caseLink = helper::createLink('testcase', 'view', "caseID=$case->id"); + $account = $this->app->user->account; + $id = $col->id; + if($col->show) + { + $class = ''; + if($id == 'status') $class .= $case->status; + if($id == 'title') $class .= ' text-left'; + if($id == 'lastRunResult') $class .= $case->lastRunResult; + + echo "'; + } + } } diff --git a/module/testcase/view/browse.html.php b/module/testcase/view/browse.html.php index 9362578f8f..3798de5771 100644 --- a/module/testcase/view/browse.html.php +++ b/module/testcase/view/browse.html.php @@ -13,6 +13,7 @@ testcase->confirmBatchDelete);
-
idAB);?> priAB);?> task->name);?>statusAB);?> task->deadlineAB);?> task->openedDateAB);?> task->assignedToAB);?> task->finishedByAB);?> task->finishedDateAB);?> task->estimateAB);?> task->consumedAB);?> task->leftAB);?>' and common::printOrderLink('story', $orderBy, $vars, $lang->task->story) and print 'actions;?>
+ + id", sprintf('%03d', $task->id))) printf('%03d', $task->id);?> + task->priList, $task->pri, $task->pri)?>'>task->priList, $task->pri, $task->pri);?> + product][$task->branch])) echo "" . $branchGroups[$task->product][$task->branch] . '';?> + id", $task->name)) echo $task->name; + if($task->fromBug) echo html::a($this->createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); + ?> + + storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion); + $storyChanged ? print("{$lang->story->changed} ") : print($lang->task->statusList[$task->status]); + ?> + deadline, 0, 4) > 0) echo substr($task->deadline, 5, 6);?>openedDate, 5, 6);?>>assignedTo == 'closed' ? 'Closed' : $task->assignedToRealName;?>finishedBy, $task->finishedBy);?>finishedDate, 5, 6);?>estimate;?>consumed;?>left;?>'; + if($task->storyID) + { + if(!common::printLink('story', 'view', "storyid=$task->storyID", $task->storyTitle)) print $task->storyTitle; + } + echo ' + project&taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + + common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); + if($browseType == 'needconfirm') + { + $lang->task->confirmStoryChange = $lang->confirm; + common::printIcon('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin'); + } + common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'edit',"taskID=$task->id", '', 'list'); + ?> +
"; + switch ($id) + { + case 'id': + echo html::a($storyLink, sprintf('%03d', $story->id)); + break; + case 'pri': + echo ""; + echo zget($this->lang->story->priList, $story->pri, $story->pri); + echo ""; + break; + case 'title': + echo html::a($storyLink, $story->title); + break; + case 'plan': + echo $story->planTitle; + break; + case 'branch': + echo $branches[$story->branch]; + break; + case 'source': + echo zget($this->lang->story->sourceList, $story->source, $story->source); + break; + case 'status': + echo $this->lang->story->statusList[$story->status]; + break; + case 'estimate': + echo $story->estimate; + break; + case 'stage': + echo "id]) ? " class='popoverStage' data-toggle='popover' data-placement='bottom' data-target='\$next'" : '') . "'>"; + echo $this->lang->story->stageList[$story->stage]; + if(isset($storyStages[$story->id])) echo ""; + echo ''; + if(isset($storyStages[$story->id])) + { + echo "
"; + foreach($storyStages[$story->id] as $storyBranch => $storyStage) echo $branches[$storyBranch] . ": " . $this->lang->story->stageList[$storyStage->stage] . '
'; + echo "
"; + } + break; + case 'openedBy': + echo zget($users, $story->openedBy, $story->openedBy); + break; + case 'openedDate': + echo substr($story->openedDate, 5, 11); + break; + case 'assignedTo': + echo zget($users, $story->assignedTo, $story->assignedTo); + break; + case 'assignedDate': + echo substr($story->assignedDate, 5, 11); + break; + case 'reviewedBy': + echo zget($users, $story->reviewedBy, $story->reviewedBy); + break; + case 'reviewedDate': + echo substr($story->reviewedDate, 5, 11); + break; + case 'closedBy': + echo zget($users, $story->closedBy, $story->closedBy); + break; + case 'closedDate': + echo substr($story->closedDate, 5, 11); + break; + case 'closedReason': + echo zget($this->lang->story->reasonList, $story->closedReason, $story->closedReason); + break; + case 'actions': + $vars = "story={$story->id}"; + common::printIcon('story', 'change', $vars, $story, 'list', 'random'); + common::printIcon('story', 'review', $vars, $story, 'list', 'search'); + common::printIcon('story', 'close', $vars, $story, 'list', 'off', '', 'iframe', true); + common::printIcon('story', 'edit', $vars, $story, 'list', 'pencil'); + common::printIcon('story', 'createCase', "productID=$story->product&branch=$story->branch&module=0&from=¶m=0&$vars", $story, 'list', 'sitemap'); + break; + } + echo '
"; + switch ($id) + { + case 'id': + echo html::a($taskLink, sprintf('%03d', $task->id)); + break; + case 'pri': + echo ""; + echo zget($this->lang->task->priList, $task->pri, $task->pri); + echo ""; + break; + case 'name': + echo html::a($taskLink, $task->name); + if($task->fromBug) echo html::a(helper::createLink('bug', 'view', "id=$task->fromBug"), "[BUG#$task->fromBug]", '_blank', "class='bug'"); + break; + case 'type': + echo $this->lang->task->typeList[$task->type]; + break; + case 'status': + $storyChanged = ($task->storyStatus == 'active' and $task->latestStoryVersion > $task->storyVersion); + $storyChanged ? print("{$this->lang->story->changed} ") : print($this->lang->task->statusList[$task->status]); + break; + case 'estimate': + echo round($task->estimate, 1); + break; + case 'consumed': + echo round($task->consumed, 1); + break; + case 'left': + echo round($task->left, 1); + break; + case 'deadline': + if(substr($task->deadline, 0, 4) > 0) echo substr($task->deadline, 5, 6); + break; + case 'openedBy': + echo zget($users, $task->openedBy, $task->openedBy); + break; + case 'openedDate': + echo substr($task->openedDate, 5, 11); + break; + case 'estStarted': + echo $task->estStarted; + break; + case 'realStarted': + echo $task->realStarted; + break; + case 'assignedTo': + echo zget($users, $task->assignedTo, $task->assignedTo); + break; + case 'assignedDate': + echo substr($task->assignedDate, 5, 11); + break; + case 'finishedBy': + echo zget($users, $task->finishedBy, $task->finishedBy); + break; + case 'finishedDate': + echo substr($task->finishedDate, 5, 11); + break; + case 'canceledBy': + echo zget($users, $task->canceledBy, $task->canceledBy); + break; + case 'canceledDate': + echo substr($task->canceledDate, 5, 11); + break; + case 'closedBy': + echo zget($users, $task->closedBy, $task->closedBy); + break; + case 'closedDate': + echo substr($task->closedDate, 5, 11); + break; + case 'closedReason': + echo $this->lang->task->reasonList[$task->closedReason]; + break; + case 'story': + if($task->storyID) + { + if(!common::printLink('story', 'view', "storyid=$task->storyID", $task->storyTitle)) print $task->storyTitle; + } + break; + case 'actions': + common::printIcon('task', 'assignTo', "projectID=$task->project&taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'start', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + + common::printIcon('task', 'recordEstimate', "taskID=$task->id", $task, 'list', 'time', '', 'iframe', true); + if($browseType == 'needconfirm') + { + $this->lang->task->confirmStoryChange = $this->lang->confirm; + common::printIcon('task', 'confirmStoryChange', "taskid=$task->id", '', 'list', '', 'hiddenwin'); + } + common::printIcon('task', 'finish', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'close', "taskID=$task->id", $task, 'list', '', '', 'iframe', true); + common::printIcon('task', 'edit',"taskID=$task->id", '', 'list'); + break; + } + echo '"; + switch ($id) + { + case 'id': + echo html::a($caseLink, sprintf('%03d', $case->id)); + break; + case 'pri': + echo ""; + echo zget($this->lang->testcase->priList, $case->pri, $case->pri); + echo ""; + break; + case 'title': + echo html::a($caseLink, $case->title); + break; + case 'branch': + echo $branches[$case->branch]; + break; + case 'type': + echo $this->lang->testcase->typeList[$case->type]; + break; + case 'stage': + foreach(explode(',', trim($case->stage, ',')) as $stage) echo $this->lang->testcase->stageList[$stage] . '
'; + break; + case 'status': + echo $this->lang->testcase->statusList[$case->status]; + break; + case 'story': + static $stories = array(); + if(empty($stories)) $stories = $this->dao->select('id,title')->from(TABLE_STORY)->where('deleted')->eq('0')->andWhere('product')->eq($case->product)->fetchPairs('id', 'title'); + if($case->story and isset($stories[$case->story])) echo html::a(helper::createLink('story', 'view', "storyID=$case->story"), $stories[$case->story]); + break; + case 'openedBy': + echo zget($users, $case->openedBy, $case->openedBy); + break; + case 'openedDate': + echo substr($case->openedDate, 5, 11); + break; + case 'lastRunner': + echo zget($users, $case->lastRunner, $case->lastRunner); + break; + case 'lastRunDate': + if(!helper::isZeroDate($case->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate)); + break; + case 'lastRunResult': + if($case->lastRunResult) echo $this->lang->testcase->resultList[$case->lastRunResult]; + break; + case 'actions': + common::printIcon('testtask', 'runCase', "runID=0&caseID=$case->id&version=$case->version", '', 'list', 'play', '', 'runCase iframe'); + common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', '', '', 'results iframe'); + common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); + common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); + + if(common::hasPriv('testcase', 'delete')) + { + $deleteURL = helper::createLink('testcase', 'delete', "caseID=$case->id&confirm=yes"); + echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '', '', "title='{$this->lang->testcase->delete}' class='btn-icon'"); + } + + common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe'); + break; + } + echo '
- recTotal}&recPerPage={$pager->recPerPage}"; ?> - - - - - - - - - - - - - - - - - - - - - - id");?> - - - - - - - - - - - - - - - - - +moduleName . $this->methodName; +$useDatatable = (isset($this->config->datatable->$datatableId->mode) and $this->config->datatable->$datatableId->mode == 'datatable'); +$vars = "productID=$productID&branch=$branch&browseType=$browseType¶m=$param&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}"; +include $useDatatable ? dirname(__FILE__) . '/datatabledata.html.php' : dirname(__FILE__) . '/browsedata.html.php'; +?> diff --git a/module/testcase/view/browsedata.html.php b/module/testcase/view/browsedata.html.php new file mode 100644 index 0000000000..640fac6ec7 --- /dev/null +++ b/module/testcase/view/browsedata.html.php @@ -0,0 +1,75 @@ + + * @package testcase + * @version $Id$ + * @link http://www.zentao.net + */ +?> +
idAB);?> priAB);?> testcase->title);?> testcase->story);?>actions;?> typeAB);?> openedByAB);?> testtask->lastRunAccount);?> testtask->lastRunTime);?> testtask->lastRunResult);?>statusAB);?>actions;?>
- - id));?> - testcase->priList, $case->pri, $case->pri)?>'>testcase->priList, $case->pri, $case->pri);?> - branch) echo "{$branches[$case->branch]}"?> - title);?> - createLink('story', 'view', "storyID=$case->story"), $case->storyTitle, '_blank');?>testcase->confirmStoryChange = $lang->confirm; common::printIcon('testcase', 'confirmStoryChange', "caseID=$case->id", '', 'list', '', 'hiddenwin');?>testcase->typeList[$case->type];?>openedBy];?>lastRunner];?>lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?>lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?>needconfirm ? "{$lang->story->changed}" : $lang->testcase->statusList[$case->status];?> - id&version=$case->version", '', 'list', 'play', '', 'runCase iframe'); - common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', 'list-alt', '', 'results iframe'); - common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); - common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); - - if(common::hasPriv('testcase', 'delete')) - { - $deleteURL = $this->createLink('testcase', 'delete', "caseID=$case->id&confirm=yes"); - echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '', '', "title='{$lang->testcase->delete}' class='btn-icon'"); - } - - common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe'); - ?> -
+ + + + + + + + + + + + + + + + + + + + + + + id");?> + + + + + + + + + + + + + + + + + + diff --git a/module/testcase/view/datatabledata.html.php b/module/testcase/view/datatabledata.html.php new file mode 100644 index 0000000000..3d60c43b7e --- /dev/null +++ b/module/testcase/view/datatabledata.html.php @@ -0,0 +1,29 @@ + + * @package testcase + * @version $Id$ + * @link http://www.zentao.net + */ +?> +datatable->getSetting('testcase'); +$widths = $this->datatable->setFixedFieldWidth($setting); +extract($widths); +?> +
idAB);?> priAB);?> testcase->title);?> testcase->story);?>actions;?> typeAB);?> openedByAB);?> testtask->lastRunAccount);?> testtask->lastRunTime);?> testtask->lastRunResult);?>statusAB);?>actions;?>
+ + id));?> + testcase->priList, $case->pri, $case->pri)?>'>testcase->priList, $case->pri, $case->pri);?> + branch) echo "{$branches[$case->branch]}"?> + title);?> + createLink('story', 'view', "storyID=$case->story"), $case->storyTitle, '_blank');?>testcase->confirmStoryChange = $lang->confirm; common::printIcon('testcase', 'confirmStoryChange', "caseID=$case->id", '', 'list', '', 'hiddenwin');?>testcase->typeList[$case->type];?>openedBy];?>lastRunner];?>lastRunDate)) echo date(DT_MONTHTIME1, strtotime($case->lastRunDate));?>lastRunResult) echo $lang->testcase->resultList[$case->lastRunResult];?>needconfirm ? "{$lang->story->changed}" : $lang->testcase->statusList[$case->status];?> + id&version=$case->version", '', 'list', 'play', '', 'runCase iframe'); + common::printIcon('testtask', 'results', "runID=0&caseID=$case->id", '', 'list', 'list-alt', '', 'results iframe'); + common::printIcon('testcase', 'edit', "caseID=$case->id", $case, 'list'); + common::printIcon('testcase', 'create', "productID=$case->product&branch=$case->branch&moduleID=$case->module&from=testcase¶m=$case->id", $case, 'list', 'copy'); + + if(common::hasPriv('testcase', 'delete')) + { + $deleteURL = $this->createLink('testcase', 'delete', "caseID=$case->id&confirm=yes"); + echo html::a("javascript:ajaxDelete(\"$deleteURL\",\"caseList\",confirmDelete)", '', '', "title='{$lang->testcase->delete}' class='btn-icon'"); + } + + common::printIcon('testcase', 'createBug', "product=$case->product&branch=$case->branch&extra=caseID=$case->id,version=$case->version,runID=", $case, 'list', 'bug', '', 'iframe'); + ?> +
+ + $value) $this->datatable->printHead($value, $orderBy, $vars);?> + + + + + $value) $this->testcase->printCell($value, $case, $users, $branches);?> + + + diff --git a/module/testtask/config.php b/module/testtask/config.php index 00067b09cc..822821a89a 100644 --- a/module/testtask/config.php +++ b/module/testtask/config.php @@ -11,3 +11,6 @@ $config->testtask->editor->edit = array('id' => 'desc,report', 'tools' => 'sim $config->testtask->editor->view = array('id' => 'lastComment', 'tools' => 'simpleTools'); $config->testtask->editor->start = array('id' => 'comment', 'tools' => 'simpleTools'); $config->testtask->editor->close = array('id' => 'report,comment', 'tools' => 'simpleTools'); + +$config->testtask->datatable = new stdclass(); +$config->testtask->datatable->defaultField = array('id', 'pri', 'title', 'type', 'assignedTo', 'lastRunner', 'lastRunDate', 'lastRunResult', 'status', 'actions'); diff --git a/module/testtask/control.php b/module/testtask/control.php index d8306e7114..8ac230e89d 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -218,8 +218,10 @@ class testtask extends control */ public function cases($taskID, $browseType = 'all', $param = 0, $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { + $this->loadModel('datatable'); + $this->loadModel('testcase'); + /* Save the session. */ - $this->app->loadLang('testcase'); $this->session->set('caseList', $this->app->getURI(true)); /* Load pager. */ diff --git a/module/testtask/model.php b/module/testtask/model.php index 854bb30b14..2c44722c1b 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -527,4 +527,92 @@ class testtaskModel extends model return true; } + + /** + * Print cell data. + * + * @param object $col + * @param object $run + * @param array $users + * @param object $task + * @param array $branches + * @access public + * @return void + */ + public function printCell($col, $run, $users, $task, $branches) + { + $caseLink = helper::createLink('testcase', 'view', "caseID=$run->case&version=$run->version&from=testtask&taskID=$run->task"); + $account = $this->app->user->account; + $id = $col->id; + if($col->show) + { + $class = ''; + if($id == 'status') $class .= $run->status; + if($id == 'title') $class .= ' text-left'; + if($id == 'lastRunResult') $class .= " $run->lastRunResult"; + if($id == 'assignedTo' && $run->assignedTo == $account) $class .= ' red'; + + echo "'; + } + } } diff --git a/module/testtask/view/cases.html.php b/module/testtask/view/cases.html.php index 8e0aa24b31..80769e6dd4 100644 --- a/module/testtask/view/cases.html.php +++ b/module/testtask/view/cases.html.php @@ -11,6 +11,7 @@ */ ?> +testtask->confirmUnlinkCase)?>
"; + switch ($id) + { + case 'id': + echo html::a($caseLink, sprintf('%03d', $run->case)); + break; + case 'pri': + echo ""; + echo zget($this->lang->testcase->priList, $run->pri, $run->pri); + echo ""; + break; + case 'title': + echo html::a($caseLink, $run->title); + break; + case 'branch': + echo $branches[$run->branch]; + break; + case 'type': + echo $this->lang->testcase->typeList[$run->type]; + break; + case 'stage': + foreach(explode(',', trim($run->stage, ',')) as $stage) echo $this->lang->testcase->stageList[$stage] . '
'; + break; + case 'status': + echo ($run->version < $run->caseVersion) ? "{$this->lang->testcase->changed}" : $this->lang->testtask->statusList[$run->status]; + break; + case 'openedBy': + $openedBy = zget($users, $run->openedBy, $run->openedBy); + echo substr($openedBy, strpos($openedBy, ':') + 1); + break; + case 'openedDate': + echo substr($run->openedDate, 5, 11); + break; + case 'lastRunner': + $lastRunner = zget($users, $run->lastRunner, $run->lastRunner); + echo substr($lastRunner, strpos($lastRunner, ':') + 1); + break; + case 'lastRunDate': + if(!helper::isZeroDate($run->lastRunDate)) echo date(DT_MONTHTIME1, strtotime($run->lastRunDate)); + break; + case 'lastRunResult': + if($run->lastRunResult) echo $this->lang->testcase->resultList[$run->lastRunResult]; + break; + case 'assignedTo': + $assignedTo = zget($users, $run->assignedTo, $run->assignedTo); + echo substr($assignedTo, strpos($assignedTo, ':') + 1); + break; + case 'actions': + common::printIcon('testtask', 'runCase', "id=$run->id", '', 'list', '', '', 'runCase iframe'); + common::printIcon('testtask', 'results', "id=$run->id", '', 'list', '', '', 'iframe'); + + if(common::hasPriv('testtask', 'unlinkCase')) + { + $unlinkURL = helper::createLink('testtask', 'unlinkCase', "caseID=$run->id&confirm=yes"); + echo html::a("javascript:ajaxDelete(\"$unlinkURL\",\"caseList\",confirmUnlink)", '', '', "title='{$this->lang->testtask->unlinkCase}' class='btn-icon'"); + } + + common::printIcon('testcase', 'createBug', "product=$run->product&branch=$run->branch&extra=projectID=$task->project,buildID=$task->build,caseID=$run->case,version=$run->version,runID=$run->id,testtask=$task->id", $run, 'list', 'bug', '', 'iframe'); + break; + } + echo '