The PT application uses two gate.asp files: a global version and a localized version. Global gate.asp is located in the virtual root of the application and runs when a user types the URL for the PT application. Coding Global gate.asp describes this file.
After the application identifies the user's language preferences, the application environment becomes language-aware. Coding Localized gate.asp describes the code that identifies code pages for each locale in addition to the code that is applicable to any locale.
Code in gate.asp first captures the language preference of the user's browser, which the ACCEPT_LANGUAGE HTTP header contains. This header must be prefixed by HTTP_ for the ServerVariables collection to retrieve its value. The MapPath property (".") specifies the physical path of the folder for current file. The following code fragment shows the language variable that contains the user's language preference:
language = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
appPath = Server.MapPath(".")
Next, gate.asp instantiates the Lingo object in Litware.dll and calls the SniffLang method. Because appPath contains the value ("."), the search for lingo.xml begins at the root directory and includes all subfolders.
Set oLingo = Server.CreateObject("Litware.Lingo")
language = oLingo.SniffLang(language,appPath,"lingo.xml")
The language variable now contains the name of the language that is the closest match the PT application can provide to the user's language preference. If SniffLang cannot provide a match (exact or rough), the value of language defaults to en-us, for U.S. English.
The following code then redirects the program flow to a language-specific version of welcome.htm:
Response.Redirect(language & "/welcome.htm")
The PT application provides localized versions of gate.asp primarily because the code page must be specified for each language. Code in gate.asp uses the value in the CodePage property of the Session object to map characters in character sets to correctly display characters on the screen. The following code fragment shows how the value 1252 (the code page for western European languages) is assigned to the CodePage property in gate.asp localized for the U.S. English version of the application:
Session.CodePage = 1252
Gate.asp calls getParam, a JavaScript function in the GetParam.js file, passing the filename variable as a parameter. Depending on which link the user clicks on the home page, filename contains person, group, location, activity, or activityType.The getParam function, described in Calling getParam to Extract a Parameter Value, returns the name of the Web page the user selected. Reusable JavaScript describes the reusable JavaScript functions in the PT application.
The following code fragments from gate.asp specify the source files for each frame (logo frame, menu frame, right pane, and left pane) and create the frameset and menu bar. This code runs every time a user requests a page. The value of the src property includes the name of the Eval table that contains the information to display on the Web page.
The following code fragment specifies the external file that contains the source code:
var search = window.location.search
var frames = document.all;
frames('logo').src = fileName + 'Logo.htm' + search;
frames('menubar').src= '../menu/menu.asp?lang=' + '<%= lang %>';
frames('rightpane').src = fileName + '.htm' + search;
frames('leftpane').src = fileName + 'List.htm' + search;
The following code fragment creates the frameset:
<frameset FRAMESPACING="0" BORDER="0" FRAMEBORDER="0" ROWS="75,24,*">
<frame ID="logo" NAME="LOGO" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0">
<frame ID="menubar" NAME="MENUBAR" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0" FRAMEBORDER="1">
<frameset COLS="20%,*">
<frame ID="leftpane" NAME="LEFTPANE" SCROLLING="NO" MARGINWIDTH="0" MARGINHEIGHT="0">
<frame ID="rightpane" NAME="RIGHTPANE" SCROLLING="AUTO" MARGINWIDTH="0" MARGINHEIGHT="0">
</frameset>
</frameset>
The following topics describe how *Logo.htm, *List.htm, and *.htm create the logo frame, left pane, and right pane on the PT application's forms:
Reloading Lists in Writing Data describes how the list in the left pane is rebuilt.