%@ LANGUAGE = VBScript %>
<% Option Explicit %>
<%
' Script to clone settings from one node to another.
' Assumes nodes are the same type.
' If a site is cloned, only the Site type properties will be cloned.
' The Root node should be cloned separately, for maximum flexibility in the script.
' Parameters:
' sFromNode - ADSpath of the node to clone settings from
' sToNode - ADSpath of the node to clone settings to
' aProperties - A string array containing property names indicating settings to clone
'
' Notes: some properties will not work generically, and must be special cased.
' currently, this works for single valued properties only.
Dim SpecProps
SpecProps = "GRANTBYDEFAULT"
Dim sFromNode, sToNode
Dim oFromNode, oToNode
Dim aProperties
Dim props, sProp
Dim bWroteData
sFromNode = Request("sFromNode")
sToNode = Request("sToNode")
'#IFDEF _DEBUG
Response.write Request.Querystring()& "
"
Response.write "From Node:" & sFromNode & "
"
Response.write "To Node:" & sToNode & "
"
'#ENDDEF _DEBUG
props = Request("prop")
aProperties = split(props,",")
Set oFromNode=GetObject(sFromNode)
Set oToNode=GetObject(sToNode)
'#IFDEF _DEBUG
Response.write oToNode.ADsPath & "
"
Response.write oFromNode.ADsPath & "
"
For each sProp in aProperties
sProp = trim(sProp)
Response.write sProp & "
"
Response.write "To Node Start Val" &oToNode.Get(sProp) & "
"
Response.write "From Node Start Val" & oFromNode.Get(sProp) & "
"
Next
Response.write "
"
'#ENDDEF _DEBUG
For each sProp in aProperties
sProp = trim(sProp)
bWroteData = writeProp(oToNode, sProp, oFromNode.Get(sProp))
'#IFDEF _DEBUG
if not bWroteData then
Response.write sProp & "
"
Response.write "Old To Node" &oToNode.Get(sProp) & "
"
Response.write "Old From Node" & oFromNode.Get(sProp) & "
"
end if
Response.write "
"
'#ENDDEF _DEBUG
Next
'#IFDEF _DEBUG
Response.write "Error:" & err & "
"
'#ENDDEF_DEBUG
oToNode.SetInfo
'#IFDEF _DEBUG
Response.write "Error:" & err & "
"
For each sProp in aProperties
sProp = trim(sProp)
Response.write sProp & "
"
Response.write "To Node" &oToNode.Get(sProp) & "
"
Response.write "From Node" & oFromNode.Get(sProp) & "
"
Next
Response.write "
" '#ENDDEF _DEBUG ' this is basically the same function (writeStdProp) ' that lives in iiput.asp, however ' we ALWAYS write the value if we are setting with templates, ' even if it is inheriting the same values... Function writeProp(thisobj, key, newval) On Error Resume Next dim curval,value curval=thisobj.Get(key) if typename(newval) <> typename(curval) then Select Case typename(curval) Case "Boolean" value = (UCase(newval) = "TRUE") Case "Long" value = cLng(newval) Case Else value = newval End Select else value = newval end if thisobj.Put key, (value) writeProp = True '#IFDEF _DEBUG if err <> 0 then Response.write err end if '#ENDDEF _DEBUG End Function %>