windows-nt/Source/XPSP1/NT/admin/snapin/dsadmin/prophtml/grpgen.htm

313 lines
8.8 KiB
HTML
Raw Normal View History

2020-09-26 03:20:57 -05:00
<!--
'------------------------------------------------------------------------------
'
' Directory Service Administration Property Pages
'
' Microsoft Windows
' Copyright (C) Microsoft Corporation, 1992 - 1997.
'
' File: grpgen.htm
'
' Contents: Group General 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">
<style>
<!--
body, input {font-size: 9pt; font-family: "MS Sans Serif, sans-serif"}
-->
</style>
</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 attributes for this page.
'
set AllColl = document.all
'
' Common Name - read only
'
ObjName = DsObj.Get("name")
if (err.number <> 0) and (err.number <> &h8000500D) then
alert("Get fullname failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
set Element = AllColl.item("commonname", 0)
if err.number <> 0 then
alert("item(commonname) failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
set NameRange = document.rangeFromElement(Element)
NameRange.pasteHTML(ObjName)
set Element = nothing
'
' Member List - read only drop-down list
'
MemberList = DsObj.Get("member")
if (err.number <> 0) and (err.number <> &h8000500D) then
alert("Get fullname failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
set Element = AllColl.item("memberslist", 0)
if err.number <> 0 then
alert("item(members) failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
MemberHTML = "<SELECT size=5 id=memberslist>"
if not IsEmpty(MemberList) then
Const vbString = 8
if VarType(MemberList) = vbString then
MemberHTML = MemberHTML & "<option>" & TrimPath(MemberList) & "</option>"
'document.forms(0).member_list.options(0).value = TrimPath(MemberList)
else
n = 0
for each i in MemberList
MemberHTML = MemberHTML & "<option>" & TrimPath(i) & "</option>"
'document.forms(0).member_list.options(n).value = TrimPath(i)
n = n + 1
next
end if
end if
MemberHTML = MemberHTML & "</SELECT>"
set MemberRange = document.rangeFromElement(Element)
MemberRange.pasteHTML(MemberHTML)
set Element = nothing
'
' Description - text input control
'
document.forms(0).description.value = DsObj.Get("adminDescription")
if err.number <> 0 then
alert("Get description failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
'
' SAM Account Name - read only
'
SamAcctName = DsObj.Get("sAMAccountName")
if (err.number <> 0) and (err.number <> &h8000500D) then
alert("Get sAMAccountName failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
set Element = AllColl.item("samacct", 0)
if err.number <> 0 then
alert("item(samacct) failed with error " & hex(err.number) & " " &_
err.description)
err.clear
end if
set NameRange = document.rangeFromElement(Element)
NameRange.pasteHTML(SamAcctName)
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.description)
err.clear
end if
DsObj.SetInfo
if err.number <> 0 then
errstr = "SetInfo failed with error " & hex(err.number) & " " &_
err.description
if err.number = &h800704B8 then
errstr = errstr & ". Extended error: " & ActiveDir.DSGetLastError
end if
alert(errstr)
err.clear
end if
end sub
</SCRIPT>
<div style="position:absolute; top:0.4em; left:0.3em; height:2em; width:29em;">
<div style="position:absolute; top:0.3em; left:0em;">Common Name:</div>
<div style="position:absolute; top:0.4em; left:9em; height:1.4em; width:15em;" id=commonname></div>
</div>
<div style="position:absolute; top:2.7em; left:0.3em; height:2em; width:29em;">
<div style="position:absolute; top:0.3em; left:0em;">SAM Name:</div>
<div style="position:absolute; top:0.4em; left:9em; height:1.4em; width:15em;" id=samacct></div>
</div>
<form>
<div style="position:absolute; top:5em; left:0.3em; height:2em; width:29em;">
<div style="position:absolute; top:0.3em; left:0em;">Description:</div>
<INPUT TYPE=text class=PageInput value="" style="position:absolute; top:0.2em; left:8em; height:1.6em; width:15em;" name=description>
</div>
<div style="position:absolute; top:7.3em; left:0.3em; height:10em; width:29em;">
<div style="position:absolute; top:0.3em; left:0em;">Members:</div>
<div style="position:absolute; top:0.3em; left:9em; height:5.3em; width:15em;">
<select size=5 id=memberslist name="member_list"></select></div>
<input type=button value="Add Members..." name=AddMember style="position:absolute; top:6.5em; left:1em; height:2em; width:11em;">
<input type=button value="Remove Member" name=RmMember style="position:absolute; top:6.5em; left:13em; height:2em; width:11em;" disabled>
</div>
</form>
<div style="position:absolute; top:17.5em; left:0.3em; height:2em; width:29em;">
</div>
<div style="position:absolute; top:20.5em; left:0.3em; height:2em; width:29em;">
</div>
<SCRIPT for=memberslist event="onclick()" language=vbscript>
'------------------------------------------------------------------------------
'
' Subroutine: memberslist_OnChange
'
' Synopsis:
'
'------------------------------------------------------------------------------
'sub memberslist_OnClick
alert "members_OnChange."
document.forms(0).RmMember.disabled = 0
'end sub
</script>
<SCRIPT language=vbscript>
'------------------------------------------------------------------------------
'
' Subroutine: AddMember_OnClick
'
' Synopsis:
'
'------------------------------------------------------------------------------
sub AddMember_OnClick
alert "Someday this will post a dialog allowing a new member to be selected."
end sub
'------------------------------------------------------------------------------
'
' Subroutine: RmMember_OnClick
'
' Synopsis:
'
'------------------------------------------------------------------------------
sub RmMember_OnClick
alert "Someday this will remove the selected item from this group."
end sub
</script>
</BODY>
</HTML>