r94121 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94120‎ | r94121 | r94122 >
Date:16:20, 9 August 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
editing <Form handelling code.
Modified paths:
  • /trunk/extensions/PageSchemas/PageSchemas.classes.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PageSchemas.classes.php
@@ -177,7 +177,7 @@
178178 $text .= self::parseField($child);
179179 }
180180 return $text;
181 - }
 181+ }
182182 static function parseField ( $field_xml ) {
183183 $name = $field_xml->attributes()->name;
184184 $text = self::tableRowHTML('paramAttr', 'Field', $name);
@@ -228,12 +228,12 @@
229229 }else{
230230 //retrievimg the third attribute which is pp_value
231231 $pageXmlstr = $row[2];
232 - $pageXml = simplexml_load_string ( $pageXmlstr );
233 - $this->pageName = (string)$pageXml->attributes()->name;
 232+ $this->pageXml = simplexml_load_string ( $pageXmlstr );
 233+ $this->pageName = (string)$this->pageXml->attributes()->name;
234234 /* index for template objects */
235235 $i = 0;
236236 $inherited_templates = null ;
237 - foreach ( $pageXml->children() as $tag => $child ) {
 237+ foreach ( $this->pageXml->children() as $tag => $child ) {
238238 if ( $tag == 'InheritsFrom ' ) {
239239 $schema_to_inherit = (string) $child->attributes()->schema;
240240 if( $schema_to_inherit !=null ){
@@ -255,14 +255,7 @@
256256 }
257257 }
258258 }
259 - }
260 - if ( $tag == 'Form' ) {
261 - $this->formName = (string) $child->attributes()->name;
262 - $this->formArray['name'] = (string) $child->attributes()->name;
263 - foreach ($child->children() as $tag => $formelem) {
264 - $this->formArray[(string)$tag] = (string)$formelem;
265 - }
266 - }
 259+ }
267260 }
268261 }
269262 }
@@ -272,7 +265,8 @@
273266 }
274267 /*return an array of PSTemplate Objects */
275268 function getFormArray () {
276 - return $this->formArray;
 269+ $obj = $this->getObject('Form');
 270+ return $obj['sf'];
277271 }
278272 /*return an array of PSTemplate Objects */
279273 function isPSDefined () {
@@ -287,8 +281,14 @@
288282 return $this->pageName;
289283 }
290284 function getFormName(){
291 - return $this->formName;
 285+ $form_array = $this->getFormArray();
 286+ return $form_array['name'];
292287 }
 288+ function getObject( $objectName ) {
 289+ $object = array();
 290+ wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->pageXml, &$object ) );
 291+ return $object;
 292+ }
293293 function getCategoryName(){
294294 return $this->categoryName;
295295 }

Status & tagging log