From 39659760227d0134a05df56c119ce00b7ef427fe Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Mon, 17 Aug 2020 15:31:44 +0800 Subject: [PATCH] * Code for task #7632. --- config/zentaopms.php | 6 +- db/update20.0.sql | 37 ++++ module/common/lang/zh-cn.php | 23 --- module/design/control.php | 5 + module/design/ext/config/design.php | 7 + module/design/ext/control/browse.php | 50 +++++ module/design/ext/control/commit.php | 44 ++++ module/design/ext/control/create.php | 37 ++++ module/design/ext/control/edit.php | 35 ++++ module/design/ext/control/revision.php | 10 + module/design/ext/control/submit.php | 24 +++ module/design/ext/css/commit/cmmi.css | 7 + module/design/ext/js/commit/cmmi.js | 20 ++ module/design/ext/js/common/design.js | 5 + module/design/ext/lang/zh-cn/cmmi.php | 32 +++ .../design/ext/view/browse.cmmi.html.hook.php | 16 ++ module/design/ext/view/browse.html.php | 191 ++++++++++++++++++ module/design/ext/view/commit.html.php | 63 ++++++ module/design/ext/view/create.html.php | 71 +++++++ module/design/ext/view/edit.html.php | 107 ++++++++++ module/design/ext/view/submit.html.php | 35 ++++ module/design/ext/view/view.html.php | 93 +++++++++ module/design/model.php | 176 ++++++++++++++++ module/install/view/step4.html.php | 2 +- 24 files changed, 1070 insertions(+), 26 deletions(-) create mode 100644 module/design/control.php create mode 100644 module/design/ext/config/design.php create mode 100644 module/design/ext/control/browse.php create mode 100644 module/design/ext/control/commit.php create mode 100644 module/design/ext/control/create.php create mode 100644 module/design/ext/control/edit.php create mode 100644 module/design/ext/control/revision.php create mode 100644 module/design/ext/control/submit.php create mode 100644 module/design/ext/css/commit/cmmi.css create mode 100644 module/design/ext/js/commit/cmmi.js create mode 100644 module/design/ext/js/common/design.js create mode 100644 module/design/ext/lang/zh-cn/cmmi.php create mode 100644 module/design/ext/view/browse.cmmi.html.hook.php create mode 100644 module/design/ext/view/browse.html.php create mode 100644 module/design/ext/view/commit.html.php create mode 100644 module/design/ext/view/create.html.php create mode 100644 module/design/ext/view/edit.html.php create mode 100644 module/design/ext/view/submit.html.php create mode 100644 module/design/ext/view/view.html.php create mode 100644 module/design/model.php diff --git a/config/zentaopms.php b/config/zentaopms.php index e50cb15514..3878b14cbe 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -193,8 +193,10 @@ define('TABLE_RELATION', '`' . $config->db->prefix . 'relation`'); define('TABLE_REPOHISTORY', '`' . $config->db->prefix . 'repohistory`'); define('TABLE_REPOFILES', '`' . $config->db->prefix . 'repofiles`'); define('TABLE_REPOBRANCH', '`' . $config->db->prefix . 'repobranch`'); -if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`'); -if(!defined('TABLE_STAGE')) define('TABLE_STAGE', '`' . $config->db->prefix . 'stage`'); +if(!defined('TABLE_LANG')) define('TABLE_LANG', '`' . $config->db->prefix . 'lang`'); +if(!defined('TABLE_STAGE')) define('TABLE_STAGE', '`' . $config->db->prefix . 'stage`'); +if(!defined('TABLE_DESIGN')) define('TABLE_DESIGN', '`' . $config->db->prefix . 'design`'); +if(!defined('TABLE_DESIGNSPEC')) define('TABLE_DESIGNSPEC', '`' . $config->db->prefix . 'designspec`'); $config->objectTables['product'] = TABLE_PRODUCT; $config->objectTables['story'] = TABLE_STORY; diff --git a/db/update20.0.sql b/db/update20.0.sql index 54b088b70d..ba8b2b6afd 100644 --- a/db/update20.0.sql +++ b/db/update20.0.sql @@ -57,3 +57,40 @@ INSERT INTO `zt_stage` (`name`,`percent`,`type`,`createdBy`,`createdDate`,`edite ('测试','15','qa','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'), ('发布','10','release','admin','2020-02-08 21:08:30','admin','2020-02-12 13:50:27','0'), ('总结评审','5','review','admin','2020-02-08 21:08:45','admin','2020-02-12 13:50:27','0'); + +-- DROP TABLE IF EXISTS `zt_flow_design`; +CREATE TABLE `zt_design` ( + `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, + `program` varchar(255) NOT NULL, + `product` varchar(255) NOT NULL, + `commit` varchar(30) NOT NULL, + `project` mediumint(9) NOT NULL DEFAULT '0', + `name` varchar(255) NOT NULL, + `parent` mediumint(8) unsigned NOT NULL, + `status` varchar(30) NOT NULL, + `subStatus` varchar(30) NOT NULL, + `createdBy` varchar(30) NOT NULL, + `createdDate` datetime NOT NULL, + `editedBy` varchar(30) NOT NULL, + `editedDate` datetime NOT NULL, + `commitBy` varchar(30) NOT NULL, + `commitDate` datetime NOT NULL, + `assignedTo` varchar(30) NOT NULL, + `assignedBy` varchar(30) NOT NULL, + `assignedDate` datetime NOT NULL, + `deleted` enum('0','1') NOT NULL DEFAULT '0', + `story` char(30) NOT NULL, + `desc` text NOT NULL, + `version` smallint(6) NOT NULL, + `type` char(30) NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +CREATE TABLE `zt_designspec` ( + `design` mediumint(8) NOT NULL, + `version` smallint(6) NOT NULL, + `name` varchar(255) NOT NULL, + `desc` text NOT NULL, + `files` varchar(255) NOT NULL, + UNIQUE KEY `design` (`design`,`version`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index a3d3832d04..c89fae431e 100755 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -1106,7 +1106,6 @@ if(isset($config->global->flow) and $config->global->flow == 'onlyTest') $lang->menu->cmmi = new stdclass(); $lang->menu->cmmi->programplan = array('link' => '计划|programplan|browse|program={PROGRAM}', 'subModule' => 'programplan'); $lang->menu->cmmi->project = array('link' => $lang->projectCommon . '|project|task|projectID={PROJECT}', 'subModule' => ',project,task,'); -$lang->menu->cmmi->review = array('link' => '评审|review|browse|program={PROGRAM}', 'subModule' => ',reviewissue,'); $lang->menu->cmmi->weekly = array('link' => '报告|weekly|index|program={PROGRAM}', 'subModule' => ',milestone,'); $lang->menu->cmmi->doc = array('link' => '文档|doc|index|program={PROGRAM}'); $lang->menu->cmmi->product = array('link' => '需求|product|browse|product={PRODUCT}&branch=&browseType=unclosed&queryID=0&storyType=requirement', 'subModule' => ',story,'); @@ -1116,17 +1115,12 @@ $lang->menu->cmmi->qa = array('link' => '测试|bug|browse|product={ $lang->menu->cmmi->release = array('link' => '发布|release|browse|product={PRODUCT}', 'subModule' => 'release'); $lang->menu->cmmi->issue = '问题|issue|browse|'; $lang->menu->cmmi->risk = '风险|risk|browse|'; -$lang->menu->cmmi->report = array('link' => '度量|report|programsummary|program={PROGRAM}', 'subModule' => ',report,measrecord,'); -$lang->menu->cmmi->auditplan = array('link' => 'QA|auditplan|browse|', 'subModule' => 'nc'); -$lang->menu->cmmi->cm = array('link' => '配置|cm|browse|program={PROGRAM}', 'subModule' => 'cm'); $lang->menu->cmmi->list = array('link' => '更多|workestimation|index|program={PROGRAM}', 'class' => 'dropdown dropdown-hover cmmi-list', 'subModule' => 'stakeholder,workestimation,durationestimation,budget,pssp,stakeholder'); $lang->cmmi = new stdclass(); $lang->cmmi->subMenu = new stdclass(); $lang->cmmi->subMenu->list = new stdclass(); $lang->cmmi->subMenu->list->workestimation = array('link' => '估算|workestimation|index|program=%s', 'subModule' => 'durationestimation,budget'); -$lang->cmmi->subMenu->list->pssp = '过程|pssp|browse|program=%s'; -$lang->cmmi->subMenu->list->stakeholder = array('link' => '干系人|stakeholder|browse|', 'subModule' => 'stakeholder'); $lang->cmmi->subMenu->list->program = '项目|||'; $lang->cmmiproduct = new stdclass(); @@ -1172,12 +1166,6 @@ $lang->budget->menu = $lang->workestimation->menu; $lang->programplan->menu->gantt = array('link' => '甘特图|programplan|browse|programID={PROGRAM}&productID={PRODUCT}&type=gantt'); $lang->programplan->menu->lists = array('link' => '阶段列表|programplan|browse|programID={PROGRAM}&productID={PRODUCT}&type=lists', 'alias' => 'create'); -$lang->review->menu->review = array('link' => '基线评审列表|review|browse|program={PROGRAM}', 'subModule' => 'review'); -$lang->review->menu->issue = array('link' => '问题列表|reviewissue|issue|program={PROGRAM}', 'subModule' => 'reviewissue'); - -$lang->reviewissue = new stdclass(); -$lang->reviewissue->menu = $lang->review->menu; - $lang->weekly->menu->browse = '周报|weekly|index|program={PROGRAM}'; $lang->weekly->menu->issue = '里程碑报告|milestone|index|program={PROGRAM}'; @@ -1186,20 +1174,9 @@ $lang->cmmiproduct->menu->requirement = '用户需求|product|browse|product={PR $lang->cmmiproduct->menu->story = '软件需求|product|browse|product={PRODUCT}&branch=&browseType=unclosed&queryID=0&storyType=story'; $lang->cmmiproduct->menu->track = '跟踪矩阵|story|track|product={PRODUCT}'; -$lang->auditplan->menu->browse = array('link' => '质量保证计划|auditplan|browse|', 'subModule' => 'auditplan'); -$lang->auditplan->menu->nc = array('link' => '不符合项|nc|browse|program={PROGRAM}', 'subModule' => 'nc'); - $lang->story->menu = $lang->cmmiproduct->menu; $lang->milestone->menu = $lang->weekly->menu; $lang->nc->menu = $lang->auditplan->menu; -$lang->cm->menu->browse = array('link' => '基线|cm|browse|program={PROGRAM}', 'alias' => 'create,edit,view'); -$lang->cm->menu->report = '基线状态报告|cm|report|program={PROGRAM}'; - -$lang->stakeholder->menu->plan = array('link' => '介入计划|stakeholder|plan|'); -$lang->stakeholder->menu->expectation = array('link' => '期望管理|stakeholder|expectation|', 'alias' => 'createexpect'); -$lang->stakeholder->menu->issue = array('link' => '问题管理|stakeholder|issue|'); -$lang->stakeholder->menu->list = array('link' => '干系人列表|stakeholder|browse|', 'alias' => 'create,edit,view'); - $lang->noMenuModule = array('my', 'todo', 'effort', 'program', 'attend', 'leave', 'makeup', 'overtime', 'lieu', 'holiday', 'custom', 'auditcl', 'subject', 'admin', 'mail', 'extension', 'dev', 'backup', 'action', 'cron', 'issue', 'risk', 'pssp', 'sms', 'message', 'webhook', 'search'); $lang->haveMenuMethod = array('custom'); diff --git a/module/design/control.php b/module/design/control.php new file mode 100644 index 0000000000..34bb0b1846 --- /dev/null +++ b/module/design/control.php @@ -0,0 +1,5 @@ +design = new stdclass(); +$config->design->editor = new stdclass(); +$config->design->editor->create = array('id' => 'desc', 'tools' => 'simpleTools'); +$config->design->editor->edit = array('id' => 'desc', 'tools' => 'simpleTools'); + +$config->design->affectedFixedNum = 7; diff --git a/module/design/ext/control/browse.php b/module/design/ext/control/browse.php new file mode 100644 index 0000000000..fa88c47533 --- /dev/null +++ b/module/design/ext/control/browse.php @@ -0,0 +1,50 @@ +design->setProductMenu($productID); + $product = $this->loadModel('product')->getById($productID); + $project = $this->loadModel('project')->getById($product->program); + + $module = 'design'; + $action = 'browse'; + list($flow, $action, $fields) = $this->design->setFlowActionFields($module, $action); + + $this->view->title = $action->name; + $this->view->flow = $flow; + $this->view->fields = $fields; + if($action->action == 'view') $this->view->flowAction = $action; + if($action->action != 'view') $this->view->action = $action; + + $this->loadModel('flow')->checkPrivilege($flow, $action); + $this->flow->setSearchParams($flow); + + $labels = $this->loadModel('workflowlabel', 'flow')->getList($flow->module); + + if(!$label) + { + reset($labels); + $label = current($labels)->id; + } + + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $dataList = $this->flow->getDataList($flow, $mode, $label, 0, $orderBy, $pager); + + $this->view->dataList = $dataList; + $this->view->valueFields = $this->loadModel('workflowfield', 'flow')->getValueFields($flow->module); + $this->view->moduleMenu = $this->flow->getModuleMenu($flow, $labels); + $this->view->batchActions = $this->flow->buildBatchActions($flow); + $this->view->summary = $this->flow->getSummary($dataList, $fields); + $this->view->mode = $mode; + $this->view->label = $label; + $this->view->allLabel = reset($labels)->id == $label ? 1 : 0; + $this->view->designType = reset($labels)->id == $label ? 'all' : $labels[$label]->params[1]['value']; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; + $this->view->productID = $productID; + $this->view->program = $project; + $this->display(); + } +} diff --git a/module/design/ext/control/commit.php b/module/design/ext/control/commit.php new file mode 100644 index 0000000000..69f746a64f --- /dev/null +++ b/module/design/ext/control/commit.php @@ -0,0 +1,44 @@ +app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + + $program = $this->loadModel('project')->getByID($this->session->program); + $begin = $begin ? date('Y-m-d', strtotime($begin)) : $program->begin; + $end = $end ? date('Y-m-d', strtotime($end)) : helper::today(); + + $repoID = $this->session->repoID; + $repo = $this->loadModel('repo')->getRepoByID($repoID); + $revisions = $this->repo->getCommits($repo, '', 'HEAD', '', $pager, $begin, $end); + + if($_POST) + { + $this->design->linkCommit($designID); + + $result['result'] = 'success'; + $result['message'] = $this->lang->saveSuccess; + $result['locate'] = 'parent'; + $this->send($result); + } + + $linkedRevisions = array(); + $relations = $this->loadModel('common')->getRelations('design', $designID, 'commit'); + foreach($relations as $relation) $linkedRevisions[] = $relation->BID; + + $this->view->title = $this->lang->design->commit; + $this->view->position[] = $this->lang->design->commit; + $this->view->repoID = $repoID; + $this->view->repo = $repo; + $this->view->revisions = $revisions; + $this->view->linkedRevisions = $linkedRevisions; + $this->view->designID = $designID; + $this->view->begin = $begin; + $this->view->end = $end; + $this->view->design = $this->design->getByID($designID); + $this->view->pager = $pager; + $this->display(); + } +} diff --git a/module/design/ext/control/create.php b/module/design/ext/control/create.php new file mode 100644 index 0000000000..97302bccab --- /dev/null +++ b/module/design/ext/control/create.php @@ -0,0 +1,37 @@ +design->setProductMenu($productID); + + if($_POST) + { + $productID = $_POST['product']; + + $designID = $this->design->create(); + if($designID) + { + $this->loadModel('action')->create('design', $designID, 'create'); + + $response['result'] = 'success'; + $response['message'] = $this->lang->saveSuccess; + $response['locate'] = $this->createLink('design', 'browse', "productID=$productID"); + $this->send($response); + } + + $response['result'] = 'fail'; + $response['message'] = dao::getError(); + $this->send($response); + } + + $this->view->title = $this->lang->design->create; + $this->view->position[] = $this->lang->design->create; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->view->stories = $this->loadModel('story')->getProductStoryPairs($productID); + $this->view->products = $this->loadModel('product')->getPairs($this->session->program); + $this->view->productID = $productID; + $this->view->program = $this->loadModel('project')->getByID($this->session->program); + $this->display(); + } +} diff --git a/module/design/ext/control/edit.php b/module/design/ext/control/edit.php new file mode 100644 index 0000000000..fb956a7221 --- /dev/null +++ b/module/design/ext/control/edit.php @@ -0,0 +1,35 @@ +design->getByID($designID); + $design = $this->design->getAffectedScope($design); + $this->design->setProductMenu($design->product); + + if($_POST) + { + $changes = $this->design->update($designID); + if($changes) + { + $actionID = $this->loadModel('action')->create('design', $designID, 'edit'); + $this->action->logHistory($actionID, $changes); + + } + + $response['result'] = 'success'; + $response['message'] = $this->lang->saveSuccess; + $response['locate'] = $this->createLink('design', 'view', "id=$design->id"); + $this->send($response); + } + + $this->view->title = $this->lang->design->edit; + $this->view->position[] = $this->lang->design->edit; + + $this->view->design = $design; + $this->view->products = $this->loadModel('product')->getPairs($this->session->program); + $this->view->program = $this->loadModel('project')->getByID($this->session->program); + $this->view->stories = $this->loadModel('story')->getProductStoryPairs($design->product); + $this->display(); + } +} diff --git a/module/design/ext/control/revision.php b/module/design/ext/control/revision.php new file mode 100644 index 0000000000..5ac9432b69 --- /dev/null +++ b/module/design/ext/control/revision.php @@ -0,0 +1,10 @@ +dao->select('*')->from(TABLE_REPOHISTORY)->where('id')->eq($repoID)->fetch(); + $repoURL = $this->createLink('repo', 'revision', "repoID=$repo->repo&revistion=$repo->revision"); + header("location:" . $repoURL); + } +} diff --git a/module/design/ext/control/submit.php b/module/design/ext/control/submit.php new file mode 100644 index 0000000000..749c6bb9f9 --- /dev/null +++ b/module/design/ext/control/submit.php @@ -0,0 +1,24 @@ +post->object; + $reviewRange = $this->post->range; + $designID = $this->post->designID; + $product = $this->loadModel('product')->getByID($productID); + $programID = isset($product->project) ? $product->project : $this->session->program; + $reviewRange == 'all' ? $checkedItem = '' : $checkedItem = $designID; + + if($reviewRange == 'assign' && empty($checkedItem)) die(js::alert($this->lang->design->errorSelection)); + + die(js::locate($this->createLink('review', 'create', "program={$programID}&object=$object&productID=$productID&reviewRange=$reviewRange&checkedItem={$checkedItem}"), 'parent')); + } + + if($allLabel) unset($this->lang->design->rangeList['assign']); + $this->view->designType = $designType; + $this->display(); + } +} diff --git a/module/design/ext/css/commit/cmmi.css b/module/design/ext/css/commit/cmmi.css new file mode 100644 index 0000000000..71e8d1ff9e --- /dev/null +++ b/module/design/ext/css/commit/cmmi.css @@ -0,0 +1,7 @@ +.searchBox{min-height: 45px;} +.searchBox .srearch-date{float: left; width: 20%} +.searchBox h4{float:left;display: inline-block} +.searchBox span{float:left;line-height:30px} +#logForm .table thead th{background: #efefef} +#begin{margin-right:5px} +#end{margin-left:5px} diff --git a/module/design/ext/js/commit/cmmi.js b/module/design/ext/js/commit/cmmi.js new file mode 100644 index 0000000000..3d87736b51 --- /dev/null +++ b/module/design/ext/js/commit/cmmi.js @@ -0,0 +1,20 @@ +$('#begin, #end').change(function() +{ + var begin = $('#begin').val(); + var end = $('#end').val(); + + if(begin.indexOf('-') != -1) + { + var beginarray = begin.split("-"); + var begin = ''; + for(i = 0; i < beginarray.length; i++) begin = begin + beginarray[i]; + } + if(end.indexOf('-') != -1) + { + var endarray = end.split("-"); + var end = ''; + for(i = 0 ; i < endarray.length ; i++) end = end + endarray[i]; + } + + location.href = createLink('design', 'commit', "designID=" + designID + '&begin=' + begin + '&end=' + end); +}) diff --git a/module/design/ext/js/common/design.js b/module/design/ext/js/common/design.js new file mode 100644 index 0000000000..7005b0242f --- /dev/null +++ b/module/design/ext/js/common/design.js @@ -0,0 +1,5 @@ +$(document).on('click', '.ajaxPager', function() +{ + $('#logBox').load($(this).attr('href')); + return false; +}) diff --git a/module/design/ext/lang/zh-cn/cmmi.php b/module/design/ext/lang/zh-cn/cmmi.php new file mode 100644 index 0000000000..92b232b4e4 --- /dev/null +++ b/module/design/ext/lang/zh-cn/cmmi.php @@ -0,0 +1,32 @@ +design->commit = '关联提交'; +$lang->design->type = '设计类型'; +$lang->design->name = '设计名称'; +$lang->design->create = '创建设计'; +$lang->design->edit = '编辑设计'; +$lang->design->products = '所属产品'; +$lang->design->story = '相关需求'; +$lang->design->file = '附件'; +$lang->design->desc = '设计描述'; +$lang->design->product = '所属产品'; +$lang->design->basicInfo = '基础信息'; +$lang->design->commitDate = '提交时间'; +$lang->design->affectedStory = "影响{$lang->storyCommon}"; +$lang->design->affectedTasks = '影响任务'; +$lang->design->submit = '提交评审'; +$lang->design->revision = '查看关联代码'; +$lang->design->reviewObject = '评审对象'; +$lang->design->createdBy = '由谁创建'; +$lang->design->createdDate = '创建时间'; + +$lang->design->typeList['HLDS'] = '概要设计'; +$lang->design->typeList['DDS'] = '详细设计'; +$lang->design->typeList['DBDS'] = '数据库设计'; +$lang->design->typeList['ADS'] = '接口设计'; + +$lang->design->range = '影响范围'; +$lang->design->errorSelection = '还没有选中记录!'; + +$lang->design->rangeList = array(); +$lang->design->rangeList['all'] = '全部记录'; +$lang->design->rangeList['assign'] = '选中记录'; diff --git a/module/design/ext/view/browse.cmmi.html.hook.php b/module/design/ext/view/browse.cmmi.html.hook.php new file mode 100644 index 0000000000..f12039622d --- /dev/null +++ b/module/design/ext/view/browse.cmmi.html.hook.php @@ -0,0 +1,16 @@ +"; +$labelPairs = $this->loadModel('workflowlabel')->getPairs($this->app->rawModule); +foreach($labelPairs as $labelID => $labelTitle) +{ + $class = ($mode == 'browse' and $labelID == $label) ? "btn-active-text" : ''; + + $params = "productID=$productID&mode=browse&label=$labelID&orderBy=$orderBy"; + $featurebar .= html::a($this->createLink($flow->module, 'browse', $params), "" . $labelTitle . "", '', "class='btn btn-link $class'"); +} +?> + + diff --git a/module/design/ext/view/browse.html.php b/module/design/ext/view/browse.html.php new file mode 100644 index 0000000000..a231e92424 --- /dev/null +++ b/module/design/ext/view/browse.html.php @@ -0,0 +1,191 @@ + + * @package flow + * @version $Id$ + * @link http://www.ranzhico.com + */ +?> +loadModel('common')->getRelations('design', $data->id, 'commit'); + $data->commit = ''; + foreach($relations as $relation) $data->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID", '', true), "#$relation->BID", '', "class='iframe' data-width='80%' data-height='550'"); + } +} +?> + + +module == 'process' || $flow->module == 'activity' || $flow->module == 'output');?> + + + + + +module);?> + +category == 'single' ? 'hidden' : 'show'; +js::set('showSubHeader', $showSubHeader); +?> + +
+
+
+ +
+ + + + + recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?> + + + show) continue;?> + width && $field->width != 'auto' ? $field->width . 'px' : $field->width;?> + + + + + + + + + > + + id data-order=$data->order"?>> + + + show || $field->field == 'actions') continue;?> + {$field->field})) + { + foreach($data->{$field->field} as $value) $output .= zget($field->options, $value) . ' '; + } + else + { + if($field->field == 'id') + { + if(commonModel::hasPriv($flow->module, 'view')) + { + $output = baseHTML::a(helper::createLink($flow->module, 'view', "dataID={$data->id}"), $data->id); + } + else + { + $output = $data->id; + } + } + elseif($field->field == 'name') + { + $output = html::a(helper::createLink($flow->module, 'view', "id={$data->id}"), $data->{$field->field}); + } + else + { + $output = zget($field->options, $data->{$field->field}); + } + } + ?> + field == 'id' && $allLabel == 0):?> + + + + + + + + + + + + + +
+ field == 'id' && $allLabel == 0):?> +
+ + field == 'desc' || $field->field == 'asc' || $field->field == 'actions') + { + echo $field->name; + } + else + { + commonModel::printOrderLink($field->field, $orderBy, $vars, $field->name, $flow->module, 'browse'); + } + ?> +
flow->orderAB;?>
id => '')) . html::a($this->createLink('design', 'view', "id=$data->id"), sprintf('%03d', $data->id))?> + +
+ +
+ + +
flow->buildOperateMenu($flow, $data, $type = 'browse');?>
+ + +
+ +
+
+
+createLink('design', 'create', "product=$productID")); +?> + + diff --git a/module/design/ext/view/commit.html.php b/module/design/ext/view/commit.html.php new file mode 100644 index 0000000000..8104fa5ffb --- /dev/null +++ b/module/design/ext/view/commit.html.php @@ -0,0 +1,63 @@ + + + +
+
+

