# # ---------------------- # DBMan # ---------------------- # Database Administrator # # File: html.pl # Description: This file contains all the HTML that the program generates. # Author: Alex Krohn # Web: http://www.gossamer-threads.com/ # Version: 2.05 # CVS Revision: $Id: html.pl,v 1.3 2000/07/08 18:14:40 alex Exp $ # # COPYRIGHT NOTICE: # # Copyright 1997 Gossamer Threads Inc. All Rights Reserved. # # This program is being distributed as shareware. It may be used and # modified free of charge for personal, academic, government or non-profit # use, so long as this copyright notice and the header above remain intact. # Any commercial use should be registered. Please also send me an email, # and let me know where you are using this script. By using this program # you agree to indemnify Gossamer Threads Inc. from any liability. # # Selling the code for this program without prior written consent is # expressly forbidden. Obtain permission before redistributing this # program over the Internet or in any other medium. In all cases # copyright and header must remain intact. # # Please check the README file for full details on registration. # ===================================================================== ########################################################## ## HTML Globals ## ########################################################## # Put any globals you like in here for your html pages. $html_title = 'Hill 4-11 Roster Database'; ########################################################## ## Record Layout ## ########################################################## sub html_record_form { # -------------------------------------------------------- # The form fields that will be displayed each time a record is # edited (including searching). You don't want to put the #
tags for each field. # The values to be displayed are in %rec and should be incorporated # into your form. You can use &build_select_field, &build_checkbox_field # and &build_radio_field to generate the respective input boxes. Text and # Textarea inputs can be inserted as is. If you turn on form auto # generation, the program will build the forms for you (all though they may # not be as nice). See the README for more info. my (%rec) = @_; ($db_auto_generate and print &build_html_record_form(%rec) and return); my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399'; print qq|<$font_color>ID: | |
<$font_color>Last Name: | |
<$font_color>First Name: | |
<$font_color>Middle Name: | |
<$font_color>Nickname: | |
<$font_color>Rank: | |; print &build_select_field("Rank",$rec{'Rank'}); print qq| |
<$font_color>Specialty/MOS: | |
<$font_color>Primary Assignment: | |; print &build_select_field("Primary Assignment",$rec{'Primary Assignment'}); print qq| |
<$font_color>Vietnam Unit: | |; print &build_select_field("Vietnam Unit",$rec{'Vietnam Unit'}); print qq| |
<$font_color>Company: | |; print &build_select_field("Company",$rec{'Company'}); print qq| |
<$font_color>Platoon: | |; print &build_select_field("Platoon",$rec{'Platoon'}); print qq| |
<$font_color>Squad: | |; print &build_select_field("Squad",$rec{'Squad'}); print qq| |
<$font_color>Date Arrived: | |
<$font_color>Major Event: | |
<$font_color>Date Departed: | |
<$font_color>Home Town: | |
<$font_color>Home State: | |; print &build_select_field("Home State",$rec{'Home State'}); print qq| |
<$font_color>Current Address Line 1: | |
<$font_color>Current Address Line 2: | |
<$font_color>City: | |
<$font_color>State: | |; print &build_select_field("State",$rec{'State'}); print qq| |
<$font_color>5-Digit Zip Code: | |
<$font_color>Phone Number: | |
<$font_color>Email Address: | |
<$font_color>Current Occupation: | |
<$font_color>Comments: | |
<$font_color>Userid: |
<$font_color>ID: | <$font>$rec{'ID'} |
<$font_color>Last Name: | <$font>$rec{'Last Name'} |
<$font_color>First Name: | <$font>$rec{'First Name'} |
<$font_color>Middle Name: | <$font>$rec{'Middle Name'} |
<$font_color>Nickname: | <$font>$rec{'Nickname'} |
<$font_color>Rank: | <$font>$rec{'Rank'} |
<$font_color>Specialty/MOS: | <$font>$rec{'Specialty/MOS'} |
<$font_color>Primary Assignment: | <$font>$rec{'Primary Assignment'} |
<$font_color>Vietnam Unit: | <$font>$rec{'Vietnam Unit'} |
<$font_color>Company: | <$font>$rec{'Company'} |
<$font_color>Platoon: | <$font>$rec{'Platoon'} |
<$font_color>Squad: | <$font>$rec{'Squad'} |
<$font_color>Date Arrived: | <$font>$rec{'Date Arrived'} |
<$font_color>Major Event: | <$font>$rec{'Major Event'} |
<$font_color>Date Departed: | <$font>$rec{'Date Departed'} |
<$font_color>Home Town: | <$font>$rec{'Home Town'} |
<$font_color>Home State: | <$font>$rec{'Home State'} |
<$font_color>Current Address Line 1: | <$font>$rec{'Current Address Line 1'} |
<$font_color>Current Address Line 2: | <$font>$rec{'Current Address Line 2'} |
<$font_color>City: | <$font>$rec{'City'} |
<$font_color>State: | <$font>$rec{'State'} |
<$font_color>5-Digit Zip Code: | <$font>$rec{'5-Digit Zip Code'} |
<$font_color>Phone Number: | <$font>$rec{'Phone Number'} |
<$font_color>Email Address: | <$font>$rec{'Email Address'} |; } print qq||; if ($rec{'Current Occupation'}) { print qq| |
<$font_color>Current Occupation: | <$font>$rec{'Current Occupation'} |
<$font_color>Comments: | <$font>$rec{'Comments'} |
<$font_color>Userid: | <$font>$rec{'Userid'} |
$html_title: Main Menu | |
Permissions: |; print " View " if ($per_view); print " Add " if ($per_add); print " Delete " if ($per_del); print " Modify " if ($per_mod); print " Admin " if ($per_admin); print " None " if (!($per_view || $per_add || $per_del || per_mod)); print qq| <$font>
This database has been set up so any user can view any other users information, but you can
only modify your own records. |
<$font>!; print qq!| Home !; print qq!| Add ! if ($per_add); print qq!| View ! if ($per_view); print qq!| Delete ! if ($per_del); print qq!| Modify ! if ($per_mod); print qq!| List All ! if ($per_view); print qq!| Admin ! if ($per_admin); print qq!| Log Off |!; print qq!
!; # Print the Footer -- note: a link (doesn't have to be the graphic) is required unless you purchase # a license. See: http://gossamer-threads.com/scripts/register/ for more info. print qq!<$font>Database Powered by Gossamer Threads Inc. |
Search Options:
Match Any
Match Case
Whole Words
Reg. Expression
Keyword Search (will match against all fields)
Max. Returned Hits
Sort By:
Sort Order:
Search Tips:
- use '*' to match everything in a field)
- put a '>' or '<' at the beginning to to do range searches.
~;
}
##########################################################
## Adding ##
##########################################################
sub html_add_form {
# --------------------------------------------------------
# The add form page where the user fills out all the details
# on the new record he would like to add. You should use
# &html_record_form to print out the form as it makes
# updating much easier. Feel free to edit &get_defaults
# to change the default values.
&html_print_headers;
print qq|
$html_title: Record Added | |
<$font> The following record was successfully added to the database: |; &html_record(&get_record($in{$db_key})); print qq| |; &html_footer; print qq| |
|; } sub html_view_failure { # -------------------------------------------------------- # The search for viewing failed. The reason is stored in $message # and a new search form is printed out. my ($message) = $_[0]; &html_print_headers; print qq|
$html_title: Search Results <$font> Your search returned $db_total_hits matches. |; if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } # Go through each hit and convert the array to hash and send to # html_record for printing. for (0 .. $numhits - 1) { print ""; &html_record (&array_to_hash($_, @hits)); } if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } print qq|
|; &html_footer; print qq|
$html_title: Record Modified. | |
<$font> The following record was successfully modified: |; &html_record(&get_record($in{$db_key})); print qq| |; &html_footer; print qq| |
$html_title: Error! Unauthorized Action. | |
<$font> The database program received a command that you are not authorized for. |; &html_footer; print qq| |
$html_title: Error! Unkown Action. | |
<$font> The database program received a command that it did not understand. |; &html_footer; print qq| |