This commit was generated by cvs2svn to compensate for changes in r12472,
[freeside.git] / httemplate / edit / process / msg_template.html
1 <% include( 'elements/process.html',  
2               'table'       => 'msg_template',
3               'viewall_dir' => 'browse',
4               #'popup_reload'=> 1,
5               'debug'       => 1,
6               'precheck_callback' => \&precheck_callback,
7               'args_callback' => \&args_callback,
8           )
9 %>
10 <%init>
11 die "access denied"
12   unless $FS::CurrentUser::CurrentUser->access_right('Edit templates')
13   ||     $FS::CurrentUser::CurrentUser->access_right('Edit global templates')
14   ||     $FS::CurrentUser::CurrentUser->access_right('Configuration');
15
16 sub precheck_callback {
17   my $cgi = shift;
18   # validate some fields
19   $cgi->param('locale') =~ /^(\w*)$/;
20   my $locale = $1;
21   return mt('Language required') if $locale eq 'new'; # the user didn't choose
22   die "unknown locale $locale" if ( $locale and 
23                                     !FS::Locales->locale_info($locale) );
24 }
25
26 sub args_callback {
27   my ($cgi, $object) = @_;
28   my %content;
29   $cgi->param('locale') =~ /^(\w*)$/;
30   $content{'locale'} = $1;
31   # no validation of these; they can contain just about anything
32   $content{'subject'} = $cgi->param('subject') || '';
33   $content{'body'} = $cgi->param('body') || '';
34   return %content;
35 }
36
37 </%init>