Index: trunk/extensions/SemanticMediaWiki/includes/SMW_Setup.php |
— | — | @@ -95,7 +95,7 @@ |
96 | 96 | $wgHooks['PageSchemasGeneratePages'][] = 'smwfGeneratePages' ; // Hook for creating Pages |
97 | 97 | $wgHooks['getHtmlTextForFieldInputs'][] = 'smwfgetHtmlTextForPS' ; // Hook for retuning html text to PS schema |
98 | 98 | $wgHooks['getFilledHtmlTextForFieldInputs'][] = 'smwfgetFilledHtmlTextForPS' ; //Hook for retuning html text to PS schema |
99 | | - $wgHooks['getXmlTextForFieldInputs'][] = 'smwfgetXMLTextForPS' ; // Hook for retuning html text to PS schema |
| 99 | + $wgHooks['PageSchemasGetFieldXML'][] = 'smwfGetFieldXMLForPS'; |
100 | 100 | $wgHooks['PSParseFieldElements'][] = 'smwfParseFieldElements' ; // Hook for creating Pages |
101 | 101 | $wgHooks['PageSchemasGetPageList'][] = 'smwfGetPageList' ; //Hook for creating Pages |
102 | 102 | /* End: Hooks related to Pageschemas extension */ |
— | — | @@ -641,18 +641,16 @@ |
642 | 642 | return true; |
643 | 643 | } |
644 | 644 | |
645 | | -function smwfgetXMLTextForPS( $wgRequest, &$text_extensions ){ |
646 | | - |
647 | | - $Xmltext = ""; |
| 645 | +function smwfGetFieldXMLForPS( $request, &$xmlArray ) { |
648 | 646 | $templateNum = -1; |
649 | | - $xml_text_array = array(); |
650 | | - foreach ( $wgRequest->getValues() as $var => $val ) { |
651 | | - if(substr($var,0,18) == 'smw_property_name_'){ |
| 647 | + $xmlPerField = array(); |
| 648 | + foreach ( $request->getValues() as $var => $val ) { |
| 649 | + if ( substr( $var, 0, 18 ) == 'smw_property_name_' ) { |
652 | 650 | $templateNum = substr($var,18,1); |
653 | | - $Xmltext .= '<semanticmediawiki_Property name="'.$val.'" >'; |
654 | | - }else if(substr($var,0,18) == 'smw_property_type_'){ |
655 | | - $Xmltext .= '<Type>'.$val.'</Type>'; |
656 | | - }else if(substr($var,0,11) == 'smw_values_'){ |
| 651 | + $xml = '<semanticmediawiki_Property name="'.$val.'" >'; |
| 652 | + } elseif ( substr( $var, 0, 18 ) == 'smw_property_type_'){ |
| 653 | + $xml .= '<Type>'.$val.'</Type>'; |
| 654 | + } elseif ( substr( $var, 0, 11 ) == 'smw_values_') { |
657 | 655 | if ( $val != '' ) { |
658 | 656 | // replace the comma substitution character that has no chance of |
659 | 657 | // being included in the values list - namely, the ASCII beep |
— | — | @@ -662,17 +660,17 @@ |
663 | 661 | foreach ( $allowed_values_array as $i => $value ) { |
664 | 662 | // replace beep back with comma, trim |
665 | 663 | $value = str_replace( "\a", $listSeparator, trim( $value ) ); |
666 | | - $Xmltext .= '<AllowedValue>'.$value.'</AllowedValue>'; |
| 664 | + $xml .= '<AllowedValue>'.$value.'</AllowedValue>'; |
667 | 665 | } |
668 | 666 | } |
669 | | - $Xmltext .= '</semanticmediawiki_Property>'; |
670 | | - $xml_text_array[] = $Xmltext; |
671 | | - $Xmltext = ''; |
| 667 | + $xml .= '</semanticmediawiki_Property>'; |
| 668 | + $xmlPerField[] = $xml; |
672 | 669 | } |
673 | 670 | } |
674 | | - $text_extensions['smw'] = $xml_text_array; |
| 671 | + $xmlArray['smw'] = $xmlPerField; |
675 | 672 | return true; |
676 | 673 | } |
| 674 | + |
677 | 675 | function smwfgetFilledHtmlTextForPS( $pageSchemaObj, &$text_extensions ){ |
678 | 676 | global $smwgContLang; |
679 | 677 | $datatype_labels = $smwgContLang->getDatatypeLabels(); |