From 7ee2b358c749d0ca96d55b9ddd93a966eea20b17 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Tue, 22 Dec 2020 16:57:48 +0800 Subject: [PATCH] * Code for my module details. --- db/update20.0.beta2.sql | 3 ++ db/zentao.sql | 4 ++- module/issue/model.php | 21 +++++++++++ module/my/control.php | 60 ++++++++++++++++++++++++++++--- module/my/css/requirement.css | 11 ++++++ module/my/js/requirement.js | 20 +++++++++++ module/my/lang/zh-cn.php | 2 ++ module/my/view/issue.html.php | 68 +++++++++++++++++++++++++++++++++++ module/my/view/risk.html.php | 66 ++++++++++++++++++++++++++++++++++ module/my/view/story.html.php | 1 - module/risk/model.php | 23 ++++++++++++ 11 files changed, 273 insertions(+), 6 deletions(-) create mode 100644 db/update20.0.beta2.sql create mode 100644 module/my/css/requirement.css create mode 100644 module/my/js/requirement.js diff --git a/db/update20.0.beta2.sql b/db/update20.0.beta2.sql new file mode 100644 index 0000000000..c00d256eb9 --- /dev/null +++ b/db/update20.0.beta2.sql @@ -0,0 +1,3 @@ +ALTER TABLE `zt_risk` add `closedBy` char(30) AFTER `assignedTo`; +ALTER TABLE `zt_risk` add `closedDate` date AFTER `closedBy`; +ALTER TABLE `zt_issue` CHANGE `closeBy` `closedBy` char(30); diff --git a/db/zentao.sql b/db/zentao.sql index 85c9391a41..f581997eb2 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -554,7 +554,7 @@ CREATE TABLE IF NOT EXISTS `zt_issue` ( `editedDate` datetime NOT NULL, `activateBy` varchar(30) NOT NULL, `activateDate` date NOT NULL, - `closeBy` varchar(30) NOT NULL, + `closedBy` varchar(30) NOT NULL, `closedDate` date NOT NULL, `assignedTo` varchar(30) NOT NULL, `assignedBy` varchar(30) NOT NULL, @@ -892,6 +892,8 @@ CREATE TABLE IF NOT EXISTS `zt_risk` ( `activateBy` varchar(30) NOT NULL, `activateDate` date NOT NULL, `assignedTo` varchar(30) NOT NULL, + `closedBy` varchar(30) NOT NULL, + `closedDate` date NOT NULL, `cancelBy` varchar(30) NOT NULL, `cancelDate` date NOT NULL, `cancelReason` char(30) NOT NULL, diff --git a/module/issue/model.php b/module/issue/model.php index 74036b04f3..f3fbd55894 100644 --- a/module/issue/model.php +++ b/module/issue/model.php @@ -146,6 +146,27 @@ class issueModel extends model return $issueList; } + /** + * Get user issues. + * + * @param string $browseType open|assignto|closed|suspended|canceled + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getUserIssues($type = 'assignedTo', $orderBy = 'id_desc', $pager) + { + $issueList = $this->dao->select('*')->from(TABLE_ISSUE) + ->where('deleted')->eq('0') + ->andWhere($type)->eq($this->app->user->account)->fi() + ->orderBy($orderBy) + ->page($pager) + ->fetchAll(); + + return $issueList; + } + /** * Get activity list. * diff --git a/module/my/control.php b/module/my/control.php index a998b62d9e..dc993518e9 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -62,11 +62,29 @@ class my extends control $this->display(); } + /** + * My calendar. + * + * @access public + * @return void + */ public function calendar() { $this->locate($this->createLink('my', 'todo')); } + /** + * My work view. + * + * @param string $mode + * @param string $type + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ public function work($mode = 'task', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $moduleIndex = array_search('my', $this->lang->noMenuModule); @@ -75,6 +93,18 @@ class my extends control echo $this->fetch('my', $mode, "type=$type&orderBy=$orderBy&recTotal=$recTotal&recPerPage=$recPerPage&pageID=$pageID"); } + /** + * My contribute view. + * + * @param string $mode + * @param string $type + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ public function contribute($mode = 'task', $type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $moduleIndex = array_search('my', $this->lang->noMenuModule); @@ -476,9 +506,20 @@ class my extends control * @access public * @return void */ - public function issue() + public function issue($type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - $this->view->mode = 'issue'; + /* Set the pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + + $this->view->title = $this->lang->my->issue; + $this->view->position[] = $this->lang->my->issue; + $this->view->mode = 'issue'; + $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; + $this->view->type = $type; + $this->view->issues = $this->loadModel('issue')->getUserIssues($type, $orderBy, $pager); $this->display(); } @@ -488,9 +529,20 @@ class my extends control * @access public * @return void */ - public function risk() + public function risk($type = 'assignedTo', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { - $this->view->mode = 'risk'; + /* Set the pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + + $this->view->title = $this->lang->my->risk; + $this->view->position[] = $this->lang->my->risk; + $this->view->risks = $this->loadModel('risk')->getUserRisks($type, $orderBy, $pager); + $this->view->users = $this->loadModel('user')->getPairs('noclosed|noletter'); + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; + $this->view->type = $type; + $this->view->mode = 'risk'; $this->display(); } diff --git a/module/my/css/requirement.css b/module/my/css/requirement.css new file mode 100644 index 0000000000..3e00457c7b --- /dev/null +++ b/module/my/css/requirement.css @@ -0,0 +1,11 @@ +.table-children {border-left: 2px solid #cbd0db; border-right: 2px solid #cbd0db;} +.table tbody > tr.table-children.table-child-top {border-top: 2px solid #cbd0db;} +.table tbody > tr.table-children.table-child-bottom {border-bottom: 2px solid #cbd0db;} +.table td.has-child > a:not(.story-toggle) {max-width: 90%; max-width: calc(100% - 30px); display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;} +.table td.has-child > .story-toggle {color: #838a9d; position: relative; top: 1px;} +.table td.has-child > .story-toggle:hover {color: #006af1; cursor: pointer;} +.table td.has-child > .story-toggle > .icon {font-size: 16px; display: inline-block; transition: transform .2s; -ms-transform:rotate(-90deg); -moz-transform:rotate(-90deg); -o-transform:rotate(-90deg); -webkit-transform:rotate(-90deg); transform: rotate(-90deg);} +.table td.has-child > .story-toggle > .icon:before {text-align: left;} +.table td.has-child > .story-toggle.collapsed > .icon {-ms-transform:rotate(90deg); -moz-transform:rotate(90deg); -o-transform:rotate(90deg); -webkit-transform:rotate(90deg); transform: rotate(90deg);} +.main-table tbody > tr.table-children > td:first-child::before {width: 3px;} +@-moz-document url-prefix() {.main-table tbody > tr.table-children > td:first-child::before {width: 4px;}} diff --git a/module/my/js/requirement.js b/module/my/js/requirement.js new file mode 100644 index 0000000000..65996d23e9 --- /dev/null +++ b/module/my/js/requirement.js @@ -0,0 +1,20 @@ +$(function() +{ + $('#storyList td.has-child .story-toggle').each(function() + { + var $td = $(this).closest('td'); + var labelWidth = 0; + if($td.find('.label').length > 0) labelWidth = $td.find('.label').width(); + $td.find('a').eq(0).css('max-width', $td.width() - labelWidth - 60); + }); + + $(document).on('click', '.story-toggle', function(e) + { + var $toggle = $(this); + var id = $(this).data('id'); + var isCollapsed = $toggle.toggleClass('collapsed').hasClass('collapsed'); + $toggle.closest('[data-ride="table"]').find('tr.parent-' + id).toggle(!isCollapsed); + e.stopPropagation(); + e.preventDefault(); + }); +}) diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 40068d26cc..8a39433e74 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -14,6 +14,8 @@ $lang->my->requirement = "我的用户{$lang->productSRCommon}"; $lang->my->createProgram = '添加项目'; $lang->my->project = "我的项目"; $lang->my->execution = "我的{$lang->execution->common}"; +$lang->my->issue = '我的问题'; +$lang->my->risk = '我的风险'; $lang->my->profile = '我的档案'; $lang->my->dynamic = '我的动态'; $lang->my->editProfile = '修改档案'; diff --git a/module/my/view/issue.html.php b/module/my/view/issue.html.php index cb1fb54671..5597e01a67 100644 --- a/module/my/view/issue.html.php +++ b/module/my/view/issue.html.php @@ -12,4 +12,72 @@ ?> + +
+ +
+

noData;?>

+
+ +
+ + recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID"; ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
idAB);?>issue->type;?>issue->title;?>issue->severity;?>issue->pri;?>issue->assignedTo;?>issue->owner;?>issue->status;?>issue->createdDate;?>actions;?>
id);?>issue->typeList, $issue->type);?>id", $issue->title);?>issue->severityList, $issue->severity);?>pri;?>assignedTo);?>owner);?>issue->statusList, $issue->status);?>createdDate;?> + id"; + echo common::printIcon('issue', 'resolve', $params, $issue, 'list', 'checked', '', 'iframe', 'yes', '', $lang->issue->resolve); + echo common::printIcon('issue', 'assignTo', $params, $issue, 'list', 'hand-right', '', 'iframe', 'yes', '', $lang->issue->assignTo); + echo common::printIcon('issue', 'close', $params, $issue, 'list', 'off', '', 'iframe', 'yes'); + echo common::printIcon('issue', 'cancel', $params, $issue, 'list', 'ban-circle', '', 'iframe', 'yes'); + echo common::printIcon('issue', 'activate', $params, $issue, 'list', 'magic', '', 'iframe', 'yes', '', $lang->issue->activate); + echo common::printIcon('issue', 'edit', $params, $issue, 'list', 'edit'); + $deleteClass = common::hasPriv('issue', 'delete') ? 'btn' : 'btn disabled'; + echo html::a($this->createLink('issue', 'delete', $params), '', 'hiddenwin', "title='{$lang->issue->delete}' class='$deleteClass'"); + ?> +
+ +
+ +
diff --git a/module/my/view/risk.html.php b/module/my/view/risk.html.php index a4e27e5f7a..a8ebad1552 100644 --- a/module/my/view/risk.html.php +++ b/module/my/view/risk.html.php @@ -12,4 +12,70 @@ ?> + +
+ +
+

noData;?>

+
+ +
+ + recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID"; ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
risk->id);?>risk->name);?>risk->strategy);?>risk->status);?>risk->identifiedDate);?>risk->rate);?>risk->pri);?>risk->assignedTo);?>risk->category);?>actions;?>
id;?>createLink('risk', 'view', "riskID=$risk->id"), $risk->name);?>risk->strategyList, $risk->strategy);?>risk->statusList, $risk->status);?>identifiedDate == '0000-00-00' ? '' : $risk->identifiedDate;?>rate;?>risk->priList, $risk->pri)?>risk->printAssignedHtml($risk, $users);;?>risk->categoryList, $risk->category);?> + id"; + common::printIcon('risk', 'track', $params, $risk, "list", 'checked'); + common::printIcon('risk', 'close', $params, $risk, "list", '', '', 'iframe', true); + common::printIcon('risk', 'cancel', $params, $risk, "list", '', '', 'iframe', true); + common::printIcon('risk', 'hangup', $params, $risk, "list", 'arrow-up', '', 'iframe', true); + common::printIcon('risk', 'activate', $params, $risk, "list", '', '', 'iframe', true); + common::printIcon('risk', 'edit', $params, $risk, "list"); + ?> +
+ +
+ +
diff --git a/module/my/view/story.html.php b/module/my/view/story.html.php index 6658bfc928..f57090327c 100644 --- a/module/my/view/story.html.php +++ b/module/my/view/story.html.php @@ -133,7 +133,6 @@ lang->story->children .'">' . $this->lang->story->childrenAB . ' ' . html::a($storyLink, $child->title, null, "style='color: $child->color'");?> productTitle;?> - planTitle;?> openedBy);?> estimate;?> diff --git a/module/risk/model.php b/module/risk/model.php index 5b3c007d6b..69acb455ae 100644 --- a/module/risk/model.php +++ b/module/risk/model.php @@ -232,6 +232,27 @@ class riskModel extends model ->fetchAll(); } + /** + * Get user risks. + * + * @param string $browseType open|assignto|closed|suspended|canceled + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function getUserRisks($type = 'assignedTo', $orderBy = 'id_desc', $pager) + { + $riskList = $this->dao->select('*')->from(TABLE_RISK) + ->where('deleted')->eq('0') + ->andWhere($type)->eq($this->app->user->account)->fi() + ->orderBy($orderBy) + ->page($pager) + ->fetchAll(); + + return $riskList; + } + /** * Print assignedTo html * @@ -325,6 +346,8 @@ class riskModel extends model ->setDefault('status','closed') ->add('editedBy', $this->app->user->account) ->add('editedDate', helper::today()) + ->add('closedBy', $this->app->user->account) + ->add('closedDate', helper::today()) ->stripTags($this->config->risk->editor->close['id'], $this->config->allowedTags) ->remove('uid,comment') ->get();