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 <& /Admin/Elements/Header, Title => loc("Modify template [_1]", $TemplateObj->id) &>
25 <& /Admin/Elements/SystemTabs,
26 current_tab => 'Admin/Global/Templates.html',
27 current_subtab => $current_subtab,
29 Title => loc("Modify template [_1]", $TemplateObj->id) &>
30 <& /Elements/ListActions, actions => \@results &>
33 <FORM METHOD=POST ACTION="Template.html">
35 <INPUT TYPE=HIDDEN NAME="Template" VALUE="new">
37 <INPUT TYPE=HIDDEN NAME="Template" VALUE="<%$TemplateObj->Id%>">
40 %# hang onto the queue id
41 <INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>">
43 <& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description => $TemplateObj->Description, Content => $TemplateObj->Content &>
45 <& /Elements/Submit, Label => loc('Save Changes'), Reset => 1 &>
52 my $TemplateObj = new RT::Template($session{'CurrentUser'});
53 my ($title, @results, $current_subtab);
56 A => { title => loc('Select template'),
57 path => "Admin/Global/Templates.html"
59 B => { title => loc('New template'),
60 path => "Admin/Global/Template.html?Create=1&Queue=0",
67 $current_subtab = "Admin/Global/Template.html?Create=1&Queue=0";
68 $title = loc("Create a template");
72 if ($Template eq 'new') {
73 my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name);
74 Abort(loc("Could not create template: [_1]", $msg)) unless ($val);
78 $TemplateObj->Load($Template) || Abort(loc('No Template'));
80 $title = loc('Modify template [_1]', loc($TemplateObj->Name()));
84 if ($TemplateObj->Id()) {
85 my @attribs = qw( Description Content Queue Name);
86 my @aresults = UpdateRecordObject( AttributesRef => \@attribs,
87 Object => $TemplateObj,
89 $current_subtab = "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id();
90 $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()),
91 path => "Admin/Global/Template.html?Queue=0&Template=".$TemplateObj->Id(),
93 push @results, @aresults;