%# BEGIN LICENSE BLOCK %# %# Copyright (c) 2002-2003 Jesse Vincent %# %# This program is free software; you can redistribute it and/or modify %# it under the terms of version 2 of the GNU General Public License %# as published by the Free Software Foundation. %# %# A copy of that license should have arrived with this %# software, but in any event can be snarfed from www.gnu.org. %# %# This program is distributed in the hope that it will be useful, %# but WITHOUT ANY WARRANTY; without even the implied warranty of %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the %# GNU General Public License for more details. %# %# END LICENSE BLOCK <& /RTFM/Admin/Elements/ClassTabs, id => $ClassObj->id, current_tab => $current_subtab, Title => $title &> <& /Elements/ListActions, actions => \@results &>
%if ($Create ) { % } else { % }
<&|/l&>Class Name:
<&|/l&>Description:
> <&|/l&>Enabled (Unchecking this box disables this Class)
<& /Elements/Submit &>
<%INIT> my $ClassObj = new RT::FM::Class($session{'CurrentUser'}); my ($title, @results, $Disabled, $EnabledChecked); if ($Create) { $title = loc("Create a Class"); } else { if ($id eq 'new') { my ($val, $msg) = $ClassObj->Create(Name => $Name); if ($val == 0 ) { $m->comp("/RTFM/Elements/Error", Why => "$msg"); } else { push @results, $msg; } } else { $ClassObj->Load($id) || $ClassObj->Load($Name) || $m->comp("/RTFM/Elements/Error", Why => "Couldn't load class '$Name'"); } $title = loc('Editing Configuration for Class [_1]', $ClassObj->Name); } if ($ClassObj->Id()) { my @attribs= qw(Description Name); @results = UpdateRecordObject( AttributesRef => \@attribs, Object => $ClassObj, ARGSRef => \%ARGS); } #we're asking about enabled on the web page but really care about disabled. if ($Enabled == 1) { $Disabled = 0; } else { $Disabled = 1; } if ( ($SetEnabled) and ( $Disabled != $ClassObj->Disabled) ) { my ($code, $msg) = $ClassObj->SetDisabled($Disabled); push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); } unless ($ClassObj->Disabled()) { $EnabledChecked ="CHECKED"; } my $current_subtab; if ($Create == 1) { $current_subtab = "RTFM/Admin/Classes/Modify.html?Create=1"; } else { $current_subtab = "RTFM/Admin/Classes/Modify.html?id=$id"; } <%ARGS> $id => undef $result => undef $Name => undef $Create => undef $Description => undef $SetEnabled => undef $Enabled => undef