Author: nick
Date: 2006-07-27 17:27:54 +0100 (Thu, 27 Jul 2006)
New Revision: 821
Added:
trunk/templates/needing_moderation.tt
Modified:
trunk/MANIFEST
trunk/wiki.cgi
Log:
Add the page to list nodes needing moderation
Modified: trunk/MANIFEST
===================================================================
--- trunk/MANIFEST 2006-07-06 17:57:51 UTC (rev 820)
+++ trunk/MANIFEST 2006-07-27 16:27:54 UTC (rev 821)
@@ -42,6 +42,7 @@
templates/home_node.tt
templates/map_index.tt
templates/navbar.tt
+templates/needing_moderation.tt
templates/newpage.tt
templates/node.tt
templates/node_history.tt
Added: trunk/templates/needing_moderation.tt
===================================================================
--- trunk/templates/needing_moderation.tt 2006-07-06 17:57:51 UTC (rev 820)
+++ trunk/templates/needing_moderation.tt 2006-07-27 16:27:54 UTC (rev 821)
@@ -0,0 +1,25 @@
+[% INCLUDE header.tt page_title = "Pages Needing Moderation - $site_name" %]
+[% INCLUDE banner.tt %]
+<div id="content">
+[% INCLUDE navbar.tt %]
+<div id="maincontent">
+<h2>Pages Needing Moderation</h2>
+<p>
+These are nodes which have been created/edited, but not yet moderated.
+</p>
+<table id="wanted_pages" style="width:80%">
+<tr><th>Node name</th><th>Pending Version</th><th>Latest Moderated Version</th><th>Action</th></tr>
+ [% FOREACH node = nodes %]
+ <tr>
+ <td>[% node.name %]</td>
+ <td>[% node.version %]</td>
+ <td>[% node.moderated_version %]</td>
+ <td><a href="[% node.moderate_url %]">Moderate this version</a>
+ or <a href="[% node.diff_url %]">See changes</a>
+ </td>
+ </tr>
+ [% END %]
+</table>
+
+</div>
+[% INCLUDE footer.tt %]
Modified: trunk/wiki.cgi
===================================================================
--- trunk/wiki.cgi 2006-07-06 17:57:51 UTC (rev 820)
+++ trunk/wiki.cgi 2006-07-27 16:27:54 UTC (rev 821)
@@ -65,6 +65,8 @@
$guide->show_backlinks( id => $node );
} elsif ($action eq 'show_wanted_pages') {
show_wanted_pages();
+ } elsif ($action eq 'show_needing_moderation') {
+ show_needing_moderation();
} elsif ($action eq 'index') {
$guide->show_index(
type => $q->param("index_type") || "Full",
@@ -80,6 +82,20 @@
id => $node,
metres => $q->param("distance_in_metres")
);
+ } elsif ( $action eq 'admin' ) {
+ $guide->display_admin_interface();
+ } elsif ( $action eq 'set_moderation' ) {
+ $guide->set_node_moderation(
+ id => $node,
+ password => $q->param("password") || "",
+ moderation_flag => $q->param("moderation_flat") || "",
+ );
+ } elsif ( $action eq 'moderate' ) {
+ $guide->moderate_node(
+ id => $node,
+ version => $q->param("version") || "",
+ password => $q->param("password") || "",
+ );
} elsif ( $action eq 'delete'
and ( lc($config->enable_page_deletion) eq "y"
or $config->enable_page_deletion eq "1" )
@@ -366,3 +382,21 @@
wanted => \@wanted } );
}
+sub show_needing_moderation {
+ my @nodes = $wiki->list_unmoderated_nodes;
+
+ # Build the moderate link
+ foreach my $node (@nodes) {
+ my $node_param =
+ uri_escape($formatter->node_name_to_node_param($node->{'name'}));
+ $node->{'moderate_url'} = $script_url . "?action=moderate&id=".$node_param."&version=".$node->{'version'};
+ $node->{'diff_url'} = $script_url . "?id=".$node_param."&version=".$node->{'moderated_version'}."&diffversion=".$node->{'version'};
+ }
+
+ process_template( "needing_moderation.tt",
+ "",
+ { not_editable => 1,
+ not_deletable => 1,
+ deter_robots => 1,
+ nodes => \@nodes } );
+}