Author: dom
Date: 2007-06-19 14:01:53 +0100 (Tue, 19 Jun 2007)
New Revision: 1093
Modified:
trunk/Build.PL
trunk/Changes
trunk/lib/OpenGuides.pm
trunk/lib/OpenGuides/Config.pm
Log:
Send email notifications when moderated nodes are edited (fixes #138)
Modified: trunk/Build.PL
===================================================================
--- trunk/Build.PL 2007-06-18 20:31:33 UTC (rev 1092)
+++ trunk/Build.PL 2007-06-19 13:01:53 UTC (rev 1093)
@@ -42,7 +42,8 @@
moderation_requires_password enable_node_image enable_common_categories
enable_common_locales recent_changes_on_home_page
random_page_omits_locales random_page_omits_categories
- content_above_navbar_in_html show_gmap_in_node_display);
+ content_above_navbar_in_html show_gmap_in_node_display
+ send_moderation_notifications);
my $skip_config = Module::Build->y_n("Skip OpenGuides configuration?",
"n");
if ( $skip_config ) {
@@ -104,7 +105,7 @@
default_gmaps_search_zoom force_wgs84 google_analytics_key
licence_name licence_url licence_info_url moderation_requires_password
enable_node_image enable_common_categories enable_common_locales
- spam_detector_module static_path static_url
+ spam_detector_module static_path static_url send_moderation_notifications
) ) {
my $q_method = $var . "__qu";
my $qu = $existing_config->$q_method;
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2007-06-18 20:31:33 UTC (rev 1092)
+++ trunk/Changes 2007-06-19 13:01:53 UTC (rev 1093)
@@ -24,6 +24,7 @@
(#216).
Move the common categories/locales navbar display decision into the
templates (#214).
+ Add email notifications when moderated nodes are edited (#138)
0.60 13 May 2007
Removed footer search from edit page (shouldn't have been there).
Modified: trunk/lib/OpenGuides/Config.pm
===================================================================
--- trunk/lib/OpenGuides/Config.pm 2007-06-18 20:31:33 UTC (rev 1092)
+++ trunk/lib/OpenGuides/Config.pm 2007-06-19 13:01:53 UTC (rev 1093)
@@ -21,7 +21,7 @@
centre_lat default_gmaps_zoom default_gmaps_search_zoom force_wgs84
licence_name licence_url licence_info_url moderation_requires_password
enable_node_image enable_common_categories enable_common_locales
- spam_detector_module static_path static_url
+ spam_detector_module static_path static_url send_moderation_notifications
);
my @questions = map { $_ . "__qu" } @variables;
OpenGuides::Config->mk_accessors( @variables );
@@ -109,6 +109,7 @@
licence_info_url => "",
spam_detector_module => "",
static_path => "/usr/local/share/openguides/static",
+ send_moderation_notifications => 1
);
# See if we already have some config variables set.
@@ -192,6 +193,7 @@
spam_detector_module => "What module would you like to use for spam
detection? (optional)",
static_path => "What directory should we install static content (CSS,
images, javascript) to?",
static_url => "What is the URL corresponding to the static
content?",
+ send_moderation_notifications => "Should we send email notifications when
a moderated node is edited?"
);
foreach my $var ( keys %questions ) {
@@ -322,6 +324,8 @@
=item * static_url
+=item * send_moderation_notifications
+
=back
=head1 AUTHOR
Modified: trunk/lib/OpenGuides.pm
===================================================================
--- trunk/lib/OpenGuides.pm 2007-06-18 20:31:33 UTC (rev 1092)
+++ trunk/lib/OpenGuides.pm 2007-06-19 13:01:53 UTC (rev 1093)
@@ -1404,7 +1404,8 @@
# Check to make sure all the indexable nodes are created
# Skip this for nodes needing moderation - this occurs for them once
# they've been moderated
- unless($wiki->node_required_moderation($node)) {
+ my $needs_moderation = $wiki->node_required_moderation($node);
+ unless( $needs_moderation ) {
$self->_autoCreateCategoryLocale(
id => $node,
metadata => \%new_metadata
@@ -1415,6 +1416,24 @@
\%new_metadata );
if ($written) {
+ if ( $needs_moderation and $config->send_moderation_notifications ) {
+ my $body = "The node '$node' in the OpenGuides
installation\n" .
+ "'" . $config->site_name . "' requires
moderation. ".
+ "Please visit\n" .
+ $config->script_url . $config->script_name .
+ "?action=show_needing_moderation\nat your convenience.\n";
+ eval {
+ OpenGuides::Utils->send_email(
+ config => $config,
+ subject => "Node requires moderation",
+ body => $body,
+ admin => 1,
+ return_output => $return_output
+ );
+ };
+ warn $@ if $@;
+ }
+
my $output = $self->redirect_to_node($node);
return $output if $return_output;
print $output;