From 66d2f40056ca2e30b26e41be9c17e854650a964b Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Fri, 29 Apr 2016 13:22:37 +0800 Subject: [PATCH 1/2] * adjust code for managecontacts method. * add buildcontactlists method which is fetched in story, bug, task and testtask create method. --- module/bug/control.php | 1 - module/bug/view/create.html.php | 9 +--- module/my/control.php | 18 ++++++-- module/my/view/buildcontactlists.html.php | 25 +++++++++++ module/my/view/managecontacts.html.php | 54 +++++++++++------------ module/story/control.php | 1 - module/story/view/create.html.php | 9 +--- module/task/control.php | 2 - module/task/view/create.html.php | 11 +---- module/testtask/control.php | 1 - module/testtask/view/create.html.php | 15 ++----- 11 files changed, 72 insertions(+), 74 deletions(-) create mode 100644 module/my/view/buildcontactlists.html.php diff --git a/module/bug/control.php b/module/bug/control.php index d1ce72167c..e2a7938c66 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -337,7 +337,6 @@ class bug extends control $this->view->projectMembers = $projectMembers; $this->view->assignedTo = $assignedTo; $this->view->mailto = $mailto; - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); $this->view->keywords = $keywords; $this->view->severity = $severity; $this->view->type = $type; diff --git a/module/bug/view/create.html.php b/module/bug/view/create.html.php index 4f02dc8af6..eb1f5f7e19 100644 --- a/module/bug/view/create.html.php +++ b/module/bug/view/create.html.php @@ -214,14 +214,7 @@ js::set('refresh', $lang->refresh);
'; - echo ''; - echo ''; - echo ''; - } + echo $this->fetch('my', 'buildContactLists'); ?>
diff --git a/module/my/control.php b/module/my/control.php index acd1fbef7c..5d29b3ad53 100644 --- a/module/my/control.php +++ b/module/my/control.php @@ -420,17 +420,27 @@ class my extends control { if($confirm == 'no') { - echo js::confirm($this->lang->user->contacts->confirmDelete, inlink('deleteContacts', "listID=$listID&confirm=yes")); - exit; + die(js::confirm($this->lang->user->contacts->confirmDelete, inlink('deleteContacts', "listID=$listID&confirm=yes"))); } else { $this->user->deleteContactList($listID); - echo js::locate(inlink('manageContacts'), 'parent'); - exit; + die(js::locate(inlink('manageContacts'), 'parent')); } } + /** + * Build contact lists. + * + * @access public + * @return void + */ + public function buildContactLists() + { + $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); + $this->display(); + } + /** * View my profile. * diff --git a/module/my/view/buildcontactlists.html.php b/module/my/view/buildcontactlists.html.php new file mode 100644 index 0000000000..f6982451c1 --- /dev/null +++ b/module/my/view/buildcontactlists.html.php @@ -0,0 +1,25 @@ + + * @package my + * @version $Id$ + * @link http://www.zentao.net + */ +?> +'; + echo ''; + echo ''; + echo ''; +} +?> diff --git a/module/my/view/managecontacts.html.php b/module/my/view/managecontacts.html.php index 999c7ca6db..79ba3f8d71 100644 --- a/module/my/view/managecontacts.html.php +++ b/module/my/view/managecontacts.html.php @@ -12,23 +12,24 @@ ?>
+
-
- user->contacts->contactsList;?> -
    $listName) { - $class = ($id == $listID) ? 'list-group-item active' : 'list-group-item'; - echo html::a(inlink('managecontacts', "listID=$id&mode=edit"), $listName, '', "class='{$class}'"); + $listClass = ($id == $listID) ? 'list-group-item active' : 'list-group-item'; + echo html::a(inlink('managecontacts', "listID=$id&mode=edit"), $listName, '', "class='{$listClass}'"); } + echo html::a(inlink('managecontacts', "listID=0&mode=new"), $lang->user->contacts->createList, '', "class='list-group-item'"); ?>
