# # ---------------------- # 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 ## ########################################################## $html_title = 'Feicke Web Workorder System'; ########################################################## ## 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 #
and
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 = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399'; print qq| <$font>
ID:

Job Number

Date Received
Customer Customer P.O.
Address
Contact Sales Rep
Phone Number Commission |; print &build_select_field("commission",$rec{'commission'}); print qq|
Fax Number
e-mail Delivery Date
Job Code Book Type |; print &build_select_field("book_type",$rec{'book_type'}); print qq|
QTY Paper Stock
Ink Color Stock Width
Prints Flat Size
Number of Pages Finish Size
Self Cover? (Y/N) |; print &build_select_field("self_cover",$rec{'self_cover'}); print qq| Number of Sections
fold online: |; print &build_select_field("fold_online",$rec{'fold_online'}); print qq| perf online: |; print &build_select_field("perf_online",$rec{'perf_online'}); print qq|
remoist glue: |; print &build_select_field("remoist_glue",$rec{'remoist_glue'}); print qq| glue inline |; print &build_select_field("glue_inline",$rec{'glue_inline'}); print qq|
prepress: |; print &build_select_field("prepress",$rec{'prepress'}); print qq| proof type: |; print &build_select_field("proof_type",$rec{'proof_type'}); print qq|
press: |; print &build_select_field("press",$rec{'press'}); print qq| press date:
stock order date: stock due date:
vendor: po number:
bindery:
|; if ($per_admin) { print qq| |; } else { print qq| |; } print qq|
out source: |; print &build_select_field("out_source",$rec{'out_source'}); print qq|
out source what:
out source who:
out source due too:
out source due back:
out source cost:
out source notes:

our truck: |; print &build_select_field("our_truck",$rec{'our_truck'}); print qq| qty shipped:
ship to: other shipping:
comments:

approval: |; print &build_select_field("approval",$rec{'approval'}); print qq| approval date:
approval by who: approval how:
approval notes:

stat prepress: |; print &build_select_field("stat_prepress",$rec{'stat_prepress'}); print qq| stat bindery: |; print &build_select_field("stat_bindery",$rec{'stat_bindery'}); print qq|
stat stripping: |; print &build_select_field("stat_stripping",$rec{'stat_stripping'}); print qq| stat out source: |; print &build_select_field("stat_out_source",$rec{'stat_out_source'}); print qq|
stat press: |; print &build_select_field("stat_press",$rec{'stat_press'}); print qq| stat shipping: |; print &build_select_field("stat_shipping",$rec{'stat_shipping'}); print qq|

