r93579 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93578‎ | r93579 | r93580 >
Date:08:55, 31 July 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
AutoFill EditSchema form for multiple filed.
Modified paths:
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -195,7 +195,11 @@
196196 $Xmltext .= $ps_add_xml;
197197 $fieldName = "";
198198 $fieldNum= -1;
199 - $templateNum = -1;
 199+ $templateNum = -1;
 200+ $xml_text_extensions = array(); //This var. will save the xml text returned by the extensions
 201+ $js_extensions = array();
 202+ wfRunHooks( 'getXmlTextForFieldInputs', array( $wgRequest, &$xml_text_extensions ));
 203+ $indexGlobalField = 0 ; //this variable is use to index the array returned by extensions for XML.
200204 foreach ( $wgRequest->getValues() as $var => $val ) {
201205 if(substr($var,0,7) == 't_name_'){
202206 $templateNum = substr($var,7,1);
@@ -219,13 +223,11 @@
220224 }
221225 }else if(substr($var,0,8) == 'f_label_'){
222226 $Xmltext .= '<Label>'.$val.'</Label>';
223 - //Get Xml parsed from extensions,
224 - $text_extensions = array(); //This var. will save the html text returned by the extensions
225 - $js_extensions = array();
226 - wfRunHooks( 'getXmlTextForFieldInputs', array( $wgRequest, &$text_extensions ));
227 - foreach( $text_extensions as $text_ex ){
228 - $Xmltext .= $text_ex ;
 227+ //Get Xml parsed from extensions,
 228+ foreach( $xml_text_extensions as $xml_ex_array ){
 229+ $Xmltext .= $xml_ex_array[$indexGlobalField] ;
229230 }
 231+ $indexGlobalField++ ;
230232 }else if(substr($var,0,10) == 'f_add_xml_'){
231233 $Xmltext .= $val;
232234 $Xmltext .= '</Field>';
@@ -278,7 +280,9 @@
279281 if( ($row[1] == 'PageSchema') && ($row[2] != null )){
280282 //Populate the form here with autocompleted values
281283 $pageXmlstr = $row[2];
282 - $pageXml = simplexml_load_string ( $pageXmlstr );
 284+ wfDebugLog( 'myextension', 'Something is not right: ' . print_r( $pageXmlstr, true ) );
 285+ $pageXml = simplexml_load_string ( $pageXmlstr );
 286+
283287 $pageName = (string)$pageXml->attributes()->name;
284288 $text_4 .= '';
285289 $text_4 .= '<form id="editPageSchemaForm" action="" method="post">' . "\n";

Status & tagging log