windows-nt/Source/XPSP1/NT/enduser/windows.com/wuv3/wuv3is/ctltest.htm

447 lines
8.1 KiB
HTML
Raw Normal View History

2020-09-26 03:20:57 -05:00
<!--
Copyright (c) 1998-99 by Microsoft Corporation
ctltest.htm
Owner: YAsmi
-->
<HTML>
<BODY>
<OBJECT CLASSID="clsid:CEBC955E-58AF-11D2-A30A-00A0C903492B" HEIGHT="0" ID="WUV3IS" WIDTH="0"></OBJECT>
<div backgroundcolor=lightblue>
<div backgroundcolor=blue width=10%>
</div>
</div>
<br>
Puid <INPUT NAME=txtPUID TYPE=TEXT>
<button id=cmdSelect>Select</button>
<button id=cmdUnSelect>UnSelect</button>
<button id=cmdRemoveSelect>Select For Removal</button>
<button id=cmdDependancies>Show Dependancies</button> &nbsp &nbsp
<button id=cmdPersonHide>Person Hide</button> &nbsp &nbsp
<button id=cmdPersonUnHide>Person Unide</button> &nbsp &nbsp
<p>
<button id=cmdRefresh>Refresh</button> &nbsp &nbsp
<button id=cmdInstallSelected>Install Selected Items</button> &nbsp &nbsp
<button id=cmdRemoveSelected>Remove Selected tems</button> &nbsp &nbsp
<button id=cmdShowHistory>Show History</button> &nbsp &nbsp
<button id=cmdShowMetrics>Show Metrics</button> &nbsp &nbsp
<button id=cmdShowEULAs>Show EULAs</button> &nbsp &nbsp
<button id=cmdSetStrings>Set Strings</button> &nbsp &nbsp
<p>
<IFRAME WIDTH= 100% HEIGHT=80% id=fraDisplay></IFRAME>
<SCRIPT LANGUAGE="VBScript">
Option Explicit
'const Server = "http://yasmi2/v3content2"
'const Server = "http://wusite/v3site/3-5-99"
'const Server = "http://fear/v3content/test/bld18"
const Server = "http://fear/v3content/beta/bld75/ident"
const Locale = "0x00000409"
Dim CatPuid
Sub Window_OnLoad()
cmdSetStrings_OnClick
Display
End Sub
Sub Display()
dim html
Dim Force98
Force98 = False
html = ""
CatPuid = 0
if Not Force98 then
html = html & GetCatalogHTML("Catalog List", 0, 0)
end if
if CatPuid = 0 then
'force
html = html & GetCatalogHTML("Forced Catalog 90702", 90702, 2)
else
html = html & GetCatalogHTML("Product Catalog " & CStr(CatPuid), CatPuid, 0)
end if
'html = html & GetItemHTML("Item 19", 19)
'html = html & GetItemHTML("Item 79", 79)
fraDisplay.document.body.innerHTML = html
End Sub
Sub cmdRemoveSelect_OnClick()
Dim Flag
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Flag = &H44 'REMOVE+SELECT
WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
End Sub
Sub cmdSelect_OnClick()
Dim Flag
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Flag = &H04 'SELECT
WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
End Sub
Sub cmdUnSelect_OnClick()
Dim Flag
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Flag = &H08 'UNSELECT
WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
End Sub
Sub cmdPersonUnHide_OnClick()
Dim Flag
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Flag = &H80 'ITEM_STATE_PERSONALIZE_UNHIDE
WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
End Sub
Sub cmdPersonHide_OnClick()
Dim Flag
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Flag = &H10 'ITEM_STATE_PERSONALIZE_HIDE
WUV3IS.ChangeItemState CLng(txtPUID.Value), Flag
End Sub
Sub cmdRefresh_OnClick()
Display
End Sub
Sub cmdSetStrings_OnClick()
Dim Strs
exit sub
Strs = Array( _
"Download*progress:", _
"Download*time*remaining:", _
"Install*progress:", _
"Cancel*", _
"%d KB/%d KB*", _
"%d sec*", _
"%d min*", _
"%d hr %d min*", _
"Microsoft*Windows*Update", _
"You*must*restart Windows so that installation can finish.", _
"Do*you want*to restart now?")
WUV3IS.SetStrings Strs, 0
End Sub
Sub cmdInstallSelected_OnClick()
Dim Arr
Dim I
Dim J
Dim S
Arr = WUV3IS.InstallSelectedItems(Server, 0, "")
S = ""
For I = 0 To UBound(Arr)
For J = 0 to UBound(Arr, 2)
S = S & Arr(I, J) & ","
Next
S = S & vbCrlf
Next
MsgBox S
WUV3IS.FinalizeInstall 1
End Sub
Sub cmdRemoveSelected_OnClick()
WUV3IS.RemoveSelectedItems()
End Sub
Sub cmdShowMetrics_OnClick()
Dim Arr
Dim I
Dim J
Dim S
Arr = WUV3IS.GetInstallMetrics()
S = ""
For I = 0 To UBound(Arr)
For J = 0 to UBound(Arr, 2)
S = S & Arr(I, J) & ","
Next
S = S & vbCrlf
Next
MsgBox S
End Sub
Sub cmdShowHistory_OnClick()
Dim Arr
Dim I
Dim J
Dim S
Dim U
Arr = WUV3IS.GetInstallHistory
S = ""
U = UBound(Arr)
For I = 0 To U
if (U - I) <= 5 then
For J = 0 to UBound(Arr, 2)
S = S & Arr(I, J) & ","
Next
S = S & vbCrlf
end if
Next
MsgBox S, 0, "History (Last Few Entries)"
End Sub
Sub cmdShowEULAs_OnClick()
Dim Arr
Dim I
Dim J
Dim S
S = WUV3IS.GetContentURL()
MsgBox "Content URL: " & S
Arr = WUV3IS.GetEula()
S = ""
For I = 0 To UBound(Arr)
For J = 0 to UBound(Arr, 2)
S = S & Arr(I, J) & ","
Next
S = S & vbCrlf
Next
MsgBox S
End Sub
Sub cmdDependancies_OnClick()
Dim Arr
Dim I
Dim S
if txtPUID.Value = "" or Not IsNumeric(txtPUID.value) then
MsgBox "Please enter a PUID first"
Exit Sub
end if
Arr = WUV3IS.GetDependencyList(CInt(txtPUID.value))
S = ""
For I = 0 To UBound(Arr)
S = S & CStr(Arr(I))
S = S & vbCrlf
Next
MsgBox S
End Sub
function GetCatalogHTML(Title, Puid, Platform)
Dim html
Dim i
Dim j
Dim Arr
Dim sCol
Dim Filter
Filter = &H800 'show personalized hidden items as well
Arr = WUV3IS.GetCatalog(Puid, Server, Platform, Locale, Filter, 0)
html = "<H1>" & Title & "</H1><P> <TABLE BORDER=1>"
For i = 0 To UBound(Arr)
if Puid = 0 then
CatPuid = Arr(0, 0)
end if
html = html & "<TR>"
For j = 0 to ubound(Arr, 2)
if j = 2 then 'description
sCol = Left(Arr(i, j), 60) & " ..."
elseif j = 3 then 'ItemStatus
sCol = ItemStatusString(CLng(Arr(i, j)))
else
sCol = Arr(i, j)
end if
html = html & "<TD>" & sCol & "</TD>"
Next
html = html & "</TR>"
Next
html = html & "</TABLE><P>"
GetCatalogHTML = html
End Function
function GetItemHTML(Title, Puid)
Dim html
Dim j
Dim Arr
Dim sCol
Arr = WUV3IS.GetCatalogItem(Puid)
html = "<H1>" & Title & "</H1><P> <TABLE BORDER=1>"
html = html & "<TR>"
For j = 0 to ubound(Arr)
if j = 2 then 'description
sCol = Left(Arr(j), 60) & " ..."
elseif j = 3 then 'ItemStatus
sCol = ItemStatusString(CLng(Arr(j)))
else
sCol = Arr(j)
end if
html = html & "<TD>" & sCol & "</TD>"
Next
html = html & "</TR>"
html = html & "</TABLE><P>"
GetItemHTML = html
End Function
Function ItemStatusString(lStatus)
Dim S
S = CStr(lStatus)
AddFlag S, lStatus, "HIDDEN" , &H00000001 'Catalog item hidden.
AddFlag S, lStatus, "SELECTED" , &H00000002 'Catalog item selected for installation.
AddFlag S, lStatus, "NEW" , &H00000004 'Catalog item is a new offering.
AddFlag S, lStatus, "POWER" , &H00000008 'Catalog item is best for power users.
AddFlag S, lStatus, "REGISTRATION" , &H00000010 'Catalog item requires that the client be registered.
AddFlag S, lStatus, "COOL" , &H00000020 'Catalog item is considered an interesting item.
AddFlag S, lStatus, "PATCH" , &H00000040 'Catalog item is a patch so requires special handling.
AddFlag S, lStatus, "SECTION" , &H00000080 'Catalog item is a section header.
AddFlag S, lStatus, "SUBSECTION" , &H00000100 'Catalog item is a sub section header.
AddFlag S, lStatus, "SUBSUBSECTION" , &H00000200 'Catalog item is a sub sub section header.
AddFlag S, lStatus, "CRITICALUPDATE", &H00004000 'Catalog item is marked as a critical update item.
AddFlag S, lStatus, "EXCLUSIVE" , &H00008000 'Catalog item is exclusive it cannot be selected with other components.
AddFlag S, lStatus, "INSTALL" , &H00000400
AddFlag S, lStatus, "UPDATE" , &H00000800
AddFlag S, lStatus, "CURRENT" , &H00001000
AddFlag S, lStatus, "UNKNOWN" , &H00002000
AddFlag S, lStatus, "PERSON-HIDE" , &H00010000
ItemStatusString = S
End Function
Sub AddFlag(ioStr, lValue, sFlagText, lFlag)
if (lValue AND lFlag) <> 0 then
if ioStr <> "" then
ioStr = ioStr & "<BR>"
End If
ioStr = ioStr & sFlagText
End If
End Sub
</SCRIPT>
</BODY>
</HTML>