Invoice: |; print &build_select_field("invoice",$rec{'invoice'}); print qq|
|; } sub html_record { # -------------------------------------------------------- # How a record will be displayed. This is used primarily in # returning search results and how it is formatted. The record to # be displayed will be in the %rec hash. my (%rec) = @_; # Load any defaults to put in the VALUE field. ($db_auto_generate and print &build_html_record(%rec) and return); my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399'; my $font = 'Font face="Verdana, Arial, Helvetica" Size=2'; print qq|
<$font>

Job Number

$rec{'Job_Number'} Date Received $rec{'Date'}
Customer $rec{'customer'} Customer P.O. $rec{'customer_po'}
Address $rec{'address'}
Contact $rec{'contact'} Sales Rep $rec{'sales_rep'}
Phone Number $rec{'phone'} Commission $rec{'commission'}
Fax Number $rec{'fax'}
e-mail $rec{'e_mail'} Delivery Date $rec{'delivery_date'}

Job Code $rec{'job_code'} Book Type $rec{'book_type'}
QTY $rec{'qty'} Paper Stock $rec{'stock'}
Ink Color $rec{'ink_colors'} Stock Width $rec{'stock_width'}
Prints $rec{'prints'} Flat Size $rec{'flat_size'}
Num of Pages $rec{'number_of_pages'} Finish Size $rec{'finish_size'}
Self Cover? $rec{'self_cover'} Num of Sections $rec{'print_sections'}

fold online: $rec{'fold_online'} perf online: $rec{'perf_online'}
remoist glue: $rec{'remoist_glue'} glue inline $rec{'glue_inline'}
prepress: $rec{'prepress'} proof type: $rec{'proof_type'}
press: $rec{'press'} press date: $rec{'press_date'}

stock order date: $rec{'stock_order_date'} stock due date: $rec{'stock_due_date'}
vendor: $rec{'vendor'} po number: $rec{'po_number'}
bindery: $rec{'bindery'}

Out Source
$rec{'out_source'} OS due too: $rec{'out_source_due_too'}
OS what:
$rec{'out_source_what'} OS due back: $rec{'out_source_due_back'}
OS to who:
$rec{'out_source_who'} out source cost: $rec{'out_source_cost'}
notes:
$rec{'out_source_notes'}


our truck: $rec{'our_truck'} qty shipped: $rec{'qty_shipped'}
ship to: other shipping: $rec{'other_shipping'}
comments: $rec{'comments'}
approval: $rec{'approval'} approval date: $rec{'approval_date'}
approval by who: $rec{'approval_by_who'} approval how: $rec{'approval_how'}
approval notes: $rec{'approval_notes'}

stat prepress: $rec{'stat_prepress'} stat bindery: $rec{'stat_bindery'}
stat stripping: $rec{'stat_stripping'} stat out source: $rec{'stat_out_source'}
stat press: $rec{'stat_press'} stat shipping: $rec{'stat_shipping'}

Invoice: $rec{'invoice'} $rec{'pdf_proof'}

|; } sub html_record_2 { # -------------------------------------------------------- # How a record will be displayed. This is used primarily in # returning search results and how it is formatted. The record to # be displayed will be in the %rec hash. my (%rec) = @_; # Load any defaults to put in the VALUE field. ($db_auto_generate and print &build_html_record_2(%rec) and return); my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399'; my $font = 'Font face="Verdana, Arial, Helvetica" Size=2'; print qq|
Job Number $rec{'Job_Number'} Date Received $rec{'Date'} Customer $rec{'customer'}
Job Code $rec{'job_code'} QTY $rec{'qty'} Delivery Date $rec{'delivery_date'}
approval: $rec{'approval'} approval date: $rec{'approval_date'}
stat prepress: $rec{'stat_prepress'} stat bindery: $rec{'stat_bindery'}
stat stripping: $rec{'stat_stripping'} stat out source: $rec{'stat_out_source'}
stat press: $rec{'stat_press'} stat shipping: $rec{'stat_shipping'}

|; } sub html_record_3 { # -------------------------------------------------------- # How a record will be displayed. This is used primarily in # returning search results and how it is formatted. The record to # be displayed will be in the %rec hash. my (%rec) = @_; # Load any defaults to put in the VALUE field. ($db_auto_generate and print &build_html_record_3(%rec) and return); my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399'; my $font = 'Font face="Verdana, Arial, Helvetica" Size=2'; print qq|
Job Number $rec{'Job_Number'} $rec{'Date'} $rec{'job_code'} Invoiced ? $rec{'invoice'}

|; } ########################################################## ## Home Page ## ########################################################## sub html_home { # -------------------------------------------------------- # The database manager home page. &html_print_headers; print qq| $html_title: Main Menu.






