Make sure the email settings in the control panel are disabled when commenting is disabled globally;

Enable/disable moderator_email setting dynamically as mail settings or discussion settings change.

svn path=/plone.app.discussion/trunk/; revision=49035
This commit is contained in:
Timo Stollenwerk 2011-04-22 15:41:45 +00:00
parent ff3cc181b8
commit c66e243a86
2 changed files with 35 additions and 12 deletions

View File

@ -4,6 +4,14 @@ Changelog
2.0.1 (2011-04-22) 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. - Remove ImportError exceptions for Plone < 4.1 code and plone.z3cform < 0.6.0.
[timo] [timo]

View File

@ -44,6 +44,7 @@
$('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'), $('#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') $('#formfield-form-widgets-user_notification_enabled')
]); ]);
} }
@ -55,22 +56,36 @@
$('#formfield-form-widgets-captcha'), $('#formfield-form-widgets-captcha'),
$('#formfield-form-widgets-show_commenter_image'), $('#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') $('#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([$('#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 { 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 /* If a custom workflow for comments is enabled, disable the moderation
switch. */ switch. */
if (moderation_custom === true) { if (moderation_custom === true) {
$.disableSettings([$('#formfield-form-widgets-moderation_enabled')]); $.disableSettings([
$('#formfield-form-widgets-moderation_enabled')
]);
} }
}; };
//#JSCOVERAGE_IF 0 //#JSCOVERAGE_IF 0