home *** CD-ROM | disk | FTP | other *** search
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Filename: SelectDrives.vbs
- ' *** ------------------------------------------------------------------------------
- ' *** Description: UserAccounts HTA Script
- ' *** ------------------------------------------------------------------------------
- ' *** Version: 1.0
- ' *** Notes: Used by SelectDrives.hta
- ' *** ------------------------------------------------------------------------------
- ' *** Copyright (C) Microsoft Corporation 2005, All Rights Reserved
- ' *** ------------------------------------------------------------------------------
- ' ***
-
- ' ~~~
- ' ~~~ Force variables to be declared and turn off script error messages unless in DEBUG mode
- ' ~~~
- Option Explicit
-
-
- document.title = L_sProtectDrives_TEXT
-
- ' ~~~
- ' ~~~ Declare global variables
- ' ~~~
- Dim strDivFocus, ColDrives
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: Init()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is executed whilst the spash screen is displayed
- ' *** If this function returns false, the spash screen is not removed
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub Init
- ' ~~~ Call the sub to enable body
- Call BodyDisable(False)
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: DrivesMain()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is executed on load of the HTA
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub DrivesMain
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- ' ~~~ Disable the body on load
- oBody.disabled = True
-
- ' ~~~ set up the screen, load controls and pages
- Call Setup()
-
- ' ~~~ call the tool initalization function
- Call Init()
-
- ' ~~~ Call the tool load function
- Call Load()
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: Validate()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is executed before a wizard page is exited
- ' *** If this function returns True The page is ready to close.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Function Validate()
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Validate = True
- End Function
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: Action()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is executed when enter key/ok button is pressed
- ' *** ------------------------------------------------------------------------------
- ' ***
- Function Action()
- CloseOK()
- End Function
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: Load()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is executed before a wizard page is displayed
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub Load
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim intValue, bSelected
-
- ' ~~~ Load the drives in left and rightpane
- Call LoadDrives()
-
- ' ~~~ Hide the drives in the right pane
- For intValue = 65 to 90
- document.all("trR" + chr(intValue)).style.display = "none"
- Next
-
- ' ~~~ Load the protected drives in the right pane
- Call LoadProtectedDrives()
-
- ' ~~~ To set the first drive as selected
- bSelected = False
- For intValue = 65 to 90
- If ( document.all("trL" + chr(intValue)).style.display <> "none" )Then
- document.all("lbL" + chr(intValue)).classname = "selectuser"
- bSelected = True
- Exit For
- End If
- Next
- If bSelected = False Then
- For intValue = 65 to 90
- If( document.all("trR" + chr(intValue)).currentstyle.display <> "none" ) Then
- document.all("lbR" + chr(intValue)).classname = "selectuser"
- Exit For
- End If
- Next
- End If
-
- ' ~~~ Set the tab indexes for the two div's that holds the drives.
- tLeft.tabindex = 0
- tRight.tabindex = 0
-
- ' ~~~ Set the onfocus event for the two div's
- Set tLeft.onfocus = GetRef("divLeftfocus")
- Set tRight.onfocus = GetRef("divRightfocus")
-
- ' ~~~ Get the collection of drives
- Set ColDrives = document.body.GetElementsByTagName("LABEL")
-
- ' ~~~ To enable Esc and Enter when the hta is launched
- oBody.disabled = false
- document.body.focus()
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: HTAKeyDown()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is called when any key is pressed while the
- ' *** SelectDrives dialog is active
- ' *** ------------------------------------------------------------------------------
- Sub HTAKeyDown()
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- If window.event.keycode = 27 Then
- self.Close()
- ElseIf window.event.keycode = 37 Then
- MoveLeft()
- ElseIf window.event.keycode = 38 Then
- moveup()
- ElseIf window.event.keycode = 39 Then
- MoveRight()
- ElseIf window.event.keycode = 40 Then
- movedown()
- ElseIf window.event.keycode = 9 Then
- If window.event.shiftkey Then
- ShiftTabPress()
- Else
- TabPress()
- End If
- End If
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: KeyUp()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This function is called when any key is released while the
- ' *** SelectDrives dialog is active
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub KeyUp()
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- If window.event.keycode = 9 Then
- ShiftTabPress()
- End If
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: LoadDrives()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine Creates the drives in Unrestricted and
- ' *** Restricted Section.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub LoadDrives()
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oRow, oCol, sHTML, intValue
-
- ' ~~~ Create two tables with 26 rows for drives A: to Z:
- For intValue = 65 to 90
- Set oRow = document.all("tLeft").insertrow()
- oRow.id = "trL" + chr(intValue)
- Set oCol = oRow.insertCell()
-
- sHTML = "<label id=""" + "lbL" + chr(intValue) + """ class=""unselectuser"" onclick=""DriveClick(window.event.srcelement.id)"" >" + chr(intValue) + ":" + "</label>"
- oCol.innerHTML = sHTML
-
- Set oRow = Nothing
- Set oCol = Nothing
- Next
-
- For intValue = 65 to 90
- Set oRow = document.all("tRight").insertrow()
- oRow.id = "trR" + chr(intValue)
- Set oCol = oRow.insertCell()
-
- sHTML = "<label id=""" + "lbR" + chr(intValue) + """ class=""unselectuser"" onclick=""DriveClick(window.event.srcelement.id)"" >" + chr(intValue) + ":" + "</label>"
- oCol.innerHTML = sHTML
-
- Set oRow = Nothing
- Set oCol = Nothing
- Next
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: LoadProtectedDrives()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine loads the drives in the Restricted Section.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub LoadProtectedDrives()
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim strProtDrive, intCharPos
-
- ' ~~~ Get the existing set of restricted drives from dialog arguments
- strProtDrive = DecToBinValue (window.DialogArguments)
-
- For intCharPos = 1 To 26
- If Mid(strProtDrive,intCharPos,1) = "1" Then
- document.all("trL" & Chr(intCharPos + 64)).style.display = "none"
- document.all("trR" & Chr(intCharPos + 64)).style.display = "block"
- End If
- Next
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: DriveClick(oDriveSelected)
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is executed on click of a drive.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub DriveClick(oDriveSelected)
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oDrive
-
- ' ~~~ Select the clicked drive
- For Each oDrive in ColDrives
- If oDrive.ClassName = "selectuser" Then
- oDrive.ClassName = "unselectuser"
- End If
- Next
-
- document.all(oDriveSelected).classname = "selectuser"
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: MoveRight()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is executed on Right arrow key press.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub MoveRight
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim bLeftEmpty, oDrive, LeftDrive, NextDrive, CurrDrive, bDown,LeftPrevDrive, LeftCurrDrive, bSelDrive
-
- bLeftEmpty = True
-
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If oDrive.ClassName = "selectuser" Then
- document.all("trL" + Mid(oDrive.id,4)).style.display = "none"
- document.all("trR" + Mid(oDrive.id,4)).style.display = "block"
- Set LeftDrive = oDrive
- End If
- End If
- If Left(oDrive.id,3) = "lbR" Then
- If oDrive.classname = "selectuser" Then
- Exit Sub
- End If
- End If
- Next
-
- If Not IsEmpty(LeftDrive) Then
- ' ~~~ Set the next drive to the moved drive as selected
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If bSelDrive = True Then
- If(document.all("trL" + Mid(oDrive.id,4)).style.display <> "none") Then
- Set NextDrive = oDrive
- bDown = True
- exit For
- End If
- End If
- If oDrive.id = LeftDrive.id Then
- bSelDrive = True
- Set CurrDrive = oDrive
- End If
- End If
- Next
- If Not IsEmpty(NextDrive) Then
- NextDrive.ClassName = "selectuser"
- CurrDrive.ClassName = "unselectuser"
- NextDrive.ScrollInToView( False)
- End If
-
-
- If bDown = False Then
- ' ~~~ Set the previous drive to the moved drive as selected
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If oDrive.id = LeftDrive.id Then
- Set LeftCurrDrive = oDrive
- Exit For
- Else
- If (document.all("trL" + Mid(oDrive.id,4)).style.display <> "none") Then
- Set LeftPrevDrive = oDrive
- End If
- End If
- End If
- Next
- If ( Not IsEmpty(LeftPrevDrive) ) Then
- LeftPrevDrive.ClassName = "selectuser"
- LeftCurrDrive.ClassName = "unselectuser"
- LeftCurrDrive.ScrollIntoView( False )
- End If
- End If
- End If
-
- ' ~~~ To select the drive the right pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If (document.all("trL" + Mid(oDrive.id,4)).style.display <> "none") Then
- bLeftEmpty = False
- End If
- End If
- Next
-
- ' ~~~ If no drives in left pane, move all drives to right pane
- If bLeftEmpty = True Then
- Call RestrictAll()
- End If
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: MoveLeft()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is executed on Left arrow key press.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub MoveLeft
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim bRightEmpty, oDrive, RightDrive, bDown, NextDrive, CurrDrive, LeftCurrDrive, LeftPrevDrive, bSelDrive
-
- bRightEmpty = True
-
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If oDrive.ClassName = "selectuser" Then
- document.all("trL" + Mid(oDrive.id,4)).style.display = "block"
- document.all("trR" + Mid(oDrive.id,4)).style.display = "none"
- Set RightDrive = oDrive
- End If
- End If
- If Left(oDrive.id,3) = "lbL" Then
- If oDrive.classname = "selectuser" Then
- Exit Sub
- End If
- End If
- Next
-
-
- If Not IsEmpty(RightDrive) Then
- ' ~~~ Set the next drive as selected
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If bSelDrive = True Then
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none") Then
- Set NextDrive = oDrive
- bDown = True
- exit For
- End If
- End If
- If oDrive.id = RightDrive.id Then
- bSelDrive = True
- Set CurrDrive = oDrive
- End If
- End If
- Next
- If Not IsEmpty(NextDrive) Then
- NextDrive.ClassName = "selectuser"
- CurrDrive.ClassName = "unselectuser"
- NextDrive.ScrollInToView( False)
- End If
-
- If bDown = False Then
- ' ~~~ Set the previous drive as selected
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If oDrive.id = RightDrive.id Then
- Set LeftCurrDrive = oDrive
- Exit For
- Else
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none" )Then
- Set LeftPrevDrive = oDrive
- End If
- End If
- End If
- Next
-
- If ( Not IsEmpty(LeftPrevDrive) ) Then
- LeftPrevDrive.ClassName = "selectuser"
- LeftCurrDrive.ClassName = "unselectuser"
- LeftCurrDrive.ScrollIntoView( False )
- End If
- End If
- End If
-
- ' ~~~ To select the drive the right pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none" )Then
- bRightEmpty = False
- End If
- End If
- Next
-
- ' ~~~ If no drives in right pane, enable all drives in left pane
- If bRightEmpty = True Then
- Call ClearAll()
- End If
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: moveup()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is executed on Up Arrow key press
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub moveup
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oDrive, LeftCurrDrive, LeftPrevDrive, bLeft, RightCurrDrive, RightPrevDrive
-
- ' ~~~ Select the previous drive in left pane on down arrow key press
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If oDrive.ClassName = "selectuser" Then
- Set LeftCurrDrive = oDrive
- bLeft = True
- Exit For
- Else
- If(document.all("trL" + Mid(oDrive.id,4)).style.display <> "none" )Then
- Set LeftPrevDrive = oDrive
- End If
- End If
- End If
- Next
- If ( (Not IsEmpty(LeftPrevDrive)) and bLeft) Then
- LeftPrevDrive.ClassName = "selectuser"
- LeftCurrDrive.ClassName = "unselectuser"
- LeftCurrDrive.ScrollIntoView( False )
- End If
-
- ' ~~~ Select the previous drive in right pane on down arrow key press
- If Not(bLeft ) Then
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If oDrive.ClassName = "selectuser" Then
- Set RightCurrDrive = oDrive
- Exit For
- Else
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none") Then
- Set RightPrevDrive = oDrive
-
- End If
- End If
- End If
- Next
- If Not IsEmpty(RightPrevDrive) Then
- RightPrevDrive.ClassName = "selectuser"
- RightCurrDrive.ClassName = "unselectuser"
- RightCurrDrive.ScrollIntoView( False )
- End If
- End If
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: movedown()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is for Down arrow key press
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub movedown
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oDrive, bSelDrive, bLeft, NextDrive, CurrDrive
-
- bSelDrive = False
- bLeft = False
-
- ' ~~~ Select the next drive in left pane on down arrow key press
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If bSelDrive = True Then
- If(document.all("trL" + Mid(oDrive.id,4)).style.display <> "none") Then
- Set NextDrive = oDrive
- bLeft = True
- exit For
- End If
- End If
- If oDrive.classname = "selectuser" Then
- bSelDrive = True
- Set CurrDrive = oDrive
- End If
- End If
- Next
-
- ' ~~~ Select the next drive in right pane on down arrow key press
- If Not(bLeft ) Then
- bSelDrive = False
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If bSelDrive = True Then
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none")Then
- Set NextDrive = oDrive
- exit For
- End If
- End If
- If oDrive.classname = "selectuser" Then
- bSelDrive = True
- Set CurrDrive = oDrive
- End If
- End If
- Next
- End If
- If Not IsEmpty(NextDrive) Then
- NextDrive.ClassName = "selectuser"
- CurrDrive.ClassName = "unselectuser"
- NextDrive.ScrollInToView( False)
- End If
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: RestrictAll()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is on click of the RestrictAll button.
- ' *** This adds all the drives in the Restricted section.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub RestrictAll
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim intValue
-
- For intValue = 65 to 90
- ' ~~~ Make all drives in right pane visible
- document.all("trR" + chr(intValue) ).style.display = "block"
- document.all("trL" + chr(intValue) ).style.display = "none"
-
- document.all("lbR" + chr(intValue)).classname = "unselectuser"
- document.all("lbL" + chr(intValue)).classname = "unselectuser"
- Next
-
- ' ~~~ Select the first drive in the right pane
- document.all("trRA").style.display = "block"
- document.all("lbRA").classname = "selectuser"
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: ClearAll()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This subroutine is on click of the ClearAll button.
- ' *** This clears all the drives in the Restricted section.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub ClearAll
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim intValue
- For intValue = 65 to 90
- ' ~~~ Make all drives in left pane visible
- document.all("trR" + chr(intValue) ).style.display = "none"
- document.all("trL" + chr(intValue) ).style.display = "block"
- document.all("lbR" + chr(intValue)).classname = "unselectuser"
- document.all("lbL" + chr(intValue)).classname = "unselectuser"
- Next
-
- ' ~~~ Select the first drive in left pane
- document.all("trLA").style.display = "block"
- document.all("lbLA").classname = "selectuser"
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: CloseOK()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed on click of the "OK" button
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub CloseOK
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim strSelDrives, oDrive
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If document.all("trR" + Mid(oDrive.id,4)).style.display = "none" Then
- strSelDrives = strSelDrives & 0
- End If
- If document.all("trR" + Mid(oDrive.id,4)).style.display = "block" Then
- strSelDrives = strSelDrives & 1
- End If
-
- End If
- Next
-
- strSelDrives = strReverse(strSelDrives)
-
- ' ~~~ Call the function to get the decimal value and return it
- window.returnValue = BinToDecValue(strSelDrives)
-
- window.close
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: TabPress()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed on TAB Key Navigation
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub TabPress
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oDrive
-
- If ( document.activeelement.id = "tRight" ) Then
- ' ~~~ To select the first drive in the left pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If (document.all("trL" + Mid(oDrive.id,4)).style.display <> "none" )Then
- oDrive.classname = "selectuser"
- oDrive.ScrollIntoView( False )
- Exit For
- End If
- End If
- Next
-
- ElseIf ( document.activeelement.id = "btnClearAll" )Then
- ' ~~~ To select the first drive in the Right pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none" )Then
- oDrive.classname = "selectuser"
- oDrive.ScrollIntoView( False )
- Exit For
- End If
- End If
- Next
- End If
-
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: ShiftTabPress()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed on the release of the TAB key with the
- ' *** SHIFT Key combination.
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub ShiftTabPress
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim oDrive
-
- If ( strDivFocus = "tLeft") Then
- ' ~~~ To select the first drive in the left pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- If (document.all("trL" + Mid(oDrive.id,4)).style.display <> "none" )Then
- oDrive.classname = "selectuser"
- oDrive.ScrollIntoView( False )
- Exit For
- End If
- End If
- Next
-
- ' ~~~ Set the string that holds tab focus to null
- strDivFocus = ""
-
-
- ElseIf ( strDivFocus = "tRight")Then
- ' ~~~ To select the first drive in the Right pane
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbL" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- oDrive.classname = "unselectuser"
- End If
- Next
- For Each oDrive in ColDrives
- If Left(oDrive.id,3) = "lbR" Then
- If (document.all("trR" + Mid(oDrive.id,4)).style.display <> "none" )Then
- oDrive.classname = "selectuser"
- oDrive.ScrollIntoView( False )
- Exit For
- End If
- End If
- Next
-
- ' ~~~ Set the string that holds tab focus to null
- strDivFocus = ""
- End If
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: divLeftfocus()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed when the focus is on Left DIV section
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub divLeftfocus
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- ' ~~~ Set the string that holds the current focus
- strDivFocus = "tLeft"
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: divRightfocus()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed when the focus is on Right DIV section
- ' *** ------------------------------------------------------------------------------
- ' ***
- Sub divRightfocus
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- ' ~~~ Set the string that holds the current focus
- strDivFocus = "tRight"
- End Sub
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: BinToDecValue(strValue)
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed to return the selected drives as a
- ' *** decimal value
- ' *** ------------------------------------------------------------------------------
- ' ***
- Function BinToDecValue(strValue)
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim intLength ' ~~~ Integer that stores the length of the input number
- Dim dblDecimalNumber:dblDecimalNumber=0 ' ~~~ Double that stores the decimal number
- Dim strCharFromHex ' ~~~ Character from the Hex number
- Dim intCharIndex ' ~~~ Integer that stores the index of the character
- Dim intPower ' ~~~ Integer that stores the power to which 16 is to be raised
- Dim strNumber
-
- strNumber = strValue
-
- ' ~~~ Get the length of the Hexa decimal number given
- intLength = Len(strNumber)
-
- intCharIndex = intLength
-
- ' ~~~ Loop till the intLength becomes 0
- While intCharIndex <> 0
-
- ' ~~~ Extract the first character from the string
- strCharFromHex = Mid(strNumber,intCharIndex,1)
-
- ' ~~~ Get the power
- intPower = intLength - intCharIndex
-
- dblDecimalNumber = dblDecimalNumber + (2^intPower) * CInt(strCharFromHex)
-
- intCharIndex = intCharIndex - 1
- Wend
-
- ' ~~~ Return the decimal value
- BinToDecValue = dblDecimalNumber
-
- End Function
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: DecToBinValue(intDecValue)
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: This is executed to get the protected drives from the
- ' *** decimal value
- ' *** ------------------------------------------------------------------------------
- ' ***
- Function DecToBinValue(intDecValue)
-
- If NOT DEBUG Then On Error Resume Next Else On Error Goto 0
-
- Dim strBin, intValue
-
- Select Case intDecValue
- ' ~~~ If no drives protected
- Case "0"
- For intValue = 1 to 26
- strBin = strBin & 0
- Next
-
- ' ~~~ Return the value
- DecToBinValue = strBin
- Exit Function
- ' ~~~ If only A: is protected
- Case "1"
- strBin = 1
- For intValue = 2 to 26
- strBin = strBin & 0
- Next
-
- ' ~~~ Return the value
- DecToBinValue = strBin
- Exit Function
- End Select
-
- Select Case intDecValue
- ' ~~~ If no drives protected
- Case ""
- For intValue = 1 to 26
- strBin = strBin & 0
- Next
-
- ' ~~~ Return the value
- DecToBinValue = strBin
- Exit Function
- End Select
-
- ' ~~~ Convert the decimal value into binary
- While intDecValue > 1
- strBin = strBin & CStr(intDecValue Mod 2)
- intDecValue = int(intDecValue/2)
- Wend
-
- strBin = strBin & CStr(intDecValue )
- strBin = CStr(strBin)
-
- ' ~~~ Pad the other bits with 0
- If Len(strBin) < 26 Then
- For intValue = Len(strBin)+1 To 26
- strBin = strBin & 0
- Next
- End If
-
- ' ~~~ Return the value
- DecToBinValue = strBin
-
- End Function
-
- ' ***
- ' *** ------------------------------------------------------------------------------
- ' *** Name: OnDoubleclick()
- ' *** ------------------------------------------------------------------------------
- ' *** Purpose: The drive double clicked is added to the restricted list
- ' *** or unrestricted list.
- ' *** ------------------------------------------------------------------------------
- ' ***
-
- Sub OnDoubleclick()
- ' ~~~ If the selected drive is in leftside move it to right else move it to left
- If mid(window.event.srcelement.id,3,1) = "L" Then
- MoveRight()
- Else
- MoveLeft()
- End If
- End sub