+ id;?> + name?> + arrow . $lang->design->commit;?> +

+
+ +
method='post'> + + + + + + SCM) and $repo->SCM == 'Git'):?> + + + + + + + + + + + + + SCM == 'Git'):?> + + + + + comment, ENT_QUOTES);?> + + + + +
repo->revisionA?>repo->commit?>repo->time?>repo->committer?>repo->comment?>
+
+ revision, $linkedRevisions)) echo 'checked="checked"'?>/> + +
+
repo->createLink('revision', "repoID=$repoID&revision={$log->revision}"), $repo->SCM == 'Git' ? substr($log->revision, 0, 10) : $log->revision);?>commit?>time, 0, 10);?>committer;?>comment?>
+ +
+
+ + diff --git a/module/design/ext/view/create.html.php b/module/design/ext/view/create.html.php new file mode 100644 index 0000000000..0748ebce54 --- /dev/null +++ b/module/design/ext/view/create.html.php @@ -0,0 +1,71 @@ + + +category == 'single' ? 'hidden' : 'show'; +js::set('showSubHeader', $showSubHeader); +?> +
+
+
+

design->create;?>

+
+
+ + + category == 'multiple'):?> + + + + + + + category == 'single'):?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
design->product;?>
design->story;?>
design->type;?>design->typeList, '', "class='form-control chosen'");?>
design->name;?>
design->desc;?>
design->file;?>fetch('file', 'buildform', 'fileCount=1&percent=0.85');?>
+
+
+
+ + diff --git a/module/design/ext/view/edit.html.php b/module/design/ext/view/edit.html.php new file mode 100644 index 0000000000..10af439f14 --- /dev/null +++ b/module/design/ext/view/edit.html.php @@ -0,0 +1,107 @@ + + + +category == 'single' ? 'hidden' : 'show'; +js::set('showSubHeader', $showSubHeader); +?> +
+
+
+

