<commit_before><script type="text/javascript">
    /*
     * fonctions permettant de definir les champs qui doivent figurer dans
     *  un formulaire de saisie des metadonnees
     *
     */

    //variable pour pouvoir trouver à quel champ on ajoute les données
    var idChamp;

    function setChoiceList( file ) {
        confirmed = true;
        if ( file.length > 50 ) {
            confirmed = confirm( "{t}Ce fichier contient plus de 50 entrées. Etes-vous sûr de vouloir l'importer ?{/t}" );
        }
        if ( confirmed ) {
            var numChild;
            //on retrouve le bon champ pour importer les données
            for ( var i = 0; i < $( "#metadata" ).alpaca()[ "children" ].length; i++ ) {
                if ( $( "#metadata" ).alpaca()[ "children" ][ i ][ "id" ] == idChamp ) {
                    numChild = i;
                }
            }
            value = $( "#metadata" ).alpaca().getValue();
            value[ numChild ][ "choiceList" ] = file;
            $( "#metadata" ).alpaca( "destroy" );
            renderForm( value );
        }
    }


    function renderForm( data ) {
        $( "#metadata" ).alpaca( {
            "data": data,
            "view": "bootstrap-edit-horizontal",
            "schema": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "title": "{t}Nom du champ (sans espace, sans accent, en minuscule){/t}",
                            "type": "string",
                            "required": true
                        },
                        "type": {
                            "title": "{t}Type du champ{/t}",
                            "type": "string",
                            "required": true,
                            "enum": [ "number", "string", "textarea", "checkbox", "select", "radio", "url" ],
                            "default": "string"
                        },
                        "importFile": {
                            "type": "string",
                            "format": "uri"
                        },
                        "multiple": {
                            "type": "string",
                            "default":"no",
                            "enum": ["yes", "no"],
                            "title": "{t}Sélection multiple possible ?{/t}"
                        },
                        "choiceList": {
                            "title": "{t}Choix possibles{/t}",
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "isSearchable": {
                            "type": "string",
                            "default": "no",
                            "enum": [ "yes", "no" ],
                            "title": "{t}champ utilisé pour rechercher un échantillon ?{/t}"
                        },
                        "required": {
                            "title": "{t}Le champ est-il obligatoire ?{/t}"
                        },
                        "defaultValue": {
                            "title": "{t}Valeur par défaut{/t}"
                        },
                        "helperChoice": {
                            "title": "{t}Affichage d'un message d'aide ?{/t}"
                        },
                        "helper": {
                            "type": "string",
                            "title": "{t}Message d'aide{/t}"
                        },
                        "description": {
                            "title": "{t}Description du champ{/t}",
                            "type": "string",
                            "required": true
                        },
                        "measureUnit": {
                            "title": "{t}Unité de mesure (ou modalités) - N/A si non applicable{/t}",
                            "type": "string",
                            "required": true,
                            "default": "N/A"
                        }
                    },
                    "dependencies": {
                        "importFile": [ "type" ],
                        "choiceList": [ "type" ],
                        "helper": [ "helperChoice" ],
                        "multiple": [ "type" ]
                    },
                }
            },
            "options": {
                "items": {
                    "fields": {
                        "type": {
                            "optionLabels": [ "{t}Nombre{/t}", "{t}Texte (une ligne){/t}", "{t}Texte (multi-ligne){/t}", "{t}Case à cocher{/t}", "{t}Liste à choix multiple{/t}", "{t}Boutons Radio{/t}", "{t}Lien vers un site externe (URL){/t}" ],
                            "type": "select",
                            "hideNone": true,
                            "sort": function ( a, b ) {
                                return 0;<commit_msg>:feat metadata: ajout d'un champ array pour saisir des valeurs multiples<commit_after><script type="text/javascript">
    /*
     * fonctions permettant de definir les champs qui doivent figurer dans
     *  un formulaire de saisie des metadonnees
     *
     */

    //variable pour pouvoir trouver à quel champ on ajoute les données
    var idChamp;

    function setChoiceList( file ) {
        confirmed = true;
        if ( file.length > 50 ) {
            confirmed = confirm( "{t}Ce fichier contient plus de 50 entrées. Etes-vous sûr de vouloir l'importer ?{/t}" );
        }
        if ( confirmed ) {
            var numChild;
            //on retrouve le bon champ pour importer les données
            for ( var i = 0; i < $( "#metadata" ).alpaca()[ "children" ].length; i++ ) {
                if ( $( "#metadata" ).alpaca()[ "children" ][ i ][ "id" ] == idChamp ) {
                    numChild = i;
                }
            }
            value = $( "#metadata" ).alpaca().getValue();
            value[ numChild ][ "choiceList" ] = file;
            $( "#metadata" ).alpaca( "destroy" );
            renderForm( value );
        }
    }


    function renderForm( data ) {
        $( "#metadata" ).alpaca( {
            "data": data,
            "view": "bootstrap-edit-horizontal",
            "schema": {
                "type": "array",
                "items": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "title": "{t}Nom du champ (sans espace, sans accent, en minuscule){/t}",
                            "type": "string",
                            "required": true
                        },
                        "type": {
                            "title": "{t}Type du champ{/t}",
                            "type": "string",
                            "required": true,
                            "enum": [ "number", "string", "textarea", "checkbox", "select", "radio", "url", "array" ],
                            "default": "string"
                        },
                        "importFile": {
                            "type": "string",
                            "format": "uri"
                        },
                        "multiple": {
                            "type": "string",
                            "default":"no",
                            "enum": ["yes", "no"],
                            "title": "{t}Sélection multiple possible ?{/t}"
                        },
                        "choiceList": {
                            "title": "{t}Choix possibles{/t}",
                            "type": "array",
                            "items": {
                                "type": "string"
                            }
                        },
                        "isSearchable": {
                            "type": "string",
                            "default": "no",
                            "enum": [ "yes", "no" ],
                            "title": "{t}champ utilisé pour rechercher un échantillon ?{/t}"
                        },
                        "required": {
                            "title": "{t}Le champ est-il obligatoire ?{/t}"
                        },
                        "defaultValue": {
                            "title": "{t}Valeur par défaut{/t}"
                        },
                        "helperChoice": {
                            "title": "{t}Affichage d'un message d'aide ?{/t}"
                        },
                        "helper": {
                            "type": "string",
                            "title": "{t}Message d'aide{/t}"
                        },
                        "description": {
                            "title": "{t}Description du champ{/t}",
                            "type": "string",
                            "required": true
                        },
                        "measureUnit": {
                            "title": "{t}Unité de mesure (ou modalités) - N/A si non applicable{/t}",
                            "type": "string",
                            "required": true,
                            "default": "N/A"
                        }
                    },
                    "dependencies": {
                        "importFile": [ "type" ],
                        "choiceList": [ "type" ],
                        "helper": [ "helperChoice" ],
                        "multiple": [ "type" ]
                    },
                }
            },
            "options": {
                "items": {
                    "fields": {
                        "type": {
                            "optionLabels": [ "{t}Nombre{/t}", "{t}Texte (une ligne){/t}", "{t}Texte (multi-ligne){/t}", "{t}Case à cocher{/t}", "{t}Liste à choix multiple{/t}", "{t}Boutons Radio{/t}", "{t}Lien vers un site externe (URL){/t}", "{t}Valeurs multiples{/t}" ],
                            "type": "select",
                            "hideNone": true,
                            "sort": function ( a, b ) {
                                return 0;
{'fraction_non_alphanumeric': 0.13628353240650087, 'fraction_numerical': 0.0011748580379870766, 'mean_word_length': 0.8468631350569518, 'pattern_counts': {'":': 132, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1999956', 'n_tokens_mistral': 2550, 'n_tokens_neox': 2430, 'n_words': 584}