From c82fc3ff60e4e605b8a3c7f36d77461aad3b0319 Mon Sep 17 00:00:00 2001 From: leiyong <1549684884@qq.com> Date: Thu, 20 Aug 2020 15:49:26 +0800 Subject: [PATCH 1/3] * Add scrum block module. --- db/update20.0.sql | 8 +++---- module/block/control.php | 7 +++--- module/block/lang/zh-cn.php | 18 +++++++++++++++- module/block/model.php | 21 ++++++++++++++++++ module/block/view/scrumtestblock.html.php | 26 +++++++++++------------ module/task/control.php | 1 + 6 files changed, 58 insertions(+), 23 deletions(-) diff --git a/db/update20.0.sql b/db/update20.0.sql index c86ef8bd2d..5af7eb7c59 100644 --- a/db/update20.0.sql +++ b/db/update20.0.sql @@ -239,10 +239,10 @@ CREATE TABLE IF NOT EXISTS `zt_holiday` ( `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(30) NOT NULL DEFAULT '', `type` enum('holiday', 'working') NOT NULL DEFAULT 'holiday', - `desc` text NOT NULL, - `year` char(4) NOT NULL, - `begin` date NOT NULL, - `end` date NOT NULL, + `desc` text NOT NULL, + `year` char(4) NOT NULL, + `begin` date NOT NULL, + `end` date NOT NULL, PRIMARY KEY (`id`), KEY `year` (`year`), KEY `name` (`name`) diff --git a/module/block/control.php b/module/block/control.php index 4a034203b5..de01ca3231 100644 --- a/module/block/control.php +++ b/module/block/control.php @@ -1440,18 +1440,17 @@ class block extends control */ public function printScrumtestBlock() { - $this->view->program = $this->loadModel('project')->getByID($this->session->program); - $this->session->set('testtaskList', $this->app->getURI(true)); if(preg_match('/[^a-zA-Z0-9_]/', $this->params->type)) die(); $this->app->loadLang('testtask'); - $this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName')->from(TABLE_TESTTASK)->alias('t1') + $this->view->testtasks = $this->dao->select('t1.*,t2.name as productName,t3.name as buildName,t4.name as projectName') + ->from(TABLE_TESTTASK)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id') ->leftJoin(TABLE_BUILD)->alias('t3')->on('t1.build=t3.id') ->leftJoin(TABLE_PROJECT)->alias('t4')->on('t1.project=t4.id') ->leftJoin(TABLE_PROJECTPRODUCT)->alias('t5')->on('t1.project=t5.project') ->where('t1.deleted')->eq('0') - ->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi() + ->andWhere('t1.product')->eq($this->session->program)->fi() ->andWhere('t1.product = t5.product') ->beginIF($this->params->type != 'all')->andWhere('t1.status')->eq($this->params->type)->fi() ->orderBy('t1.id desc') diff --git a/module/block/lang/zh-cn.php b/module/block/lang/zh-cn.php index 4fa18ec0bd..818e5dcaf9 100644 --- a/module/block/lang/zh-cn.php +++ b/module/block/lang/zh-cn.php @@ -117,6 +117,10 @@ $lang->block->default['scrum']['program']['4']['title'] = '待测版本'; $lang->block->default['scrum']['program']['4']['block'] = 'scrumtest'; $lang->block->default['scrum']['program']['4']['grid'] = 8; +$lang->block->default['scrum']['program']['4']['params']['type'] = 'all'; +$lang->block->default['scrum']['program']['4']['params']['num'] = '15'; +$lang->block->default['scrum']['program']['4']['params']['orderBy'] = 'id_desc'; + $lang->block->default['scrum']['program']['5']['title'] = '产品总览'; $lang->block->default['scrum']['program']['5']['block'] = 'scrumproduct'; $lang->block->default['scrum']['program']['5']['grid'] = 4; @@ -126,7 +130,7 @@ $lang->block->default['scrum']['program']['6']['block'] = 'scrumproject'; $lang->block->default['scrum']['program']['6']['grid'] = 4; $lang->block->default['scrum']['program']['7']['title'] = '最新动态'; -$lang->block->default['scrum']['program']['7']['block'] = 'scrumoverview'; +$lang->block->default['scrum']['program']['7']['block'] = 'scrumdynamic'; $lang->block->default['scrum']['program']['7']['grid'] = 4; $lang->block->default['product']['1']['title'] = $lang->productCommon . '统计'; @@ -315,6 +319,18 @@ $lang->block->moduleList['product'] = $lang->productCommon; $lang->block->moduleList['project'] = $lang->projectCommon; $lang->block->moduleList['qa'] = '测试'; $lang->block->moduleList['todo'] = '待办'; +$lang->block->moduleList['program'] = '项目'; + + +$lang->block->modules['program'] = new stdclass(); +$lang->block->modules['program']->availableBlocks = new stdclass(); +$lang->block->modules['program']->availableBlocks->scrumoverall = '项目整体情况'; +$lang->block->modules['program']->availableBlocks->scrumprogress = '进行中的迭代'; +$lang->block->modules['program']->availableBlocks->scrumproject = '迭代总览'; +$lang->block->modules['program']->availableBlocks->scrumproduct = '产品总览'; +$lang->block->modules['program']->availableBlocks->scrumtest = '待测版本'; +$lang->block->modules['program']->availableBlocks->scrumroadmap = '产品路线图'; +$lang->block->modules['program']->availableBlocks->scrumdynamic = '最新动态'; $lang->block->modules['product'] = new stdclass(); $lang->block->modules['product']->availableBlocks = new stdclass(); diff --git a/module/block/model.php b/module/block/model.php index 9c8a109623..703856cd5e 100644 --- a/module/block/model.php +++ b/module/block/model.php @@ -661,4 +661,25 @@ class blockModel extends model return $key == $hash; } + + /** + * Get testtask params. + *▫ + * @param string $module▫ + * @access public + * @return void + */ + public function getScrumtestParams($module = '') + { + $params = new stdclass(); + $params->type['name'] = $this->lang->block->type; + $params->type['options'] = $this->lang->block->typeList->testtask; + $params->type['control'] = 'select'; + + $params->num['name'] = $this->lang->block->num; + $params->num['default'] = 20; + $params->num['control'] = 'input'; + + return json_encode($params); + } } diff --git a/module/block/view/scrumtestblock.html.php b/module/block/view/scrumtestblock.html.php index b4327a7afb..5cb099cef5 100644 --- a/module/block/view/scrumtestblock.html.php +++ b/module/block/view/scrumtestblock.html.php @@ -17,16 +17,15 @@ - - - - - + - - + + + + + @@ -36,16 +35,15 @@ $viewLink = $this->createLink('testtask', 'view', "testtaskID={$testtask->id}"); ?> > - - - - - + - - + + + + + diff --git a/module/task/control.php b/module/task/control.php index 44b700a291..c6264caa62 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -81,6 +81,7 @@ class task extends control } $project = $this->project->getById($projectID); + $taskLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=task"); $storyLink = $this->session->storyList ? $this->session->storyList : $this->createLink('project', 'story', "projectID=$projectID"); From 09cfff0dbc8d34f3d0f0597f6e4a1d34bb61bc19 Mon Sep 17 00:00:00 2001 From: z Date: Thu, 20 Aug 2020 15:52:07 +0800 Subject: [PATCH 2/3] * finish task #7644,7642. --- db/update20.0.sql | 3 ++ module/program/control.php | 29 +++++++++---- module/program/css/browse.css | 2 + module/program/js/create.js | 4 +- module/program/lang/zh-cn.php | 2 + module/program/model.php | 52 +++++++++++++++++++++++ module/program/view/browsebylist.html.php | 3 +- module/program/view/create.html.php | 7 ++- 8 files changed, 90 insertions(+), 12 deletions(-) diff --git a/db/update20.0.sql b/db/update20.0.sql index 93bc2f330c..7b67afca2c 100644 --- a/db/update20.0.sql +++ b/db/update20.0.sql @@ -269,3 +269,6 @@ CREATE TABLE `zt_taskspec` ( `deadline` date NOT NULL, UNIQUE KEY `task` (`task`,`version`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +ALTER TABLE `zt_project` ADD `path` varchar(255) NOT NULL AFTER `parent`; +ALTER TABLE `zt_project` ADD `grade` tinyint unsigned NOT NULL AFTER `path`; diff --git a/module/program/control.php b/module/program/control.php index dd123847c9..f576d170c2 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -22,7 +22,6 @@ class program extends control $this->session->set('program', $programID); $this->lang->navGroup->program = 'program'; - $this->view->title = $this->lang->program->common . $this->lang->colon . $this->lang->program->index; $this->view->position[] = $this->lang->program->index; $this->view->program = $this->project->getByID($programID); @@ -87,20 +86,19 @@ class program extends control /** * Create a program. * - * @param varchar $template - * @param int $copyProgramID + * @param string $template + * @param int $programID + * @param int $copyProgramID * @access public * @return void */ - public function create($template = 'cmmi', $copyProgramID = '') + public function create($template = 'cmmi', $programID = 0, $copyProgramID = '') { if($_POST) { $projectID = $this->program->create(); - if(dao::isError()) - { - $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError()))); - } + if(dao::isError()) $this->send(array('result' => 'fail', 'message' => $this->processErrors(dao::getError()))); + $this->loadModel('action')->create('project', $projectID, 'opened'); $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse', array('status' => 'wait', 'orderBy' => 'order_desc')))); } @@ -111,6 +109,19 @@ class program extends control $whitelist = ''; $acl = 'open'; $privway = 'extend'; + + if($programID) + { + $program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch(); + if($this->program->checkHasContent($programID)) + { + echo js::alert($this->lang->program->cannotCreateChild); + die(js::locate('back')); + } + + if(empty($template)) $template = $program->template; + } + if($copyProgramID) { $copyProgram = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($copyProgramID)->fetch(); @@ -120,6 +131,7 @@ class program extends control $acl = $copyProgram->acl; $privway = $copyProgram->privway; $whitelist = $copyProgram->whitelist; + if(empty($template)) $template = $copyProgram->template; } $this->view->title = $this->lang->program->create; @@ -134,6 +146,7 @@ class program extends control $this->view->acl = $acl; $this->view->privway = $privway; $this->view->whitelist = $whitelist; + $this->view->programID = $programID; $this->view->copyProgramID = $copyProgramID; $this->display(); } diff --git a/module/program/css/browse.css b/module/program/css/browse.css index 42bc88fd60..0c1d1bde46 100644 --- a/module/program/css/browse.css +++ b/module/program/css/browse.css @@ -25,3 +25,5 @@ #cards .project-detail .progress-text-left .progress-text {width: 50px; left: -50px;} #cards .pager {margin: 0; float: right;} #cards .pager .btn{border: none} + +.w-215px{width:215px;} diff --git a/module/program/js/create.js b/module/program/js/create.js index 425ec369fd..fe5ee350f0 100644 --- a/module/program/js/create.js +++ b/module/program/js/create.js @@ -3,7 +3,7 @@ $(function() $('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')}); }); -function setCopyProject(programID) +function setCopyProject(copiedProgramID) { - location.href = createLink('program', 'create', 'template=' + template + '©ProgramID=' + programID); + location.href = createLink('program', 'create', 'template=' + template + '&programID=' + programID + '©ProgramID=' + copiedProgramID); } diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index 5a732e57ea..2283c9cc38 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -41,6 +41,7 @@ $lang->program->transfer = '进入项目'; $lang->program->setPlanduration = '设置工期'; $lang->program->export = '导出'; $lang->program->privway = '权限控制'; +$lang->program->children = '子项目'; $lang->program->manageGroupMember = '维护分组用户'; $lang->program->durationEstimation = '工作量估算'; @@ -82,3 +83,4 @@ $lang->program->scrumDesc = '简介:小步迭代, $lang->program->cmmi = '瀑布'; $lang->program->cmmiTitle = '瀑布式项目管理'; $lang->program->cmmiDesc = '简介:按阶段规范化管理
包含功能点:估算、计划、阶段、报告'; +$lang->program->cannotCreateChild = '该项目已经有实际的内容,无法直接添加子项目。您可以为当前项目创建一个父项目,然后在新的父项目下面添加子项目。'; diff --git a/module/program/model.php b/module/program/model.php index fbc5b19ca7..3df689e5ce 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -5,6 +5,7 @@ class programModel extends model { return $this->dao->select('*')->from(TABLE_PROJECT) ->where('iscat')->eq(0) + ->andWhere('template')->ne('') ->andWhere('program')->eq(0) ->andWhere('deleted')->eq(0) ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->programs)->fi() @@ -93,6 +94,12 @@ class programModel extends model $this->dao->update(TABLE_PROJECT)->set('`order`')->eq($programID * 5)->where('id')->eq($programID)->exec(); $this->file->updateObjectID($this->post->uid, $programID, 'project'); + if($project->parent > 0) + { + $this->dao->update(TABLE_PROJECT)->set('isCat')->eq(1)->where('id')->eq($project->parent)->exec(); + $this->fixPath($programID); + } + /* Add program admin.*/ $groupPriv = $this->dao->select('t1.*')->from(TABLE_USERGROUP)->alias('t1') ->leftJoin(TABLE_GROUP)->alias('t2')->on('t1.group = t2.id') @@ -189,4 +196,49 @@ class programModel extends model { return $this->dao->select('*')->from(TABLE_PRODUCT)->where('project')->eq($program)->fetchAll('id'); } + + public function checkHasContent($programID) + { + $count = 0; + $count += $this->dao->select('count(*) as count')->from(TABLE_BUDGET)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_BUG)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_CASE)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_DESIGN)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_DOC)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_DURATIONESTIMATION)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_ISSUE)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_PROJECT)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_RELATION)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_RELEASE)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_REPO)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_RISK)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_STORY)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_TESTREPORT)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_TESTSUITE)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_TESTTASK)->where('program')->eq($programID)->fetch('count'); + $count += $this->dao->select('count(*) as count')->from(TABLE_WORKESTIMATION)->where('program')->eq($programID)->fetch('count'); + + return $count > 0; + } + + public function fixPath($programID) + { + $path = array(); + $program = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($programID)->fetch(); + if($program->parent == 0) + { + $path['path'] = ",{$program->id},"; + $path['grade'] = 1; + $this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec(); + } + else + { + $path = $this->fixPath($program->parent); + $path['path'] .= "{$program->id},"; + $path['grade'] += 1; + $this->dao->update(TABLE_PROJECT)->set('path')->eq($path['path'])->set('grade')->eq($path['grade'])->where('id')->eq($program->id)->exec(); + } + + return $path; + } } diff --git a/module/program/view/browsebylist.html.php b/module/program/view/browsebylist.html.php index d2dfb5103c..50a3b1bd92 100644 --- a/module/program/view/browsebylist.html.php +++ b/module/program/view/browsebylist.html.php @@ -14,7 +14,7 @@
- + @@ -43,6 +43,7 @@ id", $project, 'list', '', '', 'iframe', true);?> id", $project, 'list', '', '', 'iframe', true);?> createLink("program", "edit", "projectID=$project->id"), "", '', "class='btn' title='{$lang->edit}'");?> + id", '', 'list', 'treemap-alt', '', '', '', '', $this->lang->program->children);?> diff --git a/module/program/view/create.html.php b/module/program/view/create.html.php index c2dab91696..31e10e94af 100644 --- a/module/program/view/create.html.php +++ b/module/program/view/create.html.php @@ -101,7 +101,7 @@ - + @@ -129,6 +129,10 @@
idAB?>testtask->product;?> testtask->name;?> testtask->project . '/' . $lang->testtask->build;?>testtask->product;?> testtask->begin;?>testtask->end;?>testtask->project?>testtask->build;?>testtask->status;?>
id);?>productName?> name?> buildName?>'>projectName . '/' . $testtask->buildName?>productName?> begin?>end?>projectName?>buildName?>testtask->statusList, $testtask->status)?>
program->end);?> program->budget);?> program->PM);?>actions;?>actions;?> project->orderAB);?>
project->status;?>
+
@@ -165,4 +169,5 @@ + From e4b7c55620a2bfd34aadd65589131075141dd2fd Mon Sep 17 00:00:00 2001 From: tianshujie98 Date: Thu, 20 Aug 2020 16:24:17 +0800 Subject: [PATCH 3/3] * Finish task #7628. --- module/design/control.php | 137 ++++++++++++++++++++++------- module/design/css/browse.css | 3 + module/design/css/edit.css | 1 + module/design/js/common.js | 11 +++ module/design/js/view.js | 6 ++ module/design/model.php | 119 +++++++++++++++++-------- module/design/view/browse.html.php | 101 +++++++-------------- module/design/view/commit.html.php | 19 +++- module/design/view/create.html.php | 28 +++--- module/design/view/edit.html.php | 25 +++--- module/design/view/view.html.php | 58 ++++++------ 11 files changed, 307 insertions(+), 201 deletions(-) create mode 100644 module/design/css/browse.css create mode 100644 module/design/css/edit.css create mode 100644 module/design/js/view.js diff --git a/module/design/control.php b/module/design/control.php index 7b7f7eb40e..b2a29bbdf6 100644 --- a/module/design/control.php +++ b/module/design/control.php @@ -1,7 +1,29 @@ + * @package design + * @version $Id: control.php 5107 2013-07-12 01:46:12Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ class design extends control { - public function browse($productID = 0,$type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) + /** + * Browse designs. + * + * @param int $productID + * @param string $type + * @param string $orderBy + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ + public function browse($productID = 0, $type = 'all', $orderBy = 'id_desc', $recTotal = 0, $recPerPage = 20, $pageID = 1) { $productID = $this->loadModel('product')->saveState($productID, $this->product->getPairs('nocode')); @@ -33,27 +55,38 @@ class design extends control $this->display(); } + /** + * Create a design. + * + * @param int $productID + * @param string $prevModule + * @param int $prevID + * @access public + * @return void + */ public function create($productID = 0, $prevModule = '', $prevID = 0) { + $productID = $this->loadModel('product')->saveState($productID, $this->product->getPairs('nocode')); + $this->design->setProductMenu($productID); if($_POST) { - $productID = $_POST['product']; + $productID = $this->post->product; $designID = $this->design->create(); - if($designID) + if(dao::isError()) { - $this->loadModel('action')->create('design', $designID, 'created'); - - $response['result'] = 'success'; - $response['message'] = $this->lang->saveSuccess; - $response['locate'] = $this->createLink('design', 'browse', "productID=$productID"); + $response['result'] = 'fail'; + $response['message'] = dao::getError(); $this->send($response); } - $response['result'] = 'fail'; - $response['message'] = dao::getError(); + $this->loadModel('action')->create('design', $designID, 'created'); + + $response['result'] = 'success'; + $response['message'] = $this->lang->saveSuccess; + $response['locate'] = $this->createLink('design', 'browse', "productID=$productID"); $this->send($response); } @@ -69,26 +102,40 @@ class design extends control $this->display(); } + /** + * View a design. + * + * @param int $designID + * @access public + * @return void + */ public function view($designID = 0) { - $data = $this->design->getById($designID); - $data->productName = $this->dao->findByID($data->product)->from(TABLE_PRODUCT)->fetch('name'); - $data->files = $this->loadModel('file')->getByObject('design', $designID); + $design = $this->design->getById($designID); + $design->productName = $this->dao->findByID($design->product)->from(TABLE_PRODUCT)->fetch('name'); + $design->files = $this->loadModel('file')->getByObject('design', $designID); - $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'"); + $relations = $this->loadModel('common')->getRelations('design', $design->id, 'commit'); + $storyTitle = $this->dao->findByID($design->story)->from(TABLE_STORY)->fetch('title'); + $design->commit = ''; + if(!empty($_GET['onlybody'])) + { + foreach($relations as $relation) $design->commit .= " #$relation->BID"; + $design->story = $storyTitle; + } + else + { + foreach($relations as $relation) $design->commit .= html::a(helper::createLink('design', 'revision', "repoID=$relation->BID", '', true), "#$relation->BID", '', "class='iframe' data-width='80%' data-height='550'"); + $design->story = $storyTitle ? html::a($this->createLink('story', 'view', "id=$design->story"), $storyTitle) : ''; + } - $storyTitle = $this->dao->findByID($data->story)->from(TABLE_STORY)->fetch('title'); - $data->story = $storyTitle ? html::a($this->createLink('story', 'view', "id=$data->story"), $storyTitle) : ''; - - $actions = $this->loadModel('action')->getList('design', $data->id); + $actions = $this->loadModel('action')->getList('design', $design->id); $this->view->title = $this->lang->design->designView; $this->view->position[] = $this->lang->design->designView; - $this->view->productID = $data->product; - $this->view->data = $data; + $this->view->productID = $design->product; + $this->view->design = $design; $this->view->relations = $relations; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->actions = $actions; @@ -96,6 +143,13 @@ class design extends control $this->display(); } + /** + * Edit a design. + * + * @param int $designID + * @access public + * @return void + */ public function edit($designID = 0) { $design = $this->design->getByID($designID); @@ -105,13 +159,16 @@ class design extends control if($_POST) { $changes = $this->design->update($designID); - if($changes) + if(dao::isError()) { - $actionID = $this->loadModel('action')->create('design', $designID, 'changed'); - $this->action->logHistory($actionID, $changes); - + $response['result'] = 'fail'; + $response['message'] = dao::getError(); + $this->send($response); } + $actionID = $this->loadModel('action')->create('design', $designID, 'changed'); + $this->action->logHistory($actionID, $changes); + $response['result'] = 'success'; $response['message'] = $this->lang->saveSuccess; $response['locate'] = $this->createLink('design', 'view', "id=$design->id"); @@ -129,18 +186,30 @@ class design extends control $this->display(); } + /** + * Commit a design. + * + * @param int $designID + * @param string $begin + * @param string $end + * @param int $recTotal + * @param int $recPerPage + * @param int $pageID + * @access public + * @return void + */ public function commit($designID, $begin = '', $end = '', $recTotal = 0, $recPerPage = 50, $pageID = 1) { $this->app->loadClass('pager', $static = true); - $pager = new pager($recTotal, $recPerPage, $pageID); + $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); + $repoID = $this->session->repoID; + $repo = $this->loadModel('repo')->getRepoByID($repoID); + $revisions = $this->repo->getCommits($repo, '', 'HEAD', '', $pager, $begin, $end); if($_POST) { @@ -172,6 +241,14 @@ class design extends control $this->display(); } + /** + * Delete a design. + * + * @param int $designID + * @param string $confirm + * @access public + * @return void + */ public function delete($designID, $confirm = 'no') { if($confirm == 'no') diff --git a/module/design/css/browse.css b/module/design/css/browse.css new file mode 100644 index 0000000000..e86f93c99b --- /dev/null +++ b/module/design/css/browse.css @@ -0,0 +1,3 @@ +#featurebar{display:inline-block;} +.modal-dialog{width:70% !important} +table td{white-space:nowrap;text-overflow:ellipsis;overflow:hidden;} diff --git a/module/design/css/edit.css b/module/design/css/edit.css new file mode 100644 index 0000000000..98893529a9 --- /dev/null +++ b/module/design/css/edit.css @@ -0,0 +1 @@ +.tabs .tab-pane .table{border: 1px solid #ddd; border-top: none} diff --git a/module/design/js/common.js b/module/design/js/common.js index 7005b0242f..228284b775 100644 --- a/module/design/js/common.js +++ b/module/design/js/common.js @@ -3,3 +3,14 @@ $(document).on('click', '.ajaxPager', function() $('#logBox').load($(this).attr('href')); return false; }) +$('#product').change(function() +{ + productID = $(this).val(); + var link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID); + $.post(link, function(data) + { + $('#story').replaceWith(data); + $('#story_chosen').remove(); + $('#story').chosen(); + }) +}) diff --git a/module/design/js/view.js b/module/design/js/view.js new file mode 100644 index 0000000000..829a9efbdc --- /dev/null +++ b/module/design/js/view.js @@ -0,0 +1,6 @@ +$('.main-actions').width($('.main-col').outerWidth()); +if(showAction == 'hidden') +{ + $('.main-actions').remove(); + $('.pull-left').children('a').remove(); +}; diff --git a/module/design/model.php b/module/design/model.php index 1e04ea5d05..741d78913a 100644 --- a/module/design/model.php +++ b/module/design/model.php @@ -1,6 +1,24 @@ + * @package design + * @version $Id: model.php 5079 2013-07-10 00:44:34Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +?> +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); @@ -30,11 +48,18 @@ class designModel extends model $this->dao->insert(TABLE_DESIGNSPEC)->data($spec)->exec(); return $designID; - } + } return false; } + /** + * Update a design. + * + * @param int $designID + * @access public + * @return bool + */ public function update($designID) { $oldDesign = $this->getByID($designID); @@ -57,7 +82,7 @@ class designModel extends model if($designChanged) { $design = $this->getByID($designID); - $version = $design->version + 1; + $version = $design->version + 1; $spec = new stdclass(); $spec->design = $designID; $spec->version = $version; @@ -70,16 +95,23 @@ class designModel extends model } return common::createChanges($oldDesign, $design); - } + } return false; } - + + /** + * LinkCommit a design. + * + * @param int $designID + * @access public + * @return void + */ 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']; + $revisions = $_POST['revision']; foreach($revisions as $revision) { @@ -105,38 +137,15 @@ class designModel extends model } } - 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); - } - + /** + * SetProductMenu + * + * @param int $productID + * @access public + * @return void + */ 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); @@ -145,12 +154,27 @@ class designModel extends model $this->loadModel('product')->setMenu($products, $productID); } + /** + * GetByID + * + * @param int $designID + * @access public + * @return object + */ public function getByID($designID) { $design = $this->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetch(); return $this->loadModel('file')->replaceImgURL($design, 'desc'); } + /** + * GetDesignPairs + * + * @param int $productID + * @param string $type + * @access public + * @return object + */ public function getDesignPairs($productID = 0, $type = 'detailed') { $designs = $this->dao->select('id, name')->from(TABLE_DESIGN) @@ -158,13 +182,20 @@ class designModel extends model ->andWhere('deleted')->eq(0) ->andWhere('type')->eq($type) ->fetchPairs(); - foreach($designs as $id => $name) $designs[$id] = $id . ':' . $name; + foreach($designs as $id => $name) $designs[$id] = $id . ':' . $name; return $designs; } + /** + * GetAffectedScope + * + * @param int $design + * @access public + * @return object + */ public function getAffectedScope($design) - { + { /* Get affected tasks. */ $design->tasks = $this->dao->select('*')->from(TABLE_TASK) ->where('deleted')->eq(0) @@ -175,6 +206,16 @@ class designModel extends model return $design; } + /** + * GetList + * + * @param int $productID + * @param int $type + * @param int $orderBy + * @param int $pager + * @access public + * @return array + */ public function getList($productID, $type, $orderBy, $pager) { return $this->dao->select('*')->from(TABLE_DESIGN) diff --git a/module/design/view/browse.html.php b/module/design/view/browse.html.php index 91e63a28da..686f171887 100644 --- a/module/design/view/browse.html.php +++ b/module/design/view/browse.html.php @@ -1,32 +1,16 @@ - * @package flow - * @version $Id$ - * @link http://www.ranzhico.com + * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) + * @license ZPL (http://zpl.pub/page/zplv12.html) + * @author Chunsheng Wang + * @package design + * @version $Id: browse.html.php 5102 2013-07-12 00:59:54Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net */ ?> -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'"); - } -} -?> - - + {$pager->recTotal}"; - echo html::a(inlink('browse', "productID={$productID}&type=all"), "{$lang->design->typeList['all']}" . ($type == 'all' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'all' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink('browse', "productID={$productID}&type=HLDS"), "{$lang->design->typeList['HLDS']}" . ($type == 'HLDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'HLDS' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink('browse', "productID={$productID}&type=DDS"), "{$lang->design->typeList['DDS']}" . ($type == 'DDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DDS' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink('browse', "productID={$productID}&type=DBDS"), "{$lang->design->typeList['DBDS']}" . ($type == 'DBDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DBDS' ? ' btn-active-text' : '') . "'"); - echo html::a(inlink('browse', "productID={$productID}&type=ADS"), "{$lang->design->typeList['ADS']}" . ($type == 'ADS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'ADS' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink('browse', "productID={$productID}&type=all"), "{$lang->design->typeList['all']}" . ($type == 'all' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'all' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink('browse', "productID={$productID}&type=HLDS"), "{$lang->design->typeList['HLDS']}" . ($type == 'HLDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'HLDS' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink('browse', "productID={$productID}&type=DDS"), "{$lang->design->typeList['DDS']}" . ($type == 'DDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DDS' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink('browse', "productID={$productID}&type=DBDS"), "{$lang->design->typeList['DBDS']}" . ($type == 'DBDS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'DBDS' ? ' btn-active-text' : '') . "'"); + echo html::a(inlink('browse', "productID={$productID}&type=ADS"), "{$lang->design->typeList['ADS']}" . ($type == 'ADS' ? $recTotalLabel : ''), '', "class='btn btn-link" . ($type == 'ADS' ? ' btn-active-text' : '') . "'"); ?>
- createLink('design', 'create', "productID=$productID&designID=0"), " {$lang->design->create}", '', "class='btn btn-primary'"); - ?> + createLink('design', 'create', "productID=$productID&designID=0"), " {$lang->design->create}", '', "class='btn btn-primary'");?>
-

design->noDesign;?>

+

design->noDesign;?>

@@ -61,34 +43,15 @@ js::set('showSubHeader', $showSubHeader); recTotal&recPerPage=$pager->recPerPage&pageID=$pager->pageID";?> - -
- idAB);?> - - - design->type);?> - - - design->name);?> - - - design->submission);?> - - - design->version);?> - - - design->createdBy);?> - - - design->createdDate);?> - - - design->assignedTo);?> - - - design->actions;?> - + idAB);?> + design->type);?> + design->name);?> + design->submission);?> + design->version);?> + design->createdBy);?> + design->createdDate);?> + design->assignedTo);?> + design->actions;?> @@ -103,21 +66,21 @@ js::set('showSubHeader', $showSubHeader); createdDate;?> assignedTo;?> - id}"; - common::printIcon('design', 'edit', $vars, $design, 'list', 'fork', '', '', '', '', '', $design->program); - common::printIcon('design', 'commit', $vars, $design, 'list', 'link', '', 'iframe showinonlybody', true); - common::printIcon('design', 'delete', $vars, $design, 'list', 'trash', 'hiddenwin', '', '', '', '', $design->program); - ?> + id}"; + common::printIcon('design', 'edit', $vars, $design, 'list', 'fork', '', '', '', '', '', $design->program); + common::printIcon('design', 'commit', $vars, $design, 'list', 'link', '', 'iframe showinonlybody', true); + common::printIcon('design', 'delete', $vars, $design, 'list', 'trash', 'hiddenwin', '', '', '', '', $design->program); + ?>
- + diff --git a/module/design/view/commit.html.php b/module/design/view/commit.html.php index edd4424200..1ee3f9c087 100644 --- a/module/design/view/commit.html.php +++ b/module/design/view/commit.html.php @@ -1,5 +1,16 @@ + + * @package design + * @version $Id: commit.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ +?> -

@@ -9,9 +20,9 @@

method='post'> diff --git a/module/design/view/create.html.php b/module/design/view/create.html.php index 504da92c35..50b0332af7 100644 --- a/module/design/view/create.html.php +++ b/module/design/view/create.html.php @@ -1,3 +1,15 @@ + + * @package design + * @version $Id: create.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ +?> - category == 'single'):?> - - + category == 'single') echo html::hidden('product', $productID);?> design->story;?> @@ -54,18 +64,6 @@ js::set('showSubHeader', $showSubHeader);
diff --git a/module/design/view/edit.html.php b/module/design/view/edit.html.php index 4878f0beea..8451e73528 100644 --- a/module/design/view/edit.html.php +++ b/module/design/view/edit.html.php @@ -1,10 +1,21 @@ + + * @package design + * @version $Id: edit.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ +?> category == 'single' ? 'hidden' : 'show'; js::set('showSubHeader', $showSubHeader); ?> -
@@ -90,18 +101,6 @@ js::set('showSubHeader', $showSubHeader);
diff --git a/module/design/view/view.html.php b/module/design/view/view.html.php index 3926d89ba4..118b360d90 100644 --- a/module/design/view/view.html.php +++ b/module/design/view/view.html.php @@ -1,19 +1,23 @@ - commit = ''; - foreach($relations as $relation) $data->commit .= " #$relation->BID"; - $data->story = $storyTitle; -} +/** + * The view of design module of ZenTaoPMS. + * + * @copyright Copyright 2009-2015 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com) + * @license ZPL (http://zpl.pub/page/zplv12.html) + * @author Chunsheng Wang + * @package design + * @version $Id: view.html.php 4903 2013-06-26 05:32:59Z wyd621@gmail.com $ + * @link http://www.zentao.net + */ ?> + @@ -23,8 +27,8 @@ if(!empty($_GET['onlybody']))
design->desc;?>
- desc;?> - fetch('file', 'printFiles', array('files' => $data->files, 'fieldset' => 'true'));?> + desc;?> + fetch('file', 'printFiles', array('files' => $design->files, 'fieldset' => 'true'));?>
@@ -33,13 +37,13 @@ if(!empty($_GET['onlybody']))
session->designList);?>
";?> - deleted):?> + deleted):?> id", $data, 'button', 'link', '', 'iframe showinonlybody', true); - common::printIcon('design', 'edit', "designID=$data->id", $data, 'button', '', '', '', true); - common::printIcon('design', 'delete', "designID=$data->id", $data, 'button', 'trash', 'hiddenwin'); + common::printIcon('design', 'commit', "designID=$design->id", $design, 'button', 'link', '', 'iframe showinonlybody', true); + common::printIcon('design', 'edit', "designID=$design->id", $design, 'button', '', '', '', true); + common::printIcon('design', 'delete', "designID=$design->id", $design, 'button', 'trash', 'hiddenwin'); ?> - + @@ -49,39 +53,31 @@ if(!empty($_GET['onlybody'])) - + - + - + - + - + - +
design->type;?>design->typeList, $data->type);?>design->typeList, $design->type);?>
design->product;?>productName;?>productName;?>
design->story;?>story;?>story;?>
design->commit;?>commit;?>commit;?>
design->createdBy;?>createdBy);?>createdBy);?>
design->createdDate;?>createdDate;?>createdDate;?>
- - +