summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc16
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;