Welcome to Bob Erhart's Internet Site
HOME
ADD MESSAGE
PAGE/EMAIL
TAKE A DEMO SURVEY
SEE DEMO SURVEY RESULTS
VBA DEMO
BACK TO SOURCE CODE LISTING
'====================================================================== 'Function Name :ADOGetTabInfo(strTabGroup, intTabFocus, intAccessPrivilage, booMSIEFound, booBackTab, booLast) 'Programmer :R.G. Erhart, 121931 'Date Written :11/17/1999 'Purpose :Query the Database for the tab information and set ' the tabs according to the tab group and the users ' privilage level. ' Due to some annomilies with CSS, some table defs will ' be disabled if the non IE browsers. '-------------------+---------------------------+----------------------- 'Parameters |Name |Description ' |strTabGroup |The Tab group name ' |intAccessPrivilage |The Access Privilage of the User ' |adoConnectString_Settings |The ADO Connect String ' |booMSIEFound |True/False MSIE Browser '-------------------+---------------------------+----------------------- 'Dependencies ' Functions() :SingleQuote() ' Subs() :None ' Globals :aryTabInfo(64,12,2) |Array that hold all the ' ^ ^ ^ |Tab info Values. ' | | | |Field Name/Value element ' Tab Number---+ | | |where 0 is field name, ' Field Ordinal---+ | |and 1 is field value. ' Field Name/Value--+ | ' 'Return Value :ADOGetTabInfo | '====================================================================== Private Function ADOGetTabInfo(strTabGroup, intTabFocus, intAccessPrivilage, booMSIEFound, booBackTab, booLast) Dim aryTabInfo(24,64,2) Dim cgiScriptMode Dim cgiScriptMethod Dim lngRecordsFound lngRecordsFound = 0 Dim lngOrdinalPosition lngOrdinalPosition = 0 Dim lngFieldCount lngFieldCount = 0 Dim adoTableName Dim strSql Dim objSessionId Dim rsFieldName, rsFieldValue Dim booFocusState Dim urlTargetLink, strTargetQueryString , intTargetLength Dim intTL Dim chrBuf Dim intPadding intPadding = 8 Dim intTabHeight intTabHeight = 20 Dim objConnSession Dim objRS Dim intPtr Dim intTC Dim strScriptTitle Dim strNewGroup '---------------------------------------------------------------------- 'Query the Database and see if the Userid passed is in the Database. 'If found, set all the userID info to the Global aryUserInfo() array, 'and return the Access Privilages for this UserID. '---------------------------------------------------------------------- adoTableName = "TabInfo" strSql = "SELECT * FROM [" & adoTableName & "] WHERE [Group]=" & SingleQuote(strTabGroup) & ";" Session.timeout = 1 objSessionID = Session.SessionID Set objConnSession = Server.CreateObject("ADODB.Connection") objConnSession.Open adoConnectString_Settings Set objRS = objConnSession.Execute(strsql) lngFieldCount = objRS.Fields.Count On Error Resume Next objRS.MoveFirst do while Not objRS.eof lngRecordsFound = lngRecordsFound + 1 For intPtr = 0 to lngFieldCount aryTabInfo(lngRecordsFound,intPtr,0) = objRS.Fields(intPtr).Name aryTabInfo(lngRecordsFound,intPtr,1) = objRS.Fields(intPtr).Value 'Response.Write(aryTabInfo(lngRecordsFound,intPtr,0) & aryTabInfo(lngRecordsFound,intPtr,1) & "
") Next objRS.MoveNext loop objRS.Close objConnSession.close %>
<% Select Case booBackTab Case True %>
>
>
<% Case Else %>
>
>
<% End Select %>
>
<% For intTC = 1 to lngRecordsFound booFocusState = 1 If IsEmpty(aryTabInfo(intTC,8,1)) = True Then intTabFocus = intTC If CInt(intTabFocus) = CInt(aryTabInfo(intTC,2,1)) Then booFocusState = 2 If CInt(intAccessPrivilage) < CInt(aryTabInfo(intTC,6,1)) Then booFocusState = 0 If CInt(intAccessPrivilage) > CInt(aryTabInfo(intTC,7,1)) Then booFocusState = 0 strScriptTitle = aryTabInfo(intTC,11,1) strNewGroup = aryTabInfo(intTC,12,1) If IsNull(aryTabInfo(intTC,9,1)) = False Then cgiScriptMode = UCase(aryTabInfo(intTC,9,1)) If IsNull(aryTabInfo(intTC,10,1)) = False Then cgiScriptMethod = UCase(aryTabInfo(intTC,10,1)) strTargetQueryString = "?SCRIPT_MODE=" & cgiScriptMode strTargetQueryString = strTargetQueryString & "&SCRIPT_METHOD=" & cgiScriptMethod strTargetQueryString = strTargetQueryString & "&SCRIPT_TITLE=" & Server.HTMLEncode(strScriptTitle) strTargetQueryString = strTargetQueryString & "&NEW_GROUP=" & strNewGroup strTargetQueryString = strTargetQueryString & "&MACHINE_ID=" & cgiMachineID strTargetQueryString = strTargetQueryString & "&JOB_NUMBER=" & cgiJobNumber strTargetQueryString = strTargetQueryString & "&START_DATE=" & cgiStartDate strTargetQueryString = strTargetQueryString & "&END_DATE=" & cgiEndDate strTargetQueryString = strTargetQueryString & "&TAB_SETTING=" & aryTabInfo(intTC,8,1) urlTargetLink = aryTabInfo(intTC,4,1) If IsNull(urlTargetLink) = True Then urlTargetLink = urlScriptName & strTargetQueryString End If %>
<% Select Case booFocusState %> <% Case 0 %>
>
height=16>
<% = UCase(aryTabInfo(intTC,3,1)) %>
>
height=16>
<% Case 2 %>
>
height=16>
<% = UCase(aryTabInfo(intTC,3,1)) %>
>
height=16>
<% Case Else %>
>
height=16>
<% = UCase(aryTabInfo(intTC,3,1)) %>
>
height=16>
<% End Select Next %>
<% For intTC = 1 to lngRecordsFound %>
>
height=2>
>
height=2>
<% Next %>
<% For intTC = 1 to lngRecordsFound %>
>
height=1>
>
height=1>
<% Next %>
<% For intTC = 1 to lngRecordsFound %>
>
height=1>
>
height=1>
<% Next %>
<% Select Case booLast %> <% Case True %>
>
>
<% Case Else %>
>
>
<% End Select %>
<% Session.Abandon ADOGetTabInfo = Cint(lngRecordsFound) End Function
© Copyright 1999, 2013, R.G. Erhart, Erhart Consulting LLC, Rochester New York