% '==================================================
' Microsoft Server Appliance
'
' Serves task wizard/propsheet
'
' Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved.
'================================================== %>
<% ' Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved.
'Task module-level variables
Dim mstrPageName ' used as page identifier, e.g., "Intro"
Dim mstrTaskTitle ' e.g., "Add User"
Dim mstrPageTitle ' e.g., "Username and Password"
Dim mstrTaskType ' "wizard", "prop"
Dim mstrPageType ' "intro", "standard", "finish"
Dim mstrMethod ' "BACK", "NEXT", "FINISH", etc
Dim mstrReturnURL ' URL to return to after ending task
Dim mstrFrmwrkFormStrings ' framework form values, list of strings to exclude
Dim mstrIconPath ' image for upper right header
Dim mstrPanelPath ' image for left panel of intro and finish pg
Dim mblnCancelDirect ' browser returns directly to ReturnURL
Dim mblnFinishDirect ' browser returns directly to ReturnURL
Dim mintElementIndex ' index of embedded wizard page (0 - n, -1 = no extensions)
Dim mintElementCount ' number of embedded pages in wizard
Dim mstrErrMsg ' used by SetErrMsg and GetErrMsg
Dim mstrAsyncTaskName ' Task EXE name - empty if task is synchronous
Dim intCaptionIDTask
On Error Resume Next
Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
strSourceName = "sakitmsg.dll"
if Err.number <> 0 then
Response.Write "Error in localizing the web content "
Response.End
end if
'-----------------------------------------------------
'START of localization content
Dim L_BACK_BUTTON
Dim L_BACKIE_BUTTON
Dim L_NEXT_BUTTON
Dim L_NEXTIE_BUTTON
Dim L_FINISH_BUTTON
Dim L_OK_BUTTON
Dim L_CANCEL_BUTTON
Dim L_BACK_ACCESSKEY
Dim L_NEXT_ACCESSKEY
Dim L_FINISH_ACCESSKEY
L_BACK_BUTTON = objLocMgr.GetString(strSourceName, "&H4001001C",varReplacementStrings)
L_BACKIE_BUTTON = objLocMgr.GetString(strSourceName, "&H4001001D",varReplacementStrings)
L_NEXT_BUTTON = objLocMgr.GetString(strSourceName, "&H4001001E",varReplacementStrings)
L_NEXTIE_BUTTON = objLocMgr.GetString(strSourceName, "&H4001001F",varReplacementStrings)
L_FINISH_BUTTON = objLocMgr.GetString(strSourceName, "&H40010020",varReplacementStrings)
L_OK_BUTTON = objLocMgr.GetString(strSourceName, "&H40010021",varReplacementStrings)
L_CANCEL_BUTTON = objLocMgr.GetString(strSourceName, "&H40010022",varReplacementStrings)
L_BACK_ACCESSKEY = objLocMgr.GetString(strSourceName, "&H40010039",varReplacementStrings)
L_NEXT_ACCESSKEY = objLocMgr.GetString(strSourceName, "&H4001003A",varReplacementStrings)
L_FINISH_ACCESSKEY = objLocMgr.GetString(strSourceName, "&H4001003B",varReplacementStrings)
'End of localization content
'-----------------------------------------------------
'Task Constants
Const PROPERTY_TASK_NICE_NAME = "TaskNiceName"
Const PROPERTY_TASK_URL = "TaskURL"
Const WBEM_E_PROVIDER_NOT_CAPABLE = "&H80041024"
Const WIZARD_TASK = "wizard"
Const PROPSHEET_TASK = "prop"
Const BODY_PAGE = "standard"
Const INTRO_PAGE = "intro"
Const FINISH_PAGE = "finish"
Const BACK_METHOD = "BACK"
Const NEXT_METHOD = "NEXT"
Const FINISH_METHOD = "FINISH"
Const CANCEL_METHOD = "CANCEL"
'Get standard task values and initialize
mstrMethod = Request.Form("Method")
mstrPageName = Request("PageName")
mstrReturnURL = Request("ReturnURL")
mintElementIndex = -1 ' set later in ServeWizardEmbeds()
mintElementCount = Request.Form("EmbedPageCount") ' get previous value, if any
If mintElementCount="" Then
mintElementCount=0
End If
mstrFrmwrkFormStrings = "!method!pagename!pagetype!tasktype!returnurl!embedpageindex!embedpagecount!commonvalues!canceldirect!finishdirect!embedvalues0!embedvalues1!embedvalues2!embedvalues3!embedvalues4!"
mblnCancelDirect = True
mblnFinishDirect = False
Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
'Setup task page
Select Case mstrPageName
Case "shTaskFooter"
ServeTaskFooterFrame()
End Select
'----------------------------------------------------------------------------
'
' Function : AsyncTaskBusy
'
' Synopsis : Determine if the async task is currently being executed
'
' Arguments: TaskName(IN) - async task name
'
' Returns : true/false
'
'----------------------------------------------------------------------------
Function AsyncTaskBusy(TaskName)
Dim objTask
On Error Resume Next
Set objTask = GetObject("WINMGMTS:{impersonationLevel=impersonate}!\\" & GetServerName & "\root\cimv2:Microsoft_SA_Task.TaskName=" & Chr(34) & TaskName & Chr(34) )
If Not objTask.IsAvailable Then
AsyncTaskBusy = True
Else
AsyncTaskBusy = False
End If
Set objTask = Nothing
End Function
'----------------------------------------------------------------------------
'
' Function : SetErrMsg
'
' Synopsis : Sets framework error message string
'
' Arguments: Message(IN) - error message text
'
' Returns : Nothing
'
'----------------------------------------------------------------------------
Function SetErrMsg(Message)
On Error Resume Next
mstrErrMsg = Message
End Function
'----------------------------------------------------------------------------
'
' Function : GetErrMsg
'
' Synopsis : Gets the current framework error message string
'
' Arguments: None
'
' Returns : None
'
'----------------------------------------------------------------------------
Function GetErrMsg()
On Error Resume Next
GetErrMsg = mstrErrMsg
End Function
'----------------------------------------------------------------------------
'
' Function : ServeFormValues
'
' Synopsis : Serves service specific form values while navigating wizard
' pages
'
' Arguments: None
'
' Returns : None
'
'----------------------------------------------------------------------------
Function ServeFormValues()
Dim objItem
Dim strNewCommonData
Dim strOldCommonData
Dim strOldEmbData()
Dim strNewEmbData()
Dim intOldEmbIndex
Dim intPos1
Dim intPos2
Dim strName
Dim strValue
Dim strNameD
Dim strValueD
Dim arrName()
Dim arrValue()
Dim i, j
Dim rc
On Error Resume Next
strNameD = ";;"
strValueD = ";"
ReDim strOldEmbData(mintElementCount)
ReDim strNewEmbData(mintElementCount)
' get data from post
strOldCommonData = Request.Form("CommonValues") ' data from host pages
For i = 0 To mintElementCount
strOldEmbData(i) = Request.Form("EmbedValues" & i) ' data from embedded pages
Next
intOldEmbIndex = CInt(Request.Form("EmbedPageIndex"))
For i = 0 To mintElementCount ' get previously saved Embed values
If i <> intOldEmbIndex Then
strNewEmbData(i) = strOldEmbData(i)
End If
Next
For Each objItem in Request.Form 'loop through items in posted form
strName = LCase(objItem)
strName = Replace(strName, strValueD, "")
strValue = Trim(Request.Form(objItem))
strValue = Replace(strValue, strValueD, "")
If strValue = "" Then strValue = " "
If InStr(mstrFrmwrkFormStrings, "!" & strName & "!") = 0 Then
' host page data
If strOldCommonData = "" Then
' in intro page
strNewCommonData = strNewCommonData & strNameD & strName & strValueD & strValue
ElseIf InStr(LCase(strOldCommonData), strNameD & strName & strValueD) <> 0 Then
' in body page
strNewCommonData = strNewCommonData & strNameD & strName & strValueD & strValue
ElseIf intOldEmbIndex <> -1 And Request.Form("PageName") = "TaskExtension" Then
'extension page - update data for current page
If InStr(LCase(strOldCommonData), strNameD & strName & strValueD) = 0 Then
strNewEmbData(intOldEmbIndex) = strNewEmbData(intOldEmbIndex) & strNameD & strName & strValueD & strValue
End If
End If
End If
Next
Response.Write "" & vbCrLf
Response.Write "" & vbCrLf
Response.Write "" & vbCrLf
For i = 0 To mintElementCount-1
Response.Write "" & vbCrLf
If mstrPageType="finish" Then ' serve out embed values discretely in Finish page
If UnpackData(strNewEmbData(i), arrName, arrValue, strNameD, strValueD) Then
For j = 0 To UBound(arrName)
Response.Write "" & vbCrLf
Next
End If
End If
Next
If mstrPageName = "TaskExtension" Then
If UnpackData(strNewCommonData, arrName, arrValue, strNameD, strValueD) Then ' serve out common data as discreet form values
For i = 0 To UBound(arrName)
Response.Write "" & vbCrLf
Next
End If
End If
End Function
'----------------------------------------------------------------------------
'
' Function : UnPackData
'
' Synopsis : Unpacks service specific form values from one string into
' individual pairs
'
' Arguments: InputStrings(IN) - input form variable (which contains all
'