<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <file filelist='grr' name='/etc/eole/eole-db.d/grr-db.yml' rm='True' mkdir='True'/>
		<file filelist='grr' name='/usr/share/eole/db/grr/gen/grr-create-0.sql' rm='True' mkdir='True'/>
        <file filelist='grr' name='/usr/share/eole/db/grr/updates/grr-update-1.sql' rm='True' mkdir='True'/>
		<file filelist='grr-bareos' name='/etc/bareos/bareosfichiers.d/grr.conf' source='grr-bareos.conf' rm='True'/>
   </files>	
	
    <containers>
        <container name='web'>
            <package>grr-apps</package>
            
            <!-- services de configuration apache -->
            <service method="apache" servicelist="grr">grr</service>
            
            <!-- fichier de configuration de apache -->
            <file filelist='grr' name='/etc/apache2/sites-available/grr' source='grr-apache.conf'/>
            
			<!-- fichier de configuration de l'application php -->
            <file filelist='grr' name='/var/www/html/grr/include/connect.inc.php' source="grr-connect.inc.php" rm='True'/>
            <file filelist='grr' name='/var/www/html/grr/postservice.sh' source='grr-postservice.sh' rm='True' mkdir='True' mode='700' />
        </container>
    </containers>
    
    <variables>
        <family name='applications web'>
            <variable name='activer_grr' type='oui/non' description='Activer Grr (gestionnaire de ressources)'>
                <value>oui</value>
            </variable>
        </family>

        <family name='grr' mode='expert'>
            <variable type='string' name='grr_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='grr_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='grr_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='grr_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='grr_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='grr_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'>grr</target>
            <target type='filelist'>grr-bareos</target>
            <target type='servicelist'>grr</target>
        </condition>	
        
        <condition name='hidden_if_in' source='activer_grr'>
            <param>non</param>
            <target type='filelist'>grr</target>
            <target type='filelist'>grr-bareos</target>
            <target type='servicelist'>grr</target>
        </condition>

        <check name='valid_enum' target='grr_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='grr_db_mode'>
            <param>local</param>
            <target type='variable'>grr_dbserver</target>
            <target type='variable'>grr_dbuser</target>
            <target type='variable'>grr_dbport</target>
            <target type='variable'>grr_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='grr_db_mode'>
            <param>default</param>
            <target type='variable'>grr_dbserver</target>
            <target type='variable'>grr_dbuser</target>
            <target type='variable'>grr_dbport</target>
            <target type='variable'>grr_dbpass</target>
            <target type='variable'>grr_allow_hosts</target>
        </condition>
        
        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>grr-bareos</target>			
		</condition>            
    </constraints>
    <help>
        <variable name='activer_grr'>Grr est un un outil de gestion de réservation de salles et de matériels</variable>
    </help>
</creole>