-
+ + +
@@ -37,18 +38,25 @@ user->contacts->manage;?> -
- user->contacts->createList, '', "class='btn'"); - echo html::a(inlink('deleteContacts', "listID=$listID"), $lang->delete, 'hiddenwin', "class='btn btn-danger'"); - } - ?> -
+ + + + - + -
user->contacts->listName;?> + listName, "class='form-control'"); + echo html::hidden('listID', $list->id); + } + ?> +
user->contacts->selectedUsers;?> @@ -65,22 +73,12 @@
user->contacts->listName;?> - listName, "class='form-control'"); - echo html::hidden('listID', $list->id); - } - ?> + + delete, 'hiddenwin', "class='btn btn-danger'");?>
diff --git a/module/story/control.php b/module/story/control.php index c33fc31155..3e144a2107 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -172,7 +172,6 @@ class story extends control $this->view->position[] = $this->lang->story->create; $this->view->products = $products; $this->view->users = $users; - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); $this->view->moduleID = $moduleID; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->view->plans = $this->loadModel('productplan')->getPairs($productID, $branch, 'unexpired'); diff --git a/module/story/view/create.html.php b/module/story/view/create.html.php index 1cdd651206..6dfea23806 100644 --- a/module/story/view/create.html.php +++ b/module/story/view/create.html.php @@ -151,14 +151,7 @@
'; - echo ''; - echo ''; - echo ''; - } + echo $this->fetch('my', 'buildContactLists'); ?>
diff --git a/module/task/control.php b/module/task/control.php index 03c7ee2d6d..01bf90eab2 100644 --- a/module/task/control.php +++ b/module/task/control.php @@ -134,7 +134,6 @@ class task extends control $users = $this->loadModel('user')->getPairs('nodeleted|noclosed'); $stories = $this->story->getProjectStoryPairs($projectID); $members = $this->project->getTeamMemberPairs($projectID, 'nodeleted'); - $contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); $moduleOptionMenu = $this->tree->getTaskOptionMenu($projectID); $title = $project->name . $this->lang->colon . $this->lang->task->create; @@ -154,7 +153,6 @@ class task extends control $this->view->users = $users; $this->view->stories = $stories; $this->view->members = $members; - $this->view->contactLists = $contactLists; $this->view->moduleOptionMenu = $moduleOptionMenu; $this->display(); } diff --git a/module/task/view/create.html.php b/module/task/view/create.html.php index 3e5879b771..25af37d214 100644 --- a/module/task/view/create.html.php +++ b/module/task/view/create.html.php @@ -132,16 +132,7 @@ task->mailto;?> acl == 'private' ? $members : $users, str_replace(' ', '', $task->mailto), "multiple class='form-control'");?> - - '; - echo ''; - echo ''; - echo ''; - } - ?> + fetch('my', 'buildContactLists');?>
diff --git a/module/testtask/control.php b/module/testtask/control.php index ada949e9c0..88c7de686e 100644 --- a/module/testtask/control.php +++ b/module/testtask/control.php @@ -154,7 +154,6 @@ class testtask extends control $this->view->productID = $productID; $this->view->builds = $builds; $this->view->users = $this->loadModel('user')->getPairs('noclosed|nodeleted|qdfirst'); - $this->view->contactLists = $this->user->getContactLists($this->app->user->account, 'withnote'); $this->display(); } diff --git a/module/testtask/view/create.html.php b/module/testtask/view/create.html.php index c59dd8f5c9..2e6edf4c9e 100644 --- a/module/testtask/view/create.html.php +++ b/module/testtask/view/create.html.php @@ -74,17 +74,10 @@ testtask->mailto;?>
- - - '; - echo ''; - echo ''; - echo ''; - } - ?> + fetch('my', 'buildContactLists'); + ?>
From 8f5a147d81602c874949b92844c8775079cecc85 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Fri, 29 Apr 2016 13:38:04 +0800 Subject: [PATCH 2/2] * adjust code format. --- module/bug/view/browse.html.php | 6 +++++- module/product/view/browse.html.php | 6 +++++- module/project/view/story.html.php | 12 ++++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index 4c1ee760cd..2b8dee2f04 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -69,7 +69,11 @@ js::set('bugBrowseType', ($browseType == 'bymodule' and $this->session->bugBrows { $wizardParams = helper::safe64Encode("productID=$productID&branch=$branch&extra=moduleID=$moduleID"); common::printIcon('tutorial', 'wizard', "module=bug&method=create¶ms=$wizardParams", 'btn', 'button', 'plus', '', 'btn-bug-create', '', false, $lang->bug->create); - } else common::printIcon('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID", 'btn', 'button', 'plus', '', 'btn-bug-create'); + } + else + { + common::printIcon('bug', 'create', "productID=$productID&branch=$branch&extra=moduleID=$moduleID", 'btn', 'button', 'plus', '', 'btn-bug-create'); + } ?>
diff --git a/module/product/view/browse.html.php b/module/product/view/browse.html.php index 6ddfa1d415..bacfa19961 100644 --- a/module/product/view/browse.html.php +++ b/module/product/view/browse.html.php @@ -63,7 +63,11 @@ { $wizardParams = helper::safe64Encode("productID=$productID&branch=$branch&moduleID=$moduleID"); common::printIcon('tutorial', 'wizard', "module=story&method=create¶ms=$wizardParams", 'btn', 'button', 'plus', '', 'create-story-btn', false, '', $lang->story->create); - } else common::printIcon('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID", 'btn', 'button', 'plus', '', 'create-story-btn'); + } + else + { + common::printIcon('story', 'create', "productID=$productID&branch=$branch&moduleID=$moduleID", 'btn', 'button', 'plus', '', 'create-story-btn'); + } ?> diff --git a/module/project/view/story.html.php b/module/project/view/story.html.php index 5e400f2910..2fd705ca8b 100644 --- a/module/project/view/story.html.php +++ b/module/project/view/story.html.php @@ -27,7 +27,11 @@ { $wizardParams = helper::safe64Encode("project=$project->id"); common::printIcon('tutorial', 'wizard', "module=project&method=linkStory¶ms=$wizardParams", '', 'button', 'link', '', 'link-story-btn', false, '', $lang->project->linkStory); - } else common::printIcon('project', 'linkStory', "project=$project->id", '', 'button', 'link', '', 'link-story-btn'); + } + else + { + common::printIcon('project', 'linkStory', "project=$project->id", '', 'button', 'link', '', 'link-story-btn'); + } ?> @@ -105,7 +109,11 @@ { $wizardParams = helper::safe64Encode($param); common::printIcon('tutorial', 'wizard', "module=task&method=create¶ms=$wizardParams", '', 'list', 'list-ul', '', 'btn-task-create', false, '', $lang->project->wbs); - } else common::printIcon('task', 'create', $param, '', 'list', 'list-ul', '', 'btn-task-create'); + } + else + { + common::printIcon('task', 'create', $param, '', 'list', 'list-ul', '', 'btn-task-create'); + } $lang->task->batchCreate = $lang->project->batchWBS; common::printIcon('task', 'batchCreate', "projectID={$project->id}&story={$story->id}", '', 'list', 'stack');