#!/usr/local/bin/perl 
#
# MODULE: hd-lib.pl 
# AUTHOR: Ron Shalhoup (ron@captech.com)
# PURPOSE: This file contains common subroutines and variables for
#          the web-based helpdesk system.  This must be included in 
#          each of the other helpdesk scripts.
#

require "cgi-lib.pl";

#
# This directory contains all of the CallTrack data (mail) files.
#
$DATADIR = "/usr/local/etc/httpd/htdocs/helpdesk/data";
#
# This file contains the list of engineers to which CallTracks can be assigned.
#
$ENGINEER_FL = "$DATADIR/.engineers";
#
# Set your mail program here.  Mail program needs to support the following
# switches:  -s subject -c cc
# mailx, fastmail, elm
#
$MAILER = "/usr/bin/mailx"; 
#
# This appears at the top of each form.
#
$PAGE_HEADER = "Helpdesk Response Center";

$APP_TITLE   = "Web-Based Help Desk";
$APP_NAME    = "hd";
$APP_BINDIR  = "/helpdesk/scripts";
$APP_DATADIR = "/helpdesk/data";


sub PrintHeader {
  # Returns the magic line which tells the web server that 
  # this is an HTML document.
  return "Content-type: text/html\n\n";
}

sub Generate_HTML_Header {
    $APP_ACTION = $_[0];

    print <<End_of_Header;
<META HTTP-EQUIV="Refresh" CONTENT=300>
<HTML><HEAD><TITLE>"$APP_TITLE"</TITLE></HEAD>
<BODY BGCOLOR="#FFFFFF">
<FORM METHOD=POST ACTION="$APP_BINDIR/$APP_NAME-$APP_ACTION.pl">
<center>
<H2>
$PAGE_HEADER
</H2>
<hr>
</center>
End_of_Header
}
    
sub Generate_HTML_Footer {
    print <<End_of_Footer;
</FORM>
</BODY>
</HTML>
End_of_Footer
}

sub Generate_Comments_TextArea {
    $rows = $_[0];
    print "Enter Comments:<BR>\n";
    print "<TEXTAREA WRAP=VIRTUAL NAME=COMMENTS \
           COLS=60 ROWS=$rows>$comments</TEXTAREA><BR>\n";
}

# End of File


