windows-nt/Source/XPSP1/NT/admin/snapin/dsadmin/prophtml/memberof.htm
2020-09-26 16:20:57 +08:00

179 lines
4.5 KiB
HTML

<!--
'------------------------------------------------------------------------------
'
' Directory Service Administration Property Pages
'
' Microsoft Windows
' Copyright (C) Microsoft Corporation, 1992 - 1997.
'
' File: memberof.htm
'
' Contents: MemberOf property page.
'
' History: 2-26-97 ericb created.
'
'------------------------------------------------------------------------------
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=ANSI_X3.4-1968">
</HEAD>
<BODY bgcolor=silver onload="DoOnLoad()">
<OBJECT ID=ActiveDir CLASSID="Clsid:0998BB05-DFFD-11CF-927F-00AA00688A38">
</OBJECT>
<SCRIPT language=vbscript>
dim DsObj
'------------------------------------------------------------------------------
'
' Subroutine: DoOnLoad
'
' Synopsis: Bind to the DS object and set the initial control values.
'
'------------------------------------------------------------------------------
sub DoOnLoad
on error resume next
'
' Extract the object path from the URL params. This assumes that
' path= immediatly follows the ?
'
strUrl = document.URL
URLlen = len(strUrl)
i = InStr(strUrl, "?")
i = InStr(i, strUrl, "=")
EncodedPath = right(strUrl, URLlen - i)
err.clear
path = ActiveDir.DecodeURL((EncodedPath))
if err.number <> 0 then
alert("ActiveDir.DecodeURL failed with error " & hex(err.number) &_
" " & err.description)
exit sub
end if
'
' Activate the object.
'
set DsObj = ActiveDir.DSGetObject((path))
if err.number <> 0 then
alert("ActiveDir.DSGetObject failed with error " & hex(err.number) &_
" " & err.description)
exit sub
end if
'
' Get the object attribute, MemberOf, for this page.
'
MemberList = DsObj.Get("memberOf")
if err.number <> 0 then
alert("Get memberOf failed with error " & hex(err.number) & " " &_
err.desctiption)
err.clear
end if
MemberHTML = "<SELECT size=5 readonly>"
if not IsEmpty(MemberList) then
Const vbString = 8
if VarType(MemberList) = vbString then
MemberHTML = MemberHTML & "<option>" & TrimPath(MemberList) & "</option>"
else
for each i in MemberList
MemberHTML = MemberHTML & "<option>" & TrimPath(i) & "</option>"
next
end if
end if
MemberHTML = MemberHTML & "</SELECT>"
set Element = document.all.item("members", 0)
if err.number <> 0 then
alert("item(members) failed with error " & hex(err.number) & " " &_
err.desctiption)
err.clear
end if
set MemberRange = document.rangeFromElement(Element)
MemberRange.pasteHTML(MemberHTML)
end sub
'------------------------------------------------------------------------------
'
' Function: TrimPath
'
' Synopsis: Remove the leading X500: and trailing ,DC=domain parts.
'
'------------------------------------------------------------------------------
function TrimPath(FullPath)
colon = InStr(FullPath, ":")
if colon = 0 then
p1 = FullPath
else
p1 = Right(FullPath, len(FullPath) - colon)
end if
' BUGBUG: instr(p1, "DC", 1) is not working!
dc = instr(p1, "DC")
if dc <> 0 then
TrimPath = left(p1, dc - 2)
else
TrimPath = p1
end if
end function
'------------------------------------------------------------------------------
'
' Subroutine: DoApply
'
' Synopsis: Set the DS object to the new control values.
'
'------------------------------------------------------------------------------
sub DoApply
on error resume next
'DsObj.Put "description", document.forms(0).description.value
'if err.number <> 0 then
' alert("Put description failed with error " & hex(err.number) & " " &_
' err.desctiption)
' err.clear
'end if
'DsObj.SetInfo
'if err.number <> 0 then
' alert("SetInfo failed with error " & hex(err.number) & " " &_
' err.desctiption)
'end if
end sub
</SCRIPT>
<font face=Arial size=2>
<div style="position:absolute; top:0.4em; left:0.3em; height:8em; width:29em;">
<div style="position:absolute; top:0.3em; left:0em;">Member Of:</div>
<div style="position:absolute; top:0.2em; left:9em; height:6em; width:15em;" id=members></div>
</div>
</font>
<div style="position:absolute; top:16.5em; left:0.3em; height:2em; width:29em;">
</div>
<div style="position:absolute; top:19.5em; left:0.3em; height:2em; width:29em;">
</div>
</BODY>
</HTML>