|; } sub html_footer { # -------------------------------------------------------- # Print the menu and the footer and logo. It would be nice if you left # the logo in. ;) # # We only print options that the user have permissions for. # my $font = 'Font face="Verdana, Arial, Helvetica" Size=2'; print qq!

<$font>!; print qq!| Home !; print qq!| Add ! if ($per_add); print qq!| View ! if ($per_view); print qq!| Stat Report ! if ($per_stat); print qq!| Open Job Report ! if ($per_jobs); 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. Database Powered by Gossamer Threads Inc.
!; } sub html_search_options { # -------------------------------------------------------- # Search options to be displayed at the bottom of search forms. # print qq~

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. # $rec{'Date'} = &get_date(); &html_print_headers; print qq| $html_title: Add a New Record.

$html_title: Add a New Record

<$font_title> Add a New Record

<$font> <$font>

Job Number

Date Received
Customer Customer P.O.
Address
Contact Sales Rep
Phone Number Commission |; print &build_select_field("commission",$rec{'commission'}); print qq|
Fax Number
e-mail Delivery Date
Job Code Book Type |; print &build_select_field("book_type",$rec{'book_type'}); print qq|
QTY Paper Stock
Ink Color Stock Width
Prints Flat Size
Number of Pages Finish Size
Self Cover? (Y/N) |; print &build_select_field("self_cover",$rec{'self_cover'}); print qq| Number of Sections
fold online: |; print &build_select_field("fold_online",$rec{'fold_online'}); print qq| perf online: |; print &build_select_field("perf_online",$rec{'perf_online'}); print qq|
remoist glue: |; print &build_select_field("remoist_glue",$rec{'remoist_glue'}); print qq| glue inline |; print &build_select_field("glue_inline",$rec{'glue_inline'}); print qq|
prepress: |; print &build_select_field("prepress",$rec{'prepress'}); print qq| proof type: |; print &build_select_field("proof_type",$rec{'proof_type'}); print qq|
press: |; print &build_select_field("press",$rec{'press'}); print qq| press date:
stock order date: stock due date:
vendor: po number:
bindery:
|; if ($per_admin) { print qq| |; } else { print qq| |; } print qq|
out source: |; print &build_select_field("out_source",$rec{'out_source'}); print qq|
out source what:
out source who:
out source due too:
out source due back:
out source cost:
out source notes:

our truck: |; print &build_select_field("our_truck",$rec{'our_truck'}); print qq| qty shipped:
ship to: other shipping:
comments:

approval: |; print &build_select_field("approval",$rec{'approval'}); print qq| approval date:
approval by who: approval how:
approval notes:

stat prepress: |; print &build_select_field("stat_prepress",$rec{'stat_prepress'}); print qq| stat bindery: |; print &build_select_field("stat_bindery",$rec{'stat_bindery'}); print qq|
stat stripping: |; print &build_select_field("stat_stripping",$rec{'stat_stripping'}); print qq| stat out source: |; print &build_select_field("stat_out_source",$rec{'stat_out_source'}); print qq|
stat press: |; print &build_select_field("stat_press",$rec{'stat_press'}); print qq| stat shipping: |; print &build_select_field("stat_shipping",$rec{'stat_shipping'}); print qq|

|; &html_footer; print qq|
|; } sub html_add_success { # -------------------------------------------------------- # The page that is returned upon a successful addition to # the database. You should use &get_record and &html_record # to verify that the record was inserted properly and to make # updating easier. &get_record($in{$db_key}); &html_print_headers; print qq| $html_title: Record Added.
<$font>

Job Number

$rec{'Job_Number'} Date Received $rec{'Date'}
Customer $rec{'customer'} Customer P.O. $rec{'customer_po'}
Address $rec{'address'}
Contact $rec{'contact'} Sales Rep $rec{'sales_rep'}
Phone Number $rec{'phone'} Commission $rec{'commission'}
Fax Number $rec{'fax'}
e-mail $rec{'e_mail'} Delivery Date $rec{'delivery_date'}

Job Code $rec{'job_code'} Book Type $rec{'book_type'}
QTY $rec{'qty'} Paper Stock $rec{'stock'}
Ink Color $rec{'ink_colors'} Stock Width $rec{'stock_width'}
Prints $rec{'prints'} Flat Size $rec{'flat_size'}
# of Pages $rec{'number_of_pages'} Finish Size $rec{'finish_size'}
Self Cover? $rec{'self_cover'} # of Sections $rec{'print_sections'}

fold online: $rec{'fold_online'} perf online: $rec{'perf_online'}
remoist glue: $rec{'remoist_glue'} glue inline $rec{'glue_inline'}
prepress: $rec{'prepress'} proof type: $rec{'proof_type'}
press: $rec{'press'} press date: $rec{'press_date'}

stock order date: $rec{'stock_order_date'} stock due date: $rec{'stock_due_date'}
vendor: $rec{'vendor'} po number: $rec{'po_number'}
bindery: $rec{'bindery'}

Out Source
$rec{'out_source'} OS due too: $rec{'out_source_due_too'}
OS what:
$rec{'out_source_what'} OS due back: $rec{'out_source_due_back'}
OS to who:
$rec{'out_source_who'} out source cost: $rec{'out_source_cost'}
notes:
$rec{'out_source_notes'}


our truck: $rec{'our_truck'} qty shipped: $rec{'qty_shipped'}
ship to: other shipping: $rec{'other_shipping'}
comments:

|; &html_footer; print qq|
|; } sub html_add_failure { # -------------------------------------------------------- # The page that is returned if the addition failed. An error message # is passed in explaining what happened in $message and the form is # reprinted out saving the input (by passing in %in to html_record_form). my ($message) = $_[0]; &html_print_headers; print qq| $html_title: Error! Unable to Add Record.
$html_title: Error: Unable to Add Record

<$font_title> Error: Unable to Add Record

<$font> There were problems with the following fields: $message

Please fix any errors and submit the record again.

|; &html_record_form (%in); print qq|

|; &html_footer; print qq|
|; } ########################################################## ## Viewing ## ########################################################## sub html_view_search { # -------------------------------------------------------- # This page is displayed when a user requests to search the # database for viewing. # Note: all searches must use GET method. # &html_print_headers; print qq| $html_title: Search the Database.
$html_title: Search the Database

