home *** CD-ROM | disk | FTP | other *** search
Wrap
' *** ' *** -------------------------------------------------------------------------- ' *** Filename: Restrictions.vbs ' *** -------------------------------------------------------------------------- ' *** Description: Code for the User Restrictions HTA ' *** -------------------------------------------------------------------------- ' *** Version: 1.0 ' *** Notes: ' *** -------------------------------------------------------------------------- ' *** 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 If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ ' ~~~ Declare global variables ' ~~~ Dim oRestriction, oLog, oLockPopup, oRestrictPopup, oLockAgainPopup, iUserMessages, bLockError Dim bShowLockPopup, bShowResPopup, bShowPopup, bUserMessages, bLockAgainPopup Dim sAccountName ' Stores the user account name to be restricted Dim bFAT32Drive, sCurrentScrSvr ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Init() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Initialises all the variables and gets the xml template ' *** ------------------------------------------------------------------------------ ' *** Sub Init() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sRootFolder ' ~~~ Global variable that stores the current screen saver set for the local user sCurrentScrSvr = "" ' ~~~ Create objects Set oRestriction = New Restriction Set oLog = New Logging sRootFolder = GetRootFolder ' ~~~ Initiate logging & bind the logging object to the restrictions object Call oLog.Open(sRootFolder & "\log\Restrict.hta.log") Call oLog.Write("Restrict.hta : Started") oRestriction.Logging = oLog ' ~~~ Set the template file oRestriction.TemplateXML = sRootFolder & "\xml\" & GetAppname & ".xml" ' ~~~ Delete all the old User xml files On Error Resume Next Call oFSo.DeleteFile(sRootFolder & "\xml\User.*.xml", True) ' ~~~ If error, key does not exist, value=off If err.number <> 0 Then err.Clear End If ' ~~~ Turn off error handling On Error Goto 0 ' ~~~ Populate restrictions Call AddRestrictions() ' ~~~ Create the popup's Set oLockPopup = Window.createpopup() Set oRestrictPopup = Window.createpopup() Set oLockAgainPopup = Window.createpopup() End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** 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 ' ~~~ Call the sub to enable body Call BodyDisable(False) ' ~~~ Call the method to write the user session in registry Call UserSessionReg(oNetwork.UserName) ' ~~~ Set tooltip messages ' btnAccessDisks.title = resPreventDisks.innerHTML spchkSharedAccount.Title = resLockProfileTooltip.innerText chkSharedAccount.Title = resLockProfileTooltip.innerText txtAccessDisks.style.visibility = "visible" txtAccount.value = "" txtAccount.ReadOnly = True ' ~~~ To make the default selection to selectprofile button btnSelectProfile.SetActive() btnApply.disabled = True DisableAllControls(True) bShowPopup = False bShowLockPopup = True bShowResPopup = True bLockAgainPopup = True End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Validate() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This function is executed before a wizard page is exited ' *** If this function returns false. The page does not exit. ' *** ------------------------------------------------------------------------------ ' *** Function Validate() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Validate = True End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Action() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This subroutine performs the actual functionality of the tool ' *** ------------------------------------------------------------------------------ ' *** Sub Action() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ If already applied ; no need to apply through OK If btnApply.disabled = False Then Call Apply() End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: AddRestrictions() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Adds all of the check boxes to the restrictions section ' *** ------------------------------------------------------------------------------ ' *** Sub AddRestrictions() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oDIV, oXML, oSection, oNode, sHTML, oOptDiv ' ~~~ Get the div, xml template file and the restrictions section Set oDIV = divRestrictions Set oXML = oRestriction.OpenXMLFile(oRestriction.TemplateXML) ' ~~~ Cycle through sections For Each oSection In oXML.selectNodes("/restrictions/allrestrictions/section[@type=""allrestrictions""]") ' ~~~ Add the div for this section sHTML = "" sHTML = sHTML & "<ssw:checkbox id=""chk" & oSection.Attributes.GetNamedItem("id").Text & """ tabindex = 0 onResultChange=""Bubble(this)"" /> " sHTML = sHTML & "<img id=""img" & oSection.Attributes.GetNamedItem("id").Text & """ src=""graphics/tickit.gif"" alt=""+"" title="""" align=""absmiddle"" onclick=""ShowHideSection('" & oSection.Attributes.GetNamedItem("id").Text & "')""> " sHTML = sHTML & "<span class=restrict id=""sp" & oSection.Attributes.GetNamedItem("id").Text &"""style=""cursor:hand"" onclick=""ShowHideSection('" & oSection.Attributes.GetNamedItem("id").Text & "')"">" & oSection.Attributes.GetNamedItem("name").Text & "</span><br>" & vbCrLf sHTML = sHTML & "<DIV id=""div" & oSection.Attributes.GetNamedItem("id").Text & """ style=""display:none; padding-left:42px"">" & vbCrLf ' ~~~ Add children to the div For Each oNode In oSection.childNodes sHTML = sHTML & "<table cellpadding=""0"" cellspacing=""1"" border=""0"">" sHTML = sHTML & "<tr valign=""top"">" sHTML = sHTML & "<td><ssw:checkbox id=""" & oNode.Attributes.GetNamedItem("id").Text & """ tabindex = 0 onResultChange=""Bubble(this)"" /> </td>" sHTML = sHTML & "<td><span class=restrict id=""" & "sp" & oNode.Attributes.GetNamedItem("id").Text & """ onClick=""Bubble(window.event.srcelement)"">" & oNode.Attributes.GetNamedItem("name").Text & "</span></td>" & vbCrLf sHTML = sHTML & "</tr></table>" Next ' ~~~ Close section div and add it to the document sHTML = sHTML & "</DIV>" & vbCrLf oDIV.innerHTML = oDIV.innerHTML & sHTML Next Set oDIV = Nothing ' ~~~ Optional restrictions Set oOptDiv = divOptRestrictions For Each oSection In oXML.selectNodes("/restrictions/optionalrestrictions/section[@type=""optionalrestrictions""]") ' ~~~ Add the div for this section sHTML = "" sHTML = sHTML & "<input type=""image"" id=""img" & oSection.Attributes.GetNamedItem("id").Text & """ src=""graphics/tickit.gif"" alt=""+"" title="""" align=""absmiddle"" onclick=""ShowHideSection('" & oSection.Attributes.GetNamedItem("id").Text & "')"" > " sHTML = sHTML & "<span class=restrict id=""sp" & oSection.Attributes.GetNamedItem("id").Text &""" style=""cursor:hand"" onclick=""ShowHideSection('" & oSection.Attributes.GetNamedItem("id").Text & "')"">" & oSection.Attributes.GetNamedItem("name").Text & "</span><br>" & vbCrLf sHTML = sHTML & "<div id=""div" & oSection.Attributes.GetNamedItem("id").Text & """ style=""display:none; padding-left:42px"">" & vbCrLf ' ~~~ Add children to the div For Each oNode In oSection.childNodes sHTML = sHTML & "<table cellpadding=""0"" cellspacing=""0"" border=""0"">" sHTML = sHTML & "<tr>" If oNode.Attributes.GetNamedItem("id").Text = "chkDisableInternet" Then sHTML = sHTML & "<td valign=""top""><input type=""checkbox"" id=""" & oNode.Attributes.GetNamedItem("id").Text & """ tabindex = 0 onclick=""ChangeDisableInternet()"" > </td>" Else sHTML = sHTML & "<td valign=""top""><input type=""checkbox"" id=""" & oNode.Attributes.GetNamedItem("id").Text & """ tabindex = 0 onclick=""OptRestrictionsClick('" & oNode.Attributes.GetNamedItem("id").Text & "')"" > </td>" End If sHTML = sHTML & "<td valign=""middle""><span class=restrict id=""sp" & oNode.Attributes.GetNamedItem("id").Text & """ onclick=""OptRestrictionsClick('sp" & oNode.Attributes.GetNamedItem("id").Text & "')"" >" & oNode.Attributes.GetNamedItem("name").Text & "</span></td>" & vbCrLf sHTML = sHTML & "</tr></table>" Next ' ~~~ Close section div and add it to the document sHTML = sHTML & "</div>" & vbCrLf oOptDiv.innerHTML = oOptDiv.innerHTML & sHTML Next End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ChangeUser() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Loads user data when the user is selected ' *** ------------------------------------------------------------------------------ ' *** Sub ChangeUser() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Now load the new user, unless blank was selected If document.all("txtAccount").value <> "" Then Call LoadUser() ' ~~~ To call the method to show popup bShowLockPopup = True bShowResPopup = True bLockAgainPopup = True ' ~~~ Method to check the file system of the profile location ' ~~~ and disable "Lock Profile" Call CheckFilesystem() ' ~~~ Pop up baloons are displayed based on the user's settings. Call ShowHidePopup() End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: LoadUser() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Creates xml for the user and populates the UI ' *** ------------------------------------------------------------------------------ ' *** Sub LoadUser() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oXML, bOK, oChild, iValue ' ~~~ Turn on error handling On Error Resume Next ' ~~~ Default to true for users we do not need to create bOK = True ' ~~~ Set the user and create its xml file, if it does not already exist oRestriction.User = sAccountName ' ~~~ Always load the profile settings from Registry not from the existing xml file bOK = oRestriction.CreateXML ' ~~~ If xml file created ok, or already exists! If bOK Then ' ~~~ Open xml file Set oXML = oRestriction.OpenXMLFile(oRestriction.UserXML) ' ~~~ Set the check boxes of the sections Call LoadSection(oXML, "general") Call LoadSection(oXML, "allrestrictions") Call LoadSection(oXML, "optionalrestrictions") ' ~~~ Set state if disable internet access check box If txtProxy.Value = "NoInternetAccess" Then chkDisableInternet.Checked = True Else chkDisableInternet.Checked = False End If ' ~~~ Now we need to set the state of "All Restrictions" iValue = -1 For Each oChild in divRestrictions.getElementsByTagName("checkbox") iValue = GetChildValue(iValue, oChild.value) Next chkRestrictions.value = iValue chkRestrictions.save ' ~~~ Destroy xml objects Set oXML = Nothing ' ~~~ Check if disable internet was checked ChangeDisableInternetLoad() Else ' ~~~ Display error message Call MsgBox(document.all("resErrorLoadingUser").innerHTML, vbOKOnly + vbCritical, L_sToolkitTitle_TEXT) txtAccount.value = "" End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: SaveUser() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Saves a users settings ' *** ------------------------------------------------------------------------------ ' *** Sub SaveUser() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Turn on error handling On Error Resume Next Dim oXML ' ~~~ Set the user and create its xml file, if it does not already exist oRestriction.User = sAccountName If Not(oFso.FileExists(oRestriction.UserXML)) Then bOK = oRestriction.CreateXML End If ' ~~~ Open users XML file and get the pokes Set oXML = oRestriction.OpenXMLFile(oRestriction.UserXML) ' ~~~ Save the check boxes of the sections Call SaveSection(oXML, "general") Call SaveSection(oXML, "allrestrictions") Call SaveSection(oXML, "optionalrestrictions") ' ~~~ Save the xml file Call oXML.Save(oRestriction.UserXML) ' ~~~ Clear the user oRestriction.User = "" End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: LoadSection(sSection) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Loads a users settings into a section ' *** ------------------------------------------------------------------------------ ' *** Sub LoadSection(oXML, sSection) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oSection, oRestrict, oNode, oChild, iValue ' ~~~ Turn on error handling On Error Resume Next ' ~~~ Cycle through sections For Each oSection In oXML.selectNodes("/restrictions/allrestrictions/section[@type=""" & sSection & """]") ' ~~~ Cycle through all the restrictions in the section node For Each oRestrict In oSection.childNodes ' ~~~ Process node depending on type Select Case Left(oRestrict.Attributes.GetNamedItem("id").Text,3) Case "txt" ' ~~~ If text, set field to value of first child document.all(oRestrict.Attributes.GetNamedItem("id").Text).Value = oRestrict.firstChild.Text Case "chk" iValue = -1 ' ~~~ Cycle through all the pokes to work out value For Each oNode In oRestrict.childNodes If TypeName(oNode.GetAttribute("ignore")) <> "String" Then If oNode.Attributes.GetNamedItem("on").Text = oNode.Text Then iValue = GetChildValue(iValue, 1) Else iValue = GetChildValue(iValue, 0) End If End If Next ' ~~~ Set the control document.all(oRestrict.Attributes.GetNamedItem("id").Text).value = iValue document.all(oRestrict.Attributes.GetNamedItem("id").Text).save End Select Next ' ~~~ If this isn't the general section we need to set the value of the section checkboxes If sSection <> "general" and sSection = "allrestrictions" Then For Each oChild in document.all("div" & oSection.Attributes.GetNamedItem("id").Text).getElementsByTagName("checkbox") iValue = GetChildValue(iValue, oChild.value) Next ' ~~~ Set the control document.all("chk" & oSection.Attributes.GetNamedItem("id").Text).value = iValue document.all("chk" & oSection.Attributes.GetNamedItem("id").Text).save End If Next ' ~~~ Destroy xml objects Set oSection = Nothing Set oNode = Nothing ' ~~~ For optional restrictions For Each oSection In oXML.selectNodes("/restrictions/optionalrestrictions/section[@type=""" & sSection & """]") ' ~~~ Cycle through all the restrictions in the section node For Each oRestrict In oSection.childNodes ' ~~~ Process node depending on type Select Case Left(oRestrict.Attributes.GetNamedItem("id").Text,3) Case "chk" ' ~~~ Cycle through all the pokes to work out value For Each oNode In oRestrict.childNodes If oNode.Attributes.GetNamedItem("on").Text = oNode.Text Then ' ~~~ Set the control document.all(oRestrict.Attributes.GetNamedItem("id").Text).checked = True Else document.all(oRestrict.Attributes.GetNamedItem("id").Text).checked = False End If Next End Select Next Next ' ~~~ Destroy xml objects Set oSection = Nothing Set oNode = Nothing End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: SaveSection(sSection) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Saves a users settings from a section ' *** ------------------------------------------------------------------------------ ' *** Sub SaveSection(oXML, sSection) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oSection, oNode, IdleLogoff ' ~~~ Turn on error handling On Error Resume Next ' ~~~ Cycle through sections For Each oSection In oXML.selectNodes("/restrictions/allrestrictions/section[@type=""" & sSection & """]") ' ~~~ Cycle through pokes, setting values For Each oNode In oSection.getElementsByTagName("poke") ' ~~~ Process node depending on type Call oLog.Write("Restrict.hta : " & oNode.Attributes.GetNamedItem("resid").Text) Select Case Left(oNode.Attributes.GetNamedItem("resid").Text,3) Case "chk" Select Case document.all(oNode.Attributes.GetNamedItem("resid").Text).value Case 0 oNode.Text = oNode.Attributes.GetNamedItem("off").Text Case 1 oNode.Text = oNode.Attributes.GetNamedItem("on").Text Case 2 ' do nothing End Select Case "txt" If oNode.Attributes.GetNamedItem("resid").Text = "txtLogoffInactive" Then If oNode.Attributes.GetNamedItem("on").Text <> "" Then If document.all(oNode.Attributes.GetNamedItem("resid").Text).value <> "" Then If Right(oNode.Attributes.GetNamedItem("regkey").Text,17) = "ScreenSaveTimeOut" Then If IdleLogoff > 0 Then oNode.Text = (IdleLogoff * 60) - 15 End If Else oNode.Text = oShell.ExpandEnvironmentStrings(oNode.Attributes.GetNamedItem("on").Text) End If Else If UCase(sCurrentScrSvr) = "FORCELOGOFF.EXE" Then oNode.Text = oShell.ExpandEnvironmentStrings(oNode.Attributes.GetNamedItem("off").Text) End If End If Else oNode.Text = document.all(oNode.Attributes.GetNamedItem("resid").Text).value IdleLogoff = document.all(oNode.Attributes.GetNamedItem("resid").Text).value End If Else If oNode.Attributes.GetNamedItem("on").Text <> "" Then If document.all(oNode.Attributes.GetNamedItem("resid").Text).value <> "" Then oNode.Text = oNode.Attributes.GetNamedItem("on").Text Else oNode.Text = oNode.Attributes.GetNamedItem("off").Text End If Else oNode.Text = document.all(oNode.Attributes.GetNamedItem("resid").Text).value End If End If End Select Next Next ' ~~~ Destroy xml objects Set oSection = Nothing Set oNode = Nothing ' ~~~ For Optional restrictions ' ~~~ Cycle through sections For Each oSection In oXML.selectNodes("/restrictions/optionalrestrictions/section[@type=""" & sSection & """]") ' ~~~ Cycle through pokes, setting values For Each oNode In oSection.getElementsByTagName("poke") ' ~~~ Process node depending on type Call oLog.Write("Restrict.hta : " & oNode.Attributes.GetNamedItem("resid").Text) Select Case Left(oNode.Attributes.GetNamedItem("resid").Text,3) Case "chk" If document.all(oNode.Attributes.GetNamedItem("resid").Text).Checked Then oNode.Text = oNode.Attributes.GetNamedItem("on").Text Else oNode.Text = oNode.Attributes.GetNamedItem("off").Text End If End Select Next Next ' ~~~ Destroy xml objects Set oSection = Nothing Set oNode = Nothing End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ChangeDisableInternet() ' *** ------------------------------------------------------------------------------ ' *** Purpose: If use select disable internet, disable homepage and proxy fields ' *** ------------------------------------------------------------------------------ ' *** Sub ChangeDisableInternet() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ To Enable apply button If txtAccount.value <> "" Then btnApply.disabled = False If chkDisableInternet.Checked Then txtProxy.Value = "NoInternetAccess" txtProxy.Disabled = True Else If document.all("txtProxy").Value = "NoInternetAccess" Then document.all("txtProxy").Value = "" End If txtProxy.Disabled = False End If Else chkDisableInternet.checked = False End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ChangeDisableInternetLoad() ' *** ------------------------------------------------------------------------------ ' *** Purpose: If use select disable internet, disable homepage and proxy fields ' *** This function gets called while loading the profile settings ' *** ------------------------------------------------------------------------------ ' *** Sub ChangeDisableInternetLoad() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ To Enable apply button If txtAccount.value <> "" Then If chkDisableInternet.Checked Then txtProxy.Value = "NoInternetAccess" txtProxy.Disabled = True Else If txtProxy.Value = "NoInternetAccess" Then txtProxy.Value = "" End If txtProxy.Disabled = False End If End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ShowHideSection(sSection) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Shows or Hiides a resrictions section ' *** ------------------------------------------------------------------------------ ' *** Sub ShowHideSection(sSection) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 If document.all("div" & sSection).style.display = "block" Then document.all("div" & sSection).style.display = "none" ' ~~~ Change the image of the treeview to expand document.all("img" & sSection).src = "graphics/tickit.gif" Call window.scrollto(0,0) Else document.all("div" & sSection).style.display = "block" ' ~~~ Change the image of the treeview to collapse document.all("img" & sSection).src = "graphics/crossit.gif" ' ~~~ To scroll the selected restrictions to top document.all("sp" & sSection).Scrollintoview(True) Call window.scrollto(0,0) End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ClearFields() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Saves a users settings ' *** ------------------------------------------------------------------------------ ' *** Sub ClearFields() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oField ' ~~~ Clear all input elements For Each oField in document.getElementsByTagName("input") oField.Value = "" Next ' ~~~ Clear all check boxes For Each oField in document.getElementsByTagName("checkbox") oField.Value = 0 Next ' ~~~ Clear the dd list document.all("txtAccessDisks").value = "" End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: GetChildValue(iResult, iChild) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Used to work out the overall value of multiple children ' *** returns 0,1,2 : off, on, grey ' *** ------------------------------------------------------------------------------ ' *** Function GetChildValue(iResult, iChild) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim iNewResult If (iResult=-1) or (iResult=iChild) Then iNewResult = iChild Else iNewResult = 2 End If GetChildValue = iNewResult End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Bubble(oItem) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Bubble the state of a checkbox throughout the tree when clicked ' *** ------------------------------------------------------------------------------ ' *** Sub Bubble(oItem) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sChkId, bTextClick, oChkItem If document.all("txtAccount").value = "" Then If oItem.tagname = "checkbox" Then ' ~~~ If no account is selected make the check box zero document.all(oItem.id).value = 0 End If Else ' ~~~ To Enable apply button Call Change_value() bTextClick = False ' ~~~ Check if the text is clicked If Left(oItem.id,2) = "sp" Then ' ~~~ Extract the checkbox id from the span id that is clicked sChkId = Mid(oItem.Id,3) ' ~~~ Get the object of the coressponding checkbox Set oChkItem = document.all(sChkId) bTextClick = True End If If bTextClick = True Then ' ~~~ Generate the onclick event of the checkbox oChkItem.Click Call BubbleDown(oChkItem) Else Call BubbleDown(oItem) End If Call BubbleUp() End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: BubbleDown(oItem) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Bubble the state of a checkbox down ' *** ------------------------------------------------------------------------------ ' *** Sub BubbleDown(oItem) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oDiv, oChk, oChild Dim colTable, oTable ' ~~~ bubble down Set oChk = document.all("chk" & Mid(oItem.id,4)) Set oDiv = document.all("div" & Mid(oItem.id,4)) If Not(oDiv is nothing) and Not(oChk is nothing) Then Set colTable = oDiv.getElementsByTagName("TABLE") For Each oTable in colTable For Each oChild in oTable.all Select Case UCase(oChild.TagName) Case "CHECKBOX" If oChk.value = 2 Then oChild.load oChild.value = 0 Else oChild.value = oChk.value End If Case "DIV" Call BubbleDown(oChild) End Select Next Next End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: BubbleUp(oItem) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Bubble the state of a checkbox up ' *** ------------------------------------------------------------------------------ ' *** Sub BubbleUp() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oSection, oChild, iValue, iValue2 ' ~~~ Check if the messages need to be displayed for the user If iUserMessages and bUserMessages Then If RestrictMessage(document.all("chkRestrictions").value) Then Exit Sub Else Call UserSessionReg(oNetwork.UserName) End If iValue2 = -1 For Each oSection in document.all("divRestrictions").getElementsByTagName("div") iValue = -1 For Each oChild in oSection.getElementsByTagName("checkbox") iValue = GetChildValue(iValue, oChild.value) Next document.all("chk" & Mid(oSection.id,4)).value = iValue iValue2 = GetChildValue(iValue2, iValue) Next document.all("chkRestrictions").value = iValue2 End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: SelectProfile() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Called when the Select a Profile is clicked ' *** ------------------------------------------------------------------------------ ' *** Sub SelectProfile() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim strUser bProcessing = True ' ~~~ Before selecting a new profile check whether the currently selected profile has change or not If (btnApply.disabled = False) and (txtAccount.value <> "") Then If MsgBox (resChangeProfile.innerHTML,vbYesNo+vbInformation,sTitle) = vbYes Then Call Apply() Else btnApply.disabled = true End If End If ' ~~~ Get the return value from the modal dialog strUser = Window.ShowModalDialog("UserAccounts.hta", "Restrictions", "dialogWidth:15;dialogHeight:10;Center:Yes;help:No;Resizable:No;") If NOT IsEmpty(strUser) Then txtAccount.value = strUser(1) ' ~~~ Store the user account name sAccountName = strUser(0) End If If txtAccount.value = "" Then DisableAllControls(True) btnApply.disabled = true Else ' ~~~ Check if the user logged on through fast user switching when administrator is applying restrictions. ' ~~~ The HTA is kept open and the user account displayed is logged on through fast user switching. If Not oRestriction.IsUserLoggedOn(sAccountName) Then DisableAllControls(False) ' ~~~ Call the change user function ChangeUser End If End If bProcessing = False End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Apply() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Applies the restrictions for the profile selected ' *** ------------------------------------------------------------------------------ ' *** Sub Apply() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ To change the cursor to wait icon bProcessing = True Call BodyDisable(True) ' ~~~ To check if the Apply() is called from Apply or OK button If (window.event.srcelement.id) = "btnApply" Then ' ~~~ Disable the OK button and text DisableFinish(True) End If ' ~~~ Save the restrictions if the profile is changed If document.all("txtAccount").value <> "" Then If oRestriction.GetProfilePath(sAccountName) <> "" Then If Not oRestriction.IsUserLoggedOn(sAccountName) Then Call SaveUser() RestrictSelectedProfile() If Not(bLockError) Then Msgbox document.all("txtAccount").value & " " & document.all("resAppliedChanges").innerHTML , vbInformation , sTitle Else Msgbox resUserLogonError.innerHTML, vbOKOnly+vbCritical, sTitle End If Else Msgbox resUserNoProfileError.innerHTML, vbOKOnly+vbCritical, sTitle End If End If ' ~~~ To change the cursor to default icon Call BodyDisable(False) btnApply.OnMouseout() btnApply.disabled = true ' ~~~ Enable the OK button and text DisableFinish(False) Call CheckFilesystem() bProcessing = False End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: RestrictSelectedProfile() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This subroutine performs the actual functionality of the tool ' *** Selected profile is restricted ' *** ------------------------------------------------------------------------------ ' *** Sub RestrictSelectedProfile() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oFile, sProfile sProfile = sAccountName If sProfile <> "" Then ' ~~~ Process all of the xml files If oFso.FileExists(GetRootFolder & "\xml\" & "User." & sProfile & ".xml") Then oRestriction.User = sProfile If oRestriction.AccountLocked(sProfile) = False AND oFso.FolderExists(oRestriction.GetProfilePath(sProfile) & ".orig") Then If Msgbox(resLockOrigDelete.innerHTML,VBYesNo + VBQuestion,sTitle) = VBYes Then oRestriction.ChangeLockFolder = False Else oRestriction.ChangeLockFolder = True End If End If oRestriction.ApplyXML bLockError = False If oRestriction.AccountLocked(sProfile) = False and chkSharedAccount.value = 1 Then MsgBox document.all("resLockError").innerHTML, vbOKOnly+vbCritical, sTitle chkSharedAccount.value = 0 bLockError = True End If End If End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Change_value() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This subroutine is called when the value in the edit boxes ' *** are changing.It enables the Apply button ' *** ------------------------------------------------------------------------------ ' *** Sub Change_value() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 If txtAccount.value = "" Then chkSharedAccount.value = 0 chkForceRestart.value = 0 chkDisableInternet.checked = False chkDisableMessenger.checked = False Else If window.event.srcelement.id = "chkSharedAccount" AND bFAT32Drive Then chkSharedAccount.value = 0 Exit Sub End If btnApply.disabled = False ' ~~~ To hide the popup's If window.event.srcelement.id = "chkSharedAccount" Then poponclick("Lock") ElseIf window.event.srcelement.id = "chkRestrictions" Then poponclick("Restrict") End If End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Validate_idle() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This subroutine is called when the value in the edit boxes ' *** are changing.It enables the Apply button ' *** ------------------------------------------------------------------------------ ' *** Sub Validate_idle() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Handle error in Log off Idle field On Error Resume next btnApply.disabled = False If txtLogoffInactive.value <> "" Then Int(txtLogoffInactive.value) If err.number <> 0 Then ' ~~~ If idle value is not a numeric value MsgBox resLogoffError.innerHTML, vbOKOnly+vbCritical, sTitle Window.Event.ReturnValue = False txtLogoffInactive.value = "" txtLogoffInactive.SetActive() Else If txtLogoffInactive.value >= 0 AND txtLogoffInactive.value < 1 Then ' ~~~ If idle value is between 0 and 1 then, set it to 1 txtLogoffInactive.value = 1 ElseIf txtLogoffInactive.value < 0 Then ' ~~~ If idle is negative, give the error message MsgBox resNegativeLogoffValue.innerHTML, vbOKOnly+vbCritical, sTitle Window.Event.ReturnValue = False txtLogoffInactive.value = "" txtLogoffInactive.SetActive() Exit Sub End If If txtLogoffMinsUse.value <> "" Then ' ~~~ If idle value is greater than logoff after use value If Int(txtLogoffMinsUse.value) < Int(txtLogoffInactive.value) Then MsgBox resMoreLogoffIdleValue.innerHTML, vbOKOnly+vbCritical, sTitle Window.Event.ReturnValue = False txtLogoffInactive.SetActive() Else ' ~~~ Truncate the decimal part and display the value txtLogoffInactive.value = Int( txtLogoffInactive.value ) End If Else ' ~~~ Truncate the decimal part and display the value txtLogoffInactive.value = Int( txtLogoffInactive.value ) End If End If End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: Validate_Use() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This subroutine is called when the value in the edit boxes ' *** are changing.It enables the Apply button ' *** ------------------------------------------------------------------------------ ' *** Sub Validate_Use() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Handle error in two Log off minutes checkboxes On Error Resume next btnApply.disabled = False If txtLogoffMinsUse.value <> "" Then Int(txtLogoffMinsUse.value) If err.number <> 0 Then ' ~~~ If the value is not numeric MsgBox resLogoffError.innerHTML, vbOKOnly+vbCritical,sTitle Window.Event.ReturnValue = False txtLogoffMinsUse.value = "" txtLogoffMinsUse.SetActive() Else If txtLogoffMinsUse.value >= 0 AND txtLogoffMinsUse.value < 5 Then ' ~~~ If the value is between 0 and 5, set it to 5 txtLogoffMinsUse.value = 5 ElseIf txtLogoffMinsUse.value < 0 Then ' ~~~ If the value is negative, give the error message MsgBox resNegativeLogoffValue.innerHTML, vbOKOnly+vbCritical, sTitle Window.Event.ReturnValue = False txtLogoffMinsUse.value = "" txtLogoffMinsUse.SetActive() Exit Sub End If If txtLogoffInactive.value <> "" Then ' ~~~ If the Logoff after use value is less than idle logoff value If Int(txtLogoffMinsUse.value) < Int(txtLogoffInactive.value) Then MsgBox resLessLogoffUseValue.innerHTML, vbOKOnly+vbCritical, sTitle Window.Event.ReturnValue = False txtLogoffMinsUse.SetActive() Else ' ~~~ Truncate the decimal part and display the value txtLogoffMinsUse.value = Int( txtLogoffMinsUse.value ) End If Else ' ~~~ Truncate the decimal part and display the value txtLogoffMinsUse.value = Int( txtLogoffMinsUse.value ) End If End If End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: DisableAllControls() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Enables/Disables all the controls If a User account is selected ' *** ------------------------------------------------------------------------------ ' *** Sub DisableAllControls(bEnable) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 txtHomePage.disabled = bEnable txtProxy.disabled = bEnable txtProxyOverride.Disabled = bEnable txtLogoffMinsUse.disabled = bEnable txtLogoffInactive.disabled = bEnable txtAccessDisks.disabled = bEnable btnAccessDisks.disabled = bEnable End sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ClickText(chkId) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This method is called when the user clicks on the text of the checkbox ' *** ------------------------------------------------------------------------------ ' *** Function ClickText(checkId) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 ' ~~~ Enable only if user account is selected. If txtAccount.value <> "" Then checkId.Click End If End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: DisableFinish(bToggle) ' *** ------------------------------------------------------------------------------ ' *** Purpose: Enables/Disables all the Finish text and button on Apply ' *** ------------------------------------------------------------------------------ ' *** Sub DisableFinish(bToggle) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 If bToggle = True Then btnFinish.disabled = True btnFinish.style.cursor = "auto" Else btnFinish.disabled = False btnFinish.style.cursor = "hand" End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: DrivesPopup() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This method is called to popup the selectdrives.hta ' *** ------------------------------------------------------------------------------ ' *** Sub DrivesPopup If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 bProcessing = True If txtAccount.value <> "" Then Dim intDrives intDrives = Window.ShowModalDialog("SelectDrives.hta", txtAccessDisks.value,"dialogWidth:20;dialogHeight:18;Center:Yes;help:No;Resizable:No;") ' ~~~ Assign the returned decimal value to the txtAccessDisks If intDrives <> "" Then ' ~~~ Enable apply only if the drive value changes If txtAccessDisks.value = "" Then txtAccessDisks.value = 0 If Int(txtAccessDisks.value) <> Int(intDrives) Then ' ~~~ Call the change value sub Change_value() End If txtAccessDisks.value = intDrives End If End If bProcessing = False End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: HTAKeyDown() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the handler function for tool specific key controls ' *** ------------------------------------------------------------------------------ ' *** Sub HTAKeyDown() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sElement, sParent sElement = window.event.srcelement.id sParent = window.event.srcelement.parentnode.id Select Case(window.event.keycode) Case 32 If mid(sElement,1,3) = "chk" Then If sParent <> "divAdditional" and sParent <> "divProgramIcons" Then ' ~~~ Generate the click event only for the 3-state checkboxes. document.all(sElement).Click End If End If Case 37 ' ~~~ Collapse If sElement = "chkStartMenu" or sElement = "chkWindows" or sElement = "chkIExplorer" or sElement = "chkOffice" or sElement = "chkSRPSection" or sElement = "imgAdditionalStartMenu" or sElement = "imgAdditionalWinXP" or sElement = "imgAdditionalIE" or sElement = "imgAdditional" Then If document.all("div" & mid(sElement,4)).style.display <> "none" Then ShowHideSection(mid(sElement,4)) End If ElseIf sParent = "divStartMenu" or sParent = "divWindows" or sParent = "divIExplorer" or sParent = "divOffice" or sParent = "divSRPSection" Then ShowHideSection(mid(sParent,4)) document.all("chk" & mid(sParent,4)).focus End If Case 39 ' ~~~ Expand If sElement = "chkStartMenu" or sElement = "chkWindows" or sElement = "chkIExplorer" or sElement = "chkOffice" or sElement = "chkSRPSection" or sElement = "imgAdditionalStartMenu" or sElement = "imgAdditionalWinXP" or sElement = "imgAdditionalIE" or sElement = "imgAdditional" Then If document.all("div" & mid(sElement,4)).style.display = "none" Then ShowHideSection(mid(sElement,4)) End If End If Case 40 If mid(sElement,1,3) = "chk" or mid(sElement,1,3) = "img" Then window.event.keycode = 9 End If Case 38 Case 9 Case 27 End Select If bShowPopup Then ShowHidePopup() End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: ShowHidePopup() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method to show the popup's ' *** ------------------------------------------------------------------------------ ' *** Sub ShowHidePopup() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oLockPopBody, oResPopBody, ipopHeight, oLockAgainPopBody Dim oAccount, strProfilePath, iDivScrollTop , iChkOffsetValue ipopHeight = 0 strProfilePath = "" Set oAccount = GetObject("WinNT://" & sComputer & "/" & sAccountName) strProfilePath = oAccount.Profile iDivScrollTop = divGeneralSettings.ScrollTop If document.all("chkSharedAccount").Value = 0 and bShowLockPopup = True and strProfilePath = "" Then Set oLockPopBody = oLockPopup.document.body oLockPopBody.style.backgroundColor = popupBackgroundColor.innerText oLockPopBody.style.border = popupBorder.innerText oLockPopBody.style.padding = popupPadding.innerText oLockPopBody.style.Color = popupColor.innerText oLockPopBody.style.Font = popBodyFont.innerText oLockPopBody.innerHTML = "<div onclick=""parent.poponclick('Lock')"">" + document.all("popLockMessage").innerHTML + "</div>" oLockPopup.Hide() iChkOffsetValue = chkSharedAccount.offsetparent.offsetTop + chkSharedAccount.offsetHeight If iDivScrollTop <= iChkOffsetValue Then oLockPopup.show 10, 10, 250, 100, chkSharedAccount ipopHeight = oLockPopBody.scrollHeight oLockPopup.show 10, 10, 250, ipopHeight, chkSharedAccount End If bShowLockPopup = True bShowPopup = True Exit Sub End If If document.all("chkSharedAccount").Value = 0 and bLockAgainPopup = True and strProfilePath <> "" Then Set oLockAgainPopBody = oLockAgainPopup.document.body oLockAgainPopBody.innerHTML = "<div onclick=""parent.poponclick('LockAgain')"">" + document.all("resLockAgainMessage").innerHTML + "</div>" oLockAgainPopBody.style.backgroundColor = LockAgainpopupBackground.innerText oLockAgainPopBody.style.border = popupBorder.innerText oLockAgainPopBody.style.padding = popupPadding.innerText oLockAgainPopBody.style.Color = popupColor.innerText oLockAgainPopBody.style.Font = popBodyFont.innerText oLockAgainPopup.Hide() iChkOffsetValue = chkSharedAccount.offsetparent.offsetTop + chkSharedAccount.offsetHeight If iDivScrollTop <= iChkOffsetValue Then oLockAgainPopup.show 10, 10, 250, 100, chkSharedAccount ipopHeight = oLockAgainPopBody.scrollHeight oLockAgainPopup.show 10, 10, 250, ipopHeight, chkSharedAccount End If bLockAgainPopup = True bShowPopup = True Exit Sub End If If document.all("chkRestrictions").Value = 0 and bShowResPopup = True and strProfilePath = "" Then Set oResPopBody = oRestrictPopup.document.body oResPopBody.style.backgroundColor = popupBackgroundColor.innerText oResPopBody.style.border = popupBorder.innerText oResPopBody.style.padding = popupPadding.innerText oResPopBody.style.Color = popupColor.innerText oResPopBody.style.Font = popBodyFont.innerText oResPopBody.innerHTML = "<div onclick=""parent.poponclick('Restrict')"" >" + document.all("popRestrictMessage").innerHTML + "</div>" oRestrictPopup.Hide() iChkOffsetValue = chkRestrictions.offsetTop + chkRestrictions.offsetHeight If iDivScrollTop <= iChkOffsetValue Then oRestrictPopup.show 10, 16, 300, 100, chkRestrictions ipopHeight = oResPopBody.scrollHeight oRestrictPopup.show 10, 16, 300, ipopHeight, chkRestrictions End If bShowResPopup = True bLockAgainPopup = False bShowPopup = True End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: UserSessionReg(sUserName) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method to store user's session in HKLM for ' *** displaying the messages first time. ' *** ------------------------------------------------------------------------------ ' *** Sub UserSessionReg(sUserName) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 iUserMessages = RegRead(TOOLKITKEY & sUserName & "_RestrictMessages") If IsNull(iUserMessages) Then Call RegWrite(TOOLKITKEY & sUserName & "_RestrictMessages" , "1","REG_SZ") End If iUserMessages = RegRead(TOOLKITKEY & sUserName & "_RestrictMessages") bUserMessages = True End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: RestrictMessage(iChkboxValue) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method display messageboxes. ' *** ------------------------------------------------------------------------------ ' *** Function RestrictMessage(iChkboxValue) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 RestrictMessage = False ' ~~~ If All Restrictions Chk box is off If iChkboxValue = 0 and window.event.srcelement.id <> "chkRestrictions" and bUserMessages Then If Msgbox (document.all("resLowLevelRestrict").innerHTML & vbCrlf & vbCrlf & document.all("resLowLevelRestrict2").innerHTML, VBQuestion + VBYesNo, document.all("resAdvOperator").innerHTML) = VBNo Then ' ~~~ Reset the registry value for the user Call RegWrite (TOOLKITKEY & oNetwork.UserName & "_RestrictMessages" , "1", "REG_SZ") iUserMessages = RegRead(TOOLKITKEY & oNetwork.UserName & "_RestrictMessages") bUserMessages = False ' ~~~ Reset the checkbox clicked to original state document.all(window.event.srcelement.id).click ' ~~~ Return true to exit from the sub RestrictMessage = True Else Call RegWrite (TOOLKITKEY & oNetwork.UserName & "_RestrictMessages" , "0", "REG_SZ") iUserMessages = RegRead(TOOLKITKEY & oNetwork.UserName & "_RestrictMessages") End If End If ' ~~~ If All Restrictions Chk box is on If iChkboxValue = 1 and window.event.srcelement.id <> "chkRestrictions" and bUserMessages Then If Msgbox (document.all("resAllRestrict").innerHTML & vbCrlf & vbCrlf & document.all("resAllRestrict2").innerHTML, VBQuestion + VBYesNo, document.all("resAdvOperator").innerHTML) = VBNo Then ' ~~~ Reset the registry value for the user Call RegWrite (TOOLKITKEY & oNetwork.UserName & "_RestrictMessages" , "1", "REG_SZ") iUserMessages = RegRead(TOOLKITKEY & oNetwork.UserName & "_RestrictMessages") bUserMessages = False ' ~~~ Reset the checkbox clicked to original state document.all(window.event.srcelement.id).click ' ~~~ Return true to exit from the sub RestrictMessage = True Else ' ~~~ Reset the registry value for the user(not to display the message boxes again) Call RegWrite (TOOLKITKEY & oNetwork.UserName & "_RestrictMessages" , "0", "REG_SZ") iUserMessages = RegRead(TOOLKITKEY & oNetwork.UserName & "_RestrictMessages") End If End If End Function ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: OptRestrictionsClick(strElement) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method to check/uncheck optional restrictions ' *** check boxes. ' *** ------------------------------------------------------------------------------ ' *** Sub OptRestrictionsClick(strElement) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 If document.all("txtAccount").value = "" Then If Left(strElement,2) = "sp" Then document.all(Mid(strElement,3)).checked = False Else document.all(strElement).checked = False End If Else If Left(strElement,2) = "sp" Then document.all(Mid(strElement,3)).click ' ~~~ To Enable apply button Call Change_value() End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: poponclick(sPopup) ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method display toggle the two popup's. ' *** ------------------------------------------------------------------------------ ' *** Sub poponclick(sPopup) If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim oResPopBody,ipopHeight,iDivScrollTop , iChkOffsetValue iDivScrollTop = divGeneralSettings.ScrollTop iChkOffsetValue = chkRestrictions.offsetTop + chkRestrictions.offsetHeight Select Case sPopup Case "Lock" ' ~~~ Hide the popup of Lock Profile oLockPopup.Hide() bShowLockPopup = False ' ~~~ To show the popup for the restrictions if it is off If document.all("chkRestrictions").Value = 0 and bShowResPopup = True Then set oResPopBody = oRestrictPopup.document.body oResPopBody.style.backgroundColor = popupBackgroundColor.innerText oResPopBody.style.border = popupBorder.innerText oResPopBody.style.padding = popupPadding.innerText oResPopBody.style.Color = popupColor.innerText oResPopBody.style.Font = popBodyFont.innerText oResPopBody.innerHTML = "<div onclick=""parent.poponclick('Restrict')"" >" + popRestrictMessage.innerHTML + "</div>" oRestrictPopup.Hide() If iDivScrollTop <= iChkOffsetValue Then oRestrictPopup.show 10, 16, 300, 100, chkRestrictions ipopHeight = oResPopBody.scrollHeight oRestrictPopup.show 10, 16, 300, ipopHeight, chkRestrictions End If End If Case "Restrict" ' ~~~ Hide the popup of Restrictions oRestrictPopup.Hide() bShowResPopup = False Case "LockAgain" ' ~~~ Hide the popup used to remind the user to lock the profile again oLockAgainPopup.Hide() bLockAgainPopup = False ' ~~~ To show the popup for the restrictions if it is off If document.all("chkRestrictions").Value = 0 and bShowResPopup = True Then set oResPopBody = oRestrictPopup.document.body oResPopBody.style.backgroundColor = popupBackgroundColor.innerText oResPopBody.style.border = popupBorder.innerText oResPopBody.style.padding = popupPadding.innerText oResPopBody.style.Color = popupColor.innerText oResPopBody.style.Font = popBodyFont.innerText oResPopBody.innerHTML = "<div onclick=""parent.poponclick('Restrict')"" >" + popRestrictMessage.innerHTML + "</div>" oRestrictPopup.Hide() If iDivScrollTop <= iChkOffsetValue Then oRestrictPopup.show 10, 16, 300, 100, chkRestrictions ipopHeight = oResPopBody.scrollHeight oRestrictPopup.show 10, 16, 300, ipopHeight, chkRestrictions End If End If End Select If bShowLockPopup = False and bShowResPopup = False Then bShowPopup = False End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: BodyOnclick() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This is the method is executed onclick of the body. ' *** ------------------------------------------------------------------------------ ' *** Sub BodyOnclick() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Dim sElementId sElementId = window.event.srcelement.id ' ~~~ To hide the lock again popup remainder when clicked on Lock This Profile text If sElementId = "chkSharedAccount" and oLockAgainPopup.IsOpen Then bLockAgainPopup = False oLockAgainPopup.Hide() End If ' ~~~ Call the ShowHidePopup sub to retain the popup messages ' ~~~ generally the popup messages vanish when clicked outside the popup If sElementId <> "btnSelectProfile" and sElementId <> "chkSharedAccount" Then If bShowPopup Then ShowHidePopup() End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: CheckFilesystem() ' *** ------------------------------------------------------------------------------ ' *** Purpose: Checks the file system of the drive in which the profile ' *** exists. If it is not NTFS, then disable the "Lock Profile" ' *** checkbox ' *** ------------------------------------------------------------------------------ ' *** Sub CheckFilesystem() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 bFAT32Drive = False If NOT oRestriction.IsFileSystemNTFS Then chkSharedAccount.Value = 0 bShowLockPopup = False bLockAgainPopup = False bFAT32Drive = True spchkSharedAccount.Title = resLockProfileTooltip.innerText + " " + resFAT32LockProfile.innerText chkSharedAccount.Title = resLockProfileTooltip.innerText + " " + resFAT32LockProfile.innerText oRestriction.IsProfileDriveNTFS = False Else spchkSharedAccount.Title = resLockProfileTooltip.innerText chkSharedAccount.Title = resLockProfileTooltip.innerText End If End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: HTAUnLoad() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This method unloads all the objects ' *** created within the scope of the HTA ' *** ------------------------------------------------------------------------------ ' *** Sub HTAUnLoad() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 Set oRestriction = Nothing Set oLog = Nothing Set oLockPopup = Nothing Set oRestrictPopup = Nothing Set oLockAgainPopup = Nothing End Sub ' *** ' *** ------------------------------------------------------------------------------ ' *** Name: DivScroll() ' *** ------------------------------------------------------------------------------ ' *** Purpose: This method is used to show the popup's for the lock profile ' *** and restrictions checkboxes on scrolling the restrictions ' *** div. ' *** ------------------------------------------------------------------------------ ' *** Sub DivScroll() If NOT DEBUG Then On Error Resume Next Else On Error Goto 0 oLockPopup.Hide() oRestrictPopup.Hide() oLockAgainPopup.Hide() End Sub