#!/usr/local/bin/perl #
############################# About The Script ######################################### # # Script Name:# Creator : # Date : # Description: # # COPYRIGHT NOTICE # (C) Copyright 2000 All Rights Reserved. # # This script may be used and modified free of charge by anyone so long as # this copyright notice and the comments above remain intact. By using this # code you agree to indemnify the creator (identified above) from any liability that # might arise from it's use. # # Selling the code for this program without prior written consent is # expressly forbidden. In other words, please ask first before you try and # make money off of my program. # # Obtain permission before redistributing this software over the Internet or # in any other medium. In all cases copyright and header must remain intact. # ############################# Operational Requirements/Instructions #################### # # Intended Platform: # Platform Tested: # # REQUIRED RESOURCES: # # Modules: cgi_html_bfb # APIs: # Datastores: GDBM # Applications: # Other: # # Intstallation Instructions: # ############################# Release Schedule of Changes ############################## # # RELEASES: # # Ver: Date: Developer: Description of changes: # # 0x.xx xx/xx/xxxx # 00.00 xx/xx/xxxx Initial Release # $Version = "00.00"; # Keep current with that above release info use cgi_html_bfb qw (Parse_Form_Data Load_Header Load_Footer); ######################################################################################## # Configuration variables -- application specific ######################################################################################## #$header_html = '/web/cgi-bin/header.html'; # Path to User's header (example) $header_html = ''; # Path to User's header $footer_html = ''; # Path to User's footer $exec_prog = '/cgi-bin/starter.pl'; # Path to starter.pl script (rename) $bookmark = ''; # Bookmark as shown on browser $webmaster = 'admin@somewhere.com'; # Name of script administrator ######################################################################################## # Global variables used in this CGI script ######################################################################################## $no_cache = 0; # HTTP cache switch 1=no-caching, 0=activate BACK browser button $test_flag = 0; # Diagonistic flag: 1=test, 0=normal operation ##### BEGIN PROGRAM #################################################################### Process_Options(); ######################################################################################## # Process_Options -- Determine Submit options and process accordingly # # Parameters - # data - A hash of the key value pairs passed by a CGI form # # Returns - None ######################################################################################## sub Process_Options { my %data = &Parse_Form_Data($webmaster); Start_Page(%data) if ($data{'submit'} eq ''); ## nothing passed -- first CGI entry Modify_Page(%data) if ($data{'submit'} eq 'MODIFY'); View_Page(%data) if ($data{'submit'} eq 'VIEW'); Start_Page(%data) if ($data{'submit'} eq 'CANCEL'); } ######################################################################################## # Modify_Page -- Result of modify button in start page # # Parameters - # data - A hash of the key value pairs passed by a CGI form # # Returns - None ######################################################################################## sub Modify_Page { my (%data) = @_; my (@html, $lcv, $page_name); $page_name = "Modify RESULT"; # USAGE: Load_Header ($bookmark,$heading,$header_file,$cache,$exec,%data) -- Load array @html with header @html = &Load_Header ($bookmark,$page_name,$header_html,$no_cache,$exec_prog, %data); $lcv = @html; $html[$lcv++] = "Modify OPTION selected [$data{'choice'}] "; $html[$lcv++] = "
"; # USAGE: Load_Footer ($file,$out_file,@html) -- Load footer of HTML page, output page, and exit &Load_Footer ($footer_html,'',@html); } ######################################################################################## # View_Page -- Result of view button in start page # # Parameters - # data - A hash of the key value pairs passed by a CGI form # # Returns - None ######################################################################################## sub View_Page { my (%data) = @_; my (@html, $lcv, $page_name); $page_name = "View RESULT"; # USAGE: Load_Header ($bookmark,$heading,$header_file,$cache,$exec,%data) -- Load array @html with header @html = &Load_Header ($bookmark,$page_name,$header_html,$no_cache,$exec_prog, %data); $lcv = @html; $html[$lcv++] = "View OPTION selected [$data{'choice'}]
"; $html[$lcv++] = "
"; # USAGE: Load_Footer ($file,$out_file,@html) -- Load footer of HTML page, output page, and exit &Load_Footer ($footer_html,'',@html); } ######################################################################################## # Start_Page -- Opening page displayed when first access CGI program # # Parameters - # data - A hash of the key value pairs passed by a CGI form # # Returns - None ######################################################################################## sub Start_Page { my (%data) = @_; my (@html, $lcv, $page_name); $page_name = "CGI EXAMPLE"; # USAGE: Load_Header ($bookmark,$heading,$header_file,$cache,$exec,%data) -- Load array @html with header @html = &Load_Header ($bookmark,$page_name,$header_html,$no_cache,$exec_prog, %data); $lcv = @html; $html[$lcv++] = "Current options available
"; $html[$lcv++] = "
"; $html[$lcv++] = "
"; $html[$lcv++] = ""; $html[$lcv++] = " "; $html[$lcv++] = " "; $html[$lcv++] = "To the left are the options available to you at this time."; $html[$lcv++] = "
Select option in scroll list to the right and then click [MODIFY] or [VIEW] below"; $html[$lcv++] = ""; $html[$lcv++] = ""; # USAGE: Load_Footer ($file,$out_file,@html) -- Load footer of HTML page, output page, and exit &Load_Footer ($footer_html,'',@html); }