diff --git a/CHANGES.txt b/CHANGES.txt index c598eeb..3007ef9 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,6 +4,14 @@ Changelog 2.0.1 (2011-04-22) ------------------ +- Make sure the email settings in the control panel are disabled when commenting + is disabled globally. + [timo] + +- Enable/disable moderator_email setting dynamically as mail settings or + discussion settings change. + [timo] + - Remove ImportError exceptions for Plone < 4.1 code and plone.z3cform < 0.6.0. [timo] diff --git a/plone/app/discussion/browser/javascripts/controlpanel.js b/plone/app/discussion/browser/javascripts/controlpanel.js index 10d9ebf..c87be6f 100644 --- a/plone/app/discussion/browser/javascripts/controlpanel.js +++ b/plone/app/discussion/browser/javascripts/controlpanel.js @@ -4,9 +4,9 @@ * ******************************************************************************/ (function ($) { - // This unnamed function allows us to use $ inside of a block of code - // without permanently overwriting $. - // http://docs.jquery.com/Using_jQuery_with_Other_Libraries + // This unnamed function allows us to use $ inside of a block of code + // without permanently overwriting $. + // http://docs.jquery.com/Using_jQuery_with_Other_Libraries /* Disable a control panel setting */ $.disableSettings = function (settings) { @@ -43,7 +43,8 @@ $('#formfield-form-widgets-text_transform'), $('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-show_commenter_image'), - $('#formfield-form-widgets-moderator_notification_enabled'), + $('#formfield-form-widgets-moderator_notification_enabled'), + $('#formfield-form-widgets-moderator_email'), $('#formfield-form-widgets-user_notification_enabled') ]); } @@ -55,35 +56,49 @@ $('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-show_commenter_image'), $('#formfield-form-widgets-moderator_notification_enabled'), + $('#formfield-form-widgets-moderator_email'), $('#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')]); + $.disableSettings([ + $('#formfield-form-widgets-moderator_notification_enabled'), + $('#formfield-form-widgets-moderator_email'), + $('#formfield-form-widgets-user_notification_enabled') + ]); } else { - $.enableSettings([$('#formfield-form-widgets-moderator_notification_enabled'), $('#formfield-form-widgets-user_notification_enabled')]); + /* Enable mail setup only if discussion is enabled. */ + if (globally_enabled === true) { + $.enableSettings([ + $('#formfield-form-widgets-moderator_notification_enabled'), + $('#formfield-form-widgets-moderator_email'), + $('#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')]); + $.disableSettings([ + $('#formfield-form-widgets-moderation_enabled') + ]); } }; //#JSCOVERAGE_IF 0 - + /************************************************************************** * Window Load Function: Executes when complete page is fully loaded, * including all frames, **************************************************************************/ $(window).load(function () { - + // Update settings on page load $.updateSettings(); - + // Set #content class and update settings afterwards $("input,select").live("change", function (e) { var id = $(this).attr("id"); @@ -109,8 +124,8 @@ $(form).find("input,select").removeAttr('disabled'); $(form).submit(); }); - - }); + + }); //#JSCOVERAGE_ENDIF