1 <% include( 'elements/process.html',
2 'table' => 'msg_template',
3 'viewall_dir' => 'browse',
6 'precheck_callback' => \&precheck_callback,
7 'args_callback' => \&args_callback,
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');
16 sub precheck_callback {
18 # validate some fields
19 $cgi->param('locale') =~ /^(\w*)$/;
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) );
27 my ($cgi, $object) = @_;
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') || '';