#!/usr/bin/perl -w
#
# $Id: quick-report-page.pl,v 1.2 1997/06/23 09:06:38 webadm Exp $
#
#
# DESCRIPTION: quick-report-page.pl - German frontend for gnats based on
#    error-report-page.pl. Designed for getting data from treecounter.pl
#
# URL: none yet
#
# AUTHOR: Stefan Lanz (Lanz@rz.uni-frankfurt.de)
#         Peter Sternecker (pps@rz.uni-frankfurt.de)
#         Claus Langhans (Langhans@rz.uni-frankfurt.de)
#         Cord Beermann (cord@Wunder-Nett.org)
#
# Thanks to: Ralf Begemann (begemann@cc.fh-lippe.de)
#	     Dirk 'PollDi' Uhlmann (polldi@cc.fh-lippe.de)
#	     Gerold Meerkoetter (gerold@noc.fh-lippe.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# A Perl script is "correct" if it gets the job done before your boss fires
# you.
# ('Programming Perl Second Edition' by Larry Wall, Tom Christiansen
#   & Randal. L. Schwartz)
#
# Bugs and shortcomings
# none yet
#
### Configuration ###
#
# who is responsible for this?
$webmaster="gnats\@thalassa.cc.fh-lippe.de";
#
# where is the gnats-homedir?
$gnatshome="/var/infosystems/gnats";
#
# where are the known categories?
$categories=$gnatshome."/gnats-db/gnats-adm/categories";
#
### End of Configuration ###

# include perl-modules
use CGI::Carp;
use CGI qw(:standard);
use CGI qw(:shortcuts);

# initialize the CGI-Module and load the form-input
$query = new CGI;
$query->autoEscape(undef);

# print HTTP and HTML-Header and so on.
print $query->header;
print <<EOT1;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <LINK
REV="made" HREF="mailto:cord\@cc.fh-lippe.de"> <TITLE>L&ouml;sungsdatenbank
- Fehler-Report</TITLE> </HEAD>

<BODY text="#000000" bgcolor="#FFFFF7">

<!--#include virtual="/fhl/dvz/loesungen/.header" -->

<HR>
 
<H1>Die L&ouml;sungsdatenbank - Fehler-Report</H1>

<FORM METHOD="POST" ACTION="/cgi-bin/error-report.pl">

<p>Dieses Formular dient zur schnellen Weiterleitung von Fehlern oder
Unklarheiten in der L&ouml;sungsdatenbank.</p>

<ol> 

<li><strong>Login-Name:</strong> Dies ist der Name, mit dem Sie sich am
System anmelden.  Wir verwenden diese Angabe um eventuelle Nachfragen
direkt an Sie richten zu k&ouml;nnen.
EOT1

# put a default in the field if given
print(pre(strong('Login'),
	  '     ',
	  $query->textfield(-name=>'MUST_Login',
			    -size=>'8',
			    -default=>$query->param('MUST_Login')
			    ),
	  )
      );
      
print <<EOT1;

<BR>

<li><strong>Nach- und Vorname</strong> Nur ausf&uuml;llen, wenn der oben
angegebene Login-Name nicht auf den UNIX-Rechnern der DVZ g&uuml;ltig ist.
EOT1

# put a default in the field if given
print(pre(strong('Name'),
	  '      ',
	  $query->textfield(-name=>'OPTION_Name',
			    -size=>'46',
			    -default=>$query->param('OPTION_Name')
			    ),
	  )
      );
      
print <<EOT1;

<BR>

<li><strong>Mailadresse:</strong> Dies ist Ihre Mailadresse. Nur
ausf&uuml;llen, wenn der oben angegebene Login-Name nicht auf den
UNIX-Rechnern der DVZ g&uuml;ltig ist.<p>
EOT1

