r93044 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93043‎ | r93044 | r93045 >
Date:04:31, 25 July 2011
Author:yaron
Status:deferred
Tags:
Comment:
Updated for new structure of SFTemplateField and other classes
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_CreateClass.php (modified) (history)
  • /trunk/extensions/SemanticForms/specials/SF_CreateForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateForm.php
@@ -147,7 +147,7 @@
148148 // Now cycle through the templates and fields, modifying each
149149 // one per the query variables.
150150 foreach ( $form_templates as $i => $ft ) {
151 - foreach ( $ft->fields as $j => $field ) {
 151+ foreach ( $ft->getFields() as $j => $field ) {
152152 // handle the change in indexing if a new template was
153153 // inserted before the end, or one was deleted
154154 $old_i = $i;
@@ -175,17 +175,17 @@
176176 }
177177
178178 if ( $paramName == 'label' ) {
179 - $field->template_field->label = $value;
 179+ $field->template_field->setLabel( $value );
180180 } elseif ( $paramName == 'input type' ) {
181181 $input_type = $wgRequest->getVal( "input_type_" . $old_i . "_" . $j );
182182 if ( $input_type == 'hidden' ) {
183 - $field->template_field->input_type = $input_type;
 183+ $field->template_field->setInputType( $input_type );
184184 $field->is_hidden = true;
185185 } elseif ( substr( $input_type, 0, 1 ) == '.' ) {
186186 // It's the default input type -
187187 // don't do anything.
188188 } else {
189 - $field->template_field->input_type = $input_type;
 189+ $field->template_field->setInputType( $input_type );
190190 }
191191 } else {
192192 if ( ! empty( $value ) ) {
@@ -206,12 +206,12 @@
207207 $preview_page = $wgRequest->getCheck( 'wpPreview' );
208208 if ( $save_page || $preview_page ) {
209209 // Validate form name
210 - if ( $form->mFormName == "" ) {
 210+ if ( $form->getFormName() == "" ) {
211211 $form_name_error_str = wfMsg( 'sf_blank_error' );
212212 } else {
213213 // Redirect to wiki interface
214214 $wgOut->setArticleBodyOnly( true );
215 - $title = Title::makeTitleSafe( SF_NS_FORM, $form->mFormName );
 215+ $title = Title::makeTitleSafe( SF_NS_FORM, $form->getFormName() );
216216 $full_text = $form->createMarkup();
217217 $text = SFUtils::printRedirectForm( $title, $full_text, "", $save_page, $preview_page, false, false, false, null, null );
218218 $wgOut->addHTML( $text );
@@ -243,7 +243,7 @@
244244 $text .= $before_template_msg;
245245 $select_body = "";
246246 foreach ( $form_templates as $i => $ft ) {
247 - $select_body .= "\t" . Xml::element( 'option', array( 'value' => $i ), $ft->template_name ) . "\n";
 247+ $select_body .= "\t" . Xml::element( 'option', array( 'value' => $i ), $ft->getTemplateName() ) . "\n";
248248 }
249249 $final_index = count( $form_templates );
250250 $at_end_msg = wfMsg( 'sf_createform_atend' );
Index: trunk/extensions/SemanticForms/specials/SF_CreateClass.php
@@ -84,9 +84,7 @@
8585 $is_list = $wgRequest->getCheck( "is_list_$i" );
8686 // create an SFTemplateField based on these
8787 // values, and add it to the $fields array
88 - $field = SFTemplateField::create( $field_name, $field_name );
89 - $field->semantic_property = $property_name;
90 - $field->is_list = $is_list;
 88+ $field = SFTemplateField::create( $field_name, $field_name, $property_name, $is_list );
9189 $fields[] = $field;
9290
9391 // create the property, and make a job for it