summaryrefslogtreecommitdiff
path: root/modules/file
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2010-07-10 00:03:37 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2010-07-10 00:03:37 +0000
commit0c993fd704dab80a845602a878bd612e9216b137 (patch)
tree67bb6773c148332592c1a9eb8a92bf4969bbaa3e /modules/file
parent28219f5999ba3bfc7aa2d5ad92159ef20825f42d (diff)
downloadbrdo-0c993fd704dab80a845602a878bd612e9216b137.tar.gz
brdo-0c993fd704dab80a845602a878bd612e9216b137.tar.bz2
#776956 by CrashTest_, Damien Tournoud, effulgentsia, chx: Fixed critical bug: Complex widgets are not respecting '#disabled' state.
Diffstat (limited to 'modules/file')
-rw-r--r--modules/file/file.js21
1 files changed, 11 insertions, 10 deletions
diff --git a/modules/file/file.js b/modules/file/file.js
index efea0ec07..7325229b3 100644
--- a/modules/file/file.js
+++ b/modules/file/file.js
@@ -92,17 +92,18 @@ Drupal.file = Drupal.file || {
$enabledFields = $(this).parents('div.form-managed-file').find('input.form-file');
}
- var $disabledFields = $('div.form-managed-file input.form-file').not($enabledFields);
-
- // Disable upload fields other than the one we're currently working with.
- $disabledFields.attr('disabled', 'disabled');
-
- // All the other mousedown handlers (like Drupal's AJAX behaviors) are
- // excuted before any timeout functions will be called, so this effectively
- // re-enables the file fields after other processing is complete even though
- // it is only a 1 second timeout.
+ // Temporarily disable upload fields other than the one we're currently
+ // working with. Filter out fields that are already disabled so that they
+ // do not get enabled when we re-enable these fields at the end of behavior
+ // processing. Re-enable in a setTimeout set to a relatively short amount
+ // of time (1 second). All the other mousedown handlers (like Drupal's AJAX
+ // behaviors) are excuted before any timeout functions are called, so we
+ // don't have to worry about the fields being re-enabled too soon.
+ // @todo If the previous sentence is true, why not set the timeout to 0?
+ var $fieldsToTemporarilyDisable = $('div.form-managed-file input.form-file').not($enabledFields).not(':disabled');
+ $fieldsToTemporarilyDisable.attr('disabled', 'disabled');
setTimeout(function (){
- $disabledFields.attr('disabled', '');
+ $fieldsToTemporarilyDisable.attr('disabled', '');
}, 1000);
},
/**