<!--#include virtual="/NR/System/WBC/Internals/Main/WBCApp.inc"-->

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

<!--#include virtual="/NR/System/WBC/Customizable/WBCFuncPagesConfig/UIStringConstants/AuthResourceUIStrings.inc" -->
<!--#include virtual="/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/ResourceBrowser/Authoring/AuthResourceConstants.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/
'			Authoring/AttachmentBrowser/CNCASPPageManager_AttachmentLocalProperties.inc
' Version: 	Microsoft Content Management Server
' Author:	Microsoft Corporation.
' Purpose:	Encapsulate the ASP logic associated with AttachmentLocalBrowse.asp
'
' Implements the INCASPPageManager interface:
'	- Sub InitManager()
'	- Property Error
'
' Exposes the following properties:
'	- Property PlaceholderParameters
'	- Property CurrentPosting
'	- Property URLSelectImage
'	- Property URLFormAction
'	- Property PlaceholderName
'	- Property PlaceholderType
'	- Property AttachIcon
'	- Property Error
' ********************************************************************

Class CNCASPPageManager_AttachmentLocalProperties

	' -- Object of the current Posting
	Public CurrentPosting

	' -- the links to go back select image
	Public URLSelectImage

	' -- the links to do the form submit
	Public URLFormAction

	' -- the error
	Public Error

	' -- Placeholder information
	Private m_strPlaceholderName
	Private m_strPlaceholderType
	Private m_bAllowDeskTopRes
	Private m_bAttachIcon
	Private m_bVideo
	Private m_strPlaceholderParameters

	' ---- [Private] Standard Class_Initialize
	Private Sub Class_Initialize()
		Set CurrentPosting = Nothing
		URLSelectImage = IDS_PATH_INSERT_ATTACHMENT_URL & IDS_PATH_ATTACHMENT_SELECT_URL
		Error = ""

		m_strPlaceholderName = ""
		m_strPlaceholderType = ""
		m_bAllowDeskTopRes = False
		m_bAttachIcon = False
		m_bVideo = False
		m_strPlaceholderParameters = ""
	End Sub

	' ---- [Public] InitManaer will take care of all programming logic in the ASP page
	Public Sub InitManager()
		' -- Set up information of the current placeholder
		Call SetupPlaceholderInfo()

		' -- Set up the current Posting object
		Call SetupCurrentPosting()

		' -- Set up all links URL
		Call SetupLinksURL()
	End Sub

	' ---- [Public] get the placeholder information parameter
	Public Property Get PlaceholderParameters()
		PlaceholderParameters = m_strPlacholderParameters
	End Property

	' ---- [Public] get the placeholder name
	Public Property Get PlaceholderName()
		PlaceholderName = m_strPlaceholderName
	End Property

	' ---- [Public] get the placeholder type
	Public Property Get PlaceholderType()
		PlaceholderType = m_strPlaceholderType
	End Property

	' ---- [Public] get the Attach icon value
	Public Property Get AttachIcon()
		AttachIcon = m_bAttachIcon
	End Property

	' ---- [Private] Retrieve Placeholder name from Querystring in a XSS safe fashion
	Private Function GetPlaceholderName()
		On Error Resume Next
		Dim pPlaceholder

		Set pPlaceholder = AutoSession.ThisPosting.Placeholders( CStr(Request.QueryString(IDS_QPARAM_PHNAME)) )
		If (pPlaceholder Is Nothing) Then
			GetPlaceholderName = ""
		Else
			GetPlaceholderName = CStr(Request.QueryString(IDS_QPARAM_PHNAME))
		End If
	End Function
	
	' ---- [Private] Set up information of the current placeholder
	Private Sub SetupPlaceholderInfo()
		m_strPlaceholderName = GetPlaceholderName()
		' restrict value of m_strPlaceholderType to guard against XSS attack
		Select Case Request.QueryString( IDS_QPARAM_PHTYPE )
			Case IDS_PHTYPE_MULTIPURPOSE
				m_strPlaceholderType = IDS_PHTYPE_MULTIPURPOSE
			Case IDS_PHTYPE_SINGLEATTACHMENT
				m_strPlaceholderType = IDS_PHTYPE_SINGLEATTACHMENT
			Case IDS_PHTYPE_THINEDITIE
				m_strPlaceholderType = IDS_PHTYPE_THINEDITIE
			Case Else
				m_strPlaceholderType = ""
		End Select
		m_bAllowDeskTopRes = CBool(Request.QueryString( IDS_QPARAM_DESKRES ))
		m_bAttachIcon = CBool(Request.QueryString( IDS_QPARAM_ATTACHICON ))
		m_bVideo = CBool(Request.QueryString( IDS_QPARAM_VIDEO ))

		m_strPlaceholderParameters = IDS_QPARAM_PHNAME & "=" & Server.URLEncode( m_strPlaceholderName ) & _
									"&" & IDS_QPARAM_PHTYPE & "=" & m_strPlaceholderType & _
									"&" & IDS_QPARAM_DESKRES & "=" & m_bAllowDeskTopRes & _
									"&" & IDS_QPARAM_ATTACHICON & "=" & m_bAttachIcon & _
									"&" & IDS_QPARAM_VIDEO & "=" & m_bVideo
	End Sub

	' ---- [Private] Sets up the current Posting object
	Private Sub SetupCurrentPosting()
		Set CurrentPosting = AutoSession.ThisPosting
	End Sub

	' ---- [Private] Set up URL needed for links in the ASP page
	Private Sub SetupLinksURL
		URLSelectImage = IDS_PATH_INSERT_ATTACHMENT_URL & IDS_PATH_ATTACHMENT_SELECT_URL & "?" & CurrentPosting.QueryString & _
							"&" & m_strPlaceholderParameters

		URLFormAction = IDS_PATH_AUTHORING_URL & IDS_PATH_UPLOAD_URL & "?" & CurrentPosting.QueryString & _
							"&" & IDS_QPARAM_PHNAME & "=" & Server.URLEncode( m_strPlaceholderName ) & _
							"&" & IDS_QPARAM_PHTYPE & "=" & m_strPlaceholderType & _
							"&" & IDS_QPARAM_RESTYPE & "=" & IDS_RESTYPE_ATTACHMENT & _
							"&" & IDS_QPARAM_ATTACHICON & "=" & m_bAttachIcon
	End Sub

End Class

%>