r78343 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78342‎ | r78343 | r78344 >
Date:23:39, 13 December 2010
Author:yaron
Status:deferred
Tags:
Comment:
Replaced $sfgAutocompleteDataTypes global variable with new 'autocompletedatatype' HTML attribute
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.php
@@ -403,8 +403,6 @@
404404 $values = SFUtils::getAutocompleteValues($autocompletion_source, $autocomplete_field_type );
405405 $autocompletion_source = str_replace( "'", "\'", $autocompletion_source );
406406
407 - /*adding code for displaying dropdown of autocomplete values*/
408 -
409407 $divClass = "ui-widget";
410408 if ($is_mandatory) { $divClass .= " mandatory"; }
411409 $text =<<<END
@@ -447,7 +445,7 @@
448446 return SFDropdownInput::getText( $cur_value, $input_name, $is_mandatory, $is_disabled, $other_args );
449447
450448 global $sfgTabIndex, $sfgFieldNum, $sfgScriptPath, $wgJsMimeType, $smwgScriptPath, $smwgJqUIAutoIncluded;
451 - global $sfgAutocompleteDataTypes, $sfgAutocompleteValues;
 449+ global $sfgAutocompleteValues;
452450
453451 $className = ( $is_mandatory ) ? "autocompleteInput mandatoryField" : "autocompleteInput createboxInput";
454452 if ( array_key_exists( 'class', $other_args ) )
@@ -462,7 +460,7 @@
463461 }
464462 $input_id = "input_" . $sfgFieldNum;
465463
466 - // Set autocomplete-settings attribute, and delimiter value (it's needed
 464+ // Get all autocomplete-related values, plus delimiter value (it's needed
467465 // also for the 'uploadable' link, if there is one).
468466 $autocompleteSettings = $autocompletion_source;
469467 $is_list = ( array_key_exists( 'is_list', $other_args ) && $other_args['is_list'] == true );
@@ -477,6 +475,16 @@
478476 } else {
479477 $delimiter = null;
480478 }
 479+
 480+ $remoteDataType = null;
 481+ if ( array_key_exists( 'remote autocompletion', $other_args ) &&
 482+ $other_args['remote autocompletion'] == true ) {
 483+ $remoteDataType = $autocomplete_field_type;
 484+ } elseif ( $autocompletion_source != '' ) {
 485+ $autocomplete_values = SFUtils::getAutocompleteValues( $autocompletion_source, $autocomplete_field_type );
 486+ $sfgAutocompleteValues[$autocompleteSettings] = $autocomplete_values;
 487+ }
 488+
481489 if ( array_key_exists( 'input_type', $other_args ) && $other_args['input_type'] == "textarea" ) {
482490
483491 $rows = $other_args['rows'];
@@ -495,6 +503,9 @@
496504 'class' => $className,
497505 'autocompletesettings' => $autocompleteSettings,
498506 );
 507+ if ( !is_null( $remoteDataType ) ) {
 508+ $textarea_attrs['autocompletedatatype'] = $remoteDataType;
 509+ }
499510 if ( $is_disabled ) {
500511 $textarea_attrs['disabled'] = 'disabled';
501512 }
@@ -528,6 +539,9 @@
529540 'tabindex' => $sfgTabIndex,
530541 'autocompletesettings' => $autocompleteSettings,
531542 );
 543+ if ( !is_null( $remoteDataType ) ) {
 544+ $inputAttrs['autocompletedatatype'] = $remoteDataType;
 545+ }
532546 if ( $is_disabled ) {
533547 $inputAttrs['disabled'] = 'disabled';
534548 }
@@ -549,13 +563,6 @@
550564 if ( $is_mandatory ) { $spanClass .= " mandatoryFieldSpan"; }
551565 $text = "\n" . Xml::tags( 'span', array( 'class' => $spanClass ), $text );
552566
553 - if ( array_key_exists( 'remote autocompletion', $other_args ) &&
554 - $other_args['remote autocompletion'] == true ) {
555 - $sfgAutocompleteDataTypes[$autocompleteSettings] = $autocomplete_field_type;
556 - } elseif ( $autocompletion_source != '' ) {
557 - $autocomplete_values = SFUtils::getAutocompleteValues( $autocompletion_source, $autocomplete_field_type );
558 - $sfgAutocompleteValues[$autocompleteSettings] = $autocomplete_values;
559 - }
560567 return $text;
561568 }
562569

Status & tagging log