The files generated by the Form Converter were for the most part left as they were created. The first change was the removal of visible table borders, as described in Remove Table Borders. The other changes are discussed in this topic.
The frmRoot.asp file, the first of the generated form's files that is accessed by the CML application (through critiques.asp), was changed so that the Page_3.asp file would be opened to let people submit new critiques. As generated, it was opening the message.asp file. Page_3.asp is the name given to the ASP page generated from the HalfRead page of the EnhancedLitCrit form.
The second line in the following code shows this change:
If bstrFormMode = "compose" Then
bstrTabMainFiles(iCurTab) = "Page_3.asp" '--- WAS: "Message.asp"
iCurTab = iCurTab + 1
bstrTabMainFiles(iCurTab) = "Stock_Attachments.asp"
iCurTab = iCurTab + 1
Else
bstrTabMainFiles(iCurTab) = "Message-Read.asp"
iCurTab = iCurTab + 1
bstrTabMainFiles(iCurTab) = "Stock_Attachments.asp"
iCurTab = iCurTab + 1
End If
Near the top of the LitCrit form you can see a generalized image of various library items: books, tapes/videos, magazines, and software. The original Microsoft Outlook application shows this picture, which changes when the user clicks the option buttons to set the media type. The four .gif files used for this display are: Book.gif, AudioVideo.gif, Periodicals.gif, and Software.gif.
Problems were encountered after the form was converted and all of them were fixed. Here are those problems, presented with their solutions:
When the EnhancedLitCrit form was converted, it was displaying the default book graphic on all four of its pages, namely the CurrentUser page, the HalfRead page, and both versions (compose and read) of the Others page. For this reason, the Form Converter copied only this graphic (four times) into the destination folder. It gave all four book graphics unique names such as ImgMedia_4_0_2.gif. The names of these graphics were derived from their control type and their source page, and was explained in the generated Todo.txt file.
Problem 1: The solution
The solution was to copy the original .gif files, using their original names, into the EnhancedLitCrit folder, where the files created by the Form Converter were placed.
The Form Converter commented out the ImageList ActiveX® control, which is used to supply the correct image for display on the form. The original control is flexible in that it performs binding, it can hold multiple .gif images, and you can change its settings dynamically. In HTML, this control could not bind to multiple images, so because of the reduced functionality, the Form Converter placed the code for this control in comments, which it mentioned in the Todo.txt file.
Problem 2: The solution
The solution to this problem has several parts.
First, the comment markers were removed, to re-enable the ImageList control. Second, the following MediaImage function was defined in LitCrit.inc, to be called where necessary from other files:
' Custom script code for selecting library item type image
Function MediaImage(ByVal ShortMedia)
' Response.Write "SHORTMEDIA: " & shortmedia & "<br>"
Select Case ShortMedia
Case "AV","Audio/Visual": MediaImage = "AudioVisual.gif"
Case "Prd","Periodicals": MediaImage = "Periodicals.gif"
Case "Soft","Software": MediaImage = "Software.gif"
Case Else: MediaImage = "Book.gif"
End Select
End Function
Third, code was added to call the MediaImage function from other files. The following line is from Page3_asp:
imgMedia = MediaImage(objOneMsg.Fields(sGUID & "Media"))
Fourth, the <img> tags that display the graphic had to be changed. They had been hard-coded in the generated file to lines similar to this one:
<img border='0' height='72' width='311' src='Image1_139_0_3.gif'>
The solution was to change this line so that the image source refers to the function that dynamically sets the correct graphic:
<img border='0' height='32' width='40' src='<%= imgMedia %>'>
In this line, <%= imgMedia %> calls the imgMedia function, which returns the appropriate .gif file.
Finally, the ImageList control itself, which should be invisible at run time, was placed in the cell of a table when the form was converted, and the tables originally had visible borders. This caused the control to appear as a blank rectangle. This was fixed when table borders were removed globally.
You can reference any custom field on the form with the following GUID: {2903020000000000C000000000000046}. This number is stored as the sGUID constant in LitCrit.inc (see Files Added to the Generated Form). For example, to obtain the value of the "Media" field (a text field that holds values such as "book" or "software"), you could use the following string, to specify one field in the Fields collection of the message:
objOneMsg.Fields(2903020000000000C000000000000046Media)
Using the sGUID constant makes this reference easier:
objOneMsg.Fields(sGUID & "Media"))
The generalized way to reference any user-defined field is as follows:
objOneMsg.Fields(sGUID & "<user defined field>"))