Support for removing all users.
This commit is contained in:
parent
9985f3768f
commit
54a8167ea9
4 changed files with 19 additions and 1 deletions
|
|
@ -194,6 +194,7 @@ sub www_editFriends {
|
||||||
$var->{username} = $user->username;
|
$var->{username} = $user->username;
|
||||||
$var->{userId} = $user->userId;
|
$var->{userId} = $user->userId;
|
||||||
$var->{manageUrl} = $self->getUrl('module=friendManager;do=view');
|
$var->{manageUrl} = $self->getUrl('module=friendManager;do=view');
|
||||||
|
$var->{removeAll} = WebGUI::Form::checkbox($session, { name => 'removeAllFriends', value => 'all', });
|
||||||
return $self->processTemplate($var,$session->setting->get("fmEditTemplateId"));
|
return $self->processTemplate($var,$session->setting->get("fmEditTemplateId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -222,8 +223,13 @@ sub www_editFriendsSave () {
|
||||||
$ufriend->add([$userToAdd]);
|
$ufriend->add([$userToAdd]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
##Remove all has priority, that way we don't delete friends twice.
|
||||||
|
my $removeAll = $form->process('removeAllFriends','checkbox');
|
||||||
my @usersToRemove = $form->process('friendToAxe', 'checkList');
|
my @usersToRemove = $form->process('friendToAxe', 'checkList');
|
||||||
if (scalar @usersToRemove) {
|
if ($removeAll eq 'all') {
|
||||||
|
$ufriend->delete($user->friends->getUsers());
|
||||||
|
}
|
||||||
|
elsif (scalar @usersToRemove) {
|
||||||
$ufriend->delete(\@usersToRemove);
|
$ufriend->delete(\@usersToRemove);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ our $HELP = {
|
||||||
{ name => 'checkForm', },
|
{ name => 'checkForm', },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
{ name => 'removeAll', },
|
||||||
{ name => 'submit',
|
{ name => 'submit',
|
||||||
required => 1, },
|
required => 1, },
|
||||||
{ name => 'formFooter',
|
{ name => 'formFooter',
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,17 @@ our $I18N = {
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'removeAll' => {
|
||||||
|
message => q{A checkbox to remove all friends from this user.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
|
'remove all' => {
|
||||||
|
message => q{Remove all},
|
||||||
|
context => q{Template label. To remove all members of a set, to emtpy it.},
|
||||||
|
lastUpdated => 0,
|
||||||
|
},
|
||||||
|
|
||||||
'submit' => {
|
'submit' => {
|
||||||
message => q{A button with internationalized label to submit the form.},
|
message => q{A button with internationalized label to submit the form.},
|
||||||
lastUpdated => 0,
|
lastUpdated => 0,
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue