Index: modules/block/block.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.css,v
retrieving revision 1.4
diff -u -r1.4 block.css
--- modules/block/block.css 5 Oct 2007 09:35:09 -0000 1.4
+++ modules/block/block.css 9 Oct 2007 19:56:14 -0000
@@ -13,7 +13,7 @@
padding: 3px;
}
#blocks select {
- margin-right: 18px; /* LTR */
+ margin-right: 24px; /* LTR */
}
#blocks select.progress-disabled {
margin-right: 0px; /* LTR */
@@ -21,18 +21,3 @@
#blocks tr.ahah-new-content {
background-color: #ffd;
}
-#blocks .progress {
- width: 15px;
- height: 15px;
- margin: -2px 0;
-}
-#blocks .progress .bar {
- width: 15px;
- height: 15px;
- background: transparent url(../../misc/throbber.gif) no-repeat 0px -18px;
- border: none;
- float: left; /* LTR */
-}
-#blocks .progress .message {
- display: none;
-}
Index: modules/block/block-rtl.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block-rtl.css,v
retrieving revision 1.2
diff -u -r1.2 block-rtl.css
--- modules/block/block-rtl.css 5 Oct 2007 09:35:09 -0000 1.2
+++ modules/block/block-rtl.css 9 Oct 2007 19:56:14 -0000
@@ -5,7 +5,7 @@
padding-right: 1.5em;
}
#blocks select {
- margin-left: 18px;
+ margin-left: 24px;
}
#blocks select.progress-disabled {
margin-left: 0px;
Index: misc/ahah.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/ahah.js,v
retrieving revision 1.3
diff -u -r1.3 ahah.js
--- misc/ahah.js 5 Oct 2007 09:35:08 -0000 1.3
+++ misc/ahah.js 9 Oct 2007 19:56:14 -0000
@@ -42,6 +42,7 @@
this.wrapper = '#'+ element_settings.wrapper;
this.effect = element_settings.effect;
this.method = element_settings.method;
+ this.progress = element_settings.progress;
if (this.effect == 'none') {
this.showEffect = 'show';
this.hideEffect = 'hide';
@@ -100,12 +101,29 @@
* Handler for the form redirection submission.
*/
Drupal.ahah.prototype.beforeSubmit = function (form_values, element, options) {
- // Insert progressbar and stretch to take the same space.
- this.progress = new Drupal.progressBar('ahah_progress');
- this.progress.setProgress(-1, Drupal.t('Please wait...'));
+ // Disable the element that received the change.
+ $(this.element).addClass('progress-disabled').attr('disabled', true);
- var progress_element = $(this.progress.element).addClass('ahah-progress');
- $(this.element).addClass('progress-disabled').attr('disabled', true).after(progress_element);
+ // Insert progressbar or throbber.
+ if (this.progress.type == 'bar') {
+ var progressBar = new Drupal.progressBar('ahah-progress-' + this.element.id, eval(this.progress.update_callback), this.progress.method, eval(this.progress.error_callback));
+ if (this.progress.message) {
+ progressBar.setProgress(-1, this.progress.message);
+ }
+ if (this.progress.url) {
+ progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
+ }
+ this.progress.element = $(progressBar.element).addClass('ahah-progress ahah-progress-bar');
+ this.progress.object = progressBar;
+ $(this.element).after(this.progress.element);
+ }
+ else if (this.progress.type == 'throbber') {
+ this.progress.element = $('
');
+ if (this.progress.message) {
+ $('.throbber', this.progress.element).after('' + this.progress.message + '
')
+ }
+ $(this.element).after(this.progress.element);
+ }
};
/**
@@ -114,7 +132,6 @@
Drupal.ahah.prototype.success = function (response, status) {
var wrapper = $(this.wrapper);
var form = $(this.element).parents('form');
- var progress_element = $(this.progress.element);
// Manually insert HTML into the jQuery object, using $() directly crashes
// Safari with long string lengths. http://dev.jquery.com/ticket/1152
var new_content = $('').html(response.data);
@@ -125,13 +142,13 @@
this.form_encattr ? form.attr('target', this.form_encattr) : form.removeAttr('encattr');
// Remove the progress element.
- progress_element.remove();
- $(this.element).removeClass('progess-disabled').attr('disabled', false);
-
- // Hide the new content before adding to page.
- if (this.showEffect != 'show') {
- new_content.hide();
+ if (this.progress.element) {
+ $(this.progress.element).remove();
+ }
+ if (this.progress.object) {
+ this.progress.object.stopMonitoring();
}
+ $(this.element).removeClass('progress-disabled').attr('disabled', false);
// Add the new content to the page.
Drupal.freezeHeight();
@@ -142,10 +159,18 @@
wrapper[this.method](new_content);
}
+ // Immediately hide the new content if we're using any effects.
+ if (this.showEffect != 'show') {
+ new_content.hide();
+ }
+
// Determine what effect use and what content will receive the effect, then
// show the new content. For browser compatibility, Safari is excluded from
// using effects on table rows.
- if ($('.ahah-new-content', new_content).size() > 0 && !($.browser.safari && $("tr.ahah-new-content", new_content).size() > 0)) {
+ if (($.browser.safari && $("tr.ahah-new-content", new_content).size() > 0)) {
+ new_content.show();
+ }
+ else if ($('.ahah-new-content', new_content).size() > 0) {
$('.ahah-new-content', new_content).hide();
new_content.show();
$(".ahah-new-content", new_content)[this.showEffect](this.showSpeed);
@@ -170,9 +195,13 @@
alert(Drupal.t('An error occurred:\n\n@error', { '@error': error }));
// Resore the previous action and target to the form.
element.parent('form').attr( { action: this.form_action, target: this.form_target} );
- // Remove progressbar.
- $(this.progress.element).remove();
- this.progress = null;
+ // Remove the progress element.
+ if (this.progress.element) {
+ $(this.progress.element).remove();
+ }
+ if (this.progress.object) {
+ this.progress.object.stopMonitoring();
+ }
// Undo hide.
$(this.wrapper).show();
// Re-enable the element.
Index: modules/system/system-rtl.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system-rtl.css,v
retrieving revision 1.4
diff -u -r1.4 system-rtl.css
--- modules/system/system-rtl.css 5 Oct 2007 09:35:09 -0000 1.4
+++ modules/system/system-rtl.css 9 Oct 2007 19:56:14 -0000
@@ -89,6 +89,9 @@
.ahah-progress {
float: right;
}
+.ahah-progress .throbber {
+ float: right;
+}
input.password-field {
margin-left: 10px;
margin-right: inherit;
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.35
diff -u -r1.35 system.css
--- modules/system/system.css 5 Oct 2007 09:35:09 -0000 1.35
+++ modules/system/system.css 9 Oct 2007 19:56:14 -0000
@@ -418,9 +418,8 @@
.progress .bar {
background: #fff url(../../misc/progress.gif);
border: 1px solid #00375a;
- width: 5em;
height: 1.5em;
- margin: 0.2em 0 0 0.2em;
+ margin: 0 0.2em;
}
.progress .filled {
background: #0072b9;
@@ -437,6 +436,19 @@
.ahah-progress {
float: left; /* LTR */
}
+.ahah-progress .throbber {
+ width: 15px;
+ height: 15px;
+ margin: 2px;
+ background: transparent url(../../misc/throbber.gif) no-repeat 0px -18px;
+ float: left; /* LTR */
+}
+tr .ahah-progress .throbber {
+ margin: 0 2px;
+}
+.ahah-progress-bar {
+ width: 16em;
+}
/*
** Formatting for welcome page
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.228
diff -u -r1.228 form.inc
--- includes/form.inc 5 Oct 2007 09:35:08 -0000 1.228
+++ includes/form.inc 9 Oct 2007 19:56:14 -0000
@@ -1616,7 +1616,6 @@
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 @@
'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;
Index: modules/upload/upload.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/upload/upload.module,v
retrieving revision 1.183
diff -u -r1.183 upload.module
--- modules/upload/upload.module 5 Oct 2007 09:35:09 -0000 1.183
+++ modules/upload/upload.module 9 Oct 2007 19:56:15 -0000
@@ -502,6 +502,7 @@
'#ahah' => array(
'path' => 'upload/js',
'wrapper' => 'attach-wrapper',
+ 'progress' => array('type' => 'bar', 'message' => t('Please wait...')),
),
'#submit' => array('node_form_submit_build_node'),
);