<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
		<!-- service de sauvegarde bareos -->
		<file filelist='cdt-bareos' name='/etc/bareos/bareosfichiers.d/cdt.conf' source='cdt-bareos.conf' rm='True'/>
		
		<!-- fichier de création de la base SQL -->
        <file filelist='cdt' name='/etc/eole/eole-db.d/cdt-db.yml' rm='True' mkdir='True'/>
        <file filelist='cdt' name='/usr/share/envole/eoledb/cdt' source='cdt.db' rm='True' mkdir='True'/>
		<file filelist='cdt' name='/usr/share/eole/db/cdt/gen/cdt-create-0.sql' rm='True' mkdir='True'/>
        <file filelist='cdt' name='/usr/share/eole/db/cdt/updates/cdt-update-0.sql' rm='True' mkdir='True'/>
    </files>
    
    <containers>
        <container name='web'>
            <package>cdt-apps</package>
            
            <!-- services de configuration apache -->
            <service method="apache" servicelist="cdt">cdt</service>
            
            <!-- fichier de configuration de apache -->
            <file filelist='cdt' name='/etc/apache2/sites-available/cdt' source='cdt-apache.conf'/>
            
			<!-- fichier de configuration de l'application php -->
			<file filelist='cdt' name='/var/www/html/cdt/Connections/conn_cahier_de_texte.php' source="cdt-conf.php" rm='True'/>
            <file filelist='cdt' name='/var/www/html/posh-profil/include/cdt.php' source='cdt-synchro.php' rm='True'/>
        </container>
    </containers>
    
    <variables>
        <family name='applications web'>
            <variable name='activer_cdt' type='oui/non' description='Activer Cdt (cahier de textes)'>
                <value>oui</value>
            </variable>
        </family>

        <family name='EoleDB' icon='database' mode='expert'>
            <variable type='string' name='cdt_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='cdt_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='cdt_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='cdt_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='cdt_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='cdt_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>	

        <separators>
            <separator name="cdt_db_mode">Paramètres EoleDB associés à CdT</separator>
        </separators>        
    </variables>
    
    <constraints>
        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='filelist'>cdt</target>
            <target type='filelist'>cdt-bareos</target>
            <target type='servicelist'>cdt</target>
        </condition>
        		
        <condition name='hidden_if_in' source='activer_cdt'>
            <param>non</param>
            <target type='filelist'>cdt</target>
            <target type='filelist'>cdt-bareos</target>
            <target type='servicelist'>cdt</target>
        </condition>

        <check name='valid_enum' target='cdt_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='cdt_db_mode'>
            <param>local</param>
            <target type='variable'>cdt_dbserver</target>
            <target type='variable'>cdt_dbuser</target>
            <target type='variable'>cdt_dbport</target>
            <target type='variable'>cdt_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='cdt_db_mode'>
            <param>default</param>
            <target type='variable'>cdt_dbserver</target>
            <target type='variable'>cdt_dbuser</target>
            <target type='variable'>cdt_dbport</target>
            <target type='variable'>cdt_dbpass</target>
            <target type='variable'>cdt_allow_hosts</target>
        </condition>
        
        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>cdt-bareos</target>			
		</condition>
    </constraints>
    
    <help>
        <variable name='activer_cdt'>Cdt est un cahier de textes numérique</variable>
    </help>

</creole>
