<%

'*****************************************************************************
' Microsoft Content Management Server
'
' File: SDReportImportOptions.INC
'
' Purpose:
'   ASP server-side include file that generates the import options information 
'   section of an import report. This file is included by the main report file.
'
' GLOBAL DEPENDENCIES:
'	pReportXMLTag [in] - the root XML tag of the report XML.
'
'*****************************************************************************


	'*************************************************************************
	' Description:
	'	Gets default channel for channel and posting import objects as set 
	'	in the options.
	'
	' Returns:
	'	Default container string
	'*************************************************************************
	function getDefaultChannel
	
		getDefaultChannel = pReportXMLTag.ImportOptions.DefaultContainers.Channel.Location & _
				    pReportXMLTag.ImportOptions.DefaultContainers.Channel.ObjectName
			
	end function


	'*************************************************************************
	' Description:
	'	Gets default folder for folder and page import objects as set 
	'	in the options.
	'
	' Returns:
	'	Default container string
	'*************************************************************************
	function getDefaultFolder
	
		
		getDefaultFolder = pReportXMLTag.ImportOptions.DefaultContainers.Folder.Location & _
				   pReportXMLTag.ImportOptions.DefaultContainers.Folder.ObjectName
	
	end function


	'*************************************************************************
	' Description:
	'	Gets default template gallery for template gallery and template import 
	'	objects as set in the options.
	'
	' Returns:
	'	Default container string
	'*************************************************************************
	function getDefaultTemplateGallery
	
		getDefaultTemplateGallery = pReportXMLTag.ImportOptions.DefaultContainers.TemplateGallery.Location & _
				            pReportXMLTag.ImportOptions.DefaultContainers.TemplateGallery.ObjectName
	
	end function


	'*************************************************************************
	' Description:
	'	Gets default resource gallery for resource gallery and resource 
	'	gallery item import objects as set in the options.
	'
	' Returns:
	'	Default container string
	'*************************************************************************
	function getDefaultResourceGallery
	
		getDefaultResourceGallery = pReportXMLTag.ImportOptions.DefaultContainers.ResourceGallery.Location & _
				            pReportXMLTag.ImportOptions.DefaultContainers.ResourceGallery.ObjectName
	
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the import of user
	'	rights groups. This method will examine the various low-level values
	'	in the XML and convert them to human-readable strings for the report.
	'
	' Returns:
	'	String indicating selected option for importing user rights groups
	'*************************************************************************
	function getUserRightsGroupOption
	
		dim bImportUserRightsGroups
		bImportUserRightsGroups = CBool( pReportXMLTag.ImportOptions.Security.RightsGroups.Import )
		
		dim bImportUsers
		bImportUsers = CBool( pReportXMLTag.ImportOptions.Security.RightsGroups.Users )
		
		dim strOption
		' default to do not import, overwrite otherwise
		strOption = "Do not import any User Rights Groups"
		
		if bImportUserRightsGroups then
			strOption = "Import User Rights Groups"
		end if
		
		if bImportUsers then
			strOption = strOption & " <I>and</I> Users"
		end if
	
		getUserRightsGroupOption = strOption
		
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the import of users. 
	'	This method will examine the various low-level values the XML and 
	'   convert them to human-readable strings for the report.
	'
	' Returns:
	'	String indicating selected option for importing users
	'*************************************************************************
	function getUserOption
	
		dim strUserOption
		strUserOption = pReportXMLTag.ImportOptions.Security.RightsGroups.Specifier
		
		if strUserOption = "None" then
			strUserOption = "N/A"

		elseif strUserOption = "WithoutUsers" then
			strUserOption = "Do not import users"
			
		elseif strUserOption = "ROPUsers" then
			strUserOption = "Use only the package user lists"
		
		elseif strUserOption = "CombineUsers" then
			strUserOption = "Use package and destination user lists, combining them for replaced Rights Groups"

		elseif strUserOption = "CombineUsers" then
			strUserOption = "Use package and destination user lists, combining them for replaced Rights Groups"
					
		else
			call Err.Raise( nERROR_INVALID_USER_OPTION, "ImportReportOptions", strERROR_INVALID_USER_OPTION )
			
		end if

		getuserOption = strUserOption
		
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the ownership of
	'	imported objects. This method will examine the various low-level values
	'	in the XML and convert them to human-readable strings for the report.
	'
	' Returns:
	'	String indicating selected owner for imported objects
	'*************************************************************************
	function getOwnerOption

		dim strOwnerOption
		
		strOwnerOption = pReportXMLTag.ImportOptions.Security.Ownership.Specifier
		
		if strOwnerOption = "UsePackage" then
			strOwnerOption = "Use owner in package"
		
		elseif strOwnerOption = "CurrentUser" then
			strOwnerOption = "Make current user owner"
		
		elseif strOwnerOption = "Everybody" then
			strOwnerOption = """Everybody""" 
		
		elseif strOwnerOption = "Custom" then
			strOwnerOption = pReportXMLTag.ImportOptions.Security.Ownership.Value
		
		else
			call Err.Raise( nERROR_INVALID_OWNERSHIP_OPTION, "ImportReportOptions", strERROR_INVALID_OWNERSHIP_OPTION )
			
		end if	
		
		getOwnerOption = strOwnerOption
		
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the ownership of
	'	REPLACED imported objects. This method will examine the various low-
	'	level values in the XML and convert them to human-readable strings for 
	'	the report.
	'
	' Returns:
	'	String indicating owner option
	'*************************************************************************
	function getOwnerReplaceOption

		dim strOwnerReplaceOption
		strOwnerReplaceOption = pReportXMLTag.ImportOptions.Security.Ownership.SpecifierOnReplace
		
		if strOwnerReplaceOption = "KeepExisting" then
			strOwnerReplaceOption = "Yes"
		
		elseif strOwnerReplaceOption = "None" or strOwnerReplaceOption = "" then
			strOwnerReplaceOption = "No"
		
		else
			call Err.Raise( nERROR_INVALID_OWNER_REPLACE_OPTION, "ImportReportOptions", strERROR_INVALID_OWNER_REPLACE_OPTION )
		
		end if
		
		getOwnerReplaceOption = strOwnerReplaceOption
		
	end function

	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the CreatedBy attribute of
	'	imported objects. This method will examine the various low-level values
	'	in the XML and convert them to human-readable strings for the report.
	'
	' Returns:
	'	String indicating selected owner for imported objects
	'*************************************************************************
	function getCreatedByOption
		
		dim strCreatedByOption
		
		strCreatedByOption = pReportXMLTag.ImportOptions.Security.CreatedBy.Specifier
		
		if strCreatedByOption = "UsePackage" then
			strCreatedByOption = "Use Created By in package"
		else
			strCreatedByOption = "Set to current user"
		end if				
	
		getCreatedByOption = strCreatedByOption
		
	end function
	


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the adding of 
	'	containers and what to do with their rights. This method will examine
	'	the various low-level values in the XML and convert them to 
	'	human-readable strings for the report.
	'
	' Returns:
	'	String indicating container option
	'*************************************************************************
	function getContainerAddOption

		dim strContainerAddOption
		strContainerAddOption = pReportXMLTag.ImportOptions.Security.Rights.SpecifierOnAdd
		
		if strContainerAddOption = "InheritRights" then
			strContainerAddOption = "Inherit destination parent rights"
		
		elseif strContainerAddOption = "ROPRights" then
			strContainerAddOption = "Use package container rights"
		
		elseif strContainerAddOption = "NoRights" then
			strContainerAddOption = "Leave container rights list empty"
		
		else
			call Err.Raise( nERROR_INVALID_CONTAINER_ADD_OPTION, "ImportReportOptions", strERROR_INVALID_CONTAINER_ADD_OPTION )
		
		end if
		
		getContainerAddOption = strContainerAddOption
		
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the replacing of 
	'	containers and what to do with their rights. This method will examine
	'	the various low-level values in the XML and convert them to 
	'	human-readable strings for the report.
	'
	' Returns:
	'	String indicating container option
	'*************************************************************************
	function getContainerReplaceOption

		dim strContainerReplaceOption
		strContainerReplaceOption = pReportXMLTag.ImportOptions.Security.Rights.SpecifierOnReplace
		
		if strContainerReplaceOption = "InheritRights" then
			strContainerReplaceOption = "Inherit destination parent rights"
		
		elseif strContainerReplaceOption = "ROPRights" then
			strContainerReplaceOption = "Replace with package container rights"
		
		elseif strContainerReplaceOption = "ExistingRights" then
			strContainerReplaceOption = "Keep destination container rights"
		
		elseif strContainerReplaceOption = "CombineRights" then
			strContainerReplaceOption = "Combine package and destination rights"
		
		elseif strContainerReplaceOption = "NoRights" then
			strContainerReplaceOption = "Leave container rights list empty"
		
		else
			call Err.Raise( nERROR_INVALID_CONTAINER_ADD_OPTION, "ImportReportOptions", strERROR_INVALID_CONTAINER_ADD_OPTION )
		
		end if
		
		getContainerReplaceOption = strContainerReplaceOption
		
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the the destructive
	'	syncrhonization of objects on the destination that are not present in
	'	the package. This method will examine the various low-level values in 
	'	the XML and convert them to human-readable strings for the report.
	'
	' Returns:
	'	String indicating destructive sync option
	'*************************************************************************
	function getDestructiveSyncOption

		dim bDestructiveSyncOption
		bDestructiveSyncOption = CBool( pReportXMLTag.ImportOptions.Synchronization.Destructive )
		
		dim strDestructiveSyncOption
		if bDestructiveSyncOption then
			strDestructiveSyncOption = "Yes"
			
		else
			strDestructiveSyncOption = "No"
			
		end if
		
		getDestructiveSyncOption = strDestructiveSyncOption
			
	end function


	'*************************************************************************
	' Description:
	'	Examines the option in the report XML concerning the the hierarchy
	'	fixup of containers on the destination that are not present in
	'	the same location in the package. This method will examine the various 
	'	low-level values in the XML and convert them to human-readable strings 
	'	for the report.
	'
	' Returns:
	'	String indicating hierarchy fixup option
	'*************************************************************************
	function getHierarchyFixupOption

		dim bHierarchyFixupOption
		bHierarchyFixupOption = CBool( pReportXMLTag.ImportOptions.Synchronization.Fixup )
		
		dim strHierarchyFixupOption
		if bHierarchyFixupOption then
			strHierarchyFixupOption = "Yes"
			
		else
			strHierarchyFixupOption = "No"
			
		end if
		
		getHierarchyFixupOption = strHierarchyFixupOption
			
	end function

