r100006 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100005‎ | r100006 | r100007 >
Date:01:25, 17 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Another overhaul - changed hook system for extensions to instead use an entire class per extension. Also added new "display" attribute for fields.
Modified paths:
  • /trunk/extensions/PageSchemas/PS_ExtensionHandler.php (added) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.classes.php (modified) (history)
  • /trunk/extensions/PageSchemas/PageSchemas.php (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_EditSchema.php (modified) (history)
  • /trunk/extensions/PageSchemas/specials/PS_GeneratePages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PageSchemas/PS_ExtensionHandler.php
@@ -0,0 +1,106 @@
 2+<?php
 3+/**
 4+ * @author Yaron Koren
 5+ * @file
 6+ * @ingroup SF
 7+ */
 8+
 9+class PSExtensionHandler {
 10+
 11+ public static function getDisplayColor() {
 12+ return 'white';
 13+ }
 14+
 15+ /**
 16+ * Creates an object to hold form-wide information, based on an XML
 17+ * object from the Page Schemas extension.
 18+ */
 19+ public static function createPageSchemasObject( $tagName, $xml ) {
 20+ return array();
 21+ }
 22+
 23+ public static function getSchemaDisplayValues( $schemaXML ) {
 24+ return null;
 25+ }
 26+
 27+ /**
 28+ * Displays form details for one template in the Page Schemas XML.
 29+ */
 30+ public static function getTemplateDisplayValues( $templateXML ) {
 31+ return null;
 32+ }
 33+
 34+ /**
 35+ * Displays data on a single form input in the Page Schemas XML.
 36+ */
 37+ public static function getFieldDisplayValues( $fieldXML ) {
 38+ return null;
 39+ }
 40+
 41+ /**
 42+ * Creates Page Schemas XML for form-wide information.
 43+ */
 44+ public static function getSchemaXML() {
 45+ return null;
 46+ }
 47+
 48+ /**
 49+ * Creates Page Schemas XML for form information on templates.
 50+ */
 51+ public static function getTemplateXML() {
 52+ return null;
 53+ }
 54+
 55+ /**
 56+ * Creates Page Schemas XML for form fields.
 57+ */
 58+ public static function getFieldXML() {
 59+ return null;
 60+ }
 61+
 62+ public static function getSchemaDisplayString() {
 63+ return null;
 64+ }
 65+
 66+ public static function getSchemaEditingHTML( $pageSchema ) {
 67+ return null;
 68+ }
 69+
 70+ public static function getTemplateDisplayString() {
 71+ return null;
 72+ }
 73+
 74+ public static function getTemplateEditingHTML( $psTemplate ) {
 75+ return null;
 76+ }
 77+
 78+ public static function getFieldDisplayString() {
 79+ return null;
 80+ }
 81+
 82+ /**
 83+ * Returns the HTML for inputs to define a single form field,
 84+ * within the Page Schemas 'edit schema' page.
 85+ */
 86+ public static function getFieldEditingHTML( $psField ) {
 87+ return null;
 88+ }
 89+
 90+ public static function getFieldInfo( $psTemplate ) {
 91+ return null;
 92+ }
 93+
 94+ /**
 95+ * Return the list of pages that Semantic Forms could generate from
 96+ * the current Page Schemas schema.
 97+ */
 98+ public static function getPagesToGenerate( $psSchemaObj ) {
 99+ return array();
 100+ }
 101+
 102+ /**
 103+ * Generate pages (form and templates) specified in the list.
 104+ */
 105+ public static function generatePages( $psSchemaObj, $selectedPages ) {
 106+ }
 107+}
Index: trunk/extensions/PageSchemas/PageSchemas.classes.php
@@ -134,7 +134,7 @@
135135 // TODO - this should be a non-static method of the PSSchema class,
136136 // instead of taking in XML.
137137 static function displaySchema( $schemaXML ) {
138 - global $wgTitle;
 138+ global $wgTitle, $wgPageSchemasHandlerClasses;
139139
140140 if ( $wgTitle->getNamespace() != NS_CATEGORY ) {
141141 return '';
@@ -143,10 +143,13 @@
144144 $name = $schemaXML->attributes()->name;
145145 $text .= self::tableRowHTML( 'pageSchemaHeader', 'Page schema' );
146146
147 - $displayInfoFromExtensions = array();
148 - wfRunHooks( 'PageSchemasGetSchemaDisplayInfo', array( $schemaXML, &$displayInfoFromExtensions ) );
149 - foreach ( $displayInfoFromExtensions as $displayInfo ) {
150 - list( $label, $elementName, $bgColor, $values ) = $displayInfo;
 147+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 148+ list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getSchemaDisplayValues' ), $schemaXML );
 149+ if ( is_null( $elementName ) ) {
 150+ continue;
 151+ }
 152+ $label = call_user_func( array( $psHandlerClass, 'getSchemaDisplayString' ) );
 153+ $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
151154 $text .= self::tableRowHTML( 'schemaExtensionRow', $label, $elementName, $bgColor );
152155 foreach ( $values as $fieldName => $value ) {
153156 $text .= self::attrRowHTML( 'schemaAttrRow', $fieldName, $value );
@@ -162,6 +165,8 @@
163166 }
164167
165168 static function displayTemplate ( $templateXML ) {
 169+ global $wgPageSchemasHandlerClasses;
 170+
166171 $name = $templateXML->attributes()->name;
167172 $text = self::tableRowHTML( 'templateRow', 'Template', $name );
168173 $multiple = $templateXML->attributes()->multiple;
@@ -169,10 +174,13 @@
170175 $text .= self::attrRowHTML( 'schemaAttrRow', 'multiple', null );
171176 }
172177
173 - $displayInfoFromExtensions = array();
174 - wfRunHooks( 'PageSchemasGetTemplateDisplayInfo', array( $templateXML, &$displayInfoFromExtensions ) );
175 - foreach( $displayInfoFromExtensions as $displayInfo ) {
176 - list( $label, $elementName, $bgColor, $values ) = $displayInfo;
 178+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 179+ list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getTemplateDisplayValues' ), $templateXML );
 180+ if ( is_null( $elementName ) ) {
 181+ continue;
 182+ }
 183+ $label = call_user_func( array( $psHandlerClass, 'getTemplateDisplayString' ) );
 184+ $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
177185 $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor );
178186 foreach ( $values as $fieldName => $value ) {
179187 $text .= self::attrRowHTML( 'fieldAttrRow', $fieldName, $value );
@@ -185,6 +193,8 @@
186194 }
187195
188196 static function displayField ( $fieldXML ) {
 197+ global $wgPageSchemasHandlerClasses;
 198+
189199 $name = $fieldXML->attributes()->name;
190200 $text = self::tableRowHTML( 'fieldRow', 'Field', $name );
191201
@@ -197,12 +207,15 @@
198208 }
199209 }
200210
201 - // Let extensions that store data within the Page Schemas XML each
202 - // handle displaying their data, by adding to this array.
203 - $displayInfoFromExtensions = array();
204 - wfRunHooks( 'PageSchemasGetFieldDisplayInfo', array( $fieldXML, &$displayInfoFromExtensions ) );
205 - foreach( $displayInfoFromExtensions as $displayInfo ) {
206 - list( $label, $elementName, $bgColor, $values ) = $displayInfo;
 211+ // Let extensions that store data within the Page Schemas XML
 212+ // each handle displaying their data, by adding to this array.
 213+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 214+ list( $elementName, $values ) = call_user_func( array( $psHandlerClass, 'getFieldDisplayValues' ), $fieldXML );
 215+ if ( is_null( $elementName ) ) {
 216+ continue;
 217+ }
 218+ $label = call_user_func( array( $psHandlerClass, 'getFieldDisplayString' ) );
 219+ $bgColor = call_user_func( array( $psHandlerClass, 'getDisplayColor' ) );
207220 $text .= self::tableRowHTML( 'fieldExtensionRow', $label, $elementName, $bgColor );
208221 foreach ( $values as $fieldName => $value ) {
209222 $text .= self::attrRowHTML( 'fieldAttrRow', $fieldName, $value );
@@ -210,6 +223,15 @@
211224 }
212225 return $text;
213226 }
 227+
 228+ public static function getValueFromObject( $object, $key ) {
 229+ if ( is_null( $object ) ) {
 230+ return null;
 231+ } elseif ( !array_key_exists( $key, $object ) ) {
 232+ return null;
 233+ }
 234+ return $object[$key];
 235+ }
214236 }
215237
216238 /**
@@ -245,7 +267,7 @@
246268 // retrieve the third attribute, which is pp_value
247269 $pageXMLstr = $row[2];
248270 $this->mPageXML = simplexml_load_string ( $pageXMLstr );
249 - /* index for template objects */
 271+ // index for template objects
250272 $i = 0;
251273 $inherited_templates = array();
252274 foreach ( $this->mPageXML->children() as $tag => $child ) {
@@ -279,7 +301,10 @@
280302 * Generates all pages selected by the user, based on the Page Schemas XML.
281303 */
282304 public function generateAllPages ( $selectedPageList ) {
283 - wfRunHooks( 'PageSchemasGeneratePages', array( $this, $selectedPageList ));
 305+ global $wgPageSchemasHandlerClasses;
 306+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 307+ call_user_func( array( $psHandlerClass, 'generatePages' ), $this, $selectedPageList );
 308+ }
284309 }
285310
286311 public function getCategoryName() {
@@ -302,9 +327,14 @@
303328 }
304329
305330 public function getObject( $objectName ) {
306 - $object = array();
307 - wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->mPageXML, &$object ) );
308 - return $object;
 331+ global $wgPageSchemasHandlerClasses;
 332+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 333+ $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mPageXML );
 334+ if ( !is_null( $object ) ) {
 335+ return $object;
 336+ }
 337+ }
 338+ return null;
