diff --git a/db/zentao.sql b/db/zentao.sql index 8c556a9a8e..5244e52c86 100644 --- a/db/zentao.sql +++ b/db/zentao.sql @@ -731,7 +731,7 @@ CREATE TABLE `zt_project` ( KEY `status` (`status`), KEY `acl` (`acl`), KEY `order` (`order`) -) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8 +) ENGINE=MyISAM AUTO_INCREMENT=25 DEFAULT CHARSET=utf8; -- DROP TABLE IF EXISTS `zt_projectspec`; CREATE TABLE `zt_projectspec` ( `project` mediumint(8) NOT NULL, diff --git a/lib/scm/scm.class.php b/lib/scm/scm.class.php index c2818a6f3a..966e32057a 100644 --- a/lib/scm/scm.class.php +++ b/lib/scm/scm.class.php @@ -14,8 +14,9 @@ class scm { $className = $repo->SCM; if($className == 'Git') $className = 'GitRepo'; + $client = strpos($repo->client, ' ') ? str_replace(' ', '" "', $repo->client) : $repo->client; if(!class_exists($className)) require(strtolower($className) . '.class.php'); - $this->engine = new $className($repo->client, $repo->path, $repo->account, $repo->password, $repo->encoding); + $this->engine = new $className($client, $repo->path, $repo->account, $repo->password, $repo->encoding); } /** diff --git a/module/block/view/waterfallprogressblock.html.php b/module/block/view/waterfallprogressblock.html.php index a8ac1803e3..39441b481a 100644 --- a/module/block/view/waterfallprogressblock.html.php +++ b/module/block/view/waterfallprogressblock.html.php @@ -1,126 +1,125 @@
- -
-
-
- + +
block->emptyTip;?>
+ + +
+
+
+ +
+
+
project->workHour})";?>
+
+ PV + EV + AC
-
project->workHour})";?>
-
- PV - EV - AC -
-
- - + setTimeout(renderChart, betterWidth > 200 ? 100 : 10); + } + initMilestoneChart(); + +
diff --git a/module/bug/model.php b/module/bug/model.php index 1c058874f7..90dea07ab5 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -106,10 +106,18 @@ class bugModel extends model */ public function create($from = '') { - /* Delete template HTML tags, line breaks and spaces and tags in the steps. */ - $stepTemplate = strip_tags($this->lang->bug->tplStep . $this->lang->bug->tplResult . $this->lang->bug->tplExpect); - $steps = strip_tags(preg_replace("/\s/", "", $this->post->steps)); - $steps = str_replace(" ", "", $steps); + /* Delete HTML tags, line breaks, and spaces in templates and steps. */ + if($this->post->templateID) + { + $stepsTemplate = strip_tags($this->dao->select('content')->from(TABLE_USERTPL)->where('id')->eq($this->post->templateID)->fetch('content')); + $stepsTemplate = preg_replace("/\s/", "", $stepsTemplate); + } + else + { + $stepsTemplate = strip_tags($this->lang->bug->tplStep . $this->lang->bug->tplResult . $this->lang->bug->tplExpect); + } + $steps = strip_tags(preg_replace("/\s/", "", $this->post->steps)); + $steps = str_replace(" ", "", $steps); $now = helper::now(); $bug = fixer::input('post') @@ -123,7 +131,7 @@ class bugModel extends model ->setIF($this->post->assignedTo != '', 'assignedDate', $now) ->setIF($this->post->story != false, 'storyVersion', $this->loadModel('story')->getVersion($this->post->story)) ->setIF(strpos($this->config->bug->create->requiredFields, 'project') !== false, 'project', $this->post->project) - ->setIF($steps == $stepTemplate, 'steps', '') + ->setIF($steps == $stepsTemplate, 'steps', '') ->stripTags($this->config->bug->editor->create['id'], $this->config->allowedTags) ->cleanInt('product,project,module,severity') ->join('openedBuild', ',') diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index 7450eb4f50..c41d99241a 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -219,9 +219,10 @@ js::set('flow', $config->global->flow); bug->steps;?> - + fetch('user', 'ajaxPrintTemplates', 'type=bug&link=steps');?> +
'; echo '
  • ' . $this->lang->recent . '
  • '; - $recentProjects = $this->dao->select('id,code')->from(TABLE_PROJECT) - ->where('type')->eq('project') + $recentProjects = $this->dao->select('id,parent,name')->from(TABLE_PROJECT) + ->where('type')->in('stage,sprint') ->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi() ->andWhere('status')->ne('close') ->andWhere('deleted')->eq('0') @@ -555,7 +555,10 @@ class commonModel extends model if(!empty($recentProjects)) { - foreach($recentProjects as $project) echo '
  • ' . html::a(helper::createLink('project', 'view', 'projectID=' . $project->id), $project->code) . '
  • '; + foreach($recentProjects as $project) + { + echo '
  • ' . html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->parent), $project->name, '', "class='text-ellipsis' title='$project->name'") . '
  • '; + } if(count($recentProjects) >= 5) echo '
  • ' . $this->lang->more . '
  • '; } diff --git a/module/common/view/header.html.php b/module/common/view/header.html.php index b86545ca5d..81931a2ba9 100755 --- a/module/common/view/header.html.php +++ b/module/common/view/header.html.php @@ -80,6 +80,12 @@ $("#searchInput").mouseout(function() $("#showSearchGo").show(); } }); + +$("#menuToggle").bind('click', function() +{ + $("#morePRJ").hide(); +}); + function getMorePRJ() { $("#morePRJ").toggle(); @@ -92,7 +98,6 @@ function getMorePRJ() type: 'post', success: function(data) { - console.log(data); $("#morePRJList").html(data); } }) diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index 70883c26e9..81b39b3dcc 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -159,6 +159,7 @@ $lang->todo->methodOrder[80] = 'batchClose'; /* Program. */ $lang->resource->program = new stdclass(); +$lang->resource->program->createGuide = 'createGuide'; $lang->resource->program->PGMIndex = 'PGMIndex'; $lang->resource->program->PGMBrowse = 'PGMBrowse'; $lang->resource->program->PGMProduct = 'PGMProduct'; @@ -197,6 +198,7 @@ $lang->resource->program->PRJClose = 'PRJClose'; $lang->resource->program->PRJActivate = 'PRJActivate'; $lang->resource->program->PRJDelete = 'PRJDelete'; +$lang->program->methodOrder[0] = 'createGuide'; $lang->program->methodOrder[5] = 'PGMIndex'; $lang->program->methodOrder[10] = 'PGMBrowse'; $lang->program->methodOrder[15] = 'PGMProduct'; diff --git a/module/product/control.php b/module/product/control.php index ea4bf92f46..d335963e7d 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -371,6 +371,7 @@ class product extends control */ public function batchEdit($productID = 0) { + $this->lang->product->switcherMenu = $this->product->getSwitcher(); if($this->post->names) { $allChanges = $this->product->batchUpdate(); @@ -384,6 +385,7 @@ class product extends control $this->action->logHistory($actionID, $changes); } } + die(js::locate($this->session->productList, 'parent')); } @@ -493,6 +495,7 @@ class product extends control $this->view->title = $product->name . $this->lang->colon . $this->lang->product->view; $this->view->position[] = html::a($this->createLink($this->moduleName, 'browse'), $product->name); $this->view->position[] = $this->lang->product->view; + $this->view->product = $product; $this->view->actions = $this->loadModel('action')->getList('product', $productID); $this->view->users = $this->user->getPairs('noletter'); @@ -759,12 +762,14 @@ class product extends control { $this->loadModel('program'); $this->lang->product->switcherMenu = $this->product->getSwitcher(); + $this->session->set('productList', $this->app->getURI(true)); /* Load pager and get tasks. */ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); $program = $programID ? $this->program->getPGMByID($programID) : 0; + $programName = empty($program) ? '' : $program->name; $this->view->title = $this->lang->product->common; $this->view->position[] = $this->lang->product->common; @@ -775,7 +780,9 @@ class product extends control $this->view->programTree = $this->program->getPGMTreeMenu($programID, 'product', '&browseType=' . $browseType); $this->view->programID = $programID; $this->view->program = $program; + $this->view->programName = $programName; $this->view->browseType = $browseType; + $this->display(); } diff --git a/module/product/model.php b/module/product/model.php index a935fed6ac..0b34fce3b0 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -953,8 +953,9 @@ class productModel extends model $products = $this->getList($programID, $status, $limit = 0, $line); if(empty($products)) return array(); + $productKeys = array_keys($products); $products = $this->dao->select('*')->from(TABLE_PRODUCT) - ->where('id')->in(array_keys($products)) + ->where('id')->in($productKeys) ->orderBy($orderBy) ->page($pager) ->fetchAll('id'); @@ -963,13 +964,13 @@ class productModel extends model ->from(TABLE_STORY) ->where('deleted')->eq(0) ->andWhere('type')->eq($storyType) - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->groupBy('product, status') ->fetchGroup('product', 'status'); /* Padding the stories to sure all products have records. */ $emptyStory = array_keys($this->lang->story->statusList); - foreach(array_keys($products) as $productID) + foreach($productKeys as $productID) { if(!isset($stories[$productID])) $stories[$productID] = $emptyStory; } @@ -987,7 +988,7 @@ class productModel extends model $plans = $this->dao->select('product, count(*) AS count') ->from(TABLE_PRODUCTPLAN) ->where('deleted')->eq(0) - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->andWhere('end')->gt(helper::now()) ->groupBy('product') ->fetchPairs(); @@ -995,14 +996,14 @@ class productModel extends model $releases = $this->dao->select('product, count(*) AS count') ->from(TABLE_RELEASE) ->where('deleted')->eq(0) - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->groupBy('product') ->fetchPairs(); $bugs = $this->dao->select('product,count(*) AS conut') ->from(TABLE_BUG) ->where('deleted')->eq(0) - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->groupBy('product') ->fetchPairs(); @@ -1010,7 +1011,7 @@ class productModel extends model ->from(TABLE_BUG) ->where('deleted')->eq(0) ->andwhere('status')->eq('active') - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->groupBy('product') ->fetchPairs(); @@ -1018,10 +1019,22 @@ class productModel extends model ->from(TABLE_BUG) ->where('deleted')->eq(0) ->andwhere('assignedTo')->eq('') - ->andWhere('product')->in(array_keys($products)) + ->andWhere('product')->in($productKeys) ->groupBy('product') ->fetchPairs(); + if(empty($programID)) + { + $programKeys = array(0=>0); + foreach($products as $product) $programKeys[] = $product->program; + $programs = $this->dao->select('id,name')->from(TABLE_PROGRAM) + ->where('id')->in(array_unique($programKeys)) + ->andWhere('deleted')->eq('0') + ->fetchPairs(); + + foreach($products as $product) $product->programName = isset($programs[$product->program]) ? $programs[$product->program] : ''; + } + $stats = array(); foreach($products as $key => $product) { diff --git a/module/product/view/all.html.php b/module/product/view/all.html.php index de45e1c88d..9a1ac671bf 100644 --- a/module/product/view/all.html.php +++ b/module/product/view/all.html.php @@ -51,14 +51,15 @@ idAB);?> product->name);?> - product->activeStories;?> - product->changedStories;?> - product->draftStories;?> - product->closedStories;?> + program->PGMCommon;?> + product->activeStories;?> + product->changedStories;?> + product->draftStories;?> + product->closedStories;?> product->plans;?> product->releases;?> product->unResolvedBugs;?> - product->assignToNullBugs;?> + product->assignToNullBugs;?> product->updateOrder);?> @@ -75,6 +76,7 @@ createLink('product', 'browse', 'product=' . $product->id), $product->name);?> + programName : $programName;?> stories['active'];?> stories['changed'];?> stories['draft'];?> diff --git a/module/program/control.php b/module/program/control.php index 4bfbfffb47..364354e8d9 100644 --- a/module/program/control.php +++ b/module/program/control.php @@ -609,6 +609,8 @@ class program extends control $this->lang->program->switcherMenu = $this->program->getPGMCommonAction() . $this->program->getPGMSwitcher($programID); $this->program->setPGMViewMenu($programID); + $this->app->session->set('PRJBrowse', $this->app->getURI(true)); + /* Load pager and get tasks. */ $this->app->loadClass('pager', $static = true); $pager = new pager($recTotal, $recPerPage, $pageID); @@ -752,10 +754,13 @@ class program extends control */ public function ajaxGetRecentProjects() { - $recentProjects = $this->program->getPRJParams(0, 15); + $recentProjects = $this->program->getPRJRecent(); if(!empty($recentProjects)) { - foreach($recentProjects as $project) echo html::a(helper::createLink('project', 'view', 'projectID=' . $project->id), '' . $project->name); + foreach($recentProjects as $project) + { + echo html::a(helper::createLink('project', 'task', 'projectID=' . $project->id, '', false, $project->parent), '' . $project->name, '', "class='text-ellipsis' title='$project->name'"); + } } } @@ -964,7 +969,6 @@ class program extends control public function PRJGroup($projectID = 0, $programID = 0) { $this->lang->navGroup->program = 'project'; - $this->session->set('PRJ', $projectID); $title = $this->lang->company->orgView . $this->lang->colon . $this->lang->group->browse; $position[] = $this->lang->group->browse; @@ -972,12 +976,15 @@ class program extends control $groupUsers = array(); foreach($groups as $group) $groupUsers[$group->id] = $this->group->getUserPairs($group->id); + $goback = $this->session->PRJBrowse ? $this->session->PRJBrowse : inLink('PRJBrowse', "programID=$programID"); + $this->view->title = $title; $this->view->position = $position; $this->view->groups = $groups; $this->view->projectID = $projectID; $this->view->programID = $programID; $this->view->groupUsers = $groupUsers; + $this->view->goback = $goback; $this->display(); } @@ -993,7 +1000,6 @@ class program extends control public function PRJCreateGroup($projectID = 0, $programID = 0) { $this->lang->navGroup->program = 'project'; - $this->session->set('PRJ', $projectID); if(!empty($_POST)) { @@ -1020,7 +1026,6 @@ class program extends control public function PRJManageView($groupID, $projectID, $programID) { $this->lang->navGroup->program = 'project'; - $this->session->set('PRJ', $projectID); if($_POST) { @@ -1120,7 +1125,6 @@ class program extends control public function PRJManageMembers($projectID, $dept = '') { $this->lang->navGroup->program = 'project'; - $this->session->set('PRJ', $projectID); if(!empty($_POST)) { @@ -1169,6 +1173,7 @@ class program extends control if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('group', 'browse'), 'parent')); } + $group = $this->group->getById($groupID); $groupUsers = $this->group->getUserPairs($groupID); $allUsers = $this->loadModel('dept')->getDeptUserPairs($deptID); @@ -1390,7 +1395,7 @@ class program extends control * @access public * @return void */ - public function PRJDelete($projectID, $confirm = 'no', $from = 'PRJ', $programID = 0) + public function PRJDelete($projectID, $confirm = 'no') { if($confirm == 'no') { @@ -1405,8 +1410,8 @@ class program extends control $this->project->updateUserView($projectID); $this->session->set('project', ''); - $link = $from == 'PRJ' ? inLink('PRJBrowse', 'programID=' . $programID) : inLink('PGMProject', 'programID=' . $programID); - die(js::locate($link, 'parent')); + $url = $this->session->PRJBrowse ? $this->session->PRJBrowse : inLink('PRJBrowse'); + die(js::locate($url, 'parent')); } } diff --git a/module/program/lang/zh-cn.php b/module/program/lang/zh-cn.php index dc3338f466..7a70f1b027 100644 --- a/module/program/lang/zh-cn.php +++ b/module/program/lang/zh-cn.php @@ -1,9 +1,9 @@ program->createGuide = '选择项目模板'; $lang->program->PRJIndex = '项目仪表盘'; $lang->program->PRJHome = '项目主页'; $lang->program->PRJCreate = '创建项目'; -$lang->program->PRJCreateGuide = '选择项目模板'; $lang->program->PRJEdit = '编辑项目'; $lang->program->PRJBatchEdit = '批量编辑'; $lang->program->PRJBrowse = '项目列表'; diff --git a/module/program/model.php b/module/program/model.php index 04dc9f606c..0202873aa3 100644 --- a/module/program/model.php +++ b/module/program/model.php @@ -393,7 +393,7 @@ class programModel extends model */ public function getPGMCommonAction($programID = 0) { - $output = "
    "; + $output = "
    "; $output .= '