<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <!-- bareos -->
        <file filelist='gepi-bareos' name='/etc/bareos/bareosfichiers.d/gepi.conf' source='gepi-bareos.conf' rm='True'/>
        <file filelist='gepi' name='/usr/share/eole/db/gepi/updates/gepi-update-1.sql' rm='True' mkdir='True'/>
        <file filelist='gepi' name='/etc/eole/eole-db.d/gepi-db.yml' rm='True' mkdir='True'/>
    </files>
    
    <containers>
        <container name='web'>
            <package>gepi-apps</package>
            <file filelist='gepi' name='/etc/apache2/sites-available/gepi' source='gepi-apache.conf'/>
            <file filelist='gepi' name='/var/www/html/gepi/secure/config_cas.inc.php'  source='gepi-config_cas.inc.php'  rm='True'/>
            <file filelist='gepi' name='/var/www/html/gepi/secure/config_ldap.inc.php' source='gepi-config_ldap.inc.php' rm='True'/>
            <file filelist='gepi' name='/var/www/html/gepi/secure/connect.inc.php'     source='gepi-connect.inc.php'     rm='True'/>
            <file filelist='gepi' name='/var/www/html/gepi/utilitaires/envole.sh'      source='gepi-envole.sh'           rm='True' mode='700'/>
            <service method="apache" servicelist="gepi">gepi</service>
        </container>
    </containers>
    
    <variables>
        <family name='applications web'>
            <variable name='activer_gepi' type='oui/non' description='Activer Gepi (gestion de vie scolaire)'>
                <value>oui</value>
            </variable>
        </family>

        <family name='gepi' mode='expert'>
            <variable type='string' name='gepi_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='gepi_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='gepi_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='gepi_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='gepi_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='gepi_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>        
    </variables>
    
    <constraints>
        <condition name='hidden_if_in' source='activer_gepi'>
            <param>non</param>
            <target type='filelist'>gepi</target>
            <target type='filelist'>gepi-bareos</target>
            <target type='servicelist'>gepi</target>
        </condition>
        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='filelist'>gepi</target>
            <target type='filelist'>gepi-bareos</target>
            <target type='servicelist'>gepi</target>
        </condition>
        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>gepi-bareos</target>    
        </condition>

        <check name='valid_enum' target='gepi_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='gepi_db_mode'>
            <param>local</param>
            <target type='variable'>gepi_dbserver</target>
            <target type='variable'>gepi_dbuser</target>
            <target type='variable'>gepi_dbport</target>
            <target type='variable'>gepi_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='gepi_db_mode'>
            <param>default</param>
            <target type='variable'>gepi_dbserver</target>
            <target type='variable'>gepi_dbuser</target>
            <target type='variable'>gepi_dbport</target>
            <target type='variable'>gepi_dbpass</target>
            <target type='variable'>gepi_allow_hosts</target>
        </condition>        
    </constraints>
    
    <help>
        <variable name='activer_gepi'>Gepi est un outil de gestion des notes, des absences et des cahiers de texte</variable>
    </help>
</creole>
