Skip to content

Commit

Permalink
SAK-28107 Special rank doesn't work when user has not a messages tool…
Browse files Browse the repository at this point in the history
… permission
  • Loading branch information
Jose Rabal authored and juanjmerono committed Mar 3, 2015
1 parent 3dc93fc commit 2ecded4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9180,9 +9180,6 @@ public String getTotalAssignToListJSON() {
}

private List transformItemList(List members) {
Map<String, List<JSONObject>> allParticipantsMap = new HashMap<String, List<JSONObject>>(1);
allParticipantsMap.put("allParticipants", new ArrayList<JSONObject>(1));

Map<String, List<JSONObject>> rolesMap = new HashMap<String, List<JSONObject>>(1);
rolesMap.put("roles", new ArrayList<JSONObject>(1));

Expand All @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -9293,16 +9287,6 @@ private void parseUsers(MembershipItem item, Map<String, List<JSONObject>> group
jsonMembershipItem.element("groups", memberGroupsArray);
}

private void parseAllParticipants(MembershipItem item, Map<String, List<JSONObject>> allParticipantsMap) {
List<JSONObject> allParticipantsList = allParticipantsMap.get("allParticipants");
if (allParticipantsList == null) {
allParticipantsList = new ArrayList<JSONObject>();
}
JSONObject jsonMembershipItem = new JSONObject();
jsonMembershipItem.element("name", item.getName()).element("membershipItemId", item.getId());
allParticipantsList.add(jsonMembershipItem);
}

public void setRankManager(RankManager rankManager) {
this.rankManager = rankManager;
}
Expand Down
32 changes: 0 additions & 32 deletions msgcntr/messageforums-app/src/webapp/js/forum_rank.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ Licenses.

var templates = {
toTokenTemplate: '<div class="sakai-ppkr-token token-ind sakai-ppkr-to-%membershipItemId" title="%eid" id="sakai-ppkr-to-%membershipItemIdAgain">%displayName <span class="ppkr-remove">x</span></div>',
toAllTokenTemplate: '<div class="sakai-ppkr-token token-all token-hidden token-role-%membershipItemId" id="token-role-%membershipItemIdAgain">%displayNames <span class="ppkr-remove">x</span></div>',
choiceTemplate: '<a id="role-choice-%membershipItemId" class="sakai-ppkr-select-all " href="#">%displayNames</a>',
choiceSeparator: '<span class="role-choice-separator"> &nbsp; </span>',
sourceItem: '<div id="source-list-%membershipItemId" class="role-%roleId%groupsClasses" title="%titleEid">%displayName</div>',
collectionItem: '<div id="%membershipItemId" title="%memberEid">%displayName</div>'
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 2ecded4

Please sign in to comment.