<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
        <file filelist='balado' name='/usr/share/eole/db/balado/gen/balado-create-1.sql' mkdir='True' rm='True'/>
        <file filelist='balado' name='/usr/share/eole/db/balado/updates/balado-update-1.sql' mkdir='True' rm='True'/>
        <file filelist='balado' name='/etc/eole/eole-db.d/balado-db.yml' rm='True' mkdir='True'/>
        <file filelist='balado-bareos' name='/etc/bareos/bareosfichiers.d/balado.conf' source='balado-bareos.conf' rm='True'/>
    </files>

	<containers>
        <container name='web'>
            <package>balado-apps</package>
			<!-- service de configuration apache -->
			<service method="apache" servicelist="balado">balado</service>

			<!-- template -->
			<file filelist='balado' name='/etc/apache2/sites-available/balado' source='balado-apache.conf' />
            <file filelist='balado' name='/var/www/html/balado/index.php' source='balado-index.php' rm='True'/>
			<file filelist='balado' name='/var/www/html/balado/rest/config/config.php' source='balado-config.php' rm='True'/>
            <file filelist='balado' name='/var/www/html/balado/app/config/constantes.js' source='balado-constantes.js' rm='True'/>
			<file filelist='balado' name='/var/www/html/posh-profil/include/balado.php' source='balado-synchro.php' rm='True'/>
		</container>
	</containers>

	<variables>
        <family name='applications web'>
			<variable name='activer_balado' type='oui/non' description='Activer Balado'>
				<value>oui</value>
			</variable>
			<!-- Permet d'activer php_browscap mais attention, la contrainte auto doit être définie plus bas -->
			<variable name='php_browscap' redefine='True' hidden='True'/>
		</family>

        <family name='balado' mode='expert'>
            <variable type='string' name='balado_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='balado_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='balado_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='balado_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='balado_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='balado_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'>balado</target>
            <target type='filelist'>balado-bareos</target>
            <target type='servicelist'>balado</target>
        </condition>

		<condition name='hidden_if_in' source='activer_balado'>
			<param>non</param>
			<target type='filelist'>balado</target>
			<target type='filelist'>balado-bareos</target>
			<target type='servicelist'>balado</target>
		</condition>

        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>balado-bareos</target>
		</condition>

        <check name='valid_enum' target='balado_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='balado_db_mode'>
            <param>local</param>
            <target type='variable'>balado_dbserver</target>
            <target type='variable'>balado_dbuser</target>
            <target type='variable'>balado_dbport</target>
            <target type='variable'>balado_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='balado_db_mode'>
            <param>default</param>
            <target type='variable'>balado_dbserver</target>
            <target type='variable'>balado_dbuser</target>
            <target type='variable'>balado_dbport</target>
            <target type='variable'>balado_dbpass</target>
            <target type='variable'>balado_allow_hosts</target>
        </condition>


		<!-- Permet d'activer php_browscap de force en Eole 2.3 (prise en charge redéfinition de la variable php_browscap) -->
		<auto name='calc_val' target='php_browscap'>
			<param name='valeur'>oui</param>
		</auto>
	</constraints>
	<help>
		<variable name='activer_balado'>Outils de diffusion audio</variable>
	</help>
</creole>
