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 => $title &>
25 <& /Admin/Elements/QueueTabs, id => $Queue,
26 QueueObj => $TemplateObj->QueueObj,
27 current_tab => 'Admin/Queues/Templates.html?id='.$Queue,
28 current_subtab => $current_subtab,
31 <& /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%>">
42 <& /Admin/Elements/ModifyTemplate, Name => $TemplateObj->Name, Description =>
43 $TemplateObj->Description, Content => $TemplateObj->Content &>
44 <& /Elements/Submit, Caption => loc("Be sure to save your changes"), Reset => 1 &>
50 my $TemplateObj = new RT::Template($session{'CurrentUser'});
51 my ($title, @results, $current_subtab);
54 A => { title => loc('Select template'),
55 path => "Admin/Queues/Templates.html?id=$Queue"
57 B => { title => loc('New template'),
58 path => "Admin/Queues/Template.html?Create=1&Queue=$Queue",
64 $title = loc("Create a template");
65 $current_subtab = "Admin/Queues/Template.html?create=1&Queue=".$Queue;
69 if ($Template eq 'new') {
70 my ($val, $msg) = $TemplateObj->Create(Queue => $Queue, Name => $Name);
71 Abort(loc("Could not create template: [_1]", $msg)) unless ($val);
75 $TemplateObj->Load($Template) || Abort(loc('No Template'));
77 $title = loc('Modify template [_1]', loc($TemplateObj->Name()));
81 if ($TemplateObj->Id()) {
82 $Queue = $TemplateObj->Queue;
84 my @attribs = qw( Description Content Queue Name);
85 my @aresults = UpdateRecordObject( AttributesRef => \@attribs,
86 Object => $TemplateObj,
88 $current_subtab = "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id();
89 $subtabs->{"C"} = { title => loc('Template #[_1]', $TemplateObj->Id()),
90 path => "Admin/Queues/Template.html?Queue=$Queue&Template=".$TemplateObj->Id(),
92 push @results, @aresults;