<!--- mapping virtual path depends on site physical path and intranet folder name --->
<cfif urlFirstFolder EQ intranetFolder>
	<cfset virtualPath = "/#intranetFolder#">
<cfelse>
	<cfset virtualPath = "/">
</cfif>

<cfswitch expression="#sAction#">
	<!--- password verification --->
	<cfcase value="password">
		<cftry>
			<cfadmin
			    action="connect"
			    type="web"
			    password="#form.AdminPassword#">
			<cfcatch>
				<cfoutput>{"sReturnMsg":"/Admin/SiteSettings/install_update_popup.cfm?Type=#form.Type#&UpdateVersion=#form.UpdateVersion#&UpdateFile=#form.UpdateFile#&MinCF=#form.MinCF#&MinSQL=#form.MinSQL#&ServerPassword=#Form.ServerPassword#&error=railopassword"}</cfoutput>
				<cfabort>
			</cfcatch>	
		</cftry>
	</cfcase>
	
	<cfcase value="serverPassword">
		<cftry>
			<cfadmin
			    action="connect"
			    type="server"
			    password="#form.ServerPassword#">
			<cfcatch>
				<cfoutput>{"sReturnMsg":"/Admin/SiteSettings/install_update_popup.cfm?Type=#form.Type#&UpdateVersion=#form.UpdateVersion#&UpdateFile=#form.UpdateFile#&MinCF=#form.MinCF#&MinSQL=#form.MinSQL#&AdminPassword=#Form.AdminPassword#&error=serverpassword"}</cfoutput>
				<cfabort>
			</cfcatch>	
		</cftry>
	</cfcase>
	
	<!--- delete secure archive mapping --->
	<cfcase value="removeMapping">
		<cfadmin action="removeMapping"
		    type="web"
		    password="#form.AdminPassword#"
		    virtual="#virtualPath#">
	</cfcase>
	
	<!--- create/update secure archive mapping --->
	<cfcase value="updateMapping">
		<cfadmin action="updateMapping"
		    type="web"
		    password="#form.AdminPassword#"
		    virtual="#virtualPath#"
		    physical="#intranetRoot#"
		    archive="#intranetRoot#\IntranetConnections.ras"
		    primary="resource"
		    trusted="false"
		    toplevel="true">
	</cfcase>
</cfswitch>