default to a session cookie instead of setting an explicit timeout, weird timezone...
[freeside.git] / httemplate / edit / msg_template.html
index 986629c..889b107 100644 (file)
@@ -1,23 +1,9 @@
-<% include( 'elements/edit.html',  
-              'name_singular' => 'template',
-              'table'         => 'msg_template',
-              'viewall_dir'   => 'browse',
-              'fields' => [ 'msgname',
-                            'subject',
-                            { field=>'body', type=>'htmlarea', width=>763 },
-                          ],
-              'labels' => { 'msgnum'  => 'Template',
-                            'msgname' => 'Template name',
-                            'subject' => 'Message subject',
-                            'body'    => 'Message template',
-                          },
-          )
-%>
 <%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');
-
+my $msgclass = 'email';
+if ( $cgi->param('msgnum') =~ /^(\d+)$/ ) {
+  my $msg_template = FS::msg_template->by_key($1)
+    or die "unknown msgnum $1";
+  $msgclass = $msg_template->msgclass;
+}
+print $cgi->redirect($fsurl."edit/msg_template/$msgclass.html?".$cgi->query_string);
 </%init>