Index: trunk/extensions/SemanticForms/SemanticForms.php |
— | — | @@ -97,7 +97,8 @@ |
98 | 98 | $wgHooks['PSParseFieldElements'][] = 'SFUtils::parseFieldElements' ; //Hook for creating Pages |
99 | 99 | $wgHooks['PageSchemasGetPageList'][] = 'SFUtils::getPageList' ; //Hook for creating Pages |
100 | 100 | $wgHooks['getHtmlTextForFieldInputs'][] = 'SFUtils::getHtmlTextForPS' ; //Hook for retuning html text to PS schema |
101 | | -$wgHooks['getXmlTextForFieldInputs'][] = 'SFUtils::getXMLTextForPS' ; //Hook for retuning html text to PS schema |
| 101 | +$wgHooks['PageSchemasGetSchemaXML'][] = 'SFUtils::getSchemaXMLForPS'; |
| 102 | +$wgHooks['PageSchemasGetFieldXML'][] = 'SFUtils::getFieldXMLForPS'; |
102 | 103 | $wgHooks['getFilledHtmlTextForFieldInputs'][] = 'SFUtils::getFilledHtmlTextForPS' ; //Hook for retuning html text to PS schema |
103 | 104 | |
104 | 105 | $wgAPIModules['sfautocomplete'] = 'SFAutocompleteAPI'; |
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php |
— | — | @@ -190,25 +190,31 @@ |
191 | 191 | return true; |
192 | 192 | } |
193 | 193 | |
194 | | - public static function getXMLTextForPS( $wgRequest, &$text_extensions ) { |
195 | | - $Xmltext = ""; |
196 | | - $form_xml_text = ""; |
197 | | - $templateNum = -1; |
198 | | - $xml_text_array = array(); |
199 | | - foreach ( $wgRequest->getValues() as $var => $val ) { |
| 194 | + public static function getSchemaXMLForPS( $request, &$xmlArray ) { |
| 195 | + foreach ( $request->getValues() as $var => $val ) { |
200 | 196 | if ( substr( $var, 0, 13) == 'sf_form_name_' ) { |
201 | | - $form_xml_text .= '<semanticforms_Form name="'.$val.'" >'; |
202 | | - } elseif ( substr( $var, 0, 14 ) == 'sf_input_type_') { |
203 | | - $templateNum = substr( $var, 14, 1 ); |
204 | | - $Xmltext .= '<semanticforms_FormInput>'; |
205 | | - $Xmltext .= '<InputType>'.$val.'</InputType>'; |
| 197 | + $xml = '<semanticforms_Form name="'.$val.'" >'; |
206 | 198 | } elseif ( substr( $var, 0, 21 ) == 'sf_page_name_formula_') { |
207 | | - $form_xml_text .= '<PageNameFormula>'.$val.'</PageNameFormula>'; |
| 199 | + $xml .= '<PageNameFormula>'.$val.'</PageNameFormula>'; |
208 | 200 | } elseif ( substr( $var, 0, 16 ) == 'sf_create_title_' ) { |
209 | | - $form_xml_text .= '<CreateTitle>'.$val.'</CreateTitle>'; |
| 201 | + $xml .= '<CreateTitle>'.$val.'</CreateTitle>'; |
210 | 202 | } elseif ( substr( $var, 0, 14 ) == 'sf_edit_title_' ) { |
211 | | - $form_xml_text .= '<EditTitle>'.$val.'</EditTitle>'; |
212 | | - $form_xml_text .= '</semanticforms_Form>'; |
| 203 | + $xml .= '<EditTitle>'.$val.'</EditTitle>'; |
| 204 | + $xml .= '</semanticforms_Form>'; |
| 205 | + } |
| 206 | + } |
| 207 | + $xmlArray['sf'] = $xml; |
| 208 | + return true; |
| 209 | + } |
| 210 | + |
| 211 | + public static function getFieldXMLForPS( $request, &$xmlArray ) { |
| 212 | + $xmlPerField = array(); |
| 213 | + $templateNum = -1; |
| 214 | + foreach ( $request->getValues() as $var => $val ) { |
| 215 | + if ( substr( $var, 0, 14 ) == 'sf_input_type_') { |
| 216 | + $templateNum = substr( $var, 14, 1 ); |
| 217 | + $xml = '<semanticforms_FormInput>'; |
| 218 | + $xml .= '<InputType>'.$val.'</InputType>'; |
213 | 219 | } elseif ( substr( $var, 0, 14 ) == 'sf_key_values_' ) { |
214 | 220 | if ( $val != '' ) { |
215 | 221 | // replace the comma substitution character that has no chance of |
— | — | @@ -222,20 +228,18 @@ |
223 | 229 | $param_value = explode( "=", $value ); |
224 | 230 | if ( $param_value[1] != null ) { |
225 | 231 | //handles Parameter name="size">20</Parameter> |
226 | | - $Xmltext .= '<Parameter name="'.$param_value[0].'">'.$param_value[1].'</Parameter>'; |
| 232 | + $xml .= '<Parameter name="'.$param_value[0].'">'.$param_value[1].'</Parameter>'; |
227 | 233 | } else { |
228 | 234 | //handles <Parameter name="mandatory" /> |
229 | | - $Xmltext .= '<Parameter name="'.$param_value[0].'"/>'; |
| 235 | + $xml .= '<Parameter name="'.$param_value[0].'"/>'; |
230 | 236 | } |
231 | 237 | } |
232 | | - $Xmltext .= '</semanticforms_FormInput>'; |
233 | | - $xml_text_array[] = $Xmltext; |
234 | | - $Xmltext = ''; |
| 238 | + $xml .= '</semanticforms_FormInput>'; |
| 239 | + $xmlPerField[] = $xml; |
235 | 240 | } |
236 | 241 | } |
237 | 242 | } |
238 | | - $text_extensions['sf'] = $xml_text_array; |
239 | | - $text_extensions['sf_form'] = $form_xml_text; |
| 243 | + $xmlArray['sf'] = $xmlPerField; |
240 | 244 | return true; |
241 | 245 | } |
242 | 246 | |