Commit c11cb4ec authored by Dries's avatar Dries

- Patch #120360 by nedjo: enable AJAX by making all behaviours reattachable.

parent a3d75e54
...@@ -61,6 +61,7 @@ Drupal 6.0, xxxx-xx-xx (development version) ...@@ -61,6 +61,7 @@ Drupal 6.0, xxxx-xx-xx (development version)
- Added support for configurable actions. - Added support for configurable actions.
- Made user profiles easier to theme by using array rendering and supplying template files. - Made user profiles easier to theme by using array rendering and supplying template files.
- Added Deletion API to allow modules to alter and respond to any delete operation. - Added Deletion API to allow modules to alter and respond to any delete operation.
- Added the Update status module to automatically check for available updates and warn sites if they are missing security updates or newer versions.
Drupal 5.0, 2007-01-15 Drupal 5.0, 2007-01-15
---------------------- ----------------------
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
/** /**
* Attaches the autocomplete behaviour to all required fields * Attaches the autocomplete behaviour to all required fields
*/ */
Drupal.autocompleteAutoAttach = function () { Drupal.behaviors.autocomplete = function (context) {
var acdb = []; var acdb = [];
$('input.autocomplete').each(function () { $('input.autocomplete:not(.autocomplete-processed)', context).each(function () {
var uri = this.value; var uri = this.value;
if (!acdb[uri]) { if (!acdb[uri]) {
acdb[uri] = new Drupal.ACDB(uri); acdb[uri] = new Drupal.ACDB(uri);
...@@ -14,6 +14,7 @@ Drupal.autocompleteAutoAttach = function () { ...@@ -14,6 +14,7 @@ Drupal.autocompleteAutoAttach = function () {
.attr('autocomplete', 'OFF')[0]; .attr('autocomplete', 'OFF')[0];
$(input.form).submit(Drupal.autocompleteSubmit); $(input.form).submit(Drupal.autocompleteSubmit);
new Drupal.jsAC(input, acdb[uri]); new Drupal.jsAC(input, acdb[uri]);
$(this).addClass('autocomplete-processed');
}); });
}; };
...@@ -296,8 +297,3 @@ Drupal.ACDB.prototype.cancel = function() { ...@@ -296,8 +297,3 @@ Drupal.ACDB.prototype.cancel = function() {
if (this.timer) clearTimeout(this.timer); if (this.timer) clearTimeout(this.timer);
this.searchString = ''; this.searchString = '';
}; };
// Global Killswitch
if (Drupal.jsEnabled) {
$(document).ready(Drupal.autocompleteAutoAttach);
}
if (Drupal.jsEnabled) { // $Id$
$(document).ready(function() {
$('#progress').each(function () {
var holder = this;
var uri = Drupal.settings.batch.uri;
var initMessage = Drupal.settings.batch.initMessage;
var errorMessage = Drupal.settings.batch.errorMessage;
// Success: redirect to the summary. /**
var updateCallback = function (progress, status, pb) { * Attaches the batch behaviour to progress bars.
if (progress == 100) { */
pb.stopMonitoring(); Drupal.behaviors.batch = function (context) {
window.location = uri+'&op=finished'; // This behavior attaches by ID, so is only valid once on a page.
} if ($('#progress.batch-processed').size()) {
}; return;
}
$('#progress', context).addClass('batch-processed').each(function () {
var holder = this;
var uri = Drupal.settings.batch.uri;
var initMessage = Drupal.settings.batch.initMessage;
var errorMessage = Drupal.settings.batch.errorMessage;
var errorCallback = function (pb) { // Success: redirect to the summary.
var div = document.createElement('p'); var updateCallback = function (progress, status, pb) {
div.className = 'error'; if (progress == 100) {
$(div).html(errorMessage); pb.stopMonitoring();
$(holder).prepend(div); window.location = uri+'&op=finished';
$('#wait').hide(); }
}; };
var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback); var errorCallback = function (pb) {
progress.setProgress(-1, initMessage); var div = document.createElement('p');
$(holder).append(progress.element); div.className = 'error';
progress.startMonitoring(uri+'&op=do', 10); $(div).html(errorMessage);
}); $(holder).prepend(div);
$('#wait').hide();
};
var progress = new Drupal.progressBar('updateprogress', updateCallback, "POST", errorCallback);
progress.setProgress(-1, initMessage);
$(holder).append(progress.element);
progress.startMonitoring(uri+'&op=do', 10);
}); });
} };
...@@ -20,10 +20,6 @@ Drupal.toggleFieldset = function(fieldset) { ...@@ -20,10 +20,6 @@ Drupal.toggleFieldset = function(fieldset) {
Drupal.collapseScrollIntoView(this.parentNode); Drupal.collapseScrollIntoView(this.parentNode);
} }
}); });
if (typeof(Drupal.textareaAttach) != 'undefined') {
// Initialize resizable textareas that are now revealed
Drupal.textareaAttach(null, fieldset);
}
} }
else { else {
var content = $('> div', fieldset).slideUp('medium', function() { var content = $('> div', fieldset).slideUp('medium', function() {
...@@ -50,19 +46,17 @@ Drupal.collapseScrollIntoView = function (node) { ...@@ -50,19 +46,17 @@ Drupal.collapseScrollIntoView = function (node) {
} }
}; };
// Global Killswitch Drupal.behaviors.collapse = function (context) {
if (Drupal.jsEnabled) { $('fieldset.collapsible > legend:not(.collapse-processed)', context).each(function() {
$(document).ready(function() { var fieldset = $(this.parentNode);
$('fieldset.collapsible > legend').each(function() { // Expand if there are errors inside
var fieldset = $(this.parentNode); if ($('input.error, textarea.error, select.error', fieldset).size() > 0) {
// Expand if there are errors inside fieldset.removeClass('collapsed');
if ($('input.error, textarea.error, select.error', fieldset).size() > 0) { }
fieldset.removeClass('collapsed');
}
// Turn the legend into a clickable link and wrap the contents of the fieldset // Turn the legend into a clickable link and wrap the contents of the fieldset
// in a div for easier animation // in a div for easier animation
var text = this.innerHTML; var text = this.innerHTML;
$(this).empty().append($('<a href="#">'+ text +'</a>').click(function() { $(this).empty().append($('<a href="#">'+ text +'</a>').click(function() {
var fieldset = $(this).parents('fieldset:first')[0]; var fieldset = $(this).parents('fieldset:first')[0];
// Don't animate multiple times // Don't animate multiple times
...@@ -71,7 +65,9 @@ if (Drupal.jsEnabled) { ...@@ -71,7 +65,9 @@ if (Drupal.jsEnabled) {
Drupal.toggleFieldset(fieldset); Drupal.toggleFieldset(fieldset);
} }
return false; return false;
})).after($('<div class="fieldset-wrapper"></div>').append(fieldset.children(':not(legend)'))); }))
}); .after($('<div class="fieldset-wrapper"></div>')
.append(fieldset.children(':not(legend)')))
.addClass('collapse-processed');
}); });
} };
// $Id$ // $Id$
var Drupal = Drupal || { 'settings': {}, 'themes': {}, 'locale': {} }; var Drupal = Drupal || { 'settings': {}, 'behaviors': {}, 'themes': {}, 'locale': {} };
/** /**
* Set the variable that indicates if JavaScript behaviors should be applied * Set the variable that indicates if JavaScript behaviors should be applied
...@@ -21,6 +21,43 @@ Drupal.extend = function(obj) { ...@@ -21,6 +21,43 @@ Drupal.extend = function(obj) {
} }
}; };
/**
* Attach all registered behaviors to a page element.
*
* Behaviors are event-triggered actions that attach to page elements, enhancing
* default non-Javascript UIs. Behaviors are registered in the Drupal.behaviors
* object as follows:
* @code
* Drupal.behaviors.behaviorName = function () {
* ...
* };
* @endcode
*
* Drupal.attachBehaviors is added below to the jQuery ready event and so
* runs on initial page load. Developers implementing AHAH/AJAX in their
* solutions should also call this function after new page content has been
* loaded, feeding in an element to be processed, in order to attach all
* behaviors to the new content.
*
* Behaviors should use a class in the form behaviorName-processed to ensure
* the behavior is attached only once to a given element. (Doing so enables
* the reprocessing of given elements, which may be needed on occasion despite
* the ability to limit behavior attachment to a particular element.)
*
* @param context
* An element to attach behaviors to. If none is given, the document element
* is used.
*/
Drupal.attachBehaviors = function(context) {
context = context || document;
if (Drupal.jsEnabled) {
// Execute all of them.
jQuery.each(Drupal.behaviors, function() {
this(context);
});
}
};
/** /**
* Encode special characters in a plain-text string for display as HTML. * Encode special characters in a plain-text string for display as HTML.
*/ */
...@@ -362,6 +399,8 @@ if (Drupal.jsEnabled) { ...@@ -362,6 +399,8 @@ if (Drupal.jsEnabled) {
document.documentElement.className = 'js'; document.documentElement.className = 'js';
// 'js enabled' cookie // 'js enabled' cookie
document.cookie = 'has_js=1'; document.cookie = 'has_js=1';
// Attach all behaviors.
$(document).ready(Drupal.attachBehaviors);
} }
/** /**
......
// $Id$ // $Id$
// Global Killswitch Drupal.behaviors.tableHeader = function (context) {
if (Drupal.jsEnabled) {
// Keep track of all header cells. // Keep track of all header cells.
var cells = []; var cells = [];
// Attach to all headers. var z = 0;
$(document).ready(function() { $('table thead:not(.tableHeader-processed)', context).each(function () {
var z = 0; // Find table height.
$('table thead').each(function () { var table = $(this).parent('table')[0];
// Find table height. var height = $(table).addClass('sticky-table').height();
var table = $(this).parent('table')[0]; var i = 0;
var height = $(table).addClass('sticky-table').height();
var i = 0;
// Find all header cells. // Find all header cells.
$('th', this).each(function () { $('th', this).each(function () {
// Ensure each cell has an element in it. // Ensure each cell has an element in it.
var html = $(this).html(); var html = $(this).html();
if (html == ' ') { if (html == ' ') {
html = '&nbsp;'; html = '&nbsp;';
} }
if ($(this).children().size() == 0) { if ($(this).children().size() == 0) {
html = '<span>'+ html +'</span>'; html = '<span>'+ html +'</span>';
} }
// Clone and wrap cell contents in sticky wrapper that overlaps the cell's padding. // Clone and wrap cell contents in sticky wrapper that overlaps the cell's padding.
$('<div class="sticky-header" style="position: fixed; visibility: hidden; top: 0px;">'+ html +'</div>').prependTo(this); $('<div class="sticky-header" style="position: fixed; visibility: hidden; top: 0px;">'+ html +'</div>').prependTo(this);
var div = $('div.sticky-header', this).css({ var div = $('div.sticky-header', this).css({
'marginLeft': '-'+ $(this).css('paddingLeft'), 'marginLeft': '-'+ $(this).css('paddingLeft'),
'marginRight': '-'+ $(this).css('paddingRight'), 'marginRight': '-'+ $(this).css('paddingRight'),
'paddingLeft': $(this).css('paddingLeft'), 'paddingLeft': $(this).css('paddingLeft'),
'paddingTop': $(this).css('paddingTop'), 'paddingTop': $(this).css('paddingTop'),
'paddingBottom': $(this).css('paddingBottom'), 'paddingBottom': $(this).css('paddingBottom'),
'z-index': ++z 'z-index': ++z
})[0]; })[0];
cells.push(div); cells.push(div);
// Adjust width to fit cell/table. // Adjust width to fit cell/table.
var ref = this; var ref = this;
if (!i++) { if (!i++) {
// The first cell is as wide as the table to prevent gaps. // The first cell is as wide as the table to prevent gaps.
ref = table; ref = table;
div.wide = true; div.wide = true;
} }
$(div).css('width', parseInt($(ref).width()) $(div).css('width', parseInt($(ref).width())
- parseInt($(div).css('paddingLeft')) +'px'); - parseInt($(div).css('paddingLeft')) +'px');
// Get position and store. // Get position and store.
div.cell = this; div.cell = this;
div.table = table; div.table = table;
div.stickyMax = height; div.stickyMax = height;
div.stickyPosition = Drupal.absolutePosition(this).y; div.stickyPosition = Drupal.absolutePosition(this).y;
});
}); });
$(this).addClass('tableHeader-processed');
}); });
// Track scrolling. // Track scrolling.
...@@ -108,4 +105,4 @@ if (Drupal.jsEnabled) { ...@@ -108,4 +105,4 @@ if (Drupal.jsEnabled) {
}, 250); }, 250);
}; };
$(window).resize(resize); $(window).resize(resize);
} };
// $Id$ // $Id$
Drupal.behaviors.tableSelect = function (context) {
$('form table[th.select-all]:not(.tableSelect-processed)', context).each(Drupal.tableSelect);
}
Drupal.tableSelect = function() { Drupal.tableSelect = function() {
// Keep track of the table, which checkbox is checked and alias the settings. // Keep track of the table, which checkbox is checked and alias the settings.
var table = this, selectAll, checkboxes, lastChecked; var table = this, selectAll, checkboxes, lastChecked;
...@@ -41,6 +45,7 @@ Drupal.tableSelect = function() { ...@@ -41,6 +45,7 @@ Drupal.tableSelect = function() {
// Keep track of the last checked checkbox. // Keep track of the last checked checkbox.
lastChecked = e.target; lastChecked = e.target;
}); });
$(this).addClass('tableSelect-processed');
}; };
Drupal.tableSelectRange = function(from, to, state) { Drupal.tableSelectRange = function(from, to, state) {
...@@ -67,10 +72,3 @@ Drupal.tableSelectRange = function(from, to, state) { ...@@ -67,10 +72,3 @@ Drupal.tableSelectRange = function(from, to, state) {
} }
}; };
// Global Killswitch
if (Drupal.jsEnabled) {
$(document).ready(function() {
$('form table[th.select-all]').each(Drupal.tableSelect);
});
}
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
* *
* Note: depends on resizable textareas. * Note: depends on resizable textareas.
*/ */
Drupal.teaserAttach = function() { Drupal.behaviors.teaser = function(context) {
$('textarea.teaser:not(.joined)').each(function() { $('textarea.teaser:not(.teaser-processed)', context).each(function() {
var teaser = $(this).addClass('joined'); var teaser = $(this).addClass('teaser-processed');
// Move teaser textarea before body, and remove its form-item wrapper. // Move teaser textarea before body, and remove its form-item wrapper.
var body = $('#'+ Drupal.settings.teaser[this.id]); var body = $('#'+ Drupal.settings.teaser[this.id]);
...@@ -75,7 +75,3 @@ Drupal.teaserAttach = function() { ...@@ -75,7 +75,3 @@ Drupal.teaserAttach = function() {
}); });
}; };
if (Drupal.jsEnabled) {
$(document).ready(Drupal.teaserAttach);
}
// $Id$ // $Id$
Drupal.textareaAttach = function() { Drupal.behaviors.textarea = function(context) {
$('textarea.resizable:not(.processed)').each(function() { $('textarea.resizable:not(.textarea-processed)', context).each(function() {
var textarea = $(this).addClass('processed'), staticOffset = null; var textarea = $(this).addClass('textarea-processed'), staticOffset = null;
// When wrapping the text area, work around an IE margin bug. See: // When wrapping the text area, work around an IE margin bug. See:
// http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout
...@@ -37,7 +37,3 @@ Drupal.textareaAttach = function() { ...@@ -37,7 +37,3 @@ Drupal.textareaAttach = function() {
} }
}); });
}; };
if (Drupal.jsEnabled) {
$(document).ready(Drupal.textareaAttach);
}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
/** /**
* Attaches the upload behaviour to the upload form. * Attaches the upload behaviour to the upload form.
*/ */
Drupal.uploadAutoAttach = function() { Drupal.behaviors.upload = function(context) {
$('input.upload').each(function () { $('input.upload:not(.upload-processed)', context).addClass('upload-processed').each(function () {
var uri = this.value; var uri = this.value;
// Extract the base name from the id (edit-attach-url -> attach). // Extract the base name from the id (edit-attach-url -> attach).
var base = this.id.substring(5, this.id.length - 4); var base = this.id.substring(5, this.id.length - 4);
...@@ -12,6 +12,7 @@ Drupal.uploadAutoAttach = function() { ...@@ -12,6 +12,7 @@ Drupal.uploadAutoAttach = function() {
var wrapper = base + '-wrapper'; var wrapper = base + '-wrapper';
var hide = base + '-hide'; var hide = base + '-hide';
var upload = new Drupal.jsUpload(uri, button, wrapper, hide); var upload = new Drupal.jsUpload(uri, button, wrapper, hide);
$(this).addClass('upload-processed');
}); });
}; };
...@@ -65,11 +66,10 @@ Drupal.jsUpload.prototype.oncomplete = function (data) { ...@@ -65,11 +66,10 @@ Drupal.jsUpload.prototype.oncomplete = function (data) {
// If uploading the first attachment fade in everything // If uploading the first attachment fade in everything
if ($('tr', div).size() == 2) { if ($('tr', div).size() == 2) {
// Replace form and re-attach behaviour // Replace form and re-attach behaviours
$(div).hide(); $(div).hide();
$(this.wrapper).append(div); $(this.wrapper).append(div);
$(div).fadeIn('slow'); $(div).fadeIn('slow');
Drupal.uploadAutoAttach();
} }
// Else fade in only the last table row // Else fade in only the last table row
else { else {
...@@ -89,8 +89,8 @@ Drupal.jsUpload.prototype.oncomplete = function (data) { ...@@ -89,8 +89,8 @@ Drupal.jsUpload.prototype.oncomplete = function (data) {
$(this.wrapper).append(div); $(this.wrapper).append(div);
$('table tr:last-of-type td', div).fadeIn('slow'); $('table tr:last-of-type td', div).fadeIn('slow');
$(this.hide, div).fadeIn('slow'); $(this.hide, div).fadeIn('slow');
Drupal.uploadAutoAttach();
} }
Drupal.attachBehaviors(div);
Drupal.unfreezeHeight(); Drupal.unfreezeHeight();
}; };
...@@ -108,9 +108,3 @@ Drupal.jsUpload.prototype.onerror = function (error) { ...@@ -108,9 +108,3 @@ Drupal.jsUpload.prototype.onerror = function (error) {
left: '0px' left: '0px'
}); });
}; };
// Global killswitch
if (Drupal.jsEnabled) {
$(document).ready(Drupal.uploadAutoAttach);
}
...@@ -7,7 +7,7 @@ function actions_schema() { ...@@ -7,7 +7,7 @@ function actions_schema() {
'aid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'), 'aid' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''), 'type' => array('type' => 'varchar', 'length' => 32, 'not null' => TRUE, 'default' => ''),
'callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''), 'callback' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => ''),
'parameters' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big', 'default' => ''), 'parameters' => array('type' => 'text', 'not null' => TRUE, 'size' => 'big'),
'description' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'), 'description' => array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '0'),
), ),
'primary key' => array('aid'), 'primary key' => array('aid'),
......
This diff is collapsed.
// $Id$ // $Id$
if (Drupal.jsEnabled) {
$(document).ready(function() { Drupal.behaviors.comment = function (context) {
var parts = new Array("name", "homepage", "mail"); var parts = new Array("name", "homepage", "mail");
var cookie = ''; var cookie = '';
for (i=0;i<3;i++) { for (i=0;i<3;i++) {
cookie = Drupal.comment.getCookie('comment_info_' + parts[i]); cookie = Drupal.comment.getCookie('comment_info_' + parts[i]);
if (cookie != '') { if (cookie != '') {
$("#comment-form input[@name=" + parts[i] + "]").val(cookie); $("#comment-form input[@name=" + parts[i] + "]:not(.comment-processed)", context)
} .val(cookie)
.addClass('comment-processed');
} }
}); }
}; };
Drupal.comment = {}; Drupal.comment = {};
......
...@@ -53,7 +53,7 @@ function locale_help($path, $arg) { ...@@ -53,7 +53,7 @@ function locale_help($path, $arg) {
return '<p>'. t("This page allows you to export Drupal strings. The first option is to export a translation so it can be shared. The second option generates a translation template, which contains all Drupal strings, but without their translations. You can use this template to start a new translation using various software packages designed for this task.") .'</p>'; return '<p>'. t("This page allows you to export Drupal strings. The first option is to export a translation so it can be shared. The second option generates a translation template, which contains all Drupal strings, but without their translations. You can use this template to start a new translation using various software packages designed for this task.") .'</p>';
case 'admin/build/translate/search': case 'admin/build/translate/search':
return '<p>'. t("It is often convenient to get the strings from your setup on the <a href=\"@export\">export page</a>, and use a desktop Gettext translation editor to edit the translations. On this page you can search in the translated and untranslated strings, and the default English texts provided by Drupal.", array("@export" => url("admin/build/translate/export"))) .'</p>'; return '<p>'. t("It is often convenient to get the strings from your setup on the <a href=\"@export\">export page</a>, and use a desktop Gettext translation editor to edit the translations. On this page you can search in the translated and untranslated strings, and the default English texts provided by Drupal.", array("@export" => url("admin/build/translate/export"))) .'</p>';
case 'admin/build/block/configure': case 'admin/build/block/configure':
if ($arg[4] == 'locale' && $arg[5] == 0) { if ($arg[4] == 'locale' && $arg[5] == 0) {
return '<p>'. t("This block is only shown if you have <a href=\"@languages\">at least two languages enabled</a> and you have a <a href=\"@configuration\">language negotiation setting</a> different from 'none', so you have different web addresses for different language versions.", array('@languages' => url('admin/settings/language'), '@configuration' => url('admin/settings/language/configure'))) .'</p>'; return '<p>'. t("This block is only shown if you have <a href=\"@languages\">at least two languages enabled</a> and you have a <a href=\"@configuration\">language negotiation setting</a> different from 'none', so you have different web addresses for different language versions.", array('@languages' => url('admin/settings/language'), '@configuration' => url('admin/settings/language/configure'))) .'</p>';
...@@ -524,13 +524,13 @@ function locale_block($op = 'list', $delta = 0) { ...@@ -524,13 +524,13 @@ function locale_block($op = 'list', $delta = 0) {
'attributes' => array('class' => 'language-link'), 'attributes' => array('class' => 'language-link'),
); );
} }
// Allow modules to provide translations for specific links. // Allow modules to provide translations for specific links.
// A translation link may need to point to a different path or use // A translation link may need to point to a different path or use
// a translated link text before going through l(), which will just // a translated link text before going through l(), which will just
// handle the path aliases. // handle the path aliases.
drupal_alter('translation_link', $links, $_GET['q']); drupal_alter('translation_link', $links, $_GET['q']);
$block['subject'] = t('Languages'); $block['subject'] = t('Languages');
$block['content'] = theme('links', $links, array()); $block['content'] = theme('links', $links, array());
return $block; return $block;
......
// $Id$ // $Id$
$(document).ready( Drupal.behaviors.openid = function (context) {
function() { // This behavior attaches by ID, so is only valid once on a page.
if ($("#edit-openid-url").val()) { if (!$("#edit-openid-url.openid-processed").size() && $("#edit-openid-url").val()) {
$("#edit-name-wrapper").hide(); $("#edit-openid-url").addClass('openid-processed');
$("#edit-pass-wrapper").hide(); $("#edit-name-wrapper").hide();
$("#edit-openid-url-wrapper").show(); $("#edit-pass-wrapper").hide();
$("a.openid-link").hide(); $("#edit-openid-url-wrapper").show();
} $("a.openid-link").hide();
$("a.openid-link").click( function() { }
$("a.openid-link:not(.openid-processed)", context)
.addClass('openid-processed')
.click( function() {
$("#edit-pass-wrapper").hide(); $("#edit-pass-wrapper").hide();
$("#edit-name-wrapper").fadeOut('medium', function() { $("#edit-name-wrapper").fadeOut('medium', function() {
$("#edit-openid-url-wrapper").fadeIn('medium'); $("#edit-openid-url-wrapper").fadeIn('medium');
...@@ -17,7 +20,9 @@ $(document).ready( ...@@ -17,7 +20,9 @@ $(document).ready(
$("a.user-link").show(); $("a.user-link").show();
return false; return false;
}); });
$("a.user-link").click( function() { $("a.user-link:not(.openid-processed)", context)
.addClass('openid-processed')
.click(function() {
$("#edit-openid-url-wrapper").hide(); $("#edit-openid-url-wrapper").hide();
$("#edit-pass-wrapper").show(); $("#edit-pass-wrapper").show();
$("#edit-name-wrapper").show(); $("#edit-name-wrapper").show();
...@@ -25,5 +30,5 @@ $(document).ready( ...@@ -25,5 +30,5 @@ $(document).ready(
$("a.openid-link").show(); $("a.openid-link").show();
return false; return false;
}); });
}); };
...@@ -7,7 +7,13 @@ ...@@ -7,7 +7,13 @@
* This function is not used to verify whether or not clean URLs * This function is not used to verify whether or not clean URLs
* are currently enabled. * are currently enabled.
*/ */
Drupal.cleanURLsSettingsCheck = function() { Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
// This behavior attaches by ID, so is only valid once on a page.
// Also skip if we are on an install page, as Drupal.cleanURLsInstallCheck will handle
// the processing.
if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
return;
}
var url = location.pathname +"admin/settings/clean-urls"; var url = location.pathname +"admin/settings/clean-urls";
$("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>"); $("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
$("#clean-url p").hide(); $("#clean-url p").hide();
...@@ -23,6 +29,7 @@ Drupal.cleanURLsSettingsCheck = function() { ...@@ -23,6 +29,7 @@ Drupal.cleanURLsSettingsCheck = function() {
$("#clean-url .description span").append('<div class="warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>"); $("#clean-url .description span").append('<div class="warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>");
} }
}}); }});
$("#clean-url").addClass('clean-url-processed');
}; };
/** /**
...@@ -50,6 +57,7 @@ Drupal.cleanURLsInstallCheck = function() { ...@@ -50,6 +57,7 @@ Drupal.cleanURLsInstallCheck = function() {
$("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>"); $("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>");
} }
}}); }});
$("#clean-url").addClass('clean-url-processed');
}; };