<$font_title> Search the Database

<$font> |; &html_record_form(); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } sub html_view_success { # -------------------------------------------------------- # This page displays the results of a successful search. # You can use the following variables when displaying your # results: # # $numhits - the number of hits in this batch of results. # $maxhits - the max number of hits displayed. # $db_total_hits - the total number of hits. # $db_next_hits - html for displaying the next set of results. # my (@hits) = @_; my ($numhits) = ($#hits+1) / ($#db_cols+1); my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits); &html_print_headers; print qq| $html_title: Search Results.
$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|

|; } 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 Failed.
$html_title: Search Failed

<$font_title> Search Failed

<$font>

There were problems with the search. Reason: $message
Please fix any errors and submit the record again.

|; &html_record_form(%in); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } ########################################################## ## Stat Report ## ########################################################## sub html_stat_search { # -------------------------------------------------------- # This page is displayed when a user requests to search the # database for viewing. # Note: all searches must use GET method. # &html_print_headers; print qq| $html_title: Search the Database.
$html_title: Search the Database

<$font_title> Search the Database

<$font> |; &html_record_form(); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } sub html_stat_success { # -------------------------------------------------------- # This page displays the results of a successful search. # You can use the following variables when displaying your # results: # # $numhits - the number of hits in this batch of results. # $maxhits - the max number of hits displayed. # $db_total_hits - the total number of hits. # $db_next_hits - html for displaying the next set of results. # my (@hits) = @_; my ($numhits) = ($#hits+1) / ($#db_cols+1); my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits); &html_print_headers; print qq| $html_title: Search Results.
$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_2 (&array_to_hash($_, @hits)); } if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } print qq|

|; &html_footer; print qq|

|; } sub html_stat_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 Failed.
$html_title: Search Failed

<$font_title> Search Failed

<$font>

There were problems with the search. Reason: $message
Please fix any errors and submit the record again.

|; &html_record_form(%in); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } ########################################################## ## Open Job Report ## ########################################################## sub html_jobs_search { # -------------------------------------------------------- # This page is displayed when a user requests to search the # database for viewing. # Note: all searches must use GET method. # &html_print_headers; print qq| $html_title: Search the Database.
$html_title: Search the Database

<$font_title> Search the Database

<$font> |; &html_record_form(); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } sub html_jobs_success { # -------------------------------------------------------- # This page displays the results of a successful search. # You can use the following variables when displaying your # results: # # $numhits - the number of hits in this batch of results. # $maxhits - the max number of hits displayed. # $db_total_hits - the total number of hits. # $db_next_hits - html for displaying the next set of results. # my (@hits) = @_; my ($numhits) = ($#hits+1) / ($#db_cols+1); my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits); &html_print_headers; print qq| $html_title: Search Results.
$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_3 (&array_to_hash($_, @hits)); } if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } print qq|

|; &html_footer; print qq|

|; } sub html_jobs_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 Failed.
$html_title: Search Failed

