change how to submit the form to stop ff to hang, this fixes #13037
This commit is contained in:
parent
cea0ebbfb2
commit
cb14c4f89e
@ -7,34 +7,34 @@
|
|||||||
// This unnamed function allows us to use $ inside of a block of code
|
// This unnamed function allows us to use $ inside of a block of code
|
||||||
// without permanently overwriting $.
|
// without permanently overwriting $.
|
||||||
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries
|
// http://docs.jquery.com/Using_jQuery_with_Other_Libraries
|
||||||
|
|
||||||
/* Disable a control panel setting */
|
/* Disable a control panel setting */
|
||||||
$.disableSettings = function (settings) {
|
$.disableSettings = function (settings) {
|
||||||
$.each(settings, function (intIndex, setting) {
|
$.each(settings, function (intIndex, setting) {
|
||||||
setting.addClass('unclickable');
|
setting.addClass('unclickable');
|
||||||
var setting_field = $(setting).find("input,select");
|
var setting_field = $(setting).find("input,select");
|
||||||
setting_field.attr('disabled', 'disabled');
|
setting_field.attr('disabled', 'disabled');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Enable a control panel setting */
|
/* Enable a control panel setting */
|
||||||
$.enableSettings = function (settings) {
|
$.enableSettings = function (settings) {
|
||||||
$.each(settings, function (intIndex, setting) {
|
$.each(settings, function (intIndex, setting) {
|
||||||
setting.removeClass('unclickable');
|
setting.removeClass('unclickable');
|
||||||
var setting_field = $(setting).find("input,select");
|
var setting_field = $(setting).find("input,select");
|
||||||
setting_field.removeAttr('disabled');
|
setting_field.removeAttr('disabled');
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Update settings */
|
/* Update settings */
|
||||||
$.updateSettings = function () {
|
$.updateSettings = function () {
|
||||||
|
|
||||||
var globally_enabled = $("#content").hasClass("globally_enabled");
|
var globally_enabled = $("#content").hasClass("globally_enabled");
|
||||||
var anonymous_comments = $("#content").hasClass("anonymous_comments");
|
var anonymous_comments = $("#content").hasClass("anonymous_comments");
|
||||||
var moderation_enabled = $("#content").hasClass("moderation_enabled");
|
var moderation_enabled = $("#content").hasClass("moderation_enabled");
|
||||||
var moderation_custom = $("#content").hasClass("moderation_custom");
|
var moderation_custom = $("#content").hasClass("moderation_custom");
|
||||||
var invalid_mail_setup = $("#content").hasClass("invalid_mail_setup");
|
var invalid_mail_setup = $("#content").hasClass("invalid_mail_setup");
|
||||||
|
|
||||||
/* If commenting is globally disabled, disable all settings. */
|
/* If commenting is globally disabled, disable all settings. */
|
||||||
if (globally_enabled === true) {
|
if (globally_enabled === true) {
|
||||||
$.enableSettings([
|
$.enableSettings([
|
||||||
@ -60,7 +60,7 @@
|
|||||||
$('#formfield-form-widgets-user_notification_enabled')
|
$('#formfield-form-widgets-user_notification_enabled')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the mail setup is invalid, disable the mail settings. */
|
/* If the mail setup is invalid, disable the mail settings. */
|
||||||
if (invalid_mail_setup === true) {
|
if (invalid_mail_setup === true) {
|
||||||
$.disableSettings([
|
$.disableSettings([
|
||||||
@ -73,14 +73,14 @@
|
|||||||
/* Enable mail setup only if discussion is enabled. */
|
/* Enable mail setup only if discussion is enabled. */
|
||||||
if (globally_enabled === true) {
|
if (globally_enabled === true) {
|
||||||
$.enableSettings([
|
$.enableSettings([
|
||||||
$('#formfield-form-widgets-moderator_notification_enabled'),
|
$('#formfield-form-widgets-moderator_notification_enabled'),
|
||||||
$('#formfield-form-widgets-moderator_email'),
|
$('#formfield-form-widgets-moderator_email'),
|
||||||
$('#formfield-form-widgets-user_notification_enabled')
|
$('#formfield-form-widgets-user_notification_enabled')
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a custom workflow for comments is enabled, disable the moderation
|
/* If a custom workflow for comments is enabled, disable the moderation
|
||||||
switch. */
|
switch. */
|
||||||
if (moderation_custom === true) {
|
if (moderation_custom === true) {
|
||||||
$.disableSettings([
|
$.disableSettings([
|
||||||
@ -89,20 +89,20 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
//#JSCOVERAGE_IF 0
|
//#JSCOVERAGE_IF 0
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Window Load Function: Executes when complete page is fully loaded,
|
* Window Load Function: Executes when complete page is fully loaded,
|
||||||
* including all frames,
|
* including all frames,
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
$(window).load(function () {
|
$(window).load(function () {
|
||||||
|
|
||||||
// Update settings on page load
|
// Update settings on page load
|
||||||
$.updateSettings();
|
$.updateSettings();
|
||||||
|
|
||||||
// Set #content class and update settings afterwards
|
// Set #content class and update settings afterwards
|
||||||
$("input,select").live("change", function (e) {
|
$("input,select").live("change", function (e) {
|
||||||
var id = $(this).attr("id");
|
var id = $(this).attr("id");
|
||||||
if (id === "form-widgets-globally_enabled-0") {
|
if (id === "form-widgets-globally_enabled-0") {
|
||||||
if ($(this).attr("checked") === true) {
|
if ($(this).attr("checked") === true) {
|
||||||
$("#content").addClass("globally_enabled");
|
$("#content").addClass("globally_enabled");
|
||||||
}
|
}
|
||||||
@ -112,17 +112,17 @@
|
|||||||
$.updateSettings();
|
$.updateSettings();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* Remove the disabled attribute from all form elements before
|
* Remove the disabled attribute from all form elements before
|
||||||
* submitting the form. Otherwise the z3c.form will raise errors on
|
* submitting the form. Otherwise the z3c.form will raise errors on
|
||||||
* the required attributes.
|
* the required attributes.
|
||||||
**********************************************************************/
|
**********************************************************************/
|
||||||
$("form#DiscussionSettingsEditForm").bind("submit", function (e) {
|
$("form#DiscussionSettingsEditForm").bind("submit", function (e) {
|
||||||
$(this).find("input,select").removeAttr('disabled');
|
$(this).find("input,select").removeAttr('disabled');
|
||||||
$(this).submit();
|
$("form#DiscussionSettingsEditForm").submit();
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
//#JSCOVERAGE_ENDIF
|
//#JSCOVERAGE_ENDIF
|
||||||
|
Loading…
Reference in New Issue
Block a user