<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
		<file filelist='opensondage_files' name='/usr/share/eole/db/opensondage/updates/opensondage-update-1.sql' mkdir='True' rm='True'/>
        <file filelist='opensondage_files' name='/etc/eole/eole-db.d/opensondage-db.yml' rm='True' mkdir='True'/>
    </files>

	<containers>
        <container name='web'>
            <package>opensondage-apps</package>

			<!-- service de configuration apache -->
			<service method="apache" servicelist="opensondage">opensondage</service>

			<!-- template -->
			<file filelist='opensondage_files' name='/etc/apache2/sites-available/opensondage' source='opensondage-apache.conf' />
			<file filelist='opensondage_files' name='/var/www/html/opensondage/config/conf.php' source='opensondage-conf.php' rm='True'/>
			<file filelist='opensondage_files' name='/var/www/html/opensondage/config/ldap.inc.php' source='opensondage-ldap-inc.php' rm='True'/>
		</container>
	</containers>
	
	<variables>
        <family name='applications web'>
			<variable name='activer_opensondage' type='oui/non' description='Activer OpenSondage'>
				<value>oui</value>
			</variable>
		</family>
		
        <family name='opensondage' mode='expert'>
            <variable type='string' name='opensondage_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='opensondage_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='opensondage_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='opensondage_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='opensondage_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='opensondage_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>		
	</variables>
	
	<constraints>
		<condition name='hidden_if_in' source='activer_opensondage'>
			<param>non</param>
			<target type='filelist'>opensondage_files</target>
			<target type='servicelist'>activer_opensondage</target>
		</condition>
		
        <check name='valid_enum' target='opensondage_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='opensondage_db_mode'>
            <param>local</param>
            <target type='variable'>opensondage_dbserver</target>
            <target type='variable'>opensondage_dbuser</target>
            <target type='variable'>opensondage_dbport</target>
            <target type='variable'>opensondage_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='opensondage_db_mode'>
            <param>default</param>
            <target type='variable'>opensondage_dbserver</target>
            <target type='variable'>opensondage_dbuser</target>
            <target type='variable'>opensondage_dbport</target>
            <target type='variable'>opensondage_dbpass</target>
            <target type='variable'>opensondage_allow_hosts</target>
        </condition>		
	</constraints>
	
	<help>
		<variable name='activer_opensondage'>Questionnaire en ligne</variable>
	</help>
</creole>
