r100892 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100891‎ | r100892 | r100893 >
Date:22:46, 26 October 2011
Author:yaron
Status:deferred
Tags:
Comment:
Various fixes
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_PageSchemas.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_PageSchemas.php
@@ -157,14 +157,14 @@
158158 return $xmlPerField;
159159 }
160160
 161+ public static function getDisplayColor() {
 162+ return '#CF9';
 163+ }
 164+
161165 public static function getSchemaDisplayString() {
162166 return 'Form';
163167 }
164168
165 - public static function getDisplayColor() {
166 - return '#CF9';
167 - }
168 -
169169 public static function getSchemaEditingHTML( $pageSchemaObj ) {
170170 $form_array = array();
171171 $hasExistingValues = false;
@@ -301,7 +301,25 @@
302302 }
303303
304304 public static function getMainFormInfo( $pageSchemaObj ) {
305 - return $pageSchemaObj->getObject( 'semanticforms_Form' );
 305+ //return $pageSchemaObj->getObject( 'semanticforms_Form' );
 306+ // We don't just call getObject() here, because sometimes, for
 307+ // some reason, this gets called before SF registers itself
 308+ // with Page Schemas, which means that getObject() would return
 309+ // null. Instead, we directly call the code that would have
 310+ // been called.
 311+ $xml = $pageSchemaObj->getXML();
 312+ foreach ( $xml->children() as $tag => $child ) {
 313+ if ( $tag == "semanticforms_Form" ) {
 314+ $sfarray = array();
 315+ $formName = (string)$child->attributes()->name;
 316+ $sfarray['name'] = $formName;
 317+ foreach ( $child->children() as $tag => $formelem ) {
 318+ $sfarray[$tag] = (string)$formelem;
 319+ }
 320+ return $sfarray;
 321+ }
 322+ }
 323+ return array();
306324 }
307325
308326 public static function getFormFieldInfo( $psTemplate, $template_fields ) {
@@ -465,8 +483,6 @@
466484 );
467485 $form_templates[] = $form_template;
468486 }
469 - //print_r($form_templates);
470 - //die;
471487 Job::batchInsert( $jobs );
472488
473489 // Create form, if it's specified.
@@ -544,7 +560,7 @@
545561 /**
546562 * Displays data on a single form input in the Page Schemas XML.
547563 */
548 - public static function getFieldDisplayInfo( $fieldXML ) {
 564+ public static function getFieldDisplayValues( $fieldXML ) {
549565 foreach ( $fieldXML->children() as $tag => $child ) {
550566 if ( $tag == "semanticforms_FormInput" ) {
551567 $inputName = $child->attributes()->name;