Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -615,7 +615,7 @@ |
616 | 616 | if ( $source_is_page ) { |
617 | 617 | // Add any unhandled template fields in the page as hidden variables. |
618 | 618 | if ( isset( $template_contents ) ) { |
619 | | - $form_text .= SFFormUtils::unhandledFieldsHTML( $template_contents ); |
| 619 | + $form_text .= SFFormUtils::unhandledFieldsHTML( $template_name, $template_contents ); |
620 | 620 | $template_contents = null; |
621 | 621 | } |
622 | 622 | } |
— | — | @@ -1203,7 +1203,7 @@ |
1204 | 1204 | // If we're editing an existing page, and there were fields in |
1205 | 1205 | // the template call not handled by this form, preserve those. |
1206 | 1206 | if ( !$allow_multiple ) { |
1207 | | - $template_text .= SFFormUtils::addUnhandledFields(); |
| 1207 | + $template_text .= SFFormUtils::addUnhandledFields( $template_name ); |
1208 | 1208 | } |
1209 | 1209 | $template_text .= "}}"; |
1210 | 1210 | $data_text .= $template_text . "\n"; |
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.php |
— | — | @@ -46,12 +46,12 @@ |
47 | 47 | * Add a hidden input for each field in the template call that's |
48 | 48 | * not handled by the form itself |
49 | 49 | */ |
50 | | - static function unhandledFieldsHTML( $template_contents ) { |
| 50 | + static function unhandledFieldsHTML( $templateName, $templateContents ) { |
51 | 51 | $text = ""; |
52 | | - foreach ( $template_contents as $key => $value ) { |
| 52 | + foreach ( $templateContents as $key => $value ) { |
53 | 53 | if ( !is_null( $key ) && !is_numeric( $key ) ) { |
54 | 54 | $key = urlencode( $key ); |
55 | | - $text .= self::hiddenFieldHTML( "_unhandled_$key", $value ); |
| 55 | + $text .= self::hiddenFieldHTML( '_unhandled_' . $templateName . '_' . $key, $value ); |
56 | 56 | } |
57 | 57 | } |
58 | 58 | return $text; |
— | — | @@ -61,12 +61,15 @@ |
62 | 62 | * Add unhandled fields back into the template call that the form |
63 | 63 | * generates, so that editing with a form will have no effect on them |
64 | 64 | */ |
65 | | - static function addUnhandledFields() { |
| 65 | + static function addUnhandledFields( $templateName ) { |
66 | 66 | global $wgRequest; |
| 67 | + |
| 68 | + $prefix = '_unhandled_' . $templateName . '_'; |
| 69 | + $prefixSize = strlen( $prefix ); |
67 | 70 | $additional_template_text = ""; |
68 | 71 | foreach ( $wgRequest->getValues() as $key => $value ) { |
69 | | - if ( substr( $key, 0, 11 ) == '_unhandled_' ) { |
70 | | - $field_name = urldecode( substr( $key, 11 ) ); |
| 72 | + if ( strpos( $key, $prefix ) === 0 ) { |
| 73 | + $field_name = urldecode( substr( $key, $prefixSize ) ); |
71 | 74 | $additional_template_text .= "|$field_name=$value\n"; |
72 | 75 | } |
73 | 76 | } |