<$font_title> Search Failed

<$font>

There were problems with the search. Reason: $message
Please fix any errors and submit the record again.

|; &html_record_form(%in); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } ########################################################## ## Deleting ## ########################################################## sub html_delete_search { # -------------------------------------------------------- # The page is displayed when a user wants to delete records. First # the user has to search the database to pick which records to delete. # That's handled by this form. &html_print_headers; print qq| $html_title: Search the Database for Deletion.
$html_title: Search the Database for Deletion

<$font_title> Search the Database for Deletion

<$font>

Search the database for the records you wish to delete or list all:

|; &html_record_form(); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } sub html_delete_form { # -------------------------------------------------------- # The user has searched the database for deletion and must now # pick which records to delete from the records returned. This page # should produce a checkbox with name=ID value=delete for each record. # We have to do a little work to convert the array @hits that contains # the search results to a hash for printing. my ($status, @hits) = &query("mod"); my ($numhits) = ($#hits+1) / ($#db_cols+1); my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits); my (%tmp); &html_print_headers; print qq| $html_title: Delete Record(s).
$html_title: Delete Record(s)

<$font> Check which records you wish to delete and then press "Delete Records":
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. Also add a checkbox with name=key and value=delete. if ($status ne "ok") { # There was an error searching! print qq|

Error: $status

|; } else { print "

"; for (0 .. $numhits - 1) { %tmp = &array_to_hash($_, @hits); print qq|
|; &html_record (%tmp); print qq|
\n|; } if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } } print qq|

|; &html_footer; print qq|

|; } sub html_delete_success { # -------------------------------------------------------- # This page let's the user know that the records were successfully # deleted. my $message = shift; &html_print_headers; print qq| $html_title: Record(s) Deleted.
$html_title: Record(s) Deleted.

<$font_title> Record(s) Deleted

<$font> The following records were deleted from the database: '$message'.

|; &html_footer; print qq|
|; } sub html_delete_failure { # -------------------------------------------------------- # This page let's the user know that some/all of the records were # not deleted (because they were not found in the database). # $errstr contains a list of records not deleted. my ($errstr) = $_[0]; &html_print_headers; print qq| $html_title: Error: Record(s) Not Deleted.
$html_title: Error: Record(s) Not Deleted

<$font_title> Error: Record(s) Not Deleted

<$font> The records with the following keys were not found in the database: '$errstr'.

|; &html_footer; print qq|
|; } ########################################################## ## Modifying ## ########################################################## sub html_modify_search { # -------------------------------------------------------- # The page is displayed when a user wants to modify a record. First # the user has to search the database to pick which record to modify. # That's handled by this form. &html_print_headers; print qq| $html_title: Search the Database for Modifying.
$html_title: Search the Database for Modifying

<$font_title> Search the Database for Modifying

<$font>

Search the database for the records you wish to modify or list all:

|; &html_record_form(); print qq| |; &html_search_options; print qq|

