This commit was generated by cvs2svn to compensate for changes in r2526,
[freeside.git] / rt / webrt / Admin / Queues / Template.html
1 <& /Admin/Elements/Header, title => "Modify template ".$TemplateObj->id&>
2 <& /Admin/Elements/QueueTabs, id => $Queue &>
3 <& /Elements/ListActions, actions => \@results &>
4
5 <& /Elements/TitleBoxStart, title => $title &>
6
7 <FORM METHOD=POST ACTION="Template.html">
8 %if ($create ) {
9 <INPUT TYPE=HIDDEN NAME=template VALUE="new">
10 % } else {
11 <INPUT TYPE=HIDDEN NAME=template VALUE="<%$TemplateObj->Id%>">
12 % }
13
14 %# hang onto the queue id
15 <INPUT TYPE=HIDDEN name="Queue" value="<%$Queue%>">
16
17
18 Name: <input name="Name" VALUE="<%$TemplateObj->Name%>" SIZE=20><BR>
19 Description: <input name="Description" VALUE="<%$TemplateObj->Description%>" SIZE=80><BR>
20
21 <TEXTAREA NAME=Content ROWS=25 COLS=80 WRAP=SOFT>
22 <%$TemplateObj->Content%></TEXTAREA>
23
24 <& /Elements/TitleBoxEnd&>
25 <&/Elements/Submit&>
26 </FORM>
27
28
29
30 <%INIT>
31
32 my $TemplateObj = new RT::Template($session{'CurrentUser'});
33 my  ($title, @results);
34
35 if ($create) {
36   $title = "Create a template";
37 }
38
39 else {
40   if ($template eq 'new') {
41       my ($val, $msg) =  $TemplateObj->Create(Queue => $Queue, Name => $Name);
42       Abort("Could not create template: $msg") unless ($val);
43      push @results, $msg;
44      $title = 'Created template ' . $TemplateObj->Name(); 
45     }
46     else {
47        $TemplateObj->Load($template) || Abort('No Template');
48       $title = 'Editing template ' . $TemplateObj->Name(); 
49     }
50   
51     
52 }
53 if ($TemplateObj->Id()) {
54   $Queue = $TemplateObj->Queue;
55
56   my @attribs = qw( Description Content Queue Name);
57   my @aresults = UpdateRecordObject( AttributesRef => \@attribs, 
58                                      Object => $TemplateObj, 
59                                      ARGSRef => \%ARGS);
60   push @results, @aresults;
61 }
62 </%INIT>
63 <%ARGS>
64 $Queue => undef
65 $template => undef
66 $create => undef
67 $Name => undef
68 </%ARGS>