diff --git a/db/update15.0.sql b/db/update15.0.sql index ef9bf17f8b..bc1ae2b0ba 100644 --- a/db/update15.0.sql +++ b/db/update15.0.sql @@ -23,6 +23,7 @@ ALTER TABLE `zt_story` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_repo` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_bug` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_case` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; +ALTER TABLE `zt_testtask` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_testreport` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_testsuite` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; ALTER TABLE `zt_build` ADD `program` mediumint(8) unsigned NOT NULL AFTER `id`; diff --git a/framework/base/control.class.php b/framework/base/control.class.php index 1d0ba4df6b..522f4071dc 100644 --- a/framework/base/control.class.php +++ b/framework/base/control.class.php @@ -926,10 +926,10 @@ class baseControl * @access public * @return string the link string. */ - public function createLink($moduleName, $methodName = 'index', $vars = array(), $viewType = '', $onlybody = false) + public function createLink($moduleName, $methodName = 'index', $vars = array(), $viewType = '', $onlybody = false, $programID = 0) { if(empty($moduleName)) $moduleName = $this->moduleName; - return helper::createLink($moduleName, $methodName, $vars, $viewType, $onlybody); + return helper::createLink($moduleName, $methodName, $vars, $viewType, $onlybody, $programID); } /** diff --git a/framework/base/helper.class.php b/framework/base/helper.class.php index 02c7a5861b..efee96515c 100644 --- a/framework/base/helper.class.php +++ b/framework/base/helper.class.php @@ -60,10 +60,11 @@ class baseHelper * @access public * @return string the link string. */ - static public function createLink($moduleName, $methodName = 'index', $vars = '', $viewType = '', $onlyBody = false) + static public function createLink($moduleName, $methodName = 'index', $vars = '', $viewType = '', $onlyBody = false, $programID = 0) { /* 设置$appName和$moduleName。Set appName and moduleName. */ global $app, $config; + $programID = $programID ? $programID : $app->session->program; if(strpos($moduleName, '.') !== false) { list($appName, $moduleName) = explode('.', $moduleName); @@ -93,7 +94,9 @@ class baseHelper $link .= "?{$config->moduleVar}=$moduleName&{$config->methodVar}=$methodName"; if($viewType != 'html') $link .= "&{$config->viewVar}=" . $viewType; foreach($vars as $key => $value) $link .= "&$key=$value"; - return self::processOnlyBodyParam($link, $onlyBody); + + $link = self::processOnlyBodyParam($link, $onlyBody); + return self::processProgramParam($link, $programID, $onlyBody); } /** @@ -108,7 +111,8 @@ class baseHelper foreach($vars as $value) $link .= "{$config->requestFix}$value"; $link .= '.' . $viewType; - return self::processOnlyBodyParam($link, $onlyBody); + $link = self::processOnlyBodyParam($link, $onlyBody); + return self::processProgramParam($link, $programID, $onlyBody); } /** @@ -119,7 +123,8 @@ class baseHelper if($moduleName == $config->default->module) { $link .= $config->default->method . '.' . $viewType; - return self::processOnlyBodyParam($link, $onlyBody); + $link = self::processOnlyBodyParam($link, $onlyBody); + return self::processProgramParam($link, $programID, $onlyBody); } /** @@ -130,7 +135,8 @@ class baseHelper if($viewType == $app->getViewType()) { $link .= $moduleName . '/'; - return self::processOnlyBodyParam($link, $onlyBody); + $link = self::processOnlyBodyParam($link, $onlyBody); + return self::processProgramParam($link, $programID, $onlyBody); } /** @@ -139,7 +145,38 @@ class baseHelper * */ $link .= $moduleName . '.' . $viewType; - return self::processOnlyBodyParam($link, $onlyBody); + $link = self::processOnlyBodyParam($link, $onlyBody); + return self::processProgramParam($link, $programID, $onlyBody); + } + + /** + * 处理program 参数。 + * Process the programID param in url. + * + * 如果传参的时候设定了$programID,在生成链接的时候继续追加。 + * If $progrmID in the url, append it to the link. + * + * @param string $link + * @param int $programID + * @param bool $onlybody + * @static + * @access public + * @return string + */ + public static function processProgramParam($link, $programID = '', $onlybody = false) + { + global $config; + if(!$programID) return $link; + if($onlybody) + { + $link .= $config->requestType != 'GET' ? "&pgmID=$programID" : "&pgmID=$programID"; + } + else + { + $link .= $config->requestType != 'GET' ? "?pgmID=$programID" : "&pgmID=$programID"; + } + + return $link; } /** diff --git a/framework/base/router.class.php b/framework/base/router.class.php index 2b8604b88b..c6a1bb60b9 100644 --- a/framework/base/router.class.php +++ b/framework/base/router.class.php @@ -1788,6 +1788,7 @@ class baseRouter global $filter; /* Remove these two params. */ + unset($passedParams['pgmID']); unset($passedParams['onlybody']); unset($passedParams['HTTP_X_REQUESTED_WITH']); diff --git a/framework/router.class.php b/framework/router.class.php index eeaa073339..f5e4319b8e 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -483,6 +483,7 @@ class router extends baseRouter */ public function mergeParams($defaultParams, $passedParams) { + if(isset($_GET['pgmID'])) $this->session->set('program', $_GET['pgmID']); /* If the isFlow is true, reset the passed params. */ if($this->isFlow) { diff --git a/module/common/lang/zh-cn.php b/module/common/lang/zh-cn.php index dc5772e6df..641dbf74f6 100644 --- a/module/common/lang/zh-cn.php +++ b/module/common/lang/zh-cn.php @@ -1174,7 +1174,7 @@ $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|', 'alias' => 'create,edit,batchcreate,view'); +$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; diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index fa32fa4fd5..fd53d0c609 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -78,6 +78,7 @@ $lang->resource->my->bug = 'bug'; $lang->resource->my->testTask = 'testTask'; $lang->resource->my->testCase = 'testCase'; $lang->resource->my->story = 'story'; +$lang->resource->my->program = 'program'; $lang->resource->my->project = 'myProject'; $lang->resource->my->profile = 'profile'; $lang->resource->my->dynamic = 'dynamic'; @@ -96,15 +97,16 @@ $lang->my->methodOrder[20] = 'testTask'; $lang->my->methodOrder[25] = 'testCase'; $lang->my->methodOrder[30] = 'story'; $lang->my->methodOrder[35] = 'requirement'; -$lang->my->methodOrder[40] = 'project'; -$lang->my->methodOrder[45] = 'profile'; -$lang->my->methodOrder[50] = 'dynamic'; -$lang->my->methodOrder[55] = 'editProfile'; -$lang->my->methodOrder[60] = 'changePassword'; -$lang->my->methodOrder[65] = 'unbind'; -$lang->my->methodOrder[70] = 'manageContacts'; -$lang->my->methodOrder[75] = 'deleteContacts'; -$lang->my->methodOrder[80] = 'score'; +$lang->my->methodOrder[40] = 'program'; +$lang->my->methodOrder[45] = 'project'; +$lang->my->methodOrder[50] = 'profile'; +$lang->my->methodOrder[55] = 'dynamic'; +$lang->my->methodOrder[60] = 'editProfile'; +$lang->my->methodOrder[65] = 'changePassword'; +$lang->my->methodOrder[70] = 'unbind'; +$lang->my->methodOrder[75] = 'manageContacts'; +$lang->my->methodOrder[80] = 'deleteContacts'; +$lang->my->methodOrder[85] = 'score'; /* Todo. */ $lang->resource->todo = new stdclass(); diff --git a/module/my/control.php b/module/my/control.php index 149c05d751..bea8f4ace9 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -393,6 +393,30 @@ class my extends control $this->display(); } + /** + * My programs. + * + * @param int $recTotal + * @param varchar $date + * @param varchar $direction + * @access public + * @return void + */ + public function program($recTotal = 0, $date = '', $direction = 'next') + { + $this->app->loadLang('program'); + $this->app->loadLang('project'); + + /* Set the pager. */ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage = 50, $pageID = 1); + + $this->view->position[] = $this->lang->my->myProgram; + $this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->myProgram; + $this->view->programs = $this->loadModel('program')->getList($status = 'all', $orderBy = 'id_desc', $pager); + $this->display(); + } + /** * Edit profile * diff --git a/module/my/lang/en.php b/module/my/lang/en.php index 3361c15e74..b2e7627472 100644 --- a/module/my/lang/en.php +++ b/module/my/lang/en.php @@ -11,6 +11,9 @@ $lang->my->testTask = 'My Builds'; $lang->my->testCase = 'My Cases'; $lang->my->story = 'My Stories'; $lang->my->requirement = 'My Requirements'; +$lang->my->program = 'My Programs'; +$lang->my->myProgram = "My Programs"; +$lang->my->createProgram = 'Create Program'; $lang->my->myProject = "My {$lang->projectCommon}s"; $lang->my->profile = 'My Profile'; $lang->my->dynamic = 'My Dynamics'; diff --git a/module/my/lang/zh-cn.php b/module/my/lang/zh-cn.php index 2c7915a1cb..5653fd1ed3 100644 --- a/module/my/lang/zh-cn.php +++ b/module/my/lang/zh-cn.php @@ -11,6 +11,9 @@ $lang->my->testTask = '我的版本'; $lang->my->testCase = '我的用例'; $lang->my->story = "我的{$lang->storyCommon}"; $lang->my->requirement = "我的用户{$lang->storyCommon}"; +$lang->my->program = '我的项目'; +$lang->my->myProgram = "我的项目"; +$lang->my->createProgram = '添加项目'; $lang->my->myProject = "我的{$lang->projectCommon}"; $lang->my->profile = '我的档案'; $lang->my->dynamic = '我的动态'; diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index 56631222a1..9aec507a60 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -85,7 +85,7 @@ pri?>' title='bug->priList, $bug->pri);?>'>bug->priList, $bug->pri)?> bug->typeList, $bug->type, '');?> - createLink('bug', 'view', "bugID=$bug->id"), $bug->title, null, "style='color: $bug->color' title={$bug->title}");?> + createLink('bug', 'view', "bugID=$bug->id", '', '', $bug->program), $bug->title, null, "style='color: $bug->color' title={$bug->title}");?> openedBy);?> bug->printAssignedHtml($bug, $users);?> resolvedBy);?> diff --git a/module/my/view/program.html.php b/module/my/view/program.html.php new file mode 100644 index 0000000000..4e8c56317c --- /dev/null +++ b/module/my/view/program.html.php @@ -0,0 +1,64 @@ + + * @package dashboard + * @version $Id: project.html.php 5095 2013-07-11 06:03:40Z chencongzhi520@gmail.com $ + * @link http://www.zentao.net + */ +?> + + +
+ +
+

+ program->noProgram;?> + + createLink('program', 'create'), " " . $lang->my->createProgram, '', "class='btn btn-info'");?> + +

+
+ + + + + + + + + + + + + + + createLink('program', 'transfer', "program=$project->id");?> + + + + + + + + + + +
idAB;?>program->code;?>program->name;?>program->begin;?>program->end;?>statusAB;?>
id);?>code;?>name);?>begin;?>end;?> + delay)):?> + project->delayed;?> + + processStatus('project', $project);?> + + +
+ +
+ diff --git a/module/my/view/project.html.php b/module/my/view/project.html.php index 8cb0a02366..c883c0492f 100644 --- a/module/my/view/project.html.php +++ b/module/my/view/project.html.php @@ -46,7 +46,7 @@ - createLink('project', 'browse', "projectID=$project->id");?> + createLink('project', 'browse', "projectID=$project->id", '', '', $project->program);?> id);?> code;?> diff --git a/module/my/view/requirement.html.php b/module/my/view/requirement.html.php index bffe3e0ffa..1ce43091e5 100644 --- a/module/my/view/requirement.html.php +++ b/module/my/view/requirement.html.php @@ -57,7 +57,7 @@ - createLink('story', 'view', "id=$story->id");?> + createLink('story', 'view', "id=$story->id", '', '', $story->program);?> diff --git a/module/my/view/story.html.php b/module/my/view/story.html.php index a9a81570e2..24cdb8be39 100644 --- a/module/my/view/story.html.php +++ b/module/my/view/story.html.php @@ -58,7 +58,7 @@ - createLink('story', 'view', "id=$story->id");?> + createLink('story', 'view', "id=$story->id", '', '', $story->program);?> diff --git a/module/my/view/task.html.php b/module/my/view/task.html.php index 8989ae4ee1..e4aa5119c2 100644 --- a/module/my/view/task.html.php +++ b/module/my/view/task.html.php @@ -70,7 +70,7 @@ id);?> pri;?>' title='task->priList, $task->pri);?>'>task->priList, $task->pri);?> - createLink('project', 'browse', "projectid=$task->projectID"), $task->projectName);?> + createLink('project', 'browse', "projectid=$task->projectID", '', '', $task->program), $task->projectName);?> team)) echo '' . $this->lang->task->multipleAB . ' ';?> parent > 0) echo '' . $this->lang->task->childrenAB . ' ';?> diff --git a/module/my/view/testtask.html.php b/module/my/view/testtask.html.php index 01771a8aaf..f3e115d26e 100644 --- a/module/my/view/testtask.html.php +++ b/module/my/view/testtask.html.php @@ -50,7 +50,7 @@ id);?> - createLink('testtask', 'view', "taskID=$task->id"), $task->name);?> + createLink('testtask', 'view', "taskID=$task->id", '', '', $task->program), $task->name);?> projectName?> build == 'trunk' ? print($lang->trunk) : print(html::a($this->createLink('build', 'view', "buildID=$task->build"), $task->buildName));?> begin?> diff --git a/module/testtask/model.php b/module/testtask/model.php index cff010de4c..dc4c4748b2 100644 --- a/module/testtask/model.php +++ b/module/testtask/model.php @@ -196,6 +196,7 @@ class testtaskModel extends model { $task = fixer::input('post') ->setDefault('build', '') + ->setDefault('program', $this->session->program) ->stripTags($this->config->testtask->editor->create['id'], $this->config->allowedTags) ->join('mailto', ',') ->remove('uid,contactListMenu')