<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <file filelist='limesurvey' name='/etc/eole/eole-db.d/limesurvey-db.yml' rm='True' mkdir='True'/>
        <file filelist='limesurvey' name='/usr/share/eole/db/limesurvey/gen/limesurvey-create-1.sql' source='limesurvey-create-1.sql' rm='True' mkdir='True'/>
        <file filelist='limesurvey' name='/usr/share/eole/db/limesurvey/updates/limesurvey-update-1.sql' source='limesurvey-update-1.sql' rm='True' mkdir='True'/>
        <file filelist='limesurvey-bareos' name='/etc/bareos/bareosfichiers.d/limesurvey.conf' source='limesurvey-bareos.conf' rm='True'/>
    </files>

	<containers>
		<container name="web">
		    <package>limesurvey-apps</package>
	        <!-- services de configuration apache -->
		    <service method="apache" servicelist="limesurvey">limesurvey</service>

            <!-- fichier de configuration de apache -->
		    <file filelist='limesurvey' name='/etc/apache2/sites-available/limesurvey' source='limesurvey-apache.conf'/>

            <!-- fichier de configuration de l'application php -->
		    <file filelist="limesurvey" name="/var/www/html/limesurvey/application/config/config.php" source="limesurvey-config.php" rm="True"/>
		    <file filelist="limesurvey" name="/var/www/html/limesurvey/application/config/ldap.php" source="limesurvey-ldap.php" rm="True"/>

            <!-- fichier de configuration de la synchro posh -->
            <file filelist='limesurvey' name='/var/www/html/posh-profil/include/limesurvey.php' source='limesurvey-synchro.php' rm='True'/>
		</container>
	</containers>

    <variables>
        <family name='applications web'>
            <variable name='activer_limesurvey' type='oui/non' description='Activation des sondages limesurvey'>
                <value>oui</value>
            </variable>
        </family>
        
        <family name='limesurvey' mode='expert'>
            <variable type='string' name='limesurvey_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='limesurvey_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='limesurvey_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='limesurvey_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='limesurvey_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='limesurvey_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>        
    </variables>
    
    <constraints>
        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='filelist'>limesurvey</target>
            <target type='filelist'>limesurvey-bareos</target>
            <target type='servicelist'>limesurvey</target>
        </condition>
        		
        <condition name='hidden_if_in' source='activer_limesurvey'>
            <param>non</param>
            <target type='filelist'>limesurvey</target>
            <target type='filelist'>limesurvey-bareos</target>
            <target type='servicelist'>limesurvey</target>
        </condition>

        <check name='valid_enum' target='limesurvey_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='limesurvey_db_mode'>
            <param>local</param>
            <target type='variable'>limesurvey_dbserver</target>
            <target type='variable'>limesurvey_dbuser</target>
            <target type='variable'>limesurvey_dbport</target>
            <target type='variable'>limesurvey_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='limesurvey_db_mode'>
            <param>default</param>
            <target type='variable'>limesurvey_dbserver</target>
            <target type='variable'>limesurvey_dbuser</target>
            <target type='variable'>limesurvey_dbport</target>
            <target type='variable'>limesurvey_dbpass</target>
            <target type='variable'>limesurvey_allow_hosts</target>
        </condition>
                
        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>limesurvey-bareos</target>			
		</condition>          
    </constraints>
    
    <help>
        <variable name='activer_limesurvey'>Activation des sondages limesurvey</variable>
    </help>
</creole>
