From f174e3252d7485692d88af255b1335d013e7c4c9 Mon Sep 17 00:00:00 2001 From: Sofian pujo <sofian.pujo@veremes.com> Date: Fri, 9 Nov 2018 14:32:36 +0100 Subject: [PATCH] Ajout des configurations --- ..._vitis_configuration_extractionConfig.json | 1 + .../module/javascript/script_module.js | 21 +++++++++ .../module/lang/lang-fr.json | 10 +++-- .../web_service/conf/properties.inc | 6 ++- .../web_service/conf/properties_server.inc | 3 ++ .../web_service/conf/selected_properties.inc | 18 ++++++++ .../web_service/conf/version.inc | 4 +- .../web_service/ws/Extractions.class.inc | 43 +++++++++++++------ 8 files changed, 87 insertions(+), 19 deletions(-) create mode 100644 src/module_extraction/module/forms/configuration/configuration_vitis_configuration_extractionConfig.json create mode 100644 src/module_extraction/web_service/conf/properties_server.inc create mode 100644 src/module_extraction/web_service/conf/selected_properties.inc diff --git a/src/module_extraction/module/forms/configuration/configuration_vitis_configuration_extractionConfig.json b/src/module_extraction/module/forms/configuration/configuration_vitis_configuration_extractionConfig.json new file mode 100644 index 00000000..f25d20c9 --- /dev/null +++ b/src/module_extraction/module/forms/configuration/configuration_vitis_configuration_extractionConfig.json @@ -0,0 +1 @@ +{"insert":{"rows":[],"tabs":{"position":"top","list":[{"label":"Tab 0","elements":[]}]}},"search":{"rows":[]},"display":{"rows":[]},"update":{"name":"configuration_extraction_module-form","title":"","input_size":"xxs","nb_cols":7,"javascript":false,"rows":[{"fields":[{"name":"color_mutualized","type":"text","label":"CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_MUTUALIZED","nb_cols":12,"id":"color_mutualized","default_value":"green"}]},{"fields":[{"name":"color_no_mutualized","type":"text","label":"CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_NO_MUTUALIZED","nb_cols":12,"id":"color_no_mutualized","default_value":"red"}]},{"fields":[{"name":"sig","type":"text","label":"CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_SIG","nb_cols":12,"id":"sig","default_value":"*.shp|*.*"}]},{"fields":[{"name":"dao","type":"text","label":"CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_DAO","nb_cols":12,"id":"dao","default_value":"*.dao"}]},{"fields":[{"type":"button","name":"form_submit","class":"btn-ungroup btn-group-sm","nb_cols":12,"buttons":[{"type":"submit","name":"form_submit","label":"FORM_UPDATE","class":"btn-primary"}],"id":"form_submit_6_1"}]}],"event":"updateProperties('extraction')","afterEvent":"editSectionForm()","tabs":{"position":"top","list":[{"label":"Tab 0","elements":["color_mutualized","color_no_mutualized","sig","dao","form_submit"]}]}},"datasources":{}} \ No newline at end of file diff --git a/src/module_extraction/module/javascript/script_module.js b/src/module_extraction/module/javascript/script_module.js index a654272f..db7ca4c3 100755 --- a/src/module_extraction/module/javascript/script_module.js +++ b/src/module_extraction/module/javascript/script_module.js @@ -24,6 +24,27 @@ vitisApp.on('appMainDrtvLoaded', function () { formScope["sendForm"](); } }; + + /** + * loadExtractionConfig function. + * Chargement de la section "Configuration EXTRACTION" dans l''''onglet "Configuration". + * @expose + */ + angular.element(vitisApp.appMainDrtv).scope()["loadExtractionConfig"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var envSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["envSrvc"]); + // + $log.info("loadExtractionConfig"); + // Paramètres des properties dans les valeurs du formulaire de config de Extraction. + angular.element(vitisApp.appMainDrtv).scope()["setPropertiesFormValues"](); + // Surcharge l''''url du formulaire des properties de Extraction. + var scope = this; + var sTable = envSrvc["oSelectedObject"]["name"]; + scope["oFormRequestParams"] = { + "sUrl": "modules/extraction/forms/" + envSrvc["oSelectedMode"]["mode_id"] + "/" + sTable + "_" + envSrvc["oSectionForm"][sTable]["sections"][envSrvc["oSectionForm"][sTable]["iSelectedSectionIndex"]]["name"] + ".json" + }; + }; /** * initExtractionExtractionForm function. diff --git a/src/module_extraction/module/lang/lang-fr.json b/src/module_extraction/module/lang/lang-fr.json index d5a02d2b..88375368 100755 --- a/src/module_extraction/module/lang/lang-fr.json +++ b/src/module_extraction/module/lang/lang-fr.json @@ -64,8 +64,8 @@ "EXTRACTION_REF_EXTRACTION_LAYER_LAYERS_TOOLTIP_TITLE" : "Couches", "EXTRACTION_REF_EXTRACTION_LAYER_UNUSED_ATTRIBUTES_TOOLTIP_TITLE" : "Attributs inutilisés", "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_SCHEMA_EXTRACTION" : "", - "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_MUTUALIZED" : "", - "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_NO_MUTUALIZED" : "", + "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_MUTUALIZED" : "Couleur des couches mutualisées", + "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_COLOR_NO_MUTUALIZED" : "Couleur des couches non mutualisées", "TEXT_MODE_EXTRACTION_FORM" : "", "TITLE_MODE_EXTRACTION_FORM" : "extraction_form", "SIGN_UP_END_DATE" : "Date de fin de contrat", @@ -115,5 +115,9 @@ "EXTRACTION_DEPOT_FILE_UPDATE": "Mettre à jour", "ERROR_FILE_SIZE_EXTRACTION_LOAD_DEPOSIT_DIRECTORY" : "La taille du fichier est supérieure à la taille maximale autorisée.", "EXTRACTION_EXTRACTION_EXTRACTION_FORM_DEPOSIT" : "Déposer", - "EXTRACTION_EXTRACTION_EXTRACTION_FORM_INPUT_DEPOSIT" : "Fichier à déposer" + "EXTRACTION_EXTRACTION_EXTRACTION_FORM_INPUT_DEPOSIT" : "Fichier à déposer", + "EXTRACTION_EXTRACTION_EXTRACTION_FORM_FORMAT_EXTENSION" : "Format du fichier", + "EXTRACTION_EXTRACTION_EXTRACTION_FORM_SCHEMA_CONSTRAINT" : "Schéma des contraintes", + "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_SIG" : "Extensions SIG (séparées par |)", + "CONFIGURATION_VITIS_CONFIGURATION_EXTRACTIONCONFIG_FORM_DAO" : "Extensions DAO (séparées par |)" } \ No newline at end of file diff --git a/src/module_extraction/web_service/conf/properties.inc b/src/module_extraction/web_service/conf/properties.inc index 28e8fdf6..62a488a9 100755 --- a/src/module_extraction/web_service/conf/properties.inc +++ b/src/module_extraction/web_service/conf/properties.inc @@ -1,3 +1,7 @@ <?php - $properties["schema_extraction"] = 's_extraction'; +$properties['color_mutualized'] = 'green'; +$properties['color_no_mutualized'] = 'red'; +$properties['sig'] = '*.shp'; +$properties['dao'] = '*.dao'; +$properties['shared_dir'] = 'D:/serveur/gtf/vas/shared'; ?> \ No newline at end of file diff --git a/src/module_extraction/web_service/conf/properties_server.inc b/src/module_extraction/web_service/conf/properties_server.inc new file mode 100644 index 00000000..1f67047d --- /dev/null +++ b/src/module_extraction/web_service/conf/properties_server.inc @@ -0,0 +1,3 @@ +<?php + $properties['schema_extraction'] = 's_extraction'; +?> \ No newline at end of file diff --git a/src/module_extraction/web_service/conf/selected_properties.inc b/src/module_extraction/web_service/conf/selected_properties.inc new file mode 100644 index 00000000..90da243f --- /dev/null +++ b/src/module_extraction/web_service/conf/selected_properties.inc @@ -0,0 +1,18 @@ +<?php + +$aAdminFields = Array( + 'color_mutualized', + 'color_no_mutualized', + 'sig', + 'dao' +); +$aUserFields = Array( + 'color_mutualized', + 'color_no_mutualized', + 'sig', + 'dao' +); + +$properties['aAdminFields'] = array_merge($properties['aAdminFields'], $aAdminFields); +$properties['aUserFields'] = array_merge($properties['aUserFields'], $aUserFields); +?> \ No newline at end of file diff --git a/src/module_extraction/web_service/conf/version.inc b/src/module_extraction/web_service/conf/version.inc index a812e4b5..42fa9895 100755 --- a/src/module_extraction/web_service/conf/version.inc +++ b/src/module_extraction/web_service/conf/version.inc @@ -1,7 +1,7 @@ <?php -// Numéro de la version de [Module_name] +// Numéro de la version de extraction define ("VM_VERSION", "20XX.XX.XX"); define ("VM_BUILD", "XXXXX"); define ("VM_MONTH_YEAR", "XX_20XX"); -define ("VM_STATUS", "UNSTABLE"); +define ("VM_STATUS", "STABLE"); ?> \ No newline at end of file diff --git a/src/module_extraction/web_service/ws/Extractions.class.inc b/src/module_extraction/web_service/ws/Extractions.class.inc index a2607092..5173ff58 100755 --- a/src/module_extraction/web_service/ws/Extractions.class.inc +++ b/src/module_extraction/web_service/ws/Extractions.class.inc @@ -183,7 +183,7 @@ class Extractions extends ExtractionExtraction */ public function POST() { - $aReturn = $this->genericPost($this->aProperties['schema_extraction'], 'extraction', $this->aProperties['schema_extraction'] . '.bo_id_extraction_seq', 'bo_id'); + $aReturn = $this->genericPost($this->aProperties['schema_extraction'], 'extraction', $this->aProperties['schema_extraction'] . '.bo_id_extraction_seq', 'bo_id'); $this->aValues["bo_id"] = $this->aValues['my_vitis_id']; eval('$this->' . $this->aValues['tr_status_method'] . '();'); return $aReturn['sMessage']; @@ -241,18 +241,35 @@ class Extractions extends ExtractionExtraction $aXmlRacineAttribute['status'] = 1; $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], true, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); $sDirPath = $this->aProperties["upload_dir"] . "/" . getUniqRandomId(); - while (is_dir($sDirPath)) { - $sDirPath = $this->aProperties["upload_dir"] . "/" . getUniqRandomId(); - } - if (!mkdir($sDirPath)) { - return false; + + $sExtension = '*.' . end(explode(".", $this->aValues["input_deposit_name"])); + + //Si l'extension est autorisée + if (in_array($sExtension, explode("|", $this->aProperties['sig'])) or in_array($sExtension, explode("|", $this->aProperties['dao']))) { + + while (is_dir($sDirPath)) { + $sDirPath = $this->aProperties["upload_dir"] . "/" . getUniqRandomId(); + } + if (!mkdir($sDirPath)) { + return false; + } + // Sauvegarde le nouveau fichier. + $fp = fopen($sDirPath . '/' . utf8_decode($this->aValues["input_deposit_name"]), "w"); + fwrite($fp, $this->aValues["input_deposit_file"]); + fclose($fp); + //Demande GTF + $this->oBO->insertOrder('EM0160AYYTK48', 'sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["input_deposit_name"] . '|sourceMotif=*.shp'); + } else { + //Si l'extension n'est pas bonne + $error_message .= $this->aValues["input_deposit_name"] . " format is not authaurized (" . $sExtension . ")"; + writeToErrorLog("WARNING: " . $error_message); + + $aXmlRacineAttribute['status'] = 0; + $this->aFields = array(); + $this->aFields['errorMessage'] = $error_message; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], true, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + return $sMessage; } - // Sauvegarde le nouveau fichier. - $fp = fopen($sDirPath . '/' . utf8_decode($this->aValues["input_deposit_name"]), "w"); - fwrite($fp, $this->aValues["input_deposit_file"]); - fclose($fp); - //Demande GTF - $this->oBO->insertOrder('EM0160AYYTK48', 'sourceDir=' . end(explode("/", $sDirPath)) . '/' . $this->aValues["input_deposit_name"] . '|sourceMotif=*.shp'); } return $aReturn['sMessage']; } @@ -475,7 +492,7 @@ class Extractions extends ExtractionExtraction // Check si la table existe si oui change l'état $this->oBO->wabSetStatus($this->aProperties["schema_extraction"], "extraction", "bo_id", $this->aValues["bo_id"], "AE Généré"); -//$this->sendmail(9904); + //$this->sendmail(9904); $this->sendmail(171); } -- GitLab