<!--#include virtual="/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/PageCreationWizard/EntryProgrammingConstants.inc"-->

<!-- #include virtual="/NR/System/WBC/Internals/Integration/InternalHooks/URLGenerationHooks/PostingCreationHooks.inc" -->
<!-- #include virtual="/NR/System/WBC/Customizable/Hooks/URLGenerationHooks/PostingCreationHooks.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."
' ********************************************************************


' -----------------------------------------------------------------------------
'
'	[Public] Determines whether the "Create Connected Page" link should be
'				visible or not
'
' -----------------------------------------------------------------------------
Function IsNewConnectedPostingLinkVisible()
	' init default value
	IsNewConnectedPostingLinkVisible = False

	Dim pCurrentObject
	Set pCurrentObject = GetCurrentObject()
	If pCurrentObject.IsPosting Then
		IsNewConnectedPostingLinkVisible = (AutoSession.IsModeUnpublished) And _
								(Not IsStagedOrCrawled) And _
								(pCurrentObject.CanSetProperties) And _
								(Request.QueryString(IDS_QPARAM_WBCPURPOSE) = IDS_WBCPURPOSE_BASIC)
	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL to the "Create Connected Page" link
'
' -----------------------------------------------------------------------------
Function GetCreateConnectedPostingDlgURL()
	GetCreateConnectedPostingDlgURL = "#"

	If IsNewConnectedPostingLinkVisible Then
		GetCreateConnectedPostingDlgURL = IDS_FRAMEWORK_VIRTUAL_PATH_ASPX & _
					IDS_PAGECREATIONWIZARD_PATH_ASPX & "/ChannelsBrowse/ChannelsBrowse.aspx?" & _
					IDS_QPARAM_NRMODE & "=" & IDS_NRMODE_UNPUBLISHED & "&" & _
					IDS_QSTR_PAGECREATIONWIZARD_FRESHTREE & "=" & IDS_PAGECREATIONWIZARD_FRESHTREE_TRUE & "&" & _
					IDS_QSTR_PAGECREATIONWIZARD_CONNECTEDPAGE & "=" & AutoSession.ThisPosting.Guid
	
		' -- call Internal Hook
		Call OnInternalCustomizePostingCreationDlgURL( GetCreateConnectedPostingDlgURL )

		' -- call external Customizable Hook
		Call OnCustomizePostingCreationDlgURL( GetCreateConnectedPostingDlgURL )

	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Determines whether the "Create New Page" link should be visible
'				or not
'
' -----------------------------------------------------------------------------
Function IsNewPostingLinkVisible()
	IsNewPostingLinkVisible = (AutoSession.IsModeUnpublished) And _
							(AutoSession.ThisChannel.CanCreatePostings) And _
							(Not IsStagedOrCrawled) And _
							(Request.QueryString(IDS_QPARAM_WBCPURPOSE) = IDS_WBCPURPOSE_BASIC)
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL to the "Create New Page" link
'
' -----------------------------------------------------------------------------
Function GetCreateSimplePostingDlgURL()
	 GetCreateSimplePostingDlgURL = "#"

	If IsNewPostingLinkVisible Then
		 GetCreateSimplePostingDlgURL = IDS_FRAMEWORK_VIRTUAL_PATH & _
					IDS_PAGECREATIONWIZARD_PATH & "/TemplateGalleriesBrowse/TemplateGalleriesBrowse.asp?" & _
					IDS_QPARAM_NRMODE & "=" & IDS_NRMODE_UNPUBLISHED & "&" & _
					IDS_QSTR_PAGECREATIONWIZARD_FRESHTREE & "=" & IDS_PAGECREATIONWIZARD_FRESHTREE_TRUE & "&" & _
					IDS_QSTR_PAGECREATIONWIZARD_DESTINATIONCHANNEL & "=" & AutoSession.ThisChannel.Guid

		' -- call Internal Hook
		Call OnInternalCustomizePostingCreationDlgURL( GetCreateSimplePostingDlgURL )

		' -- call external Customizable Hook
		Call OnCustomizePostingCreationDlgURL( GetCreateSimplePostingDlgURL )
	End If

End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL to some arbitary link for creating new Posting
'			with pre-defined Template and Channel as set by the script.
'
' -----------------------------------------------------------------------------
Function GetCreatePostingDirectLinkURL( pChannel, pTemplate )
	GetCreatePostingDirectLinkURL = "#"

	If Not IsStagedOrCrawled Then
		GetCreatePostingDirectLinkURL = AppendQueryString( pTemplate.URLAsPosting(pChannel), _
							IDS_QPARAM_NREMIT & "=" & IDS_EMIT_THINEDIT & "&" & _
							IDS_QPARAM_WBCPURPOSE & "=" & IDS_WBCPURPOSE_AUTHORING)

		' -- call Internal Hook
		Call OnInternalCustomizeCreatePostingDirectLinkURL( pChannel, pTemplate, GetCreatePostingDirectLinkURL )

		' -- call External Customizable Hook
		Call OnCustomizeCreatePostingDirectLinkURL( pChannel, pTemplate, GetCreatePostingDirectLinkURL )
	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function GetTmplGalleryURL()
	GetTmplGalleryURL =  GetCreateSimplePostingDlgURL()
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function IsCreateFromPreviewVisible()
	IsCreateFromPreviewVisible = False
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function GetCreateFromPreviewURL()
	GetCreateFromPreviewURL = "JavaScript:alert('This function has been deprecated. Create Template from Preview is no longer supported.')"
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function GetTmplBasedNewPostingURL( pTemplate )
	GetTmplBasedNewPostingURL = "#"

	If Not IsStagedOrCrawled Then
		GetTmplBasedNewPostingURL = "JavaScript:alert('The function GetTmplBasedNewPostingURL(pTemplate) has been deprecated.\n\nPlease use GetCreatePostingDirectLinkURL( pChannel, pTemplate ) instead')"
	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function GetTmplPathBasedNewPostingURL(strTmplPath)
	GetTmplPathBasedNewPostingURL = "#"

	If Not IsStagedOrCrawled Then
		GetTmplPathBasedNewPostingURL = "JavaScript:alert('The function GetTmplPathBasedNewPostingURL(strTmplPath) has been deprecated.\n\nPlease use GetCreatePostingDirectLinkURL( pChannel, pTemplate ) instead')"
	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Retained for backwards compatibility with version 3.x
'
' -----------------------------------------------------------------------------
Function GetTaskCentricNewPostingURL(strChannelPath, strTmplPath)
	GetTaskCentricNewPostingURL = "#"

	If Not IsStagedOrCrawled Then
		GetTaskCentricNewPostingURL = "JavaScript:alert('The function GetTaskCentricNewPostingURL(strChannelPath, strTmplPath) has been deprecated.\n\nPlease use GetCreatePostingDirectLinkURL( pChannel, pTemplate ) instead')"
	End If
End Function


%>
