X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=metaform.php;h=9fe48c9c3b490d2220ebd0b31198b5f7b7d03ac5;hb=e3c093250e28f834151eb6ddba5ad965a8e6651b;hp=d8cc07e54648a3f6b290d98013951b964a4a223d;hpb=ea4d90be29beb1d4a1462159c4deafd14c2bd7c1;p=wfpl.git diff --git a/metaform.php b/metaform.php index d8cc07e..9fe48c9 100644 --- a/metaform.php +++ b/metaform.php @@ -36,10 +36,12 @@ $GLOBALS['types'] = array( 'money' => array('textbox', 'money', 'varchar(32)'), 'dollars' => array('textbox', 'dollars', 'varchar(32)'), 'url' => array('textbox', 'url', 'varchar(200)'), + 'hidden' => array('hidden', 'unix', 'varchar(200)'), + 'password' => array('password', 'oneline', 'varchar(200)'), 'textarea' => array('textarea', 'unix', 'text'), 'pulldown' => array('pulldown', 'options', 'int'), - 'checkbox' => array('checkbox', 'yesno', 'int'), - 'yesno' => array('checkbox', 'yesno', 'int'), + 'checkbox' => array('checkbox', 'yesno', 'varchar(3)'), + 'yesno' => array('checkbox', 'yesno', 'varchar(3)'), 'submit' => array('submit', 'oneline', 'n/a') ); @@ -156,7 +158,9 @@ function make_template($whole_file = true) { $tem->set('name', $name); $tem->set('caption', $name); # fixme $tem->sub($input); - $tem->sub('row'); + if($input != 'hidden') { + $tem->sub('row'); + } } $tem->set('name', 'save'); $tem->set('caption', 'Save'); @@ -182,6 +186,7 @@ function make_php() { $tem->set('form_name', $GLOBALS['form_name']); $fields = get_fields(); $db_fields = ''; + $php_fields = ''; $always_field = false; foreach($fields as $field) { list($name, $type, $input, $format, $sql) = $field; @@ -190,11 +195,13 @@ function make_php() { $tem->set('name', $name); $tem->set('db_field', ''); # we don't want to use the value from last time if($sql != 'n/a') { - $tem->sub('db_field'); if($db_fields != '') $db_fields .= ','; $db_fields .= $name; + if($php_fields != '') $php_fields .= ', '; + $php_fields .= '$' . $name; } $tem->sub('formats'); + $tem->sub('tem_sets'); if(!$always_field and $input != 'checkbox' and $input != 'radio') { $always_field = $name; } @@ -203,6 +210,7 @@ function make_php() { # always_field is a form field that always submits (unlike say, checkboxes). It's used to detect if the form has submitted or not. $tem->set('always_field', $always_field); $tem->set('db_fields', $db_fields); + $tem->set('php_fields', $php_fields); return $tem->run(); }