home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1999 January / dppcpro0199a.iso / January / Fp98 / SDK / Wizards / Webs / Realest.wiz / Realest.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-09-18  |  29.8 KB  |  870 lines

  1. VERSION 5.00
  2. Begin VB.Form realest 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Real Estate Web Wizard"
  5.    ClientHeight    =   8715
  6.    ClientLeft      =   1200
  7.    ClientTop       =   1545
  8.    ClientWidth     =   12090
  9.    ForeColor       =   &H80000008&
  10.    Icon            =   "realest.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    PaletteMode     =   1  'UseZOrder
  15.    ScaleHeight     =   8715
  16.    ScaleWidth      =   12090
  17.    ShowInTaskbar   =   0   'False
  18.    Begin VB.PictureBox pg 
  19.       BackColor       =   &H00C0C0C0&
  20.       BeginProperty Font 
  21.          Name            =   "MS Sans Serif"
  22.          Size            =   8.25
  23.          Charset         =   0
  24.          Weight          =   700
  25.          Underline       =   0   'False
  26.          Italic          =   0   'False
  27.          Strikethrough   =   0   'False
  28.       EndProperty
  29.       Height          =   3810
  30.       Index           =   3
  31.       Left            =   5040
  32.       ScaleHeight     =   3750
  33.       ScaleWidth      =   4455
  34.       TabIndex        =   14
  35.       Tag             =   "0"
  36.       Top             =   4740
  37.       Visible         =   0   'False
  38.       Width           =   4515
  39.       Begin VB.TextBox txtEmailAddress 
  40.          Height          =   285
  41.          Left            =   675
  42.          TabIndex        =   18
  43.          Top             =   1515
  44.          Width           =   3555
  45.       End
  46.       Begin VB.TextBox txtCompanyName 
  47.          Height          =   285
  48.          Left            =   660
  49.          TabIndex        =   16
  50.          Top             =   885
  51.          Width           =   3555
  52.       End
  53.       Begin VB.Label Label11 
  54.          Appearance      =   0  'Flat
  55.          BackColor       =   &H80000005&
  56.          BackStyle       =   0  'Transparent
  57.          Caption         =   "Email Address"
  58.          ForeColor       =   &H80000008&
  59.          Height          =   195
  60.          Left            =   675
  61.          TabIndex        =   11
  62.          Top             =   1275
  63.          Width           =   3555
  64.       End
  65.       Begin VB.Label Label10 
  66.          Appearance      =   0  'Flat
  67.          BackColor       =   &H00000000&
  68.          BackStyle       =   0  'Transparent
  69.          Caption         =   "Company Name"
  70.          ForeColor       =   &H80000008&
  71.          Height          =   195
  72.          Left            =   660
  73.          TabIndex        =   17
  74.          Top             =   645
  75.          Width           =   3555
  76.       End
  77.       Begin VB.Label Label8 
  78.          Appearance      =   0  'Flat
  79.          BackColor       =   &H80000005&
  80.          BackStyle       =   0  'Transparent
  81.          Caption         =   "Test for web meta-info variables that will be used by Substitution Bots:"
  82.          ForeColor       =   &H80000008&
  83.          Height          =   675
  84.          Left            =   0
  85.          TabIndex        =   15
  86.          Top             =   0
  87.          Width           =   4485
  88.       End
  89.    End
  90.    Begin VB.PictureBox pg 
  91.       BackColor       =   &H00C0C0C0&
  92.       BeginProperty Font 
  93.          Name            =   "MS Sans Serif"
  94.          Size            =   8.25
  95.          Charset         =   0
  96.          Weight          =   700
  97.          Underline       =   0   'False
  98.          Italic          =   0   'False
  99.          Strikethrough   =   0   'False
  100.       EndProperty
  101.       Height          =   3810
  102.       Index           =   2
  103.       Left            =   360
  104.       ScaleHeight     =   3750
  105.       ScaleWidth      =   4455
  106.       TabIndex        =   12
  107.       Tag             =   "0"
  108.       Top             =   4800
  109.       Visible         =   0   'False
  110.       Width           =   4515
  111.       Begin VB.OptionButton optThree 
  112.          Caption         =   "Option Three"
  113.          Height          =   255
  114.          Left            =   480
  115.          TabIndex        =   25
  116.          Top             =   1680
  117.          Width           =   3135
  118.       End
  119.       Begin VB.OptionButton optTwo 
  120.          Caption         =   "Option Two"
  121.          Height          =   255
  122.          Left            =   480
  123.          TabIndex        =   24
  124.          Top             =   1320
  125.          Width           =   3135
  126.       End
  127.       Begin VB.OptionButton optOne 
  128.          Caption         =   "Option One"
  129.          Height          =   255
  130.          Left            =   480
  131.          TabIndex        =   23
  132.          Top             =   960
  133.          Width           =   3135
  134.       End
  135.       Begin VB.Label Label9 
  136.          Appearance      =   0  'Flat
  137.          BackColor       =   &H80000005&
  138.          BackStyle       =   0  'Transparent
  139.          Caption         =   "This is a test to see how radio buttons behave when INI file settings are restored ..."
  140.          ForeColor       =   &H80000008&
  141.          Height          =   675
  142.          Left            =   0
  143.          TabIndex        =   13
  144.          Top             =   0
  145.          Width           =   4485
  146.       End
  147.    End
  148.    Begin VB.PictureBox pg 
  149.       BackColor       =   &H00C0C0C0&
  150.       BeginProperty Font 
  151.          Name            =   "MS Sans Serif"
  152.          Size            =   8.25
  153.          Charset         =   0
  154.          Weight          =   700
  155.          Underline       =   0   'False
  156.          Italic          =   0   'False
  157.          Strikethrough   =   0   'False
  158.       EndProperty
  159.       Height          =   3810
  160.       Index           =   1
  161.       Left            =   7320
  162.       ScaleHeight     =   3750
  163.       ScaleWidth      =   4455
  164.       TabIndex        =   9
  165.       Tag             =   "0"
  166.       Top             =   165
  167.       Visible         =   0   'False
  168.       Width           =   4515
  169.       Begin VB.CheckBox chkQuestions 
  170.          Caption         =   "Real Estate Q&&A Feature"
  171.          Height          =   255
  172.          Left            =   480
  173.          TabIndex        =   22
  174.          Top             =   1440
  175.          Width           =   3075
  176.       End
  177.       Begin VB.CheckBox chkMortgage 
  178.          Caption         =   "Mortgage Affordability Guide"
  179.          Height          =   255
  180.          Left            =   480
  181.          TabIndex        =   21
  182.          Top             =   1140
  183.          Width           =   3735
  184.       End
  185.       Begin VB.CheckBox chkRealtors 
  186.          Caption         =   "Index of Local Realtors"
  187.          Height          =   255
  188.          Left            =   480
  189.          TabIndex        =   20
  190.          Top             =   840
  191.          Width           =   3615
  192.       End
  193.       Begin VB.CheckBox chkImprove 
  194.          Caption         =   "Home Improvement"
  195.          Height          =   255
  196.          Left            =   480
  197.          TabIndex        =   19
  198.          Top             =   540
  199.          Width           =   3735
  200.       End
  201.       Begin VB.Label Label3 
  202.          Appearance      =   0  'Flat
  203.          BackColor       =   &H80000005&
  204.          BackStyle       =   0  'Transparent
  205.          Caption         =   "Select the main topical areas you want to include in your web:"
  206.          ForeColor       =   &H80000008&
  207.          Height          =   495
  208.          Left            =   0
  209.          TabIndex        =   10
  210.          Top             =   0
  211.          Width           =   4485
  212.       End
  213.    End
  214.    Begin VB.PictureBox pg 
  215.       BackColor       =   &H00C0C0C0&
  216.       BeginProperty Font 
  217.          Name            =   "MS Sans Serif"
  218.          Size            =   8.25
  219.          Charset         =   0
  220.          Weight          =   700
  221.          Underline       =   0   'False
  222.          Italic          =   0   'False
  223.          Strikethrough   =   0   'False
  224.       EndProperty
  225.       Height          =   3810
  226.       Index           =   0
  227.       Left            =   2580
  228.       ScaleHeight     =   3750
  229.       ScaleWidth      =   4455
  230.       TabIndex        =   6
  231.       Tag             =   "0"
  232.       Top             =   165
  233.       Visible         =   0   'False
  234.       Width           =   4515
  235.       Begin VB.Label Label2 
  236.          Appearance      =   0  'Flat
  237.          BackColor       =   &H80000005&
  238.          BackStyle       =   0  'Transparent
  239.          Caption         =   $"realest.frx":030A
  240.          ForeColor       =   &H80000008&
  241.          Height          =   1035
  242.          Left            =   0
  243.          TabIndex        =   7
  244.          Top             =   540
  245.          Width           =   4485
  246.       End
  247.       Begin VB.Label Label1 
  248.          Appearance      =   0  'Flat
  249.          BackColor       =   &H80000005&
  250.          BackStyle       =   0  'Transparent
  251.          Caption         =   "This wizard will generate a sample web framework for presenting information about Real Estate."
  252.          ForeColor       =   &H80000008&
  253.          Height          =   495
  254.          Left            =   0
  255.          TabIndex        =   8
  256.          Top             =   0
  257.          Width           =   4485
  258.       End
  259.    End
  260.    Begin VB.CommandButton btnFinish 
  261.       Appearance      =   0  'Flat
  262.       BackColor       =   &H80000005&
  263.       Caption         =   "Finish"
  264.       Enabled         =   0   'False
  265.       Height          =   375
  266.       Left            =   6180
  267.       TabIndex        =   5
  268.       TabStop         =   0   'False
  269.       Top             =   4080
  270.       Width           =   915
  271.    End
  272.    Begin VB.CommandButton btnNext 
  273.       Appearance      =   0  'Flat
  274.       BackColor       =   &H80000005&
  275.       Caption         =   "Next >"
  276.       Height          =   375
  277.       Left            =   4860
  278.       TabIndex        =   4
  279.       TabStop         =   0   'False
  280.       Top             =   4080
  281.       Width           =   915
  282.    End
  283.    Begin VB.CommandButton btnBack 
  284.       Appearance      =   0  'Flat
  285.       BackColor       =   &H80000005&
  286.       Caption         =   "< Back"
  287.       Enabled         =   0   'False
  288.       Height          =   375
  289.       Left            =   3960
  290.       TabIndex        =   3
  291.       TabStop         =   0   'False
  292.       Top             =   4080
  293.       Width           =   915
  294.    End
  295.    Begin VB.CommandButton btnCancel 
  296.       Appearance      =   0  'Flat
  297.       BackColor       =   &H80000005&
  298.       Caption         =   "Cancel"
  299.       Height          =   375
  300.       Left            =   2640
  301.       TabIndex        =   2
  302.       TabStop         =   0   'False
  303.       Top             =   4080
  304.       Width           =   915
  305.    End
  306.    Begin VB.CommandButton btnHelp 
  307.       Appearance      =   0  'Flat
  308.       BackColor       =   &H80000005&
  309.       Caption         =   "Help"
  310.       Height          =   375
  311.       Left            =   180
  312.       TabIndex        =   1
  313.       TabStop         =   0   'False
  314.       Top             =   4080
  315.       Width           =   915
  316.    End
  317.    Begin VB.PictureBox pnlLeft 
  318.       BackColor       =   &H00C0C0C0&
  319.       BeginProperty Font 
  320.          Name            =   "MS Sans Serif"
  321.          Size            =   8.25
  322.          Charset         =   0
  323.          Weight          =   700
  324.          Underline       =   0   'False
  325.          Italic          =   0   'False
  326.          Strikethrough   =   0   'False
  327.       EndProperty
  328.       Height          =   3795
  329.       Left            =   180
  330.       ScaleHeight     =   3735
  331.       ScaleWidth      =   2235
  332.       TabIndex        =   0
  333.       Top             =   180
  334.       Width           =   2295
  335.       Begin VB.Image imgMain 
  336.          Appearance      =   0  'Flat
  337.          Height          =   3255
  338.          Left            =   120
  339.          Picture         =   "realest.frx":03FC
  340.          Stretch         =   -1  'True
  341.          Top             =   120
  342.          Width           =   2055
  343.       End
  344.    End
  345.    Begin VB.Image img 
  346.       Appearance      =   0  'Flat
  347.       Height          =   735
  348.       Index           =   0
  349.       Left            =   11175
  350.       Picture         =   "realest.frx":E1BE
  351.       Stretch         =   -1  'True
  352.       Top             =   4110
  353.       Width           =   735
  354.    End
  355.    Begin VB.Image img 
  356.       Appearance      =   0  'Flat
  357.       Height          =   735
  358.       Index           =   1
  359.       Left            =   11190
  360.       Picture         =   "realest.frx":1BF80
  361.       Stretch         =   -1  'True
  362.       Top             =   4950
  363.       Width           =   795
  364.    End
  365. Attribute VB_Name = "realest"
  366. Attribute VB_GlobalNameSpace = False
  367. Attribute VB_Creatable = False
  368. Attribute VB_PredeclaredId = True
  369. Attribute VB_Exposed = False
  370. ' -------------------------------------------------------------------
  371. ' File: REALEST.FRM
  372. ' Copyright (c) 1995 Vermeer Technologies, Inc.  All rights reserved.
  373. ' -------------------------------------------------------------------
  374. Option Explicit
  375. ' page management variables
  376. Dim PageNum As Integer
  377. Dim PageMax As Integer
  378. ' OLE automation objects
  379. Dim webber As Object
  380. Dim todo As Object
  381. Private Sub btnBack_Click()
  382.     If PageNum > 0 Then
  383.         GoToPage PageNum - 1
  384.     End If
  385. End Sub
  386. Private Sub btnCancel_Click()
  387.     Dim msg As String
  388.     msg = "If you quit now, the web will not be created,"
  389.     msg = msg & Chr$(10) & "but all wizard settings will be saved."
  390.     msg = msg & Chr$(10) & "Quit anyway?"
  391.     If MsgBox(msg, 48 + 4, "Confirm Cancel") = 7 Then ' user says NO
  392.         Exit Sub
  393.     End If
  394.     Unload Me
  395. End Sub
  396. Private Sub btnCurrent_Click()
  397. End Sub
  398. Private Sub btnFinish_Click()
  399.     If Not ValidatePage(PageNum) Then
  400.         Exit Sub
  401.     End If
  402.     Me.Hide
  403.     DoEvents
  404.     GenerateWeb
  405.     ' GenerateWeb should finish, but in case
  406.     ' somebody forgets to unload us, take care
  407.     ' of it here
  408.     Unload Me
  409. End Sub
  410. Private Sub btnHelp_Click()
  411.     ' if you need help, invoke it here;
  412.     ' else get rid of the button
  413.     MsgBox "Help is not available in this wizard.", 48
  414. End Sub
  415. Private Sub btnNext_Click()
  416.     If PageNum < PageMax Then
  417.         GoToPage PageNum + 1
  418.     End If
  419. End Sub
  420. Private Sub btnUpdate_Click()
  421.     Load Realtors
  422.     CenterFormOnScreen Realtors
  423.     Realtors.Show 1
  424. End Sub
  425. Private Sub ChangePicture(pgnum As Integer)
  426.     ' load picture appropriate for this page;
  427.     ' don't load from disk if you don't have to
  428.     Select Case pgnum
  429.         
  430.         Case 1:  ' web location input
  431.             imgMain.Picture = img(1).Picture
  432.         Case Else ' default image
  433.             imgMain.Picture = img(0).Picture
  434.             
  435.     End Select
  436. End Sub
  437. Private Sub Form_Load()
  438.     Dim titleH As Integer
  439.     Dim i As Integer
  440.     Dim msg As String
  441.     Dim obj As String
  442.     GetFrontPageInfo
  443.     GetWizardInfo
  444.     ' IMPORTANT: have to set the highest page number index manually
  445.     PageMax = 3
  446.     ' fetch any previous settings from INI file
  447.     LoadSettings
  448.     ' set any initial values on pages
  449.     InitPages
  450.     ' shrink-wrap form around controls
  451.     ' (allows form to be much larger in design mode);
  452.     ' this part will vary depending on your control
  453.     ' names and layout
  454.     titleH = Me.Height - Me.ScaleHeight  ' with and without border
  455.     Me.Width = pg(0).Left + pg(0).Width + pnlLeft.Left
  456.     Me.Height = titleH + btnHelp.Top + btnHelp.Height + pnlLeft.Left
  457.     ' since a wizard is supposed to work like a dialog,
  458.     ' make it centered like a dialog
  459.     CenterFormOnScreen Me
  460.     ' initialize page meter control
  461. '    meter.value = 0
  462. '    meter.Min = 0
  463. '    meter.Max = PageMax
  464.     ' set all pages to be same size and location
  465.     ' (allows them to be spread all over large form in design mode)
  466.     For i = 0 To PageMax
  467.         pg(i).Left = pg(0).Left
  468.         pg(i).Top = pg(0).Top
  469.         pg(i).Width = pg(0).Width
  470.         pg(i).Height = pg(0).Height
  471.     Next i
  472.     ' set initial conditions and show first page
  473.     PageNum = -1
  474.     GoToPage 0
  475.     Exit Sub
  476. End Sub
  477. Private Sub Form_Unload(Cancel As Integer)
  478.     ' write current attributes out to INI file
  479.     SaveSettings
  480.     End
  481. End Sub
  482. Private Function GenerateFile(webfile As String, outfile As String) As Integer
  483.     ' create requested HTML files by calling
  484.     ' a separate subroutine for each file and
  485.     ' passing it the name of the temporary file
  486.     ' where output should go
  487.     Select Case webfile
  488.         Case "inc.htm"
  489.             GenInc outfile
  490.             GenerateFile = True  ' indicate success
  491.         Case "index.htm"
  492.             GenIndex outfile
  493.             GenerateFile = True  ' indicate success
  494.         Case "improve.htm"
  495.             GenImprove outfile
  496.             GenerateFile = True  ' indicate success
  497.         Case "realtors.htm"
  498.             GenRealtors outfile
  499.             GenerateFile = True  ' indicate success
  500.         Case "mortgage.htm"
  501.             GenMortgage outfile
  502.             GenerateFile = True  ' indicate success
  503.         Case "question.htm"
  504.             GenQuestion outfile
  505.             GenerateFile = True  ' indicate success
  506.         Case Else  ' no match
  507.             GenerateFile = False   ' indicate failure
  508.     End Select
  509. End Function
  510. Private Sub GenerateWeb()
  511.     ' replace this routine with your own version;
  512.     ' it should generate the HTML pages one-by-one
  513.     ' in the system-dependent temp directory
  514.     ' and upload the files to the web server
  515.     Dim i As Integer
  516.     Dim tempfile As String
  517.     Dim curfile As String
  518.     Dim retval As Long
  519.     Dim wizname As String
  520.     Dim wizversion As String
  521.     Dim tmp As String
  522.     Dim done As Integer
  523.     Dim FileList As String
  524.     Dim URLList As String
  525.     Dim webURL As String
  526.     ' put up the hourglass
  527.     Screen.MousePointer = 11
  528.     Set webber = CreateObject(FrontPageExplorerID)
  529.     webURL = webber.vtiGetWebURL
  530.     If Len(webURL) = 0 Then
  531.         MsgBox "The FrontPage Explorer does not have a web open.", vbExclamation
  532.         Set webber = Nothing
  533.         Exit Sub
  534.     End If
  535.     Set todo = CreateObject(FrontPageToDoListID)
  536.     ' set tool name for document upload
  537.     wizname = "Real Estate Web Wizard"
  538.     wizversion = "0.1"
  539.     InitFiles     ' establish a clean slate for upload list
  540.     InitMetaVars  ' establish a clean slate for meta-info variables
  541.     ' -----------
  542.     ' construct list of required meta-info vars
  543.     ' -----------
  544.     AddMetaVar "CompanyName", CStr(txtCompanyName.text)
  545.     AddMetaVar "EmailAddress", CStr(txtEmailAddress.text)
  546.     ' -----------
  547.     ' construct list of files to be uploaded
  548.     ' -----------
  549.     ' (AddFile takes name of file as first arg,
  550.     '  and whether or not file is generated dynamically
  551.     '  as second arg)
  552.     ' first add any pre-existing files (such as images)
  553.     AddFile "masthead.gif", False, "masthead image"
  554.     ' then add any INCLUDED files (for IncludeBots)
  555.     ' *BEFORE* the files which will "include" them
  556.     AddFile "inc.htm", True, "page footer"
  557.     ' finally any files that must be generated
  558.     AddFile "index.htm", True, "home page"  ' default home page is *REQUIRED*
  559.     If chkImprove.value Then AddFile "improve.htm", True, "home improvement guide"
  560.     If chkRealtors.value Then AddFile "realtors.htm", True, "index of Realtors"
  561.     If chkMortgage.value Then AddFile "mortgage.htm", True, "mortgage guide"
  562.     If chkQuestions.value Then AddFile "question.htm", True, "answers to common questions"
  563.     done = nfiles - 1
  564.     ' -----------
  565.     ' upload any web meta-info variables
  566.     ' -----------
  567.     tmp = PackMetaInfoVars()
  568.     If tmp <> "" Then
  569.         retval = webber.vtiPutWebMetaInfo(tmp)
  570.         If retval <> 1 Then
  571.             ' failure
  572.             Set webber = Nothing
  573.             Set todo = Nothing
  574.             MsgBox "Warning: " & Chr$(10) & "Wizard failed PutWebMetaInfo call."
  575.             Exit Sub
  576.         End If
  577.     End If
  578.     ' -----------
  579.     ' loop through list of files, generating files and creating upload lists
  580.     ' -----------
  581.     FileList = ""
  582.     URLList = ""
  583.     For i = 0 To done
  584.         If Files(i).IsNew Then
  585.             ' create temp file where output will go
  586.             Files(i).path = TempFileName()
  587.             If Not GenerateFile(Files(i).Name, Files(i).path) Then
  588.                 MsgBox "Couldn't generate file: '" & Files(i).Name & "'."
  589.                 Files(i).path = ""  ' couldn't create file
  590.             End If
  591.         Else
  592.             ' generate full path to file
  593.             Files(i).path = App.path & "\" & Files(i).Name
  594.         End If
  595.         
  596.         If Files(i).path <> "" Then
  597.             ' TODO: images should go in /images web dir
  598.             FileList = FileList & Files(i).path
  599.             URLList = URLList & Files(i).Name
  600.             ' item separator is newline char
  601.             FileList = FileList & Chr$(10)
  602.             URLList = URLList & Chr$(10)
  603.         End If
  604.         
  605.     Next i
  606.         
  607.     ' perform upload
  608.     retval = webber.vtiPutDocuments(FileList, URLList)
  609.     If retval = 0 Then         ' failed
  610.         MsgBox "Unable to load documents into web."
  611.     End If
  612.    ' -----------
  613.     ' refresh Explorer's views
  614.     ' -----------
  615.     webber.vtiRefreshWebFromServer
  616.     ' -----------
  617.     ' add any items for To Do List
  618.     ' -----------
  619.     todo.vtiAddTask "Customize home page", 1, wizname, "index.htm", "", "Add local content to reinforce unique identity."
  620.     ' -----------
  621.     ' remove any temp files
  622.     ' -----------
  623.     For i = 0 To done
  624.         If Files(i).IsNew And Files(i).path <> "" Then
  625.             Kill Files(i).path
  626.         End If
  627.     Next i
  628.     ' -----------
  629.     ' all done
  630.     ' -----------
  631.     Set webber = Nothing
  632.     Set todo = Nothing
  633.     ' take down the hourglass
  634.     Screen.MousePointer = 0
  635.     ' all done
  636.     Unload Me
  637. End Sub
  638. Private Sub GenImprove(outfile As String)
  639.     Dim f As Integer   ' file number
  640.     Dim tmp As String  ' temporary string
  641.     f = OpenFile(outfile)
  642.         OpenDocument f, "Home Improvement Page"
  643.             WriteImage f, "masthead.gif", "Masthead Image", "", False
  644.             WriteBreak f
  645.             WriteHeading f, 1, "Home Improvement Page"
  646.             WriteRule f
  647.             WriteParagraph f, "This page has a lot of info about home improvement."
  648.             CreateIncludeBot tmp, "inc.htm"
  649.             WriteText f, tmp, False
  650.         CloseDocument f
  651.     CloseFile f
  652. End Sub
  653. Private Sub GenInc(outfile As String)
  654.     Dim f As Integer   ' file number
  655.     Dim tmp As String  ' temporary string
  656.     Dim bot As String
  657.     f = OpenFile(outfile)
  658.         OpenDocument f, "Included page footer"
  659.             WriteRule f
  660.             CreateMacroBot bot, "CompanyName"
  661.             tmp = "<H5>Copyright 1995 " & bot & "<BR>"
  662.             CreateMacroBot bot, "EmailAddress"
  663.             tmp = tmp & "For more information contact " & bot & "."
  664.             WriteHeading f, 5, tmp
  665.         CloseDocument f
  666.     CloseFile f
  667. End Sub
  668. Private Sub GenIndex(outfile As String)
  669.     Dim f As Integer   ' file number
  670.     Dim tmp As String  ' temporary string
  671.     f = OpenFile(outfile)
  672.         OpenDocument f, "Real Estate Home Page"
  673.             WriteImage f, "masthead.gif", "Masthead Image", "", False
  674.             WriteBreak f
  675.             WriteHeading f, 1, "Real Estate Home Page"
  676.             WriteRule f
  677.             WriteParagraph f, "Welcome to the <I>Real Estate</I> Home Page."
  678.             WriteParagraph f, "The following articles can be found in our web:"
  679.             OpenList f, False
  680.                 If chkImprove.value Then
  681.                     CreateLink tmp, "Home Improvement", "improve.htm"
  682.                     WriteListItem f, tmp
  683.                 End If
  684.                 If chkRealtors.value Then
  685.                     CreateLink tmp, "Local Realtors", "realtors.htm"
  686.                     WriteListItem f, tmp
  687.                 End If
  688.                 If chkMortgage.value Then
  689.                     CreateLink tmp, "Mortgage Affordability Guide", "mortgage.htm"
  690.                     WriteListItem f, tmp
  691.                 End If
  692.                 If chkQuestions.value Then
  693.                     CreateLink tmp, "Questions and Answers", "question.htm"
  694.                     WriteListItem f, tmp
  695.                 End If
  696.             CloseList f, False
  697.             WriteRule f
  698.             CreateSearchBot tmp, "", ""
  699.             WriteText f, tmp, False
  700.             CreateIncludeBot tmp, "inc.htm"
  701.             WriteText f, tmp, False
  702.         CloseDocument f
  703.     CloseFile f
  704. End Sub
  705. Private Sub GenMortgage(outfile As String)
  706.     Dim f As Integer   ' file number
  707.     Dim tmp As String  ' temporary string
  708.     f = OpenFile(outfile)
  709.         OpenDocument f, "Mortgage Info Page"
  710.             WriteImage f, "masthead.gif", "Masthead Image", "", False
  711.             WriteBreak f
  712.             WriteHeading f, 1, "Mortgage Info Page"
  713.             WriteRule f
  714.             WriteParagraph f, "This page has a lot of info about mortgages."
  715.             CreateIncludeBot tmp, "inc.htm"
  716.             WriteText f, tmp, False
  717.         CloseDocument f
  718.     CloseFile f
  719. End Sub
  720. Private Sub GenQuestion(outfile As String)
  721.     Dim f As Integer   ' file number
  722.     Dim tmp As String  ' temporary string
  723.     f = OpenFile(outfile)
  724.         OpenDocument f, "Real Estate Questions Page"
  725.             WriteImage f, "masthead.gif", "Masthead Image", "", False
  726.             WriteBreak f
  727.             WriteHeading f, 1, "Real Estate Questions Page"
  728.             WriteRule f
  729.             WriteParagraph f, "This page has a lot of answers to questions about Real Estate."
  730.             CreateIncludeBot tmp, "inc.htm"
  731.             WriteText f, tmp, False
  732.         CloseDocument f
  733.     CloseFile f
  734. End Sub
  735. Private Sub GenRealtors(outfile As String)
  736.     Dim f As Integer   ' file number
  737.     Dim tmp As String  ' temporary string
  738.     f = OpenFile(outfile)
  739.         OpenDocument f, "Realtor Guide Page"
  740.             WriteImage f, "masthead.gif", "Masthead Image", "", False
  741.             WriteBreak f
  742.             WriteHeading f, 1, "Realtor Guide Page"
  743.             WriteRule f
  744.             WriteParagraph f, "This page has a lot of info about local Realtors."
  745.             CreateIncludeBot tmp, "inc.htm"
  746.             WriteText f, tmp, False
  747.         CloseDocument f
  748.     CloseFile f
  749. End Sub
  750. Private Sub GoToPage(num As Integer)
  751.     If num >= 0 And num <= PageMax Then
  752.         ' validate and then take down previous page (if any)
  753.         If PageNum >= 0 And PageNum <= PageMax Then
  754.             ' check for valid input on the current page
  755.             If Not ValidatePage(PageNum) Then Exit Sub
  756.             pg(PageNum).Visible = False
  757.         End If
  758.         PageNum = num
  759.         ChangePicture PageNum
  760.         pg(PageNum).Visible = True
  761.         If PageNum = 0 Then
  762.             btnBack.Enabled = False
  763.         Else
  764.             btnBack.Enabled = True
  765.         End If
  766.         If PageNum = PageMax Then
  767.             btnNext.Enabled = False
  768.         Else
  769.             btnNext.Enabled = True
  770.         End If
  771. '        meter.value = PageNum
  772.         SetFinishState ' see if Finish button can be enabled
  773.     End If
  774. End Sub
  775. Private Sub InitPages()
  776.     ' make sure any pages with required values
  777.     ' (except for the server/web name page)
  778.     ' are initialized (after INI file has been read)
  779.     ' page 0
  780.     ' (nothing)
  781.     ' page 1
  782.     ' (nothing)
  783.     ' page 2
  784.     ' (nothing)
  785.     ' page 3
  786.     ' (nothing)
  787.     ' page 4
  788.     If txtCompanyName.text = "" Then txtCompanyName.text = "My Company Inc."
  789.     If txtEmailAddress.text = "" Then txtEmailAddress.text = "info@mycompany.com"
  790. End Sub
  791. Private Sub LoadSettings()
  792.     ' read in all persistent values from INI file
  793.     ' page 1
  794.     If GetIniBool("HomeImprovement") Then
  795.         chkImprove.value = 1
  796.     Else
  797.         chkImprove.value = 0
  798.     End If
  799.     If GetIniBool("RealtorIndex") Then
  800.         chkRealtors.value = 1
  801.     Else
  802.         chkRealtors.value = 0
  803.     End If
  804.     If GetIniBool("MortgageGuide") Then
  805.         chkMortgage.value = 1
  806.     Else
  807.         chkMortgage.value = 0
  808.     End If
  809.     If GetIniBool("Questions") Then
  810.         chkQuestions.value = 1
  811.     Else
  812.         chkQuestions.value = 0
  813.     End If
  814.     ' page 2
  815.     optOne.value = GetIniBool("OptionOne")
  816.     optTwo.value = GetIniBool("OptionTwo")
  817.     optThree.value = GetIniBool("OptionThree")
  818.     ' page 3
  819.     txtCompanyName.text = GetIniString("CompanyName")
  820.     txtEmailAddress.text = GetIniString("EmailAddress")
  821. End Sub
  822. Private Sub ParseCommandLine()
  823.     ' TODO: read command line and place values in global vars
  824. End Sub
  825. Private Sub SaveSettings()
  826.     ' write out all persistent values to INI file
  827.     ' page 1
  828.     SetIniBool "HomeImprovement", chkImprove.value = 1
  829.     SetIniBool "RealtorIndex", chkRealtors.value = 1
  830.     SetIniBool "MortgageGuide", chkMortgage.value = 1
  831.     SetIniBool "Questions", chkQuestions.value = 1
  832.     ' page 2
  833.     SetIniBool "OptionOne", optOne.value
  834.     SetIniBool "OptionTwo", optTwo.value
  835.     SetIniBool "OptionThree", optThree.value
  836.     ' page 3
  837.     SetIniString "CompanyName", CStr(txtCompanyName.text)
  838.     SetIniString "EmailAddress", CStr(txtEmailAddress.text)
  839. End Sub
  840. Private Sub SetFinishState()
  841.     ' make sure all required input has been provided
  842.     Dim state As Integer
  843.     state = True  ' enabled unless some test fails below
  844.     If txtCompanyName.text = "" Then state = False
  845.     If txtEmailAddress.text = "" Then state = False
  846.     btnFinish.Enabled = state
  847. End Sub
  848. Private Function ValidatePage(pgnum As Integer) As Integer
  849.     Dim errtitle As String
  850.     Dim noisy As Integer
  851.     ' handle bad input on pages
  852.     errtitle = "Bad Input"
  853.     noisy = True
  854.     ValidatePage = False
  855.     Select Case pgnum
  856.         Case 4  ' web meta-info page
  857.             If txtCompanyName.text = "" Then
  858.                 If noisy Then Beep
  859.                 MsgBox "Company Name field cannot be empty.", 48, errtitle
  860.                 Exit Function
  861.             End If
  862.             If txtEmailAddress.text = "" Then
  863.                 If noisy Then Beep
  864.                 MsgBox "Email Address field cannot be empty.", 48, errtitle
  865.                 Exit Function
  866.             End If
  867.     End Select
  868.     ValidatePage = True
  869. End Function
  870.