sub Add { # Add # Add is responsible for adding a question to the database. # First it must check the form input, second, see if there # are any other database questions for that location, when # there are other questions it must ask the user to set the # order of the questions for the location. Finally, Add must # edit the database two ways: a count must be incremented # and the entry must be assembeled and then added to the # database # First it must check the form input and respond with a # confirmation screen. It must also see if there are any # other database questions for that location, when there # are other questions it must ask the user to set the order # of the questions for the location. When this is necescary, # the set order will be displayed in the confirmation screen. # So we must figure out here if this is the first or second call # to Add. The finalize screen will do all the DB editing, it will # be a form and all the entries will be of type input->hidden. In # that form will be the value "finalizeadd". so we check now to # see if that exists. If it does not, we check the form. If it # does we add to the DB. if ($call{'finalizeadd'}){ # it is the second call to Add # Add must edit the database two ways:a count must be # incremented and the entry must be assembeled and then # added to the database &openDBhash; # dbaccess.pl &incrementDBcount; # dbaccess.pl # If we have had multiple questions, we need to set the # order field of each question that matches in the DB. if ($call{'matchquestions'}){ &setOrderOfDisplayQuestions; # dbaccess.pl } &assembleQuestionEntry; # parsedata.pl &addEntryToDatabase; # dbaccess.pl &closeDBhash; # dbaccess.pl &printHtmlHeader; # htmlroutines.pl &printAddQuestionSummary; # htmlroutines.pl # Discussion: The idea printAddQuestionForm is that the user # shouldn't have to do anything special to add more questions. # We should display this form, but the issue is that there may # be some special form that the user has or there may be another # application pre-producing the form before it gets to notebook. # It's not implemented because of this and the user will have # to hit back and reset and use their own form. For example: # The riverweb:preproduction:addquestion cgi has to pre-parse # strings to set the form variables to "x=y" format. # &printAddQuestionForm; # htmlroutines.pl &printHtmlFooter; # htmlroutines.pl } else { # it is the first call to Add &checkFormAddQuestion; # parsedata.pl &searchForMatchQuestions; # dbaccess.pl &printHtmlHeader; # htmlroutines.pl &printFinalizeAddForm; # htmlroutines.pl &printHtmlFooter; # htmlroutines.pl } } 1;