<!--#include file="CNCASPPageManager_ExistingPageSave.inc"-->

<%
' *****************************************************************************
' File:		/NR/System/WBC/Internals/WBCFuncPages/Cross-Browser/
'			PageOperation/AuthoringMode/PageSave/ExistingPageSave/
'			ExistingPageSave.asp
'
' Author:	Microsoft Corporation.
' Purpose:	Process the saving of a page. Entry pt will be NewPageSaveDlg.asp which
'           captures info like PageName and PageDisplayName.  Exit pt will be the URL
'           mode that the user wants to go back to after saving
'			the page
'
' Query String Parameters:
'	IDS_QSTR_PAGEOPERATIONAUTHORING_CONTINUEAUTHORING: Indicate what is the return URL mode
'	IDS_QSTR_PAGEOPERATIONAUTHORING_LASTMODIFIEDDATE: Used for checking whether page has been
'													  modified or not
'
' ************************************************************************

' ---- Initialize the ASPPageManager
Dim g_pASPPageManager
Set g_pASPPageManager = New CNCASPPageManager_ExistingPageSave
Call g_pASPPageManager.InitManager()

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="-1">
<meta name="Author" content="Microsoft Corporation.">
<meta name="Description" content="Process the saving of a posting">
<meta name="robots" content="NOINDEX,NOFOLLOW">
<meta http-equiv="Content-Type" content="text/html;charset=<%= g_pASPPageManager.Charset %>">
<title><%= IDS_UI_BROWSER_TITLE %></title>
<% Call EmbedWBCHeadSection %>

</head>

<body>

<form name="NC_AuthoringSave"
	  action=""
	  method="post"
	  enctype="multipart/form-data"
	  onsubmit="return false;">

<%	If (g_pASPPageManager.ErrorString() <> IDS_E_NO_ERROR) Then %>

	<table width="100%" border="0" cellspacing="0" cellpadding="0">

		<!-- Show the Top Title -->
		<tr class="WBC_styclsBackground1">
			<td align=right><img border=0 src="<%=IDS_PATH_IMAGE_LOGO %>"></td>
			<td width=100% valign="middle"  class="WBC_styclsHeaderText">
				<%= IDS_UI_SAVING_A_PAGE %>
			</td>
			<td><img src="<%=IDS_TRANSPARENT_GIF%>"
						width="<%= C_INT_MAIN_MARGIN %>" height="<%=C_INT_HEADER_HEIGHT%>" border="0"></td>
		</tr>

		<!-- Show the breadcrumb trail -->
		<tr class="WBC_styclsBackground2">
			<td><img src="<%=IDS_TRANSPARENT_GIF%>"
				width="<%= C_INT_MAIN_MARGIN %>" height="<%=C_INT_SUBHEAD_HEIGHT%>" border="0"></td>
			<td class="WBC_styclsSubheadText">
				<%= IDS_UI_SAVING_A_PAGE %>
			</td>
			<td><img src="<%=IDS_TRANSPARENT_GIF%>"
				width="<%= C_INT_MAIN_MARGIN %>" height="<%=C_INT_SUBHEAD_HEIGHT%>" border="0"></td>
		</tr>
		<tr>
			<td><img src="<%=IDS_TRANSPARENT_GIF%>"
				width="15" height="<%= C_INT_MAIN_SPACING %>" border="0"></td>
		</tr>

		<!-- Set the margin width for the rest of the page -->
		<tr>
			<td rowspan="999"><img src="<%=IDS_TRANSPARENT_GIF%>"
						width="<%= C_INT_MAIN_MARGIN %>" height="1" border="0"></td>
			<td><img src="<%=IDS_TRANSPARENT_GIF%>"
						width="100%" height="1" border="0"></td>
			<td rowspan="999"><img src="<%=IDS_TRANSPARENT_GIF%>"
						width="<%= C_INT_MAIN_MARGIN %>" height="1" border="0"></td>
		</tr>

		<!-- Display the fact that there is an error -->
		<tr>
			<td class="WBC_styclsBackground1">
				<table width="100%" border="0" cellspacing="<%= C_INT_THICK_BORDER %>" cellpadding="5">
					<tr class="WBC_styclsBackground2">
						<td>
							<span class="WBC_styclsHeavyTextColor1"><%= IDS_UI_ERROR %>:</span>&nbsp;&nbsp;
<%		If (g_pASPPageManager.ErrorString = IDS_E_PAGE_MODIFIED_ALREADY) Then %>
							<span class="WBC_styclsTextColor1"><%= IDS_UI_PAGE_MODIFIED_ALREADY %></span>
