chiark / gitweb /
Merge remote branch 'origin/master'
[modbot-uram.git] / webstump / scripts / html_output.pl
index 04cddcc6c70e928d229a063ff4885bd101e73ad8..728bd711d42fd3c153b1598b09598af096318da5 100644 (file)
@@ -193,7 +193,7 @@ of this installation. <HR>
   &end_html;
 }
 
   &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'};
 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 "<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> ) {
       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>
   &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>
 
   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>
 
 <BR><BR>
 <I>
-NOTE: Decisions to ban and preapprove posters and threads can be reversed by 
-logging in as \"admin\" and editing respective lists of preapproved
-and banned threads  and posters.
+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." );
 
 ";
 
   &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
 
 <INPUT TYPE=radio NAME=next_screen VALUE=single CHECKED> 
        Review ONE article in next screen
@@ -299,6 +285,11 @@ and banned threads  and posters.
 ";
 
       print "</FORM>\n\n";
 ";
 
       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>";
 
   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);
 }
 
     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'};
 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
 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;
 
 
   &read_rejection_reasons;
 
@@ -529,6 +520,10 @@ queue.\n";
   <FORM METHOD=$request_method action=$base_address>
   <INPUT NAME=action VALUE=approval_decision TYPE=hidden>";
     &html_print_credentials;
   <FORM METHOD=$request_method action=$base_address>
   <INPUT NAME=action VALUE=approval_decision TYPE=hidden>";
     &html_print_credentials;
+
+    print "<HR> <INPUT TYPE=submit VALUE=Submit>
+<INPUT TYPE=reset VALUE=Reset>
+";
   
   my $file, $subject = "No Subject", $from = "From nobody";
   my $form_not_empty = "";
   
   my $file, $subject = "No Subject", $from = "From nobody";
   my $form_not_empty = "";
@@ -558,7 +553,7 @@ queue.\n";
 
         print "<HR><B>$from: $subject</B>(";
         print "<A HREF=$base_address?action=moderate_article&newsgroup=$newsgroup&" .
 
         print "<HR><B>$from: $subject</B>(";
         print "<A HREF=$base_address?action=moderate_article&newsgroup=$newsgroup&" .
-              "moderator=$moderator&password=$password&file=$subdir>Review/Comment/Preapprove</A>)<BR>\n";
+              "moderator=$moderator&password=$password&file=$subdir>Review/Comment/Whitelist</A>)<BR>\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=approve>Approve\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=skip>Leave\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=leave>Back of queue\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=approve>Approve\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=skip>Leave\n";
         print "<INPUT TYPE=radio NAME=\"decision_$file\" VALUE=leave>Back of queue\n";
@@ -574,7 +569,7 @@ queue.\n";
 
         my $i = 0;
 
 
         my $i = 0;
 
-        while( ($_ = <PROLOG>) && $i < 5 ) {
+        while( ($_ = <PROLOG>) && $i < 8 ) {
             chop;
            next if m/^\>/;
            s/\&/&amp;/g;
             chop;
            next if m/^\>/;
            s/\&/&amp;/g;
@@ -640,22 +635,24 @@ sub scanlogs ($$$) {
     my $num= sub {
         local ($_) = @_;
         return $forwards * (
     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) }
                            );
     };
     foreach my $leaf (
                       sort { $num->($a) <=> $num->($b) }
-                      grep { defined $num->($_) }
+                     grep { $num->($_) }
                       readdir LOGSDIR
                       ) {
         my $file= "$dir/$leaf";
                       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 {
         } else {
-            open LOGFILE, "< $file" or die "$file $!";
-        }
+           die "Unexpected filename in scanlogs: $file";
+       }
         while (<LOGFILE>) {
             my $tgot= $callback->();
             next unless $tgot;
         while (<LOGFILE>) {
             my $tgot= $callback->();
             next unless $tgot;
@@ -765,12 +762,7 @@ sub html_newsgroup_management {
 
     <OPTION VALUE=good.posters.list>Good Posters List
     <OPTION VALUE=watch.posters.list>Suspicious Posters List
 
     <OPTION VALUE=good.posters.list>Good Posters List
     <OPTION VALUE=watch.posters.list>Suspicious Posters List
-    <OPTION VALUE=bad.posters.list>Banned Posters List
-    <OPTION VALUE=good.subjects.list>Good Subjects List
-    <OPTION VALUE=watch.subjects.list>Suspicious Subjects List
-    <OPTION VALUE=bad.subjects.list>Banned Subjects List
     <OPTION VALUE=watch.words.list>Suspicious Words List
     <OPTION VALUE=watch.words.list>Suspicious Words List
-    <OPTION VALUE=bad.words.list>Banned Words List
 
   </SELECT>
   <INPUT TYPE=submit VALUE=\"Edit\">
 
   </SELECT>
   <INPUT TYPE=submit VALUE=\"Edit\">
@@ -812,6 +804,14 @@ sub html_newsgroup_management {
 
   print "</UL>\n";
 
 
   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;
 }
 
   &end_html;
 }