<?xml version="1.0" encoding="UTF-8"?>
<authdriver enabled="false" name="ftp" label="CONF_MESSAGE[FTP authentication]" description="CONF_MESSAGE[Authenticate users by validating their credentials against an FTP server.]" mixins="authdriver_commons"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:../core.ajaxplorer/ajxp_registry.xsd">
    <client_settings>
        <resources>
            <i18n namespace="ftp_auth" path="plugins/auth.ftp/i18n"/>
        </resources>
    </client_settings>
	<server_settings>
        <param name="TEST_CONNEXION" type="button" choices="run_plugin_action:auth.ftp:testParameters" default="auth.ftp" label="CONF_MESSAGE[Test connection]" description="CONF_MESSAGE[Test connection to the FTP server]" mandatory="false"/>
        <param name="FTP_LOGIN_SCREEN" type="boolean" label="CONF_MESSAGE[FTP Login Screen]" description="CONF_MESSAGE[Replace the default connection screen (username and password) by a screen allowing users to enter their own FTP connection data (server, port, etc.)]" mandatory="true" default="false"/>
        <param name="REPOSITORY_ID" type="select" choices="json_list:list_all_repositories_json" label="CONF_MESSAGE[Workspace]" description="CONF_MESSAGE[ID of the workspace used to validate credentials]" mandatory="true"/>
	</server_settings>
	<class_definition filename="plugins/auth.ftp/class.ftpAuthDriver.php" classname="ftpAuthDriver"/>
	<registry_contributions>
		<external_file filename="plugins/core.auth/standard_auth_actions.xml" include="actions/action[@name='back']" exclude=""/>
        <client_configs>
            <template element="ajxp_desktop" name="hide_remember_me" position="bottom"><![CDATA[
                    <style type="text/css"> form#login_form > div > div.SF_element:last-child{ display:none; }</style>
                    ]]></template>
        </client_configs>
        <actions>
			<action name="set_ftp_data">
				<rightsContext noUser="false" userLogged="hidden" guestLogged="show" read="false" write="false" adminOnly=""/>
				<processing>
					<serverCallback methodName="setFtpDataCallback"/>
				</processing>
			</action>
			<!-- OVERRIDE LOGOUT -->
			<action name="ftp_logout" expireDefault="true">
				<gui text="164" title="169" src="decrypted.png"
					accessKey="" hasAccessKey="false" iconClass="icon-signout">
					<context selection="false" dir="" recycle="false"
						actionBar="false" contextMenu="false" infoPanel="false"
						actionBarGroup="user" ajxpWidgets="UserWidget::logging_string">
					</context>
				</gui>
				<rightsContext noUser="false" userLogged="only" guestLogged="hidden" read="false" write="false" adminOnly=""/>
				<processing>
					<clientCallback prepareModal="false"><![CDATA[
						clearRememberData();
						var connexion = new Connexion();
						connexion.addParameter('get_action', 'ftp_logout');
						connexion.onComplete = function(transport){
							PydioApi.getClient().parseXmlMessage(transport.responseXML);
							};
						connexion.sendAsync();
						]]></clientCallback>
					<serverCallback methodName="logoutCallback"/>
				</processing>
			</action>
		</actions>
	</registry_contributions>
	<dependencies>
		<pluginClass pluginName="access.ftp"/>
	</dependencies>
</authdriver>
