<?xml version='1.0' encoding='utf-8'?>

<creole>
    <containers>
        <container name='web'>
            <package>sondepiwik-apps</package>

            <!-- services de configuration apache -->
            <service method='apache' servicelist='sondepiwikdnma'>sondepiwik</service>

            <!-- fichier de configuration de apache et php -->
            <file filelist='sondepiwikdnma' name='/etc/apache2/sites-available/sondepiwik' source='sondepiwik-apache.conf'/>

            <!-- Configuration du trackeur sondepiwik pour envole -->
            <file filelist='sondepiwikdnma' name='/var/www/html/sondepiwik/envoleTrackeur.js.php' source='sondepiwik-envoleTrackeur.js.php' rm='True'/>
         </container>
    </containers>

    <variables>
        <family name='statistiques' icon='signal'>
            <variable name="activer_piwik" type="oui/non" description="Activer Piwik" hidden='True' exists='False'>
                <value>non</value>
            </variable>
        </family>
           
        <family name='sonde statistique' icon='signal'>
            <!-- Activation soit sonde local soit sonde DNMA -->
            <variable name='sonde_test_piwikdnma' type='oui/non' hidden='True'/>

            <!-- Sonde vers le piwik Local -->
            <variable name="activer_sondepiwik_local" type="oui/non" description="Activer la connexion au serveur de statistiques local">
                <value>non</value>
            </variable>
            <variable name='sondepiwik_local' type='string' description="Adresse vers l'application piwik local" hidden='True' mandatory='True'>
                <value></value>
            </variable>
            <variable name='sondepiwik_idsite' type='number' description="Id du serveur piwik local" hidden='True' mandatory='True'>
                <value>1</value>
            </variable>

            <!-- Activation DNMA -->
            <variable name='activer_sondednma' type='oui/non' description='Activer Sonde DNMA'>
                <value>non</value>
            </variable>
            <variable name='sondednma_projet' type='string' description='Ancien Code Projet DNMA' hidden='True' mode='expert' />
            <variable name='sondednma_codeprojet' type='string' description='Code Projet DNMA' mandatory='True' />
            <variable name='sondednma_collectivite' type='string' description='Code Collectivite DNMA' mandatory='True' />
            <variable name='sondednma_uai' type='string' description='Code Etab UIA DNMA' mandatory='True' />

            <!-- Variables à définir si activer_stats_acad ou activer_stats_nat est à oui -->
            <variable name='sonde_adresse_postale' type='string' description='Adresse postale'/>
            <variable name='sonde_code_postal' type='string' description='Code postal'/>
            <variable name='sonde_ville' type='string' description='Ville'/>
            <variable name='sonde_pays' type='string' description='Pays'>
                <value>France</value>
            </variable>
            <variable name='sonde_nature_etab' type='string' description='Type de serveur'>
                <value>école</value>
            </variable>
            <variable name='sonde_nature_serveur' type='string' description='Nature de serveur'>
                <value>production</value>
            </variable>
            <variable name='sonde_fonction_serveur' type='string' description='Fonction du serveur'>
                <value>ENT</value>
            </variable>
        </family>

        <separators>
            <separator name='activer_sondepiwik_loc'>Gestion des statistiques</separator>
            <separator name='activer_sondednma'>Sonde DNMA</separator>
            <separator name='sonde_adresse_postale'>Infos statistiques</separator>
        </separators>
    </variables>
    
    <constraints>
        <check name='valid_enum' target='sonde_nature_etab'>
             <param>['école', 'collège', 'lycée', 'supérieur', 'autre_etab', 'rectorat', 'dsden', 'entreprise', 'autre']</param>
        </check>
        
        <check name='valid_enum' target='sonde_nature_serveur'>
             <param>['production', 'recette', 'développement']</param>
        </check>
        
        <check name='valid_enum' target='sonde_fonction_serveur'>
             <param>['ENT', 'PIA']</param>
        </check>

        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='family'>sonde statistique</target>
        </condition>

        <condition name='hidden_if_in' source='activer_piwik'>
            <param>oui</param>
            <target type='family'>sonde statistique</target>
        </condition>
        
        <condition name='hidden_if_in' source='sonde_test_piwikdnma'>
            <param>non</param>          
            <target type='filelist'>sondepiwikdnma</target>
            <target type='servicelist'>sondepiwikdnma</target>
        </condition>

        <condition name='hidden_if_in' source='activer_sondepiwik_local'>
            <param>non</param>
            <target type='variable'>sondepiwik_local</target>
            <target type='variable'>sondepiwik_idsite</target>
        </condition>

        <condition name='hidden_if_in' source='sonde_test_piwikdnma'>
            <param>non</param>
            <target type='variable'>sonde_adresse_postale</target>
            <target type='variable'>sonde_code_postal</target>
            <target type='variable'>sonde_ville</target>
            <target type='variable'>sonde_pays</target>
            <target type='variable'>sonde_nature_etab</target>
            <target type='variable'>sonde_nature_serveur</target>
            <target type='variable'>sonde_fonction_serveur</target>
        </condition>

        <condition name='hidden_if_in' source='activer_sondednma'>
            <param>non</param>
            <target type='variable'>sondednma_projet</target>
            <target type='variable'>sondednma_codeprojet</target>
            <target type='variable'>sondednma_collectivite</target>
            <target type='variable'>sondednma_uai</target>
        </condition>


        <fill name='calc_multi_condition' target='sondednma_codeprojet'>
            <param>56</param>
            <param type='eole' name='condition_1' hidden='False'>sondednma_projet</param>
            <param name='match'>ICART</param>
            <param name='default_mismatch'>None</param>
        </fill>

        <fill name='calc_val' target='sondednma_uai'>
            <param type='eole' name='valeur'>numero_etab</param>
        </fill>

    </constraints>


    <help>
        <variable name='activer_sondepiwik_local'>Activer la connexion au serveur de statistiques local.</variable>
        <variable name='sonde_code_postal'>Code postal de la ville où se situe l'établissement.</variable>
        <variable name='sonde_nature_etab'>Type d'établissement scolaire ou autre.</variable>
        <variable name='sonde_nature_serveur'>Type d'utilisation du serveur.</variable>
    </help>
</creole>
