<%

'*****************************************************************************
' Microsoft Content Management Server
'
' File: SDReportImportDeletedObjects.INC
'
' Purpose:
'   ASP server-side include file that generates information about those 
'	objects that will be/have been deleted as a result of an import operation.
'   This file is included by the main report file.
'
' GLOBAL DEPENDENCIES:
'	pReportXMLTag [in] - the root XML tag of the report XML.
'
'*****************************************************************************


	'*************************************************************************
	' Description:
	'	This function takes a deleted object XML tag pointer as an argument
	'	and dumps out the object to the output stream.
	'
	' Returns:
	'	None
	'	
	'*************************************************************************
	sub dumpDeletedObject( pDeletedObject )
	
		' Note that ObjectType is type name string
		Response.Write( "<TR> " & _
						"<TD WIDTH=""30%""> " & _
						getObjectTypeImageTag( pDeletedObject.ObjectType, 1 ) & " " & _
						pDeletedObject.ObjectType & _
						"</TD> " & _
						"<TD> " )
			Response.Write Server.HTMLEncode(pDeletedObject.Location) 
			Response.Write( _
						"</TD> " & _
						"</TR>" )
						
						'pDeletedObject.Location & "/" &_
						'pDeletedObject.ObjectName & _
						
		' double-check that we got back an array. If it is not an array
		' there is only one deleted object in the XML
		dim pDeletedObjects
		
		if pDeletedObject.Count > 0 then
			
			if pDeletedObject.Count > 1 then
				pDeletedObjects = pDeletedObject.DeletedObject
			else
				set pDeletedObjects = pDeletedObject.DeletedObject
			end if
			
			if IsArray(pDeletedObjects) then
				dim pDeletedObjectChild
				for each pDeletedObjectChild in pDeletedObjects
					call dumpDeletedObject( pDeletedObjectChild )
				next			
			else
				call dumpDeletedObject( pDeletedObjects )	
			end if
		
		end if
						
	end sub  'dumpDeletedObject
	
	
	'*************************************************************************
	' Description:
	'	This function iterates over the XML-based deleted object collection,
	'	dumping out a row in a table for each object that it comes across
	'	in the XML. The result is a nicely formatted list of objects that
	'	will be/were deleted as a result of an import operation.
	'
	' Returns:
	'	None
	'	
	'*************************************************************************
	sub dumpDeletedObjectsCollection
	
		dim collectionEmpty
		collectionEmpty = True
		

		' grab the collection of deleted objects from the XML (if there are
		' any
	
		Dim pXmlTag
		'start with channels and postings
		if pReportXMLTag.DeletedObjects.ChannelsAndPostings.Count > 0 then
			if pReportXMLTag.DeletedObjects.ChannelsAndPostings.Count > 1 then
				pXmlTag = pReportXMLTag.DeletedObjects.ChannelsAndPostings.DeletedObject
			else
				set pXmlTag = pReportXMLTag.DeletedObjects.ChannelsAndPostings.DeletedObject
			end if
			dumpDeletedObjectsCollectionByType pXmlTag
			
			collectionEmpty	= False
		end if
		
		if pReportXMLTag.DeletedObjects.TemplatesAndGalleries.Count > 0 then
			if pReportXMLTag.DeletedObjects.TemplatesAndGalleries.Count > 1 then
				pXmlTag = pReportXMLTag.DeletedObjects.TemplatesAndGalleries.DeletedObject
			else
				set pXmlTag = pReportXMLTag.DeletedObjects.TemplatesAndGalleries.DeletedObject
			end if
			dumpDeletedObjectsCollectionByType pXmlTag
			
			collectionEmpty	= False
		end if
					
		if pReportXMLTag.DeletedObjects.ResourcesAndGalleries.Count > 0 then
			if pReportXMLTag.DeletedObjects.ResourcesAndGalleries.Count > 1 then
				pXmlTag = pReportXMLTag.DeletedObjects.ResourcesAndGalleries.DeletedObject
			else
				set pXmlTag = pReportXMLTag.DeletedObjects.ResourcesAndGalleries.DeletedObject
			end if
			dumpDeletedObjectsCollectionByType pXmlTag
		
			collectionEmpty	= False
		end if
												
		if collectionEmpty = True then
			call Response.Write( "<TR> <TD> None </TD> </TR>" )
		end if  
	
	end sub  'dumpDeletedObjectsCollection


	'*************************************************************************
	' Description:
	'	This function iterates over the XML-based deleted object collection
	'	for a particular type 
	'
	' Returns:
	'	None
	'	
	'*************************************************************************
	sub dumpDeletedObjectsCollectionByType (pDeletedObjects)

		'dim pDeletedObjects

		'if pDeletedObjectCollection.Count > 1 then
		'	' more than one Deleted Objects, get the first tag as an array
		'	pDeletedObjects = pDeletedObjectCollection.DeletedObject
		'else
		'	' only one Deleted object, get the tag as an object
		'	set pDeletedObjects = pDeletedObjectCollection.DeletedObject
		'end if
	
		' double-check that we got back an array. If it is not an array
		' there is only one deleted object in the XML
		if IsArray( pDeletedObjects ) then
	
			' loop over all the deleted objects in the collection, dumping
			' them out as we go
			dim pDeletedObject
			for each pDeletedObject in pDeletedObjects
				call dumpDeletedObject( pDeletedObject )
				
			next
			
		else
			call dumpDeletedObject( pDeletedObjects )
			
		end if  'if deleted object tag is an array
	end sub


%>


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

	<P>

	<TABLE border="0" cellPadding="1" cellSpacing="1" width="75%">

	<% call dumpDeletedObjectsCollection %>  
	  
	</TABLE>

	</P>
    
</BLOCKQUOTE>