%>
     
<H4 Class="Heading4">Containers</H4>

<BLOCKQUOTE style="MARGIN-RIGHT: 0px">

  <P>
  
  <TABLE CLASS="OptionsTable" >
    
    <TR>
      <TD CLASS="OptionsTableData" >When Adding Containers:</TD>
      <TD> <%= getContainerAddOption %> </TD>
    </TR>
    
    <TR>
      <TD>When Replacing Containers:</TD>
      <TD> <%= getContainerReplaceOption %> </TD>
    </TR>
    
    <TR>
      <TD>Change container hierarchy on destination to match the package hierarchy:</TD>
      <TD> <%= getHierarchyFixupOption %> </TD>
    </TR>
    
    <TR>
      <TD>Delete all existing container contents when 
        replacing a container:</TD>
      <TD> <%= getDestructiveSyncOption %> </TD>
    </TR>    
    
  </TABLE>
  
  </P>
  
</BLOCKQUOTE>
        
<H4 Class="Heading4">Rights Groups</H4>

<BLOCKQUOTE style="MARGIN-RIGHT: 0px">

	<P>
	
	<TABLE CLASS="OptionsTable">
	  
	  <TR>
	    <TD CLASS="OptionsTableData" >Select how Rights Groups are imported:</TD>
	    <TD> <%= getUserRightsGroupOption %></TD>
	  </TR>
	  
	  <TR VALIGN="TOP">
	    <TD>When how Users are imported:</TD>
	    <TD> <%= getUserOption %> </TD>
	  </TR>
	
	  <TR>
	    <TD>Set Created By on imported objects to:</TD>
	    <TD> <%= getCreatedByOption %> </TD>
	  </TR>
  
	</TABLE>
	
	</P>
  
</BLOCKQUOTE>
 
<H4 Class="Heading4"> Orphaned Objects - destination containers</H4>

<BLOCKQUOTE style="MARGIN-RIGHT: 0px">

<P>
    <TABLE CLASS="OptionsTable" >
	      
      <TR>
        <TD CLASS="OptionsTableData" >Channel:</TD>
        <TD> <%= getDefaultChannel %> </TD>
      </TR>

      <TR>
        <TD>Template Gallery:</TD>
        <TD> <%= getDefaultTemplateGallery %> </TD>
      </TR>
	      
      <TR>
        <TD>Resource Gallery:</TD>
        <TD> <%= getDefaultResourceGallery %> </TD>
      </TR>
	      
    </TABLE>
	    
</P>
	        
</BLOCKQUOTE>