diff options
author | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-10 10:24:25 +0000 |
---|---|---|
committer | Gábor Hojtsy <gabor@hojtsy.hu> | 2007-10-10 10:24:25 +0000 |
commit | 212c0484b9ffcd6b2c044f4539477b0d52be905f (patch) | |
tree | bc607db610587526663633d12f95cf14267eabc0 /includes | |
parent | c1e9256dcba4a1956082a2fcb780739a1c566cab (diff) | |
download | brdo-212c0484b9ffcd6b2c044f4539477b0d52be905f.tar.gz brdo-212c0484b9ffcd6b2c044f4539477b0d52be905f.tar.bz2 |
#181741 by quicksketch: fix AHAH throbber/progress bar issues and generalize progress display configuration to allow module developers to choose from the throbber and progress bar
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/includes/form.inc b/includes/form.inc index 3320b3e6a..87a0a762d 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -1616,7 +1616,6 @@ function form_expand_ahah($element) { if (isset($element['#ahah']['path']) && isset($element['#ahah']['event']) && !isset($js_added[$element['#id']])) { drupal_add_js('misc/jquery.form.js'); drupal_add_js('misc/ahah.js'); - drupal_add_js('misc/progress.js'); $ahah_binding = array( 'url' => url($element['#ahah']['path']), @@ -1625,8 +1624,23 @@ function form_expand_ahah($element) { 'selector' => empty($element['#ahah']['selector']) ? '#'. $element['#id'] : $element['#ahah']['selector'], 'effect' => empty($element['#ahah']['effect']) ? 'none' : $element['#ahah']['effect'], 'method' => empty($element['#ahah']['method']) ? 'replace' : $element['#ahah']['method'], + 'progress' => empty($element['#ahah']['progress']) ? array('type' => 'throbber') : $element['#ahah']['progress'], ); + // Convert a simple #ahah[progress] type string into an array. + if (is_string($ahah_binding['progress'])) { + $ahah_binding['progress'] = array('type' => $ahah_binding['progress']); + } + // Change progress path to a full url. + if (isset($ahah_binding['progress']['path'])) { + $ahah_binding['progress']['url'] = url($ahah_binding['progress']['path']); + } + + // Add progress.js if we're doing a bar display. + if ($ahah_binding['progress']['type'] == 'bar') { + drupal_add_js('misc/progress.js'); + } + drupal_add_js(array('ahah' => array($element['#id'] => $ahah_binding)), 'setting'); $js_added[$element['#id']] = TRUE; |