design->edit;?>

+
+
+ + + category == 'multiple'):?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
design->product;?>product, "class='form-control chosen'");?>
design->story;?>story, "class='form-control chosen'");?>
design->type;?>design->typeList, $design->type, "class='form-control chosen'");?>
design->name;?>name, "class='form-control'");?>
design->desc;?>desc, "class='form-control'");?>
design->file;?>fetch('file', 'buildform', 'fileCount=1&percent=0.85');?>
story->checkAffection;?> +
+ +
+
+ + + + + + + + + + + + + tasks as $task):?> + + + ; + + + + + + + +
task->id;?>task->name;?>task->assignedTo;?>task->status;?>task->consumed;?>task->left;?>
id?>createLink('task', 'view', "taskID=$task->id"), $task->name, '_blank');?>assignedTo);?>processStatus('task', $task);?>consumed;?>left;?>
+
+
+
+
+
+
+
+ + diff --git a/module/design/ext/view/submit.html.php b/module/design/ext/view/submit.html.php new file mode 100644 index 0000000000..063c9cc0e2 --- /dev/null +++ b/module/design/ext/view/submit.html.php @@ -0,0 +1,35 @@ + +
+
+
+
+

design->submit;?>

+
+
+ + + + + + + + + + + + + + +
design->reviewObject;?> + design->typeList, $designType, "class='form-control'");?> +
design->range;?> + design->rangeList, '', "class='form-control'");?> +
+
+
+
+ +
diff --git a/module/design/ext/view/view.html.php b/module/design/ext/view/view.html.php new file mode 100644 index 0000000000..98548516f2 --- /dev/null +++ b/module/design/ext/view/view.html.php @@ -0,0 +1,93 @@ + + + + + +product; +$data->product = $this->dao->findByID($productID)->from(TABLE_PRODUCT)->fetch('name'); + +$this->loadModel('design'); +$relations = $this->loadModel('common')->getRelations('design', $data->id, 'commit'); +$data->commit = ''; +foreach($relations as $relation) $data->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID", '', true), "#$relation->BID", '', "class='iframe' data-width='80%' data-height='550'"); + +$storyTitle = $this->dao->findByID($data->story)->from(TABLE_STORY)->fetch('title'); +$data->story = $storyTitle ? html::a($this->createLink('story', 'view', "id=$data->story"), $storyTitle) : ''; + +$showAction = empty($_GET['onlybody']) ? 'show' : 'hidden'; +js::set('showAction', $showAction); +if(!empty($_GET['onlybody'])) +{ + $data->commit = ''; + foreach($relations as $relation) $data->commit .= " #$relation->BID"; + $data->story = $storyTitle; +} +?> + +
+
+
+
+
design->desc;?>
+
+ desc;?> + fetch('file', 'printFiles', array('files' => $data->files, 'fieldset' => 'false'));?> +
+
+
+ loadModel('action')->getList($flow->module, $data->id);?> +
+ flow->buildOperateMenu($flow, $data, $type = 'view');?> +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
design->type;?>options, $data->type);?>
design->product;?>product;?>
design->story;?>story;?>
design->commit;?>commit;?>
design->createdBy;?>createdBy);?>
design->createdDate;?>createdDate;?>
+
+
+
+
+ + diff --git a/module/design/model.php b/module/design/model.php new file mode 100644 index 0000000000..fdabfe6402 --- /dev/null +++ b/module/design/model.php @@ -0,0 +1,176 @@ +stripTags('desc', $this->config->allowedTags) + ->add('createdBy', $this->app->user->account) + ->add('createdDate', helper::now()) + ->add('program', $this->session->program) + ->add('version', 1) + ->remove('file,files,labels,children, toList') + ->get(); + + $design = $this->loadModel('file')->processImgURL($design, 'desc', $this->post->uid); + $this->dao->insert(TABLE_DESIGN)->data($design)->autoCheck()->batchCheck('name,type', 'notempty')->exec(); + + if(!dao::isError()) + { + $designID = $this->dao->lastInsertID(); + $this->file->updateObjectID($this->post->uid, $designID, 'design'); + $files = $this->file->saveUpload('design', $designID); + + $spec = new stdclass(); + $spec->design = $designID; + $spec->version = 1; + $spec->name = $design->name; + $spec->desc = $design->desc; + $spec->files = empty($files) ? '' : implode(',', array_keys($files)); + $this->dao->insert(TABLE_DESIGNSPEC)->data($spec)->exec(); + + return $designID; + } + + return false; + } + + public function update($designID) + { + $oldDesign = $this->getByID($designID); + $design = fixer::input('post') + ->stripTags('desc', $this->config->allowedTags) + ->add('editedBy', $this->app->user->account) + ->add('editedDate', helper::now()) + ->remove('file,files,labels,children, toList') + ->get(); + + $design = $this->loadModel('file')->processImgURL($design, 'desc', $this->post->uid); + $this->dao->update(TABLE_DESIGN)->data($design)->autoCheck()->batchCheck('name,type', 'notempty')->where('id')->eq($designID)->exec(); + + if(!dao::isError()) + { + $this->file->updateObjectID($this->post->uid, $designID, 'design'); + $files = $this->file->saveUpload('design', $designID); + $designChanged = ($oldDesign->name != $design->name || $oldDesign->desc != $design->desc || !empty($files)); + + if($designChanged) + { + $design = $this->getByID($designID); + $version = $design->version + 1; + $spec = new stdclass(); + $spec->design = $designID; + $spec->version = $version; + $spec->name = $design->name; + $spec->desc = $design->desc; + $spec->files = empty($files) ? '' : implode(',', array_keys($files)); + $this->dao->insert(TABLE_DESIGNSPEC)->data($spec)->exec(); + + $this->dao->update(TABLE_DESIGN)->set('version')->eq($version)->where('id')->eq($designID)->exec(); + } + + return common::createChanges($oldDesign, $design); + } + + return false; + } + + public function linkCommit($designID) + { + $this->dao->delete()->from(TABLE_RELATION)->where('AType')->eq('design')->andWhere('AID')->eq($designID)->andWhere('BType')->eq('commit')->andWhere('relation')->eq('completedin')->exec(); + $this->dao->delete()->from(TABLE_RELATION)->where('AType')->eq('commit')->andWhere('BID')->eq($designID)->andWhere('BType')->eq('design')->andWhere('relation')->eq('completedfrom')->exec(); + $revisions = $_POST['revision']; + + foreach($revisions as $revision) + { + $data = new stdclass(); + $data->program = $this->session->program; + $data->product = $this->session->product; + $data->AType = 'design'; + $data->AID = $designID; + $data->BType = 'commit'; + $data->BID = $revision; + $data->relation = 'completedin'; + $data->extra = $this->session->repoID; + + $this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec(); + + $data->AType = 'commit'; + $data->AID = $revision; + $data->BType = 'design'; + $data->BID = $designID; + $data->relation = 'completedfrom'; + + $this->dao->replace(TABLE_RELATION)->data($data)->autoCheck()->exec(); + } + } + + public function setFlowActionFields($module, $action) + { + $flow = $this->loadModel('workflow', 'flow')->getByModule($module); + $action = $this->loadModel('workflowaction', 'flow')->getByModuleAndAction($flow->module, $action); + $fields = $this->workflowaction->getFields($flow->module, $action->action); + + return array($flow, $action, $fields); + } + + public function setFlowChild($module, $action, $fields, $dataID = 0) + { + $this->loadModel('workflowlayout', 'flow'); + + $childFields = array(); + $childDatas = array(); + $childModules = $this->loadModel('workflow', 'flow')->getList($module, 'table'); + foreach($childModules as $childModule) + { + $key = 'sub_' . $childModule->module; + + if(isset($fields[$key]) && $fields[$key]->show) + { + $childFields[$key] = $this->workflowaction->getFields($childModule->module, $action); + $childDatas[$key] = $this->flow->getDataList($childModule, '', 0, $dataID); + } + } + + return array($childFields, $childDatas); + } + + public function setProductMenu($productID = 0) + { + $programID = $this->session->program; + $products = $this->loadModel('product')->getPairs($programID); + $productID = in_array($productID, array_keys($products)) ? $productID : key($products); + + $productID = $this->loadModel('product')->saveState($productID, $products); + $this->loadModel('product')->setMenu($products, $productID); + } + + public function getByID($designID) + { + return $this->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetch(); + } + + public function getDesignPairs($productID = 0, $type = 'detailed') + { + $designs = $this->dao->select('id, name')->from(TABLE_DESIGN) + ->where('product')->eq($productID) + ->andWhere('deleted')->eq(0) + ->andWhere('type')->eq($type) + ->fetchPairs(); + foreach($designs as $id => $name) $designs[$id] = $id . ':' . $name; + + return $designs; + } + + public function getAffectedScope($design) + { + /* Get affected tasks. */ + $design->tasks = $this->dao->select('*')->from(TABLE_TASK) + ->where('deleted')->eq(0) + ->andWhere('status')->ne('closed') + ->andWhere('design')->eq($design->id) + ->orderBy('id desc')->fetchAll(); + + return $design; + } +} diff --git a/module/install/view/step4.html.php b/module/install/view/step4.html.php index 6be22c42b3..c710a3dece 100644 --- a/module/install/view/step4.html.php +++ b/module/install/view/step4.html.php @@ -49,7 +49,7 @@ install->company;?> - + install->working;?> install->workingList, 'full', "class='form-control chosen'");?>