3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
24 <& /Elements/Header, Title => $title &>
26 <& /User/Elements/GroupTabs,
28 current_subtab => $current_tab,
31 <& /Elements/ListActions, actions => \@results &>
34 <FORM ACTION="<%$RT::WebPath%>/User/Groups/Modify.html" METHOD=POST>
36 %unless ($Group->Id) {
37 <INPUT TYPE=HIDDEN NAME=id VALUE="new">
39 <INPUT TYPE=HIDDEN NAME=id VALUE="<%$Group->Id%>">
45 <TD><INPUT name="Name" value="<%$Group->Name%>"></TD>
48 <&|/l&>Description</&>:</TD><TD COLSPAN=3><INPUT name="Description" value="<%$Group->Description%>" size=60></TD>
51 <INPUT TYPE=HIDDEN NAME="SetEnabled" VALUE="1">
52 <INPUT TYPE=CHECKBOX NAME="Enabled" VALUE="1" <%$EnabledChecked%>> <&|/l&>Enabled (Unchecking this box disables this group)</&><BR>
55 <& /Elements/Submit, Label => loc('Create'), Reset => 1 &>
60 my ($title, @results, $Disabled, $EnabledChecked);
62 my $Group = RT::Group->new($session{'CurrentUser'});
65 $current_tab = 'User/Groups/Modify.html?Create=1';
66 $title = loc("Create a new personal group");
71 my ( $id, $msg ) = $Group->CreatePersonalGroup(
73 PrincipalId => $session{'CurrentUser'}->PrincipalId
76 Abort( loc("Could not create group") );
81 $Group->Load($id) || Abort( loc('Could not load group') );
85 $title = loc( "Modify the group [_1]", $Group->Name );
89 # If the create failed
91 $title = loc("Create a new personal group");
95 $current_tab = 'User/Groups/Modify.html?id=' . $Group->Id;
100 my @fields = qw(Description Name );
101 my @fieldresults = UpdateRecordObject ( AttributesRef => \@fields,
104 push (@results,@fieldresults);
107 #we're asking about enabled on the web page but really care about disabled.
114 if ( ($SetEnabled) and ( $Disabled != $Group->Disabled) ) {
115 my ($code, $msg) = $Group->SetDisabled($Disabled);
116 push @results, loc('Enabled status [_1]', loc_fuzzy($msg));
119 unless ($Group->Disabled()) {
120 $EnabledChecked ="CHECKED";
129 $Description => undef