/* signupCGI.cc  	This is a subclass of CGISession.cc, the dBASE Web Class.
						It adds custom formatting to the "Sorry" page to match
                  the Visual dBASE 7.5 Conference Signup sample application

   Usage				oCGI = new sampleCGISession()

   Author:			A. A. Katz  01/17/2000  dBASE Inc.
*/


Class SignupCGISession of CGISession from "Webclass.cc"

   ////// Method:   SorryPage //////////////////////////////////////////////
   ////// Purpose:    Returns Sorry page in response to user ///////////////
   ////// Param:      cMsg  = Error Message ////////////////////////////////
   //////             		   Accepts a char string or array of messages ///
   //////             cSubTtl Subtitle, such as 'An error has ocurred"  or /
   //////                    "data missing" ////////////////////////////////
   //////             cRecover = Suggestion for recovery ///////////////////
   //////                     such as "Press the browser's back button" ////
   //////                     or contact Web master..

   Function SorryPage(cMsg,cSubTtl,cRcvr)
  
      cMess = iif(empty(cMsg),'',cMsg)

      if type('cMess') = 'C'   // if message is not array,
         cMess = new array()   // convert to a one-element array
         cMess.add(cMsg)
      endif
                               // Make private versions for type()
      cRecover =  iif(empty(cRcvr),'',cRcvr)  
      cSubtitle = iif(empty(cSubTtl),'',cSubTtl)


      /////// Stream out header
      this.StreamHeader('Sorry!')

      with (this.fOut)

         ////// Body tag (starts body of page)  
         puts('<BODY LINK="#009999" VLINK="#009999">')

         ////// Table is used to format color and text

         ////// First row of table with 'Sorry" display.
         puts('<P>')
         puts('<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" WIDTH="100%">')
         puts('   <TR>')
         puts('   <TD WIDTH="13%" HEIGHT="77" BGCOLOR="silver">&nbsp;</TD>')
         puts('   <TD WIDTH="3%" HEIGHT="77" BGCOLOR="silver">&nbsp;</TD>')
         puts('   <TD WIDTH="4%" HEIGHT="77" BGCOLOR="silver">&nbsp;</TD>')
         puts('   <TD WIDTH="7%" HEIGHT="77" BGCOLOR="white">&nbsp;</TD>')
         puts('   <TD WIDTH="73%" HEIGHT="77" BGCOLOR="white">')
         puts('      <H1><FONT COLOR="#009999" FACE="Arial, Helvetica">Sorry!</FONT>')
         puts('   </TD>')
         puts('</TR>')

         ////// Narrow gray horizontal stripe
         puts('<TR>')
         puts('   <TD WIDTH="13%" BGCOLOR="silver">&nbsp;</TD>')
         puts('   <TD WIDTH="3%" BGCOLOR="#CECECE">&nbsp;</TD>')
         puts('   <TD WIDTH="4%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('   <TD WIDTH="7%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('   <TD WIDTH="73%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('</TR>')

         ////// If there is a "Subtitle" , such as "An error has ocurred on the
         ////// Server!
         if len(cSubtitle) > 0
            ///// Page subtitle
            puts('<TR>')
            puts('   <TD WIDTH="13%" BGCOLOR="silver">&nbsp;</TD>')
            puts('   <TD WIDTH="3%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
            puts('   <TD WIDTH="4%">&nbsp;</TD>')
            puts('   <TD WIDTH="7%">&nbsp;</TD>')
            puts('   <TD WIDTH="73%"><I><FONT COLOR="#009999" FACE="Arial, Helvetica">'+cSubtitle+'</FONT></I></TD>')
            puts('</TR>')
         endif

         ////// Empty row for spacing
         puts('<TR>')
         puts('   <TD WIDTH="13%" BGCOLOR="silver">&nbsp;</TD>')
         puts('   <TD WIDTH="3%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('   <TD WIDTH="4%">&nbsp;</TD>')
         puts('   <TD WIDTH="7%">&nbsp;</TD>')
         puts('  <TD WIDTH="73%">&nbsp;</TD>')
         puts('</TR>')
 
         for n = 1 to cMess.size 
            puts('<TR>')
            puts('   <TD WIDTH="13%">&nbsp;</TD>')
            puts('   <TD WIDTH="3%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
            puts('   <TD WIDTH="4%">&nbsp;</TD>')
            puts('   <TD WIDTH="7%">&nbsp;</TD>')
            puts('  <TD WIDTH="73%">'+cMess[n]+'</TD>')
            puts('</TR>')     
         next

          ////// Empty row for spacing
         puts('<TR>')
         puts('   <TD WIDTH="13%">&nbsp;</TD>')
         puts('   <TD WIDTH="3%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('   <TD WIDTH="4%">&nbsp;</TD>')
         puts('   <TD WIDTH="7%">&nbsp;</TD>')
         puts('  <TD WIDTH="73%">&nbsp;</TD>')
         puts('</TR>')
 
         ////// Stream out recovery instructions
         cRecover = iif(empty(cRecover),"Press Browser's Back Button and try again.",;
                        cRecover)
         puts('<TR>')
         puts('   <TD WIDTH="13%">&nbsp;</TD>')
         puts('   <TD WIDTH="3%" BGCOLOR="#E4E4E4">&nbsp;</TD>')
         puts('   <TD WIDTH="4%">&nbsp;</TD>')
         puts('   <TD WIDTH="7%">&nbsp;</TD>')
         puts('   <TD WIDTH="73%"><I><FONT COLOR="#009999" FACE="Arial, Helvetica">'+;
                       cRecover+'</FONT></I></TD>')
         puts('</TR>')

         ////// Close table
         puts('</Table>')


      endwith

      ////// Close out HTML structure
      this.StreamFooter()
 
      quit

endClass

