From: dhaeseg@se.bel.alcatel.be (Gratien D'haese)
Message-Id: <9509070619.AA14191@btmpfd.se>
To: req@ccs.neu.edu
Subject: Re: CGI wrapper?
X-Sun-Charset: US-ASCII

> From: Geoff Allen <geoff@eecs.wsu.edu>
> Subject: CGI wrapper?
>
> We've been asked to make the req info available to our users on the
> web. Seems like a pretty good idea. It would just need a wrapper for q
> and another for 'req -show #', and maybe a 'mailto' link on the 'req -show' 
> page to allow them to send mail about the req (I'm not thinking of
> anything fancy here).
> 
> This seems like some pretty straightforward perl, and I was wondering
> if anybody's done it yet. If not, I'll do it and let Remy put it in
> the req-contrib directory so others can use it, build upon it, etc.
> 

I've written something quiet simple, but on your webserver one has to run
an identd!  Because "status" may only show your own problems and not of the
rest too.  This CGI is put in a restricted area where only my users
(=certain subnets) are allowed to execute CGIs (=protected by httpd).

I certaintly hope this is a start for lots of new (and better then mine)
CGIs behind req!

Gratien

  ______           Gratien D'haese   Switching Systems Division         se121
  \    / Alcatel   F. Wellesplein 1, B-2018 Antwerpen, Belgium
   \  /   Bell	   E-mail: dhaeseg@se.bel.alcatel.be  Phone: (32) 3 240 94 51
    \/  Telephone                                       Fax: (32) 3 240 99 50

------- file: qstat ------

#! /usr/local/bin/perl
#
#   Show the general request q
#
#####

$Query = $ENV{'QUERY_STRING'};
$User = $ENV{'REMOTE_USER'};

print "Content-type: text/html\n\n<isindex>\n";

&status_overview unless $Query;
 
while($Query =~ /%(..)/) { # unpack encoded puctuation in query
	$hex = $1;
	$c = sprintf("%c", hex($hex));
	$Query =~ s/%$hex/$c/;
	}
$Query1 = $Query;
$Query =~ s/([+.?])/\\$1/g; # escape R.E. metacharacters

print "<HTML>\n";
print "<title>Show Ticket for Req# $Query1</title>\n";
print "<BODY>\n";
print "<P>An empty search field shows all <i>open</i> problems owned by you.\n";
print "<P><HR>\n";
print "<H2>Show Ticket for Req# $Query1</H2>\n";
print "<pre>\n";
open(Q, "/req/bin/status $Query|");
while (<Q>) { print "$_"; }
close(Q);
 
print "</pre>\n";
print "</BODY>\n";
print "</HTML>\n";

exit 0;
### subroutines 
sub status_overview {
print "<HTML>\n";
print "<title>Request Queue Mode</title>\n";
print "<BODY>\n";
print "<P><b>Fill in the Request number (Req #) to see a full description of the problem.</b>\n";
print "<P><HR>\n";
print "<H2>Open problems submitted by  $User</H2>\n";
print "<pre>\n";

open(Q, "/req/bin/status |");
while (<Q>) { print "$_"; }
close(Q);

print "</pre>\n";
print "<HR><P>More information about <a href=../req/req.html>Request Queue Mode</a>.\n";
print "</BODY>\n";
print "<address><a href=http://www.se.bel.alcatel.be/~dhaeseg/dhaese_home.html>Gratien D'haese</a></address>";
print "</HTML>\n";
exit 0;
}
