<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <file filelist='fengoffice' name='/etc/eole/eole-db.d/fengoffice-db.yml' rm='True' mkdir='True'/>
		<file filelist='fengoffice' name='/usr/share/eole/db/fengoffice/gen/fengoffice-create-0.sql' rm='True' mkdir='True'/>
   </files>	
	
    <containers>
        <container name='web'>
            <package>fengoffice-apps</package>
            <!-- services de configuration apache -->
            <service method="apache" servicelist="fengoffice">fengoffice</service>
            <!-- fichier de configuration de apache -->
            <file filelist='fengoffice' name='/etc/apache2/sites-available/fengoffice' source='apache-fengoffice.conf'/>
	        <!-- fichier de configuration de l'application php -->
            <file filelist='fengoffice' name='/var/www/html/fengoffice/config/config.php' source="fengoffice-config.php" rm='True'/>
            <file filelist='fengoffice' name='/var/www/html/posh-profil/include/fengoffice.php' source='fengoffice-synchro.php' rm='True'/>
        </container>
    </containers>
    <variables>
        <family name='applications web'>
            <variable name='activer_fengoffice' type='oui/non' description='Activer fengoffice (Travail collaboratif)'>
                <value>oui</value>
            </variable>
        </family>

        <family name='fengoffice' mode='expert'>
            <variable type='string' name='fengoffice_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='fengoffice_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='fengoffice_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='fengoffice_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='fengoffice_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='fengoffice_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>
    </variables>

    <constraints>
        <condition name='hidden_if_in' source='activer_fengoffice'>
            <param>non</param>
            <target type='filelist'>fengoffice</target>
            <target type='servicelist'>fengoffice</target>
        </condition>

        <check name='valid_enum' target='fengoffice_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='fengoffice_db_mode'>
            <param>local</param>
            <target type='variable'>fengoffice_dbserver</target>
            <target type='variable'>fengoffice_dbuser</target>
            <target type='variable'>fengoffice_dbport</target>
            <target type='variable'>fengoffice_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='fengoffice_db_mode'>
            <param>default</param>
            <target type='variable'>fengoffice_dbserver</target>
            <target type='variable'>fengoffice_dbuser</target>
            <target type='variable'>fengoffice_dbport</target>
            <target type='variable'>fengoffice_dbpass</target>
            <target type='variable'>fengoffice_allow_hosts</target>
        </condition>
    </constraints>

    <help>
        <variable name='activer_fengoffice'>Fengoffice est un un outil de travail collaboratif</variable>
    </help>
</creole>
