JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform: avoid css name conflicts
[wfpl.git] / metaform / template.php
index 57cd79f..79d018c 100644 (file)
@@ -75,7 +75,7 @@ function ~file_name~_get_fields() {
 
 
 function ~public_file_name~_main() {~opt_public_display {~
-       $id = _REQUEST_cut('~public_file_name~_id');
+       $id = _REQUEST_cut('id');
        if($id) {
                return ~file_name~_main_display($id);~opt_public_form unset {~
        } else {
@@ -86,7 +86,7 @@ function ~public_file_name~_main() {~opt_public_display {~
 }~}~
 
 
-function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = false~}~~}~) {~opt_pass {~
+function ~file_name~_main() {~opt_pass {~
        if(logged_in_as_admin()) {
                tem_set('admin_privs');
        } else {
@@ -94,7 +94,7 @@ function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = fa
                return 'admin_login';
        }
 ~}~~opt_db {~
-       $id = _REQUEST_cut('~file_name~_edit_id');
+       $id = _REQUEST_cut('edit_id');
        if($id) {
                return ~file_name~_main_form($id);
        }
@@ -104,15 +104,15 @@ function ~file_name~_main(~opt_display unset {~~opt_public_form {~$new_only = fa
                return ~file_name~_main_delete($id);
        }
 
-       if(_REQUEST_cut('~file_name~_new')) {
+       if(_REQUEST_cut('new')) {
                return ~file_name~_main_form();
        }
 ~}~~opt_listing {~
-       if(_REQUEST_cut('~file_name~_list')) {
+       if(_REQUEST_cut('list')) {
                return ~file_name~_main_listing();
        }
 ~}~~opt_display {~
-       $id = _REQUEST_cut('~file_name~_id');
+       $id = _REQUEST_cut('id');
        if($id) {
                return ~file_name~_main_display($id);
        }
@@ -148,11 +148,11 @@ function ~file_name~_main_listing() {
 }~}~
 
 function ~file_name~_main_form($id = false) {~pulldowns {~
-       pulldown('~name~', ~pulldown_options~);~}~~pulldowns once_if {~
+       pulldown('~name~', ~pulldown_options~);~}~~has_pulldowns {~
 ~}~~opt_db {~
        if($id) {
                # add hidden field for database id of row we're editing
-               tem_set('~file_name~_edit_id', $id);
+               tem_set('id', $id);
                tem_set('editing');
                tem_set('edit_msg');
        } else {
@@ -174,10 +174,10 @@ function ~file_name~_main_form($id = false) {~pulldowns {~
                                $to = $GLOBALS['~file_name~_form_recipient'];
                                $from = 'noreply@~this_domain~';
                                $reply_to = $to;
-                               if(isset($_REQUEST['email']) and valid_email($_REQUEST['email'])) {
-                                       $reply_to = $_REQUEST['email'];
-                                       if($_REQUEST['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $_REQUEST['name']) !== false) {
-                                               $reply_to = "$_REQUEST[name] <$reply_to>";
+                               if(isset($data['email']) and valid_email($data['email'])) {
+                                       $reply_to = $data['email'];
+                                       if($data['name'] and ereg('^[a-zA-Z0-9_\' -]*$', $data['name']) !== false) {
+                                               $reply_to = "$data[name] <$reply_to>";
                                        }
                                }
                                $subject = '~plural cap~ form submitted';
@@ -221,5 +221,5 @@ function ~file_name~_main_form($id = false) {~pulldowns {~
        tem_set('upload_max_filesize', upload_max_filesize());~}~
 
        tem_set('form', $data);~show_extra_headers {~
-       tem_set('extra_headers');~}~
+       tem_set('$head');~}~
 }