JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
metaform puts a link to the metaform edit page in the generated php document
authorJason Woofenden <jason183@herkamire.com>
Mon, 12 Feb 2007 22:27:00 +0000 (17:27 -0500)
committerJason Woofenden <jason183@herkamire.com>
Mon, 12 Feb 2007 22:27:00 +0000 (17:27 -0500)
metaform.php
metaform/template.php

index 8263797..03d8b28 100644 (file)
@@ -22,6 +22,7 @@
 # This file writes the code for you (sql, php, html, email) to handle a form.
 
 require_once('code/wfpl/template.php');
+require_once('code/wfpl/http.php');
 require_once('code/wfpl/tar.php');
 
 # see code/wfpl/metaform/template.html for the html templates for these elements
@@ -231,9 +232,18 @@ function make_php() {
        $tem->set('always_field', $always_field);
        $tem->set('db_fields', $db_fields);
        $tem->set('php_fields', $php_fields);
+       $tem->set('metaform_url', edit_url());
        return $tem->run();
 }
 
+# make a URL for the edit page with all the fields filled in
+function edit_url() {
+       $url = this_url();
+       $url = ereg_replace('view_php=[^&]*', 'edit=yes', $url);
+       $url = ereg_replace('download_tar=[^&]*', 'edit=yes', $url);
+       return $url;
+}
+
 function view_php() {
        view_headers();
        echo make_php();
index af98d96..07eda6a 100644 (file)
@@ -1,6 +1,12 @@
 <?php
 
-# This form requires wfpl. See: http://jasonwoof.org/wfpl
+# This form requires wfpl. If you didn't recieve wfpl along with this file,
+# see: http://jasonwoof.org/wfpl
+
+# This form was auto-generated. If you would like to alter the parameters and
+# generate a new one try this URL:
+#
+# ~metaform_url~
 
 # This code can send form results by e-mail and/or save them to a database. See
 # the next two comments to enable either or both.