From 8dbd0ef594a24f205ea2118a4f5133e28eacb0f4 Mon Sep 17 00:00:00 2001 From: wangchunsheng Date: Tue, 27 Oct 2009 07:34:58 +0000 Subject: [PATCH] * adjust the feature of project view. --- trunk/module/project/control.php | 170 ++++++++++++++---- trunk/module/project/view/bug.html.php | 92 ++++++++++ trunk/module/project/view/create.html.php | 5 +- trunk/module/project/view/edit.html.php | 9 +- .../project/view/manageproducts.html.php | 4 +- trunk/module/project/view/project.html.php | 108 +++++++++++ trunk/module/project/view/story.html.php | 109 +++++++---- trunk/module/project/view/tabbar.html.php | 14 ++ trunk/module/project/view/task.html.php | 117 ++++++++---- 9 files changed, 515 insertions(+), 113 deletions(-) create mode 100644 trunk/module/project/view/project.html.php create mode 100644 trunk/module/project/view/tabbar.html.php diff --git a/trunk/module/project/control.php b/trunk/module/project/control.php index e5306cc803..9dd00e80d8 100644 --- a/trunk/module/project/control.php +++ b/trunk/module/project/control.php @@ -29,54 +29,146 @@ class project extends control public function __construct() { parent::__construct(); - $this->loadModel('product'); - $this->loadModel('task'); - $this->loadModel('story'); $this->projects = $this->project->getPairs(); - if(empty($this->projects)) $this->locate($this->createLink('project', 'create')); } /* 项目视图首页,暂时跳转到浏览页面。*/ public function index() { - $this->locate($this->createLink($this->moduleName, 'browse')); + if(empty($this->projects)) $this->locate($this->createLink('project', 'create')); + $this->locate($this->createLink($this->moduleName, 'task')); } /* 浏览某一个项目。*/ - public function browse($projectID = 0, $tabID = 'task') + public function browse($projectID = 0) { + $this->locate($this->createLink($this->moduleName, 'task', "productID=$projectID")); + } + + /* task, story, bug等方法的一些公共操作。*/ + private function commonAction($projectID = 0) + { + /* 加载product模块。*/ + $this->loadModel('product'); + /* 获取当前项目的详细信息,相关产品,子项目以及团队成员。*/ - $projectID = common::saveProjectState($projectID, key($this->projects)); - $project = $this->project->getById($projectID); + $projectID = common::saveProjectState($projectID, array_keys($this->projects)); + $project = $this->project->findByID($projectID); $products = $this->project->getProducts($project->id); $childProjects = $this->project->getChildProjects($project->id); $teamMembers = $this->project->getTeamMembers($project->id); - /* 设定header和position信息。*/ - $header['title'] = $this->lang->project->browse . $this->lang->colon . $project->name; - $position[] = $project->name; - - /* 赋值。*/ - $this->assign('header', $header); - $this->assign('position', $position); + /* 将其赋值到模板系统。*/ $this->assign('projects', $this->projects); $this->assign('project', $project); $this->assign('childProjects', $childProjects); $this->assign('products', $products); $this->assign('teamMembers', $teamMembers); - $this->assign('tabID', $tabID); - /* 处理Tab。*/ - if($tabID == 'task') - { - $tasks = $this->task->getProjectTasks($projectID); - $this->assign('tasks', $tasks); - } - elseif($tabID == 'story') - { - $stories = $this->story->getProjectStories($projectID); - $this->assign('stories', $stories); - } + return $project; + } + + /* 浏览某一个项目下面的任务。*/ + public function task($projectID = 0, $orderBy = 'status|desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) + { + /* 加载任务模块。*/ + $this->loadModel('task'); + + /* 公共的操作。*/ + $project = $this->commonAction($projectID); + $projectID = $project->id; + + /* 记录用户当前选择的列表。*/ + $this->app->session->set('taskList', $this->app->getURI(true)); + $this->app->session->set('storyList', $this->app->getURI(true)); + + /* 设定header和position信息。*/ + $header['title'] = $project->name . $this->lang->colon . $this->lang->project->tasks; + $position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $position[] = $this->lang->project->tasks; + + /* 分页操作。*/ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $tasks = $this->task->getProjectTasks($projectID, $orderBy, $pager); + + /* 赋值。*/ + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('tasks', $tasks); + $this->assign('tabID', 'task'); + $this->assign('pager', $pager->get()); + $this->assign('orderBy', $orderBy); + + $this->display(); + } + + /* 浏览某一个项目下面的需求。*/ + public function story($projectID = 0, $orderBy = 'status|desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) + { + /* 加载story, user模块,加载task模块的语言。*/ + $this->loadModel('story'); + $this->loadModel('user'); + $this->app->loadLang('task'); + + /* 记录用户当前选择的列表。*/ + $this->app->session->set('storyList', $this->app->getURI(true)); + + /* 公共的操作。*/ + $project = $this->commonAction($projectID); + + /* 设定header和position信息。*/ + $header['title'] = $project->name . $this->lang->colon . $this->lang->project->stories; + $position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $position[] = $this->lang->project->stories; + + /* 分页操作。*/ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $stories = $this->story->getProjectStories($projectID, $orderBy, $pager); + $users = array('' => '') + $this->user->getRealNames($this->story->extractAccountsFromList($stories)); + + /* 赋值。*/ + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('stories', $stories); + $this->assign('tabID', 'story'); + $this->assign('pager', $pager->get()); + $this->assign('orderBy', $orderBy); + $this->assign('users', $users); + + $this->display(); + } + + /* 浏览某一个项目下面的bug。*/ + public function bug($projectID = 0, $orderBy = 'status|desc', $recTotal = 0, $recPerPage = 15, $pageID = 1) + { + /* 加载bug和user模块。*/ + $this->loadModel('bug'); + $this->loadModel('user'); + + /* 公共的操作。*/ + $project = $this->commonAction($projectID); + + /* 设定header和position信息。*/ + $header['title'] = $project->name . $this->lang->colon . $this->lang->project->bugs; + $position[] = html::a($this->createLink('project', 'browse', "projectID=$projectID"), $project->name); + $position[] = $this->lang->project->bugs; + + /* 分页操作。*/ + $this->app->loadClass('pager', $static = true); + $pager = new pager($recTotal, $recPerPage, $pageID); + $bugs = $this->bug->getProjectBugs($projectID, $orderBy, $pager); + $users = array('' => '') + $this->user->getRealNames($this->bug->extractAccountsFromList($bugs)); + + /* 赋值。*/ + $this->assign('header', $header); + $this->assign('position', $position); + $this->assign('bugs', $bugs); + $this->assign('tabID', 'bug'); + $this->assign('pager', $pager->get()); + $this->assign('orderBy', $orderBy); + $this->assign('users', $users); $this->display(); } @@ -86,9 +178,11 @@ class project extends control { if(!empty($_POST)) { - $projectID = $this->project->create($_POST); - $this->locate($this->createLink('project', 'browse', "projectID=$projectID")); + $projectID = $this->project->create(); + if(dao::isError()) die(js::error(dao::getError())); + die(js::locate($this->createLink('project', 'browse', "projectID=$projectID"), 'parent')); } + $header['title'] = $this->lang->project->create; $position[] = $header['title']; $projects = array('' => '') + $this->projects; @@ -106,10 +200,11 @@ class project extends control if(!empty($_POST)) { $this->project->update($projectID); + if(dao::isError()) die(js::error(dao::getError())); die(js::locate($browseProjectLink, 'parent')); } $projects = array('' => '') + $this->projects; - $project = $this->project->getById($projectID); + $project = $this->project->findById($projectID); /* 从列表中删除当前项目。*/ unset($projects[$projectID]); @@ -151,9 +246,12 @@ class project extends control if(!empty($_POST)) { $this->project->updateProducts($projectID); + if(dao::isError()) dis(js::error(dao::getError())); die(js::locate($browseProjectLink)); } - $project = $this->project->getById($projectID); + + $this->loadModel('product'); + $project = $this->project->findById($projectID); /* 标题和位置信息。*/ $header['title'] = $this->lang->project->manageProducts . $this->lang->colon . $project->name; @@ -182,7 +280,7 @@ class project extends control $this->project->updateChilds($projectID); die(js::locate($browseProjectLink)); } - $project = $this->project->getById($projectID); + $project = $this->project->findById($projectID); $projects = $this->projects; unset($projects[$projectID]); unset($projects[$project->parent]); @@ -217,7 +315,7 @@ class project extends control } $this->loadModel('user'); - $project = $this->project->getById($projectID); + $project = $this->project->findById($projectID); $users = $this->user->getPairs($this->app->company->id); $users = array('' => '') + $users; $members = $this->project->getTeamMembers($projectID); @@ -254,9 +352,9 @@ class project extends control public function linkStory($projectID = 0) { /* 获得项目和相关产品信息。如果没有相关产品,则跳转到产品关联页面。*/ - $project = $this->project->getById($projectID); + $project = $this->project->findById($projectID); $products = $this->project->getProducts($projectID); - $browseLink = $this->createLink('project', 'browse', "projectID=$projectID&tab=story"); + $browseLink = $this->createLink('project', 'story', "projectID=$projectID"); if(empty($products)) { @@ -302,7 +400,7 @@ class project extends control else { $this->project->unlinkStory($projectID, $storyID); - echo js::locate($this->createLink('project', 'browse', "projectID=$projectID&tab=story"), 'parent'); + echo js::locate($this->app->session->storyList, 'parent'); exit; } } diff --git a/trunk/module/project/view/bug.html.php b/trunk/module/project/view/bug.html.php index e69de29bb2..721dfdedd3 100644 --- a/trunk/module/project/view/bug.html.php +++ b/trunk/module/project/view/bug.html.php @@ -0,0 +1,92 @@ +. + * + * @copyright Copyright: 2009 Chunsheng Wang + * @author Chunsheng Wang + * @package project + * @version $Id$ + * @link http://www.zentao.cn + */ +?> + + +
+
+
+
+
+ ' . html::a($this->createLink('bug', 'create', "productID=0&project=$project->id"), $lang->bug->create) . '
'; + $app->global->vars = "projectID=$project->id"; + $app->global->orderBy = $orderBy; + function printOrderLink($fieldName) + { + global $app, $lang; + if(strpos($app->global->orderBy, $fieldName) !== false) + { + if(stripos($app->global->orderBy, 'desc') !== false) $orderBy = str_replace('desc', 'asc', $app->global->orderBy); + if(stripos($app->global->orderBy, 'asc') !== false) $orderBy = str_replace('asc', 'desc', $app->global->orderBy); + } + else + { + $orderBy = $fieldName . '|' . 'asc'; + } + $link = helper::createLink('project', 'bug', $app->global->vars ."&orderBy=$orderBy"); + $fieldName = str_replace('`', '', $fieldName); + echo html::a($link, $lang->bug->$fieldName); + } + ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bug->id;?>bug->severity;?>bug->title;?>bug->openedBy;?>bug->assignedTo;?>bug->resolvedBy;?>bug->resolution;?>
createLink('bug', 'view', "bugID=$bug->id"), $bug->id);?>severity?>title;?>openedBy];?>assignedTo];?>resolvedBy];?>resolution;?>
+
+
+
+ + diff --git a/trunk/module/project/view/create.html.php b/trunk/module/project/view/create.html.php index c94c6e7e88..9c79d8476f 100644 --- a/trunk/module/project/view/create.html.php +++ b/trunk/module/project/view/create.html.php @@ -24,7 +24,7 @@ ?>
-
+ @@ -64,8 +64,7 @@
project->create;?>
- - +
diff --git a/trunk/module/project/view/edit.html.php b/trunk/module/project/view/edit.html.php index 5d24b7a142..39e1a5a5ee 100644 --- a/trunk/module/project/view/edit.html.php +++ b/trunk/module/project/view/edit.html.php @@ -55,18 +55,15 @@ project->goal;?> - + project->desc;?> - + - - - - +
diff --git a/trunk/module/project/view/manageproducts.html.php b/trunk/module/project/view/manageproducts.html.php index 497aead6c3..cf0fd4197a 100644 --- a/trunk/module/project/view/manageproducts.html.php +++ b/trunk/module/project/view/manageproducts.html.php @@ -25,7 +25,7 @@
- +
- +
project->manageProducts;?>
@@ -34,7 +34,7 @@ ?>
diff --git a/trunk/module/project/view/project.html.php b/trunk/module/project/view/project.html.php new file mode 100644 index 0000000000..d3ac0f3c8e --- /dev/null +++ b/trunk/module/project/view/project.html.php @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ project->selectProject;?> + id, 'onchange="selectProject(this.value);" style="width:200px"');?> +
project->name;?>name;?>
project->code;?>code;?>
project->begin;?>begin;?>
project->end;?>end;?>
project->goal;?>goal);?>
project->desc;?>desc);?>
+ createLink('project', 'edit', "projectID=$project->id"), $lang->project->edit); + if(common::hasPriv('project', 'delete')) echo html::a($this->createLink('project', 'delete', "projectID=$project->id"), $lang->project->delete, 'hiddenwin'); + //echo html::a($this->createLink('tree', 'browse', "productID=$productID&view=product"), $lang->tree->manage); + ?> +
+ + + + + +
+ project->products;?> +
+ $productName) echo html::a($this->createLink('product', 'browse', "productID=$productID"), $productName) . '
';?> +
+ createLink('project', 'manageproducts', "projectID=$project->id"), $lang->project->manageProducts); + if(common::hasPriv('project', 'linkstory')) echo html::a($this->createLink('project', 'linkstory', "projectID=$project->id"), $lang->project->linkStory); + ?> +
+
+ + + + + + + + + + $lang->action";?> + + + + + + + + + + " . html::a($this->createLink('project', 'unlinkmember', "projectID=$project->id&account=$member->account"), $lang->project->unlinkMember, 'hiddenwin') . '';?> + + + +
+ project->team . $lang->colon . $project->team; ?> +
team->account;?>team->role;?>team->joinDate;?>team->workingHour;?>
+ createLink('user', 'view', "account=$member->account"), $member->realname); + else echo $member->realname; + ?> + role;?>joinDate, 2);?>workingHour;?>
+
+ createLink('project', 'managemembers', "projectID=$project->id"), $lang->project->manageMembers) . '
';?> +
diff --git a/trunk/module/project/view/story.html.php b/trunk/module/project/view/story.html.php index 5cb1b36c91..81d15176bb 100644 --- a/trunk/module/project/view/story.html.php +++ b/trunk/module/project/view/story.html.php @@ -1,6 +1,6 @@ - * @package story + * @package project * @version $Id$ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - - - - - - - - - -
story->id;?>story->pri;?>story->title;?>story->spec;?>story->product;?>story->status;?>action;?>
id;?>pri;?>title;?>spec;?>createLink('product', 'browse', "product=$story->product"), $products[$story->product], '_blank');?>show($lang->story->statusList, $story->status);?> - createLink('task', 'create', "projectid=$project->id&storyid=$story->id"), $lang->task->create);?> - createLink('project', 'unlinkstory', "projectid=$project->id&storyid=$story->id"), $lang->project->unlinkStory, 'hiddenwin');?> -
+ + +
+
+
+
+
+ ' . html::a($this->createLink('project', 'linkstory', "project=$project->id"), $lang->project->linkStory) . '
'; + $app->global->vars = "projectID=$project->id"; + $app->global->orderBy = $orderBy; + function printOrderLink($fieldName) + { + global $app, $lang; + if(strpos($app->global->orderBy, $fieldName) !== false) + { + if(stripos($app->global->orderBy, 'desc') !== false) $orderBy = str_replace('desc', 'asc', $app->global->orderBy); + if(stripos($app->global->orderBy, 'asc') !== false) $orderBy = str_replace('asc', 'desc', $app->global->orderBy); + } + else + { + $orderBy = $fieldName . '|' . 'asc'; + } + $link = helper::createLink('project', 'story', $app->global->vars ."&orderBy=$orderBy"); + echo html::a($link, $lang->story->$fieldName); + } + ?> +
+ + + + + + + + + + + + + + + + $story):?> + createLink('story', 'view', "storyID=$story->id"); + $canView = common::hasPriv('story', 'view'); + ?> + + + + + + + + + + + + +
action;?>
id)); else printf('%03d', $story->id);?>pri;?>title;?>assignedTo];?>openedBy];?>estimate;?>story->statusList; echo $statusList[$story->status];?> + createLink('task', 'create', "projectID={$project->id}&story={$story->id}"), $lang->task->create);?> + createLink('project', 'unlinkStory', "projectID={$project->id}&story={$story->id}&confirm=no"), $lang->project->unlinkStory, 'hiddenwin');?> +
+
+
+
+
+ diff --git a/trunk/module/project/view/tabbar.html.php b/trunk/module/project/view/tabbar.html.php new file mode 100644 index 0000000000..4bb1de7b05 --- /dev/null +++ b/trunk/module/project/view/tabbar.html.php @@ -0,0 +1,14 @@ + diff --git a/trunk/module/project/view/task.html.php b/trunk/module/project/view/task.html.php index 51a959e068..12a115e8f8 100644 --- a/trunk/module/project/view/task.html.php +++ b/trunk/module/project/view/task.html.php @@ -17,42 +17,89 @@ * * @copyright Copyright: 2009 Chunsheng Wang * @author Chunsheng Wang - * @package task + * @package project * @version $Id$ * @link http://www.zentao.cn */ ?> - - - - - - - - - - - - - - - - - owner == $app->user->account ? 'style=color:red' : '';?> - - - - - - - - - - - - - -
task->id;?>task->name;?>task->owner;?>task->estimate;?>task->consumed;?>task->left;?>task->status;?>task->story;?>action;?>
id;?>name;?>>ownerRealName;?>estimate;?>consumed;?>left;?>status;?> >task->statusList->{$task->status};?>storyTitle;?> - createLink('task', 'edit', "taskid=$task->id"), $lang->task->edit);?> - createLink('task', 'delete', "projectID=$task->project&taskid=$task->id"), $lang->task->delete, 'hiddenwin');?> -
+ + +
+
+
+
+
+ ' . html::a($this->createLink('task', 'create', "project=$project->id"), $lang->task->create) . '
'; + $app->global->vars = "projectID=$project->id"; + $app->global->orderBy = $orderBy; + function printOrderLink($fieldName) + { + global $app, $lang; + if(strpos($app->global->orderBy, $fieldName) !== false) + { + if(stripos($app->global->orderBy, 'desc') !== false) $orderBy = str_replace('desc', 'asc', $app->global->orderBy); + if(stripos($app->global->orderBy, 'asc') !== false) $orderBy = str_replace('asc', 'desc', $app->global->orderBy); + } + else + { + $orderBy = $fieldName . '|' . 'asc'; + } + $link = helper::createLink('project', 'task', $app->global->vars ."&orderBy=$orderBy"); + $fieldName = str_replace('`', '', $fieldName); + echo html::a($link, $lang->task->$fieldName); + } + ?> + +
+ + + + + + + + + + + + + + + + + owner == $app->user->account ? 'style=color:red' : '';?> + + + + + + + + + + + + + +
action;?>
createLink('task', 'view', "task=$task->id"), sprintf('%03d', $task->id)); else printf('%03d', $task->id);?>name;?>>ownerRealName;?>estimate;?>consumed;?>left;?>status;?> >task->statusList->{$task->status};?> + createLink('story', 'view', "storyid=$task->storyID"), $task->storyTitle); + else echo $task->storyTitle; + ?> + + createLink('task', 'edit', "taskid=$task->id"), $lang->task->edit);?> + createLink('task', 'delete', "projectID=$task->project&taskid=$task->id"), $lang->task->delete, 'hiddenwin');?> +
+
+
+
+ +