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

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

Dim strWBCPurpose
strWBCPurpose = Request.QueryString(IDS_QPARAM_WBCPURPOSE)

Dim m_bAreAuthCmdsVisible
Dim m_bAreAuthCmdsFunctional

' Authoring commands are visible when the wbc_purpose is either for authoing or
' for previewing the authoring form
m_bAreAuthCmdsVisible = (AutoSession.IsModeUnpublished) And _
						(Not AutoSession.ThisPosting Is Nothing) And _
						(Not IsStagedOrCrawled) And _
						((strWBCPurpose = IDS_WBCPURPOSE_AUTHORING) Or _
						 (strWBCPurpose = IDS_WBCPURPOSE_PREVIEWAUTHORING))

' Authoring commands are functional when the wbc_purpose is for authoring,
' not when it is for previewing of authoring form
m_bAreAuthCmdsFunctional = (AutoSession.IsModeUnpublished) And _
							(Not AutoSession.ThisPosting Is Nothing) And _
							(Not IsStagedOrCrawled) And _
							(strWBCPurpose = IDS_WBCPURPOSE_AUTHORING)




' -----------------------------------------------------------------------------
'
'	[Public] Returns if link should be available
'
' -----------------------------------------------------------------------------
Function IsAuthPreviewConnectedPageVisible
	IsAuthPreviewConnectedPageVisible = False

	Dim pCurrentObject
	Set pCurrentObject = GetCurrentObject()

	If (pCurrentObject.IsPosting) Then

		IsAuthPreviewConnectedPageVisible = ( pCurrentObject.IsConnected )
	End If

End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL for the "Preview Other Connected Page" dialog in
'			WBC Authoring mode
'
' -----------------------------------------------------------------------------
Function GetAuthPreviewConnectedDlgURL()

	' -- Disable WBC mode propagation policy because we want to
	'		generate all the query string parameters ourselves
	Call DisableROMPropagationPolicyForWBCMode()

	GetAuthPreviewConnectedDlgURL = IDS_FRAMEWORK_VIRTUAL_PATH & "/Internals/WBCFuncPages/Cross-Browser/AuthPreview" & _
								 "/AuthPreviewConnectedSel/AuthPreviewConnectedSelDlg.asp?" & _
								 AutoSession.ThisPosting.QueryString

	' -- call hook function to allow custom modification of the URL
	Call OnInternalCustomizeAuthPreviewConnectedDlgURL( AutoSession.ThisPosting, GetAuthPreviewConnectedDlgURL )

	' -- call hook function to allow custom modification of the URL
	Call OnCustomizeAuthPreviewConnectedDlgURL( AutoSession.ThisPosting, GetAuthPreviewConnectedDlgURL )

	' -- restore WBC mode propagation policy
	Call SetROMPropagationPolicyForWBCMode()

End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL for the "Save" authoring link for a new Posting
'
'	NOTE: This URL will return a URL point to NewPageSaveDlg.asp for WBC to use
'		  if the page is not a new page
'
' -----------------------------------------------------------------------------
Function GetAuthSaveURL()
	' return a non-empty URL only for a brand new Posting
	If Not IsExistingPosting( AutoSession.ThisPosting ) Then

		GetAuthSaveURL = IDS_FRAMEWORK_VIRTUAL_PATH & IDS_PAGEOPERATIONAUTHORING_PAGESAVE_PATH & "/NewPageSaveDlg/NewPageSaveDlg.asp?" & _
						AutoSession.ThisPosting.QueryString & "&" & _
						IDS_QSTR_PAGEOPERATIONAUTHORING_CONTINUEAUTHORING & "=" & IDS_PAGEOPERATIONAUTHORING_CONTINUEAUTHORING_TRUE

		' -- call Internal hook function to allow custom modification of the URL
		Call OnInternalCustomizeAuthSaveNewDlgURL( AutoSession.ThisPosting, GetAuthSaveURL )

		' -- call hook function to allow custom modification of the URL
		Call OnCustomizeAuthSaveNewDlgURL( AutoSession.ThisPosting, GetAuthSaveURL )
	End If
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL for the "Save" authoring link for a new Posting
'
'	NOTE: This URL will return a URL point to NewPageSaveDlg.asp for WBC to use
'		  if the page is not a new page
'
' -----------------------------------------------------------------------------
Function GetAuthSaveAndExitURL()
	' return a non-empty URL only for a brand new Posting
	If Not IsExistingPosting( AutoSession.ThisPosting ) Then

		GetAuthSaveAndExitURL = IDS_FRAMEWORK_VIRTUAL_PATH & IDS_PAGEOPERATIONAUTHORING_PAGESAVE_PATH & "/NewPageSaveDlg/NewPageSaveDlg.asp?" & _
						AutoSession.ThisPosting.QueryString & "&" & _
						IDS_QSTR_PAGEOPERATIONAUTHORING_CONTINUEAUTHORING & "=" & IDS_PAGEOPERATIONAUTHORING_CONTINUEAUTHORING_FALSE

		' -- call Internal hook function to allow custom modification of the URL
		Call OnInternalCustomizeAuthSaveNewDlgURL( AutoSession.ThisPosting, GetAuthSaveAndExitURL )

		' -- call hook function to allow custom modification of the URL
		Call OnCustomizeAuthSaveNewDlgURL( AutoSession.ThisPosting, GetAuthSaveAndExitURL )
	End If
End Function




' -----------------------------------------------------------------------------
'
'	[Public] For backwards compatibility with version 3.x. Microsoft Content Management Server no
'			longer supports "Submit" in WBC Authoring Mode. The current
'			implementation just delegates to make the link identical to "Save".
'
' -----------------------------------------------------------------------------
Function GetAuthSubmitURL()
	GetAuthSubmitURL = GetAuthSaveURL
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns the URL for the "Exit" authoring link
'
' -----------------------------------------------------------------------------
Function GetAuthCancelURL()
	Dim pObjDestination

	If IsExistingPosting( AutoSession.ThisPosting ) Then
		' set the destination object to be the existing Posting
		Set pObjDestination = AutoSession.ThisPosting
	Else
		' set the destination object to be the parent Channel
		' since Posting does not exist yet
		Set pObjDestination = AutoSession.ThisPosting.Parent
	End If

	GetAuthCancelURL = GetWBCBasicEditURL( pObjDestination )
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns if authoring commands are visible
'
' -----------------------------------------------------------------------------
Function AreAuthCmdsVisible()
	AreAuthCmdsVisible = m_bAreAuthCmdsVisible
End Function


' -----------------------------------------------------------------------------
'
'	[Public] Returns if authoring commands are functional
'
' -----------------------------------------------------------------------------
Function AreAuthCmdsFunctional()
	AreAuthCmdsFunctional = m_bAreAuthCmdsFunctional
End Function


%>
