diff --git a/gtf.engine/gtf.engines/Traitement.class.inc b/gtf.engine/gtf.engines/Traitement.class.inc index 181a3b55cb8c07192f499c4b76595ede8b0ec09d..d87dfd3606399bbe7faa0cb0bc02b8ea8a6dad23 100755 --- a/gtf.engine/gtf.engines/Traitement.class.inc +++ b/gtf.engine/gtf.engines/Traitement.class.inc @@ -121,6 +121,9 @@ class Traitement { * \param $oBd Connexion à la base de données. * \param $iDemandeId Identifiant de la demande. * \param $sRobotLogFile Fichier de log. + * \param $sParams Liste des paramètres saisis par l'utilisateur à la création de la demande. + * \param $aProperties Tableau des properties associés à l'application + * \param $sFmwFileName Nom du fichier FMW associé à la demande. */ function __construct($oBd, $iDemandeId, $sRobotLogFile, $sParams, $aProperties, $sFmwFileName) { $this->oBd = $oBd; @@ -133,20 +136,9 @@ class Traitement { // table de correspondance entre GTF et le FMW utiliser dans les fonction d'encodage $this->aReplaceGTF = array("\r\n", " ", "(", ")", "$", "&", "@", "°", "'", ",", "\"", "{", "}", "[", "]", ";", "/", "\\", "é", "à"); $this->aReplaceFME = array("<lf>", "<space>", "<openparen>", "<closeparen>", "<dollar>", "<amp>", "<at>", "<u00b0>", "<apos>", "<comma>", "<quote>", "<opencurly>", "<closecurly>", "<openbracket>", "<closebracket>", "<semicolon>", "<solidus>", "<backslash>", "<u00e9>", "<u00e0>"); - - writeToLog(str_replace('[this->sFmwFileName]', $this->sFmwFileName, str_replace('[sParams]', $sParams, INFO_RESOURCES)), $this->sRobotLogFile); + //writeToLog(str_replace('[this->sFmwFileName]', $this->sFmwFileName, str_replace('[sParams]', $sParams, INFO_RESOURCES)), $this->sRobotLogFile); } - /* - * Initialisation du traitement. - * \param $oBd Connexion à la base de données. - * \param $iDemandeId Identifiant de la demande. - * \param $sLogFile Fichier de log. - * \param $sParams Liste des paramètres saisis par l'utilisateur à la création de la demande. - * \param $aProperties Tableau des properties associés à l'application - * \param $sFmwFileName Nom du fichier FMW associé à la demande. - */ - /** * Cette méthode permet de générer un tableau de paramètres à partir d'une chaîne dont les délimiteurs sont "|" et "=". * \param $sAllParams Chaine composé de tous les paramètres. @@ -324,7 +316,7 @@ class Traitement { $i = 0; $aSourceFiles = array(); if (is_dir($sDirSource)) { - $this->aExtension = $oGui->getExtensionArrayNoLower($oGui->sFiltreSource); + $this->aExtension = $oGui->getExtensionArray($oGui->sFiltreSource); $iExtension = count($this->aExtension); if (($this->aExtension[0] == "*.*" and $oGui->sType == "FILE_OR_URL") or $oGui->sType == "DIRNAME_SRC" or $oGui->sType == "SOURCE_GEODATABASE") { writeToLog(INFO_VALID_DATA_SOURCE_FILE_EXTENSION . $this->aExtension[0], $this->sRobotLogFile); @@ -381,26 +373,6 @@ class Traitement { } return $num; } - - function returnFileListToString($sDirSource, $sExtension) { - $aFileList = array(); - if (!is_dir($sDirSource)) { - $path_parts = pathinfo($sDirSource); - if (is_file($sDirSource) && strtolower($path_parts['extension']) == strtolower($sExtension)){ - array_push($aFileList,$sDirSource); - } - - }else{ - foreach (scandir($sDirSource) AS $entry) { - if (!in_array($entry, array('..', '.'))){ - $aFileListTmp = $aFileList; - $aFileList = array_merge($aFileListTmp,$this->returnFileListToString($sDirSource . "/" . $entry, $sExtension)); - } - - } - } - return $aFileList; - } function returnFileListToString($sDirSource, $sExtension) { $aFileList = array(); @@ -664,15 +636,13 @@ class Traitement { */ function Process() { - $oGtfFmwParser = new GtfFmwParser($this->aProperties["workspace_dir"] . "/" . $this->sFmwFileName); + $oGtfFmwParser = new GtfFmwParser($this->aProperties["workspace_dir"] . "/" . $this->sFmwFileName, $this->aProperties); // Création du répertoire de résultat. $this->sResultDirectoryName = $this->createResultDirectory(); //1 Initialisation & calcul du chemin d'accés du fichier TCL $sCommandLine = '"' . $this->aProperties["fme_path"] . '" "' . getenv("GTF_HOME") . "/" . utf8_decode($this->sFmwFileName) . '"'; - - //3 Ajout des paramètres propres au traitement $sTclParams = $this->getTclParams($oGtfFmwParser); if ($sTclParams != "") @@ -726,7 +696,7 @@ class Traitement { // Création du répertoire de résultat. $this->sResultDirectoryName = $this->createResultDirectory(); // Fichiers sources en entrée et sortie. - $oGtfFmwParser = new GtfFmwParser($this->aProperties["workspace_dir"] . "/" . $this->sFmwFileName); + $oGtfFmwParser = new GtfFmwParser($this->aProperties["workspace_dir"] . "/" . $this->sFmwFileName, $this->aProperties); $aTGui = array(); $aSourceFiles = array(); $aDestinationFiles = array(); @@ -767,9 +737,16 @@ class Traitement { copy($sFmwFilePath, $sRepositoryFmwFilePath); // Supprime le fichier de l'ancienne version du projet (GTF + Fme Server). if ($aWorkspace['version'] > 0) { - $sRepositoryOldFmwFileName = pathinfo($this->sFmwFileName, PATHINFO_FILENAME) . '_v' . --$aWorkspace['version'] . '.' . pathinfo($this->sFmwFileName, PATHINFO_EXTENSION); - unlink($this->aProperties["workspace_dir"] . "/" . pathinfo($this->sFmwFileName, PATHINFO_DIRNAME) . "/" . $sRepositoryOldFmwFileName); - //$oFmeServer->serviceRequest('repositories/' . $sRepository . '/items/' . $sRepositoryOldFmwFileName, 'delete'); + $sOldFmwFileName = pathinfo($this->sFmwFileName, PATHINFO_FILENAME) . '_v' . --$aWorkspace['version'] . '.' . pathinfo($this->sFmwFileName, PATHINFO_EXTENSION); + $sOldFmwFilePath = $this->aProperties["workspace_dir"] . "/" . pathinfo($this->sFmwFileName, PATHINFO_DIRNAME) . "/" . $sOldFmwFileName; + if (file_exists($sOldFmwFilePath)) + unlink($sOldFmwFilePath); + //$oFmeServer->serviceRequest('repositories/' . $sRepository . '/items/' . $sOldFmwFileName, 'delete'); + // S3 -> copie du fichier avec la dernière version et suppression de l'ancien. + if ($this->aProperties['fileS3Uploader'] === true) { + deleteFileFromWsDataDirTree('gtf', 'workspace', $aWorkspace['workspace_id'], 'fme', $sOldFmwFileName); + copyFileInWsDataDir ('gtf', 'workspace', $aWorkspace['workspace_id'], 'fme', pathinfo($this->sFmwFileName, PATHINFO_BASENAME), $sRepositoryFmwFileName); + } } } // Upload du fichier .fmw. @@ -1247,5 +1224,4 @@ class Traitement { } } } - ?> diff --git a/gtf.engine/gtf.engines/engine.php b/gtf.engine/gtf.engines/engine.php index c390137f005621ba0350d35b73da34d00becc4c2..6c2473b475322d6b5d6f92f766a5b11017680168 100755 --- a/gtf.engine/gtf.engines/engine.php +++ b/gtf.engine/gtf.engines/engine.php @@ -48,20 +48,37 @@ if ($ErrorLicense == "0") { } else { writeToLog(INFO_BASE_CONNECTION . $properties["database"], $properties["engine_log_file"]); - //Recherche du Moteur V2 (ExecuteWithParams) - //Selection du chemin fme + // Données du moteur fme utilisé. $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $properties['schema_gtf'], 'type' => 'schema_name'); + $aParams['sSchemaGtf'] = array('value' => $properties["schema_gtf"], 'type' => 'schema_name'); $aParams['gtf_engine_id'] = array('value' => $properties['id_gtf_engine'], 'type' => 'number'); - $oPDOResult = $oBd->executeWithParams($aSql['pgsql']['select_fme_path'], $aParams); + $oPDOResult4 = $oBd->executeWithParams($aSql[$properties["sgbd"]]["getFmeEngine"], $aParams); + $aFmeEngine = $oBd->ligneSuivante($oPDOResult4); + + // Si stockage sur S3 -> fichiers du projet FME dans un répertoire temporaire. + if ($properties['fileS3Uploader'] === true) { + $properties["workspace_dir"] = $properties['extract_dir'] . '/workspace'; + if (!(file_exists($properties["workspace_dir"]))) + mkdir($properties["workspace_dir"], 0777, true); + } + + // Variables d'environnement. + if ($aFmeEngine['fme_engine_type_id'] == 'desktop') { + //Recherche du Moteur V2 (ExecuteWithParams) + //Selection du chemin fme + $aParams = array(); + $aParams['sSchemaGtf'] = array('value' => $properties['schema_gtf'], 'type' => 'schema_name'); + $aParams['gtf_engine_id'] = array('value' => $properties['id_gtf_engine'], 'type' => 'number'); + $oPDOResult = $oBd->executeWithParams($aSql['pgsql']['select_fme_path'], $aParams); - if ($aRecord = $oBd->ligneSuivante($oPDOResult)) { - $properties["fme_path"] = $aRecord['fme_path']; - } else { - $properties["fme_path"] = ''; + if ($aRecord = $oBd->ligneSuivante($oPDOResult)) { + $properties["fme_path"] = $aRecord['fme_path']; + } else { + $properties["fme_path"] = ''; + } + putenv("FME_PATH=" . $properties["fme_path"]); + putenv("GTF_HOME=" . $properties["workspace_dir"] . "/"); } - putenv("FME_PATH=" . $properties["fme_path"]); - putenv("GTF_HOME=" . $properties["workspace_dir"] . "/"); /* // Traitement des demandes en fonction du moteur @@ -244,7 +261,27 @@ if ($ErrorLicense == "0") { // $aAction = $oBd->ligneSuivante ($oPDOResult4); // $properties["transit_dir"] = $aAction["value"]; // $oPDOResult4 = $oBd->fermeResultat(); - + + // Si stockage sur S3 -> Téléchargement de tous les fichiers du projet FME. + if ($properties['fileS3Uploader'] === true) { + if ($iTentative == 1) { + $sWorkspaceDir = $properties["workspace_dir"] . '/' . $aDemande['workspace_id']; + if (file_exists($sWorkspaceDir)) + clearDir($sWorkspaceDir); + if (mkdir($sWorkspaceDir . '/fme', 0777, true)) { + $aTree = getDirectoryInfosFromWsDataDir('gtf', 'workspace', $aDemande['workspace_id'], 'fme'); + if (!empty($aTree)) { + if (!empty($aTree[0]['content'])) { + foreach($aTree[0]['content'] as $aFile) { + $sFmwFileContent = getFileContentInWsDataDir("gtf", "workspace", $aDemande['workspace_id'], 'fme', $aFile['filename']); + file_put_contents($sWorkspaceDir . '/fme/' . $aFile['filename'], $sFmwFileContent); + } + } + } + } + } + } + //Lancement du traitement correspondant à la demande. $bValidFmeLicence = false; switch($aFmeEngine['fme_engine_type_id']) { @@ -827,7 +864,16 @@ function TesteHeureCreuse($sHeureMin, $sHeureMax) { */ function updateOrder($iOrderId, $iStatut, $sExecutionDate, $sLogUrl = null, $iNbSec = null, $sResultUrl = null) { // Variables globales. - global $oBd, $properties, $aSql; + global $oBd, $properties, $aSql, $aDemande; + // Suppression du répertoire temporaire du projet. + if ($properties['fileS3Uploader'] === true) { + $aStatus = array(2, 3, 4, 6, 7); + if (in_array($iStatut, $aStatus)) { + $sWorkspacePath = $properties['workspace_dir'] . '/' . $aDemande['workspace_id']; + if (file_exists($sWorkspacePath)) + clearDir($sWorkspacePath); + } + } // Requete d'update de la demande. if (empty($sLogUrl)) $sLogUrl = null; diff --git a/gtf.engine/gtf.engines/properties_engine.inc b/gtf.engine/gtf.engines/properties_engine.inc index faf47c8dec9ca0a95a8bc1dc4d39883301b1394f..83162f38c8cfa9e062df6c79879b94556699aafc 100755 --- a/gtf.engine/gtf.engines/properties_engine.inc +++ b/gtf.engine/gtf.engines/properties_engine.inc @@ -14,6 +14,4 @@ $properties["notify_log_file"] = $properties["engine_log_home"]."/notify.log"; $properties["sql_log_file"] = $properties["engine_log_home"]."/sql.log"; $properties["subscription_log_file"] = $properties["engine_log_home"]."/subscription.log"; $properties["error_log_file"] = $properties['vas_home']."/log/engines"."/error.log"; - -$properties['web_server_name'] = 'https://dev.veremes.net'; ?> \ No newline at end of file diff --git a/gtf.engine/gtf.engines/subscription.php b/gtf.engine/gtf.engines/subscription.php index 7b353391535702a2a07751ad0944513dd8eed84c..a25d7011ed26c03ef9603cb03801a0d6561fdcb4 100755 --- a/gtf.engine/gtf.engines/subscription.php +++ b/gtf.engine/gtf.engines/subscription.php @@ -10,6 +10,10 @@ */ //set_include_path(dirname($_SERVER["PHP_SELF"]).'/../gtf.client'.';'.dirname($_SERVER["PHP_SELF"]).'/php/lib'); //ini_set ('writeToErrorLog', dirname($_SERVER["PHP_SELF"]).'/php/php.log'); +// Si "$_SERVER["HTTP_HOST"]" n'est pas renseigné -> php notice. +if (!isset($_SERVER["HTTP_HOST"])) + $_SERVER["HTTP_HOST"] = 'localhost'; + require_once ("php_engine_conf.inc"); require_once ("gtf_lib/GtfFmwParser.class.inc"); require_once ("vmlib/Vm.class.inc"); @@ -254,7 +258,9 @@ if ($oBd->erreurRencontree) { if ($bAutorisationDemande == true) { //Création d'une nouvelle demande. //writeToLog($properties["workspace_dir"],$properties["subscription_log_file"]); - $oGtfFmwParser = new GtfFmwParser($properties['vas_home'] . '/ws_data/gtf/workspace' . "/" . $aDemande['workspace_id'] . "/fme/" . $aDemande['fmw_file']); + // Lit le contenu du fichier .fmw du projet. + $sFmwFileContent = getFileContentInWsDataDir("gtf", "workspace", $aDemande['workspace_id'], 'fme', $aDemande['fmw_file']); + $oGtfFmwParser = new GtfFmwParser($aDemande['fmw_file'], $this->aProperties, $sFmwFileContent); $iNouvelId = ""; if ($bIsFile) { diff --git a/module/forms/configuration/configuration_vitis_configuration_gtfConfig.json b/module/forms/configuration/configuration_vitis_configuration_gtfConfig.json old mode 100755 new mode 100644 index ab1ba4d18e8a3e551a34384f6aa78b991e010fa7..2c3d7e25557d9a332a252de8c57f13252c5bf535 --- a/module/forms/configuration/configuration_vitis_configuration_gtfConfig.json +++ b/module/forms/configuration/configuration_vitis_configuration_gtfConfig.json @@ -17,6 +17,32 @@ } ] }, + { + "class": "form-field-inline gtf-instance-id", + "fields":[ + { + "type":"text", + "name":"gtf_instance_id", + "label":"FORM_GTF_INSTANCE_ID_CONFIGURATION_CONFIGURATION_GTF_CONFIG", + "read_only":true, + "nb_cols":10 + }, + { + "type": "button", + "class": "btn-ungroup btn-group-sm", + "nb_cols": 2, + "buttons": [ + { + "type": "button", + "name": "btn_generate_gtf_instance_id", + "label": "FORM_BTN_GENERATE_GTF_INSTANCE_ID_WORKSPACE_EDIT_WIDGET", + "class": "btn-primary", + "event": "generateGtfInstanceId()" + } + ] + } + ] + }, { "fields":[ { @@ -129,6 +155,31 @@ } ] }, + { + "fields":[ + { + "type":"title", + "label":"FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG", + "name":"title_properties_ext_conn_string", + "nb_cols":12 + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"connectionStringExternalIp", + "label":"FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGIP", + "nb_cols":6 + },{ + "type":"number", + "name":"connectionStringExternalPort", + "label":"FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGPORT", + "nb_cols":6 + } + ] + }, { "fields":[ { diff --git a/module/forms/engine/engine_gtf_fme_engine.json b/module/forms/engine/engine_gtf_fme_engine.json old mode 100755 new mode 100644 index d24ab707829c9578af51cbfc68d369bb9250eac9..5aee23e556f2b293b27cc4cf195ab82d01f5edb2 --- a/module/forms/engine/engine_gtf_fme_engine.json +++ b/module/forms/engine/engine_gtf_fme_engine.json @@ -26,6 +26,34 @@ } }, "nb_cols":4 + }, + { + "type":"select", + "name":"fme_engine_type_id", + "label":"FORM_TYPE_ENGINE_FME_ENGINE", + "web_service":{ + "ressource_id":"gtf/fmeenginetypes", + "id_key":"fme_engine_type_id", + "label_key":"fme_engine_type_label", + "parameters":{ + "filter":{ + "lang":"getProperty('language')" + }, + "order_by":"fme_engine_type_label" + } + }, + "nb_cols":4 + } + ] + }, + { + "fields":[ + { + "type":"url", + "name":"server_url", + "label":"FORM_SERVER_URL_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":4 } ] }, @@ -60,6 +88,7 @@ "name":"gtf_v_fme_engine_update_form", "title":"FORM_TITLE_ENGINE_FME_ENGINE", "input_size":"xs", + "initEvent":"initGtfFmeEngineForm()", "event":"sendSimpleForm()", "nb_cols":6, "rows":[ @@ -102,6 +131,50 @@ "nb_cols":12 } ] + },{ + "fields": [ + { + "type": "radio", + "name": "useexternaldbconnection", + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE", + "nb_cols": 12, + "id": "Element_0_1_1", + "options": { + "choices": [ + { + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_YES", + "value": true + }, + { + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_NO", + "value": false + } + ] + } + } + ] + }, + { + "fields":[ + { + "type":"select", + "name":"fme_engine_type_id", + "label":"FORM_TYPE_ENGINE_FME_ENGINE", + "required":true, + "web_service":{ + "ressource_id":"gtf/fmeenginetypes", + "id_key":"fme_engine_type_id", + "label_key":"fme_engine_type_label", + "parameters":{ + "filter":{ + "lang":"getProperty('language')" + }, + "order_by":"fme_engine_type_label" + } + }, + "nb_cols":12 + } + ] }, { "fields":[ @@ -115,18 +188,274 @@ ] }, { + "fields":[ + { + "type":"url", + "name":"server_url", + "label":"FORM_SERVER_URL_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_cloud_api_token", + "label":"FORM_FME_CLOUD_API_TOKEN_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"fme_server_instance_title", + "label":"FORM_FME_SERVER_INSTANCE_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_server_instance_name", + "label":"FORM_FME_SERVER_INSTANCE_NAME_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"login", + "label":"FORM_LOGIN_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"password", + "label":"FORM_PASSWORD_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"fme_server_instance_status", + "label":"FORM_FME_SERVER_INSTANCE_STATUS_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "class":"fme_cloud_button", "fields":[ { "type":"button", "class":"btn-ungroup btn-group-sm", "nb_cols":12, + "name":"fme_cloud_button", + "buttons":[ + { + "type":"button", + "name":"start_fme_server_instance", + "label":"FORM_BTN_START_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE", + "class":"btn-success", + "event":"StartFmeServerInstance()", + "disabled": true + }, + { + "type":"button", + "name":"pause_fme_server_instance", + "label":"FORM_BTN_PAUSE_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE", + "class":"btn-warning", + "event":"PauseFmeServerInstance()", + "disabled": true + }, + { + "type":"button", + "name":"fme_server_instance_version", + "label":"FORM_BTN_FME_SERVER_INSTANCE_VERSION_ENGINE_FME_ENGINE", + "class":"btn-primary", + "event":"displayFmeServerInstanceInfo()", + "disabled": true + }, + { + "type":"button", + "name":"refresh_fme_server_instance_status", + "glyphicon":"refresh", + "class":"btn-primary", + "event":"refreshFmeServerInstanceStatus()", + "tooltip": { + "title":"FORM_BTN_REFRESH_FME_SERVER_INSTANCE_STATUT_STATUT_ENGINE_FME_ENGINE", + "placement": "bottom", + "trigger": "hover", + "container": "body" + } + } + ] + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"amazon_s3_title", + "label":"FORM_AMAZON_S3_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"s3_access_key_id", + "label":"FORM_S3_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"s3_secret_access_key", + "label":"FORM_S3_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_server_s3_bucket", + "label":"FORM_FME_SERVER_S3_BUCKET_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"iam_access_key_id", + "label":"FORM_IAM_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"iam_secret_access_key", + "label":"FORM_IAM_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"select", + "name":"s3_region", + "label":"FORM_S3_REGION_ENGINE_FME_ENGINE", + "required":true, + "options":[ + "FORM_S3_REGION_US-EAST-2_ENGINE_FME_ENGINE|us-east-2", + "FORM_S3_REGION_US-EAST-1_ENGINE_FME_ENGINE|us-east-1", + "FORM_S3_REGION_US-WEST-1_ENGINE_FME_ENGINE|us-west-1", + "FORM_S3_REGION_US-WEST-2_ENGINE_FME_ENGINE|us-west-2", + "FORM_S3_REGION_AP-SOUTH-1_ENGINE_FME_ENGINE|ap-south-1", + "FORM_S3_REGION_AP-NORTHEAST-2_ENGINE_FME_ENGINE|ap-northeast-2", + "FORM_S3_REGION_AP-SOUTHEAST-1_ENGINE_FME_ENGINE|ap-southeast-1", + "FORM_S3_REGION_AP-SOUTHEAST-2_ENGINE_FME_ENGINE|ap-southeast-2", + "FORM_S3_REGION_AP-NORTHEAST-1_ENGINE_FME_ENGINE|ap-northeast-1", + "FORM_S3_REGION_CA-CENTRAL-1_ENGINE_FME_ENGINE|ca-central-1", + "FORM_S3_REGION_CN-NORTH-1_ENGINE_FME_ENGINE|cn-north-1", + "FORM_S3_REGION_EU-CENTRAL-1_ENGINE_FME_ENGINE|eu-central-1", + "FORM_S3_REGION_EU-WEST-1_ENGINE_FME_ENGINE|eu-west-1", + "FORM_S3_REGION_EU-WEST-2_ENGINE_FME_ENGINE|eu-west-2", + "FORM_S3_REGION_EU-WEST-3_ENGINE_FME_ENGINE|eu-west-3", + "FORM_S3_REGION_SA-EAST-1_ENGINE_FME_ENGINE|sa-east-1" + ], + "visible":false, + "nb_cols":12 + } + ] + }, + { + "fields":[ + { + "type":"button", + "class":"btn-ungroup btn-group-sm", + "nb_cols":12, + "name":"amazon_s3_button", + "buttons":[ + { + "type":"button", + "name":"test_amazon_s3_bucket", + "label":"FORM_BTN_TEST_AMAZON_S3_BUCKET_ENGINE_FME_ENGINE", + "class":"btn-primary", + "event":"testAmazonS3BucketConnection()" + } + ] + } + ] + }, + { + "fields":[ + { + "type":"button", + "class":"btn-ungroup btn-group-sm", + "nb_cols":12, + "name":"update_button", "buttons":[ { "type":"button", "name":"test_fme_engine", "label":"FORM_BTN_TEST_FME_ENGINE_ENGINE_FME_ENGINE", "class":"btn-primary", - "event":"testFmeEngine('local_path')" + "event":"testFmeEngine('local_path')", + "visible": false }, { "type":"submit", @@ -151,6 +480,7 @@ "name":"gtf_v_fme_engine_insert_form", "title":"FORM_TITLE_ENGINE_FME_ENGINE", "input_size":"xs", + "initEvent":"initGtfFmeEngineForm()", "event":"sendSimpleForm()", "afterEvent":"editSectionForm()", "nb_cols":6, @@ -185,6 +515,51 @@ "nb_cols":12 } ] + },{ + "fields": [ + { + "type": "radio", + "name": "useexternaldbconnection", + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE", + "nb_cols": 12, + "id": "Element_0_1_1", + "options": { + "choices": [ + { + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_YES", + "value": true + }, + { + "label": "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_NO", + "value": false + } + ] + }, + "default_value": false + } + ] + }, + { + "fields":[ + { + "type":"select", + "name":"fme_engine_type_id", + "label":"FORM_TYPE_ENGINE_FME_ENGINE", + "required":true, + "web_service":{ + "ressource_id":"gtf/fmeenginetypes", + "id_key":"fme_engine_type_id", + "label_key":"fme_engine_type_label", + "parameters":{ + "filter":{ + "lang":"getProperty('language')" + }, + "order_by":"fme_engine_type_label" + } + }, + "nb_cols":12 + } + ] }, { "fields":[ @@ -193,16 +568,192 @@ "name":"local_path", "label":"FORM_PATH_ENGINE_FME_ENGINE", "required":true, - "nb_cols":12 + "nb_cols":12, + "visible":false } ] }, + { + "fields":[ + { + "type":"url", + "name":"server_url", + "label":"FORM_SERVER_URL_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_cloud_api_token", + "label":"FORM_FME_CLOUD_API_TOKEN_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"fme_server_instance_title", + "label":"FORM_FME_SERVER_INSTANCE_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_server_instance_name", + "label":"FORM_FME_SERVER_INSTANCE_NAME_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"login", + "label":"FORM_LOGIN_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"password", + "label":"FORM_PASSWORD_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"amazon_s3_title", + "label":"FORM_AMAZON_S3_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"s3_access_key_id", + "label":"FORM_S3_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"s3_secret_access_key", + "label":"FORM_S3_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"fme_server_s3_bucket", + "label":"FORM_FME_SERVER_S3_BUCKET_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"text", + "name":"iam_access_key_id", + "label":"FORM_IAM_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"password", + "name":"iam_secret_access_key", + "label":"FORM_IAM_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "required":true, + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"select", + "name":"s3_region", + "label":"FORM_S3_REGION_ENGINE_FME_ENGINE", + "required":true, + "options":[ + "FORM_S3_REGION_US-EAST-2_ENGINE_FME_ENGINE|us-east-2", + "FORM_S3_REGION_US-EAST-1_ENGINE_FME_ENGINE|us-east-1", + "FORM_S3_REGION_US-WEST-1_ENGINE_FME_ENGINE|us-west-1", + "FORM_S3_REGION_US-WEST-2_ENGINE_FME_ENGINE|us-west-2", + "FORM_S3_REGION_AP-SOUTH-1_ENGINE_FME_ENGINE|ap-south-1", + "FORM_S3_REGION_AP-NORTHEAST-2_ENGINE_FME_ENGINE|ap-northeast-2", + "FORM_S3_REGION_AP-SOUTHEAST-1_ENGINE_FME_ENGINE|ap-southeast-1", + "FORM_S3_REGION_AP-SOUTHEAST-2_ENGINE_FME_ENGINE|ap-southeast-2", + "FORM_S3_REGION_AP-NORTHEAST-1_ENGINE_FME_ENGINE|ap-northeast-1", + "FORM_S3_REGION_CA-CENTRAL-1_ENGINE_FME_ENGINE|ca-central-1", + "FORM_S3_REGION_CN-NORTH-1_ENGINE_FME_ENGINE|cn-north-1", + "FORM_S3_REGION_EU-CENTRAL-1_ENGINE_FME_ENGINE|eu-central-1", + "FORM_S3_REGION_EU-WEST-1_ENGINE_FME_ENGINE|eu-west-1", + "FORM_S3_REGION_EU-WEST-2_ENGINE_FME_ENGINE|eu-west-2", + "FORM_S3_REGION_EU-WEST-3_ENGINE_FME_ENGINE|eu-west-3", + "FORM_S3_REGION_SA-EAST-1_ENGINE_FME_ENGINE|sa-east-1" + ], + "visible":false, + "nb_cols":12 + } + ] + }, { "fields":[ { "type":"button", "class":"btn-ungroup btn-group-sm", "nb_cols":12, + "name":"insert_button", "buttons":[ { "type":"submit", @@ -226,6 +777,7 @@ "display":{ "name":"gtf_v_fme_engine_display_form", "title":"FORM_TITLE_ENGINE_FME_ENGINE", + "initEvent":"initGtfFmeEngineForm()", "input_size":"xs", "nb_cols":6, "rows":[ @@ -259,6 +811,16 @@ } ] }, + { + "fields":[ + { + "type":"label", + "name":"fme_engine_type_label", + "label":"FORM_TYPE_ENGINE_FME_ENGINE", + "nb_cols":12 + } + ] + }, { "fields":[ { @@ -269,11 +831,157 @@ } ] }, + { + "fields":[ + { + "type":"label", + "name":"server_url", + "label":"FORM_SERVER_URL_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"fme_cloud_api_token", + "label":"FORM_FME_CLOUD_API_TOKEN_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"fme_server_instance_title", + "label":"FORM_FME_SERVER_INSTANCE_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"fme_server_instance_name", + "label":"FORM_FME_SERVER_INSTANCE_NAME_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"login", + "label":"FORM_LOGIN_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"password", + "label":"FORM_PASSWORD_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"title", + "name":"amazon_s3_title", + "label":"FORM_AMAZON_S3_TITLE_ENGINE_FME_ENGINE", + "nb_cols":12, + "class":"h5", + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"s3_access_key_id", + "label":"FORM_S3_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"s3_secret_access_key", + "label":"FORM_S3_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"fme_server_s3_bucket", + "label":"FORM_FME_SERVER_S3_BUCKET_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"iam_access_key_id", + "label":"FORM_IAM_ACCESS_KEY_ID_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"iam_secret_access_key", + "label":"FORM_IAM_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE", + "nb_cols":12, + "visible":false + } + ] + }, + { + "fields":[ + { + "type":"label", + "name":"s3_region", + "label":"FORM_S3_REGION_ENGINE_FME_ENGINE", + "visible":false, + "nb_cols":12 + } + ] + }, { "fields":[ { "type":"button", "class":"btn-ungroup btn-group-sm", + "name":"display_button", "nb_cols":12, "buttons":[ { diff --git a/module/forms/my_work/my_work_gtf_user_order.json b/module/forms/my_work/my_work_gtf_user_order.json index c0c4d1ee9a84c4629a729bc23470024f0d0a2456..a8ca40f83a1445996af53f5c338b65b308edff2e 100755 --- a/module/forms/my_work/my_work_gtf_user_order.json +++ b/module/forms/my_work/my_work_gtf_user_order.json @@ -46,27 +46,6 @@ } ] }, - { - "fields":[ - { - "type":"select", - "name":"priority_id", - "label":"FORM_PRIORITY_MY_WORK_USER_ORDER", - "web_service":{ - "ressource_id":"gtf/priorities", - "id_key":"priority_id", - "label_key":"priority_label", - "parameters":{ - "filter":{ - "lang":"getProperty('language')" - }, - "order_by":"priority_label" - } - }, - "nb_cols":4 - } - ] - }, { "fields":[ { @@ -156,28 +135,6 @@ } ] }, - { - "fields":[ - { - "type":"select", - "name":"priority_id", - "label":"FORM_PRIORITY_MY_WORK_USER_ORDER", - "web_service":{ - "ressource_id":"gtf/priorities", - "id_key":"priority_id", - "label_key":"priority_label", - "parameters":{ - "filter":{ - "lang":"getProperty('language')" - }, - "order_by":"priority_label" - } - }, - "default_value":1, - "nb_cols":12 - } - ] - }, { "fields":[ { @@ -212,6 +169,19 @@ } ] }, + { + "fields":[ + { + "type":"datetime", + "name":"minexecdate", + "label":"FORM_MINEXECDATE_MY_WORK_USER_ORDER", + "options": { + "minDate": [] + }, + "nb_cols":12 + } + ] + }, { "fields":[ { @@ -284,8 +254,8 @@ "fields":[ { "type":"label", - "name":"priority_label", - "label":"FORM_PRIORITY_MY_WORK_USER_ORDER", + "name":"minexecdate", + "label":"FORM_MINEXECDATE_MY_WORK_USER_ORDER", "nb_cols":12 } ] diff --git a/module/forms/publication/publication_gtf_workspace.json b/module/forms/publication/publication_gtf_workspace.json index 2c3777af1c5687c6d54fa856dec69ba9a9ce7357..acd287f47cceeacf9375eb5195a6b2bc4236ee1b 100755 --- a/module/forms/publication/publication_gtf_workspace.json +++ b/module/forms/publication/publication_gtf_workspace.json @@ -185,14 +185,14 @@ "content": "FORM_KEY_TOOLTIP_CONTENT_PUBLICATION_WORKSPACE", "width": "500px" }, - "nb_cols": 4 + "nb_cols": 5 }, { "type": "linkurl", "name": "fmw_file_url", "label": "FORM_FMW_FILE_URL_PUBLICATION_WORKSPACE", "target": "_self", - "nb_cols": 8 + "nb_cols": 7 } ] }, @@ -297,7 +297,7 @@ "value": false }] }, - "nb_cols": 4 + "nb_cols": 5 }, { "type": "radio", @@ -314,7 +314,65 @@ "value": false }] }, - "nb_cols": 4 + "nb_cols": 5 + } + ] + }, + { + "fields": [ + { + "type": "radio", + "name": "dataencrypt", + "label": "FORM_DATAENCRYPT_PUBLICATION_WORKSPACE", + "nb_cols": 5, + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "default_value": false + }, + { + "type": "radio", + "name": "usepersonaldata", + "label": "FORM_USEPERSONALDATA_PUBLICATION_WORKSPACE", + "nb_cols": 5, + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "default_value": false + } + ] + }, + { + "fields": [ + { + "type": "float", + "name": "unitcost", + "label": "FORM_UNITCOST_PUBLICATION_WORKSPACE", + "nb_cols": 5 + }, + { + "type": "float", + "name": "costpersecond", + "label": "FORM_COSTPERSECOND_PUBLICATION_WORKSPACE", + "nb_cols": 5 } ] }, @@ -450,7 +508,7 @@ }] }, "default_value": 0, - "nb_cols": 4 + "nb_cols": 5 }, { "type": "radio", @@ -468,7 +526,65 @@ }] }, "default_value": 0, - "nb_cols": 4 + "nb_cols": 5 + } + ] + }, + { + "fields": [ + { + "type": "radio", + "name": "dataencrypt", + "label": "FORM_DATAENCRYPT_USER_USER", + "nb_cols": 5, + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "default_value": false + }, + { + "type": "radio", + "name": "usepersonaldata", + "label": "FORM_USEPERSONALDATA_PUBLICATION_WORKSPACE", + "nb_cols": 5, + "options": { + "choices": [ + { + "label": "Oui", + "value": true + }, + { + "label": "Non", + "value": false + } + ] + }, + "default_value": false + } + ] + }, + { + "fields": [ + { + "type": "float", + "name": "unitcost", + "label": "FORM_UNITCOST_PUBLICATION_WORKSPACE", + "nb_cols": 5 + }, + { + "type": "float", + "name": "costpersecond", + "label": "FORM_COSTPERSECOND_PUBLICATION_WORKSPACE", + "nb_cols": 5 } ] }, @@ -607,13 +723,45 @@ "type": "label", "name": "subscription", "label": "FORM_SUBSCRIPTION_AVAILABLE_PUBLICATION_WORKSPACE", - "nb_cols": 4 + "nb_cols": 5 }, { "type": "label", "name": "survey", "label": "FORM_SURVEY_AVAILABLE_PUBLICATION_WORKSPACE", - "nb_cols": 4 + "nb_cols": 5 + } + ] + }, + { + "fields": [ + { + "type": "label", + "name": "dataencrypt", + "label": "FORM_DATAENCRYPT_PUBLICATION_WORKSPACE", + "nb_cols": 5 + }, + { + "type": "label", + "name": "usepersonaldata", + "label": "FORM_USEPERSONALDATA_PUBLICATION_WORKSPACE", + "nb_cols": 5 + } + ] + }, + { + "fields": [ + { + "type": "label", + "name": "unitcost", + "label": "FORM_UNITCOST_PUBLICATION_WORKSPACE", + "nb_cols": 5 + }, + { + "type": "label", + "name": "costpersecond", + "label": "FORM_COSTPERSECOND_PUBLICATION_WORKSPACE", + "nb_cols": 5 } ] }, diff --git a/module/forms/supervision/supervision_gtf_order.json b/module/forms/supervision/supervision_gtf_order.json index 9ba137b52d1ba548900a4f95c13d4cb5c2043797..9cf0cd54df09f18516a7c3caa9140090bd4f9147 100755 --- a/module/forms/supervision/supervision_gtf_order.json +++ b/module/forms/supervision/supervision_gtf_order.json @@ -62,23 +62,6 @@ "label":"FORM_DATE_SUPERVISION_ORDER", "nb_cols":4 }, - { - "type":"select", - "name":"priority_id", - "label":"FORM_PRIORITY_SUPERVISION_ORDER", - "web_service":{ - "ressource_id":"gtf/priorities", - "id_key":"priority_id", - "label_key":"priority_label", - "parameters":{ - "filter":{ - "lang":"getPropertie('language')" - }, - "order_by":"priority_label" - } - }, - "nb_cols":4 - }, { "type":"select", "name":"gtf_engine_id", @@ -178,8 +161,8 @@ "fields":[ { "type":"label", - "name":"priority_label", - "label":"FORM_PRIORITY_SUPERVISION_ORDER", + "name":"login", + "label":"FORM_OWNER_SUPERVISION_ORDER", "nb_cols":12 } ] @@ -188,8 +171,8 @@ "fields":[ { "type":"label", - "name":"login", - "label":"FORM_OWNER_SUPERVISION_ORDER", + "name":"order_date", + "label":"FORM_DATE_SUPERVISION_ORDER", "nb_cols":12 } ] @@ -198,8 +181,8 @@ "fields":[ { "type":"label", - "name":"order_date", - "label":"FORM_DATE_SUPERVISION_ORDER", + "name":"execution_date", + "label":"FORM_WORK_DATE_SUPERVISION_ORDER", "nb_cols":12 } ] @@ -208,8 +191,8 @@ "fields":[ { "type":"label", - "name":"execution_date", - "label":"FORM_WORK_DATE_SUPERVISION_ORDER", + "name":"minexecdate", + "label":"FORM_MINEXECDATE_SUPERVISION_ORDER", "nb_cols":12 } ] diff --git a/module/forms/users/users_vitis_group_qualigeo.json b/module/forms/users/users_vitis_group_qualigeo.json new file mode 100755 index 0000000000000000000000000000000000000000..88b3dbe798162c8f5f4cd42ef131aab01aadc925 --- /dev/null +++ b/module/forms/users/users_vitis_group_qualigeo.json @@ -0,0 +1,155 @@ +{ + "display": { + "name": "qualigeo_group-display-form", + "title": "FORM_TITLE_USERS_GROUP", + "input_size": "xxs", + "nb_cols": 9, + "javascript": false, + "rows": [ + { + "fields": [ + { + "type": "label", + "name": "group_schema", + "label": "FORM_USERS_GROUP_QUALIGEO_DOUBLE_SELECT", + "nb_cols": 12, + "id": "Element_0_2_1" + } + ] + } + ], + "tabs": { + "position": "top", + "list": [ + { + "label": "Tab 0", + "elements": [ + "group_schema" + ] + } + ] + }, + "event": "sendSimpleForm()", + "afterEvent": "editSectionForm()" + }, + "search": {}, + "insert": {}, + "update": { + + "name": "qualigeo_group-update-form", + "title": "FORM_TITLE_USERS_GROUP", + "input_size": "xxs", + "nb_cols": 9, + "javascript": false, + "rows": [ + { + "fields": [ + { + "type": "double_select", + "name": "group_schema", + "label": "FORM_USERS_GROUP_QUALIGEO_DOUBLE_SELECT", + "required": false, + "nb_cols": 12, + "id": "Element_0_2_1", + "name_to": "group_schema", + "name_from": "group_schema_from", + "label_from": "FORM_USERS_GROUP_QUALIGEO_SCHEMA_AVAILABLE", + "label_to": "FORM_USERS_GROUP_QUALIGEO_SCHEMA_ASSOCIATE", + "id_from": "Element_0_2_1_from", + "datasource": { + "datasource_id": "datasource_3", + "sort_order": "ASC", + "distinct": "true", + "id_key": "id_schema", + "label_key": "schema", + "attributs": "schema|id_schema", + "order_by": "schema" + }, + "size": 12 + } + ] + }, + { + "fields": [ + { + "type": "button", + "class": "btn-ungroup btn-group-sm", + "nb_cols": 12, + "name": "insert_button", + "buttons": [ + { + "type": "submit", + "name": "form_submit", + "label": "FORM_UPDATE", + "class": "btn-primary" + }, + { + "type": "button", + "name": "return_list", + "label": "FORM_RETURN_LIST", + "class": "btn-primary", + "event": "setMode(\"search\")" + } + ], + "id": "undefined_5_1" + } + ] + } + ], + "tabs": { + "position": "top", + "list": [ + { + "label": "Tab 0", + "elements": [ + "insert_button", + "group_schema" + ] + } + ] + }, + "event": "sendSimpleForm()" + }, + "datasources": { + "datasource_1": { + "type": "web_service", + "dataType": "tableValue", + "name": "datasource_1", + "description": "", + "parameters": { + "schema": "s_wab", + "table": "v_module_t" + }, + "ressource_id": "vitis/genericquerys", + "id": "datasource_1" + }, + "datasource_2": { + "type": "web_service", + "dataType": "tableValue", + "name": "datasource_2", + "description": "", + "parameters": { + "schema": "s_wab", + "table": "v_privilege_t" + }, + "ressource_id": "vitis/genericquerys", + "id": "datasource_2" + }, + "datasource_3": { + "type": "web_service", + "dataType": "tableValue", + "name": "datasource_3", + "description": "", + "parameters": { + "filter": { + "relation": "AND", + "operators": [] + }, + "schema": "q_constraint", + "table": "schema" + }, + "ressource_id": "vitis/genericquerys", + "id": "datasource_3" + } + } +} \ No newline at end of file diff --git a/module/javascript/controllers/userOrderCtrl.js b/module/javascript/controllers/userOrderCtrl.js index b038298914776c9c66705d0e62fb29b80c2217c4..498efbab65ea5391ba3dda58e684425dc4ddcaf7 100755 --- a/module/javascript/controllers/userOrderCtrl.js +++ b/module/javascript/controllers/userOrderCtrl.js @@ -6,10 +6,30 @@ goog.require("vitis.modules.main"); * userOrder Controller. * . * @param {angular.$log} $log Angular log service. + * @param {angular.$rootScope} $rootScope Angular rootScope. + * @param {$translateProvider.$translate} $translate TranslateProvider translate service. + * @param {service} envSrvc Paramètres d'environnement. + * @param {service} formSrvc Service de gestion des formulaires. * @ngInject **/ -vitisApp.userOrderCtrl = function ($log) { +vitisApp.userOrderCtrl = function ($log, $rootScope, $translate, envSrvc, formSrvc) { // Initialisation $log.info("initUserOrder"); + // Attends la fin de la compilation du formulaire. + var clearListener = $rootScope.$on("formExtracted", function(event) { + // Supprime le "listener". + clearListener(); + // Texte indicatif (placeholder) si aucune date de planification est sélectionnée. + $translate(["FORM_MINEXECDATE_PLACE_HOLDER_MY_WORK_USER_ORDER"]).then(function (translations) { + if (envSrvc["sMode"] == "insert") { + var oMinExecDateFormElemDef = formSrvc["getFormElementDefinition"]("minexecdate", envSrvc["sFormDefinitionName"]); + document.getElementById(oMinExecDateFormElemDef["id"]).setAttribute("placeholder", translations["FORM_MINEXECDATE_PLACE_HOLDER_MY_WORK_USER_ORDER"]); + } + else { + if (!goog.isDefAndNotNull(envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["minexecdate"])) + envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["minexecdate"] = translations["FORM_MINEXECDATE_PLACE_HOLDER_MY_WORK_USER_ORDER"]; + } + }); + }); }; vitisApp.module.controller("userOrderCtrl", vitisApp.userOrderCtrl); diff --git a/module/javascript/directives/projectDirectoryDrtv.js b/module/javascript/directives/projectDirectoryDrtv.js index 68385c5ab6c42f5977a11190807510288fbcff17..89be6a4ac36233c139a350f0a7063da026ec8e2f 100755 --- a/module/javascript/directives/projectDirectoryDrtv.js +++ b/module/javascript/directives/projectDirectoryDrtv.js @@ -91,6 +91,13 @@ vitisApp.appProjectDirectoryTreeviewDrtv = function(propertiesSrvc, envSrvc) { "data": scope["aTreeviewLogs"]["data"] }); } + else if (response["data"]["status"] == 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + scope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } } }); }; diff --git a/module/javascript/script_module.js b/module/javascript/script_module.js old mode 100755 new mode 100644 index 60d9a8dd5620b0c62787ad2e415c8819e5610afe..ef05d16c663caa2721d9c9acc1b4672ffa9137fe --- a/module/javascript/script_module.js +++ b/module/javascript/script_module.js @@ -239,8 +239,13 @@ vitisApp.on('appMainDrtvLoaded', function () { } // Test en erreur ? var sErrorMessage; - if (scope["oTestFmeEngineResult"]["exists"] !== true) - sErrorMessage = "ERROR_FME_PATH_ENGINE_FME_ENGINE"; + var sServerType = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["fme_engine_type_id"]; + if (sServerType == "desktop" && scope["oTestFmeEngineResult"]["exists"] !== true) + sErrorMessage = "ERROR_FME_PATH_ENGINE_FME_ENGINE"; // + else if (scope["oTestFmeEngineResult"]["expired"] === true) + sErrorMessage = "ERROR_FME_LICENSE_EXPIRED_ENGINE_FME_ENGINE"; + else if (scope["oTestFmeEngineResult"]["request_error"] === true) + sErrorMessage = "ERROR_FME_REQUEST_ERROR_ENGINE_FME_ENGINE"; else if (scope["oTestFmeEngineResult"]["valid"] !== true) sErrorMessage = "ERROR_FME_LICENSE_ENGINE_FME_ENGINE"; if (typeof (sErrorMessage) !== "undefined") { @@ -773,7 +778,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // Valeurs des champs cachés du form. de la demande. var oWkParams = {}; //var aSerializedSubForm = angular.element("#double_form_right_section_" + envSrvc["oSelectedObject"]["name"] + " form").serializeArray(); - //mise en forme pour fme + //mise en forme pour fme /***********************************************************************/ var encoderFME = function (str) { @@ -808,14 +813,14 @@ vitisApp.on('appMainDrtvLoaded', function () { //GTF_QUOTE et GTF BACKSLASH /* var quote = "<GTF_QUOTE>"; var backslash = "<GTF_BACKSLASH>"; - + var clipper = result.substr(iresult, quote.length); if (clipper === quote) { istr += quote.length; iresult += quote.length; find = true; } - + clipper = result.substr(iresult, backslash.length); console.error(result,clipper, iresult); if (clipper === backslash) { @@ -1088,7 +1093,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // Sauve les valeurs du formulaire du projet FME + id de l'utilisateur connecté. envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["wk_params"] = sWkParams; //envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["user_id"] = sessionStorage["user_id"]; - // + // envSrvc["sFormDefinitionName"] = envSrvc["sFormDefinitionName"].replace(/_subform/, "_form"); // Envoi du formulaire. return scope["sendSimpleForm"](true); @@ -1106,7 +1111,6 @@ vitisApp.on('appMainDrtvLoaded', function () { var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); var $timeout = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$timeout"]); var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); - var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); $log.info("initSubForm"); // Attends la fin de l'affichage du 1er formulaire. var clearListener = $rootScope.$on('formExtracted', function (event) { @@ -1117,13 +1121,11 @@ vitisApp.on('appMainDrtvLoaded', function () { $timeout(function () { // Evènement sur le <select> des projets Fme. document.getElementById("workspace_id").addEventListener("change", function () { - scope["loadSubForm"](this.value, scope, element); + angular.element(element).empty(); + if (this.value != "") + scope["loadSubForm"](this.value, scope, element); }); }, 100); - } else { - // Formatage de la date de demande. - if (goog.isDefAndNotNull(envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["order_date"])) - envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["order_date"] = moment(envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["order_date"]).format('L LTS'); } }); @@ -1178,7 +1180,7 @@ vitisApp.on('appMainDrtvLoaded', function () { } // 1er affichage ou tri de la liste : maj de la mise en forme. var clearObserver = attrs.$observe("appMessageStatusIconColumn", function (value) { - // Si le champ est vide : supprime l'icône. + // Si le champ est vide : supprime l'icône. if (scope["row"]["entity"][scope["col"]["field"]] == null || String(scope["row"]["entity"][scope["col"]["field"]]) == "") element[0].className = ""; else { @@ -1228,7 +1230,7 @@ vitisApp.on('appMainDrtvLoaded', function () { link: function (scope, element, attrs) { // 1er affichage ou tri de la liste : maj de la mise en forme. var clearObserver = attrs.$observe("appMessageBodyColumn", function (value) { - // Si le champ est vide : supprime l'icône. + // Si le champ est vide : supprime l'icône. if (scope["row"]["entity"][scope["col"]["field"]] == null || scope["row"]["entity"][scope["col"]["field"]] == "") element[0].className = ""; else { @@ -1379,7 +1381,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // . $log.info("checkCronExpression"); var scope = this; - // Sauve le nouveau scope crée dans la définition de l'onglet. + // Sauve le nouveau scope crée dans la définition de l'onglet. modesSrvc["addScopeToObject"](envSrvc["oSelectedObject"]["name"], envSrvc["oSelectedMode"]["mode_id"], scope); scope["oCheckCronExpressionResult"] = {}; // Paramètres du service web (vitis, gtf...) @@ -1454,7 +1456,7 @@ vitisApp.on('appMainDrtvLoaded', function () { } sColumn = "order_status_id"; } - // Onglet "Abonnements" / "Surveillances". + // Onglet "Messages". else if (envSrvc["oSelectedObject"]["name"] == "supervision_gtf_message"){ if (typeof (envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]) != "undefined" && typeof (envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["enabled"]) != "undefined") envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["status"] = JSON.parse(sFilter.toLowerCase()); @@ -1544,7 +1546,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // $log.info("ModifyEngine"); var scope = this; - // Sauve le nouveau scope crée dans la définition de l'onglet. + // Sauve le nouveau scope crée dans la définition de l'onglet. modesSrvc["addScopeToObject"](envSrvc["oSelectedObject"]["name"], envSrvc["oSelectedMode"]["mode_id"], scope); // Des demandes sont sélectionnées ? var aSelectedRows = scope.$root["gridApi"][scope["sSelectedGridOptionsName"]]["selection"]["getSelectedRows"](); @@ -1892,7 +1894,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // Sauve le nouvel onglet. var oMode = modesSrvc["getMode"](envSrvc["oSelectedMode"]["mode_id"]); oMode["objects"].push(angular.copy(envSrvc["oSelectedObject"])); - // Sauve le nouveau scope crée dans la définition de l'onglet. + // Sauve le nouveau scope crée dans la définition de l'onglet. modesSrvc["addScopeToObject"](envSrvc["oSelectedObject"]["name"], envSrvc["oSelectedMode"]["mode_id"], scope); // Compilation du template "doubleFormTpl". //var sTemplateUrl = 'templates/doubleFormTpl.html'; @@ -2044,7 +2046,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // $log.info("showGtfLicenseInfos"); var scope = this.$new(); - // Sauve le nouveau scope crée dans la définition de l'onglet. + // Sauve le nouveau scope crée dans la définition de l'onglet. modesSrvc["addScopeToObject"](envSrvc["oSelectedObject"]["name"], envSrvc["oSelectedMode"]["mode_id"], scope); // Attends la compilation du formulaire de la section "licence". var clearListener = scope.$root.$on('endFormNgRepeat', function (event) { @@ -2099,7 +2101,7 @@ vitisApp.on('appMainDrtvLoaded', function () { $log.info("showGtfLincenseFileRequestForm"); // Crée un nouveau scope. var scope = this.$new(); - // Sauve le nouveau scope crée dans la définition de l'onglet. + // Sauve le nouveau scope crée dans la définition de l'onglet. modesSrvc["addScopeToObject"](envSrvc["oSelectedObject"]["name"], envSrvc["oSelectedMode"]["mode_id"], scope); // var sFormId = "form_gtf_license_file_request_" + envSrvc["oSelectedObject"]["name"]; @@ -2525,7 +2527,7 @@ vitisApp.on('appMainDrtvLoaded', function () { var oFormValues = envSrvc['oFormValues'][envSrvc['sFormDefinitionName']]; // Paramètres pour le template du widget. scope['oWidgetParams'] = { - 'client_url': propertiesSrvc['web_server_name'] + '/' + sessionStorage['appEnv'], + 'client_url': propertiesSrvc['web_server_name'] + '/' + propertiesSrvc['application'], 'button_label': vitisApp['htmlentities'](oFormValues['buttonText']) }; // Fichiers js à charger. @@ -2589,7 +2591,7 @@ vitisApp.on('appMainDrtvLoaded', function () { "data": {"widgetFileContent": sCode}, "scope": scope, "success": function(response) { - oFormValues['url_widget_file'] = propertiesSrvc['web_server_name'] + '/' + propertiesSrvc['ws_data_alias'] + '/gtf/widget/' + response["data"]['workspace_key'] + '.html?token=' + oFormValues['token']; + oFormValues['url_widget_file'] = response["data"]['widget_file_url']; oFormValues['btn_download_widget_file'] = oFormValues['url_widget_file']; formSrvc['getFormElementDefinition']('url_widget_file', envSrvc['sFormDefinitionName'])['visible'] = true; formSrvc['getFormElementDefinition']('btn_download_widget_file', envSrvc['sFormDefinitionName'])['visible'] = true; @@ -2678,7 +2680,8 @@ vitisApp.on('appMainDrtvLoaded', function () { "scope": scope, "success": function(response) { if (response["data"]['status'] === 1) { - oFormValues['url_widget_file'] = propertiesSrvc['web_server_name'] + '/' + propertiesSrvc['ws_data_alias'] + '/gtf/widget/' + response["data"]['workspace_key'] + '.html?token=' + oFormValues['token']; + var oFormValues = envSrvc['oFormValues'][envSrvc['sFormDefinitionName']]; + oFormValues['url_widget_file'] = response["data"]['widget_file_url']; oFormValues['btn_download_widget_file'] = oFormValues['url_widget_file']; formSrvc['getFormElementDefinition']('url_widget_file', envSrvc['sFormDefinitionName'])['visible'] = true; formSrvc['getFormElementDefinition']('btn_download_widget_file', envSrvc['sFormDefinitionName'])['visible'] = true; @@ -2698,6 +2701,8 @@ vitisApp.on('appMainDrtvLoaded', function () { var envSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(['envSrvc']); var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(['propertiesSrvc']); var formSrvc = angular.element(vitisApp.appMainDrtv).injector().get(['formSrvc']); + var $rootScope = angular.element(vitisApp.appMainDrtv).injector().get(["$rootScope"]); + var $translate = angular.element(vitisApp.appMainDrtv).injector().get(["$translate"]); // var scope = this; ajaxRequest({ @@ -2710,10 +2715,14 @@ vitisApp.on('appMainDrtvLoaded', function () { formSrvc['getFormElementDefinition']('url_widget_file', envSrvc['sFormDefinitionName'])['visible'] = false; formSrvc['getFormElementDefinition']('btn_download_widget_file', envSrvc['sFormDefinitionName'])['visible'] = false; formSrvc['getFormElementDefinition']('btn_delete_widget_file', envSrvc['sFormDefinitionName'])['visible'] = false; + // Affiche le message de succés. + $translate("SUCCESSFUL_OPERATION").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); } else { // Affichage de la fenêtre modale d'erreur. - this['modalWindow']('dialog', response["data"]['errorMessage'], {'className': 'modal-danger'}); + $rootScope['modalWindow']('dialog', response["data"]['errorMessage'], {'className': 'modal-danger'}); } } }); @@ -2791,7 +2800,7 @@ vitisApp.on('appMainDrtvLoaded', function () { "className": "modal-danger", "message": response["data"]["errorMessage"] }; - scope["modalWindow"]("dialog", "ERROR_REEINTEGRATE_METADATA_PUBLICATION_WORKSPACE", oOptions); + scope["modalWindow"]("dialog", "ERROR_REINTEGRATE_METADATA_PUBLICATION_WORKSPACE", oOptions); } else { // Affiche le message de succés. $translate("SUCCESSFUL_OPERATION").then(function (sTranslation) { @@ -2842,9 +2851,6 @@ vitisApp.on('appMainDrtvLoaded', function () { oFormValues["form_type"] = aTranslation[sTranslationId]; angular.element(vitisApp.appMainDrtv).scope().$emit("WorkspaceGeneralSectionReady"); }); - // Formatage de la date de création du projet FME. - if (goog.isDefAndNotNull(oFormValues["creation_date"])) - oFormValues["creation_date"] = moment(oFormValues["creation_date"]).format('L'); // Traduction des valeurs booléennes (disponible sur abonnement, disponible pour surveillance, verrou). if (envSrvc["sMode"] === "display") { var scope = this; @@ -2854,6 +2860,17 @@ vitisApp.on('appMainDrtvLoaded', function () { scope.$root["getBooleanTranslation"](oFormValues["survey"]).then(function (sTranslation) { oFormValues["survey"] = sTranslation; }); + scope.$root["getBooleanTranslation"](oFormValues["dataencrypt"]).then(function (sTranslation) { + oFormValues["dataencrypt"] = sTranslation; + }); + scope.$root["getBooleanTranslation"](oFormValues["usepersonaldata"]).then(function (sTranslation) { + oFormValues["usepersonaldata"] = sTranslation; + }); + // Symbole "Euro". + if (goog.isDefAndNotNull(oFormValues["unitcost"]) && !isNaN(oFormValues["unitcost"])) + oFormValues["unitcost"] += " €"; + if (goog.isDefAndNotNull(oFormValues["costpersecond"]) && !isNaN(oFormValues["costpersecond"])) + oFormValues["costpersecond"] += " €"; } // Paramètres du lien vers le fichier fmw du projet fme. var oFmwFileUrlElementDef = formSrvc["getFormElementDefinition"]("fmw_file_url", envSrvc["sFormDefinitionName"]); @@ -2959,12 +2976,6 @@ vitisApp.on('appMainDrtvLoaded', function () { var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); // $log.info("initPublicationWorkspaceUpdateMetaDataForm"); - // Formatage de la date de dernière sauvegarde des métadonnées. - var scope = this; - if (goog.isDefAndNotNull(envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["last_save_date"])) { - envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["last_save_date"] = moment(envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["last_save_date"]).format('L LTS'); - scope.$apply(); - } }; /** @@ -3171,26 +3182,184 @@ vitisApp.on('appMainDrtvLoaded', function () { "sUrl": "modules/gtf/forms/" + envSrvc["oSelectedMode"]["mode_id"] + "/" + sTable + "_" + envSrvc["oSectionForm"][sTable]["sections"][envSrvc["oSectionForm"][sTable]["iSelectedSectionIndex"]]["name"] + ".json" }; }; - + /** - * loadGtfGroupQualigeo function. - * Chargement de la section "Qualigeo" dans l'onglet "Groupes" (mode "Utilisateurs"). + * displayFormFields function. + * Affiche la liste des champs de formulaire passée en paramètre et cache les autres. + * @param {array} aFormFieldsToDisplay Tableau de champs de formulaire à afficher. **/ - angular.element(vitisApp.appMainDrtv).scope()["loadGtfGroupQualigeo"] = function () { - console.log("FJHGIFHGFIHGIFHGIHGIORGHIO"); + angular.element(vitisApp.appMainDrtv).scope()["displayFormFields"] = function (aFormFieldsToDisplay) { // Injection des services. var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); - var envSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["envSrvc"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + var formSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["formSrvc"]); + var externFunctionSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["externFunctionSrvc"]); // - $log.info("loadGtfGroupQualigeo"); - // Surcharge l'url du formulaire des groupes de Gtf. - var scope = this; - var sTable = envSrvc["oSelectedObject"]["name"]; - scope["oFormRequestParams"] = { - "sUrl": "modules/gtf/forms/" + envSrvc["oSelectedMode"]["mode_id"] + "/" + sTable + "_" + envSrvc["oSectionForm"][sTable]["sections"][envSrvc["oSectionForm"][sTable]["iSelectedSectionIndex"]]["name"] + ".json" + $log.info("displayFormFields"); + // + var aFormFields = formSrvc["getAllFormElementDefinition"](envSrvc["sFormDefinitionName"], envSrvc["oFormDefinition"]); + var i, j; + if (Array.isArray(aFormFields)) { + for (i = 0; i < aFormFields.length; i++) { + if (aFormFieldsToDisplay.indexOf(aFormFields[i]["name"]) == -1) + aFormFields[i]["visible"] = false; + else + aFormFields[i]["visible"] = true; + // Boutons + if (Array.isArray(aFormFields[i]["buttons"])) { + for (j = 0; j < aFormFields[i]["buttons"].length; j++) { + if (aFormFieldsToDisplay.indexOf(aFormFields[i]["buttons"][j]["name"]) == -1) + aFormFields[i]["buttons"][j]["visible"] = false; + else { + aFormFields[i]["buttons"][j]["visible"] = true; + aFormFields[i]["visible"] = true; + } + } + } + } + // Rafraîchit le formulaire. + var formScope = angular.element("form[name='" + envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["name"]).scope(); + formScope.$broadcast('$$rebind::refresh'); + formScope.$applyAsync(); + // + externFunctionSrvc["resizeWin"](); + } + }; + + /** + * initGtfFmeEngineForm function. + * Traitements avant l'affichage du formulaire de l'onglet "Moteur FME". + **/ + angular.element(vitisApp.appMainDrtv).scope()["initGtfFmeEngineForm"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appMainDrtv).injector().get(["$rootScope"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + var formSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["formSrvc"]); + // + $log.info("initGtfFmeEngineForm"); + // + var clearListener = $rootScope.$on('formExtracted', function (event, sFormDefinitionName) { + // Supprime le "listener". + clearListener(); + // Affiche et cache les champs de form. suivant le type de moteur fme. + var oServerType = formSrvc["getFormElementDefinition"]("fme_engine_type_id", envSrvc["sFormDefinitionName"], envSrvc["oFormDefinition"]); + var sServerType = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["fme_engine_type_id"]; + if (typeof(sServerType) == "object") + sServerType = sServerType["selectedOption"]["value"]; + var formScope = angular.element("form[name='" + envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["name"]).scope(); + formScope["server_url"] = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["server_url"]; + // Affichage des champs de form. en fonction du type de moteur sélectionné. + if (envSrvc["sMode"] != "insert") + $rootScope["setGtfFmeEngineForm"](sServerType); + if (envSrvc["sMode"] != "display") { + document.getElementById(oServerType["id"]).addEventListener("change", function () { + $rootScope["setGtfFmeEngineForm"](this.value); + }); + } + // Désactivation des boutons de l'instance Fme Server suivant son statut . + if (sServerType == "fme_cloud" && envSrvc["sMode"] == "update") + $rootScope["refreshFmeServerInstanceStatus"](); + }); + }; + + /** + * setGtfFmeEngineForm function. + * Affichage des champs du formulaire de l'onglet "Moteur FME" suivant le type passé. + * @param {string} sServerType Type de moteur fme. + **/ + angular.element(vitisApp.appMainDrtv).scope()["setGtfFmeEngineForm"] = function (sServerType) { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appMainDrtv).injector().get(["$rootScope"]); + var $timeout = angular.element(vitisApp.appMainDrtv).injector().get(["$timeout"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + var formSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["formSrvc"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("setGtfFmeEngineForm"); + var formScope = angular.element("form[name='" + envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["name"]).scope(); + // Champs de form. à afficher suivant le type de moteur fme. + var aFormFieldsToConcat = ["fme_engine_id", "name", "server_id", "fme_engine_type_id","form_submit","return_list", "useexternaldbconnection"]; + var oFormFieldsToDisplay = { + "desktop": ["local_path", "test_fme_engine"], + "fme_server": ["server_url", "login", "password", "test_fme_engine"], + "fme_cloud": ["server_url", "login", "password", "fme_cloud_api_token", "fme_server_instance_title", "start_fme_server_instance", "pause_fme_server_instance", "fme_server_instance_version", "fme_server_instance_name", "refresh_fme_server_instance_status", "fme_server_instance_status"], // , "s3_access_key_id", "s3_secret_access_key", "s3_region", "amazon_s3_title", "fme_server_s3_bucket", "test_amazon_s3_bucket" + "fme_cloud_for_gtf": ["iam_access_key_id", "iam_secret_access_key", "s3_region", "fme_server_s3_bucket"] }; + if (envSrvc["sMode"] == "display") + aFormFieldsToConcat = aFormFieldsToConcat.concat(["fme_engine_type_label", "server_name"]); + var aFormFieldsToDisplay = []; + if (typeof (oFormFieldsToDisplay[sServerType]) != "undefined") + aFormFieldsToDisplay = oFormFieldsToDisplay[sServerType]; + aFormFieldsToDisplay = aFormFieldsToDisplay.concat(aFormFieldsToConcat); + $rootScope["displayFormFields"](aFormFieldsToDisplay); + // + if (envSrvc["sMode"] != "display") { + $timeout(function () { + // Bug avec les champs de form. "password" qui reste en "readonly". + var aPasswordElem = document.querySelectorAll("form[name='" + envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["name"] + "'] input[type='password']"); + for(var i= 0; i < aPasswordElem.length; i++) + aPasswordElem[i].readOnly = false; + // Url du serveur non modifiable si le type de moteur = fme cloud. + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + var oServerUrl = formSrvc["getFormElementDefinition"]("server_url", envSrvc["sFormDefinitionName"]); + var oServerUrlElem = document.getElementById(oServerUrl["id"]); + if (oServerUrlElem != null) { + if (sServerType == "fme_cloud") { + oServerUrlElem.readOnly = true; + formScope["server_url"] = oFormValues["server_url"]; + oFormValues["server_url"] = propertiesSrvc['fme_cloud_api_url']; + } + else { + oServerUrlElem.readOnly = false; + if (typeof(formScope["server_url"]) != "undefined") + oFormValues["server_url"] = formScope["server_url"]; + else + oFormValues["server_url"] = ''; + } + } + }); + } + } + + /** + * generateGtfInstanceId function. + * Génération de l'identifiant de l'instance de GTF. + **/ + angular.element(vitisApp.appMainDrtv).scope()["generateGtfInstanceId"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $translate = angular.element(vitisApp.appMainDrtv).injector().get(["$translate"]); + var envSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["envSrvc"]); + var propertiesSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("generateGtfInstanceId"); + // Charge le résumé de la supervision. + var formScope = angular.element('form[name=\'' + envSrvc['oFormDefinition'][envSrvc['sFormDefinitionName']]['name'] + '\']').scope(); + ajaxRequest({ + "method": "POST", + "scope": formScope, + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/instance/generate", + "success": function(response) { + if (response["data"]["status"] === 1) { + envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["gtf_instance_id"] = response["data"]["instance_id"]; + // Affiche le message de succés. + $translate("SUCCESSFUL_OPERATION").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + else { + var oOptions = {"className": "modal-danger"}; + // Message d'erreur ? + if (response["data"]["errorMessage"] !== null) + oOptions["message"] = response["data"]["errorMessage"]; + scope["modalWindow"]("alert", "REQUEST_ERROR", oOptions); + } + } + }); }; - + /** * afterGtfEngineForm function. * Traitement apès l'envoi du formulaire de l'onglet "Moteur GTF". @@ -3208,7 +3377,7 @@ vitisApp.on('appMainDrtvLoaded', function () { $rootScope["editSectionForm"]() }); }; - + /** * deleteGtfEngine function. * Suppression d'un ou plusieurs moteurs GTF. @@ -3230,7 +3399,7 @@ vitisApp.on('appMainDrtvLoaded', function () { // Supprime les enregistrements. $rootScope["DeleteSelection"](); }; - + /** * downloadGtfWorkspaceFile function. * Téléchargement d'un fichier du répertoire "workspace" d'un projet. @@ -3272,4 +3441,489 @@ vitisApp.on('appMainDrtvLoaded', function () { } }); }; -}); \ No newline at end of file + + /** + * StartFmeServerInstance function. + * Démarre une instance Fme Server (Fme Cloud). + **/ + angular.element(vitisApp.appMainDrtv).scope()["StartFmeServerInstance"] = function () { + // Injection des services. + var $translate = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$translate"]); + var $log = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + // + $log.info("StartFmeServerInstance"); + $rootScope["removeFmeServerInstanceInfo"](); + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + var oParams = { + "fme_engine_id": oFormValues['fme_engine_id'], + }; + ajaxRequest({ + "method": "PUT", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/fmeengines/" + oFormValues['fme_engine_id'] + "/instances/" + oFormValues["fme_server_instance_name"] + "/start", + "data": oParams, + "success": function(response) { + if (response["data"]["status"] == 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } else { + // Mise à jour du statut de l'instance. + $rootScope["setFmeServerInstanceStatus"](response["data"]["instance"]["state"]); + // Affichage du message de succés. + $translate("MSG_FME_SERVER_INSTANCE_EXECUTING_START_ENGINE_FME_ENGINE").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + } + }); + }; + + /** + * PauseFmeServerInstance function. + * Met en pause une instance Fme Server (Fme Cloud). + **/ + angular.element(vitisApp.appMainDrtv).scope()["PauseFmeServerInstance"] = function () { + // Injection des services. + var $translate = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$translate"]); + var $log = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + // + $log.info("PauseFmeServerInstance"); + // + $rootScope["removeFmeServerInstanceInfo"](); + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + var oParams = { + "fme_engine_id": oFormValues['fme_engine_id'], + }; + ajaxRequest({ + "method": "PUT", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/fmeengines/" + oFormValues['fme_engine_id'] + "/instances/" + oFormValues["fme_server_instance_name"] + "/pause", + "data": oParams, + "success": function(response) { + if (response["data"]["status"] == 0) { + // Affichage du message d'erreur. + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } else { + // Mise à jour du statut de l'instance. + $rootScope["setFmeServerInstanceStatus"](response["data"]["instance"]["state"]); + // Affichage du message de succés. + $translate("MSG_FME_SERVER_INSTANCE_EXECUTING_PAUSE_ENGINE_FME_ENGINE").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + } + }); + }; + + /** + * getFmeServerInstance function. + * Retourne une instance Fme Server (Fme Cloud). + * @param {number} sFmeEngineId Id du moteur Fme. + * @param {string} sFmeServerInstanceName Nom de l'instance Fme Server. + * @return {object} + **/ + angular.element(vitisApp.appMainDrtv).scope()["getFmeServerInstance"] = function (sFmeEngineId, sFmeServerInstanceName) { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $q = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$q"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var propertiesSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("getFmeServerInstance"); + // Charge les infos de l'instance Fme Server sur Fme Cloud. + var deferred = $q.defer(); + var promise = deferred.promise; + ajaxRequest({ + "method": "GET", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/fmeengines/" + sFmeEngineId + "/instances/" + sFmeServerInstanceName, + "success": function(response) { + if (response["data"]["status"] == 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + deferred.reject(false); + } else { + deferred.resolve(response["data"]["instance"]); + } + } + }); + return promise; + }; + + /** + * displayFmeServerInstanceInfo function. + * Affiche les informations d'une instance Fme Server sur Fme Cloud. + **/ + angular.element(vitisApp.appMainDrtv).scope()["displayFmeServerInstanceInfo"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var $templateRequest = angular.element(vitisApp.appMainDrtv).injector().get(["$templateRequest"]); + var $compile = angular.element(vitisApp.appMainDrtv).injector().get(["$compile"]); + var propertiesSrvc = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["propertiesSrvc"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + // + $log.info("displayFmeServerInstanceInfo"); + var scope = this; + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + // Charge les infos de l'instance Fme Server sur Fme Cloud. + ajaxRequest({ + "method": "GET", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/fmeengines/" + oFormValues['fme_engine_id'] + "/instances/" + oFormValues["fme_server_instance_name"] + "/info", + "success": function(response) { + if (response["data"]["status"] == 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } else { + // Informations sur Fme server pour le template. + scope["oTestFmeEngineResult"] = { + "exists" : true, + "valid" : true, + "host" : response["data"]["info"]["host"], + "type" : response["data"]["info"]["version"], + "version" : response["data"]["info"]["build"], + }; + // Création de l'élément html pour afficher le template. + var sContainerElementName = scope["sFormDefinitionName"] + "_fme_server_info_container"; + var oLastFormElement = document.querySelector(".fme_cloud_button").nextSibling; + if (document.getElementById(sContainerElementName) === null) { + var oDiv = document.createElement("div"); + oDiv.id = scope["sFormDefinitionName"] + "_fme_server_info_container"; + oLastFormElement.parentElement.insertBefore(oDiv, oLastFormElement); + } + // Compile le template du résultat. + $templateRequest("modules/gtf/templates/testFmeEngineTpl.html").then(function (sTemplate) { + $compile($("#" + sContainerElementName).html(sTemplate).contents())(scope); + }); + } + } + }); + }; + + /** + * setFmeServerInstanceButtonsStatus function. + * Active ou désactive les boutons de l'instance Fme Server suivant son statut. + * @param {string} sFmeServerInstanceName Nom de l'instance Fme Server. + **/ + angular.element(vitisApp.appMainDrtv).scope()["setFmeServerInstanceButtonsStatus"] = function (sFmeServerInstanceStatut) { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var formSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["formSrvc"]); + var envSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["envSrvc"]); + // + $log.info("setFmeServerInstanceButtonsStatus"); + // Les boutons sont désactivés par défaut. + var oStartInstanceFormElem = formSrvc["getFormElementDefinition"]("start_fme_server_instance", envSrvc["sFormDefinitionName"]); + var oPauseInstanceFormElem = formSrvc["getFormElementDefinition"]("pause_fme_server_instance", envSrvc["sFormDefinitionName"]); + var oInstanceVersionFormElem = formSrvc["getFormElementDefinition"]("fme_server_instance_version", envSrvc["sFormDefinitionName"]); + oStartInstanceFormElem["disabled"] = true; + oPauseInstanceFormElem["disabled"] = true; + oInstanceVersionFormElem["disabled"] = true; + if (sFmeServerInstanceStatut == "RUNNING") { + oPauseInstanceFormElem["disabled"] = false; + oInstanceVersionFormElem["disabled"] = false; + } + else if (sFmeServerInstanceStatut == "PAUSED") + oStartInstanceFormElem["disabled"] = false; + // Rafraîchit le formulaire. + var formScope = angular.element("form[name='" + envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["name"]).scope(); + formScope.$broadcast('$$rebind::refresh'); + formScope.$applyAsync(); + }; + + /** + * removeFmeServerInstanceInfo function. + * Supprime les informations d'une instance Fme Server sur Fme Cloud. + **/ + angular.element(vitisApp.appMainDrtv).scope()["removeFmeServerInstanceInfo"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var envSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["envSrvc"]); + // + $log.info("removeFmeServerInstanceInfo"); + var oContainerElement = document.getElementById(envSrvc["sFormDefinitionName"] + "_fme_server_info_container"); + if (oContainerElement !== null) + oContainerElement.parentElement.removeChild(oContainerElement); + }; + + /** + * refreshFmeServerInstanceStatus function. + * Charge et met à jour le statut d'une instance Fme Server. + **/ + angular.element(vitisApp.appMainDrtv).scope()["refreshFmeServerInstanceStatus"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var envSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["envSrvc"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("refreshFmeServerInstanceStatus"); + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + // Charge le statut de l'instance Fme Server sur Fme Cloud. + ajaxRequest({ + "method": "GET", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/fmeengines/" + oFormValues['fme_engine_id'] + "/instances/" + oFormValues["fme_server_instance_name"], + "success": function(response) { + if (response["data"]["status"] == 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } else { + // Met à jour le statut. + $rootScope["setFmeServerInstanceStatus"](response["data"]["instance"]["state"]); + } + } + }); + }; + + /** + * setFmeServerInstanceStatus function. + * Met à jour le statut d'une instance Fme Server dans le formulaire "Moteur FME". + * @param {string} sFmeServerInstanceState Statut de l'instance Fme Server. + **/ + angular.element(vitisApp.appMainDrtv).scope()["setFmeServerInstanceStatus"] = function (sFmeServerInstanceState) { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var $translate = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$translate"]); + var envSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["envSrvc"]); + // + $log.info("setFmeServerInstanceStatus"); + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + // Activation des boutons de l'instance Fme Server suivant son statut. + $rootScope["setFmeServerInstanceButtonsStatus"](sFmeServerInstanceState); + // Supprime le loader Ajax à côté des boutons de Fme Cloud. + var oFmeServerInstanceStatusRefreshBtnElem = document.querySelector("button[name='refresh_fme_server_instance_status'] > span"); + oFmeServerInstanceStatusRefreshBtnElem.classList.remove("fme-server-instance-status-button-rotation"); + // Traitements spécifiques si une action est cours d'exécution sur l'instance Fme Server. + if (sFmeServerInstanceState == "executing_action") { + // Loader Ajax à côté des boutons de Fme Cloud. + oFmeServerInstanceStatusRefreshBtnElem.classList.add("fme-server-instance-status-button-rotation"); + // Création d'un interval (si inexistant). + if (!goog.isNumber($rootScope["iFmeServerInstanceStatusInterval"])) { + // Vérification du statut de l'instance Fme Server jusqu'à démarrage. + var iIntervalId = setInterval(function() { + $rootScope["getFmeServerInstance"](oFormValues['fme_engine_id'], oFormValues["fme_server_instance_name"]).then(function(oInstance){ + if (goog.isObject(oInstance)) { + $rootScope["setFmeServerInstanceStatus"](oInstance["state"]); + if (oInstance["state"] != "executing_action") { + // Suppression de l'intervalle. + clearInterval(iIntervalId); + delete($rootScope["iFmeServerInstanceStatusInterval"]); + // L'instance a démarré. + if (oInstance["state"] == "RUNNING") { + // Affichage du message de succés. + $translate("MSG_FME_SERVER_INSTANCE_START_ENGINE_FME_ENGINE").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + // L'instance est arrétée. + else if (oInstance["state"] == "PAUSED") { + // Affichage du message de succés. + $translate("MSG_FME_SERVER_INSTANCE_PAUSE_ENGINE_FME_ENGINE").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + } + } + else { + clearInterval(iIntervalId); + delete($rootScope["iFmeServerInstanceStatusInterval"]); + } + }); + }, 6000); + $rootScope["iFmeServerInstanceStatusInterval"] = iIntervalId; + // Attends la suppression du scope. + var formScope = angular.element('form[name=\'' + envSrvc['oFormDefinition'][envSrvc['sFormDefinitionName']]['name'] + '\']').scope(); + formScope.$on("$destroy", function () { + clearInterval(iIntervalId); + delete($rootScope["iFmeServerInstanceStatusInterval"]); + }); + } + } + // Mise à jour l'affichage du statut. + var oFmeServerInstanceStateTranslation = { + "RUNNING": "FORM_FME_SERVER_INSTANCE_STATUS_RUNNING_ENGINE_FME_ENGINE", + "PAUSED": "FORM_FME_SERVER_INSTANCE_STATUS_PAUSED_ENGINE_FME_ENGINE", + "executing_action": "FORM_FME_SERVER_INSTANCE_STATUS_executing_action_ENGINE_FME_ENGINE" + }; + $translate(oFmeServerInstanceStateTranslation[sFmeServerInstanceState]).then(function (sTranslation) { + oFormValues["fme_server_instance_status"] = sTranslation; + }); + }; + + /** + * testAmazonS3BucketConnection function. + * Teste la connexion vers un bucket Amazon S3. + **/ + angular.element(vitisApp.appMainDrtv).scope()["testAmazonS3BucketConnection"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var $translate = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$translate"]); + var envSrvc = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["envSrvc"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("testAmazonS3BucketConnection"); + var oFormValues = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]; + // Charge le statut de l'instance Fme Server sur Fme Cloud. + ajaxRequest({ + "method": "GET", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/vitis/amazonawsservices/s3/" + oFormValues['fme_server_s3_bucket'] + "/test", + "params": { + "access_key_id": oFormValues["s3_access_key_id"], + "secret_access_key_id": oFormValues["s3_secret_access_key"], + "region": oFormValues["s3_region"]["selectedOption"]["value"], + "bucket_name": oFormValues["fme_server_s3_bucket"] + }, + "success": function(response) { + if (response["data"]["status"] == 0) { + // Affichage du message d'erreur. + var oOptions = { + "className": "modal-danger" + }; + $translate([ + "TEST_AMAZON_S3_BUCKET_ERROR_NO_SUCH_BUCKET_ENGINE_FME_ENGINE", + "TEST_AMAZON_S3_BUCKET_ERROR_INVALID_ACCESS_KEY_ID_FME_ENGINE", + "TEST_AMAZON_S3_BUCKET_ERROR_SIGNATURE_DOES_NOT_MATCH_FME_ENGINE" + ]).then(function (oTranslations) { + switch (response["data"]["message"]) { + case "NoSuchBucket": + oOptions["message"] = oTranslations["TEST_AMAZON_S3_BUCKET_ERROR_NO_SUCH_BUCKET_ENGINE_FME_ENGINE"]; + break; + case "InvalidAccessKeyId": + oOptions["message"] = oTranslations["TEST_AMAZON_S3_BUCKET_ERROR_INVALID_ACCESS_KEY_ID_FME_ENGINE"]; + break; + case "SignatureDoesNotMatch": + oOptions["message"] = oTranslations["TEST_AMAZON_S3_BUCKET_ERROR_SIGNATURE_DOES_NOT_MATCH_FME_ENGINE"]; + break; + }; + $rootScope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + }); + } else { + // Affiche le message de succés. + $translate("SUCCESSFUL_OPERATION").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + } + }); + }; + + /** + * deleteGtfOrders function. + * Suppression d'une ou plusieurs demandes. + **/ + angular.element(vitisApp.appMainDrtv).scope()["deleteGtfOrders"] = function () { + // Injection des services. + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var $log = angular.element(vitisApp.appWorkspaceListDrtv).injector().get(["$log"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + // + $log.info("deleteGtfOrders"); + // Charge la liste des pid (job id) de demandes en cours de traitement. + ajaxRequest({ + "method": "GET", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/orders/running", + "success": function(response) { + if (response["data"]["status"] === 1) { + // Liste des demandes sélectionnées. + var aSelectedRows = $rootScope["gridApi"][envSrvc["sSelectedGridOptionsName"]]["selection"]["getSelectedRows"](); + var aOrders = response["data"]["orders"]; + if (goog.isArray(aOrders) && aSelectedRows.length > 0) { + var sMessage; + for (var i = 0; i < aSelectedRows.length; i++) { + if (aOrders.indexOf(aSelectedRows[i]["order_id"]) != -1) { + sMessage = "CONFIRM_DELETE_ORDERS_SUPERVISION_ORDER"; + break; + } + } + } + // Supprime les enregistrements. + $rootScope["DeleteSelection"]({"sMessage": sMessage}); + } + else { + var oOptions = {"className": "modal-danger"}; + // Message d'erreur ? + if (response["data"]["errorMessage"] !== null) + oOptions["message"] = response["data"]["errorMessage"]; + $rootScope["modalWindow"]("alert", "REQUEST_ERROR", oOptions); + } + } + }); + }; + + /** + * stopOrderProcess function. + * Arrête une demande en cours. + */ + angular.element(vitisApp.appMainDrtv).scope()["stopOrderProcess"] = function () { + // Injection des services. + var $log = angular.element(vitisApp.appMainDrtv).injector().get(["$log"]); + var $translate = angular.element(vitisApp.appMainDrtv).injector().get(["$translate"]); + var $rootScope = angular.element(vitisApp.appStatisticsFormDrtv).injector().get(["$rootScope"]); + var envSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["envSrvc"]); + var propertiesSrvc = angular.element(vitisApp.appMainDrtv).injector().get(["propertiesSrvc"]); + // + $log.info("stopOrderProcess"); + // Une seule demande peut être arrêté. + var aSelectedRows = $rootScope["gridApi"][envSrvc["sSelectedGridOptionsName"]]["selection"]["getSelectedRows"](); + var oOptions = { + "className": "modal-danger" + }; + if (aSelectedRows.length > 0) { + if (aSelectedRows.length == 1) { + if (aSelectedRows[0]["order_status_id"] == 5) { + ajaxRequest({ + "method": "PUT", + "url": propertiesSrvc["web_server_name"] + "/" + propertiesSrvc["services_alias"] + "/gtf/orders/" + aSelectedRows[0]["order_id"] + "/stop", + "params": {"order_id": aSelectedRows[0]["order_id"]}, + //"scope": scope, + "success": function(response) { + if (response["data"]["status"] === 0) { + var oOptions = { + "className": "modal-danger", + "message": response["data"]["errorMessage"] + }; + scope["modalWindow"]("dialog", "REQUEST_ERROR", oOptions); + } else { + // + $rootScope['refreshGrid']($rootScope["gridApi"][envSrvc["sSelectedGridOptionsName"]]['grid']['appScope'], envSrvc["oGridOptions"][envSrvc["sSelectedGridOptionsName"]]); + $rootScope["refreshSupervisionRecap"](); + // Affiche le message de succés. + $translate("SUCCESSFUL_OPERATION").then(function (sTranslation) { + $.notify(sTranslation, "success"); + }); + } + } + }); + } + else + $rootScope["modalWindow"]("dialog", "ERROR_STOP_ORDER_PROCESS_NO_RUNNING_ORDER_SUPERVISION_ORDER", oOptions); + } + else + $rootScope["modalWindow"]("dialog", "ERROR_STOP_ORDER_PROCESS_ONE_ORDER_ONLY_SUPERVISION_ORDER", oOptions); + } + else + $rootScope["modalWindow"]("dialog", "ERROR_STOP_ORDER_PROCESS_NO_SELECTION_SUPERVISION_ORDER", oOptions); + }; +}); diff --git a/module/javascript/widget/script_widget.js b/module/javascript/widget/script_widget.js index 4ade98a80c32086f8f8a2f63b6455205b0465b45..80fe1b777052202c006f3249572fa7332093e269 100755 --- a/module/javascript/widget/script_widget.js +++ b/module/javascript/widget/script_widget.js @@ -135,6 +135,8 @@ widget.initWidget = function () { var clearFormDefListener = scope.$root.$on('formDefinitionLoaded', function (event, sFormDefinitionName) { // Supprime le "listener". clearFormDefListener(); + // Sauve les valeurs d'origine. + scope["oOriginalFormValues"] = angular.copy(envSrvc["oFormValues"][sFormDefinitionName]); // Vérification avant l'envoi du formulaire envSrvc["oFormDefinition"][sFormDefinitionName]["beforeEvent"] = function () { var deferred = $q.defer(); @@ -313,10 +315,8 @@ widget.sendSubForm = function () { // Affichage du message de succés. $translate("FORM_VALIDATION_OK").then(function (sTranslation) { $.notify(sTranslation, "success"); + formScope[sFormElementName]["appFormSubmitted"] = false; // Recharge le widget. - setTimeout(function(){ - window.location.reload(); - }, 2000); // Vidage du formulaire. //angular.element("#widget_form_container").empty(); /* @@ -558,9 +558,6 @@ widget.formatSubForm = function (scope) { } else sDirectory = envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]]["upload_directory"]; - // - envSrvc["oFormDefinition"][envSrvc["sFormDefinitionName"]]["rows"].push({"fields": [formSrvc["getFormElementDefinition"](val["name"], scope["sFormDefinitionName"])]}); - envSrvc["oFormValues"][envSrvc["sFormDefinitionName"]][val["name"]] = envSrvc["oFormValues"][scope["sFormDefinitionName"]][val["name"]]; // Fichier sélectionné. if (typeof (tmp["aFiles"]) != "undefined" && tmp["aFiles"].length > 0) { @@ -612,7 +609,7 @@ widget.formatSubForm = function (scope) { var aWkParams = []; i = 0; while (i < aKeys.length) { - if (aKeys[i] != "email_notifications") + if (aKeys[i] != "email_notifications" && aKeys[i] != "upload_directory") aWkParams.push(aKeys[i] + "=" + oFormValues[aKeys[i]]); i++; } diff --git a/module/lang/lang-en.json b/module/lang/lang-en.json old mode 100755 new mode 100644 index a3a99c6f88d121a35b196565dd8b637be4e0fec8..989140aa4325eb6201699c9362f3f232b3aabc63 --- a/module/lang/lang-en.json +++ b/module/lang/lang-en.json @@ -6,12 +6,14 @@ "TITLE_MODE_SUPERVISION" : "Supervision", "TITLE_MODE_STATISTICS" : "Statistics", "TITLE_MODE_PUBLICATION_AUTHOR" : "Publication", + "TITLE_MODE_EXPLOITATION" : "Exploitation", "TEXT_MODE_MY_WORK" : "User activities", "TEXT_MODE_ENGINE" : "FME settings", "TEXT_MODE_PUBLICATION" : "Publish FME workspaces", "TEXT_MODE_SUPERVISION" : "Supervision", "TEXT_MODE_STATISTICS" : "Production of graphs and tables", "TEXT_MODE_PUBLICATION_AUTHOR" : "Publish FME workspaces", + "TEXT_MODE_EXPLOITATION" : "Exploitation", "" : "", "SECTION_UPDATE_TITLE_PUBLICATION_GTF_WORKSPACE" : "FME Project n°{{sId}}", "SECTION_DISPLAY_TITLE_PUBLICATION_GTF_WORKSPACE" : "FME Project n°{{sId}}", @@ -19,9 +21,7 @@ "SECTION_UPDATE_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Email template n°{{sId}}", "SECTION_DISPLAY_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Email template n°{{sId}}", "SECTION_INSERT_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Email template", - "SECTION_UPDATE_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "FME Project n°{{sId}}", - "SECTION_DISPLAY_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "FME Project n°{{sId}}", - "SECTION_INSERT_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "FME Project", + "SECTION_UPDATE_TITLE_EXPLOITATION_EXPLOITATION" : "Exploitation", "" : "", "FORM_CALCULATE_STATS" : "Calculate", "FORM_TITLE_STATISTICS" : "Select parameters for the statistics", @@ -128,6 +128,10 @@ "FORM_MISSING_FORM_PUBLICATION_WORKSPACE" : "Missing form", "FORM_WORKSPACE_NAME_EXISTS_PUBLICATION_WORKSPACE" : "This name is already used by another workspace", "FORM_FMW_FILE_URL_PUBLICATION_WORKSPACE" : "fmw file of the workspace", + "FORM_DATAENCRYPT_PUBLICATION_WORKSPACE" : "Data encryption", + "FORM_USEPERSONALDATA_PUBLICATION_WORKSPACE" : "Use of personal data", + "FORM_UNITCOST_PUBLICATION_WORKSPACE": "Unit cost", + "FORM_COSTPERSECOND_PUBLICATION_WORKSPACE": "Cost per second", "" : "", "FORM_ID_PUBLICATION_WORKSPACE_UPDATE_METADATA" : "ID", "FORM_TITLE_PUBLICATION_WORKSPACE_UPDATE_METADATA" : "Project title", @@ -150,6 +154,7 @@ "ERROR_REINTEGRATE_METADATA_PUBLICATION_WORKSPACE" : "Error while project", "CONFIRM_DELETE_LOCKED_WOKSPACE_PUBLICATION_WORKSPACE": "One or more projects are locked and can not be deleted. Continue ?", "FORM_BTN_REGENERATE_METADATA_TOOLTIP_PUBLICATION_WORKSPACE" : "Remplacement des champs Description, Utilisation, Prérequis et Conditions d'utilisation saisis dans GTF par les valeurs correspondantes contenues dans le projet FME source. Attention, les valeurs actuelles seront supprimées.", + "ERROR_WORKSPACE_FILE_NOT_FOUND" : "Reading error on the.fmw file of the FME project", "" : "", "TOOLTIP_TITLE_IMPORT_TOKEN_CONNECTION" : "Generate a token", "FORM_USER_IMPORT_TOKEN_CONNECTION" : "User", @@ -199,6 +204,7 @@ "" : "", "ERROR_WORKSPACE_NOT_LINKED_USER_GROUPS_WIDGET" : "The workspace is not linked to any group of users", "ERROR_CAPTCHA_VALIDATION_WIDGET" : "The validation of the captcha failed", + "ERROR_CREATION_WIDGET_FILE" : "Error while creating the widget file", "" : "", "FORM_FMW_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "fmw file", "FORM_ADDITIONAL_RESOURCES_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Additionnal resources", @@ -214,6 +220,7 @@ "ERROR_FMW_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "The selected file is not a valid fmw file", "ERROR_ADDITIONAL_RESOURCES_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "The selected file type is not allowed", "ERROR_FILE_SIZE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "The file size exceeds the maximum allowed size.", + "ERROR_FILE_TREE_LOADING_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Error while loading the project file list", "" : "", "DESCRIPTION_TOOLTIP_TITLE_PUBLICATION_WORKSPACE" : "Description", "" : "", @@ -235,6 +242,8 @@ "FORM_TREATMENT_WORKSPACES_MY_WORK_USER_ORDER" : "Workspaces linked to treatment", "ERROR_NO_GTF_ENGINE_CONTENT_MY_WORK_USER_ORDER" : "Please create a GTF engine to add orders", "ERROR_NO_GTF_ENGINE_TITLE_MY_WORK_USER_ORDER" : "No GTF engine", + "FORM_MINEXECDATE_MY_WORK_USER_ORDER" : "Planning date", + "FORM_MINEXECDATE_PLACE_HOLDER_MY_WORK_USER_ORDER" : "As soon as possible", "" : "", "FORM_EXECUTE_WORKSPACE_PUBLICATION_WORKSPACE_SUB_FORM" : "Execute", "FORM_PREVISU_PUBLISHED_PUBLICATION_WORKSPACE_SUB_FORM" : "Preview the published form", @@ -257,6 +266,21 @@ "FME_VERSION_ENGINE_FME_ENGINE" : "Version", "FME_VALIDITY_ENGINE_FME_ENGINE" : "Validity", "FME_TYPE_ENGINE_FME_ENGINE" : "Type", + "ERROR_FME_LICENSE_EXPIRED_ENGINE_FME_ENGINE" : "The licence has expired", + "ERROR_FME_REQUEST_ERROR_ENGINE_FME_ENGINE" : "The request returned an error", + "FORM_BTN_START_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE" : "Start", + "FORM_BTN_PAUSE_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE" : "Stop", + "FORM_BTN_FME_SERVER_INSTANCE_VERSION_ENGINE_FME_ENGINE" : "Version", + "MSG_FME_SERVER_INSTANCE_EXECUTING_PAUSE_ENGINE_FME_ENGINE" : "The Fme Server instance is in the process of being stopped", + "MSG_FME_SERVER_INSTANCE_PAUSE_ENGINE_FME_ENGINE" : "The Fme Server instance is stopped", + "MSG_FME_SERVER_INSTANCE_EXECUTING_START_ENGINE_FME_ENGINE" : "The Fme Server instance is starting up", + "MSG_FME_SERVER_INSTANCE_START_ENGINE_FME_ENGINE" : "The Fme Server instance is running", + "FORM_FME_SERVER_INSTANCE_NAME_ENGINE_FME_ENGINE" : "Nom de l'instance", + "FORM_BTN_REFRESH_FME_SERVER_INSTANCE_STATUT_STATUT_ENGINE_FME_ENGINE" : "Refresh", + "FORM_FME_SERVER_INSTANCE_STATUS_ENGINE_FME_ENGINE" : "Status", + "FORM_FME_SERVER_INSTANCE_STATUS_RUNNING_ENGINE_FME_ENGINE" : "Instance started", + "FORM_FME_SERVER_INSTANCE_STATUS_PAUSED_ENGINE_FME_ENGINE" : "Instance stopped", + "FORM_FME_SERVER_INSTANCE_STATUS_executing_action_ENGINE_FME_ENGINE" : "Instance in the process of stopping or starting", "" : "", "FORM_BTN_CREATE_SUBSCRIPTION_MY_WORK_GTF_USER_SUBSCRIPTION" : "Order", "FORM_BTN_UPDATE_SUBSCRIPTION_MY_WORK_GTF_USER_SUBSCRIPTION" : "Update subscription", @@ -408,9 +432,13 @@ "FORM_PASSWORD_PROXY_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Proxy server password", "FORM_DEFAULT_MAIL_MODEL_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Default email template", "FORM_LOG_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Log", - "FORM_PYCRON_DIR_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Pycron directory (Windows) / Cron (Linux)", - "FORM_PYCRON_LOG_DIRECTORY_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Directory Pycron logs", - "FORM_GTF_DOC_ALIAS_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "GTF documentation alias", + "FORM_PYCRON_DIR_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Pycron directory", + "FORM_PYCRON_LOG_DIRECTORY_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Directory Pycron logs", + "FORM_GTF_INSTANCE_ID_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "GTF instance identifier", + "FORM_BTN_GENERATE_GTF_INSTANCE_ID_WORKSPACE_EDIT_WIDGET" : "Generate", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG" :"External use of GTF_CONNECTION_STRING", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGIP" : "Public IP for database's connection", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGPORT" : "Public Port for database's connection", "" : "", "FORM_SUBTITLE_INFORMATIONS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Informations", "FORM_SUBTITLE_REQUEST_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Request license", @@ -439,6 +467,7 @@ "SEND_MAIL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Mail sent successfully", "LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Error while installing the license file.", "LICENSE_FILE_INSTALL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "License file successfully installed", + "SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Please enter the settings of your SMTP server", "" : "", "FORM_NAME_ENGINE_GTF_ENGINE" : "Name", "FORM_SERVER_ENGINE_GTF_ENGINE" : "Server", @@ -458,6 +487,42 @@ "FORM_ID_ENGINE_FME_ENGINE" : "ID", "FORM_PATH_ENGINE_FME_ENGINE" : "Path to the FME executable", "FORM_TITLE_ENGINE_FME_ENGINE" : "FME engine {{::name}}", + "FORM_TYPE_ENGINE_FME_ENGINE" : "Type", + "FORM_SERVER_URL_ENGINE_FME_ENGINE" : "Server url", + "FORM_LOGIN_ENGINE_FME_ENGINE" : "User", + "FORM_PASSWORD_ENGINE_FME_ENGINE" : "Password", + "FORM_S3_ACCESS_KEY_ID_ENGINE_FME_ENGINE" : "S3 access key id", + "FORM_S3_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE" : "S3 secret access key", + "FORM_FME_CLOUD_API_TOKEN_ENGINE_FME_ENGINE" : "FME Cloud API token", + "FORM_S3_REGION_ENGINE_FME_ENGINE" : "S3 region", + "FORM_S3_REGION_US-EAST-2_ENGINE_FME_ENGINE" : "US East (Ohio)", + "FORM_S3_REGION_US-EAST-1_ENGINE_FME_ENGINE" : "US East (N. Virginia)", + "FORM_S3_REGION_US-WEST-1_ENGINE_FME_ENGINE" : "US West (N. California)", + "FORM_S3_REGION_US-WEST-2_ENGINE_FME_ENGINE" : "US West (Oregon)", + "FORM_S3_REGION_AP-SOUTH-1_ENGINE_FME_ENGINE" : "Asia Pacific (Mumbai)", + "FORM_S3_REGION_AP-NORTHEAST-2_ENGINE_FME_ENGINE" : "Asia Pacific (Seoul)", + "FORM_S3_REGION_AP-SOUTHEAST-1_ENGINE_FME_ENGINE" : "Asia Pacific (Singapore)", + "FORM_S3_REGION_AP-SOUTHEAST-2_ENGINE_FME_ENGINE" : "Asia Pacific (Sydney)", + "FORM_S3_REGION_AP-NORTHEAST-1_ENGINE_FME_ENGINE" : "Asia Pacific (Tokyo)", + "FORM_S3_REGION_CA-CENTRAL-1_ENGINE_FME_ENGINE" : "Canada (Central)", + "FORM_S3_REGION_CN-NORTH-1_ENGINE_FME_ENGINE" : "China (Beijing)", + "FORM_S3_REGION_EU-CENTRAL-1_ENGINE_FME_ENGINE" : "EU (Frankfurt)", + "FORM_S3_REGION_EU-WEST-1_ENGINE_FME_ENGINE" : "EU (Ireland)", + "FORM_S3_REGION_EU-WEST-2_ENGINE_FME_ENGINE" : "EU (London)", + "FORM_S3_REGION_EU-WEST-3_ENGINE_FME_ENGINE" : "EU (Paris)", + "FORM_S3_REGION_SA-EAST-1_ENGINE_FME_ENGINE" : "South America (São Paulo)", + "FORM_FME_SERVER_INSTANCE_TITLE_ENGINE_FME_ENGINE" : "FME Server instance", + "FORM_AMAZON_S3_TITLE_ENGINE_FME_ENGINE" : "Amazon S3", + "FORM_IAM_ACCESS_KEY_ID_ENGINE_FME_ENGINE" : "IAM access key to the FME Cloud for GTF service", + "FORM_IAM_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE" : "IAM secret access key to the FME Cloud for GTF service", + "FORM_FME_SERVER_S3_BUCKET_ENGINE_FME_ENGINE" : "Bucket name", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE" : "Do you want use external GTF_CONNECTION_STRING ?", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_YES" : "Yes (Public database informations)", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_NO" : "No (Private database informations)", + "FORM_BTN_TEST_AMAZON_S3_BUCKET_ENGINE_FME_ENGINE" : "Tester", + "TEST_AMAZON_S3_BUCKET_ERROR_NO_SUCH_BUCKET_ENGINE_FME_ENGINE" : "The specified bucket does not exist", + "TEST_AMAZON_S3_BUCKET_ERROR_INVALID_ACCESS_KEY_ID_FME_ENGINE" : "The S3 Access Key you provided does not exist", + "TEST_AMAZON_S3_BUCKET_ERROR_SIGNATURE_DOES_NOT_MATCH_FME_ENGINE" : "The calculation of the signature does not match. Check your S3 secret access key.", "" : "", "FORM_ID_ENGINE_SERVER" : "ID", "FORM_NAME_ENGINE_SERVER" : "Name", @@ -507,5 +572,8 @@ "FORM_WIDGET_NOTIFICATIONS_NEEDED_PUBLICATION_WORKSPACE_EDIT_WIDGET" : "Email (Mandatory)", "FORM_WIDGET_NOTIFICATIONS_OPTIONAL_PUBLICATION_WORKSPACE_EDIT_WIDGET" : "Email (Optional)", "EXPIRED_WIDGET_TOKEN_ERROR_TITLE": "Session timed out", - "INVALID_WIDGET_TOKEN_ERROR_TITLE": "Invalid Session" -} \ No newline at end of file + "INVALID_WIDGET_TOKEN_ERROR_TITLE": "Invalid Session", + "FORM_USERS_GROUP_QUALIGEO_DOUBLE_SELECT": "Schemas", + "FORM_USERS_GROUP_QUALIGEO_SCHEMA_AVAILABLE": "Available schemas", + "FORM_USERS_GROUP_QUALIGEO_SCHEMA_ASSOCIATE": "Associated schemas" +} diff --git a/module/lang/lang-fr.json b/module/lang/lang-fr.json old mode 100755 new mode 100644 index 61ef1c98a3d06f7e7251f101f115a9092ac9918a..70c607cc370491cd4b3fc58ba20eb6b64a4f93ea --- a/module/lang/lang-fr.json +++ b/module/lang/lang-fr.json @@ -6,12 +6,14 @@ "TITLE_MODE_SUPERVISION" : "Supervision", "TITLE_MODE_STATISTICS" : "Statistiques", "TITLE_MODE_PUBLICATION_AUTHOR" : "Publication", + "TITLE_MODE_EXPLOITATION" : "Exploitation", "TEXT_MODE_MY_WORK" : "Activités propres à l'utilisateur connecté", "TEXT_MODE_ENGINE" : "Gestion des moteurs", "TEXT_MODE_PUBLICATION" : "Publication des projets FME", "TEXT_MODE_SUPERVISION" : "Supervision", "TEXT_MODE_STATISTICS" : "Production de graphiques et d'états sur l'utilisation des ressources", "TEXT_MODE_PUBLICATION_AUTHOR" : "Publication des projets FME", + "TEXT_MODE_EXPLOITATION" : "Exploitation", "" : "", "SECTION_UPDATE_TITLE_PUBLICATION_GTF_WORKSPACE" : "Projet FME n°{{sId}}", "SECTION_DISPLAY_TITLE_PUBLICATION_GTF_WORKSPACE" : "Projet FME n°{{sId}}", @@ -19,9 +21,7 @@ "SECTION_UPDATE_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Modèle e-mail n°{{sId}}", "SECTION_DISPLAY_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Modèle e-mail n°{{sId}}", "SECTION_INSERT_TITLE_PUBLICATION_GTF_EMAIL_TEMPLATE" : "Modèle e-mail", - "SECTION_UPDATE_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "Projet FME n°{{sId}}", - "SECTION_DISPLAY_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "Projet FME n°{{sId}}", - "SECTION_INSERT_TITLE_PUBLICATION_AUTHOR_GTF_WORKSPACE_AUTHOR" : "Projet FME", + "SECTION_UPDATE_TITLE_EXPLOITATION_EXPLOITATION" : "Exploitation", "" : "", "FORM_CALCULATE_STATS" : "Calculer", "FORM_TITLE_STATISTICS" : "Sélectionnez les différents critères afin de générer votre rapport statistique", @@ -128,6 +128,10 @@ "FORM_MISSING_FORM_PUBLICATION_WORKSPACE" : "Formulaire absent", "FORM_WORKSPACE_NAME_EXISTS_PUBLICATION_WORKSPACE" : "Ce nom est déja utilisé par un autre projet.", "FORM_FMW_FILE_URL_PUBLICATION_WORKSPACE" : "Fichier fmw du projet", + "FORM_DATAENCRYPT_PUBLICATION_WORKSPACE" : "Cryptage des données", + "FORM_USEPERSONALDATA_PUBLICATION_WORKSPACE" : "Utilisation de données personnelles", + "FORM_UNITCOST_PUBLICATION_WORKSPACE": "Coût unitaire", + "FORM_COSTPERSECOND_PUBLICATION_WORKSPACE": "Coût à la seconde", "" : "", "FORM_ID_PUBLICATION_WORKSPACE_UPDATE_METADATA" : "ID", "FORM_TITLE_PUBLICATION_WORKSPACE_UPDATE_METADATA" : "Titre du projet", @@ -150,6 +154,7 @@ "ERROR_REINTEGRATE_METADATA_PUBLICATION_WORKSPACE" : "Erreur pendant l'écriture du projet", "CONFIRM_DELETE_LOCKED_WOKSPACE_PUBLICATION_WORKSPACE": "Un ou plusieurs projets sont verrouillés et ne pourront être supprimés. Continuer ?", "FORM_BTN_REGENERATE_METADATA_TOOLTIP_PUBLICATION_WORKSPACE" : "Remplacement des champs Description, Utilisation, Prérequis et Conditions d'utilisation saisis dans GTF par les valeurs correspondantes contenues dans le projet FME source. Attention, les valeurs actuelles seront supprimées.", + "ERROR_WORKSPACE_FILE_NOT_FOUND" : "Erreur de lecture sur le fichier .fmw du projet FME.", "" : "", "TOOLTIP_TITLE_IMPORT_TOKEN_CONNECTION" : "Générer un jeton", "FORM_USER_IMPORT_TOKEN_CONNECTION" : "Utilisateur", @@ -196,6 +201,7 @@ "FORM_WIDGET_BTN_PUBLICATION_WORKSPACE_EDIT_WIDGET" : "Voir la fenêtre de traitement", "FORM_BUTTON_DOWNLOAD_WIDGET" : "Télécharger le widget", "FORM_BUTTON_DELETE_WIDGET" : "Supprimer le widget", + "ERROR_CREATION_WIDGET_FILE" : "Erreur pendant la création du fichier de widget", "" : "", "ERROR_WORKSPACE_NOT_LINKED_USER_GROUPS_WIDGET" : "Le traitement n'est lié à aucun groupe de l'utilisateur.", "ERROR_CAPTCHA_VALIDATION_WIDGET" : "La validation du captcha a échoué.", @@ -205,7 +211,7 @@ "FORM_DOWNLOAD_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Télécharger le fichier", "FORM_DELETE_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Supprimer le fichier", "FORM_RELOAD_DIRECTORY_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Recharger le répertoire", - "FORM_UPLOAD_FMW_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Mettre à jour", + "FORM_UPLOAD_FMW_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Télécharger", "FORM_UPLOAD_ADDITIONAL_RESOURCE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Télécharger", "DELETE_FILE_ERROR_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Erreur pendant la suppression du fichier", "FILE_NOT_FOUND_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Le fichier est introuvable", @@ -214,6 +220,7 @@ "ERROR_FMW_FILE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Le fichier sélectionné n'est pas un fichier fmw valide.", "ERROR_ADDITIONAL_RESOURCES_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Le type de fichier sélectionné n'est pas autorisé.", "ERROR_FILE_SIZE_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "La taille du fichier est supérieure à la taille maximale autorisée.", + "ERROR_FILE_TREE_LOADING_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY" : "Erreur pendant le chargement de la liste des fichiers du projet.", "" : "", "DESCRIPTION_TOOLTIP_TITLE_PUBLICATION_WORKSPACE" : "Description", "" : "", @@ -235,6 +242,8 @@ "FORM_TREATMENT_WORKSPACES_MY_WORK_USER_ORDER" : "Projets liés à la demande", "ERROR_NO_GTF_ENGINE_CONTENT_MY_WORK_USER_ORDER" : "Veuillez créer un moteur GTF pour ajouter des demandes.", "ERROR_NO_GTF_ENGINE_TITLE_MY_WORK_USER_ORDER" : "Aucun Moteur GTF", + "FORM_MINEXECDATE_MY_WORK_USER_ORDER" : "Date de planification", + "FORM_MINEXECDATE_PLACE_HOLDER_MY_WORK_USER_ORDER" : "Au plus tôt", "" : "", "FORM_EXECUTE_WORKSPACE_PUBLICATION_WORKSPACE_SUB_FORM" : "Exécuter", "FORM_PREVISU_PUBLISHED_PUBLICATION_WORKSPACE_SUB_FORM" : "Prévisualiser le formulaire publié", @@ -257,6 +266,21 @@ "FME_VERSION_ENGINE_FME_ENGINE" : "Version", "FME_VALIDITY_ENGINE_FME_ENGINE" : "Validité", "FME_TYPE_ENGINE_FME_ENGINE" : "Type", + "ERROR_FME_LICENSE_EXPIRED_ENGINE_FME_ENGINE" : "La licence a expiré", + "ERROR_FME_REQUEST_ERROR_ENGINE_FME_ENGINE" : "La requête a retourné une erreur", + "FORM_BTN_START_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE" : "Démarrer", + "FORM_BTN_PAUSE_FME_SERVER_INSTANCE_ENGINE_FME_ENGINE" : "Arrêter", + "FORM_BTN_FME_SERVER_INSTANCE_VERSION_ENGINE_FME_ENGINE" : "Version", + "MSG_FME_SERVER_INSTANCE_EXECUTING_PAUSE_ENGINE_FME_ENGINE" : "L'instance Fme Server est en cours d'arrêt", + "MSG_FME_SERVER_INSTANCE_PAUSE_ENGINE_FME_ENGINE" : "L'instance Fme Server est arrêtée", + "MSG_FME_SERVER_INSTANCE_EXECUTING_START_ENGINE_FME_ENGINE" : "L'instance Fme Server est en cours de démarrage", + "MSG_FME_SERVER_INSTANCE_START_ENGINE_FME_ENGINE" : "L'instance Fme Server est opérationnelle", + "FORM_FME_SERVER_INSTANCE_NAME_ENGINE_FME_ENGINE" : "Nom de l'instance", + "FORM_BTN_REFRESH_FME_SERVER_INSTANCE_STATUT_STATUT_ENGINE_FME_ENGINE" : "Actualiser", + "FORM_FME_SERVER_INSTANCE_STATUS_ENGINE_FME_ENGINE" : "Statut", + "FORM_FME_SERVER_INSTANCE_STATUS_RUNNING_ENGINE_FME_ENGINE" : "Instance démarrée", + "FORM_FME_SERVER_INSTANCE_STATUS_PAUSED_ENGINE_FME_ENGINE" : "Instance arrêtée", + "FORM_FME_SERVER_INSTANCE_STATUS_executing_action_ENGINE_FME_ENGINE" : "Instance en cours d'arrêt ou de démarrage", "" : "", "FORM_BTN_CREATE_SUBSCRIPTION_MY_WORK_GTF_USER_SUBSCRIPTION" : "Demander", "FORM_BTN_UPDATE_SUBSCRIPTION_MY_WORK_GTF_USER_SUBSCRIPTION" : "MAJ abonnement", @@ -392,7 +416,7 @@ "FORM_GTF_SCHEMA_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Schéma de GTF", "FORM_GTF_HOME_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Répertoire de GTF", "FORM_NOT_COMPRESSED_EXTENSION_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Extensions des fichiers à ne pas compresser", - + "FORM_NBR_ORDER_MAX_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Nombre maximum de demandes traitées simultanément", "FORM_MAX_ATTEMPT_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Nombre maximum de tentatives", "FORM_RADIO_TRUE_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Oui", @@ -408,10 +432,14 @@ "FORM_LOGIN_PROXY_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Login du serveur proxy", "FORM_PASSWORD_PROXY_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Mot de passe du serveur proxy", "FORM_DEFAULT_MAIL_MODEL_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Modèle d' e-mail par défaut", - "FORM_LOG_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Journaux", - "FORM_PYCRON_DIR_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Répertoire de pycron (Windows) / Cron (Linux)", + "FORM_LOG_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Journaux", + "FORM_PYCRON_DIR_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Répertoire de pycron", "FORM_PYCRON_LOG_DIRECTORY_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Répertoire des logs de pycron", - "FORM_GTF_DOC_ALIAS_CONFIGURATION_CONFIGURATION_GTF_CONFIG": "Alias de la documentation de GTF", + "FORM_GTF_INSTANCE_ID_CONFIGURATION_CONFIGURATION_GTF_CONFIG" : "Identifiant de l'instance de GTF", + "FORM_BTN_GENERATE_GTF_INSTANCE_ID_WORKSPACE_EDIT_WIDGET" : "Générer", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_GTF_CONFIG" :"Utilisation de GTF_CONNECTION_STRING Externe", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGIP" : "IP Public de la base de donnée", + "FORM_EXTERNAL_CONNSTRING_SECTION_CONFIGURATION_CONFIGURATION_CONNECTIONSTRINGPORT" : "Port Public de la base de donnée", "" : "", "FORM_SUBTITLE_INFORMATIONS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Informations", "FORM_SUBTITLE_REQUEST_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Demander la licence", @@ -440,6 +468,7 @@ "SEND_MAIL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Mail envoyé avec succés", "LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Erreur pendant l'installation du fichier de licence.", "LICENSE_FILE_INSTALL_SUCCESS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Fichier de licence installé avec succés", + "SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE" : "Veuillez renseigner les paramètres de votre serveur SMTP.", "" : "", "FORM_NAME_ENGINE_GTF_ENGINE" : "Nom", "FORM_SERVER_ENGINE_GTF_ENGINE" : "Serveur", @@ -459,6 +488,42 @@ "FORM_ID_ENGINE_FME_ENGINE" : "ID", "FORM_PATH_ENGINE_FME_ENGINE" : "Chemin vers l'exécutable de FME", "FORM_TITLE_ENGINE_FME_ENGINE" : "Moteur FME {{::name}}", + "FORM_TYPE_ENGINE_FME_ENGINE" : "Type", + "FORM_SERVER_URL_ENGINE_FME_ENGINE" : "Url du serveur", + "FORM_LOGIN_ENGINE_FME_ENGINE" : "Utilisateur", + "FORM_PASSWORD_ENGINE_FME_ENGINE" : "Mot de passe", + "FORM_S3_ACCESS_KEY_ID_ENGINE_FME_ENGINE" : "Id de la clé d'accès S3", + "FORM_S3_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE" : "Clé d'accès secrète S3", + "FORM_FME_CLOUD_API_TOKEN_ENGINE_FME_ENGINE" : "Token de l'API de FME Cloud", + "FORM_S3_REGION_ENGINE_FME_ENGINE" : "Région S3", + "FORM_S3_REGION_US-EAST-2_ENGINE_FME_ENGINE" : "USA Est (Ohio)", + "FORM_S3_REGION_US-EAST-1_ENGINE_FME_ENGINE" : "USA Est (Virginie du Nord)", + "FORM_S3_REGION_US-WEST-1_ENGINE_FME_ENGINE" : "USA Ouest (Californie du Nord)", + "FORM_S3_REGION_US-WEST-2_ENGINE_FME_ENGINE" : "USA Ouest (Oregon)", + "FORM_S3_REGION_AP-SOUTH-1_ENGINE_FME_ENGINE" : "Asie-Pacifique (Mumbai)", + "FORM_S3_REGION_AP-NORTHEAST-2_ENGINE_FME_ENGINE" : "Asie-Pacifique (Séoul)", + "FORM_S3_REGION_AP-SOUTHEAST-1_ENGINE_FME_ENGINE" : "Asie-Pacifique (Singapour)", + "FORM_S3_REGION_AP-SOUTHEAST-2_ENGINE_FME_ENGINE" : "Asie-Pacifique (Sydney)", + "FORM_S3_REGION_AP-NORTHEAST-1_ENGINE_FME_ENGINE" : "Asie-Pacifique (Tokyo)", + "FORM_S3_REGION_CA-CENTRAL-1_ENGINE_FME_ENGINE" : "Canada (Centre)", + "FORM_S3_REGION_CN-NORTH-1_ENGINE_FME_ENGINE" : "Chine (Pékin)", + "FORM_S3_REGION_EU-CENTRAL-1_ENGINE_FME_ENGINE" : "UE (Francfort)", + "FORM_S3_REGION_EU-WEST-1_ENGINE_FME_ENGINE" : "UE (Irlande)", + "FORM_S3_REGION_EU-WEST-2_ENGINE_FME_ENGINE" : "UE (Londres)", + "FORM_S3_REGION_EU-WEST-3_ENGINE_FME_ENGINE" : "EU (Paris)", + "FORM_S3_REGION_SA-EAST-1_ENGINE_FME_ENGINE" : "Amérique du Sud (São Paulo)", + "FORM_FME_SERVER_INSTANCE_TITLE_ENGINE_FME_ENGINE" : "Instance FME Server", + "FORM_AMAZON_S3_TITLE_ENGINE_FME_ENGINE" : "Amazon S3", + "FORM_IAM_ACCESS_KEY_ID_ENGINE_FME_ENGINE" : "Id de la clé d'accès IAM au service FME Cloud for GTF", + "FORM_IAM_SECRET_ACCESS_KEY_ENGINE_FME_ENGINE" : "Clé d'accès secrète IAM au service FME Cloud for GTF", + "FORM_FME_SERVER_S3_BUCKET_ENGINE_FME_ENGINE" : "Nom du compartiment", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE" : "Voulez-vous utiliser la GTF_CONNECTION_STRING externe ?", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_YES" : "Oui (Informations de connexion public à la base)", + "FORM_USEEXTERNALDBCONNECTION_ENGINE_FME_ENGINE_NO" : "Non (Informations de connexion privée à la base)", + "FORM_BTN_TEST_AMAZON_S3_BUCKET_ENGINE_FME_ENGINE" : "Tester", + "TEST_AMAZON_S3_BUCKET_ERROR_NO_SUCH_BUCKET_ENGINE_FME_ENGINE" : "Le compartiment spécifié n'existe pas.", + "TEST_AMAZON_S3_BUCKET_ERROR_INVALID_ACCESS_KEY_ID_FME_ENGINE" : "La clé d'accès S3 spécifiée n'existe pas.", + "TEST_AMAZON_S3_BUCKET_ERROR_SIGNATURE_DOES_NOT_MATCH_FME_ENGINE" : "Le calcul de la signature ne correspond pas. Vérifiez votre clé d'accès secrète S3.", "" : "", "FORM_ID_ENGINE_SERVER" : "ID", "FORM_NAME_ENGINE_SERVER" : "Nom", @@ -508,5 +573,8 @@ "FORM_WIDGET_NOTIFICATIONS_NEEDED_PUBLICATION_WORKSPACE_EDIT_WIDGET" : "Adresse e-mail (Obligatoire)", "FORM_WIDGET_NOTIFICATIONS_OPTIONAL_PUBLICATION_WORKSPACE_EDIT_WIDGET" : "Adresse e-mail (Optionnelle)", "EXPIRED_WIDGET_TOKEN_ERROR": "Votre session a expirée.", - "INVALID_WIDGET_TOKEN_ERROR": "Votre session est invalide." + "INVALID_WIDGET_TOKEN_ERROR": "Votre session est invalide.", + "FORM_USERS_GROUP_QUALIGEO_DOUBLE_SELECT": "Schémas", + "FORM_USERS_GROUP_QUALIGEO_SCHEMA_AVAILABLE": "Schémas disponibles", + "FORM_USERS_GROUP_QUALIGEO_SCHEMA_ASSOCIATE": "Schémas associés" } diff --git a/module/less/configuration.less b/module/less/configuration.less index 6f1045428fc4186b06544205a917f791be2176c4..99d9f38605959cb8c7e2aefda35c2758f5b93ad4 100755 --- a/module/less/configuration.less +++ b/module/less/configuration.less @@ -2,3 +2,7 @@ .gtf-license-file-request-connect-btn { float: right !important; } +// Bouton de génération de l'instance de GTF. +.gtf-instance-id > div:nth-child(2) { + padding: 0; +} diff --git a/module/less/fmeEngines.less b/module/less/fmeEngines.less new file mode 100755 index 0000000000000000000000000000000000000000..1b6dcc949574b6d4f5cf7e5f784ca7c705be7ef2 --- /dev/null +++ b/module/less/fmeEngines.less @@ -0,0 +1,6 @@ +// Rotation du bouton d'actualisation d'une l'instance Fme Server. +.fme-server-instance-status-button-rotation { + -webkit-animation:spin 1.5s linear infinite; + -moz-animation:spin 1.5s linear infinite; + animation:spin 1.5s linear infinite; +} \ No newline at end of file diff --git a/module/less/main.less b/module/less/main.less index bd73184d6c76339c2b2f5e51bb5358cf100ff6b1..cfbf3a465262ac906dc7a0da53983fc2a47daf64 100755 --- a/module/less/main.less +++ b/module/less/main.less @@ -16,6 +16,7 @@ @import 'importWorkspace.less'; @import 'configuration.less'; @import 'workspace.less'; +@import 'fmeEngines.less'; // Récap. de supervision (Etat des demandes, abo., surv.) .recap{ @@ -47,7 +48,7 @@ display : inline; background-color:#ffffff; cursor: pointer; - + } .box_number { @@ -73,20 +74,22 @@ text-transform: uppercase; text-align: center; } - -.box_waiting {background: #ffffff url("../../../images/sql_list/st1.gif") 2px 2px no-repeat;} -.box_error {background: #ffffff url("../../../images/sql_list/st2.png") 2px 2px no-repeat;} -.box_treated {background: #ffffff url("../../../images/sql_list/st3.png") 2px 2px no-repeat;} -.box_non_treatable {background: #ffffff url("../../../images/sql_list/st4.png") 2px 2px no-repeat;} -.box_processing {background: #ffffff url("../../../images/sql_list/st5.gif") 2px 2px no-repeat;} -.box_non_authorized {background: #ffffff url("../../../images/sql_list/st6.png") 2px 2px no-repeat;} +// Etat des demandes et messages. +.box-dot-waiting {background-color: #5ac6de;} +.box-dot-error {background-color: #ff0000;} +.box-dot-treated {background-color: #9cce29;} +.box-dot-non-treatable {background-color: #000000;} +.box-dot-non-authorized {background-color: #c6c6c6;} .box-dot-order-stopped {background-color: darkorange;} - -.box_enabled_subscription {background: #ffffff url("../../../images/sql_list/st3.png") 2px 2px no-repeat;} -.box_non_enabled_subscription {background: #ffffff url("../../../images/sql_list/st2.png") 2px 2px no-repeat;} - -.box_enabled_survey {background: #ffffff url("../../../images/sql_list/st3.png") 2px 2px no-repeat;} -.box_non_enabled_survey {background: #ffffff url("../../../images/sql_list/st2.png") 2px 2px no-repeat;} +// En cours (point clignotant). +.box-dot-processing {background-color: #f79cce; animation: blinking 1s linear infinite;} +@keyframes blinking {from, 49.9% {opacity: 0;} 50%, to {opacity: 1;}} +// Abonnements. +.box-dot-enabled-subscription {background-color: #9cce29;} +.box-dot-non-enabled-subscription {background-color: #ff0000;} +// Surveillances. +.box-dot-enabled-survey {background-color: #9cce29;} +.box-dot-non-enabled-survey {background-color: #ff0000;} // Point indiquant la couleur de la demande. .box-dot { @@ -96,4 +99,4 @@ width: 10px; margin: 3px; border-radius: 50%; -} \ No newline at end of file +} diff --git a/module/templates/supervisionStatusTpl.html b/module/templates/supervisionStatusTpl.html index 5c86739bd00d85e2e67ee58c7b5dd012a1c47143..7a31275f06dcc6ec55c4268fc7fdce122fa3931d 100755 --- a/module/templates/supervisionStatusTpl.html +++ b/module/templates/supervisionStatusTpl.html @@ -3,31 +3,37 @@ <div class="recap_title" data-translate="STATUS_TITLE_SUPERVISION_ORDER"></div> <div class="recap_boxes"> <div class="box_recap box_waiting" ng-click="setSupervisionRecapFilter(1)"> + <span class="box-dot box-dot-waiting"></span> <div class="box_number">{{oSupervisionStatus.order.iWaitingOrders}}</div> <div class="box_text" data-translate="WAITING_BOX_TITLE_SUPERVISION_ORDER"></div> </div> <div class="box_recap box_error" ng-click="setSupervisionRecapFilter(2)"> + <span class="box-dot box-dot-error"></span> <div class="box_number">{{oSupervisionStatus.order.iErrors}}</div> <div class="box_text" data-translate="ERROR_BOX_TITLE_SUPERVISION_ORDER"></div> </div> <div class="box_recap box_treated" ng-click="setSupervisionRecapFilter(3)"> + <span class="box-dot box-dot-treated"></span> <div class="box_number">{{oSupervisionStatus.order.iTreatedOrders}}</div> <div class="box_text" data-translate="TREATED_BOX_TITLE_SUPERVISION_ORDER"></div> </div> <div class="box_recap box_non_treatable" ng-click="setSupervisionRecapFilter(4)"> + <span class="box-dot box-dot-non-treatable"></span> <div class="box_number">{{oSupervisionStatus.order.iNonTreatableOrders}}</div> <div class="box_text" data-translate="NON_TREATABLE_BOX_TITLE_SUPERVISION_ORDER"></div> </div> <div class="box_recap box_processing" ng-click="setSupervisionRecapFilter(5)"> + <span class="box-dot box-dot-processing"></span> <div class="box_number">{{oSupervisionStatus.order.iProcessingOrders}}</div> <div class="box_text" data-translate="PROCESSING_BOX_TITLE_SUPERVISION_ORDER"></div> </div> <div class="box_recap box_non_authorized" ng-click="setSupervisionRecapFilter(6)"> + <span class="box-dot box-dot-non-authorized"></span> <div class="box_number">{{oSupervisionStatus.order.iNonAuthorizedOrders}}</div> <div class="box_text" data-translate="NON_AUTHORIZED_BOX_TITLE_SUPERVISION_ORDER"></div> </div> - <span class="box-dot box-dot-order-stopped"></span> <div class="box_recap box_stopped" ng-click="setSupervisionRecapFilter(7)"> + <span class="box-dot box-dot-order-stopped"></span> <div class="box_number">{{oSupervisionStatus.order.iStoppedOrders}}</div> <div class="box_text" data-translate="STOPPED_BOX_TITLE_SUPERVISION_ORDER"></div> </div> @@ -37,10 +43,12 @@ <div class="recap_title" data-translate="STATUS_TITLE_SUPERVISION_SUBSCRIPTION"></div> <div class="recap_boxes"> <div class="box_recap box_enabled_subscription" ng-click="setSupervisionRecapFilter('TRUE')"> + <span class="box-dot box-dot-enabled-subscription"></span> <div class="box_number">{{oSupervisionStatus.subscription.iEnabledSubscription}}</div> <div class="box_text" data-translate="ENABLED_SUBSCRIPTION_BOX_TITLE_SUPERVISION_SUBSCRIPTION"></div> </div> <div class="box_recap box_non_enabled_subscription" ng-click="setSupervisionRecapFilter('FALSE')"> + <span class="box-dot box-dot-non-enabled-subscription"></span> <div class="box_number">{{oSupervisionStatus.subscription.iNonEnabledSubscription}}</div> <div class="box_text" data-translate="NON_ENABLED_SUBSCRIPTION_BOX_TITLE_SUPERVISION_SUBSCRIPTION"></div> </div> @@ -50,10 +58,12 @@ <div class="recap_title" data-translate="STATUS_TITLE_SUPERVISION_SURVEY"></div> <div class="recap_boxes"> <div class="box_recap box_enabled_survey" ng-click="setSupervisionRecapFilter('TRUE')"> + <span class="box-dot box-dot-enabled-survey"></span> <div class="box_number">{{oSupervisionStatus.survey.iEnabledSurvey}}</div> <div class="box_text" data-translate="ENABLED_SURVEY_BOX_TITLE_SUPERVISION_SURVEY"></div> </div> <div class="box_recap box_non_enabled_survey" ng-click="setSupervisionRecapFilter('FALSE')"> + <span class="box-dot box-dot-non-enabled-survey"></span> <div class="box_number">{{oSupervisionStatus.survey.iNonEnabledSurvey}}</div> <div class="box_text" data-translate="NON_ENABLED_SURVEY_BOX_TITLE_SUPERVISION_SURVEY"></div> </div> @@ -63,18 +73,22 @@ <div class="recap_title" data-translate="STATUS_TITLE_SUPERVISION_MESSAGE"></div> <div class="recap_boxes"> <div class="box_recap box_waiting" ng-click="setSupervisionRecapFilter(1)"> + <span class="box-dot box-dot-waiting"></span> <div class="box_number">{{oSupervisionStatus.message.iWaitingMessages}}</div> <div class="box_text" data-translate="WAITING_BOX_TITLE_SUPERVISION_MESSAGE"></div> </div> <div class="box_recap box_error" ng-click="setSupervisionRecapFilter(2)"> + <span class="box-dot box-dot-error"></span> <div class="box_number">{{oSupervisionStatus.message.iErrorMessage}}</div> <div class="box_text" data-translate="ERROR_BOX_TITLE_SUPERVISION_MESSAGE"></div> </div> <div class="box_recap box_treated" ng-click="setSupervisionRecapFilter(3)"> + <span class="box-dot box-dot-treated"></span> <div class="box_number">{{oSupervisionStatus.message.iTreatedMessages}}</div> <div class="box_text" data-translate="TREATED_BOX_TITLE_SUPERVISION_MESSAGE"></div> </div> <div class="box_recap box_processing" ng-click="setSupervisionRecapFilter(5)"> + <span class="box-dot box-dot-processing"></span> <div class="box_number">{{oSupervisionStatus.message.iProcessingMessages}}</div> <div class="box_text" data-translate="PROCESSING_BOX_TITLE_SUPERVISION_MESSAGE"></div> </div> diff --git a/module/templates/testFmeEngineTpl.html b/module/templates/testFmeEngineTpl.html index afb5a574fc549ed6a038308095447dbf51e12a65..d56899187e9dfce9bae48396fcacce7637cdd61f 100755 --- a/module/templates/testFmeEngineTpl.html +++ b/module/templates/testFmeEngineTpl.html @@ -5,10 +5,10 @@ <h3 class="panel-title" data-translate="SUCCESS_FME_ENGINE_FME_ENGINE"></h3> </div> <ul class="list-group"> - <li class="list-group-item"><span data-translate="FME_HOST_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.host}}</li> - <li class="list-group-item"><span data-translate="FME_VERSION_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.version}}</li> - <li class="list-group-item"><span data-translate="FME_TYPE_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.type}}</li> - <li class="list-group-item"><span data-translate="FME_VALIDITY_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.validity}}</li> + <li ng-if="::oTestFmeEngineResult.host" class="list-group-item"><span data-translate="FME_HOST_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.host}}</li> + <li ng-if="::oTestFmeEngineResult.version"class="list-group-item"><span data-translate="FME_VERSION_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.version}}</li> + <li ng-if="::oTestFmeEngineResult.type"class="list-group-item"><span data-translate="FME_TYPE_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.type}}</li> + <li ng-if="::oTestFmeEngineResult.validity"class="list-group-item"><span data-translate="FME_VALIDITY_ENGINE_FME_ENGINE"></span> : {{::oTestFmeEngineResult.validity}}</li> </ul> </div> <!-- Erreur --> diff --git a/web_service/class/gtf_lib/GtfFmwParser.class.inc b/web_service/class/gtf_lib/GtfFmwParser.class.inc index f29e86e27af0226484ce8e602ea092ce0169acd4..d85789c4f27863fca87647cdd8654c35c4695a11 100755 --- a/web_service/class/gtf_lib/GtfFmwParser.class.inc +++ b/web_service/class/gtf_lib/GtfFmwParser.class.inc @@ -27,6 +27,8 @@ class GtfFmwParser { var $sSaveDate; var $sSaveBuild; var $sRequirement; + var $aProperties; + var $bDeleteFmwFile = false; // var $sOriginalName; @@ -35,8 +37,21 @@ class GtfFmwParser { * le fichier fmw est parcouru ligne par ligne et chaque occurrence * correspondant à un GUI est stocké dans le tableau approrié */ - function __construct($sFmwFileName) { - $this->sFmwFileName = $sFmwFileName; + function __construct($sFmwFileName, $aProperties, $sFmwFileContent = '') { + $this->aProperties = $aProperties; + // Création du fichier temporaire (si le contenu du fichier .fmw est passé et pas un nom de fichier). + if (!empty($sFmwFileContent)) { + $this->sFmwFileName = $this->aProperties['extract_dir'] . '/' . getUniqRandomId() . '/' . $sFmwFileName; + $sFmwFileDirPath = pathinfo($this->sFmwFileName, PATHINFO_DIRNAME); + if (file_exists($sFmwFileDirPath)) + cleardir($sFmwFileDirPath); + mkdir($sFmwFileDirPath, 0777, true); + file_put_contents($this->sFmwFileName, $sFmwFileContent); + $this->bDeleteFmwFile = true; + } + else + $this->sFmwFileName = $sFmwFileName; + // $oFichier = fopen(utf8_decode($this->sFmwFileName), "r"); $sRc = chr(10); // Compatible avec FME 2014 et inférieur $sRecherche = "^GUI(.*)" . $sRc; @@ -322,17 +337,16 @@ class GtfFmwParser { /** * Product a JSON form - * @param array $aProperties * @param string $sName * @return array */ - function productJson($aProperties, $sName) { + function productJson($sName) { $aJson = array("name" => "Subform", "title" => $sName, "input_size" => "xxs", "nb_cols" => 12, "rows" => array()); $aFields = array("fields" => array()); foreach ($this->aGuiObject as $oGtfGui) { // bizarre mais des lignes peuvent être vides (génération KML)... à voir if ($oGtfGui->sDefault_Macro != "") { - $aFormField = $oGtfGui->getGuiV2($aProperties); + $aFormField = $oGtfGui->getGuiV2($this->aProperties); // Décode les tags de FME et GTF dans les valeurs par défaut du formulaire json. if (!empty($aFormField[0]['default_value'])) $aFormField[0]['default_value'] = $oGtfGui->decodeFmeGtfTags($aFormField[0]['default_value']); @@ -625,7 +639,14 @@ class GtfFmwParser { fclose($ecriture); } - + /* + * Destructeur de la classe GtfFmwParser + */ + function __destruct() { + // Supprime le fichier .fmw temporaire du projet. + $sFmwFileDirPath = pathinfo($this->sFmwFileName, PATHINFO_DIRNAME); + if ($this->bDeleteFmwFile && file_exists($sFmwFileDirPath)) + cleardir($sFmwFileDirPath); + } } - ?> diff --git a/web_service/class/gtf_lib/gtf_object/Order.class.inc b/web_service/class/gtf_lib/gtf_object/Order.class.inc index 41d43324e68ee69c21c61dd89f12a1d6775eee6e..2908f6a32486332da9ad90f5ed97a5e308a0b225 100644 --- a/web_service/class/gtf_lib/gtf_object/Order.class.inc +++ b/web_service/class/gtf_lib/gtf_object/Order.class.inc @@ -10,7 +10,7 @@ require_once("vmlib/error.inc"); class orderLib extends GtfLib{ var $sPkField = "order_id"; var $sTable = "v_user_order"; - + /** * Class constructor * \param $oBd Connection object. @@ -37,7 +37,7 @@ class orderLib extends GtfLib{ $this->aFields['order_id']=$iOrderId; $this->sMessage = $this->oBd->getBDMessage(); }else{ - $this->aFields = $this->oBd->ligneSuivante ($oPDOresult); + $this->aFields = $this->oBd->ligneSuivante ($oPDOresult); // result_file (chemin du fichier de résultat), log_file (chemin du fichier de log) if (!empty($this->aFields['result_url'])) $this->aFields['result_file'] = $aProperties['dir_export'] . '/gtf/' . $this->aFields['result_url']; @@ -53,7 +53,7 @@ class orderLib extends GtfLib{ $this->aFields['order_id']=$iOrderId; $this->bEnErreur= -1; $this->iErrorCode=3; - $this->sMessage ="The order_id #".$iOrderId." doesn't exist"; + $this->sMessage ="The order_id #".$iOrderId." doesn't exist"; }else{ $this->bEnErreur= 0; } @@ -84,7 +84,7 @@ class orderLib extends GtfLib{ while($oEnginesId = $this->oBd->objetSuivant ($resultat)) $aEnginesId[] = $oEnginesId->gtf_engine_id; $this->oBd->fermeResultat(); - + if(count($aEnginesId)==0){ // Le tag correspondant n'a pas été trouvé, nous allons cherché la liste des moteur ayant comme tag |default| $sSql = $aSql['getEnginesDefaultTag']; @@ -113,7 +113,7 @@ class orderLib extends GtfLib{ writeToErrorLog(str_replace('[iOrderId]', $iOrderId, ERROR_0008)); $this->aFields['gtf_engine_id'] = 1; }else{ - $this->aFields['gtf_engine_id'] = $iEngine; + $this->aFields['gtf_engine_id'] = $iEngine; } } @@ -179,8 +179,7 @@ class orderLib extends GtfLib{ function formatOrderEmail() { // Calcule la date et heure de fin list($iHours, $iMinutes, $iSeconds) = explode(':', $this->aFields['length_sec']); - $oLengthSec = new DateInterval('PT' . intval($iHours) . 'H' . intval($iMinutes) . 'M' . intval($iSeconds) . 'S'); - $this->aFields['length_sec'] = $oLengthSec->format('%s'); + $this->aFields['length_sec'] = (intval($iHours) * 3600) + (intval($iMinutes) * 60) + intval($iSeconds); if (!empty($this->aFields['execution_date']) && !empty($this->aFields['length_sec'])) $this->aFields['process_date'] = date_add(date_create($this->aFields['execution_date']), new DateInterval('PT' . intval($this->aFields['length_sec']) . 'S')); // Format des dates @@ -199,4 +198,4 @@ class orderLib extends GtfLib{ } } } -?> \ No newline at end of file +?> diff --git a/web_service/ws/License.class.inc b/web_service/ws/License.class.inc index 8f1e63df69d834a2b084cc1fbf2f2c35053dd714..f322a87bb8ed2493691ce5e300cabbe1e8f7f201 100755 --- a/web_service/ws/License.class.inc +++ b/web_service/ws/License.class.inc @@ -157,7 +157,7 @@ class License extends GTF { function POST() { if ($this->aValues["action"] == 'activate') { if (!empty($_FILES['license_file'])) { - $sErrorMessage = uploadFile('license_file', "", $this->aProperties['vas_home'] . '/../gtf.engines/licenses/' . $_FILES['license_file']["name"], $_FILES['license_file']['size'] + 1); + $sErrorMessage = uploadFileToLocal('license_file', "", $this->aProperties['vas_home'] . '/../gtf.engines/licenses/' . $_FILES['license_file']["name"], $_FILES['license_file']['size'] + 1); rename($this->aProperties['vas_home'] . '/../gtf.engines/licenses/' . $_FILES['license_file']["name"], $this->aProperties['vas_home'] . '/../gtf.engines/licenses/license.txt'); if ($sErrorMessage == "") { $aXmlRacineAttribute['status'] = 1; @@ -170,64 +170,84 @@ class License extends GTF { } } } else if ($this->aValues["action"] == 'ask') { - $mail = new PHPMailer; - - $mail->isSMTP(); // Set mailer to use SMTP - //$mail->SMTPDebug = 3; // debugger level (3 all with connection) - $mail->Debugoutput = function($str, $level) {error_log("debug level $level; message: $str");}; - $mail->Host = $this->aProperties["smtp_host"]; // Specify main and backup SMTP servers - $mail->Port = $this->aProperties["smtp_port"]; // TCP port to connect to - $mail->SMTPAuth = $this->aProperties["smtp_authentification"]; // Enable SMTP authentication - // if authentication add parameter to connect SMTP - if ($this->aProperties["smtp_authentification"] === true){ - $mail->AuthType = 'LOGIN'; - $mail->Username = $this->aProperties["smtp_login"]; // SMTP username - $mail->Password = $this->aProperties["smtp_password"]; // SMTP password - $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted (deprecated) - } - $sTo = 'codes@veremes.com'; - $mail->AddAddress($sTo); - $mail->SetFrom($this->aProperties['mail_sender'], $this->aProperties['nickname_sender']); - $mail->AddReplyTo($this->aValues['reply_to']); - $mail->IsHTML(true); // Set email format to HTML - $mail->CharSet = 'UTF-8'; - $mail->Subject = $this->aValues['subject'] . $this->aValues['license_number']; - $mail->Body = /*utf8_decode*/('<html><body>' . $this->aValues['message'] . '</body></html>'); - $mail->AddCC($this->aValues['reply_to']); - - // Depuis PHP 5.6 -> vérification du certificat SSL. - if (!$this->aProperties['proxy_check_ssl']) { - $mail->SMTPOptions = array( - 'ssl' => array( - 'verify_peer' => false, - 'verify_peer_name' => false, - 'allow_self_signed' => true - ) - ); + // Vérification des paramètres du serveur smtp (vides ou par défaut -> erreur). + $aSmtpDefault = array( + 'smtp_host' => 'smtp.domaine.com', + 'smtp_port' => 26, + 'smtp_authentification' => true, + 'smtp_login' => 'login@domaine.com', + 'smtp_password' => 'password' + ); + $iSmtpCount = 0; + foreach ($aSmtpDefault as $sSmtpKey => $sSmtpValue) { + if (empty($this->aProperties[$sSmtpKey]) || $this->aProperties[$sSmtpKey] == $sSmtpValue) + $iSmtpCount++; } - - // - if (!$mail->send()) { - writeToErrorLog(ERROR_0023 . $sTo . '.'); - writeToErrorLog("Error message : " . $mail->ErrorInfo); - writeToLog("|WARN|PHP|Failed sending email to the following address : " . $sTo . ' and copy to : ' . $this->aValues['reply_to'], $this->aProperties['mail_log_file']); - $oError = new VitisError(1, 'SEND_MAIL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE'); + if ($iSmtpCount == count($aSmtpDefault)) { + writeToErrorLog('the SMTP server is not configured'); + $oError = new VitisError(1, 'SMTP_SERVER_PARAMETERS_CONFIGURATION_CONFIGURATION_GTF_LICENSE'); $aXmlRacineAttribute['status'] = 0; $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - //$sErrorMessage = $sMail->getMessage(); - } else { - writeToLog("|INFORM|PHP| An email has been sent to the following address : " . $sTo . ' and copy to : ' . $this->aValues['reply_to'], $this->aProperties['mail_log_file']); - if(!empty($this->aProperties['SaveSentMail']) && $this->aProperties['SaveSentMail'] === true){ - $imap = new Imap($this->aProperties['imapBotSender_host'], $this->aProperties['imapBotSender_port'], $this->aProperties['imapBotSender_login'], $this->aProperties['imapBotSender_pwd'], $this->aProperties['imapBotSender_encrypt']); - if($imap->isConnected()===false) - writeToLog("|WARN|PHP| can't connect to the IMAP at hostname : " . $this->aProperties['imapBotSender_host'], $this->aProperties['mail_log_file']); - else{ - $imap->selectFolder("Sent"); - $imap->saveMessageInSent($mail->getSentMIMEMessage(), ""); + } + else { + $mail = new PHPMailer; + $mail->isSMTP(); // Set mailer to use SMTP + //$mail->SMTPDebug = 3; // debugger level (3 all with connection) + $mail->Debugoutput = function($str, $level) {error_log("debug level $level; message: $str");}; + $mail->Host = $this->aProperties["smtp_host"]; // Specify main and backup SMTP servers + $mail->Port = $this->aProperties["smtp_port"]; // TCP port to connect to + $mail->SMTPAuth = $this->aProperties["smtp_authentification"]; // Enable SMTP authentication + // if authentication add parameter to connect SMTP + if ($this->aProperties["smtp_authentification"] === true){ + $mail->AuthType = 'LOGIN'; + $mail->Username = $this->aProperties["smtp_login"]; // SMTP username + $mail->Password = $this->aProperties["smtp_password"]; // SMTP password + $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted (deprecated) + } + $sTo = 'codes@veremes.com'; + $mail->AddAddress($sTo); + $mail->SetFrom($this->aProperties['mail_sender'], $this->aProperties['nickname_sender']); + $mail->AddReplyTo($this->aValues['reply_to']); + $mail->IsHTML(true); // Set email format to HTML + $mail->CharSet = 'UTF-8'; + $mail->Subject = $this->aValues['subject'] . $this->aValues['license_number']; + $mail->Body = /*utf8_decode*/('<html><body>' . $this->aValues['message'] . '</body></html>'); + $mail->AddCC($this->aValues['reply_to']); + + // Depuis PHP 5.6 -> vérification du certificat SSL. + if (!$this->aProperties['proxy_check_ssl']) { + $mail->SMTPOptions = array( + 'ssl' => array( + 'verify_peer' => false, + 'verify_peer_name' => false, + 'allow_self_signed' => true + ) + ); + } + + // + if (!$mail->send()) { + writeToErrorLog(ERROR_0023 . $sTo . '.'); + writeToErrorLog("Error message : " . $mail->ErrorInfo); + writeToLog("|WARN|PHP|Failed sending email to the following address : " . $sTo . ' and copy to : ' . $this->aValues['reply_to'], $this->aProperties['mail_log_file']); + $oError = new VitisError(1, 'SEND_MAIL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + //$sErrorMessage = $sMail->getMessage(); + } else { + writeToLog("|INFORM|PHP| An email has been sent to the following address : " . $sTo . ' and copy to : ' . $this->aValues['reply_to'], $this->aProperties['mail_log_file']); + if(!empty($this->aProperties['SaveSentMail']) && $this->aProperties['SaveSentMail'] === true){ + $imap = new Imap($this->aProperties['imapBotSender_host'], $this->aProperties['imapBotSender_port'], $this->aProperties['imapBotSender_login'], $this->aProperties['imapBotSender_pwd'], $this->aProperties['imapBotSender_encrypt']); + if($imap->isConnected()===false) + writeToLog("|WARN|PHP| can't connect to the IMAP at hostname : " . $this->aProperties['imapBotSender_host'], $this->aProperties['mail_log_file']); + else{ + $imap->selectFolder("Sent"); + $imap->saveMessageInSent($mail->getSentMIMEMessage(), ""); + } } + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - $aXmlRacineAttribute['status'] = 1; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } } return $sMessage; @@ -235,4 +255,4 @@ class License extends GTF { } -?> \ No newline at end of file +?> diff --git a/web_service/ws/ServerClass.class.inc b/web_service/ws/ServerClass.class.inc index ccae65b8cc0d5d942a28a336eefc35db68d13e26..8eb898ae2f078268b9d27e156c9c01bd112ae543 100755 --- a/web_service/ws/ServerClass.class.inc +++ b/web_service/ws/ServerClass.class.inc @@ -1,225 +1,196 @@ -<?php - -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/dbUtil.inc'; -require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/logUtil.inc'; - -class ServerClass { - - //Chemin du fichier crontab - var $sCrontabFile; - //Id du server - var $iId; - //Nom du server - var $sServerName; - //Ancien nom du server - var $sOldServerName; - //Répertoire racine - var $sGtfHome; - //Répertoire Engines - var $EnginesHome; - //Objet de labase de données - var $oBd; - - function __construct($iId, $oBd, $sGtfHome, $sOldServerName = "", $aProperties = array()) { - $this->iId = $iId; - $this->oBd = $oBd; - $this->sOldServerName = $sOldServerName; - $this->sGtfHome = $sGtfHome; - $this->aProperties = $aProperties; - $this->setValues($iId); - } - - function setValues($iId) { - if ($iId != "") { - $sSql = 'SELECT scheduler_network_home, hostname, engines_home FROM ' . $this->aProperties['schema_gtf'] . '.server where server_id=[iIdServer]'; - $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - $oServer = $this->oBd->objetSuivant($oPDOresult); - $this->sCrontabFile = $oServer->scheduler_network_home; - $this->sServerName = $oServer->hostname; - $this->EnginesHome = $oServer->engines_home; - if ($this->sOldServerName == "") { - $this->sOldServerName = $this->sServerName; - } - } - } - - function deleteCrontabValuesEngine() { - $aValuesPycronNewFile = Array(); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - if (is_file($sCronFile)) { - $aPycronValues = file($sCronFile); - $bWrite = true; - foreach ($aPycronValues as $sPycronValue) { - $sPycronValue = str_replace("\n", "", $sPycronValue); - $sPycronValue = str_replace("\r", "", $sPycronValue); - if ($sPycronValue == "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - - $bWrite = false; - } else if ($sPycronValue == "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - $bWrite = true; - } - if ($bWrite == true && $sPycronValue != "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { - $aValuesPycronNewFile[] = $sPycronValue; - } - } - } - // On écrit dans le fichier texte - $sFichierCrontab = fopen($sCronFile, "w"); - // Le fichier texte est vidé - ftruncate($sFichierCrontab, 0); - $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); - $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); - foreach ($aValuesPycronNewFile as $sPycronValues2) { - fputs($sFichierCrontab, $sPycronValues2 . "\n"); - } - // Enfin fermer le fichier - fclose($sFichierCrontab); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function deleteCrontabValuesSubscription() { - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $aPycronValues = file($sCronFile); - $aValuesPycronNewFile = Array(); - $bWrite = true; - foreach ($aPycronValues as $sPycronValue) { - $sPycronValue = str_replace("\n", "", $sPycronValue); - $sPycronValue = str_replace("\r", "", $sPycronValue); - - if ($sPycronValue == "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - - $bWrite = false; - } else if ($sPycronValue == "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - $bWrite = true; - } - if ($bWrite == true && $sPycronValue != "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { - $aValuesPycronNewFile[] = $sPycronValue; - } - } - // On écrit dans le fichier texte - $sFichierCrontab = fopen($sCronFile, "w"); - // Le fichier texte est vidé - ftruncate($sFichierCrontab, 0); - $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); - $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); - foreach ($aValuesPycronNewFile as $sPycronValues2) { - fputs($sFichierCrontab, $sPycronValues2 . "\n"); - } - // Enfin fermer le fichier - fclose($sFichierCrontab); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddCrontabValuesEngines($sNotInList = "") { - if ($sNotInList == "") { - $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer]'; - } else { - $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer] AND gtf_engine_id not in ([sNotInList])'; - $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); - } - $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $sFichierCrontab = fopen($sCronFile, "a"); - - fputs($sFichierCrontab, "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - while ($oGTF = $this->oBd->objetSuivant($oPDOresult)) { - if ($oGTF->enabled == true) { - $sActif = ""; - } else { - $sActif = "#"; - } - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $sLigne = $sActif . "*/" . $oGTF->period . " * * * * \"" . $this->EnginesHome . "/engine.exe\" " . $oGTF->gtf_engine_id; - } else { - $sLigne = $sActif . "*/" . $oGTF->period . " * * * * cd \"" . $this->EnginesHome . "\" && \"" . $this->EnginesHome . "/engine\" " . $oGTF->gtf_engine_id; - } - fputs($sFichierCrontab, $sLigne . "\n"); - } - fputs($sFichierCrontab, "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddCrontabValuesSubscription() { - $sSql = 'SELECT period_id, cron_expression, enabled FROM ' . $this->aProperties['schema_gtf'] . '.period'; - $oPDOresult = $this->oBd->executeWithParams($sSql, array()); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - $sCronFile = '/tmp/' . uniqid('cron_'); - exec("crontab -u www-data -l > " . $sCronFile); - } else { - $sCronFile = $this->sCrontabFile; - } - $sFichierCrontab = fopen($sCronFile, "a"); - fputs($sFichierCrontab, "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - while ($oPeriod = $this->oBd->objetSuivant($oPDOresult)) { - if ($oPeriod->enabled == true) { - $sActif = ""; - } else { - $sActif = "#"; - } - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { - $sLigne = $sActif . $oPeriod->cron_expression . " \"" . $this->EnginesHome . "/php/php.exe\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id; - } else { - $sLigne = $sActif . $oPeriod->cron_expression . " (\"" . $this->EnginesHome . "/php/bin/php\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id . ")"; - } - fputs($sFichierCrontab, $sLigne . "\n"); - } - fputs($sFichierCrontab, "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); - if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { - exec("crontab -u www-data " . $sCronFile); - exec("rm " . $sCronFile); - } - } - - function AddPropertiesFME($sNotInList = "") { - $sFichierProperties = fopen($this->sGtfHome . "/rest/conf/gtf/properties_post_engines.inc", "w"); - fputs($sFichierProperties, "<?php" . "\n"); - $sLigne = '$properties["engines_list"] = \''; - $aParams = array(); - if ($sNotInList == "") { - $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE enabled = true ORDER BY gtf_engine_id'; - } else { - $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE gtf_engine_id not in (' . $sNotInList . ") AND enabled = true ORDER BY gtf_engine_id"; - $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); - } - $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); - while ($oFme = $this->oBd->objetSuivant($oPDOresult)) { - if ($sLigne == '$properties["engines_list"] = \'') { - $sLigne .= $oFme->gtf_engine_id; - } else { - $sLigne .= "," . $oFme->gtf_engine_id; - } - } - $sLigne .= "';"; - fputs($sFichierProperties, $sLigne . "\n"); - fputs($sFichierProperties, "?>" . "\n"); - } - -} - +<?php + +require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/dbUtil.inc'; +require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/logUtil.inc'; + +class ServerClass { + + //Chemin du fichier crontab + var $sCrontabFile; + //Id du server + var $iId; + //Nom du server + var $sServerName; + //Ancien nom du server + var $sOldServerName; + //Répertoire racine + var $sGtfHome; + //Répertoire Engines + var $EnginesHome; + //Objet de labase de données + var $oBd; + + function __construct($iId, $oBd, $sGtfHome, $sOldServerName = "", $aProperties = array()) { + $this->iId = $iId; + $this->oBd = $oBd; + $this->sOldServerName = $sOldServerName; + $this->sGtfHome = $sGtfHome; + $this->aProperties = $aProperties; + $this->setValues($iId); + } + + function setValues($iId) { + if ($iId != "") { + $sSql = 'SELECT scheduler_network_home, hostname, engines_home FROM ' . $this->aProperties['schema_gtf'] . '.server where server_id=[iIdServer]'; + $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + $oServer = $this->oBd->objetSuivant($oPDOresult); + $this->sCrontabFile = $oServer->scheduler_network_home; + $this->sServerName = $oServer->hostname; + $this->EnginesHome = $oServer->engines_home; + if ($this->sOldServerName == "") { + $this->sOldServerName = $this->sServerName; + } + } + } + + function deleteCrontabValuesEngine() { + $aValuesPycronNewFile = Array(); + if (is_file($this->sCrontabFile)) { + $aPycronValues = file($this->sCrontabFile); + $bWrite = true; + foreach ($aPycronValues as $sPycronValue) { + $sPycronValue = str_replace("\n", "", $sPycronValue); + $sPycronValue = str_replace("\r", "", $sPycronValue); + if ($sPycronValue == "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + + $bWrite = false; + } else if ($sPycronValue == "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + $bWrite = true; + } + if ($bWrite == true && $sPycronValue != "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">") { + $aValuesPycronNewFile[] = $sPycronValue; + } + } + } + // On écrit dans le fichier texte + $sFichierCrontab = fopen($this->sCrontabFile, "w"); + // Le fichier texte est vidé + ftruncate($sFichierCrontab, 0); + $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); + $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); + foreach ($aValuesPycronNewFile as $sPycronValues2) { + fputs($sFichierCrontab, $sPycronValues2 . "\n"); + } + // Enfin fermer le fichier + fclose($sFichierCrontab); + } + + function deleteCrontabValuesSubscription() { + $aPycronValues = file($this->sCrontabFile); + $aValuesPycronNewFile = Array(); + $bWrite = true; + foreach ($aPycronValues as $sPycronValue) { + $sPycronValue = str_replace("\n", "", $sPycronValue); + $sPycronValue = str_replace("\r", "", $sPycronValue); + + if ($sPycronValue == "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + + $bWrite = false; + } else if ($sPycronValue == "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + $bWrite = true; + } + if ($bWrite == true && $sPycronValue != "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">") { + $aValuesPycronNewFile[] = $sPycronValue; + } + } + // On écrit dans le fichier texte + $sFichierCrontab = fopen($this->sCrontabFile, "w"); + // Le fichier texte est vidé + ftruncate($sFichierCrontab, 0); + $aValuesPycronNewFile = str_replace("\n", "", $aValuesPycronNewFile); + $aValuesPycronNewFile = str_replace("\r", "", $aValuesPycronNewFile); + foreach ($aValuesPycronNewFile as $sPycronValues2) { + fputs($sFichierCrontab, $sPycronValues2 . "\n"); + } + // Enfin fermer le fichier + fclose($sFichierCrontab); + } + + function AddCrontabValuesEngines($sNotInList = "") { + if ($sNotInList == "") { + $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer]'; + } else { + $sSql = 'SELECT gtf_engine_id, period, enabled FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE server_id=[iIdServer] AND gtf_engine_id not in ([sNotInList])'; + $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); + } + $aParams['iIdServer'] = array('value' => $this->iId, 'type' => 'number'); + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + $sFichierCrontab = fopen($this->sCrontabFile, "a"); + fputs($sFichierCrontab, "#<gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + while ($oGTF = $this->oBd->objetSuivant($oPDOresult)) { + if ($oGTF->enabled == true) { + $sActif = ""; + } else { + $sActif = "#"; + } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $sLigne = $sActif . "*/" . $oGTF->period . " * * * * \"" . $this->EnginesHome . "/engine.exe\" " . $oGTF->gtf_engine_id; + } else { + $sLigne = $sActif . "*/" . $oGTF->period . " * * * * cd \"" . $this->EnginesHome . "\" && \"" . $this->EnginesHome . "/engine\" " . $oGTF->gtf_engine_id; + } + fputs($sFichierCrontab, $sLigne . "\n"); + } + fputs($sFichierCrontab, "#</gtf_engines " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $sCronTmp = '/tmp/' . uniqid('cron_'); + exec("crontab -u www-data -l > " . $sCronTmp); + exec("crontab -u www-data " . $sCronTmp); + exec("rm " . $sCronTmp); + } + } + + function AddCrontabValuesSubscription() { + $sSql = 'SELECT period_id, cron_expression, enabled FROM ' . $this->aProperties['schema_gtf'] . '.period'; + $oPDOresult = $this->oBd->executeWithParams($sSql, array()); + $sFichierCrontab = fopen($this->sCrontabFile, "a"); + fputs($sFichierCrontab, "#<gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + while ($oPeriod = $this->oBd->objetSuivant($oPDOresult)) { + if ($oPeriod->enabled == true) { + $sActif = ""; + } else { + $sActif = "#"; + } + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { + $sLigne = $sActif . $oPeriod->cron_expression . " \"" . $this->EnginesHome . "/php/php.exe\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id; + } else { + $sLigne = $sActif . $oPeriod->cron_expression . " (\"" . $this->EnginesHome . "/php/bin/php\" \"" . $this->EnginesHome . "/subscription.php\" " . $oPeriod->period_id . ")"; + } + fputs($sFichierCrontab, $sLigne . "\n"); + } + fputs($sFichierCrontab, "#</gtf_subscription " . gethostname() . " " . $this->sGtfHome . ">" . "\n"); + if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') { + $sCronTmp = '/tmp/' . uniqid('cron_'); + exec("crontab -u www-data -l > " . $sCronTmp); + exec("crontab -u www-data " . $sCronTmp); + exec("rm " . $sCronTmp); + } + } + + function AddPropertiesFME($sNotInList = "") { + $sFichierProperties = fopen($this->sGtfHome . "/rest/conf/gtf/properties_post_engines.inc", "w"); + fputs($sFichierProperties, "<?php" . "\n"); + $sLigne = '$properties["engines_list"] = \''; + $aParams = array(); + if ($sNotInList == "") { + $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE enabled = true ORDER BY gtf_engine_id'; + } else { + $sSql = 'SELECT gtf_engine_id FROM ' . $this->aProperties['schema_gtf'] . '.gtf_engine WHERE gtf_engine_id not in (' . $sNotInList . ") AND enabled = true ORDER BY gtf_engine_id"; + $aParams['sNotInList'] = array('value' => str_replace(',', '|', $sNotInList), 'type' => 'group'); + } + $oPDOresult = $this->oBd->executeWithParams($sSql, $aParams); + while ($oFme = $this->oBd->objetSuivant($oPDOresult)) { + if ($sLigne == '$properties["engines_list"] = \'') { + $sLigne .= $oFme->gtf_engine_id; + } else { + $sLigne .= "," . $oFme->gtf_engine_id; + } + } + $sLigne .= "';"; + fputs($sFichierProperties, $sLigne . "\n"); + fputs($sFichierProperties, "?>" . "\n"); + } + +} + ?> \ No newline at end of file diff --git a/web_service/ws/UserOrders.class.inc b/web_service/ws/UserOrders.class.inc index b0919bb3ecfaf61b8412fe4a3594420d092dcbb5..c8b49b977a7ea4e82679e6b1ecb253a3c831be54 100755 --- a/web_service/ws/UserOrders.class.inc +++ b/web_service/ws/UserOrders.class.inc @@ -195,15 +195,8 @@ class UserOrders extends GTF { $this->aValues['user_id'] = $_SESSION['ses_user_id']; if (!empty($this->aValues['email_notifications'])) $this->aValues['email_notifications'] = str_replace(chr(13) . chr(10), ";", $this->aValues['email_notifications']); - // Si token public -> id du compte public. + // Si token public -> teste si le compte 'public' a un des groupes qui est lié au traitement. if ($this->aValues['token'] == $this->aProperties['public_token']) { - $aPrivateTokenValues = $this->aValues; - $aPrivateTokenValues['user'] = $_SESSION['ses_Login']; - $aPrivateTokenValues['password'] = $this->oConnection->oBd->mdp; - $oPrivateToken = new PrivateToken($this->aPath, $aPrivateTokenValues, $this->aProperties, $this->oConnection); - $oPrivateToken->POST(); - $this->aValues['user_id'] = $oPrivateToken->aFields['user_id']; - // Teste si le compte 'public' a un des groupes qui est lié au traitement. require $this->sRessourcesFile; $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); $aParams['workspace_id'] = array('value' => $this->aValues['workspace_id'], 'type' => 'number'); @@ -246,7 +239,7 @@ class UserOrders extends GTF { $sDirName = $this->aProperties['upload_dir'] . "/" . $this->aValues['upload_directory']; if (!is_dir($sDirName)) mkdir($sDirName, 0777, true); - uploadFile($sName, "", $sDirName . "/" . $aFile['name'], $aFile['size'] + 1); + uploadFileToLocal($sName, "", $sDirName . "/" . $aFile['name'], $aFile['size'] + 1); } } // Met à jour le n° du moteur. diff --git a/web_service/ws/Workspace.class.inc b/web_service/ws/Workspace.class.inc index 07a23d46851c83cd464c1eb8445c26eae394af73..183128f8f1ec9263b8f4d5d8b7215618c9f51c33 100755 --- a/web_service/ws/Workspace.class.inc +++ b/web_service/ws/Workspace.class.inc @@ -2,6 +2,7 @@ require_once 'Gtf.class.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; +require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/files/Files_manager.class.inc'; /** * \file Workspace.class.inc @@ -12,7 +13,7 @@ require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection * \brief This file contains the Workspace php class * * This class defines operation for one Workspace - * + * */ class Workspace extends GTF { @@ -32,7 +33,7 @@ class Workspace extends GTF { } /** - * @SWG\Get(path="/workspaces/{workspace_id}", + * @SWG\Get(path="/workspaces/{workspace_id}", * tags={"Workspaces"}, * summary="Get Workspace", * description="Request to get Workspace by id", @@ -169,72 +170,58 @@ class Workspace extends GTF { * get informations about workspace */ function GET() { + $oFilesManager = new Files_manager($this->aProperties); if (!empty($this->aValues["form"])) { - $sDirName = $this->aProperties['workspace_dir'] . "/" . (string) $this->aValues["my_vitis_id"]; require $this->sRessourcesFile; $this->aFields = $this->getFields($this->aProperties['schema_gtf'], "v_workspace", "workspace_id"); + // Groupes rattachés au projet FME. $this->getGroups(); - - if ($this->aValues["form"] == "Default") { - $sFile = $sDirName . "/form/DSubform.json"; - } else if ($this->aValues["form"] == "Perso") { - $sFile = $sDirName . "/form/WSubform.json"; - } else if ($this->aValues["form"] == "Published") { - $sFile = $sDirName . "/form/Subform.json"; - } else { + // Fichier de formulaire. + if ($this->aValues["form"] == 'Default') + $sFile = 'DSubform.json'; + else if ($this->aValues["form"] == 'Perso') + $sFile = 'WSubform.json'; + else if ($this->aValues["form"] == 'Published') + $sFile = 'Subform.json'; + else { writeToErrorLog("Error parameter is not a known mode user :" . $_SESSION["user_id"]); - $this->oError = new VitisError(1, "Error parameter is not a known mode"); } - if (is_file($sFile)) { - $pFile = fopen($sFile, "r"); - $iSize = filesize($sFile); - $sJson = fread($pFile, $iSize); - fclose($pFile); - $aJson = json_decode($sJson, true); + // Contenu du fichier de formulaire. + $sDirPath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"]; + $sFileContent = $oFilesManager->oFileInterface->file_get_contents($sDirPath . '/form/' . $sFile); + if ($sFileContent !== false) { + $aJson = json_decode($sFileContent, true); $this->aFields["json_form"] = array($aJson); $sJs = ""; $sCss = ""; - if (is_dir($sDirName . "/form")) { - if ($dh = opendir($sDirName . "/form/ressources")) { - while (($file = readdir($dh)) !== false) { - $sName = explode(".", $file); - if ($sName[1] == "js") { - // $pFileJS = fopen($sDirName . "/form/ressources/Subform.js", "r"); - // $iSize = filesize($sDirName . "/form/ressources/Subform.js"); - // $sJs = fread($pFileJS, $iSize); - // fclose($pFileJS); - - $sJs = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . "/gtf/workspace/" . (string) $this->aValues["my_vitis_id"] . "/form/ressources/Subform.js"; - } - if ($sName[1] == "css") { - /* $pFileCSS = fopen($sDirName . "/form/ressources/Subform.css", "r"); - $iSize = filesize($sDirName . "/form/ressources/Subform.css"); - $sCss = fread($pFileCSS, $iSize); - fclose($pFileCSS); */ - $sCss = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . "/gtf/workspace/" . (string) $this->aValues["my_vitis_id"] . "/form/ressources/Subform.css"; - } - } - closedir($dh); - } - } + // Url du fichier js du formulaire. + $sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sDirPath . '/form/ressources/Subform.js'); + $sJs = $sFileUrl; + // Url du fichier css du formulaire. + $sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sDirPath . '/form/ressources/Subform.css'); + $sCss = $sFileUrl; + // array_push($this->aFields["json_form"], $sJs); array_push($this->aFields["json_form"], $sCss); - } else { - - $this->oError = new VitisError(1, "File not found"); } + else + $this->oError = new VitisError(1, "File not found"); } else { require $this->sRessourcesFile; $this->aFields = $this->getFields($this->aProperties['schema_gtf'], "v_workspace", "workspace_id"); $this->getGroups(); // Url vers le fichier fmw du projet. - if (!empty($this->aFields['fmw_file'])) - $this->aFields['fmw_file_url'] = $this->aProperties['web_server_name'] . '/' . $this->aProperties['ws_data_alias'] . '/gtf/workspace/' . $this->aValues['my_vitis_id'] . '/fme/' . $this->aFields['fmw_file']; + if (!empty($this->aFields['fmw_file'])) { + $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues['my_vitis_id'] . '/fme/' . $this->aFields['fmw_file']; + $sFmwFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sFilePath); + if (!empty($sFmwFileUrl)) + $this->aFields['fmw_file_url'] = $sFmwFileUrl; + } } // Formatage de la colonne "form_type". - $sFile = $this->aProperties['workspace_dir'] . "/" . $this->aValues["my_vitis_id"] . '/form/Subform.json'; - if (!file_exists($sFile)) + $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/form/Subform.json'; + if (!$oFilesManager->oFileInterface->file_exists($sFilePath)) $this->aFields['form_type'] = ''; else { if ($this->aFields['form_type'] != "custom") @@ -273,17 +260,13 @@ class Workspace extends GTF { if ($this->oConnection->oBd->enErreur()) { $this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage()); } else { - $this->aFields['workspace_id'] = $this->aValues["my_vitis_id"]; - - $sDirName = $this->aProperties['workspace_dir'] . "/" . $this->aFields["workspace_id"] . "/"; - if (is_dir($sDirName)) { - clearDir($sDirName); - } else { - writeToErrorLog("No folder link with this workspace. verify if the workspace folder already exist on the server"); - } + // Suppression du répertoire du projet FME. + $oFilesManager = new Files_manager($this->aProperties); + $sDirPath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"]; + $oFilesManager->oFileInterface->clearDir($sDirPath); } } } -?> \ No newline at end of file +?> diff --git a/web_service/ws/Workspaces.class.inc b/web_service/ws/Workspaces.class.inc index 521713a108af401fa00b0e09fad16465a2433361..63d7fd789faade6ab7c49cdb1d9db9d5c8d8573d 100755 --- a/web_service/ws/Workspaces.class.inc +++ b/web_service/ws/Workspaces.class.inc @@ -9,7 +9,7 @@ * \brief This file contains the Workspaces php class * * This class defines Rest Api to Gtf workspaces - * + * */ require_once 'Gtf.class.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vitis_lib/Connection.class.inc'; @@ -17,6 +17,7 @@ require_once 'Workspace.class.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/BdDataAccess.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/phpUtil.inc'; require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/gtf_lib/GtfFmwParser.class.inc'; +require_once dirname($_SERVER['SCRIPT_FILENAME']) . '/class/vmlib/files/Files_manager.class.inc'; class Workspaces extends GTF { /** @@ -168,14 +169,14 @@ class Workspaces extends GTF { $aReturn = $this->genericGet($this->aProperties['schema_gtf'], "v_workspace", "workspace_id"); // Formatage de la colonne "form_type". if ($aReturn['sStatus'] == 1) { + $oFilesManager = new Files_manager($this->aProperties); foreach ($this->aObjects as &$oWorkspace) { - $sFile = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields['workspace_id'] . '/form/Subform.json'; - if (!file_exists($sFile)) { + $sFilePath = $this->aProperties['workspace_dir'] . '/' . $oWorkspace->aFields['workspace_id'] . '/form/Subform.json'; + if (!$oFilesManager->oFileInterface->file_exists($sFilePath)) $oWorkspace->aFields['form_type'] = ''; - } else { - if ($oWorkspace->aFields['form_type'] != "custom") { + else { + if ($oWorkspace->aFields['form_type'] != "custom") $oWorkspace->aFields['form_type'] = "default"; - } } } $aXmlRacineAttribute['status'] = 1; @@ -310,34 +311,41 @@ class Workspaces extends GTF { * @return id of the workspace created */ function POST() { + $oFilesManager = new Files_manager($this->aProperties); require $this->sRessourcesFile; - // Importation de projets. + // Création du fichier html du widget. if (!empty($this->aPath[3]) && $this->aPath[3] === "GenerateWidgetFile") { unset($this->aPath[3]); $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); $oWorkspace->GET(); $sWorkspace_key = $oWorkspace->aFields["key"]; - // Emplacement des widgets - $sWidgetDirectory = $this->aProperties["vas_home"] . '/ws_data/gtf/widget'; - $bError = False; - if (!is_dir($sWidgetDirectory)) { - if (!mkdir($sWidgetDirectory, 0777, true)) { - $bError = True; - $this->aFields['errorMessage'] = "Failed to create directory " . $sWidgetDirectory; - } + $this->aFields['workspace_key'] = $sWorkspace_key; + // Widget dans une page html. + $sWidgetHtml = '<!DOCTYPE html>' . PHP_EOL . '<html>' . PHP_EOL . '<head>' . PHP_EOL . '<title>Widget</title>' . PHP_EOL . '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL . '<meta http-equiv="X-UA-Compatible" content="IE=edge">' . PHP_EOL . '</head>' . PHP_EOL . '<body>'; + $sWidgetHtml .= $this->aValues['widgetFileContent']; + $sWidgetHtml .= '' . PHP_EOL . '</body>' . PHP_EOL . '</html>'; + // Création du répertoire des widgets si inexistant. + $sDirPath = $this->aProperties['ws_data_dir'] . '/gtf/widget'; + if (!$oFilesManager->oFileInterface->is_dir($sDirPath)) + $oFilesManager->oFileInterface->mkdir($sDirPath, 0777, true); + // Création du fichier du widget. + $sFilePath = $sDirPath . '/' . $sWorkspace_key . ".html"; + if ($oFilesManager->oFileInterface->file_put_contents($sFilePath, $sWidgetHtml) !== false) { + // Url du fichier du widget. + $sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sFilePath); + if ($sFileUrl !== false) + $this->aFields['widget_file_url'] = $sFileUrl; + $aXmlRacineAttribute['status'] = 1; + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - if (!$bError) { - $this->aFields['workspace_key'] = $sWorkspace_key; - // Widget dans une page html. - $sWidgetHtml = '<!DOCTYPE html>' . PHP_EOL . '<html>' . PHP_EOL . '<head>' . PHP_EOL . '<title>Widget</title>' . PHP_EOL . '<meta name="viewport" content="width=device-width, initial-scale=1.0">' . PHP_EOL . '<meta http-equiv="X-UA-Compatible" content="IE=edge">' . PHP_EOL . '</head>' . PHP_EOL . '<body>'; - $sWidgetHtml .= $this->aValues['widgetFileContent']; - $sWidgetHtml .= '' . PHP_EOL . '</body>' . PHP_EOL . '</html>'; - file_put_contents($this->aProperties["vas_home"] . '/ws_data/gtf/widget/' . $sWorkspace_key . ".html", $sWidgetHtml); + else { + $oError = new VitisError(17, 'ERROR_CREATION_WIDGET_FILE'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - $aXmlRacineAttribute['status'] = (int) !$bError; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); return $sMessage; } + // Importation de projets. if (!empty($this->aValues['mode']) && $this->aValues['mode'] == "import") { for ($i = 0; $i < count($_FILES['fmw_file']['name']); $i++) { $aParams = array(); @@ -380,48 +388,56 @@ class Workspaces extends GTF { } $aReturn = $this->genericPost($this->aProperties['schema_gtf'], 'workspace', $this->aProperties['schema_gtf'] . '.seq_common', 'workspace_id'); - $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); - $oWorkspace->GET(); - $sFilePathName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"] . "/fme/" . $_FILES['fmw_file']['name'][$i]; - $sDirName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"]; - // Si le répertoire existe déja : suppression. - if (is_dir($sDirName)) - clearDir($sDirName); - // - mkdir($sDirName, 0777, true); - mkdir($sDirName . "/form", 0777, true); - mkdir($sDirName . "/form/ressources", 0777, true); - mkdir($sDirName . "/fme", 0777, true); - - if (!move_uploaded_file($_FILES['fmw_file']['tmp_name'][$i], utf8_decode($sFilePathName))) { - writeToErrorLog(ERROR_0031 . $_FILES['file']['name']); - $aReturn = array(sStatus => 1, sMessage => WORKSPACE_ERROR_COPYING_FILE); - } else { - // Fichier .fmw original en .bak. - copy($sDirName . "/fme/" . utf8_decode($this->aValues['fmw_file']), $sDirName . "/fme/" . utf8_decode($this->aValues['fmw_file']) . '.bak'); - // - fclose(fopen($sDirName . "/form/ressources/Subform.js", "w+")); - fclose(fopen($sDirName . "/form/ressources/Subform.css", "w+")); - $oFmwParser = new GtfFmwParser($sDirName . "/fme/" . $_FILES['fmw_file']['name'][$i]); - // Sauve le .fmw sans les visualizers. - $oFmwParser->save($sDirName . "/fme/" . utf8_decode($this->aValues['fmw_file'])); - // Création des formulaires json. - $aJson = $oFmwParser->productJson($this->aProperties, $oWorkspace->aFields["name"]); - $fJson = fopen($sDirName . "/form/Subform.json", "w+"); - if (fwrite($fJson, json_encode($aJson)) == FALSE) { - if ($fJson == FALSE) { - writeToErrorLog("Subform.json can't be opened : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); + if ($aReturn['sStatus'] == 1) { + $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); + $oWorkspace->GET(); + $sFilePathName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"] . "/fme/" . $_FILES['fmw_file']['name'][$i]; + $sDirName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"]; + // Si le répertoire existe déja : suppression. + if ($oFilesManager->oFileInterface->is_dir($sDirName)) + $oFilesManager->oFileInterface->clearDir($sDirName); + // Upload du fichier fmw. + $this->aValues['fme'] = $this->aValues['fmw_file']; + $_FILES['fme'] = array( + 'name' => $_FILES['fmw_file']['name'][$i], + 'type' => $_FILES['fmw_file']['type'][$i], + 'tmp_name' => $_FILES['fmw_file']['tmp_name'][$i], + 'error' => $_FILES['fmw_file']['error'][$i], + 'size' => $_FILES['fmw_file']['size'][$i] + ); + $sErrorMessage = uploadInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], "fme", $this->aValues, -1, "fmw"); + if (!empty($sErrorMessage)) { + writeToErrorLog($sErrorMessage); + $oError = new VitisError(8, $sErrorMessage); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + } else { + // Copie du .fmw original en .bak. + $oFilesManager->oFileInterface->copy($sDirName . '/fme/' . $_FILES['fmw_file']['name'][$i], $sDirName . '/fme/' . $_FILES['fmw_file']['name'][$i] . '.bak'); + // Création des fichiers vides de ressources js et css. + $oFilesManager->oFileInterface->mkdir($sDirName . '/form/ressources', 0777, true); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.js', ''); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.css', ''); + // Lit le contenu du fichier .fmw du projet. + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sDirName . '/fme/' . $_FILES['fmw_file']['name'][$i]); + // Sauve le .fmw sans les visualizers. + $oFmwParser = new GtfFmwParser($_FILES['fmw_file']['name'][$i], $this->aProperties, $sFmwFileContent); + $oFmwParser->save($oFmwParser->sFmwFileName); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/fme/' . $_FILES['fmw_file']['name'][$i], file_get_contents($oFmwParser->sFmwFileName)); + // Création des formulaires json. + $aJson = $oFmwParser->productJson($oWorkspace->aFields["name"]); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/Subform.json', json_encode($aJson)) !== false) { + $oFilesManager->oFileInterface->copy($sDirName . '/form/Subform.json', $sDirName . '/form/WSubform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/Subform.json', $sDirName . '/form/DSubform.json'); } + $oFmwParser->updateMetadata($this->oConnection->oBd, $oWorkspace->aFields["workspace_id"]); + // + $this->aValues["errorkeys"] = ""; } - fclose($fJson); - copy($sDirName . "/form/Subform.json", $sDirName . "/form/WSubform.json"); - copy($sDirName . "/form/Subform.json", $sDirName . "/form/DSubform.json"); - $oFmwParser->updateMetadata($this->oConnection->oBd, $oWorkspace->aFields["workspace_id"]); - $this->aValues["errorkeys"] = ""; + $sMessage = $aReturn['sMessage']; } - $sMessage = $aReturn['sMessage']; + else + return $aReturn['sMessage']; } } else { $this->aValues["fmw_file"] = $_FILES['fmw_file']['name']; @@ -454,7 +470,7 @@ class Workspaces extends GTF { $oError = new VitisError(1, "FORM_WORKSPACE_NAME_EXISTS_PUBLICATION_WORKSPACE"); $aXmlRacineAttribute['status'] = 0; $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } + } else { $this->aValues['creation_date'] = gmdate('Y-m-d H:i:s'); // Création de la clé du projet. @@ -502,44 +518,49 @@ class Workspaces extends GTF { } $sDirName = $this->aProperties['workspace_dir'] . "/" . $oWorkspace->aFields["workspace_id"]; // Si le répertoire existe déja : suppression. - if (is_dir($sDirName)) - clearDir($sDirName); - // - mkdir($sDirName, 0777, true); - mkdir($sDirName . "/form", 0777, true); - mkdir($sDirName . "/form/ressources", 0777, true); - mkdir($sDirName . "/fme", 0777, true); - uploadFile('fmw_file', "fmw", $sDirName . "/fme/" . $_FILES['fmw_file']['name'], $_FILES['fmw_file']['size'] + 1); - // Fichier .fmw original en .bak. - copy($sDirName . "/fme/" . utf8_decode($_FILES['fmw_file']['name']), $sDirName . "/fme/" . utf8_decode($_FILES['fmw_file']['name']) . '.bak'); - // - fclose(fopen($sDirName . "/form/ressources/Subform.js", "w+")); - fclose(fopen($sDirName . "/form/ressources/Subform.css", "w+")); - if ($this->aValues["comp_file"] != "") { - uploadFile('comp_file', "", $sDirName . "/fme/" . $_FILES['comp_file']['name'], $_FILES['comp_file']['size'] + 1); - $ext = pathinfo($_FILES['comp_file']['name'], PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($_FILES['comp_file']['name']), $sDirName . "/fme/"); - } + if ($oFilesManager->oFileInterface->is_dir($sDirName)) + $oFilesManager->oFileInterface->clearDir($sDirName); + // Upload du fichier fmw. + $this->aValues['fme'] = $this->aValues['fmw_file']; + $_FILES['fme'] = $_FILES['fmw_file']; + $sErrorMessage = uploadInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], "fme", $this->aValues, -1, "fmw"); + if (!empty($sErrorMessage)) { + writeToErrorLog($sErrorMessage); + $oError = new VitisError(8, $sErrorMessage); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - $oFmwParser = new GtfFmwParser($sDirName . "/fme/" . $_FILES['fmw_file']['name']); - // Sauve le .fmw sans les visualizers. - $oFmwParser->save($sDirName . "/fme/" . utf8_decode($_FILES['fmw_file']['name'])); - // Création des formulaires json. - $aJson = $oFmwParser->productJson($this->aProperties, $oWorkspace->aFields["name"]); - $fJson = fopen($sDirName . "/form/Subform.json", "w+"); - if (fwrite($fJson, json_encode($aJson)) == FALSE) { - if ($fJson == FALSE) { - writeToErrorLog("Subform.json can't be opened : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); + else { + // Copie du .fmw original en .bak. + $oFilesManager->oFileInterface->copy($sDirName . '/fme/' . $_FILES['fmw_file']['name'], $sDirName . '/fme/' . $_FILES['fmw_file']['name'] . '.bak'); + // Création des fichiers vides de ressources js et css. + $oFilesManager->oFileInterface->mkdir($sDirName . '/form/ressources', 0777, true); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.js', ''); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.css', ''); + // Upload du fichier de ressource. + if ($this->aValues["comp_file"] != "") { + // Si le fichier est une archive .zip -> décompression et copie des fichiers. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $_FILES['comp_file']['tmp_name']); + $this->aValues['fme'] = $this->aValues['comp_file']; + $_FILES['fme'] = $_FILES['comp_file']; + $sErrorMessage = uploadInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], "fme", $this->aValues); } + // Lit le contenu du fichier .fmw du projet. + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sDirName . '/fme/' . $_FILES['fmw_file']['name']); + // Sauve le .fmw sans les visualizers. + $oFmwParser = new GtfFmwParser($_FILES['fmw_file']['name'], $this->aProperties, $sFmwFileContent); + $oFmwParser->save($oFmwParser->sFmwFileName); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/fme/' . $_FILES['fmw_file']['name'], file_get_contents($oFmwParser->sFmwFileName)); + // Création des formulaires json. + $aJson = $oFmwParser->productJson($oWorkspace->aFields["name"]); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/Subform.json', json_encode($aJson)) !== false) { + $oFilesManager->oFileInterface->copy($sDirName . '/form/Subform.json', $sDirName . '/form/WSubform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/Subform.json', $sDirName . '/form/DSubform.json'); + } + $oFmwParser->updateMetadata($this->oConnection->oBd, $oWorkspace->aFields["workspace_id"]); + /* * ************************************************************** */ } - fclose($fJson); - copy($sDirName . "/form/Subform.json", $sDirName . "/form/WSubform.json"); - copy($sDirName . "/form/Subform.json", $sDirName . "/form/DSubform.json"); - $oFmwParser->updateMetadata($this->oConnection->oBd, $oWorkspace->aFields["workspace_id"]); - /* * ************************************************************** */ } else { writeToErrorLog("the uploaded file is not a fmw file or no file uploaded (Workspaces.class.inc : user_id->" . $_SESSION["user_id"] . ")"); $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); @@ -549,6 +570,11 @@ class Workspaces extends GTF { $sMessage = $aReturn['sMessage']; } } + else { + $oError = new VitisError(1, 'REQUEST_ERROR'); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + } }; return $sMessage; } @@ -683,21 +709,21 @@ class Workspaces extends GTF { * @return id of the workspace if ok error object if ko */ function PUT() { + $oFilesManager = new Files_manager($this->aProperties); if (!empty($this->aValues["action"]) && $this->aValues["action"] == "Metadata") { $aReturn = $this->reintegrateMetadata(); - $aXmlRacineAttribute['status'] = $aReturn['status']; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + if ($aReturn['status'] == 1) + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + else { + $oError = new VitisError(13, $aReturn['message']); + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + } } else { $sDirName = $this->aProperties['workspace_dir'] . "/" . (string) $this->aValues["my_vitis_id"]; - - - $sDirName = $this->aProperties['workspace_dir'] . "/" . (string) $this->aValues["my_vitis_id"]; - $error_message = ""; - // Si le dossier {id} n'existe pas (Important pour gérer les erreurs) - if (!is_dir($sDirName)) { + if (!$oFilesManager->oFileInterface->is_dir($sDirName)) { $error_message .= $sDirName . " does not exist"; writeToErrorLog("WARNING: " . $error_message); @@ -708,7 +734,7 @@ class Workspaces extends GTF { return $sMessage; } // Si le dossier {id}/fme n'existe pas (Important pour gérer les erreurs) - if (!is_dir($sDirName . "/fme")) { + if (!$oFilesManager->oFileInterface->is_dir($sDirName . '/fme')) { $error_message .= $sDirName . "/fme does not exist"; writeToErrorLog("WARNING: " . $error_message); @@ -720,107 +746,83 @@ class Workspaces extends GTF { } // Si le dossier {id}/form n'existe pas il est crée - if (!is_dir($sDirName . "/form")) { + if (!$oFilesManager->oFileInterface->is_dir($sDirName . '/form')) { writeToErrorLog("WARNING: " . $sDirName . "/form dit not exist"); - @mkdir($sDirName . "/form"); + $oFilesManager->oFileInterface->mkdir($sDirName . '/form', 0777, true); + //if ($this->aProperties['fileS3Uploader'] === false) + //@mkdir($sDirName . "/form"); } if (!empty($this->aValues["cmd"])) { switch ($this->aValues["cmd"]) { - // DSubform: formulaire par défaut // Subform: formulaire publié // WSubform: formulaire personnalié // Remplace le formulaire publié par celui par défaut case "Default_Published": // Si le fichier par défaut n'existe pas, il est généré - if (!file_exists($sDirname . "/form/DSubform.json")) { + if (!$oFilesManager->oFileInterface->file_exists($sDirName . '/form/DSubform.json')) { $this->aValues["cmd"] = "Default_Reset"; $this->PUT(); } - @unlink($sDirname . "/form/Subform.json"); - copy($sDirName . "/form/DSubform.json", $sDirName . "/form/Subform.json"); + // Remplace 'Subform.json' par le formulaire par défaut 'DSubform.json'. + $oFilesManager->oFileInterface->unlink($sDirName . '/form/Subform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/DSubform.json', $sDirName . '/form/Subform.json'); $this->aValues["form_type"] = 'default'; break; // Regénère le formulaire par défaut en fonction du fmw case "Default_Reset": $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); $oWorkspace->GET(); - if (empty($oWorkspace->aFields["fmw_file"])) { $error_message .= "Any FME file founded in" . $sDirName . "/fme/ "; 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; } - - $oFmwParser = new GtfFmwParser($sDirName . "/fme/" . $oWorkspace->aFields["fmw_file"]); - $aJson = $oFmwParser->productJson($this->aProperties, $oWorkspace->aFields["name"]); - $fJson = fopen($sDirName . "/form/DSubform.json", "w"); - if (fwrite($fJson, json_encode($aJson)) == FALSE) { - if ($fJson == FALSE) { - writeToErrorLog("Subform.json can't be opened : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); - } - } - fclose($fJson); + // Lit le contenu du fichier .fmw du projet. + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sDirName . '/fme/' . $oWorkspace->aFields["fmw_file"]); + // Création des formulaires json. + $oFmwParser = new GtfFmwParser($oWorkspace->aFields["fmw_file"], $this->aProperties, $sFmwFileContent); + $aJson = $oFmwParser->productJson($oWorkspace->aFields["name"]); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/DSubform.json', json_encode($aJson)) === false) + writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); //$oFmwParser->updateMetadata($this->oConnection->oBd, $oWorkspace->aFields["workspace_id"]); break; // Remplace le formulaire publié par celui personnalisé case "Perso_Published" : - @unlink($sDirname . "/form/Subform.json"); - copy($sDirName . "/form/WSubform.json", $sDirName . "/form/Subform.json"); + $oFilesManager->oFileInterface->unlink($sDirName . '/form/Subform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/WSubform.json', $sDirName . '/form/Subform.json'); $this->aValues["form_type"] = 'custom'; break; // Remplace le fornulaire personnalisé par le formulaire par défaut case "Perso_Reset": // Si le fichier par défaut n'existe pas, il est généré - if (!file_exists($sDirname . "/form/DSubform.json")) { + if (!$oFilesManager->oFileInterface->file_exists($sDirName . '/form/DSubform.json')) { $this->aValues["cmd"] = "Default_Reset"; $this->PUT(); } - @unlink($sDirname . "/form/WSubform.json"); - copy($sDirName . "/form/DSubform.json", $sDirName . "/form/WSubform.json"); + // Remplace 'Subform.json' par 'WSubform.json'. + $oFilesManager->oFileInterface->unlink($sDirName . '/form/WSubform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/DSubform.json', $sDirName . '/form/WSubform.json'); break; - // Sauvegarde le formulaire personnalisé + // Sauvegarde le formulaire personnalisé. case "Perso_Save": - $pFile = fopen($sDirName . "/form/WSubform.json", "w"); - if (fwrite($pFile, $this->aValues["Json"]) == FALSE) { - if ($fJson == FALSE) { - writeToErrorLog("Subform.json can't be opened : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); - } - } - fclose($pFile); - + // Sauve le formulaire personnalisé. + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/WSubform.json', $this->aValues["Json"]) === false) + writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); + // Sauve le javascript. if ($this->aValues["Js"] != "") { - $pFileJS = fopen($sDirName . "/form/ressources/Subform.js", "w+"); - if (fwrite($pFileJS, $this->aValues["Js"]) == FALSE) { - if ($pFileJS == FALSE) { - writeToErrorLog("Subform.js can't be opened : " . $sDirName . "/form/ressources/Subform.js" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.js can't be writed : " . $sDirName . "/form/ressources/Subform.js" . "(Workspaces.class.inc : verify the folder's rights)"); - } - } - fclose($pFileJS); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.js', $this->aValues["Js"]) === false) + writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); } - + // Sauve le css. if ($this->aValues["Css"] != "") { - $pFileCSS = fopen($sDirName . "/form/ressources/Subform.css", "w+"); - if (fwrite($pFileCSS, $this->aValues["Css"]) == FALSE) { - if ($pFileCSS == FALSE) { - writeToErrorLog("Subform.css can't be opened : " . $sDirName . "/form/ressources/Subform.css" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.css can't be writed : " . $sDirName . "/form/ressources/Subform.css" . "(Workspaces.class.inc : verify the folder's rights)"); - } - } - fclose($pFileCSS); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.css', $this->aValues["Css"]) === false) + writeToErrorLog("Subform.css can't be writed : " . $sDirName . "/form/ressources/Subform.css" . "(Workspaces.class.inc : verify the folder's rights)"); } break; default : writeToErrorLog("ERROR : Bad request from Client : " . $this->aValues["cmd"] . " form user ->" . $_SESSION["user_id"]); @@ -829,14 +831,16 @@ class Workspaces extends GTF { if (!empty($this->aValues["fmw_file_file"])) { $this->aValues["fmw_file"] = $this->aValues["fmw_file_name"]; } + // Upload du fichier de ressource. if (!empty($this->aValues["comp_file_file"])) { $this->aValues["comp_file"] = $this->aValues["comp_file_name"]; - $fp = fopen($sDirName . "/fme/" . utf8_decode($this->aValues["comp_file_name"]), "w"); - fwrite($fp, $this->aValues["comp_file_file"]); - fclose($fp); - $ext = pathinfo($sDirName . "/fme/" . utf8_decode($this->aValues["comp_file_name"]), PATHINFO_EXTENSION); - if ($ext == "zip") { - unZip($sDirName . "/fme/" . utf8_decode($this->aValues["comp_file_name"]), $sDirName . "/fme/"); + $sFilePath = $sDirName . '/fme/' . $this->aValues["comp_file_name"]; + $oFilesManager->oFileInterface->file_put_contents($sFilePath, $this->aValues["comp_file_file"]); + // Si le fichier est une archive .zip -> décompression et copie du répertoire. + if (pathinfo($this->aValues["comp_file"], PATHINFO_EXTENSION) == "zip") { + $sZipFilePath = $this->aProperties['extract_dir'] . '/' . $this->aValues["comp_file_name"]; + file_put_contents($sZipFilePath, $this->aValues["comp_file_file"]); + unzipInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'fme', $sZipFilePath); } } $aReturn = $this->genericPut($this->aProperties['schema_gtf'], 'workspace', 'workspace_id'); @@ -865,35 +869,39 @@ class Workspaces extends GTF { $aExt = explode(".", $this->aValues["fmw_file_name"]); if ($aExt[count($aExt) - 1] == "fmw") { // Sauve le nouveau fichier fmw. - $fp = fopen($sDirName . "/fme/" . utf8_decode($this->aValues["fmw_file_name"]), "w"); - fwrite($fp, $this->aValues["fmw_file_file"]); - fclose($fp); - // Fichier .fmw original en .bak. - copy($sDirName . "/fme/" . utf8_decode($this->aValues['fmw_file_name']), $sDirName . "/fme/" . utf8_decode($this->aValues['fmw_file_name']) . '.bak'); - // Création du nouveau formulaire. - $oFmwParser = new GtfFmwParser($sDirName . "/fme/" . $this->aValues["fmw_file_name"]); - // Sauve le .fmw sans les visualizers. - $oFmwParser->save($sDirName . "/fme/" . utf8_decode($this->aValues["fmw_file_name"])); - // Création des formulaires json. - $aJson = $oFmwParser->productJson($this->aProperties, $oWorkspace->aFields["name"]); - $fJson = fopen($sDirName . "/form/DSubform.json", "w"); - if (fwrite($fJson, json_encode($aJson)) == FALSE) { - if ($fJson == FALSE) { - writeToErrorLog("Subform.json can't be opened : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the property workspace_dir)"); - } else { - writeToErrorLog("Subform.json can't be writed : " . $sDirName . "/form/ressources/Subform.json" . "(Workspaces.class.inc : verify the folder's rights)"); - } + $sFilePath = $sDirName . '/fme/' . $this->aValues["fmw_file_name"]; + $oFilesManager->oFileInterface->file_put_contents($sFilePath, $this->aValues["fmw_file_file"]); + if (!empty($sErrorMessage)) { + writeToErrorLog($sErrorMessage); + $oError = new VitisError(8, $sErrorMessage); + $aXmlRacineAttribute['status'] = 0; + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - fclose($fJson); - if ($oWorkspace->aFields["form_type"] == 'default') { - copy($sDirName . "/form/DSubform.json", $sDirName . "/form/Subform.json"); - copy($sDirName . "/form/DSubform.json", $sDirName . "/form/WSubform.json"); + else { + // Copie du .fmw original en .bak. + $oFilesManager->oFileInterface->copy($sDirName . '/fme/' . $this->aValues['fmw_file_name'], $sDirName . '/fme/' . $this->aValues['fmw_file_name'] . '.bak'); + // Création des fichiers vides de ressources js et css. + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.js', ''); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/ressources/Subform.css', ''); + // Lit le contenu du fichier .fmw du projet. + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sDirName . '/fme/' . $this->aValues['fmw_file_name']); + // Sauve le .fmw sans les visualizers. + $oFmwParser = new GtfFmwParser($this->aValues['fmw_file_name'], $this->aProperties, $sFmwFileContent); + $oFmwParser->save($oFmwParser->sFmwFileName); + $oFilesManager->oFileInterface->file_put_contents($sDirName . '/fme/' . $this->aValues['fmw_file_name'], file_get_contents($oFmwParser->sFmwFileName)); + // Création des formulaires json. + $aJson = $oFmwParser->productJson($oWorkspace->aFields["name"]); + if ($oFilesManager->oFileInterface->file_put_contents($sDirName . '/form/DSubform.json', json_encode($aJson)) !== false) { + $oFilesManager->oFileInterface->copy($sDirName . '/form/DSubform.json', $sDirName . '/form/WSubform.json'); + $oFilesManager->oFileInterface->copy($sDirName . '/form/DSubform.json', $sDirName . '/form/Subform.json'); + } + // Récupère les anciens paramètres. + $oFmwParser->getBdMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); + // Mise à jour des paramètres du nouveau fichier dans la base. + $oFmwParser->sSaveDate = gmdate('Y-m-d G:i:s'); + $oFmwParser->updateMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); + /*****************************************************************/ } - // Récupère les anciens paramètres. - $oFmwParser->getBdMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); - // Mise à jour des paramètres du nouveau fichier dans la base. - $oFmwParser->sSaveDate = gmdate('Y-m-d G:i:s'); - $oFmwParser->updateMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); } } else { $aXmlRacineAttribute['status'] = 1; @@ -1044,28 +1052,32 @@ class Workspaces extends GTF { if ($this->aPath[3] == "File") { $aReturn = $this->deleteWorkspaceFile(); $aXmlRacineAttribute['status'] = $aReturn['status']; - if ($aReturn['status'] == 1) { + if ($aReturn['status'] == 1) $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); - } else { - $oError = new VitisError(1, 'LICENSE_FILE_INSTALL_ERROR_CONFIGURATION_CONFIGURATION_GTF_LICENSE'); + else { + $oError = new VitisError(1, $aReturn['message']); $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } } elseif ($this->aPath[3] == "DeleteWidgetFile") { unset($this->aPath[3]); + $aReturn = array('status' => 1, 'message' => ''); $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); $oWorkspace->GET(); $sWorkspace_key = $oWorkspace->aFields["key"]; - // Emplacement des widgets - $sWidgetFilePath = $this->aProperties["vas_home"] . '/ws_data/gtf/widget/' . $sWorkspace_key . ".html"; - $bError = False; - if (is_file($sWidgetFilePath)) { - if (!unlink($sWidgetFilePath)) { - $bError = True; - $this->aFields['errorMessage'] = "Failed to remove the widget " . $sWidgetFilePath; - } + // Suppression du fichier de widget. + $oFilesManager = new Files_manager($this->aProperties); + $sFilePath = $this->aProperties['ws_data_dir'] . '/gtf/widget/' . $sWorkspace_key . '.html'; + if ($oFilesManager->oFileInterface->file_exists($sFilePath) && !$oFilesManager->oFileInterface->unlink($sFilePath)) { + $aReturn = array('status' => 0, 'message' => 'DELETE_FILE_ERROR_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY', 'error_code' => null); + writeToErrorLog('Failed to remove the wisget file ' . $sWorkspace_key . '.html'); + } + $aXmlRacineAttribute['status'] = $aReturn['status']; + if ($aReturn['status'] == 1) + $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); + else { + $oError = new VitisError($aReturn['error_code'], $aReturn['message']); + $sMessage = $oError->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); } - $aXmlRacineAttribute['status'] = (int) !$bError; - $sMessage = $this->asDocument('', 'vitis', $this->aValues['sEncoding'], True, $aXmlRacineAttribute, $this->aValues['sSourceEncoding'], $this->aValues['output']); return $sMessage; } } else { @@ -1080,17 +1092,33 @@ class Workspaces extends GTF { */ function getWorkspaceDirectoryTree() { $aReturn = array('status' => 1, 'message' => ''); - $sWorkspaceDir = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme'; - $sTreeName = 'fme'; - if (is_dir($sWorkspaceDir)) { - $aDirStructure = $this->getDirStructure($sWorkspaceDir, $sTreeName); - $aTreeviewLogs["data"][] = $aDirStructure["data"]; - foreach ($aDirStructure["files"] as $aFiles) { - $aTreeviewLogs["files"][] = $aFiles; + if ($this->aProperties['fileS3Uploader'] === true) { + $aWorkspaceDirectoryTree = $this->getS3FolderInfos('ws_data/gtf/workspace/' . $this->aValues["my_vitis_id"] . '/fme'); + if ($aWorkspaceDirectoryTree === false) { + $aReturn['status'] = 0; + $aReturn['error_code'] = 13; + $aReturn['message'] = 'ERROR_FILE_TREE_LOADING_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY'; + } + else + $this->aFields['tree'] = $aWorkspaceDirectoryTree; + } + else { + $sWorkspaceDir = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme'; + $sTreeName = 'fme'; + if (is_dir($sWorkspaceDir)) { + $aDirStructure = $this->getDirStructure($sWorkspaceDir, $sTreeName); + $aTreeviewLogs["data"][] = $aDirStructure["data"]; + foreach ($aDirStructure["files"] as $aFiles) + $aTreeviewLogs["files"][] = $aFiles; + $this->aFields['tree'] = $aTreeviewLogs; } - $this->aFields['tree'] = $aTreeviewLogs; - } else - writeToErrorLog('scandir(' . $sWorkspaceDir . '): failed to open dir'); + else { + writeToErrorLog('scandir(' . $sWorkspaceDir . '): failed to open dir'); + $aReturn['status'] = 0; + $aReturn['error_code'] = 13; + $aReturn['message'] = 'ERROR_FILE_TREE_LOADING_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY'; + } + } return $aReturn; } @@ -1145,7 +1173,7 @@ class Workspaces extends GTF { // Sauve le nom et la date du fichier. $aFilteredDir['files'][] = array( 'path' => utf8_encode($sPath), - 'last_modif' => floor((time() - $aFileInfos['mtime']) / (24 * 3600)) // dernière modif. (Nb jours). + 'last_modif' => floor((time() - $aFileInfos['mtime']) / (24 * 3600)) // dernière modif. (Nb jours). ); } } @@ -1156,32 +1184,50 @@ class Workspaces extends GTF { * Get workspace file. */ function getWorkspaceFile() { - $aReturn = array('status' => 1, 'message' => ''); + // Chargement du contenu du fichier. + $oFilesManager = new Files_manager($this->aProperties); $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $this->aValues['file_name']; - // Le fichier existe ? - if (file_exists($sFilePath)) { + $sFileContent = $oFilesManager->oFileInterface->file_get_contents($sFilePath); + if ($sFileContent !== false) { + // Copie du fichier dans un répertoire temporaire. + $sFilePath = $this->aProperties['extract_dir'] . '/' . getUniqRandomId() . '/' . $this->aValues['file_name']; + $sFileDirPath = pathinfo($sFilePath, PATHINFO_DIRNAME); + if (file_exists($sFileDirPath)) + cleardir($sFileDirPath); + mkdir($sFileDirPath, 0777, true); + file_put_contents($sFilePath, $sFileContent); + // Retourne les entêtes pour forcer le téléchargement du fichier. header("Content-Type: application/octet-stream"); header("Content-Transfer-Encoding: Binary"); header("Content-disposition: attachment; filename=\"" . $this->aValues['file_name'] . "\""); header('Content-Length: ' . filesize($sFilePath)); readfile($sFilePath); + cleardir($sFileDirPath); } + else + WriteToErrorLog("The file '$sWidgetFile' does not exist."); } /** * Check if Widget file exist */ function checkWidgetFile() { + $oFilesManager = new Files_manager($this->aProperties); $aReturn = array('status' => 1); unset($this->aPath[3]); $oWorkspace = new Workspace($this->aPath, $this->aValues, $this->aProperties, $this->oConnection); $oWorkspace->GET(); $this->aFields['workspace_key'] = $oWorkspace->aFields["key"]; - $sWidgetFilePath = $this->aProperties["vas_home"] . '/ws_data/gtf/widget/' . $this->aFields['workspace_key'] . '.html'; - // Le fichier existe ? - if (!file_exists($sWidgetFilePath)) { - $aReturn = array('status' => 0, 'error_code' => 13, 'message' => 'The file ' . $this->aFields['workspace_key'] . '.html' . 'does not exist.'); - WriteToErrorLog("The file '$sWidgetFilePath' does not exist."); + $sWidgetFile = $this->aFields['workspace_key'] . '.html'; + $sFilePath = $this->aProperties['ws_data_dir'] . '/gtf/widget/' . $sWidgetFile; + if (!$oFilesManager->oFileInterface->file_exists($sFilePath)) { + $aReturn = array('status' => 0, 'error_code' => 13, 'message' => 'The file ' . $sWidgetFile . ' does not exist.'); + WriteToErrorLog("The file '$sWidgetFile' does not exist."); + } + else { + // Url du fichier du widget. + $sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sFilePath); + $this->aFields['widget_file_url'] = $sFileUrl; } return $aReturn; } @@ -1190,15 +1236,11 @@ class Workspaces extends GTF { * Delete workspace file. */ function deleteWorkspaceFile() { + $oFilesManager = new Files_manager($this->aProperties); $aReturn = array('status' => 1, 'message' => ''); $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $this->aValues['file_name']; - // Le fichier existe ? - if (file_exists(utf8_decode($sFilePath))) { - if (!unlink(utf8_decode($sFilePath))) - $aReturn = array('status' => 0, 'message' => 'DELETE_FILE_ERROR_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY', 'error_code' => null); - } else - $aReturn = array('status' => 0, 'message' => 'FILE_NOT_FOUND_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY', 'error_code' => null); - + if (!$oFilesManager->oFileInterface->unlink($sFilePath)) + $aReturn = array('status' => 0, 'message' => 'DELETE_FILE_ERROR_PUBLICATION_WORKSPACE_LOAD_PROJECT_DIRECTORY', 'error_code' => null); return $aReturn; } @@ -1207,22 +1249,30 @@ class Workspaces extends GTF { */ function regenerateMetadata() { require $this->sRessourcesFile; - $aReturn = array('status' => 1, 'message' => ''); $aFields = $this->getFields($this->aProperties['schema_gtf'], "workspace", "workspace_id"); - $sFmwFile = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $aFields['fmw_file']; - $oObject = new GtfFmwParser($sFmwFile); - // Valeurs des colonnes "last_save_date" et "last_save_build" originales. - $aParams = array(); - $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); - $aParams['workspace_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); - $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getWorkspaceLastSaveData'], $aParams); - if (!$this->oConnection->oBd->enErreur()) { - $aRow = $this->oConnection->oBd->ligneSuivante($oPDOresult); - $oObject->sSaveDate = gmdate('Y-m-d G:i:s'); - $oObject->sSaveBuild = $aRow['last_save_build']; + // Lit le contenu du fichier .fmw du projet. + $oFilesManager = new Files_manager($this->aProperties); + $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $aFields['fmw_file']; + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sFilePath); + // Remplace les métas données. + if ($sFmwFileContent !== false) { + $oFmwParser = new GtfFmwParser($aFields['fmw_file'], $this->aProperties, $sFmwFileContent); + // Valeurs des colonnes "last_save_date" et "last_save_build" originales. + $aParams = array(); + $aParams['sSchemaGtf'] = array('value' => $this->aProperties['schema_gtf'], 'type' => 'schema_name'); + $aParams['workspace_id'] = array('value' => $this->aValues['my_vitis_id'], 'type' => 'number'); + $oPDOresult = $this->oConnection->oBd->executeWithParams($aSql['getWorkspaceLastSaveData'], $aParams); + if (!$this->oConnection->oBd->enErreur()) { + $aRow = $this->oConnection->oBd->ligneSuivante($oPDOresult); + $oFmwParser->sSaveDate = gmdate('Y-m-d G:i:s'); + $oFmwParser->sSaveBuild = $aRow['last_save_build']; + $aReturn = array('status' => 1, 'message' => ''); + } + // Mise à jour du projet en base. + $oFmwParser->updateMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); } - // Mise à jour du projet en base. - $oObject->updateMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); + else + $aReturn = array('status' => 0, 'message' => 'ERROR_WORKSPACE_FILE_NOT_FOUND'); return $aReturn; } @@ -1230,15 +1280,139 @@ class Workspaces extends GTF { * Reintegrate workspace metadata. */ function reintegrateMetadata() { - $aReturn = array('status' => 1, 'message' => ''); $aFields = $this->getFields($this->aProperties['schema_gtf'], "workspace", "workspace_id"); - $sFmwFile = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $aFields['fmw_file']; - $oObject = new GtfFmwParser($sFmwFile); - $oObject->getBdMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); - $oObject->save($sFmwFile); + // Lit le contenu du fichier .fmw du projet. + $oFilesManager = new Files_manager($this->aProperties); + $sFilePath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"] . '/fme/' . $aFields['fmw_file']; + $sFmwFileContent = $oFilesManager->oFileInterface->file_get_contents($sFilePath); + // Remplace les métas données. + if ($sFmwFileContent !== false) { + $oFmwParser = new GtfFmwParser($aFields['fmw_file'], $this->aProperties, $sFmwFileContent); + $oFmwParser->getBdMetadata($this->oConnection->oBd, $this->aValues["my_vitis_id"]); + $oFmwParser->save($oFmwParser->sFmwFileName); + $oFilesManager->oFileInterface->file_put_contents($sFilePath, file_get_contents($oFmwParser->sFmwFileName)); + $aReturn = array('status' => 1, 'message' => ''); + } + else { + $aReturn = array('status' => 0, 'message' => 'ERROR_WORKSPACE_FILE_NOT_FOUND'); + } return $aReturn; } + /** + *This method scan a path to get metrics of an object (S3). + *@file vmlib/phpUtil.inc + *@param $sDirectoryPath path/prefix to scan. + *@return $aArray file structure from S3. + */ + function getS3FolderInfos ($sDirectoryPath){ + global $properties; + require_once ("aws_sdk/aws-autoloader.php"); + + // traitement du bucket et de ses sous-dossiers + $sBucket = $properties['fileS3UploaderBucket']; + $sPrefix = ""; + if (strpos($sBucket, "/") > -1){ + $aBucket = explode("/", $sBucket ); + $sBucket = $aBucket[0]; + $sPrefix = implode("/", array_slice($aBucket, 1)); + } + // Création du client S3 + $s3 = new Aws\S3\S3Client(array( + 'version'=>'latest', + 'region'=> $properties['fileS3UploaderRegion'], + 'profile'=> $properties['fileS3UploaderProfil'], + 'debug' => false + )); + $sListPrefix = str_replace($properties['ws_data_dir'], $sPrefix . "/ws_data" , $sDirectoryPath); + try { + // Liste des objets. + $aList = $s3->listObjectsV2(array( + 'Bucket' => $sBucket, + 'Prefix' => $sListPrefix + )); + $date = new DateTime(); + $sDataUrl = $properties['web_server_name'] . "/rest/vitis/file_downloader?key=[KEY]&eTag=[ETAG]&d=" . $date->getTimestamp(); + $aPath = explode("/", $sDirectoryPath); + $aReturn = array(); + $aTree = array( + "filename"=> end($aPath), + "text"=> end($aPath), + 'selectable' => false, + "nodes" => array() + ); + if ($aList["KeyCount"] > 0){ + $aFiles = array(); + foreach ($aList["Contents"] as $aObject) { + $aFiles[] = array('path' => $aObject['Key']); + $sObjectPath = str_replace($sListPrefix, "", $aObject["Key"]); + $aObjectPath = explode("/", $sObjectPath); + // Libellé du fichier avec la taille. + $iFileSizeLabel = $aObject["Size"]; + $aFileSizeUnity = array('o', 'Ko', 'Mo', 'Go', 'To'); + $i = 0; + while ($iFileSizeLabel > 1024) { + $iFileSizeLabel /= 1024; + $i++; + } + $sDate = $aObject["LastModified"]->__toString(); + $aTree = $this->s3TreeBuilder($aTree, $sObjectPath, array( + "filename"=> end($aObjectPath), + "text"=> end($aObjectPath) . ' (' . round($iFileSizeLabel) . ' ' . $aFileSizeUnity[$i] . ')', + "size" => $aObject["Size"], + 'icon' => 'glyphicon glyphicon-file', + 'tags' => array(date ("d/m/Y H:i:s", strtotime($sDate))), + "path" => $aObject["Key"] + )); + } + $aReturn['files'] = $aFiles; + $aReturn['data'] = array($aTree); + } + else + $aReturn = false; + return $aReturn; + + }catch(Aws\S3\Exception\S3Exception $e){ + writeToErrorLog($e->getMessage()); + return false; + } + } + + /** + *This method scan an object key to generate a tree struct (S3). + *@file vmlib/phpUtil.inc + *@param $aTree an existing tree. + *@param $sPath Path to scan. + *@param $FileStructure object metrics structure. + *@return $aArray file structure from S3. + */ + function s3TreeBuilder ($aTree, $sPath, $FileStructure) { + $aTreeTmp = &$aTree["nodes"]; + $aPath = explode("/", $sPath); + foreach ($aPath as $sFragment){ + if(!empty($sFragment)){ + if($sFragment !== $FileStructure["filename"]){ + $key = array_search($sFragment, array_column($aTreeTmp, 'filename')); + if ($key !== false) + $aTreeTmp = &$aTreeTmp[$key]["nodes"]; + else { + $aFolder = array( + "filename"=> $sFragment, + "text"=> $sFragment, + 'selectable' => false, + "nodes" => array() + ); + array_push($aTreeTmp, $aFolder); + $key = array_search($sFragment, array_column($aTreeTmp, 'filename')); + $aTreeTmp = &$aTreeTmp[$key]["nodes"]; + } + } + else + array_push($aTreeTmp, $FileStructure); + } + } + return $aTree; + } } -?> \ No newline at end of file +?>