From 299bb3807462342fc77eae29ce360c0a72b43a27 Mon Sep 17 00:00:00 2001
From: "maieul@maieul.net" <>
Date: Sun, 11 Dec 2016 21:03:35 +0000
Subject: [PATCH] =?UTF-8?q?un=20.yaml=20pour=20la=20v=C3=A9rification=20de?=
 =?UTF-8?q?=20fichiers?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .gitattributes         |  1 +
 lang/verifier_fr.php   | 12 ++++++++++
 verifier/fichiers.yaml | 53 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 66 insertions(+)
 create mode 100644 verifier/fichiers.yaml

diff --git a/.gitattributes b/.gitattributes
index 91f7a24..054b8ca 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -46,6 +46,7 @@ verifier/email.yaml -text
 verifier/entier.php -text
 verifier/entier.yaml -text
 verifier/fichiers.php -text
+verifier/fichiers.yaml -text
 verifier/id_document.php -text
 verifier/id_document.yaml -text
 verifier/id_objet.php -text
diff --git a/lang/verifier_fr.php b/lang/verifier_fr.php
index 254523e..4890030 100644
--- a/lang/verifier_fr.php
+++ b/lang/verifier_fr.php
@@ -88,6 +88,16 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
 	'option_email_mode_strict' => 'Vérification moins permissive',
 	'option_entier_max_label' => 'Valeur maximum',
 	'option_entier_min_label' => 'Valeur minimum',
+	'option_fichiers_dimension_autoriser_rotation_label' => 'Tenir compte d\'une rotation de l\'image ?', 
+	'option_fichiers_dimension_autoriser_rotation_label_case' => 'Cocher cette case pour pouvoir intervertir largeur et hauteur maximum', 
+	'option_fichiers_hauteur_max_label' => 'Hauteur maximum de l\'image (en px)', 
+	'option_fichiers_largeur_max_label' => 'Largeur maximum de l\'image (en px)', 
+	'option_fichiers_mime_label' => 'Type Mime',
+	'option_fichiers_mime_image_web_label' => 'Image web (gif, jpg, png)',
+	'option_fichiers_mime_specifique_label' => 'Un type Mime précisé ci-dessous',
+	'option_fichiers_mime_tout_mime_label' => 'Tous les types Mime autorisés par SPIP',
+	'option_fichiers_taille_max_label' => 'Poids maximum du fichier (en kio)',
+	'option_fichiers_type_mime_label' => 'Cocher les types MIME autorisés', 
 	'option_id_objet_objet_label' => 'Nom de l’objet (au singulier)',
 	'option_regex_modele_label' => 'La valeur doit correspondre au masque suivant',
 	'option_siren_siret_mode_label' => 'Que voulez-vous vérifier ?',
@@ -125,6 +135,8 @@ $GLOBALS[$GLOBALS['idx_lang']] = array(
 	'type_email_disponible_description' => 'Vérifie que l’adresse de courriel n’est pas déjà utilisé par un autre utilisateur du système.',
 	'type_entier' => 'Nombre entier',
 	'type_entier_description' => 'Vérifie que la valeur est un entier, avec la possibilité de restreindre entre deux valeurs.',
+	'type_fichiers' => 'Propriétés de fichier',
+	'type_fichiers_description' => 'Pour chaque fichier chargé, vérifier certaines propriétés',
 	'type_id_document' => 'Numéro d’un document',
 	'type_id_document_description' => 'Vérifie que la valeur correspond à un numéro de document existant.',
 	'type_id_objet' => 'Numéro d’un objet',
diff --git a/verifier/fichiers.yaml b/verifier/fichiers.yaml
new file mode 100644
index 0000000..966369c
--- /dev/null
+++ b/verifier/fichiers.yaml
@@ -0,0 +1,53 @@
+
+titre: '<:verifier:type_fichiers:>'
+description: '<:verifier:type_fichiers_descriptions>:'
+options:
+  -
+    saisie: 'radio'
+    options:
+      nom: 'mime'
+      label: '<:verifier:option_fichiers_mime_label:>'
+      datas:
+        tout_mime: '<:verifier:option_fichiers_mime_tout_mime_label:>'
+        image_web: '<:verifier:option_fichiers_mime_image_web_label:>'
+        specifique: '<:verifier:option_fichiers_mime_specifique_label:>'
+      defaut: 'tout_mime'
+  - 
+    saisie: 'input'
+    options:
+      nom: 'taille_max'
+      label: '<:verifier:option_fichiers_taille_max_label:>'
+    verifier:
+      type: 'entier'
+      options:
+        min: 0
+  -  
+    saisie: 'input'
+    options:
+      nom: 'largeur_max'
+      label: '<:verifier:option_fichiers_largeur_max_label:>'
+    verifier:
+      type: 'entier'
+      options:
+        min: 0
+  -  
+    saisie: 'input'
+    options:
+      nom: 'hauteur_max'
+      label: '<:verifier:option_fichiers_hauteur_max_label:>'
+    verifier:
+      type: 'entier'
+      options:
+        min: 0
+  -  
+    saisie: 'case'
+    options:
+      nom: 'dimension_autoriser_rotation'
+      label: '<:verifier:option_fichiers_dimension_autoriser_rotation_label:>'
+      label_case: '<:verifier:option_fichiers_dimension_autoriser_rotation_label_case:>'
+      value: 'on'
+  -
+    saisie: 'type_mime'
+    options:
+      nom: 'mime_specifique'
+      label: '<:verifier:option_fichiers_type_mime_label:>'
-- 
GitLab