X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=blobdiff_plain;f=metaform.php;h=a0dce787236395b62f496b16a86a01a6eac764ba;hp=bf90466478884bf39ce936b792ff1426a97f94f1;hb=f6fdd9deec6c7815f5877270e746e1bd1201a726;hpb=b3e0519705687b2b71ecb4fbe95640b786967bb4 diff --git a/metaform.php b/metaform.php index bf90466..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') {