#!/usr/bin/perl # newdb.cgi # multipage cgi that creates and populates a database # Calls to this Script: # initial call # Second Call # Define Keyword set # Define associated values # 1 Initial Call: Display form that has basic database entry fields # 2 Second Call: Check form input, create and populate the database # Respond with define keyword set form # 3 Define keyword set: print a form that prints associated value entry fields. # 4 Define associated values: prepare and add string to database # if checkbox checked. print define keyword set form or # if finished, print Registration Summary #################### # first we must get files and set variables require 'parseform.pl'; require 'getdate.pl'; require 'checkemail.pl'; require 'printhtml.pl'; require 'subroutines.pl'; $tmpdir = '/tmp/'; $databasedir = '/usr/local/jail/www/htdocs/ncsa/riverweb/notebook/notebook1/database/'; $script = "newdb.cgi"; $notebookcgi = "/ncsa/riverweb/notebook/notebook1/notebook.cgi"; ################ $logdata = "/usr/local/jail/www/htdocs/ncsa/riverweb/notebook/register/logdata"; print "Content-type: text/html\n\n"; use DB_File; # program &ParseForm; # parseform.pl if ($call{'secondcall'}){ &SecondCall; # newdb.cgi } elsif ($call{'definekeywordset'}){ &DefineKeywordSet; # newdb.cgi } elsif ($call{'defineassociatedvalues'}){ &DefineAssociatedValues; # newdb.cgi } else { &InitialCall; # printhtml.pl } # Second level Subroutines sub SecondCall{ # Second Call: Check form input, create and populate the database # Respond with define keyword set form #&CheckFields; # subroutines.pl #$email = $call{'contactemail'}; #&CheckEmail; # checkemail.pl &CheckDatabaseName; # subroutines.pl if ($error){ &PrintError; # printhtml.pl exit; } # print "Second Call: $!"; &GetDate; # getdate.pl &CreateDatabase; # subroutines.pl &AddBasicInfo; # subroutines.pl &PrintDefineKeywordSet; # printhtml.pl } sub DefineKeywordSet{ # Define keyword set: print a form that prints associated value entry fields. $keyword = $call{'keyword'}; $values = $call{'values'}; &PrintDefineAssociatedValues; # printhtml.pl } sub DefineAssociatedValues{ # Define associated values: prepare and add string to database # if checkbox checked. print define keyword set form or # if finished, print Registration Summary &openDBhash; &PrepareString; # subroutines.pl &AddStringToDatabase; # subroutines.pl if ($form{'addset'}){ &PrintDefineKeywordSet; # newdb.cgi } else{ &PrintRegistrationSummary; # printhtml.pl } &closeDBhash; } exit;