From 2ecded42555422ed55b6c5810a57ca188f40cb21 Mon Sep 17 00:00:00 2001 From: Jose Rabal Date: Tue, 3 Mar 2015 13:03:52 +0100 Subject: [PATCH] SAK-28107 Special rank doesn't work when user has not a messages tool permission --- .../messageforums/DiscussionForumTool.java | 20 ++---------- .../src/webapp/js/forum_rank.js | 32 ------------------- 2 files changed, 2 insertions(+), 50 deletions(-) diff --git a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java index 90cbef7b2381..1bc58c74290a 100644 --- a/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java +++ b/msgcntr/messageforums-app/src/java/org/sakaiproject/tool/messageforums/DiscussionForumTool.java @@ -9180,9 +9180,6 @@ public String getTotalAssignToListJSON() { } private List transformItemList(List members) { - Map> allParticipantsMap = new HashMap>(1); - allParticipantsMap.put("allParticipants", new ArrayList(1)); - Map> rolesMap = new HashMap>(1); rolesMap.put("roles", new ArrayList(1)); @@ -9194,9 +9191,7 @@ private List transformItemList(List members) { for (Iterator iterator = members.iterator(); iterator.hasNext();) { MembershipItem item = (MembershipItem) iterator.next(); - if (MembershipItem.TYPE_ALL_PARTICIPANTS.equals(item.getType())) { - parseAllParticipants(item, allParticipantsMap); - } else if (MembershipItem.TYPE_ROLE.equals(item.getType())) { + if (MembershipItem.TYPE_ROLE.equals(item.getType())) { parseRoles(item, rolesMap); } else if (MembershipItem.TYPE_GROUP.equals(item.getType())) { parseGroups(item, groupsMap); @@ -9223,8 +9218,7 @@ private List transformItemList(List members) { } } } - List allItemsList = new ArrayList(3); - allItemsList.add(allParticipantsMap); + List allItemsList = new ArrayList(); allItemsList.add(rolesMap); // we only need the userIds to setup the individual user data @@ -9293,16 +9287,6 @@ private void parseUsers(MembershipItem item, Map> group jsonMembershipItem.element("groups", memberGroupsArray); } - private void parseAllParticipants(MembershipItem item, Map> allParticipantsMap) { - List allParticipantsList = allParticipantsMap.get("allParticipants"); - if (allParticipantsList == null) { - allParticipantsList = new ArrayList(); - } - JSONObject jsonMembershipItem = new JSONObject(); - jsonMembershipItem.element("name", item.getName()).element("membershipItemId", item.getId()); - allParticipantsList.add(jsonMembershipItem); - } - public void setRankManager(RankManager rankManager) { this.rankManager = rankManager; } diff --git a/msgcntr/messageforums-app/src/webapp/js/forum_rank.js b/msgcntr/messageforums-app/src/webapp/js/forum_rank.js index d4497fda92c2..d7673020ef79 100644 --- a/msgcntr/messageforums-app/src/webapp/js/forum_rank.js +++ b/msgcntr/messageforums-app/src/webapp/js/forum_rank.js @@ -32,8 +32,6 @@ Licenses. var templates = { toTokenTemplate: '
%displayName x
', - toAllTokenTemplate: '
%displayNames x
', - choiceTemplate: '%displayNames', choiceSeparator: '   ', sourceItem: '
%displayName
', collectionItem: '
%displayName
' @@ -350,42 +348,12 @@ Licenses. displayName: recipientRow.text() }); }; - - var buildAllToken = function (roleName, roleId) { - return fluid.stringTemplate(templates.toAllTokenTemplate, { - membershipItemId: roleId, - membershipItemIdAgain: roleId, - displayName: roleName - }); - }; - - var buildAllChoice = function (roleName, roleId) { - return fluid.stringTemplate(templates.choiceTemplate, { - membershipItemId: roleId, - displayName: roleName - }); - }; var buildMailToBox = function () { // restore previous state - handling going to add attachment page and back var needsTokens = !restoreSelectionFromParentWindow(); - var allParticipants = getJSONData("allParticipants").allParticipants[0]; // assignToBox is the box above the 'Add Individual..' button. It contains the selected results. - // sakai-ppkr-to-choice contains the available categories below the box. Not used here for Rank feature. - assignToBox.append(buildAllToken("All Participant", allParticipants.membershipItemId)); - //$(".sakai-ppkr-to-choice").append(buildAllChoice("Add all participant", allParticipants.membershipItemId) + templates.choiceSeparator); - var roles = getJSONData("roles").roles; - for (var i = 0; i < roles.length; i++) { - var role = roles[i]; - if (needsTokens) { - assignToBox.append(buildAllToken("All " + role.roleId, role.membershipItemId)); - } - //$(".sakai-ppkr-to-choice").append(buildAllChoice("Add all " + role.roleId, role.membershipItemId)); - if (i < roles.length - 1) { - // $('.sakai-ppkr-to-choice').append(templates.choiceSeparator); - } - } // CW-2780 CW-2779: build already selected individuals, in EditRank page buildExistingUsers();