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

        <family name='fluxbb' mode='expert'>
            <variable type='string' name='fluxbb_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='fluxbb_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='fluxbb_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='fluxbb_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='fluxbb_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='fluxbb_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>        
    </variables>
    <constraints>
        <condition name='hidden_if_in' source='activer_fluxbb'>
            <param>non</param>
            <target type='filelist'>fluxbb</target>
            <target type='servicelist'>fluxbb</target>
        </condition>
        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='filelist'>fluxbb</target>
            <target type='servicelist'>fluxbb</target>
        </condition>

        <check name='valid_enum' target='fluxbb_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='fluxbb_db_mode'>
            <param>local</param>
            <target type='variable'>fluxbb_dbserver</target>
            <target type='variable'>fluxbb_dbuser</target>
            <target type='variable'>fluxbb_dbport</target>
            <target type='variable'>fluxbb_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='fluxbb_db_mode'>
            <param>default</param>
            <target type='variable'>fluxbb_dbserver</target>
            <target type='variable'>fluxbb_dbuser</target>
            <target type='variable'>fluxbb_dbport</target>
            <target type='variable'>fluxbb_dbpass</target>
            <target type='variable'>fluxbb_allow_hosts</target>
        </condition>        
    </constraints>
    <help>
        <variable name='activer_fluxbb'>FluxBB est une application web légère de forum de discussions basé sur PunBB</variable>
    </help>
</creole>
