From 9fd03716b831bd00a725a63edbe19cfe6b88aea0 Mon Sep 17 00:00:00 2001 From: Mark Wells Date: Sat, 29 Aug 2015 21:27:20 -0700 Subject: #21564: user interface for REST client --- httemplate/edit/process/msg_template.html | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'httemplate/edit/process/msg_template.html') diff --git a/httemplate/edit/process/msg_template.html b/httemplate/edit/process/msg_template.html index e146adf76..d8b125ae0 100644 --- a/httemplate/edit/process/msg_template.html +++ b/httemplate/edit/process/msg_template.html @@ -1,7 +1,7 @@ <% include( 'elements/process.html', 'table' => 'msg_template', - 'viewall_dir' => 'browse', - #'popup_reload'=> 1, + 'fields' => $fields, + 'viewall_url' => "browse/msg_template/$msgclass.html", 'debug' => 0, 'precheck_callback' => \&precheck_callback, 'args_callback' => \&args_callback, @@ -11,9 +11,21 @@ die "access denied" unless $FS::CurrentUser::CurrentUser->access_right(['Edit templates','Edit global templates']); +my $msgclass = 'email'; +if ( $cgi->param('msgclass') =~ /^(\w+)$/ ) { + $msgclass = $1; +} + +my $fields = [ fields('msg_template') ]; +my $class = "FS::msg_template::$msgclass"; +eval "use $class;"; +if ( $class->extension_table ) { + push @$fields, fields($class->extension_table); +} + sub precheck_callback { my $cgi = shift; - # validate some fields + # validate locale field (for email-type records) $cgi->param('locale') =~ /^(\w*)$/; my $locale = $1; return mt('Language required') if $locale eq 'new'; # the user didn't choose -- cgit v1.2.1