%#============================================================================ %# ePortal - WEB Based daily organizer %# Author - S.Rusakov %# %# Copyright (c) 2000-2004 Sergey Rusakov. All rights reserved. %# This program is open source software %# %# %#----------------------------------------------------------------------------   <% $dlg->dialog_start( title => pick_lang(rus => "Членство пользователя в группах", eng => "Group membership"), delete_button => 0, width => 500) %> % foreach my $field (qw/username fullname/) { <% $dlg->field($field, RO => 1) %> % }     <% pick_lang(rus => "Входит в группы", eng => "Member of") %>
<% CGI::scrolling_list( -name => "member_of", -values => [$dlg->{obj}->member_of()], -size => 5, -multiple => 'true', -class => "dlgfield", ) %>
<% CGI::submit( -name => "remove", -value => pick_lang(rus => "Убрать", eng => "Remove"), -class => "button" ) %> <% pick_lang(rus => "Не входит в группы", eng => "Not member of") %>
<% CGI::scrolling_list( -name => "not_member_of", -values => [$dlg->{obj}->not_member_of()], -size => 5, -multiple => 'true', -class => "dlgfield", ) %>
<% CGI::submit( -name => "add", -value => pick_lang(rus => "Добавить", eng => "Add"), -class => "button" ) %>     <% $dlg->buttons( ok_button => 0, cancel_label => pick_lang(rus => "Закрыть", eng => "Cancel")) %> <% $dlg->dialog_end %> %#=== @METAGS attr ========================================================= <%attr> Title => {rus => "Членство пользователя в группах", eng => "Group membership"} Layout => 'Dialog' %#=== @METAGS onStartRequest ==================================================== <%method onStartRequest><%perl> my $user = new ePortal::epUser; $dlg = new ePortal::HTML::Dialog( obj => $user ); my $location = try { $dlg->handle_request( ); } catch ePortal::Exception::DataNotValid with { my $E = shift; $session{ErrorMessage} = $E->text; ''; }; my @member_of = ref($ARGS{member_of}) eq "ARRAY" ? @{$ARGS{member_of}} : ($ARGS{member_of}); my @not_member_of = ref($ARGS{not_member_of}) eq "ARRAY" ? @{$ARGS{not_member_of}} : ($ARGS{not_member_of}); if ($ARGS{remove}) { $user->remove_groups(@member_of); return undef; } elsif ($ARGS{add}) { $user->add_groups(@not_member_of); return undef; } if ( $dlg->isButtonPressed('cancel')) { return $location; } %#=== @metags once ========================================================= <%once> my ($dlg, $obj); %#=== @metags cleanup ========================================================= <%cleanup> ($dlg, $obj) = ();