From 9c3e35e4b1f4b60267c8fc30f7e67504ed706624 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 18 Apr 2016 11:24:00 +0800 Subject: [PATCH 1/4] * add change log for 8.1.3 version of new privilege. --- module/group/lang/resource.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/module/group/lang/resource.php b/module/group/lang/resource.php index ac694ec0b6..e50ebd208a 100644 --- a/module/group/lang/resource.php +++ b/module/group/lang/resource.php @@ -1152,3 +1152,10 @@ $lang->changelog['8.0.1'][] = 'story-linkStory'; $lang->changelog['8.0.1'][] = 'story-unlinkStory'; $lang->changelog['8.0.1'][] = 'testcase-linkCases'; $lang->changelog['8.0.1'][] = 'testcase-unlinkCase'; + +$lang->changelog['8.1.3'][] = 'story-batchChangeModule'; +$lang->changelog['8.1.3'][] = 'task-batchChangeModule'; +$lang->changelog['8.1.3'][] = 'bug-batchChangeModule'; +$lang->changelog['8.1.3'][] = 'testcase-batchChangeModule'; +$lang->changelog['8.1.3'][] = 'my-manageContacts'; +$lang->changelog['8.1.3'][] = 'my-deleteContacts'; From 3e7ff8731da5a03f3618a7111709fd8ef29d2ec2 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 18 Apr 2016 15:12:37 +0800 Subject: [PATCH 2/4] * remove manageContacts and deleteContacts method of user module. --- module/company/view/browse.html.php | 4 +- module/user/control.php | 84 ----------------------------- module/user/lang/en.php | 2 - module/user/lang/zh-cn.php | 2 - module/user/model.php | 20 ------- 5 files changed, 2 insertions(+), 110 deletions(-) diff --git a/module/company/view/browse.html.php b/module/company/view/browse.html.php index e3c22f8f3d..c5cef28368 100644 --- a/module/company/view/browse.html.php +++ b/module/company/view/browse.html.php @@ -60,7 +60,7 @@ js::set('confirmDelete', $lang->user->confirmDelete); account'> "; + if($canBatchEdit) echo " "; printf('%03d', $user->id); ?> @@ -96,7 +96,7 @@ js::set('confirmDelete', $lang->user->confirmDelete);
edit, 'onclick=batchEdit()', 'btn btn-default'); ?>
diff --git a/module/user/control.php b/module/user/control.php index f6b4a247b6..f0d4e6b065 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -901,90 +901,6 @@ class user extends control $this->display(); } - /** - * Manage contacts. - * - * @param int $listID - * @access public - * @return void - */ - public function manageContacts($listID = 0) - { - $lists = $this->user->getContactLists($this->app->user->account); - - /* If set $mode, need to update database. */ - if($this->post->mode) - { - /* The mode is new: append or new a list. */ - if($this->post->mode == 'new') - { - if($this->post->list2Append) - { - $this->user->append2ContactList($this->post->list2Append, $this->post->users); - die(js::locate(inlink('manageContacts', "listID={$this->post->list2Append}"), 'parent')); - } - elseif($this->post->newList) - { - $listID = $this->user->createContactList($this->post->newList, $this->post->users); - die(js::locate(inlink('manageContacts', "listID=$listID"), 'parent')); - } - } - elseif($this->post->mode == 'edit') - { - $this->user->updateContactList($this->post->listID, $this->post->listName, $this->post->users); - die(js::locate(inlink('manageContacts', "listID={$this->post->listID}"), 'parent')); - } - } - if($this->post->users) - { - $mode = 'new'; - $users = $this->user->getContactUserPairs($this->post->users); - } - else - { - $mode = 'edit'; - $listID= $listID ? $listID : key($lists); - if(!$listID) die(js::alert($this->lang->user->contacts->noListYet) . js::locate($this->createLink('company', 'browse'), 'parent')); - - $list = $this->user->getContactListByID($listID); - $users = explode(',', $list->userList); - $users = $this->user->getContactUserPairs($users); - $this->view->list = $list; - } - - $this->view->title = $this->lang->company->common . $this->lang->colon . $this->lang->user->manageContacts; - $this->view->position[] = $this->lang->company->common; - $this->view->position[] = $this->lang->user->manageContacts; - $this->view->lists = $this->user->getContactLists($this->app->user->account); - $this->view->users = $users; - $this->view->listID = $listID; - $this->view->mode = $mode; - $this->display(); - } - - /** - * Delete a contact list. - * - * @param int $listID - * @param string $confirm - * @access public - * @return void - */ - public function deleteContacts($listID, $confirm = 'no') - { - if($confirm == 'no') - { - echo js::confirm($this->lang->user->contacts->confirmDelete, inlink('deleteContacts', "listID=$listID&confirm=yes")); - exit; - } - else - { - $this->user->deleteContactList($listID); - echo js::locate(inlink('manageContacts'), 'parent'); - exit; - } - } - /** * Get user for ajax * diff --git a/module/user/lang/en.php b/module/user/lang/en.php index b97ae68f84..51ef77c624 100644 --- a/module/user/lang/en.php +++ b/module/user/lang/en.php @@ -59,8 +59,6 @@ $lang->user->unbind = "Unbind ranzhi"; $lang->user->login = "Login"; $lang->user->mobileLogin = "Mobile"; $lang->user->editProfile = "Edit profile"; -$lang->user->manageContacts = 'Manage contacts'; -$lang->user->deleteContacts = 'Delete contacts'; $lang->user->deny = "Denied"; $lang->user->confirmDelete = "Are you sure to delete this user?"; $lang->user->confirmUnlock = "Are you sure to unlock this user?"; diff --git a/module/user/lang/zh-cn.php b/module/user/lang/zh-cn.php index bb660d8b3c..8c20dbd658 100644 --- a/module/user/lang/zh-cn.php +++ b/module/user/lang/zh-cn.php @@ -59,8 +59,6 @@ $lang->user->unbind = "解除然之绑定"; $lang->user->login = "用户登录"; $lang->user->mobileLogin = "手机访问"; $lang->user->editProfile = "修改档案"; -$lang->user->manageContacts = '维护联系人'; -$lang->user->deleteContacts = '删除联系人'; $lang->user->deny = "访问受限"; $lang->user->confirmDelete = "您确定删除该用户吗?"; $lang->user->confirmUnlock = "您确定解除该用户的锁定状态吗?"; diff --git a/module/user/model.php b/module/user/model.php index 4327539442..4ecf105a3a 100644 --- a/module/user/model.php +++ b/module/user/model.php @@ -915,26 +915,6 @@ class userModel extends model return $this->dao->lastInsertID(); } - /** - * Append some users to a contact list. - * - * @param int $listID - * @param string $userList - * @access public - * @return void - */ - public function append2ContactList($listID, $userList) - { - $list = $this->getContactListByID($listID); - if($list->userList) $userList = array_merge($userList, explode(',', $list->userList)); - - $userList = array_unique($userList); - sort($userList); - $userList = join(',', $userList); - - $this->dao->update(TABLE_USERCONTACT)->set('userList')->eq($userList)->where('id')->eq($listID)->exec(); - } - /** * Update a contact list. * From 8345963cb4bb603d2e08e84b6fda8c3b28d57659 Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 18 Apr 2016 16:11:02 +0800 Subject: [PATCH 3/4] * fix error if bugs do not belong to same product when batch edit bugs. --- module/bug/control.php | 12 ++++++++---- module/bug/js/batchedit.js | 23 ++++++++++++++++++++++- module/bug/lang/en.php | 4 +++- module/bug/lang/zh-cn.php | 4 +++- module/bug/model.php | 2 +- module/bug/view/batchedit.html.php | 16 +++++++++++----- 6 files changed, 48 insertions(+), 13 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index e2bc1396ef..cf7d25809c 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -602,10 +602,15 @@ class bug extends control { $product = $this->product->getByID($productID); + /* Set plans. */ + $plans = $this->loadModel('productplan')->getPairs($productID, $branch); + $plans['ditto'] = $this->lang->bug->ditto; + /* Set product menu. */ $this->bug->setMenu($this->products, $productID, $branch); $this->view->title = $product->name . $this->lang->colon . "BUG" . $this->lang->bug->batchEdit; $this->view->position[] = html::a($this->createLink('bug', 'browse', "productID=$productID&branch=$branch"), $this->products[$productID]); + $this->view->plans = $plans; } /* The bugs of my. */ else @@ -631,11 +636,11 @@ class bug extends control $this->view->customFields = $customFields; $this->view->showFields = $this->config->bug->custom->batchedit; - /* Set ditto option for users and type, severity, pri, resolution list. */ + /* Set users. */ $users = $this->user->getPairs('nodeleted,devfirst'); $users['ditto'] = $this->lang->bug->ditto; - $plans = $this->loadModel('productplan')->getPairs($productID, $branch); - $plans['ditto'] = $this->lang->bug->ditto; + + /* Set ditto option for users and type, severity, pri, resolution list. */ $this->lang->bug->typeList['ditto'] = $this->lang->bug->ditto; $this->lang->bug->priList['ditto'] = $this->lang->bug->ditto; $this->lang->bug->resolutionList['ditto'] = $this->lang->bug->ditto; @@ -656,7 +661,6 @@ class bug extends control $this->view->bugs = $bugs; $this->view->branch = $branch; $this->view->users = $users; - $this->view->plans = $plans; $this->display(); } diff --git a/module/bug/js/batchedit.js b/module/bug/js/batchedit.js index a66f0cf3f5..3b958af9c0 100644 --- a/module/bug/js/batchedit.js +++ b/module/bug/js/batchedit.js @@ -27,6 +27,8 @@ $(function() }); }) +$(document).on('click', '.chosen-with-drop', function(){oldValue = $(this).prev('select').val();}) + $(document).on('change', 'select', function() { if($(this).val() == 'ditto') @@ -49,7 +51,26 @@ $(document).on('change', 'select', function() if(value != 'ditto') break; } - $(this).val(value); + isPlans = $(this).attr('name').indexOf('plans') != -1; + + if(isPlans) + { + var valueStr = ',' + $(this).find('option').map(function(){return $(this).val();}).get().join(',') + ','; + if(valueStr.indexOf(',' + value + ',') != -1) + { + $(this).val(value); + } + else + { + alert(dittoNotice); + $(this).val(oldValue); + } + } + else + { + $(this).val(value); + } + $(this).trigger("chosen:updated"); $(this).trigger("change"); } diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index 33397c7b7e..46e8319ea0 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -107,7 +107,9 @@ $lang->bug->allBugs = 'Allbug'; $lang->bug->byQuery = 'Search'; $lang->bug->needConfirm = 'StoryChanged'; $lang->bug->allProduct = "All {$lang->productCommon}s"; -$lang->bug->ditto = 'Ditto'; + +$lang->bug->ditto = 'Ditto'; +$lang->bug->dittoNotice = 'Current bug and bug above it do not belong to same product!'; /* Labels. */ $lang->bug->lblAssignedTo = 'Assigned to'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 7e480f403f..8120a2a019 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -107,7 +107,9 @@ $lang->bug->allBugs = '所有'; $lang->bug->byQuery = '搜索'; $lang->bug->needConfirm = '需求变动'; $lang->bug->allProduct = '所有' . $lang->productCommon; -$lang->bug->ditto = '同上'; + +$lang->bug->ditto = '同上'; +$lang->bug->dittoNotice = '该bug与上一bug不属于同一产品!'; /* 页面标签。*/ $lang->bug->lblAssignedTo = '当前指派'; diff --git a/module/bug/model.php b/module/bug/model.php index bbeaad9f0d..922470965f 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -543,7 +543,7 @@ class bugModel extends model $bug->pri = $data->pris[$bugID]; $bug->status = $data->statuses[$bugID]; $bug->title = $data->titles[$bugID]; - $bug->plan = $data->plan[$bugID]; + $bug->plan = empty($data->plans[$bugID]) ? 0 : $data->plans[$bugID]; $bug->assignedTo = $data->assignedTos[$bugID]; $bug->resolvedBy = $data->resolvedBys[$bugID]; $bug->keywords = $data->keywords[$bugID]; diff --git a/module/bug/view/batchedit.html.php b/module/bug/view/batchedit.html.php index 8453ed7587..0e4a090d47 100644 --- a/module/bug/view/batchedit.html.php +++ b/module/bug/view/batchedit.html.php @@ -11,6 +11,7 @@ */ ?> +lang->bug->dittoNotice);?>
icons['bug']);?> @@ -40,16 +41,21 @@ $columns = count($hasFields) + 2; '>bug->productplan;?> '>bug->assignedTo;?> '>bug->status;?> - '>bug->resolvedByAB;?> - '>bug->resolutionAB;?> '>bug->os;?> '>bug->browser;?> '>bug->keywords;?> + '>bug->resolvedByAB;?> + '>bug->resolutionAB;?> loadModel('productplan')->getPairs($bugs[$bugID]->product, $branch); + $plans['ditto'] = $this->lang->story->ditto; + } /** * Remove designchange, newfeature, trackings from the typeList, because should be tracked in story or task. * These thress types if upgrade from bugfree2.x. @@ -67,6 +73,9 @@ $columns = count($hasFields) + 2; ' style='overflow:visible'>plan, "class='form-control chosen'");?> ' style='overflow:visible'>assignedTo, "class='form-control chosen'");?> >bug->statusList, $bugs[$bugID]->status, 'class=form-control');?> + >bug->osList, $bugs[$bugID]->os, 'class=form-control');?> + >bug->browserList, $bugs[$bugID]->browser, 'class=form-control');?> + >keywords, 'class=form-control');?> ' style='overflow:visible'>resolvedBy, "class='form-control chosen'");?> > @@ -80,9 +89,6 @@ $columns = count($hasFields) + 2;
- >bug->osList, $bugs[$bugID]->os, 'class=form-control');?> - >bug->browserList, $bugs[$bugID]->browser, 'class=form-control');?> - >keywords, 'class=form-control');?> From 5762df7678569032736a7c069b7726e08780602f Mon Sep 17 00:00:00 2001 From: chenfeiCF Date: Mon, 18 Apr 2016 16:26:25 +0800 Subject: [PATCH 4/4] * fix button style for bug method of my module. --- module/my/view/bug.html.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/module/my/view/bug.html.php b/module/my/view/bug.html.php index 521708b106..7a944c613f 100644 --- a/module/my/view/bug.html.php +++ b/module/my/view/bug.html.php @@ -70,11 +70,15 @@ -
- edit, '', '');?> + createLink('bug', 'batchEdit'); + echo html::selectButton() . html::commonButton($lang->edit, "onclick=\"setFormAction('$actionLink')\""); + } + ?>
- show();?>