Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php |
— | — | @@ -14,10 +14,10 @@ |
15 | 15 | |
16 | 16 | class SFFormPrinter { |
17 | 17 | |
18 | | - var $mSemanticTypeHooks; |
19 | | - var $mInputTypeHooks; |
20 | | - var $standardInputsIncluded; |
21 | | - var $mPageTitle; |
| 18 | + public $mSemanticTypeHooks; |
| 19 | + public $mInputTypeHooks; |
| 20 | + public $standardInputsIncluded; |
| 21 | + public $mPageTitle; |
22 | 22 | |
23 | 23 | public function __construct() { |
24 | 24 | // Initialize variables. |
— | — | @@ -420,7 +420,6 @@ |
421 | 421 | $all_instances_printed = false; |
422 | 422 | $strict_parsing = false; |
423 | 423 | for ( $section_num = 0; $section_num < count( $form_def_sections ); $section_num++ ) { |
424 | | - $tif = new SFTemplateInForm(); |
425 | 424 | $start_position = 0; |
426 | 425 | $template_text = ""; |
427 | 426 | // the append is there to ensure that the original |
— | — | @@ -438,7 +437,7 @@ |
439 | 438 | if ( $tag_title == 'for template' ) { |
440 | 439 | $old_template_name = $template_name; |
441 | 440 | $template_name = trim( $tag_components[1] ); |
442 | | - $tif->template_name = $template_name; |
| 441 | + $tif = SFTemplateInForm::create( $template_name ); |
443 | 442 | $query_template_name = str_replace( ' ', '_', $template_name ); |
444 | 443 | $add_button_text = wfMsg( 'sf_formedit_addanother' ); |
445 | 444 | // Also replace periods with underlines, since that's what |
— | — | @@ -471,7 +470,7 @@ |
472 | 471 | $form_text .= "\t" . '<div class="multipleTemplateList">' . "\n"; |
473 | 472 | } |
474 | 473 | } |
475 | | - $template_text .= "{{" . $tif->template_name; |
| 474 | + $template_text .= "{{" . $template_name; |
476 | 475 | $all_fields = $tif->getAllFields(); |
477 | 476 | // remove template tag |
478 | 477 | $section = substr_replace( $section, '', $brackets_loc, $brackets_end_loc + 3 - $brackets_loc ); |
— | — | @@ -483,7 +482,7 @@ |
484 | 483 | if ( $source_is_page || $form_is_partial ) { |
485 | 484 | // Replace underlines with spaces in template name, to allow for |
486 | 485 | // searching on either. |
487 | | - $search_template_str = str_replace( '_', ' ', $tif->template_name ); |
| 486 | + $search_template_str = str_replace( '_', ' ', $template_name ); |
488 | 487 | $preg_match_template_str = str_replace( |
489 | 488 | array( '/', '(', ')' ), |
490 | 489 | array( '\/', '\(', '\)' ), |
— | — | @@ -1008,8 +1007,9 @@ |
1009 | 1008 | // SFFormField object, not the SFTemplateField object it contains; |
1010 | 1009 | // it seemed like too much work, though, to create an |
1011 | 1010 | // SFFormField::setSemanticProperty() function just for this call |
1012 | | - if ( $semantic_property != null ) |
1013 | | - $form_field->template_field->setSemanticProperty( $semantic_property ); |
| 1011 | + if ( $semantic_property != null ) { |
| 1012 | + $form_field->setSemanticProperty( $semantic_property ); |
| 1013 | + } |
1014 | 1014 | |
1015 | 1015 | // call hooks - unfortunately this has to be split into two |
1016 | 1016 | // separate calls, because of the different variable names in |
— | — | @@ -1035,7 +1035,7 @@ |
1036 | 1036 | ( $cur_value == '' || $cur_value == 'now' ) ) { |
1037 | 1037 | if ( $input_type == 'date' || $input_type == 'datetime' || |
1038 | 1038 | $input_type == 'year' || |
1039 | | - ( $input_type == '' && $form_field->template_field->property_type == '_dat' ) ) { |
| 1039 | + ( $input_type == '' && $form_field->getTemplateField()->getPropertyType() == '_dat' ) ) { |
1040 | 1040 | // Get current time, for the time zone specified in the wiki. |
1041 | 1041 | global $wgLocaltimezone; |
1042 | 1042 | if ( isset( $wgLocaltimezone ) ) { |
— | — | @@ -1442,15 +1442,15 @@ |
1443 | 1443 | * Create the HTML and Javascript to display this field within a form |
1444 | 1444 | */ |
1445 | 1445 | function formFieldHTML( $form_field, $cur_value ) { |
1446 | | - // also get the actual field, with all the semantic information (type is |
1447 | | - // SFTemplateField, instead of SFFormField) |
1448 | | - $template_field = $form_field->template_field; |
| 1446 | + // Also get the actual field, with all the semantic information |
| 1447 | + // (type is SFTemplateField, instead of SFFormField) |
| 1448 | + $template_field = $form_field->getTemplateField(); |
1449 | 1449 | |
1450 | 1450 | if ( $form_field->is_hidden ) { |
1451 | 1451 | $text = SFFormUtils::hiddenFieldHTML( $form_field->input_name, $cur_value ); |
1452 | | - } elseif ( $form_field->input_type != '' && |
1453 | | - array_key_exists( $form_field->input_type, $this->mInputTypeHooks ) && |
1454 | | - $this->mInputTypeHooks[$form_field->input_type] != null ) { |
| 1452 | + } elseif ( $form_field->getInputType() != '' && |
| 1453 | + array_key_exists( $form_field->getInputType(), $this->mInputTypeHooks ) && |
| 1454 | + $this->mInputTypeHooks[$form_field->getInputType()] != null ) { |
1455 | 1455 | $funcArgs = array(); |
1456 | 1456 | $funcArgs[] = $cur_value; |
1457 | 1457 | $funcArgs[] = $form_field->input_name; |
— | — | @@ -1459,13 +1459,13 @@ |
1460 | 1460 | // last argument to function should be a hash, merging the default |
1461 | 1461 | // values for this input type with all other properties set in |
1462 | 1462 | // the form definition, plus some semantic-related arguments |
1463 | | - $hook_values = $this->mInputTypeHooks[$form_field->input_type]; |
| 1463 | + $hook_values = $this->mInputTypeHooks[$form_field->getInputType()]; |
1464 | 1464 | $other_args = $form_field->getArgumentsForInputCall( $hook_values[1] ); |
1465 | 1465 | $funcArgs[] = $other_args; |
1466 | 1466 | $text = call_user_func_array( $hook_values[0], $funcArgs ); |
1467 | 1467 | } else { // input type not defined in form |
1468 | | - $property_type = $template_field->property_type; |
1469 | | - $is_list = ( $form_field->is_list || $template_field->is_list ); |
| 1468 | + $property_type = $template_field->getPropertyType(); |
| 1469 | + $is_list = ( $form_field->is_list || $template_field->getIsList() ); |
1470 | 1470 | if ( $property_type != '' && |
1471 | 1471 | array_key_exists( $property_type, $this->mSemanticTypeHooks ) && |
1472 | 1472 | isset( $this->mSemanticTypeHooks[$property_type][$is_list] ) ) { |