Change the comment workflow setting in the discussion control panel if the setting is changed in the types control panel; show warning message and disable the setting if a custom comment workflow is enabled.

svn path=/plone.app.discussion/trunk/; revision=46253
This commit is contained in:
Timo Stollenwerk
2010-12-11 21:30:18 +00:00
parent 0475376ed0
commit f2f97c5b38
4 changed files with 81 additions and 38 deletions
@@ -27,46 +27,39 @@
};
/* Update settings */
$.updateSettings = function () {
$.updateSettings = function(){
var globally_enabled = $("#content").hasClass("globally_enabled");
var anonymous_comments = $("#content").hasClass("anonymous_comments");
var moderation_enabled = $("#content").hasClass("moderation_enabled");
var moderation_custom = $("#content").hasClass("moderation_custom");
var invalid_mail_setup = $("#content").hasClass("invalid_mail_setup");
/* If commenting is globally disabled, disable all settings. */
if (globally_enabled === true) {
$.enableSettings([
$('#formfield-form-widgets-anonymous_comments'),
$('#formfield-form-widgets-text_transform'),
$('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'),
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-user_notification_enabled')
]);
} else {
$.disableSettings([
$('#formfield-form-widgets-anonymous_comments'),
$('#formfield-form-widgets-text_transform'),
$('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'),
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-user_notification_enabled')
]);
$.enableSettings([$('#formfield-form-widgets-anonymous_comments'), $('#formfield-form-widgets-moderation_enabled'), $('#formfield-form-widgets-text_transform'), $('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-show_commenter_image'), $('#formfield-form-widgets-moderator_notification_enabled'), $('#formfield-form-widgets-user_notification_enabled')]);
}
else {
$.disableSettings([$('#formfield-form-widgets-anonymous_comments'), $('#formfield-form-widgets-moderation_enabled'), $('#formfield-form-widgets-text_transform'), $('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-show_commenter_image'), $('#formfield-form-widgets-moderator_notification_enabled'), $('#formfield-form-widgets-user_notification_enabled')]);
}
/* If the mail setup is invalid, disable the mail settings. */
if (invalid_mail_setup === true) {
$.disableSettings([
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-user_notification_enabled')
]);
} else {
$.enableSettings([
$('#formfield-form-widgets-moderator_notification_enabled'),
$('#formfield-form-widgets-user_notification_enabled')
]);
$.disableSettings([$('#formfield-form-widgets-moderator_notification_enabled'), $('#formfield-form-widgets-user_notification_enabled')]);
}
};
else {
$.enableSettings([$('#formfield-form-widgets-moderator_notification_enabled'), $('#formfield-form-widgets-user_notification_enabled')]);
}
/* If a custom workflow for comments is enabled, disable the moderation
switch. */
if (moderation_custom === true) {
$.disableSettings([$('#formfield-form-widgets-moderation_enabled'), ]);
}
else {
$.enableSettings([$('#formfield-form-widgets-moderation_enabled'), ]);
}
}
//#JSCOVERAGE_IF 0
/**************************************************************************