X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fprocess%2Fmsg_template.html;h=e146adf7616a328667b071171388ead54f4c89c9;hb=41a196e59f41821c3c35e1833ce35eea8fb7bab9;hp=70d451b724ed60b565c1503ec3804f895c2c3f26;hpb=0fb307c305e4bc2c9c27dc25a3308beae3a4d33c;p=freeside.git diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html index 70d451b72..e146adf76 100644 --- a/httemplate/edit/process/msg_template.html +++ b/httemplate/edit/process/msg_template.html @@ -1,13 +1,37 @@ <% include( 'elements/process.html', 'table' => 'msg_template', 'viewall_dir' => 'browse', + #'popup_reload'=> 1, + 'debug' => 0, + 'precheck_callback' => \&precheck_callback, + 'args_callback' => \&args_callback, ) %> <%init> - die "access denied" - unless $FS::CurrentUser::CurrentUser->access_right('Edit templates') - || $FS::CurrentUser::CurrentUser->access_right('Edit global templates') - || $FS::CurrentUser::CurrentUser->access_right('Configuration'); + unless $FS::CurrentUser::CurrentUser->access_right(['Edit templates','Edit global templates']); + +sub precheck_callback { + my $cgi = shift; + # validate some fields + $cgi->param('locale') =~ /^(\w*)$/; + my $locale = $1; + return mt('Language required') if $locale eq 'new'; # the user didn't choose + die "unknown locale $locale" if ( $locale and + !FS::Locales->locale_info($locale) ); +} + +sub args_callback { + my ($cgi, $object) = @_; + my %content; + $cgi->param('locale') =~ /^(\w*)$/; + $content{'locale'} = $1; + # no validation of these; they can contain just about anything + $content{'subject'} = $cgi->param('subject') || ''; + $content{'body'} = $cgi->param('body') || ''; + $object->subject(''); + $object->body(''); + return %content; +}