|; &html_footer; print qq|
|; } sub html_modify_form { # -------------------------------------------------------- # The user has searched the database for modification and must now # pick which record to modify from the records returned. This page # should produce a radio button with name=modify value=ID for each record. # We have to do a little work to convert the array @hits that contains # the search results to a hash for printing. my (%tmp); my ($status, @hits) = &query("mod"); my ($numhits) = ($#hits+1) / ($#db_cols+1); if (($numhits == 1) and !$in{'nh'}) { $in{'modify'} = $hits[$db_key_pos]; &html_modify_form_record(); return; } my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits); &html_print_headers; print qq| $html_title: Modify Record.
$html_title: Modify Record

<$font> Check which record you wish to modify and then press "Modify Records":
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. Also add a radio button with name=modify # and value=key. if ($status ne "ok") { # Error searching database! print qq|

Error: $status|; } else { print "

"; for (0 .. $numhits - 1) { %tmp = &array_to_hash($_, @hits); print qq|
|; &html_record (%tmp); print qq|
\n|; } if ($db_next_hits) { print "
<$font>Pages: $db_next_hits"; } } print qq|

|; &html_footer; print qq|

|; } sub html_modify_form_record { # -------------------------------------------------------- # The user has picked a record to modify and it should appear # filled in here stored in %rec. If we can't find the record, # the user is sent to modify_failure. my (%rec) = &get_record($in{'modify'}); if (!%rec) { &html_modify_failure("unable to find record/no record specified: $in{'modify'}"); return; } &html_print_headers; print qq| $html_title: Modify a Record.
$html_title: Modify a Record

<$font_title> Modify a Record

<$font> |; &html_record_form (%rec); print qq|

|; &html_footer; print qq|
|; } sub html_modify_success { # -------------------------------------------------------- # The user has successfully modified a record, and this page will # display the modified record as a confirmation. &html_print_headers; print qq| $html_title: Record Modified.
$html_title: Record Modified.

<$font_title> Record Modified

<$font> The following record was successfully modified:

|; &html_record(&get_record($in{$db_key})); print qq| |; &html_footer; print qq|
|; } sub html_modify_failure { # -------------------------------------------------------- # There was an error modifying the record. $message contains # the reason why. my ($message) = $_[0]; &html_print_headers; print qq| $html_title: Error! Unable to Modify Record.
$html_title: Error! Unable to Modify Record.

<$font_title> Error: Unable to Modify Record

<$font> There were problems modifying the record: $message
Please fix any errors and submit the record again.

|; &html_record_form (%in); print qq|

|; &html_footer; print qq|
|; } ########################################################## ## Authentication ## ########################################################## sub html_login_form { # -------------------------------------------------------- # The login screen. &html_print_headers; print qq| $html_title: Login.
$html_title: Login

<$font_title> Log On

<$font>Welcome! You need to have an active account to access $html_title. For the demo, you can use userid/passwords: 'admin/admin', 'author/author', 'guest/guest'.

User ID:
Password:

|; } sub html_login_failure { # -------------------------------------------------------- # There was an error loggin in. The error message is stored in $message. my ($message) = $_[0]; &html_print_headers; print qq| $html_title: Login Error.
$html_title: Login Error

<$font_title> Log On Error

<$font>Oops, there was a problem logging into the system: $message.

Please try logging in again, or contact the system administrator.

User ID:
Password:

|; } sub html_admin_display { # -------------------------------------------------------- # The displays the list of current users. my ($message, $user_list, $password, $permissions) = @_; &html_print_headers; print qq| $html_title: User Management.
$html_title: User Management

<$font_title> User Management

<$font>$message

<$font>User List: $user_list
<$font>New Username:
<$font>Change Password:
<$font>Permissions:
$permissions

|; &html_footer; print qq|

|; } sub html_unauth { # -------------------------------------------------------- # A user tried to do something he was not authorized for. &html_print_headers; print qq| $html_title: Error! Unauthorized Action.
$html_title: Error! Unauthorized Action.

<$font_title> Error: Unauthorized Action

<$font> The database program received a command that you are not authorized for.

|; &html_footer; print qq|
|; } sub html_signup_form { # -------------------------------------------------------- # This form is displayed for new users who want to create an account. # my $error = shift; &html_print_headers; print qq| $html_title: Create Account.
$html_title: Create Account

<$font_title> Create Account

<$font>To create your own account, simply enter in your desired username and password.

|; if ($error) { print "$error

"; } print qq|
User ID:
Password:

|; } sub html_signup_success { # -------------------------------------------------------- # The user has successfully created a new account. &html_print_headers; print qq| $html_title: Account Created.
$html_title: Account Created

<$font_title> Account Created

<$font>Your account has been set up! Use your username and password to log in.

User ID:
Password:

|; } ########################################################## ## Misc ## ########################################################## sub html_unkown_action { # -------------------------------------------------------- # The program received a command it did not recognize. &html_print_headers; print qq| $html_title: Error! Unknown Action.
$html_title: Error! Unkown Action.

<$font_title> Error: Unknown Action

<$font> Oh my GOD what did you do???????, well don't do it again!.

|; &html_footer; print qq|
|; } sub html_print_headers { # -------------------------------------------------------- # Print out the headers if they haven't already been printed. if (!$html_headers_printed) { print "Content-type: text/html\n\n"; $html_headers_printed = 1; } } 1;