Change display of groups on manage friends screen

If 1 group, display it.  If more than 1, display all groups
but this one.
This commit is contained in:
Colin Kuskie 2009-04-10 10:04:43 -07:00
parent a2c736459e
commit 8f5e9aac1f
2 changed files with 8 additions and 4 deletions

View file

@ -293,7 +293,9 @@ sub www_getFriendsAsJson {
my @records = ();
my $groups = $session->setting->get('groupsToManageFriends');
my @groupIds = split "\n", $groups;
@groupIds = grep { $_ ne $groupId } @groupIds;
if (scalar @groupIds > 1) {
@groupIds = grep { $_ ne $groupId } @groupIds;
}
my $groupNames = join "\n",
map { $_->name }
map { WebGUI::Group->new($session, $_) }
@ -341,7 +343,7 @@ sub www_getFriendsAsJson {
=head2 www_view ( )
The main view page for editing the user's profile.
The main view page for editing the user's friends.
=cut

View file

@ -61,12 +61,14 @@ WebGUI.FriendManager.formatUsername = function ( el, oRecord, oColumn, oData ) {
WebGUI.FriendManager.formatGroups = function ( el, oRecord, oColumn, oData ) {
var userId = oRecord.getData('userId');
el.innerHTML = '<a href="?op=account;module=friendManager;do=editFriends;userId=' + userId + '">Edit all</a>';
el.innerHTML = '';
var groups = oData.split("\n");
for (var idx=0; idx < groups.length; idx++) {
var group = groups[idx];
var groupUri = encodeURI(group);
el.innerHTML += ' ';
if (el.innerHTML) {
el.innerHTML += ' ';
}
el.innerHTML += '<a href="?op=account;module=friendManager;do=editFriends;userId=' + userId + ';groupName='+groupUri+'">'+group+'</a>';
}
}