309339 }
310340 }
311341
@@ -320,14 +350,14 @@
321351 if( ((string) $templateXML->attributes()->multiple) == "multiple" ) {
322352 $this->mMultipleAllowed = true;
323353 }
324 - /*index for template objects */
 354+ // Index for template objects
325355 $i = 0 ;
326356 $inherited_fields = array();
327357 foreach ($templateXML->children() as $child) {
328358 if ( $child->getName() == 'InheritsFrom' ) {
329359 $schema_to_inherit = (string) $child->attributes()->schema;
330360 $template_to_inherit = (string) $child->attributes()->template;
331 - if( $schema_to_inherit !=null && $template_to_inherit != null ) {
 361+ if ( $schema_to_inherit != null && $template_to_inherit != null ) {
332362 $inheritedSchemaObj = new PSSchema( $schema_to_inherit );
333363 $inherited_templates = $inheritedSchemaObj->getTemplates();
334364 foreach( $inherited_templates as $inherited_template ) {
@@ -339,13 +369,13 @@
340370 } elseif ( $child->getName() == "Field" ) {
341371 $ignore = (string) $child->attributes()->ignore;
342372 if ( count($child->children()) > 0 ) { //@TODO :Can be dealt more efficiently
343 - $fieldObj = new PSTemplateField($child);
 373+ $fieldObj = new PSTemplateField( $child );
344374 $this->mFields[$i++]= $fieldObj;
345375 } elseif ( $ignore != "true" ) {
346376 // Code to add fields from inherited templates
347377 $field_name = (string) $child->attributes()->name;
348 - foreach( $inherited_fields as $inherited_field ) {
349 - if( $field_name == $inherited_field->getName() ){
 378+ foreach ( $inherited_fields as $inherited_field ) {
 379+ if ( $field_name == $inherited_field->getName() ) {
350380 $this->mFields[$i++]= $inherited_field;
351381 }
352382 }
@@ -354,25 +384,30 @@
355385 }
356386 }
357387
358 - function getName() {
 388+ public function getName() {
359389 return $this->mTemplateName;
360390 }
361391
362 - function getXML() {
 392+ public function getXML() {
363393 return $this->mTemplateXML;
364394 }
365395
366 - function isMultiple() {
 396+ public function isMultiple() {
367397 return $this->mMultipleAllowed;
368398 }
369399
370 - function getObject( $objectName ) {
371 - $object = array();
372 - wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->mTemplateXML, &$object ) );
373 - return $object;
 400+ public function getObject( $objectName ) {
 401+ global $wgPageSchemasHandlerClasses;
 402+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 403+ $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mTemplateXML );
 404+ if ( !empty( $object ) ) {
 405+ return $object;
 406+ }
 407+ }
 408+ return null;
374409 }
375410
376 - function getFields() {
 411+ public function getFields() {
377412 return $this->mFields;
378413 }
379414 }
@@ -400,25 +435,31 @@
401436 }
402437 }
403438
404 - public function getDelimiter(){
 439+ public function getDelimiter() {
405440 return $this->mDelimiter;
406441 }
407442
408 - public function getName(){
 443+ public function getName() {
409444 return $this->mFieldName;
410445 }
411446
412 - public function getLabel(){
 447+ public function getLabel() {
413448 return $this->mFieldLabel;
414449 }
415450
416 - public function isList(){
 451+ public function isList() {
417452 return $this->mIsList;
418453 }
419454
420455 public function getObject( $objectName ) {
421 - $object = array();
422 - wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->mFieldXML, &$object ) );
423 - return $object;
 456+ global $wgPageSchemasHandlerClasses;
 457+
 458+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 459+ $object = call_user_func( array( $psHandlerClass, 'createPageSchemasObject' ), $objectName, $this->mFieldXML );
 460+ if ( !is_null( $object ) ) {
 461+ return $object;
 462+ }
 463+ }
 464+ return null;
424465 }
425466 }
Index: trunk/extensions/PageSchemas/specials/PS_GeneratePages.php
@@ -14,7 +14,7 @@
1515 }
1616
1717 function execute( $category ) {
18 - global $wgRequest, $wgOut;
 18+ global $wgRequest, $wgOut, $wgPageSchemasHandlerClasses;
1919
2020 $this->setHeaders();
2121 $param = $wgRequest->getText('param');
@@ -48,7 +48,12 @@
4949 // This hook will set an array of strings, with each value
5050 // as a title of a page to be created.
5151 $pageList = array();
52 - wfRunHooks( 'PageSchemasGetPageList', array( $pageSchemaObj, &$pageList ) );
 52+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 53+ $pagesFromHandler = call_user_func( array( $psHandlerClass, "getPagesToGenerate" ), $pageSchemaObj );
 54+ foreach ( $pagesFromHandler as $page ) {
 55+ $pageList[] = $page;
 56+ }
 57+ }
5358 // SpecialPage::getSkin() was added in MW 1.18
5459 if ( is_callable( $this, 'getSkin' ) ) {
5560 $skin = $this->getSkin();
@@ -72,9 +77,9 @@
7378 /**
7479 * Creates all the pages that the user specified.
7580 */
76 - function generatePages( $categoryName, $toGenPageList ) {
 81+ function generatePages( $categoryName, $selectedPageList ) {
7782 $pageSchema = new PSSchema( $categoryName );
78 - $pageSchema->generateAllPages( $toGenPageList );
 83+ $pageSchema->generateAllPages( $selectedPageList );
7984 }
8085
8186 /**
Index: trunk/extensions/PageSchemas/specials/PS_EditSchema.php
@@ -33,6 +33,7 @@
3434 */
3535 static function pageSchemaXMLFromRequest() {
3636 global $wgRequest;
 37+ global $wgPageSchemasHandlerClasses;
3738
3839 // Generate the XML from the form elements.
3940 $psXML = '<PageSchema>';
@@ -45,10 +46,12 @@
4647 $schemaXMLFromExtensions = array();
4748 $templateXMLFromExtensions = array();
4849 $fieldXMLFromExtensions = array();
49 - wfRunHooks( 'PageSchemasGetSchemaXML', array( $wgRequest, &$schemaXMLFromExtensions ));
50 - wfRunHooks( 'PageSchemasGetTemplateXML', array( $wgRequest, &$templateXMLFromExtensions ));
51 - wfRunHooks( 'PageSchemasGetFieldXML', array( $wgRequest, &$fieldXMLFromExtensions ));
52 - foreach ( $schemaXMLFromExtensions as $extensionName => $xml ) {
 50+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 51+ $schemaXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'getSchemaXML' ) );
 52+ $templateXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'getTemplateXML' ) );
 53+ $fieldXMLFromExtensions[] = call_user_func( array( $psHandlerClass, 'getFieldXML' ) );
 54+ }
 55+ foreach ( $schemaXMLFromExtensions as $xml ) {
5356 if ( !empty( $xml ) ) {
5457 $psXML .= $xml;
5558 }
@@ -102,8 +105,7 @@
103106 }
104107 }
105108 $psXML .= '</PageSchema>';
106 - $psXML = self::prettyPrintXML( $psXML );
107 - return $psXML;
 109+ return self::prettyPrintXML( $psXML );
108110 }
109111
110112 /**
@@ -179,8 +181,8 @@
180182 /*
181183 * Returns the HTML for a form section coming from a specific extension.
182184 */
183 - static function printFieldHTMLForExtension( $valuesFromExtension ) {
184 - list( $label, $color, $html, $hasExistingValues ) = $valuesFromExtension;
 185+ static function printFieldHTMLForExtension( $valuesFromExtension, $label, $color ) {
 186+ list( $html, $hasExistingValues ) = $valuesFromExtension;
185187 return self::printFormSection( $label, $color, $html, null, $hasExistingValues );
186188 }
187189
@@ -188,7 +190,9 @@
189191 * Returns the HTML for a section of the form comprising one
190192 * template field.
191193 */
192 - static function printFieldSection( $field_xml = null, $pageSchemaField = null ) {
 194+ static function printFieldSection( $field_xml = null, $psField = null ) {
 195+ global $wgPageSchemasHandlerClasses;
 196+
193197 if ( is_null( $field_xml ) ) {
194198 $fieldNum = 'fnum';
195199 } else {
@@ -221,9 +225,9 @@
222226 }
223227 }
224228 $fieldHTML = wfMsg( 'ps-namelabel' ) . ' ';
225 - $fieldHTML .= Html::input( 'f_name_' . $fieldNum, $fieldName, 'text', array( 'size' => 15 ) ) . ' ';
 229+ $fieldHTML .= Html::input( 'f_name_' . $fieldNum, $fieldName, 'text', array( 'size' => 25 ) ) . ' ';
226230 $fieldHTML .= wfMsg( 'ps-displaylabel' ) . ' ';
227 - $fieldHTML .= Html::input( 'f_label_' . $fieldNum, $fieldLabel, 'text', array( 'size' => 15 ) );
 231+ $fieldHTML .= Html::input( 'f_label_' . $fieldNum, $fieldLabel, 'text', array( 'size' => 25 ) );
228232 $fieldHTML = Html::rawElement( 'p', null, $fieldHTML ) . "\n";
229233 $fieldIsListInput = Html::input( 'f_is_list_' . $fieldNum, null, 'checkbox', $isListAttrs );
230234 $fieldHTML .= Html::rawElement( 'p', null, $fieldIsListInput . ' ' . wfMsg( 'ps-field-list-label' ) );
@@ -231,10 +235,14 @@
232236 $fieldHTML .= "\n" . Html::rawElement( 'p', $delimiterAttrs, wfMsg( 'ps-delimiter-label' ) . ' ' . $fieldDelimiterInput );
233237
234238 // Insert HTML text from extensions
235 - $htmlFromExtensions = array();
236 - wfRunHooks( 'PageSchemasGetFieldHTML', array( $pageSchemaField, &$htmlFromExtensions ) );
237 - foreach ( $htmlFromExtensions as $valuesFromExtension ) {
238 - $html = self::printFieldHTMLForExtension( $valuesFromExtension );
 239+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 240+ $valuesFromExtension = call_user_func( array( $psHandlerClass, "getFieldEditingHTML" ), $psField );
 241+ if ( is_null( $valuesFromExtension ) ) {
 242+ continue;
 243+ }
 244+ $label = call_user_func( array( $psHandlerClass, "getFieldDisplayString" ) );
 245+ $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) );
 246+ $html = self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color );
