X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=metaform.php;h=a0dce787236395b62f496b16a86a01a6eac764ba;hb=56892b42cb4895e601c8de375d833806772673e9;hp=31efa99317a506cf5597f430b57b52e2139b95e1;hpb=73081d29a40502abc68db3ce80115e052b95f953;p=wfpl.git diff --git a/metaform.php b/metaform.php index 31efa99..a0dce78 100644 --- a/metaform.php +++ b/metaform.php @@ -175,13 +175,24 @@ function get_fields() { $fields_str = rtrim($fields_str); $fields = split("\n", $fields_str); foreach($fields as $field) { + $first_char = substr($field, 0, 1); $field = trim($field); + if ($first_char === ' ' || $first_char === "\t") { + $i = count($GLOBALS['gotten_fields']); + if($i > 0) { + $i -= 1; + if (!$GLOBALS['gotten_fields'][$i]['options']) { + $GLOBALS['gotten_fields'][$i]['options'] = array(); + } + $GLOBALS['gotten_fields'][$i]['options'][] = $field; + continue; + } + } if(substr($field, -1) == '{') { $caption = trim(substr($field, 0, -1)); $name = format_varname($caption); $type = '{'; $options = null; - # FIXME restore parsing of option lists for pulldowns } else { $options = null; $type = null; @@ -317,6 +328,20 @@ function make_html($whole_file = true) { 'caption' => $field['caption'] ) ); + if($field['type'] == 'radio') { + $i = 0; + $opts = array(); + foreach ($field['options'] as $row) { + if (is_array($row)) { + $cap = $row[1]; + } else { + $cap = $row; + } + $opts[] = array('i' => $i, 'option_caption' => $cap); + $i += 1; + } + $visible_fields[count($visible_fields) - 1]['options'] = $opts; + } } if($field['input'] == 'image' || $field['input'] == 'file') { @@ -530,7 +555,6 @@ function edit_url() { $url = ereg_replace('view_php=[^&]*', 'edit=yes', $url); $url = ereg_replace('download_tar=[^&]*', 'edit=yes', $url); $url = ereg_replace('/[a-z0-9_.]*\?', '/?', $url); - $url = str_replace('jasonwoof.l', 'jasonwoof.com', $url); # so that code generated on Jason's home computer will display a publically accessible link. return $url; } @@ -600,7 +624,8 @@ function download_tar() { $files = array( "README" => "These files are meant to work with wfpl.\n\nSee: http://sametwice.com/wfpl\n", ".htaccess" => make_htaccess(), - "config.php" => " " read_whole_file(__DIR__.'/'.'metaform/wfpl_main.php'), "styl.styl" => read_whole_file(__DIR__.'/'.'metaform/styl.styl'), "template.html" => read_whole_file(__DIR__.'/'.'metaform/site-template.html'), "$admin_name.html" => make_html(),