You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
635 lines
44 KiB
635 lines
44 KiB
<HTML>
|
|
<!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
|
|
<HEAD>
|
|
|
|
<TITLE>Tasks Page</TITLE>
|
|
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Option Explicit
|
|
|
|
'Windows constants for key codes
|
|
Public Const RightArrow = 39
|
|
Public Const LeftArrow = 37
|
|
Public Const EnterKey = 13
|
|
Public Const EscapeKey = 27
|
|
Public Const TabKey = 9
|
|
|
|
'special code for new alerts
|
|
Public Const NewAlertKey = 135
|
|
|
|
'color constants
|
|
Public Const BLACK = "#000000"
|
|
Public Const WHITE = "#FFFFFF"
|
|
|
|
|
|
'Three dimentional array holding alert captions, descriptions and long descs
|
|
Dim TasksArray()
|
|
|
|
'Number of localui tasks
|
|
Dim NumberOfTasks
|
|
|
|
'Number of localui tasks
|
|
Dim NumberOfPages
|
|
|
|
'Index of the alert with the focus
|
|
Dim intCurrentTask
|
|
|
|
'Current page that is on display
|
|
Dim intCurrentPage
|
|
|
|
'Timer for idle timeout
|
|
Dim iIdleTimeOut
|
|
|
|
'Timer for idle timeout
|
|
Dim iFlashIconTimeOut
|
|
|
|
'"Page" text to diplay
|
|
Dim strPageText
|
|
|
|
'"View Alerts" text to diplay
|
|
Dim strViewAlertsText
|
|
'----------------------------------------------------------------------------
|
|
' Function: Window_OnLoad
|
|
' Description: Initialization routine for the page
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: AlertsArray,NumberOfAlerts,bAlertViewMode,bOnlyOnePage
|
|
'----------------------------------------------------------------------------
|
|
|
|
Sub Window_OnLoad()
|
|
|
|
'Localization manager object
|
|
Dim objLocMgr
|
|
|
|
'Replacement strings
|
|
Dim varReplacementStrings
|
|
|
|
'Resource ID for "page" text
|
|
Const PAGEINFO_PAGE_TEXT = "&H40020013"
|
|
|
|
'Resource ID for "View Alerts" text
|
|
Const ALERTS_VIEWALERTS_TEXT = "&H40020015"
|
|
|
|
On Error Resume Next
|
|
Err.Clear
|
|
|
|
'Create the localization manager
|
|
Set objLocMgr = CreateObject("ServerAppliance.LocalizationManager")
|
|
|
|
If Err.number = 0 Then
|
|
'Get the strings
|
|
strPageText = objLocMgr.GetString("salocaluimsg.dll",PAGEINFO_PAGE_TEXT,varReplacementStrings)
|
|
strViewAlertsText = objLocMgr.GetString("salocaluimsg.dll",ALERTS_VIEWALERTS_TEXT,varReplacementStrings)
|
|
Set objLocMgr = Nothing
|
|
|
|
End If
|
|
|
|
Err.Clear
|
|
|
|
'set the text for alerts link
|
|
SaAlertsLink.innerText = strViewAlertsText
|
|
|
|
'Get the current local ui alerts
|
|
GetLocalUITasks
|
|
|
|
intCurrentPage = CInt(CurrentPage.value)
|
|
intCurrentTask = CInt(CurrentTask.value)
|
|
|
|
ServeLocalUITasks
|
|
|
|
iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
|
|
|
|
On Error Resume Next
|
|
Err.Clear
|
|
'set the key codes for the page
|
|
Dim objKeypad
|
|
Set objKeypad = CreateObject("Ldm.SAKeypadController")
|
|
If Err.number = 0 Then
|
|
|
|
objKeypad.Setkey 0,TabKey,TRUE
|
|
objKeypad.Setkey 1,TabKey,FALSE
|
|
objKeypad.Setkey 2,LeftArrow,FALSE
|
|
objKeypad.Setkey 3,RightArrow,FALSE
|
|
objKeypad.Setkey 4,EscapeKey,FALSE
|
|
objKeypad.Setkey 5,EnterKey,FALSE
|
|
|
|
Set objKeypad = Nothing
|
|
End If
|
|
|
|
Dim bNewAlerts
|
|
|
|
bNewAlerts = AreThereLocalUIAlerts
|
|
|
|
'display or hide the link
|
|
HideOrDisplayAlertsLink(bNewAlerts)
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: IdleHandler
|
|
' Description: Goes back to main page when timeout expires
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub IdleHandler()
|
|
|
|
window.history.go(-1)
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: ServeLocalUITasks
|
|
' Description: Format the alerts and display them
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: TasksArray,NumberOfTasks,NumberOfPages
|
|
'----------------------------------------------------------------------------
|
|
Sub ServeLocalUITasks
|
|
|
|
Dim NumberOfTasksBefore
|
|
Dim RemainingTasks
|
|
|
|
NumberOfTasksBefore = (intCurrentPage-1) * 4
|
|
RemainingTasks = NumberOfTasks - NumberOfTasksBefore
|
|
|
|
'Clear all of the tasks
|
|
SaTask1.style.display = "none"
|
|
SaTask2.style.display = "none"
|
|
SaTask3.style.display = "none"
|
|
SaTask4.style.display = "none"
|
|
|
|
|
|
If RemainingTasks > 0 Then
|
|
SaTask1.innerText = TasksArray(NumberOfTasksBefore,0)
|
|
SaTask1.href = TasksArray(NumberOfTasksBefore,1)
|
|
SaTask1.style.display = ""
|
|
End If
|
|
|
|
NumberOfTasksBefore = NumberOfTasksBefore + 1
|
|
If RemainingTasks > 1 Then
|
|
SaTask2.innerText = TasksArray(NumberOfTasksBefore,0)
|
|
SaTask2.href = TasksArray(NumberOfTasksBefore,1)
|
|
SaTask2.style.display = ""
|
|
End If
|
|
|
|
NumberOfTasksBefore = NumberOfTasksBefore + 1
|
|
If RemainingTasks > 2 Then
|
|
SaTask3.innerText = TasksArray(NumberOfTasksBefore,0)
|
|
SaTask3.href = TasksArray(NumberOfTasksBefore,1)
|
|
SaTask3.style.display = ""
|
|
End If
|
|
|
|
NumberOfTasksBefore = NumberOfTasksBefore + 1
|
|
If RemainingTasks > 3 Then
|
|
SaTask4.innerText = TasksArray(NumberOfTasksBefore,0)
|
|
SaTask4.href = TasksArray(NumberOfTasksBefore,1)
|
|
SaTask4.style.display = ""
|
|
End If
|
|
|
|
If NumberOfPages > 1 Then
|
|
SaPageInfo.innertext = strPageText&" "&intCurrentPage&"/"&NumberOfPages
|
|
End If
|
|
|
|
'Set the focus on the current task
|
|
If intCurrentTask = 1 Then
|
|
SaTask1.focus
|
|
ElseIf intCurrentTask = 2 Then
|
|
SaTask2.focus
|
|
ElseIf intCurrentTask = 3 Then
|
|
SaTask3.focus
|
|
ElseIf intCurrentTask = 4 Then
|
|
SaTask4.focus
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: GetLocalUITasks
|
|
' Description: Get the local ui tasks from element manager
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: TasksArray,NumberOfTasks
|
|
'----------------------------------------------------------------------------
|
|
Sub GetLocalUITasks()
|
|
|
|
Dim objTaskElementCol
|
|
Dim objTaskElement
|
|
Dim objLocMgr
|
|
Dim varReplacementStrings
|
|
Dim objRetriever
|
|
Dim intCaptionID
|
|
Dim strURL
|
|
Dim intMerit
|
|
Dim intCount
|
|
Dim strSourceDll
|
|
|
|
On Error Resume Next
|
|
Err.Clear
|
|
|
|
'Create elementmgr and get current alerts
|
|
Set objRetriever = CreateObject("Elementmgr.ElementRetriever")
|
|
|
|
If Err.Number = 0 Then
|
|
|
|
Set objTaskElementCol = objRetriever.GetElements(1, "LocalUITask")
|
|
If objTaskElementCol.Count=0 or Err.Number <> 0 Then
|
|
Err.Clear
|
|
NumberOfTasks = 0
|
|
Else
|
|
|
|
ReDim TasksArray(objTaskElementCol.Count-1,2)
|
|
|
|
'create localization manager to get task strings
|
|
Set objLocMgr = CreateObject("ServerAppliance.LocalizationManager")
|
|
If (Err.Number <> 0) Then
|
|
Err.Clear
|
|
NumberOfTasks = 0
|
|
Else
|
|
intCount = 0
|
|
For Each objTaskElement in objTaskElementCol
|
|
|
|
strSourceDll = objTaskElement.GetProperty("Source")
|
|
intCaptionID = "&H" & objTaskElement.GetProperty("CaptionRID")
|
|
strURL = objTaskElement.GetProperty("URL")
|
|
intMerit = CInt(objTaskElement.GetProperty("Merit"))
|
|
|
|
TasksArray(intCount,0) = objLocMgr.GetString(strSourceDll, intCaptionID, varReplacementStrings)
|
|
TasksArray(intCount,1) = strURL
|
|
TasksArray(intCount,2) = intMerit
|
|
intCount = intCount + 1
|
|
Next
|
|
NumberOfTasks = intCount
|
|
NumberOfPages = (NumberOfTasks-1)\4 + 1
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
SortTasksArray
|
|
|
|
Set objLocMgr = Nothing
|
|
Set objTaskElement = Nothing
|
|
Set objTaskElementCol = Nothing
|
|
Set objRetriever = Nothing
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: SortTasksArray
|
|
' Description: Sorts tasks array by merit values
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: TasksArray,NumberOfTasks
|
|
'----------------------------------------------------------------------------
|
|
Sub SortTasksArray()
|
|
|
|
Dim i
|
|
Dim j
|
|
Dim iSmallest
|
|
|
|
Dim strCaption
|
|
Dim strURL
|
|
Dim intMerit
|
|
|
|
'for each item in the array
|
|
For i = 0 To NumberOfTasks-2
|
|
|
|
iSmallest = i
|
|
'find the index of the item with the smallest merit
|
|
For j = i To NumberOfTasks-1
|
|
If TasksArray(j,2) < TasksArray(iSmallest,2) Then
|
|
iSmallest = j
|
|
End If
|
|
Next
|
|
|
|
'swap the smallest item with the current item
|
|
strCaption = TasksArray(i,0)
|
|
strURL = TasksArray(i,1)
|
|
intMerit = TasksArray(i,2)
|
|
|
|
TasksArray(i,0) = TasksArray(iSmallest,0)
|
|
TasksArray(i,1) = TasksArray(iSmallest,1)
|
|
TasksArray(i,2) = TasksArray(iSmallest,2)
|
|
|
|
TasksArray(iSmallest,0) = strCaption
|
|
TasksArray(iSmallest,1) = strURL
|
|
TasksArray(iSmallest,2) = intMerit
|
|
|
|
Next
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: KeyDown
|
|
' Description: Changes pages in response to right and left arrows
|
|
' in multiple task page mode
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub KeyDown()
|
|
|
|
If window.event.keycode = NewAlertKey Then
|
|
Dim bNewAlerts
|
|
|
|
bNewAlerts = AreThereLocalUIAlerts
|
|
|
|
'display or hide the link
|
|
HideOrDisplayAlertsLink(bNewAlerts)
|
|
Exit Sub
|
|
End If
|
|
|
|
'clear the timeout and restart it
|
|
window.clearTimeOut(iIdleTimeOut)
|
|
iIdleTimeOut = window.SetTimeOut("IdleHandler()",300000)
|
|
|
|
'If escape key is hit, go back to alerts page
|
|
If window.event.keycode = EscapeKey Then
|
|
window.history.back
|
|
End If
|
|
|
|
'if there are tasks and they don't fit one page
|
|
If NumberOfPages > 1 Then
|
|
'right arrow
|
|
If window.event.keycode = RightArrow Then
|
|
|
|
intCurrentPage = intCurrentPage + 1
|
|
If intCurrentPage = NumberOfPages + 1 Then
|
|
intCurrentPage = 1
|
|
End If
|
|
intCurrentTask = 1
|
|
ServeLocalUITasks
|
|
CurrentTask.value = CStr(intCurrentTask)
|
|
CurrentPage.value = CStr(intCurrentPage)
|
|
|
|
End If
|
|
'left arrow
|
|
If window.event.keycode = LeftArrow Then
|
|
|
|
intCurrentPage = intCurrentPage -1
|
|
If intCurrentPage = 0 Then
|
|
intCurrentPage = NumberOfPages
|
|
End If
|
|
intCurrentTask = 1
|
|
ServeLocalUITasks
|
|
CurrentTask.value = CStr(intCurrentTask)
|
|
CurrentPage.value = CStr(intCurrentPage)
|
|
End If
|
|
|
|
End If
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: InvertSelection
|
|
' Description: Inverts the focus element's background and foreground
|
|
' Input Variables: intIndex, index of the focus element, -1 for alerts link
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub InvertSelection(intIndex)
|
|
|
|
CurrentTask.value = CStr(intIndex)
|
|
|
|
'Invert the background and foreground for the focus element
|
|
If intIndex = 1 Then
|
|
SaTask1.style.backgroundColor = BLACK
|
|
SaTask1.style.color = WHITE
|
|
ElseIf intIndex = 2 Then
|
|
SaTask2.style.backgroundColor = BLACK
|
|
SaTask2.style.color = WHITE
|
|
ElseIf intIndex = 3 Then
|
|
SaTask3.style.backgroundColor = BLACK
|
|
SaTask3.style.color = WHITE
|
|
ElseIf intIndex = 4 Then
|
|
SaTask4.style.backgroundColor = BLACK
|
|
SaTask4.style.color = WHITE
|
|
ElseIf intIndex = -1 Then
|
|
SaAlertsLink.style.backgroundColor = BLACK
|
|
SaAlertsLink.style.color = WHITE
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: InvertToNormal
|
|
' Description: Inverts element that loses focus to normal
|
|
' Input Variables: intIndex, index of the element loosing the focus, -1 for alerts link
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub InvertToNormal(intIndex)
|
|
|
|
|
|
'Invert the background and color for the element loosing the focus
|
|
If intIndex = 1 Then
|
|
SaTask1.style.backgroundColor = ""
|
|
SaTask1.style.color = BLACK
|
|
ElseIf intIndex = 2 Then
|
|
SaTask2.style.backgroundColor = ""
|
|
SaTask2.style.color = BLACK
|
|
ElseIf intIndex = 3 Then
|
|
SaTask3.style.backgroundColor = ""
|
|
SaTask3.style.color = BLACK
|
|
ElseIf intIndex = 4 Then
|
|
SaTask4.style.backgroundColor = ""
|
|
SaTask4.style.color = BLACK
|
|
ElseIf intIndex = -1 Then
|
|
SaAlertsLink.style.backgroundColor = ""
|
|
SaAlertsLink.style.color = BLACK
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: HideOrDisplayAlertsLink
|
|
' Description: Displays or hides the link to alerts
|
|
' Input Variables: true, display the link
|
|
' false, hide the link
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub HideOrDisplayAlertsLink(bDisplay)
|
|
|
|
'clear the current timeout
|
|
window.clearTimeOut(iFlashIconTimeOut)
|
|
|
|
If bDisplay = true Then
|
|
'reposition the page info
|
|
SaPageInfo.style.top = 39
|
|
|
|
'display the link and flashing icon
|
|
SaAlertsLink.style.display = ""
|
|
SaAlertsIcon.style.display = ""
|
|
'start the timer
|
|
iFlashIconTimeOut = window.SetTimeOut("FlashAlertsIcon(1)",500)
|
|
|
|
Else
|
|
'reposition the page info
|
|
SaPageInfo.style.top = 52
|
|
|
|
'hide the link and flashing icon
|
|
SaAlertsLink.style.display = "none"
|
|
SaAlertsIcon.style.display = "none"
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: AreThereLocalUIAlerts
|
|
' Description: Check if there are existing localui alerts
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: true, false
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Function AreThereLocalUIAlerts()
|
|
|
|
Dim objElement
|
|
Dim objElementCol
|
|
Dim objAlertElementCol
|
|
Dim objAlertElement
|
|
Dim strElementID
|
|
Dim strAlertLog
|
|
Dim objRetriever
|
|
On Error Resume Next
|
|
|
|
|
|
AreThereLocalUIAlerts = false
|
|
Err.Clear
|
|
|
|
'Create elementmgr and get current alerts
|
|
Set objRetriever = CreateObject("Elementmgr.ElementRetriever")
|
|
|
|
If Err.Number = 0 Then
|
|
|
|
Set objElementCol = objRetriever.GetElements(1, "SA_Alerts")
|
|
If objElementCol.Count=0 or Err.Number <> 0 Then
|
|
Err.Clear
|
|
AreThereLocalUIAlerts = false
|
|
Else
|
|
|
|
'get alert definitions
|
|
Set objAlertElementCol = objRetriever.GetElements(1,"LocalUIAlertDefinitions")
|
|
|
|
If (Err.Number <> 0) Then
|
|
Err.Clear
|
|
AreThereLocalUIAlerts = false
|
|
Else
|
|
For Each objElement in objElementCol
|
|
strAlertLog = objElement.GetProperty("AlertLog")
|
|
strElementID = "LocalUIAlertDefinitions" & strAlertLog & Hex(objElement.GetProperty("AlertID"))
|
|
Err.Clear
|
|
Set objAlertElement = objAlertElementCol.Item(strElementID)
|
|
If Err <> 0 Then
|
|
Set objAlertElement = Nothing
|
|
Else
|
|
AreThereLocalUIAlerts = true
|
|
Exit For
|
|
End If
|
|
Next
|
|
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
Set objElement = Nothing
|
|
Set objElementCol = Nothing
|
|
Set objAlertElement = Nothing
|
|
Set objAlertElementCol = Nothing
|
|
Set objRetriever = Nothing
|
|
|
|
End Function
|
|
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: FlashAlertsIcon
|
|
' Description: Flash the alert icon
|
|
' Input Variables: iIndex, current status of icon
|
|
' 0, invisible 1, visible
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub FlashAlertsIcon(iIndex)
|
|
|
|
If iIndex = 1 Then
|
|
SaAlertsIcon.style.display = "none"
|
|
iFlashIconTimeOut = window.SetTimeOut("FlashAlertsIcon(0)",500)
|
|
Else
|
|
iFlashIconTimeOut = window.SetTimeOut("FlashAlertsIcon(1)",500)
|
|
SaAlertsIcon.style.display = ""
|
|
End If
|
|
|
|
End Sub
|
|
|
|
'----------------------------------------------------------------------------
|
|
' Function: GotoAlertsPage
|
|
' Description: Goes back to alerts page
|
|
' Input Variables: None
|
|
' Output Variables: None
|
|
' Return Values: None
|
|
' Global Variables: None
|
|
'----------------------------------------------------------------------------
|
|
Sub GotoAlertsPage()
|
|
|
|
window.event.returnValue = false
|
|
window.history.back
|
|
|
|
End Sub
|
|
-->
|
|
</SCRIPT>
|
|
|
|
</HEAD>
|
|
<BODY RIGHTMARGIN=0 LEFTMARGIN=0>
|
|
|
|
<A STYLE="position:absolute; top:0; left:0; font-size:10; font-family=arial;"
|
|
ID="SaTask1" OnFocus="InvertSelection(1)" HIDEFOCUS=true onkeydown="KeyDown"
|
|
OnBlur="InvertToNormal(1)">
|
|
</A>
|
|
|
|
<A STYLE="position:absolute; top:13; left:0; font-size:10; font-family=arial;"
|
|
ID="SaTask2" OnFocus="InvertSelection(2)" HIDEFOCUS=true onkeydown="KeyDown"
|
|
OnBlur="InvertToNormal(2)">
|
|
</A>
|
|
|
|
<A STYLE="position:absolute; top:26; left:0; font-size:10; font-family=arial;"
|
|
ID="SaTask3" OnFocus="InvertSelection(3)" HIDEFOCUS=true onkeydown="KeyDown"
|
|
OnBlur="InvertToNormal(3)">
|
|
</A>
|
|
|
|
<A STYLE="position:absolute; top:39; left:0; font-size:10; font-family=arial;"
|
|
ID="SaTask4" OnFocus="InvertSelection(4)" HIDEFOCUS=true onkeydown="KeyDown"
|
|
OnBlur="InvertToNormal(4)">
|
|
</A>
|
|
|
|
<A ID="SaPageInfo" STYLE="position:absolute; top:52; right:0; font-size:10;
|
|
font-family=arial;">
|
|
</A>
|
|
|
|
<A STYLE="position:absolute; top:52; right:14; font-size:10; font-family=arial; display:none;"
|
|
ID="SaAlertsLink" href="localui_main.htm" onkeydown="KeyDown" OnBlur="InvertToNormal(-1)"
|
|
OnFocus="InvertSelection(-1)" OnClick="GotoAlertsPage()" HIDEFOCUS=true>
|
|
</A>
|
|
|
|
<IMG STYLE="position:absolute; bottom:0; right:0; display:none;"
|
|
ID="SaAlertsIcon" SRC="localui_saalertsicon.bmp" BORDER=0>
|
|
|
|
<INPUT TYPE=HIDDEN Name="CurrentPage" value="1">
|
|
|
|
<INPUT TYPE=HIDDEN Name="CurrentTask" value="1">
|
|
|
|
</BODY>
|
|
</HTML>
|