r112922 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112921‎ | r112922 | r112923 >
Date:22:09, 2 March 2012
Author:yaron
Status:deferred
Tags:
Comment:
Fix for bug with "values dependent on" if more than one field is dependent on the same base field
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormPrinter.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SemanticForms.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.php
@@ -852,7 +852,7 @@
853853 $possible_values = SFUtils::getAllPagesForNamespace( $sub_components[1] );
854854 } elseif ( $sub_components[0] == 'values dependent on' ) {
855855 global $sfgDependentFields;
856 - $sfgDependentFields[$sub_components[1]] = $fullFieldName;
 856+ $sfgDependentFields[] = array( $sub_components[1], $fullFieldName );
857857 } elseif ( $sub_components[0] == 'property' ) {
858858 $semantic_property = $sub_components[1];
859859 } elseif ( $sub_components[0] == 'default filename' ) {
Index: trunk/extensions/SemanticForms/libs/SemanticForms.js
@@ -945,15 +945,18 @@
946946
947947 nameAttr = partOfMultiple ? 'origName' : 'name';
948948 name = jQuery(this).attr(nameAttr);
949 - dependentField = sfgDependentFields[name];
950 - if ( dependentField != null ) {
951 - if ( partOfMultiple ) {
952 - jQuery(this).closest(".multipleTemplateInstance")
953 - .find('[origName="' + dependentField + '"]')
954 - .setDependentAutocompletion(dependentField, name, curValue);
955 - } else {
956 - jQuery('[name="' + dependentField + '"]')
957 - .setDependentAutocompletion(dependentField, name, curValue);
 949+ for ( var i in sfgDependentFields ) {
 950+ dependentFieldPair = sfgDependentFields[i];
 951+ if ( dependentFieldPair[0] == name ) {
 952+ dependentField = dependentFieldPair[1];
 953+ if ( partOfMultiple ) {
 954+ jQuery(this).closest(".multipleTemplateInstance")
 955+ .find('[origName="' + dependentField + '"]')
 956+ .setDependentAutocompletion(dependentField, name, curValue);
 957+ } else {
 958+ jQuery('[name="' + dependentField + '"]')
 959+ .setDependentAutocompletion(dependentField, name, curValue);
 960+ }
958961 }
959962 }
960963

Sign-offs

UserFlagDate
Nikerabbitinspected06:40, 5 March 2012