The UserInfo component is required only to check out library items. If it is not present, the library user can browse, but not check out materials from the library catalog.
From the CML's home page, you click Search for Library Materials to display the Catalog Filter page. After entering information here, you see the Library Catalog page, whose source file is Library.asp. Library.asp is the only page within the CML that invokes the UserInfo component; as one of its first actions, it instantiates a UserInfo object on the client computer. This fails if the CML's client components, specifically CMLC.dll, have not been installed, as shown in the following code:
On Error Resume Next
uiOnPC = IsObject(CreateObject("CML.UserInfo"))
If uiOnPC = False Then
MsgBox "You must install the CML.UserInfo component in order to request books." &_
vbCrLf & "Please check your security settings and reload this page.", _
vbCritical, "UserInfo Component Not Installed"
Else
GetUserInfo = UserInfo.Logon
End If
Installation of the UserInfo object is automatic, but it can fail in certain instances, such as insufficient disk space on the client computer, or if the user cancels the installation of the component. For more information on installing the UserInfo object, see System Requirements and Hardware Requirements.
If the CMLC DLL is not installed, the CreateObject call produces an error and displays a message (see preceding code example) reminding the user to install the CML UserInfo object. If the client components are installed, UserInfo is instantiated (see Instantiating the UserInfo Object) and its Logon Get property is called. This property in turn calls the Win32 API function GetUserName to retrieve the current user's name from the client system.
The Document Object Model of DHTML allows for the trapping of document state events. One of these is the window onload event. In this case, the current window object represents the Library.asp file and its onload event fires when that file is parsed and sent to the browser. This event invokes the Window_OnLoad subroutine, shown here, in Library.asp:
Sub Window_OnLoad()
'--- Confirm the download of the CML.UserInfo component, and
'--- retreive current user logon
sLogon = GetUserInfo()
<% IF Session("LastPage") = "" THEN %>
gettingStarted.style.display = ""
initialinfo.style.display = ""
txtWord.Focus
<% END IF %>
End Sub
Within this subroutine, the user's logon name is assigned to the sLogon variable. In the ReDoCurrent and DoRequest functions (defined in the same Library.asp file), this variable is sent on the URL line to the Search.asp and Request.asp files, respectively. Several other search-related subroutines are defined here as well.
After these function and subroutine definitions, this file displays Fitch & Mather's logo. It then uses the #include directive to invoke the file Dfilter.asp, which presents users a search menu for finding library materials. See Searching for Library Materials.