239247 // We use 'num' here, instead of 'fnum', to distinguish
240248 // between field names from Page Schemas (which get
241249 // their number set via Javascript) and field names from
@@ -259,6 +267,8 @@
260268 * Returns the HTML for a section of the form comprising one template.
261269 */
262270 static function printTemplateSection( $template_num = 'tnum', $templateXML = null, $psTemplate = null ) {
 271+ global $wgPageSchemasHandlerClasses;
 272+
263273 if ( is_null( $psTemplate ) ) {
264274 $psTemplateFields = array();
265275 } else {
@@ -293,10 +303,14 @@
294304 }
295305 */
296306
297 - $htmlForTemplate = array();
298 - wfRunHooks( 'PageSchemasGetTemplateHTML', array( $psTemplate, &$htmlForTemplate ) );
299 - foreach ( $htmlForTemplate as $valuesFromExtension ) {
300 - $html = self::printFieldHTMLForExtension( $valuesFromExtension );
 307+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 308+ $valuesFromExtension = call_user_func( array( $psHandlerClass, "getTemplateEditingHTML" ), $psTemplate );
 309+ if ( is_null( $valuesFromExtension ) ) {
 310+ continue;
 311+ }
 312+ $label = call_user_func( array( $psHandlerClass, "getTemplateDisplayString" ) );
 313+ $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) );
 314+ $html = self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color );
