<%
'ManualLogin.inc: Contains methods and constants required to perform
'redirects to a manual login page.  Used by Authenticate.inc, 
'DefaultGuestLogin.asp, etc.

'WARNING: Changing this file will alter the behaviour of user access
'into the Resolution system.

'To change the manual login page which Authenticate.inc redirects to in order 
'to authenticate a request, modify the MANUALLOGINURL path below.
Dim MANUALLOGINURL 
Dim QS_PARAM_NAME_ORIGINALURL

MANUALLOGINURL = "/NR/System/Access/ManualLogin.asp"
QS_PARAM_NAME_ORIGINALURL = "NRORIGINALURL"

' ---- [Public] Checks if the user agent string indicates that it is a robot
' This function is not used by authenticate.inc, but is called by the WBC.
Function GetManualLoginRedirectUrl( strMessage, strReturnUrl )
	Dim strRedirectUrl
	
	strRedirectUrl = MANUALLOGINURL

	' -- If they did not specify a return URL, use the current URL	
	If strReturnUrl = "" Then
		strReturnUrl = URLForThisPageRequest
	End If

	' -- Build up the URL along with QueryString	
	If strReturnUrl <> "" Or strMessage <> "" Then
		strRedirectUrl = strRedirectUrl & "?"
		
		' -- Add the ReturnUrl if we have it
		If strReturnUrl <> "" Then
			strRedirectUrl = strRedirectUrl & "ReturnUrl=" & Server.UrlEncode( strReturnUrl )
		End If
		
		' -- Add the message if we have it
		If strMessage <> "" Then
			If strReturnUrl <> "" Then
				strRedirectUrl = strRedirectUrl & "&"
			End If
			
			strRedirectUrl = strRedirectUrl & "REASONTXT=" & Server.UrlEncode( strMessage )
		End If
	End If
	
	GetManualLoginRedirectUrl = strRedirectUrl
End Function


' ---- [Private] 
Function URLForThisPageRequest

	Dim queryString
	Dim GotoUrl

	GotoUrl = Request.QueryString( QS_PARAM_NAME_ORIGINALURL )
	if GotoUrl = "" Then
		queryString = Request.ServerVariables( "QUERY_STRING" )

		If queryString <> "" Then
			queryString = "?" & queryString
		End If
	
		GotoUrl = Request.ServerVariables("SCRIPT_NAME" ) & queryString
	End If
	
	URLForThisPageRequest = GotoUrl
	
End Function

%>
