Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php |
— | — | @@ -32,6 +32,9 @@ |
33 | 33 | foreach ( $wgRequest->getArray('params') as $key => $value ) { |
34 | 34 | if ( ( $pos = strpos( $key, '_' . $fieldFormText ) ) != false ) { |
35 | 35 | $paramName = substr( $key, 0, $pos ); |
| 36 | + // Spaces got replaced by underlines in |
| 37 | + // the query. |
| 38 | + $paramName = str_replace( '_', ' ', $paramName ); |
36 | 39 | $paramValues[$paramName] = $value; |
37 | 40 | } |
38 | 41 | } |
— | — | @@ -149,13 +152,16 @@ |
150 | 153 | foreach ( $wgRequest->getValues() as $key => $value ) { |
151 | 154 | if ( ( $pos = strpos( $key, '_' . $old_i . '_' . $j ) ) != false ) { |
152 | 155 | $paramName = substr( $key, 0, $pos ); |
| 156 | + // Spaces got replaced by underlines |
| 157 | + // in the query. |
| 158 | + $paramName = str_replace( '_', ' ', $paramName ); |
153 | 159 | } else { |
154 | 160 | continue; |
155 | 161 | } |
156 | 162 | |
157 | 163 | if ( $paramName == 'label' ) { |
158 | 164 | $field->template_field->label = $value; |
159 | | - } elseif ( $paramName == 'input_type' ) { |
| 165 | + } elseif ( $paramName == 'input type' ) { |
160 | 166 | $input_type = $wgRequest->getVal( "input_type_" . $old_i . "_" . $j ); |
161 | 167 | if ( $input_type == 'hidden' ) { |
162 | 168 | $field->template_field->input_type = $input_type; |
— | — | @@ -273,23 +279,23 @@ |
274 | 280 | * Code borrowed heavily from Semantic MediaWiki's |
275 | 281 | * SMWAskPage::addOptionInput(). |
276 | 282 | */ |
277 | | - public static function inputTypeParamInput( $type, $param_name, $cur_value, array $param, array $paramValues, $fieldFormText ) { |
| 283 | + public static function inputTypeParamInput( $type, $paramName, $cur_value, array $param, array $paramValues, $fieldFormText ) { |
278 | 284 | if ( $type == 'int' ) { |
279 | 285 | return Xml::element( 'input', array( |
280 | 286 | 'type' => 'text', |
281 | | - 'name' => $param_name . '_' . $fieldFormText, |
| 287 | + 'name' => $paramName . '_' . $fieldFormText, |
282 | 288 | 'value' => $cur_value, |
283 | 289 | 'size' => 6 |
284 | 290 | ) ); |
285 | 291 | } elseif ( $type == 'string' ) { |
286 | 292 | return Xml::element( 'input', array( |
287 | 293 | 'type' => 'text', |
288 | | - 'name' => $param_name . '_' . $fieldFormText, |
| 294 | + 'name' => $paramName . '_' . $fieldFormText, |
289 | 295 | 'value' => $cur_value, |
290 | 296 | 'size' => 32 |
291 | 297 | ) ); |
292 | 298 | } elseif ( $type == 'enumeration' ) { |
293 | | - $text = '<select name="p[' . htmlspecialchars( $param_name ) . ']">'; |
| 299 | + $text = '<select name="p[' . htmlspecialchars( $paramName ) . ']">'; |
294 | 300 | $text .= "\n <option value=''></option>\n"; |
295 | 301 | |
296 | 302 | $parts = array(); |
— | — | @@ -305,14 +311,14 @@ |
306 | 312 | $cur_values = explode( ',', $cur_value ); |
307 | 313 | foreach ( $param['values'] as $val ) { |
308 | 314 | $text .= '<span style="white-space: nowrap; padding-right: 5px;"><input type="checkbox" name="p[' . |
309 | | - htmlspecialchars( $param_name ) . '][' . htmlspecialchars( $val ). ']" value="true"' . |
| 315 | + htmlspecialchars( $paramName ) . '][' . htmlspecialchars( $val ). ']" value="true"' . |
310 | 316 | ( in_array( $val, $cur_values ) ? ' checked' : '' ) . '/> <tt>' . htmlspecialchars( $val ) . "</tt></span>\n"; |
311 | 317 | } |
312 | 318 | return $text; |
313 | 319 | } elseif ( $type == 'boolean' ) { |
314 | 320 | $checkboxAttrs = array( |
315 | 321 | 'type' => 'checkbox', |
316 | | - 'name' => $param_name . '_' . $fieldFormText |
| 322 | + 'name' => $paramName . '_' . $fieldFormText |
317 | 323 | ); |
318 | 324 | if ( $cur_value) { $checkboxAttrs['checked'] = 'checked'; } |
319 | 325 | return Xml::element( 'input', $checkboxAttrs ); |
— | — | @@ -344,11 +350,11 @@ |
345 | 351 | $params = method_exists( $inputTypeClass, 'getParameters' ) ? call_user_func( array( $inputTypeClass, 'getParameters' ) ) : array(); |
346 | 352 | |
347 | 353 | foreach ( $params as $i => $param ) { |
348 | | - $param_name = $param['name']; |
| 354 | + $paramName = $param['name']; |
349 | 355 | $type = $param['type']; |
350 | 356 | $desc = $param['description']; |
351 | 357 | |
352 | | - $cur_value = ( array_key_exists( $param_name, $paramValues ) ) ? $paramValues[$param_name] : ''; |
| 358 | + $cur_value = ( array_key_exists( $paramName, $paramValues ) ) ? $paramValues[$paramName] : ''; |
353 | 359 | |
354 | 360 | // 3 values per row, with alternating colors for rows |
355 | 361 | if ( $i % 3 == 0 ) { |
— | — | @@ -356,9 +362,9 @@ |
357 | 363 | $text .= "<div style=\"background: $bgcolor;\">"; |
358 | 364 | } |
359 | 365 | |
360 | | - $text .= "<div style=\"width: 30%; padding: 5px; float: left;\">$param_name:\n"; |
| 366 | + $text .= "<div style=\"width: 30%; padding: 5px; float: left;\">$paramName:\n"; |
361 | 367 | |
362 | | - $text .= self::inputTypeParamInput( $type, $param_name, $cur_value, $param, array(), $fieldFormText ); |
| 368 | + $text .= self::inputTypeParamInput( $type, $paramName, $cur_value, $param, array(), $fieldFormText ); |
363 | 369 | $text .= "\n<br />" . Xml::element( 'em', null, $desc ) . "\n</div>\n"; |
364 | 370 | |
365 | 371 | if ( $i % 3 == 2 || $i == count( $params ) - 1 ) { |
Index: trunk/extensions/SemanticForms/includes/SF_FormField.php |
— | — | @@ -159,6 +159,9 @@ |
160 | 160 | foreach ( $wgRequest->getValues() as $key => $value ) { |
161 | 161 | if ( ( $pos = strpos( $key, '_' . $field_form_text ) ) != false ) { |
162 | 162 | $paramName = substr( $key, 0, $pos ); |
| 163 | + // Spaces got replaced by underlines in the |
| 164 | + // query. |
| 165 | + $paramName = str_replace( '_', ' ', $paramName ); |
163 | 166 | $paramValues[$paramName] = $value; |
164 | 167 | } |
165 | 168 | } |