<%@ Language=VBScript %>

<%

'*****************************************************************************
' Microsoft Content Management Server
'
' File: ExportInProgress.asp
'
' Purpose:
'   ASP file that Reports Export in Progress for Site Deployment.
'
'*****************************************************************************

' Script Parameters Names and Values
' Note: use all lower case strings for comparison
Const strEXPORT 	 = "export"
Const strIMPORT 	 = "import"
Const strDEPLOY_TYPE = "deploytype"
Const strPREVIEW	 = "preview"
Const strUSER 	 	 = "user"
Const strPROFILE 	 = "profile"
Const strROP     	 = "rop"
Const strTIME    	 = "time"
Const strSTATUS    	 = "status"
Const strBEGIN    	 = "begin"
Const strDONE    	 = "done"

' UI Messages
Const strEXPORT_IN_PROGRESS 		  = "Export in progress..."
Const strGENERATING_EXPORT_PREVIEW 	  = "Generating Export Preview..."
Const strEXPORT_COMPLETED 			  = "Export Completed"
Const strPRE_EXPORT_REPORT_DONE 	  = "Export Preview Done"
Const strIMPORT_IN_PROGRESS 		  = "Import in progress..."
Const strGENERATING_IMPORT_PREVIEW 	  = "Generating Import Preview..."
Const strIMPORT_COMPLETED 			  = "Import Completed"
Const strPRE_IMPORT_REPORT_DONE 	  = "Import Preview Done"
Const strTIME_STARTED 				  = "Time Started:"
Const strTIME_FINISHED 				  = "Time Finished:"

%>

<%
	dim strHTML
	dim strContent
	dim strMainMsg
	dim strTimeStampLabel
	dim bReportOnly
	dim bError

	' initialize the error flag
	bError = False

	' find out request type, report-only or actual deployment?
	' initialize to False
	bReportOnly = False
	If Request.QueryString( strPREVIEW ) Then
		bReportOnly = True
	End If

	strHTML = "<html>" & vbcrlf & _
			  "<head>" & vbcrlf & _
			  "<title>Microsoft Content Management Server - Site Deployment Manager</title>" & vbcrlf & _
			  "</head>" & vbcrlf & _
			  "<body>" & vbcrlf & _
			  "<center><br><br>" & vbcrlf & _
			  "<font face=arial>" & vbcrlf

	Select Case LCase( Request.QueryString( strDEPLOY_TYPE ) )
	Case strEXPORT

		' set main progress message and time stamp label according to
		' provided deploy type and status of progress
		Select Case LCase( Request.QueryString( strSTATUS ) )
		Case strBEGIN

			If bReportOnly Then
				strMainMsg = strGENERATING_EXPORT_PREVIEW
			Else
				strMainMsg = strEXPORT_IN_PROGRESS
			End If

			strTimeStampLabel = strTIME_STARTED

		Case strDONE

			If bReportOnly Then
				strMainMsg = strPRE_EXPORT_REPORT_DONE
			Else
				strMainMsg = strEXPORT_COMPLETED
			End If

			strTimeStampLabel = strTIME_FINISHED

		Case Else
			' Bad! Missing or unexpected value for parameter Status
			' no need to raise error, just display it
			strContent = "Error: Invalid parameter value for Status"
			bError = True
		End Select

		If Not bError Then
			strContent = "		<table border=0 cellspacing=0>" & vbcrlf & _
						 "		<tr><td colspan=2>" & vbcrlf & _
						 "     <b>" & strMainMsg & "</b>" & vbcrlf & _
						 "     <br><br><font size=1><b>Export Details</b></font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>User:" & vbcrlf     & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("User"))    & "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>Export Profile:"    & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("Profile")) & "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>Output to ROP File:"& "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("ROP")) 	& "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>" & strTimeStampLabel & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("Time")) 	& "</font></td></tr>" & vbcrlf & _
						 "		</table>" & vbcrlf
		End If  ' bError

	Case strIMPORT

		' set main progress message and time stamp label according to
		' provided deploy type and status of progress
		Select Case LCase( Request.QueryString( strSTATUS ) )
		Case strBEGIN

			If bReportOnly Then
				strMainMsg = strGENERATING_IMPORT_PREVIEW
			Else
				strMainMsg = strIMPORT_IN_PROGRESS
			End If

			strTimeStampLabel = strTIME_STARTED

		Case strDONE

			If bReportOnly Then
				strMainMsg = strPRE_IMPORT_REPORT_DONE
			Else
				strMainMsg = strIMPORT_COMPLETED
			End If

			strTimeStampLabel = strTIME_FINISHED

		Case Else
			' Bad! Missing or unexpected value for parameter Status
			strContent = "Error: Invalid parameter value for Status"
			bError = True
		End Select

		If Not bError Then
			strContent = "		<table border=0 cellspacing=0>" & vbcrlf & _
						 "		<tr><td colspan=2>" & vbcrlf & _
						 "     <b>" & strMainMsg & "</b>" & vbcrlf & _
						 "     <br><br><font size=1><b>Import Details</b></font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>User:" & vbcrlf     & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("User"))    & "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>Import Profile:"    & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("Profile")) & "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>ROP File to Import:"& "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("ROP")) 	& "</font></td></tr>" & vbcrlf & _
						 "		<tr valign=top><td><font size=1>" & strTimeStampLabel & "</font></td>" & vbcrlf & _
						 "     <td><font size=1>" & Server.HTMLEncode(Request.QueryString("Time")) 	& "</font></td></tr>" & vbcrlf & _
						 "		</table>" & vbcrlf
		End If  ' bError

	Case Else
		' Invalid Deploy Type!
		strContent = "Error: Invalid parameter value for DeployType"
		bError = True
	End Select

	strHTML	= strHTML & strContent & _
			  "</font>" & vbcrlf & _
			  "</center>" & vbcrlf & _
			  "</body>" & vbcrlf & _
			  "</html>"

	Response.Write( strHTML )
%>