301315 $templateHTML .= str_replace( 'num', $template_num, $html );
302316 }
303317
@@ -338,8 +352,7 @@
339353 * Returns the HTML to display an entire form.
340354 */
341355 static function printForm( $pageSchemaObj = null, $pageXML = null ) {
342 - $htmlForSchema = array();
343 - wfRunHooks( 'PageSchemasGetSchemaHTML', array( $pageSchemaObj, &$htmlForSchema ) );
 356+ global $wgPageSchemasHandlerClasses;
344357
345358 if ( is_null( $pageSchemaObj ) ) {
346359 $psTemplates = array();
@@ -367,8 +380,15 @@
368381 $additionalXMLInput = "\n\t\t\t\t" . Html::textarea( 'ps_add_xml', $ps_add_xml, array( 'rows' => 4, 'style' => 'width: 100%;' ) );
369382 $text .= '<p>' . wfMsg('ps-add-xml-label') . $additionalXMLInput . "\n</p>";
370383
371 - foreach ( $htmlForSchema as $valuesFromExtension ) {
372 - $text .= self::printFieldHTMLForExtension( $valuesFromExtension );
 384+ foreach ( $wgPageSchemasHandlerClasses as $psHandlerClass ) {
 385+ $valuesFromExtension = call_user_func( array( $psHandlerClass, "getSchemaEditingHTML" ), $pageSchemaObj );
 386+ if ( is_null( $valuesFromExtension ) ) {
 387+ continue;
 388+ }
 389+ $label = call_user_func( array( $psHandlerClass, "getSchemaDisplayString" ) );
 390+ $color = call_user_func( array( $psHandlerClass, "getDisplayColor" ) );
 391+ $html = self::printFieldHTMLForExtension( $valuesFromExtension, $label, $color );
 392+ $text .= str_replace( 'num', $fieldNum, $html );
373393 }
374394
375395 $text .= '<div id="templatesList">' . "\n";
Index: trunk/extensions/PageSchemas/PageSchemas.php
@@ -35,11 +35,11 @@
3636 // Internationalization
3737 $wgExtensionMessagesFiles['PageSchemas'] = $dir . 'PageSchemas.i18n.php';
3838
39 -//Job classes
 39+// Job classes
4040 $wgJobClasses['pageSchemasCreatePage'] = 'PSCreatePageJob';
4141 $wgAutoloadClasses['PSCreatePageJob'] = $dir . 'PS_CreatePageJob.php';
4242
43 -// Register auto load for the special page class
 43+// Register page classes
4444 $wgAutoloadClasses['PageSchemasHooks'] = $dir . 'PageSchemas.hooks.php';
4545 $wgAutoloadClasses['PageSchemas'] = $dir . 'PageSchemas.classes.php';
4646 $wgAutoloadClasses['PSSchema'] = $dir . 'PageSchemas.classes.php';
@@ -47,7 +47,9 @@
4848 $wgAutoloadClasses['PSGeneratePages'] = $dir . 'specials/PS_GeneratePages.php';
4949 $wgAutoloadClasses['PSEditSchema'] = $dir . 'specials/PS_EditSchema.php';
5050 $wgAutoloadClasses['PSTabs'] = $dir . 'PS_Tabs.php';
51 -// registering Special page
 51+$wgAutoloadClasses['PSExtensionHandler'] = $dir . 'PS_ExtensionHandler.php';
 52+
 53+// Register special pages
5254 $wgSpecialPages['GeneratePages'] = 'PSGeneratePages';
5355 $wgSpecialPages['EditSchema'] = 'PSEditSchema';
5456 $wgSpecialPageGroups['GeneratePages'] = 'other';
@@ -83,3 +85,4 @@
8486
8587 // Page Schemas global variables
8688 $wgPageSchemasFieldNum = 0;
 89+$wgPageSchemasHandlerClasses = array();

Follow-up revisions

RevisionCommit summaryAuthorDate
r100205Fix for r100006 - fixed handling of schema elements that have no nameyaron02:47, 19 October 2011

Status & tagging log