<%		ElseIf (g_pASPPageManager.ErrorString = IDS_E_ERR_IN_PAGE_UPDATE) Then %>
							<span class="WBC_styclsTextColor1"><%= IDS_UI_ERR_IN_PAGE_UPDATE %></span>
<%		Else %>
							<span class="WBC_styclsTextColor1"><%= IDS_UI_ERR_UNKNOWN %></span>
<%		End If %>
						</td>
					</tr>
		<!-- Don't show rom errors details when the issue is due with tme stamp such as page changed on server -->
<%		If (g_pASPPageManager.ErrorString <> IDS_E_PAGE_MODIFIED_ALREADY) Then %>
					<tr class="WBC_styclsBackground2">
						<td>
							<span class="WBC_styclsHeavyTextColor1"><%= IDS_UI_ERROR_DESCRIPTION %>:</span>&nbsp;&nbsp;
							<span class="WBC_styclsTextColor1"><%= AutoSession.LastError.Description %></span>
						</td>
					</tr>
					<tr class="WBC_styclsBackground2">
						<td>
							<span class="WBC_styclsHeavyTextColor1"><%= IDS_UI_ERROR_DETAILS %>:</span>&nbsp;&nbsp;
							<span class="WBC_styclsTextColor1"><%= AutoSession.LastError.InternalDetails %></span>
						</td>
					</tr>
<%		End If %>

				</table>
			</td>
		</tr>
		<tr>
			<td colspan=3><img src="<%=IDS_TRANSPARENT_GIF%>"
				width="15" height="<%= C_INT_MAIN_SPACING %>" border="0"></td>
		</tr>
		<tr>
			<td colspan=3><%= IDS_UI_PLEASE_TRY_AGAIN %></td>
		</tr>
		<tr>
			<td colspan=3>
				<li>
					<a target="_self" href="#" onclick="WBC_submitForm('NC_AuthoringSave', '<%= g_pASPPageManager.URLRetrySaveLink %>'); return false">
					<%=IDS_UI_SAVE_AGAIN%> </a>
				</li>

				<li>
					<a target="_self" href="#" onclick="WBC_submitForm('NC_AuthoringSave', '<%= g_pASPPageManager.URLAuthoringAgainLink %>'); return false">
					<%=IDS_UI_RESUME_EDIT%> </a>
				</li>

				<li>
					<a target="_top" href="<%=g_pASPPageManager.URLCancelEditLink%>">
					<%=IDS_UI_CANCEL_EDIT%> </a>
				</li>
<%			If (g_pASPPageManager.ErrorString = IDS_E_PAGE_MODIFIED_ALREADY) Then %>
				<li>
					<a target="_self" href="#" onclick="WBC_openWindowOnFocus('<%= g_pASPPageManager.URLPreview %>', IDS_WIN_PREVIEW, WBC_getPoppedUpWindowFeatures(IDS_WIN_PREVIEW, window.top));return false">
					<%=IDS_UI_PREVIEW%> </a>
				</li>
<%
			End If
			Call g_pASPPageManager.GenerateRoundTripFormElementsForReSubmit()
%>
			</td>
		</tr>
	</table>
<%

	  Else
			If g_pASPPageManager.ContinueToAuthoring Then
				If (Not g_pASPPageManager.HookFailed) Then
				'No error encountered after creating the posting and updating it, so we
				'chk for filtering msg box and return user back to the editing mode
					If g_pASPPageManager.ShowWarningReport Then%>
						<script language="JavaScript" type="text/javascript">
						<!--
							alert(IDS_CONTENT_STRIPPED)
							window.top.location =  '<%= g_pASPPageManager.URLGoToAuthoringMode %>'
						// -->
						</script>
<%					Else
						Call ServerSideRedirect(g_pASPPageManager.URLGoToAuthoringMode)
					End If
				Else%>
						<script language="JavaScript" type="text/javascript">
						<!--
							window.top.location =  '<%= g_pASPPageManager.URLGoToAuthoringMode %>'
						// -->
						</script>
<%
				End If
			Else
				'No error occur but user has requested not to go back to Authoring.
				If g_pASPPageManager.ShowWarningReport Then
					If (Not g_pASPPageManager.HookFailed) Then %>
						<script language="JavaScript" type="text/javascript">
						<!--
							alert(IDS_CONTENT_STRIPPED)
							window.top.location =  '<%= g_pASPPageManager.URLGoToEditMode %>'
						// -->
						</script>
<%					Else
						Call ServerSideRedirect(g_pASPPageManager.URLGoToEditMode)
					End If
				Else %>
					<script language="JavaScript" type="text/javascript">
					<!--
							window.top.location =  '<%= g_pASPPageManager.URLGoToEditMode %>'
						// -->
					</script>
<%				End If
			End If
	  End If %>


</form>

</body>
</html>
