chiark / gitweb /
Merge remote branch 'origin/master'
[modbot-uram.git] / webstump / scripts / html_output.pl
index 630f3410cc257679d1eccd18e0ca91bd0180fe14..728bd711d42fd3c153b1598b09598af096318da5 100644 (file)
@@ -193,7 +193,7 @@ of this installation. <HR>
   &end_html;
 }
 
-# main moderation page -- old version
+# main moderation page -- single-article version
 sub html_moderate_article {
   my $newsgroup = &required_parameter( 'newsgroup' );
   my $moderator = $request{'moderator'};
@@ -211,7 +211,7 @@ sub html_moderate_article {
 
       print "<HR>\n" if &print_article_warning( $file );
 
-      print "<PRE>\n";
+      print "<pre style=\"white-space: pre-wrap\">\n";
       my $filename;
       my $inhead= 1;
       while( $filename = <TEXT_FILES> ) {
@@ -247,45 +247,31 @@ sub html_moderate_article {
   &html_print_credentials;
   print "<SELECT NAME=\"decision_$file\">
 <OPTION VALUE=\"approve\">Approve</OPTION>
-<OPTION VALUE=\"leave\" SELECTED>Put to back of queue</OPTION>
-<OPTION VALUE=\"consider\">Back of queue, adding mark requesting further consideration</OPTION>
+<OPTION VALUE=\"skip\" SELECTED>Leave</OPTION>
+<OPTION VALUE=\"leave\">Back of queue</OPTION>
 ";
 
-      foreach (sort(keys %rejection_reasons)) {
-        print "<OPTION VALUE=\"reject $_\">Reject -- $rejection_reasons{$_}</OPTION>\n";
-      }
-
-      print "<BR>";
-
-      print "</SELECT><BR> Comment: <INPUT NAME=comment VALUE=\"\" SIZE=80><BR>";
+  foreach (@short_rejection_reasons) {
+      print "<OPTION VALUE=\"reject $_\">Reject \u$_</OPTION>\n";
+  }
+  print "</SELECT> <BR> Comment (to poster, in rejection message): <INPUT NAME=comment VALUE=\"\" SIZE=80><BR>";
 
   print "<BR>
 <INPUT TYPE=radio NAME=poster_decision VALUE=nothing CHECKED>Don't change poster's status</INPUT>
 <INPUT TYPE=radio NAME=poster_decision VALUE=preapprove 
 >White-list poster</INPUT>
-<INPUT TYPE=radio NAME=poster_decision VALUE=ban 
-  ONCLICK=\"alert( 'Banning a poster is a controversial practice'); \"
-> Ban All Posts by this Person (Careful!)</INPUT>
-<BR><BR>
-<INPUT TYPE=radio NAME=thread_decision VALUE=nothing CHECKED>Don't change thread's status</INPUT>
-<!-- <INPUT TYPE=radio NAME=thread_decision VALUE=preapprove>Preapprove thread, by Subject:</INPUT> -->
-<BR>
-
-<!-- <INPUT TYPE=radio NAME=thread_decision VALUE=ban
-  ONCLICK=\"alert( 'Banning a thread is a controversial practice'); \"
->Ban Entire Thread By Subject (Careful!)</INPUT> -->
-<!-- <INPUT TYPE=radio NAME=thread_decision VALUE=watch>Put Entire thread on a Watch, by Subject:</INPUT> -->
+<INPUT TYPE=radio NAME=poster_decision VALUE=suspicious>
+Add poster to watch list</INPUT>
 
 <BR><BR>
 <I>
-NOTE: Decisions to ban and whitelist posters can be reversed by 
-logging in as \"admin\" and editing respective lists of whitelisted
-and banned threads.
+NOTE: Decisions to watchlist and whitelist posters can be reversed by 
+editing the respective lists of whitelisted and watchlisted posters.
 ";
 
   &link_to_help( "filter-lists", "automatic filtering and filter lists, blacklisting and preapproved threads." );
 
-  print "Be really careful about blacklisting of everyone except spammers.</I><BR><BR>
+  print "</I>You may also wish to read the <A href=\"http://www.chiark.greenend.org.uk/~webstump/g.ulm/rrtable.html\" target=\"_blank\">summary of rejection reasons</a> (opens in a new window).\n<BR><BR>
 
 <INPUT TYPE=radio NAME=next_screen VALUE=single CHECKED> 
        Review ONE article in next screen
@@ -299,6 +285,11 @@ and banned threads.
 ";
 
       print "</FORM>\n\n";
+  print "<FORM METHOD=$request_method action=$base_address>";
+  &html_print_credentials;
+  print "<INPUT NAME=action VALUE=moderator_admin TYPE=hidden>
+         <INPUT TYPE=submit VALUE=\"Go to Management Page Instead of Moderating This Post\">
+         </FORM>";
   print "<BR><A HREF=$base_address?action=change_password&newsgroup=$newsgroup&" .
         "moderator=$moderator&password=$password>Change Password</A>";
 
@@ -478,7 +469,7 @@ sub get_queue_list ($) {
     return ($dir, @articles);
 }
 
-# main moderation page
+# main moderation page -- multiple-articles version
 sub html_moderation_screen {
   my $newsgroup = &required_parameter( 'newsgroup' );
   my $moderator = $request{'moderator'};
@@ -519,7 +510,7 @@ decision (approve/reject etc) and click submit. For those messages which
 you would like to review in more details, do not select anything and
 use Review/Comment function from this screen or from a subsequent screen.
 Remember that if you do not make any decision, the article would stay in the
-queue.\n";
+queue. See also the <A href=\"http://www.chiark.greenend.org.uk/~webstump/g.ulm/rrtable.html\" target=\"_blank\">summary of rejection reasons</a> (opens in a new window).\n";
 
   &read_rejection_reasons;
 
@@ -578,7 +569,7 @@ queue.\n";
 
         my $i = 0;
 
-        while( ($_ = <PROLOG>) && $i < 5 ) {
+        while( ($_ = <PROLOG>) && $i < 8 ) {
             chop;
            next if m/^\>/;
            s/\&/&amp;/g;
@@ -644,22 +635,24 @@ sub scanlogs ($$$) {
     my $num= sub {
         local ($_) = @_;
         return $forwards * (
-            m/^errs$/ ? -1 :
-            m/^errs\.(\d+)(?:\.gz$)$/ ? $1 :
-            undef
+            m/^errs$/ ? 1 :
+            m/^errs\.(\d+)(?:\.gz$)$/ ? ($1+2) :
+            0
                            );
     };
     foreach my $leaf (
                       sort { $num->($a) <=> $num->($b) }
-                      grep { defined $num->($_) }
+                     grep { $num->($_) }
                       readdir LOGSDIR
                       ) {
         my $file= "$dir/$leaf";
-        if ($file =~ m/\.gz$/) {
-            open LOGFILE, "zcat $file |" or die "zcat $file $!";
+        if ($file =~ m/\/errs.*\.gz$/) {
+            open LOGFILE, "zcat $file | tac |" or die "zcat $file | tac $!";
+        } elsif ($file =~ /errs/) {
+            open LOGFILE, "tac $file |" or die "tac $file $!";
         } else {
-            open LOGFILE, "< $file" or die "$file $!";
-        }
+           die "Unexpected filename in scanlogs: $file";
+       }
         while (<LOGFILE>) {
             my $tgot= $callback->();
             next unless $tgot;
@@ -768,7 +761,7 @@ sub html_newsgroup_management {
   Configuration List: <SELECT NAME=list_to_edit>
 
     <OPTION VALUE=good.posters.list>Good Posters List
-    <OPTION VALUE=bad.posters.list>Banned Posters List
+    <OPTION VALUE=watch.posters.list>Suspicious Posters List
     <OPTION VALUE=watch.words.list>Suspicious Words List
 
   </SELECT>
@@ -811,6 +804,14 @@ sub html_newsgroup_management {
 
   print "</UL>\n";
 
+  print "<HR>See the <A href=\"http://www.chiark.greenend.org.uk/~webstump/g.ulm/rrtable.html\" target=\"_blank\">summary of rejection reasons</a> (opens in a new window).\n";
+
+  print "<HR><FORM METHOD=$request_method action=$base_address>";
+  &html_print_credentials;
+  print "<INPUT NAME=action VALUE=moderation_screen TYPE=hidden>
+         <INPUT TYPE=submit VALUE=\"Go to moderation screen\">
+         </FORM>";
+
   &end_html;
 }