event refactor, landing on HEAD!
[freeside.git] / httemplate / edit / invoice_template.html
1 <% include("/elements/header.html", "Edit $type2desc{$type} invoice template",
2              menubar(
3                'View all invoice templates' => $p.'browse/invoice_template.html'
4              )
5           )
6 %>
7
8 <FORM ACTION="process/invoice_template.html" METHOD="POST">
9 <INPUT TYPE="hidden" NAME="confname" VALUE="<% $confname %>">
10
11 % if ( $type eq 'html' ) {
12
13 % #init
14   <SCRIPT TYPE="text/javascript" src="<% $p %>elements/fckeditor/fckeditor.js">
15   </SCRIPT>
16
17 % #editor
18   <SCRIPT TYPE="text/javascript">
19     var oFCKeditor = new FCKeditor('value');
20     oFCKeditor.Value = <% $value |js_string %>;
21
22     oFCKeditor.BasePath = '<% $p %>elements/fckeditor/';
23     oFCKeditor.Config['SkinPath'] = '<% $p %>elements/fckeditor/editor/skins/silver/';
24     oFCKeditor.Height = '800';
25     oFCKeditor.Config['StartupFocus'] = true;
26
27     oFCKeditor.Create();
28
29   </SCRIPT>
30
31 % } else {
32
33   <TEXTAREA NAME="value" ROWS=30 COLS=80 WRAP="off"><%$value |h %></TEXTAREA>
34
35 % }
36
37 <BR><BR>
38 <INPUT TYPE="submit" VALUE="Change template">
39
40 </FORM>
41
42 <% include("/elements/footer.html") %>
43
44 <%once>
45
46 my %type2desc = (
47   'html'  => 'HTML',
48   'latex' => 'Print/PDF (typeset)',
49   'text'  => 'Plaintext',
50 );
51
52 my %type2base = (
53   'html'  => 'invoice_html',
54   'latex' => 'invoice_latex',
55   'text'  => 'invoice_template',
56 );
57
58 </%once>
59 <%init>
60
61 die "access denied"
62   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
63
64 my $type = $cgi->param('type');
65 my $name = $cgi->param('name');
66 my $suffix = $cgi->param('suffix');
67
68 #XXX type handling, just testing this out for now
69
70 my $conf = new FS::Conf;
71
72 my $value = length($name)
73               ? join("\n", $conf->config_orbase($type2base{$type}.$suffix, $name) )
74               : join("\n", $conf->config($type2base{$type}.$suffix) );
75
76 my $confname = length($name)
77                  ? $type2base{$type}.$suffix. '_'. $name
78                  : $type2base{$type}.$suffix;
79
80 </%init>