<%
'The 'feedback_inc.asp' include file sets the main content for the feedback popup depending on the values passed.
%>

<%
dim intErrNumber
dim strUserFeedback
dim strModule
dim strAction
dim strParentURL
dim strCloseLink

intErrNumber = Session("FeedbackError")
strAction = Session("FeedbackMode")
strModule = Session("FeedbackModule")
strParentURL = Session("Referer")


Session("FeedbackMode") = ""
Session("FeedbackError") = ""
Session("FeedbackModule") = ""
Session("Referer") = ""

'feedback for Posting Type module (add/edit/delete) 
Select Case LCase(strModule)
	Case "merge"
		If intErrNumber = 0 Then
			strUserFeedback = "<p>The subscribers were successfully merged to the group.</p>"
			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Group Administration Module.</a></p>"
		Else
			strUserFeedback = "<p>An error occurred while merging the subscribers to the database.</p>"
			strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
		End If
		strParentURL = "/admin/groups.asp"
	Case "subscriber_import"
		If intErrNumber = 0 Then
			strUserFeedback = "<p>The subscribers were successfully added to the database.</p>"
			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Subscriber Administration Module.</a></p>"
		Else
			strUserFeedback = "<p>An error occurred while adding the subscribers to the database.</p>"
			strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
		End If
		strParentURL = "/admin/subscribers.asp?type=live"
	Case "dynamic_form"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>The dynamic form was successfully deleted from the database.</p>"
					strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Dynamic Form Administration Module.</a></p>"
				Case "edit"
					strUserFeedback = "<p>The dynamic form was successfully updated.</p>"
					strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Dynamic Form Administration Module.</a></p>"
					strParentURL = "/admin/dynamic_forms.asp"
				Case "add"
					strUserFeedback = "<p>The dynamic form was successfully added to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Form Element Administration Module.</a></p>"
			End Select
			
		Else
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the dynamic form information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while updating the dynamic form information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the dynamic form information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If

	Case "dynamic_form_admin_entry"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Form entry was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Form entry was successfully updated.</p>"
				Case "delete"
					strUserFeedback = "<p>The Form entry(ies) were successfully deleted.</p>"
			End Select
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Form entry to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Form entry information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Form entry.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If

	Case "form_element_sort_order"
		If intErrNumber = 0 Then
			strUserFeedback = "<p>The Dynamic Form's Element Sort Order was successfully updated.</p>"
			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Dynamic Form Administration.</a></p>"
		Else
			strUserFeedback = "<p>An error occurred while modifying the Dynamic Form's Element Sort Order.</p>"
			strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
		End If

	Case "caption"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Caption was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Caption was successfully updated.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Form Element Administration.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Caption to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Caption information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If

	Case "field"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Field was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Field was successfully updated.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Form Element Administration.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Field to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Field information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If

	Case "form_element"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>The Form Element was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Form Element Administration Module.</a></p>"

		Else
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Form Element information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If


	Case "client_exists"
		strUserFeedback = "<p>The submitted Username (email) was not unique, the 'Add a Client' transaction was cancelled.</p>"

	Case "data_result"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "send"
					strUserFeedback = "<p>The Data Resut(s) were successfully sent to the Client.</p>"
			End Select

		Else
			Select Case LCase(strAction)
				Case "send"
					strUserFeedback = "<p>An error occurred while sending the Data Resut(s) to the Client.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
	Case "client"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Client was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Client was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Client was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Clients Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Client to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Client information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Client information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		strParentURL = "/admin/clients.asp"
		
	Case "sample"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>The Sample was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Sequencing Submission Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Sample information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
	Case "seqencing_submission"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Sequencing Submission was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Sequencing Submission was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Sequencing Submission was successfully deleted from the database.</p>"
				Case "set_reception_date"
					strUserFeedback = "<p>The Samples' reception date was successfully set.</p>"
				Case "set_payment_reception_date"
					strUserFeedback = "<p>The 'Payment Received' date was successfully set.</p>"
				Case "unset_payment_reception_date"
					strUserFeedback = "<p>The 'Payment Received' date was successfully unset.</p>"
				Case "reset_ss_as_current"
					strUserFeedback = "<p>The Sequencing Submission was successfully reset as Current.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Sequencing Submission Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Sequencing Submission to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Sequencing Submission information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Sequencing Submission information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "set_reception_date"
					strUserFeedback = "<p>An error occurred while setting the Samples' reception date.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "unset_payment_reception_date"
					strUserFeedback = "<p>An error occurred while unsetting the 'Payment Received' date.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "reset_ss_as_current"
					strUserFeedback = "<p>An error occurred while resetting the Sequencing Submission as Current.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
	Case "posting_type"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Posting Type was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Posting Type was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Posting Type was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Content Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Posting Type to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Posting Type information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Posting Type information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		strParentURL = "/admin/content.asp"
		
	Case "subscriber"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Subscriber was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Subscriber was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Subscriber(s) were successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Subscriber Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Subscriber to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Subscriber information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Subscriber information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		'if the redirect page is an empty string then...
		If strParentURL = "" Then
			'set it to the default subscriber admin page
			strParentURL = "/admin/subscribers.asp"
		End If
		
	Case "user"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new User was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The User was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The User was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the User Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new User to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the User information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the User information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		strParentURL = "/admin/users.asp"
		
	Case "posting"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Posting was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Posting was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Posting was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Content Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Posting to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Posting information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Posting information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		strParentURL = "/admin/content.asp"
		
	Case "url"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new URL was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The URL was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The URL was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Content Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new URL to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the URL information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the URL information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		strParentURL = "/admin/urls.asp"
		
	Case "password"
		If intErrNumber = 0 Then
			strUserFeedback = "<p>The Password was successfully updated to the database.</p>"
			strUserFeedback = strUserFeedback & "<p>You will now be redirected back to the Administration Centre.</a></p>"
		Else
			strUserFeedback = "<p>An error occurred while modifying the Password information.</p>"
			strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
		End If
		
	Case "section"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Section was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Section was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Section was successfully deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Section Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>An error occurred while adding the new Section to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Section information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Section information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		'CASE GROUPS - NEW
		Case "groups"
		If intErrNumber = 0 Then
			Select Case LCase(strAction)
				Case "add"
					strUserFeedback = "<p>The new Group was successfully added to the database.</p>"
				Case "edit"
					strUserFeedback = "<p>The Group was successfully updated to the database.</p>"
				Case "delete"
					strUserFeedback = "<p>The Section was Group deleted from the database.</p>"
			End Select

			strUserFeedback = strUserFeedback & "<p>You will now be redirected to the Section Administration Module.</a></p>"
			
		Else
			Select Case LCase(strAction)
				Case ""
					strUserFeedback = "<p>An error occurred while adding the new Section to the database.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "edit"
					strUserFeedback = "<p>An error occurred while modifying the Section information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
				Case "delete"
					strUserFeedback = "<p>An error occurred while deleting the Section information.</p>"
					strUserFeedback = strUserFeedback & "<p>Please advise your Systems Administrator.</p>"
			End Select
		End If
		
		
End Select

'if the strParentURL variable is not empty then...
If strParentURL <> "" Then
	'set strCloseLink variable value 
	strCloseLink = "javascript:window.opener.location.href='" & strParentURL & "';window.close();"

'if the strParentURL variable is empty then...
Else
	'set strCloseLink variable value 
	strCloseLink = "javascript:window.close();"
End If

%>
<script language="JavaScript">parentUrl = '<%=strParentURL%>';</script>
<table align="center" width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="100%" align="center" valign="middle">
			<%=strUserFeedback%>
		</td>
	</tr>
</table>
