%# 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 <& /Admin/RTFM/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)
  > <&|/l&>All articles in this topic are on dropdown on ticket reply page

When inserting articles in this class into emails:

<& /Elements/Submit &>
<%INIT> my $ClassObj = new RT::FM::Class($session{'CurrentUser'}); my ($title, @results, $Disabled); 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()) { $ARGS{HotList} ||= 0 if $Submitted; my @attribs= qw(Description Name HotList); @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 or (not defined $Enabled and $Create)) { $Disabled = 0; } else { $Disabled = 1; } my %include = (Name => 1, Summary => 1); my $cfs = $ClassObj->ArticleCustomFields; $include{"CF-Title-".$_->Id} = $include{"CF-Value-".$_->Id} = 1 while $_ = $cfs->Next; if ( $Submitted ) { if ( $Disabled != $ClassObj->Disabled) { my ($code, $msg) = $ClassObj->SetDisabled($Disabled); push @results, loc('Enabled status [_1]', loc_fuzzy($msg)); } for (keys %include) { if ($ARGS{"Include-$_"}) { $ClassObj->DeleteAttribute("Skip-$_"); } else { $ClassObj->SetAttribute(Name => "Skip-$_", Content => 1); } } } $include{$_} = not $ClassObj->FirstAttribute("Skip-$_") for keys %include; $include{$_} = $include{$_} ? " CHECKED" : "" for keys %include; my $EnabledChecked = ($Create ? $Disabled : $ClassObj->Disabled()) ? "" : "CHECKED"; my $HotListChecked = $ClassObj->HotList ? "CHECKED" : ""; my $current_subtab; if ($Create == 1) { $current_subtab = "Admin/RTFM/Classes/Modify.html?Create=1"; } else { $current_subtab = "Admin/RTFM/Classes/Modify.html?id=$id"; } <%ARGS> $id => undef $result => undef $Name => undef $Create => undef $Description => undef $Submitted => undef $Enabled => undef