<?xml version="1.0" encoding="utf-8"?>
<creole>
	<files>
        <file filelist='xdesktop_files' name='/etc/eole/eole-db.d/xdesktop-db.yml' rm='True' mkdir='True'/>
        <file filelist='xdesktop_files' name='/usr/share/eole/db/xdesktop/gen/xdesktop-create-0.sql' rm='True' mkdir='True'/>
	</files>
	<containers>
        <container name='web'>
            <package>xdesktop-apps</package>
			<!-- service de configuration apache -->
			<service method="apache" servicelist="xdesktop">xdesktop</service>
			
			<!-- fichiers de conf apache -->
			<file filelist='xdesktop_files' name='/etc/apache2/sites-available/xdesktop' source='xdesktop-apache.conf' />
			<file filelist='xdesktop_files' name='/var/www/html/xdesktop/include/config.php' source='xdesktop-config.php' rm='True'/>
		</container>
	</containers>

	<variables>
        <family name='envole'>
			<variable name='activer_xdesktop' type='oui/non' description='Activer xDesktop' hidden='True' >
				<value>oui</value>
			</variable>
		</family>

        <family name='EoleDB' icon='database' mode='expert'>
            <variable type='string' name='xdesktop_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='xdesktop_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='xdesktop_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='xdesktop_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='xdesktop_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='xdesktop_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>

        <separators>
            <separator name="xdesktop_db_mode">Paramètres EoleDB associés à xDesktop</separator>
        </separators>         
	</variables>

	<constraints>
		<condition name='hidden_if_in' source='activer_xdesktop'>
			<param>non</param>
			<target type='filelist'>xdesktop_files</target>
			<target type='servicelist'>xdesktop</target>
		</condition>

        <check name='valid_enum' target='xdesktop_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='xdesktop_db_mode'>
            <param>local</param>
            <target type='variable'>xdesktop_dbserver</target>
            <target type='variable'>xdesktop_dbuser</target>
            <target type='variable'>xdesktop_dbport</target>
            <target type='variable'>xdesktop_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='xdesktop_db_mode'>
            <param>default</param>
            <target type='variable'>xdesktop_dbserver</target>
            <target type='variable'>xdesktop_dbuser</target>
            <target type='variable'>xdesktop_dbport</target>
            <target type='variable'>xdesktop_dbpass</target>
            <target type='variable'>xdesktop_allow_hosts</target>
        </condition>
	</constraints>

	<help>
		<variable name='activer_xdesktop'>Bureau des applications</variable>
	</help>
</creole>
