r93057 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93056‎ | r93057 | r93058 >
Date:16:24, 25 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Switched to using methods, instead of fields, for classes SFTemplateField, SFFormField and SFForm
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -180,7 +180,7 @@
181181 $input_type = $wgRequest->getVal( "input_type_" . $old_i . "_" . $j );
182182 if ( $input_type == 'hidden' ) {
183183 $field->template_field->setInputType( $input_type );
184 - $field->is_hidden = true;
 184+ $field->setIsHidden( true );
185185 } elseif ( substr( $input_type, 0, 1 ) == '.' ) {
186186 // It's the default input type -
187187 // don't do anything.
Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -1446,16 +1446,16 @@
14471447 // (type is SFTemplateField, instead of SFFormField)
14481448 $template_field = $form_field->getTemplateField();
14491449
1450 - if ( $form_field->is_hidden ) {
 1450+ if ( $form_field->isHidden() ) {
14511451 $text = SFFormUtils::hiddenFieldHTML( $form_field->input_name, $cur_value );
14521452 } elseif ( $form_field->getInputType() != '' &&
14531453 array_key_exists( $form_field->getInputType(), $this->mInputTypeHooks ) &&
14541454 $this->mInputTypeHooks[$form_field->getInputType()] != null ) {
14551455 $funcArgs = array();
14561456 $funcArgs[] = $cur_value;
1457 - $funcArgs[] = $form_field->input_name;
1458 - $funcArgs[] = $form_field->is_mandatory;
1459 - $funcArgs[] = $form_field->is_disabled;
 1457+ $funcArgs[] = $form_field->getInputName();
 1458+ $funcArgs[] = $form_field->isMandatory();
 1459+ $funcArgs[] = $form_field->isDisabled();
14601460 // last argument to function should be a hash, merging the default
14611461 // values for this input type with all other properties set in
14621462 // the form definition, plus some semantic-related arguments
@@ -1465,15 +1465,15 @@
14661466 $text = call_user_func_array( $hook_values[0], $funcArgs );
14671467 } else { // input type not defined in form
14681468 $property_type = $template_field->getPropertyType();
1469 - $is_list = ( $form_field->is_list || $template_field->getIsList() );
 1469+ $is_list = ( $form_field->isList() || $template_field->isList() );
14701470 if ( $property_type != '' &&
14711471 array_key_exists( $property_type, $this->mSemanticTypeHooks ) &&
14721472 isset( $this->mSemanticTypeHooks[$property_type][$is_list] ) ) {
14731473 $funcArgs = array();
14741474 $funcArgs[] = $cur_value;
1475 - $funcArgs[] = $form_field->input_name;
1476 - $funcArgs[] = $form_field->is_mandatory;
1477 - $funcArgs[] = $form_field->is_disabled;
 1475+ $funcArgs[] = $form_field->getInputName();
 1476+ $funcArgs[] = $form_field->isMandatory();
 1477+ $funcArgs[] = $form_field->isDisabled();
14781478 $hook_values = $this->mSemanticTypeHooks[$property_type][$is_list];
14791479 $other_args = $form_field->getArgumentsForInputCall( $hook_values[1] );
14801480 $funcArgs[] = $other_args;
@@ -1481,12 +1481,12 @@
14821482 } else { // anything else
14831483 $other_args = $form_field->getArgumentsForInputCall();
14841484 // special call to ensure that a list input is the right default size
1485 - if ( $form_field->is_list ) {
 1485+ if ( $form_field->isList() ) {
14861486 if ( ! array_key_exists( 'size', $other_args ) ) {
14871487 $other_args['size'] = 100;
14881488 }
14891489 }
1490 - $text = SFTextInput::getHTML( $cur_value, $form_field->input_name, $form_field->is_mandatory, $form_field->is_disabled, $other_args );
 1490+ $text = SFTextInput::getHTML( $cur_value, $form_field->getInputName(), $form_field->isMandatory(), $form_field->isDisabled(), $other_args );
14911491 }
14921492 }
14931493 return $text;
Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -237,7 +237,7 @@
238238 $form->setPageNameFormula( $form_array['PageNameFormula'] );
239239 $form->setCreateTitle( $form_array['CreateTite'] );
240240 $form->setEditTitle( $form_array['EditTitle'] );
241 - $title = Title::makeTitleSafe( SF_NS_FORM, $form->mFormName );
 241+ $title = Title::makeTitleSafe( SF_NS_FORM, $form->getFormName() );
242242 $key_title = PageSchemas::titleString( $title );
243243 if( in_array($key_title, $toGenPageList )){
244244 $full_text = $form->createMarkup();