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

            <service method="apache" servicelist="owncloud">owncloud</service>

            <file filelist='owncloud' name='/etc/apache2/sites-available/owncloud' source='owncloud-apache.conf' rm='True'/>
            <file filelist='owncloud' name='/var/www/html/owncloud/config/config.php' source='owncloud-config.php' rm='True' mkdir='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-7.0.2/config/config.php' source='owncloud-config-7.0.2.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-7.0.12/config/config.php' source='owncloud-config-7.0.12.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-8.0.10/config/config.php' source='owncloud-config-8.0.10.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-8.1.5/config/config.php' source='owncloud-config-8.1.5.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-8.2.2/config/config.php' source='owncloud-config-8.2.2.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-9.0.2/config/config.php' source='owncloud-config-9.0.2.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/html/owncloud/apps/calendar/lib/envole.php' source='owncloud-envole.php' rm='True' mkdir='True'/>
            <file filelist='owncloud' name='/var/www/owncloud/owncloud-8.2.2/apps/calendar/lib/envole.php' source='owncloud-envole.php' rm='True'/>
            <file filelist='owncloud' name='/var/www/html/posh-profil/include/owncloud.php' source='owncloud-synchro.php' rm='True'/>
            <file filelist='owncloud' name='/etc/cron.d/owncloud' source='owncloud.cron' rm='True'/>
        </container>
    </containers>

    <variables>
        <family name='applications web'>
            <variable name='activer_owncloud' type='oui/non' description='Activer ownCloud (gestionnaire de fichiers)'>
                <value>oui</value>
            </variable>
            <variable name='owncloud_postsize' type='string' description='Taille max. des téléversements dans owncloud (en Mo)'>
                <value>32</value>
            </variable>
        </family>

        <family name='owncloud' mode='expert'>
            <variable type='string' name='owncloud_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='owncloud_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='owncloud_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='owncloud_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='owncloud_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='owncloud_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'>owncloud</target>
            <target type='filelist'>owncloud-bareos</target>
            <target type='servicelist'>owncloud</target>
        </condition>

        <condition name='hidden_if_in' source='activer_owncloud'>
            <param>non</param>
            <target type='filelist'>owncloud</target>
            <target type='filelist'>owncloud-bareos</target>
            <target type='servicelist'>owncloud</target>
            <target type='variable'>owncloud_postsize</target>
        </condition>


        <check name='valid_enum' target='owncloud_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='owncloud_db_mode'>
            <param>local</param>
            <target type='variable'>owncloud_dbserver</target>
            <target type='variable'>owncloud_dbuser</target>
            <target type='variable'>owncloud_dbport</target>
            <target type='variable'>owncloud_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='owncloud_db_mode'>
            <param>default</param>
            <target type='variable'>owncloud_dbserver</target>
            <target type='variable'>owncloud_dbuser</target>
            <target type='variable'>owncloud_dbport</target>
            <target type='variable'>owncloud_dbpass</target>
            <target type='variable'>owncloud_allow_hosts</target>
        </condition>

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

    <help>
        <variable name='activer_owncloud'>ownCloud vous donne un accès universel a vos fichiers via une interface web ou WebDAV</variable>
    </help>
</creole>
