<?xml version="1.0" encoding="utf-8"?>
<creole>
    <!-- Déclaration des fichiers à installer -->
    <files>
        <!-- Fichier de création des tables dans la BDD  -->
        <file filelist='mahara' name='/usr/share/eole/db/mahara/gen/mahara-create-1.sql' mkdir='True' rm='True'/>
        <file filelist='mahara' name='/usr/share/eole/db/mahara/updates/mahara-update-1.sql' mkdir='True' rm='True'/>
        <file filelist='mahara' name='/etc/eole/eole-db.d/mahara-db.yml' rm='True' mkdir='True'/>
    </files>
    <!-- Précision du containeur pour les AMON-Ecole -->
    <containers>
        <container name='web'>
            <package>mahara-apps</package>
            <service servicelist="mahara" method="apache">mahara</service>
            <file filelist='mahara' name='/var/www/html/mahara/config.php' source ='mahara-config.php'  rm='True'/>
            <file filelist='mahara' name='/etc/apache2/sites-available/mahara' source ='mahara-apache.conf' rm='True'/>
        </container>
    </containers>
    <variables>
        <family name='applications web'>
            <variable name='activer_mahara' type='oui/non' description='Activer Mahara (eportfolio)'>
                <value>oui</value>
            </variable>
        </family>
        <family name='EoleDB' icon='database' mode='expert'>
            <variable type='string' name='mahara_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='mahara_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='mahara_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='mahara_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='mahara_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='mahara_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>    

        <separators>
            <separator name="mahara_db_mode">Paramètres EoleDB associés à Mahara</separator>
        </separators>             
    </variables>
    <constraints>
        <condition name='hidden_if_in' source='activer_mahara'>
            <param>non</param>
            <target type='filelist'>mahara</target>
            <target type='servicelist'>mahara</target>
        </condition>

        <check name='valid_enum' target='mahara_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='mahara_db_mode'>
            <param>local</param>
            <target type='variable'>mahara_dbserver</target>
            <target type='variable'>mahara_dbuser</target>
            <target type='variable'>mahara_dbport</target>
            <target type='variable'>mahara_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='mahara_db_mode'>
            <param>default</param>
            <target type='variable'>mahara_dbserver</target>
            <target type='variable'>mahara_dbuser</target>
            <target type='variable'>mahara_dbport</target>
            <target type='variable'>mahara_dbpass</target>
            <target type='variable'>mahara_allow_hosts</target>
        </condition>        
    </constraints>
    <help>
        <variable name='activer_mahara'>Mahara est un portefolio</variable>
    </help>
</creole>