# put a default in the field if given
print(pre(strong('Mailadresse'),
	  $query->textfield(-name=>'OPTION_Mailadresse',
			    -size=>'46',
			    -default=>$query->param('OPTION_Mailadresse')
			    ),
	  )
      );

print <<EOT1;

<BR>

<li><STRONG>Telefonnummer:</STRONG> Telefonnummer(n) unter der man Sie
tags&uuml;ber erreichen kann.

EOT1

# put a default in the field if given
print(pre(strong('Telefon'),
	  '   ',
	  $query->textfield(-name=>'OPTION_Telefon',
			    -size=>'46',
			    -default=>$query->param('OPTION_Telefon')
			    ),
	  )
      );

print <<EOT1;

<BR>

<li><STRONG>Beschreibung:</STRONG> Beschreiben Sie m&ouml;glichst genau,
wo der Fehler in dem Dokument ist, und worin der Fehler besteht.

EOT1

# put a default in the field if given
print(pre(strong('Beschreibung').
	  ':'),
      $query->textarea(-name=>'MUST_Fehlerbeschreibung',
		       -rows=>10,
		       -columns=>50,
		       -default=>$query->param('MUST_Fehlerbeschreibung')
		       ),
      );

print <<EOT1;

</ol>

EOT1

# add hidden fields with defaults and data we've got from our preceder
print($query->hidden(-name=>'MUST_pri',
		     -default=>'high'
		     ),
      $query->hidden(-name=>'MUST_reproduzierbar',
		     -default=>'Nein'
		     ),
      $query->hidden(-name=>'MUST_Fehlerkategorie',
		     -default=>'ldb'
		     ),
      $query->hidden(-name=>'MUST_Host',
		     -default=>'thalassa'
		     ),
      $query->hidden(-name=>'OPTION_betreff',
		     -default=>$query->param('OPTION_betreff')
		     )
      );
		     
print <<EOT1;

<INPUT TYPE="submit" VALUE="Fehlerbericht absenden">
</FORM>
EOT1

# print the HTML-Trailer
&html_trailer;

1;

#Subroutinen fuer Fehlermeldung
sub fatalerror{
    local ($errortext) = @_;
    &html_header("Error executing script $0 (pid $$)");
    print "<h1>ERROR</h1><hr>";
    print "You got an error while executing the script <strong>$0 (pid $$)</strong> !<br>\n";
    print "Please notify $webmaster<br><br>\n";
    print "Description : <h1>$errortext</h1><br><hr>";
    &html_trailer;
    exit;
};	                

sub friendlyerror{
    local ($errortext) = @_;
    &html_header("Benutzerfehler");
    print "<h1>Fehler</h1><hr>";
#    print "User error detected executing <strong>$0 (pid $$)</strong>!<br>\n";
    print "<br><br>\n";
    print "Sie haben folgendes falsch gemacht : $errortext<br><br>";
    &html_trailer;
    exit;
};

#Subroutine fuer die Zusammensetzung einer HTML- Nachricht
sub html_header {
    local($title) = @_;
    print "Content-type: text/html\n\n";
    print qq|<html><head><title>$title</title></head>\n<BODY BGCOLOR="#ffffff"  TEXT="#000000" VLINK="#551A8B"  ALINK="#ff0000"  LINK="#0000ff">\n|;
}

sub html_trailer {
    	print "<hr>\n";
	print 'Autoren: ';
	print '<A HREF="http://www.rz.uni-frankfurt.de/personal/Stefan_Lanz.html">Stefan Lanz</A>, ';
    	print '<A HREF="http://www.rz.uni-frankfurt.de/personal/Peter_Sternecker.html">Peter Sternecker</A>, ';
    	print '<A HREF="http://www.rz.uni-frankfurt.de/personal/Claus_Langhans.html">Claus Langhans</A>';
	print '<br>Anpassung an lokale Gegebenheiten: ';
	print '<A HREF="http://Cord.de/">Cord Beermann</A>';
	print "</body></html>\n";
}

