diff --git a/module/release/config/dtable.php b/module/release/config/dtable.php new file mode 100644 index 0000000000..4a85bcb5e3 --- /dev/null +++ b/module/release/config/dtable.php @@ -0,0 +1,56 @@ +loadLang('story'); +$app->loadLang('build'); + +$config->release->dtable = new stdclass(); +$config->release->dtable->story = new stdclass(); +$config->release->dtable->bug = new stdclass(); +$config->release->dtable->leftBug = new stdclass(); + +$config->release->dtable->story->fieldList['id']['title'] = $lang->idAB; +$config->release->dtable->story->fieldList['id']['name'] = 'id'; +$config->release->dtable->story->fieldList['id']['type'] = 'checkID'; +$config->release->dtable->story->fieldList['id']['sortType'] = 'desc'; +$config->release->dtable->story->fieldList['id']['checkbox'] = true; + +$config->release->dtable->story->fieldList['title']['title'] = $lang->story->title; +$config->release->dtable->story->fieldList['title']['name'] = 'title'; +$config->release->dtable->story->fieldList['title']['type'] = 'title'; +$config->release->dtable->story->fieldList['title']['link'] = helper::createLink('story', 'view', 'storyID = {id}', '', true); +$config->release->dtable->story->fieldList['title']['data-modal'] = 'modal'; + +$config->release->dtable->story->fieldList['pri']['title'] = $lang->priAB; +$config->release->dtable->story->fieldList['pri']['name'] = 'pri'; +$config->release->dtable->story->fieldList['pri']['type'] = 'pri'; + +$config->release->dtable->story->fieldList['status']['title'] = $lang->statusAB; +$config->release->dtable->story->fieldList['status']['name'] = 'status'; +$config->release->dtable->story->fieldList['status']['type'] = 'status'; +$config->release->dtable->story->fieldList['status']['statusMap'] = $lang->story->statusList; + +$config->release->dtable->story->fieldList['linkedBuild']['title'] = $lang->build->linkedBuild; +$config->release->dtable->story->fieldList['linkedBuild']['name'] = 'linkedBuild'; +$config->release->dtable->story->fieldList['linkedBuild']['type'] = 'text'; + +$config->release->dtable->story->fieldList['openedBy']['title'] = $lang->openedByAB; +$config->release->dtable->story->fieldList['openedBy']['name'] = 'openedBy'; +$config->release->dtable->story->fieldList['openedBy']['type'] = 'user'; + +$config->release->dtable->story->fieldList['estimate']['title'] = $lang->story->estimateAB; +$config->release->dtable->story->fieldList['estimate']['name'] = 'estimate'; +$config->release->dtable->story->fieldList['estimate']['type'] = 'number'; + +$config->release->dtable->story->fieldList['stage']['title'] = $lang->story->stageAB; +$config->release->dtable->story->fieldList['stage']['name'] = 'stage'; +$config->release->dtable->story->fieldList['stage']['type'] = 'category'; +$config->release->dtable->story->fieldList['stage']['map'] = $lang->story->stageList; + +$config->release->dtable->story->fieldList['actions']['title'] = $lang->actions; +$config->release->dtable->story->fieldList['actions']['name'] = 'actions'; +$config->release->dtable->story->fieldList['actions']['type'] = 'actions'; +$config->release->dtable->story->fieldList['actions']['menu'] = array('unlinkStory'); + +$config->release->dtable->story->fieldList['actions']['list']['unlinkStory']['icon'] = 'unlink'; +$config->release->dtable->story->fieldList['actions']['list']['unlinkStory']['hint'] = $lang->release->unlinkStory; +$config->release->dtable->story->fieldList['actions']['list']['unlinkStory']['url'] = helper::createLink('release', 'unlinkStory', "releaseID={id}&story={story}"); diff --git a/module/release/control.php b/module/release/control.php index a854a240bd..2dde4ca9ee 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -580,7 +580,7 @@ class release extends control public function batchUnlinkStory($releaseID) { $this->release->batchUnlinkStory($releaseID); - echo js::locate($this->createLink('release', 'view', "releaseID=$releaseID&type=story"), 'parent'); + return $this->sendSuccess(array('load' => true)); } /** diff --git a/module/release/js/view.ui.js b/module/release/js/view.ui.js new file mode 100644 index 0000000000..284e6434c1 --- /dev/null +++ b/module/release/js/view.ui.js @@ -0,0 +1,14 @@ +$(document).off('click','.dtable-footer .batch-btn').on('click', '.dtable-footer .batch-btn', function() +{ + const dtable = zui.DTable.query($(this).target); + const checkedList = dtable.$.getChecks(); + if(!checkedList.length) return; + + const postData = []; + postData[`${type}IdList[]`] = checkedList; + + $.ajaxSubmit({ + url: $(this).data('url'), + data: postData + }); +}); diff --git a/module/release/model.php b/module/release/model.php index ce4376eaf6..3d24eae56f 100644 --- a/module/release/model.php +++ b/module/release/model.php @@ -797,23 +797,43 @@ class releaseModel extends model $canBeChanged = common::canBeChanged('release', $release); if($release->deleted || !$canBeChanged || isonlybody()) return ''; - $menu = ''; + $menu = array(); $params = "releaseID=$release->id"; if(common::hasPriv('release', 'changeStatus', $release)) { $changedStatus = $release->status == 'normal' ? 'terminate' : 'normal'; - $menu .= html::a(inlink('changeStatus', "releaseID=$release->id&status=$changedStatus"), ' ' . $this->lang->release->changeStatusList[$changedStatus], 'hiddenwin', "class='btn btn-link' title='{$this->lang->release->changeStatusList[$changedStatus]}'"); + + $menu[] = array( + 'text' => $this->lang->release->changeStatusList[$changedStatus], + 'icon' => $release->status == 'normal' ? 'pause' : 'play', + 'url' => inlink('changeStatus', "releaseID=$release->id&status=$changedStatus") + ); } - $menu .= "
"; - $menu .= $this->buildFlowMenu('release', $release, 'view', 'direct'); - $menu .= ""; + $menu[] = array( + 'type' => 'divider' + ); - $editClickable = $this->buildMenu('release', 'edit', $params, $release, 'view', '', '', '', '', '', '', false); - $deleteClickable = $this->buildMenu('release', 'delete', $params, $release, 'view', '', '', '', '', '', '', false); - if(common::hasPriv('release', 'edit') and $editClickable) $menu .= html::a(helper::createLink('release', 'edit', $params), " " . $this->lang->edit, '', "class='btn btn-link' title='{$this->lang->edit}'"); - if(common::hasPriv('release', 'delete') and $deleteClickable) $menu .= html::a(helper::createLink('release', 'delete', $params), " " . $this->lang->delete, '', "class='btn btn-link' title='{$this->lang->delete}' target='hiddenwin'"); + //$menu .= $this->buildFlowMenu('release', $release, 'view', 'direct'); + + if(common::hasPriv('release', 'edit')) + { + $menu[] = array( + 'text' => $this->lang->edit, + 'icon' => 'edit', + 'url' => inlink('edit', $params) + ); + } + + if(common::hasPriv('release', 'delete')) + { + $menu[] = array( + 'text' => $this->lang->delete, + 'icon' => 'delete', + 'url' => inlink('delete', $params) + ); + } return $menu; } diff --git a/module/release/ui/view.html.php b/module/release/ui/view.html.php new file mode 100644 index 0000000000..0bc86a2c4b --- /dev/null +++ b/module/release/ui/view.html.php @@ -0,0 +1,62 @@ + + * @package task + * @link https://www.zentao.net + */ +namespace zin; +global $lang; + +$actions = $this->release->buildOperateViewMenu($release); +detailHeader +( + to::title(entityLabel(set(array('entityID' => $release->id, 'level' => 1, 'text' => $release->name)))), + !empty($actions) ? to::suffix(btnGroup(set::items($actions))) : null +); + +jsVar('type', $type); + +/* Table data and setting for finished story tab. */ +$storyFootToolbar = array(); +$storyTableData = initTableData($stories, $config->release->dtable->story->fieldList, $this->release); + +$canBatchUnlinkStory = common::hasPriv('release', 'batchUnlinkStory'); +$canBatchCloseStory = common::hasPriv('story', 'batchClose'); +if($canBatchUnlinkStory) $storyFootToolbar['items'][] = array('class' => 'btn primary size-sm batch-btn', 'text' => $lang->release->batchUnlink, 'btnType' => 'primary', 'data-url' => inlink('batchUnlinkStory', "release={$release->id}")); +if($canBatchCloseStory) $storyFootToolbar['items'][] = array('class' => 'btn primary size-sm batch-btn', 'text' => $lang->story->batchClose, 'btnType' => 'primary', 'data-url' => createLink('story', 'batchClose', "productID={$release->product}")); + +detailBody +( + tabs + ( + set::class('w-full'), + tabPane + ( + set::key('finished-story'), + set::title($lang->release->stories), + set::active(true), + dtable + ( + set::userMap($users), + set::cols(array_values($config->release->dtable->story->fieldList)), + set::data($storyTableData), + set::checkable(true), + //set::sortLink(jsRaw('createSortLink')), + set::footToolbar($storyFootToolbar), + set::footPager( + usePager(null, 'storyPager'), + set::recPerPage($storyPager->recPerPage), + set::recTotal($storyPager->recTotal), + set::linkCreator(helper::createLink('release', 'view', "releaseID={$release->id}&type={$type}&link={$link}¶m={$param}&orderBy={$orderBy}&recTotal={$storyPager->recTotal}&recPerPage={recPerPage}&page={page}")) + ), + //set::checkInfo(jsRaw('function(checkedIDList){return window.setStatistics(this, checkedIDList);}')) + ) + ), + ) +); + +render();