<!--#include virtual="/NR/System/WBC/Internals/Main/WBCApp.inc"-->
<!-- #include virtual="/NR/System/WBC/Customizable/WBCFuncPagesConfig/MLSDisplayConfig/ResourceBrowserConfig.inc" -->
<!--#include virtual="/NR/System/WBC/Customizable/WBCFuncPagesConfig/UIStringConstants/ResMgntUIStrings.inc" -->
<!--#include virtual="/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/ResourceBrowser/Management/InternalProgrammingConstants.inc" -->

<!--#include virtual="/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/ResourceBrowser/Management/ResourceFileIO.inc" -->

<%
' ********************************************************************
' Copyright (C) 2001 Microsoft Corporation. All rights reserved.
'
'	IMPORTANT.  Please read the legal.txt file, located in the
'	"<CMS Install Directory>\Server\httpexec\WBC\Internals"
'	directory, governing the use of this internal file."
' ********************************************************************

' ********************************************************************
' File:		/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/ResourceBrowser/
'			Management/ResourceDelete/CNCASPPageManager_ResourceDelete.inc
' Version: 	Microsoft Content Management Server
' Author:	Microsoft Corporation.
' Purpose:	Encapsulate the ASP logic associated with ResourceDelete.asp
'
' Implements the INCASPPageManager interface:
'	- Sub InitManager()
'	- Property Error
'
' Exposes the following methods/properties:
'	- Sub DeleteResourceSafe()
'	- Property CodePage
'	- Property Charset
'	- Property URLBack2ResourcesLink
'	- Property URLBack2GalleriesLink
'	- Property URLRefreshResourcesAfterDelete
'	- Property ResourceGallery
'	- Property FormReader
'	- Property ASPUtilsObject
' ********************************************************************

Class CNCASPPageManager_ResourceDelete

	' -- The Charset ASP page will be running under
	Public CodePage
	Public Charset

	' -- Some UI and links needed in the ASP page
	Public URLBack2ResourcesLink
	Public URLBack2GalleriesLink
	Public URLRefreshResourcesAfterDelete

	' -- objects needed in the ASP page
	Public ResourceGallery
	Public FormReader
	Public ASPUtilsObject
	Public Error

	Private m_strGalleryGUID

	' ---- [Private] Standard Class_Initialize
	Private Sub Class_Initialize()
		Set ResourceGallery = Nothing
		URLBack2ResourcesLink = "#"
		URLBack2GalleriesLink = "../GalleriesBrowse/GalleriesBrowse.asp"
		Error = ""
	End Sub

	' ---- [Public] InitManager will take care of all programming logic in the ASP page
	Public Sub InitManager()
		' -- set up Gallery context and its associated MLS info
		Call SetupBrowseContext()
		If (ResourceGallery Is Nothing) Then
			Error = IDS_ERR_GALLERY_NOT_FOUND
			Exit Sub
		End If
		Call SetupMLSInfo()

		' -- set up ASPUtil object with MLS info
		Call SetupASPUtilObjects()

		' -- Set up URL needed for links in the ASP page
		Call SetupLinksURL()
	End Sub

	' ---- [Public] Attempt to delete Resource and suppress any error
	Public Sub DeleteResourceSafe( pResource )
		On Error Resume Next
		Call pResource.Delete
	End Sub

	' ---- [Private] Sets up the browsing context (Gallery)
	Private Sub SetupBrowseContext()
		m_strGalleryGUID = GetGuidFromQueryString(IDS_QPARAM_GALLERY)
		Set ResourceGallery = AutoSession.Searches.GetByGUID( m_strGalleryGUID )
	End Sub

	' ---- [Private] Set up the MLS info this ASP page will be running under
	Private Sub SetupMLSInfo()
		Charset = GetCharacterSetForResource( ResourceGallery )
	End Sub

	' ---- [Private] Set up ASPUtil objects with MLS info
	Private Sub SetupASPUtilObjects()
		Set ASPUtilsObject = GetInitializedASPUtils()

		CodePage = GetCodePageForResource( ResourceGallery, ASPUtilsObject )
		Set FormReader = GetResMgntFormReaderSafe( False, CodePage )
		FormReader.CodePage = GetCodePageForResource( ResourceGallery, ASPUtilsObject )

	End Sub


	' ---- [Private] Set up URL needed for links in the ASP page
	Private Sub SetupLinksURL()
		' for all URLs we mix in a time stamp to guarantee uniqueness to get around
		' problems of client browser sometimes caching pages

		URLBack2ResourcesLink = "../ResourcesBrowse/ResourcesBrowse.asp?" & IDS_QPARAM_GALLERY & "=" & m_strGalleryGUID & _
													"&" & IDS_QPARAM_TIMESTAMP & "=" & CDbl(CDate(now))

		URLBack2GalleriesLink = "../GalleriesBrowse/GalleriesBrowse.asp?" & IDS_QPARAM_GALLERY & "=" & m_strGalleryGUID & _
													"&" & IDS_QPARAM_TIMESTAMP & "=" & CDbl(CDate(now))

		URLRefreshResourcesAfterDelete = "../ResourcesBrowse/ResourcesBrowse.asp?" & IDS_QPARAM_GALLERY & "=" & m_strGalleryGUID & _
															"&" & IDS_QPARAM_TIMESTAMP & "=" & CDbl(CDate(now)) & _
															"&" & IDS_QPARAM_PAGESTATUS & "=" & IDS_PAGESTATUS_AFTDELETE

	End Sub


End Class

%>