Add button to add all Friend Managers to friends.

Help, i18n, template and code.
This commit is contained in:
Colin Kuskie 2009-04-07 15:54:30 -07:00
parent 54a8167ea9
commit 03b777ee1e
4 changed files with 19 additions and 1 deletions

View file

@ -195,6 +195,7 @@ sub www_editFriends {
$var->{userId} = $user->userId;
$var->{manageUrl} = $self->getUrl('module=friendManager;do=view');
$var->{removeAll} = WebGUI::Form::checkbox($session, { name => 'removeAllFriends', value => 'all', });
$var->{addManagers} = WebGUI::Form::checkbox($session, { name => 'addManagers', value => 'addManagers', });
return $self->processTemplate($var,$session->setting->get("fmEditTemplateId"));
}
@ -222,6 +223,11 @@ sub www_editFriendsSave () {
if ($userToAdd) {
$ufriend->add([$userToAdd]);
}
my $addManagers = $form->process('addManagers', 'checkbox');
if ($addManagers eq 'addManagers') {
my $managerGroup = WebGUI::Group->new($session, $session->setting->get('groupIdAdminFriends'));
$ufriend->add($managerGroup->getUsers());
}
##Remove all has priority, that way we don't delete friends twice.
my $removeAll = $form->process('removeAllFriends','checkbox');

View file

@ -44,7 +44,8 @@ our $HELP = {
{ name => 'checkForm', },
],
},
{ name => 'removeAll', },
{ name => 'removeAll', },
{ name => 'addManagers', },
{ name => 'submit',
required => 1, },
{ name => 'formFooter',

View file

@ -149,6 +149,17 @@ our $I18N = {
lastUpdated => 0,
},
'addManagers' => {
message => q{A checkbox to add all users in the Friend Manager group to this users's list of Friends.},
lastUpdated => 0,
},
'Add Friend Managers' => {
message => q{Add Friend Managers},
context => q{Template label. To add all Friend Managers to this list of friends.},
lastUpdated => 0,
},
'submit' => {
message => q{A button with internationalized label to submit the form.},
lastUpdated => 0,