Skip to content
Snippets Groups Projects
Commit a0d802c3 authored by Frédéric Carretero's avatar Frédéric Carretero
Browse files

Classe Files_manager dans les web services (GTF)

parent 9c7997d1
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -169,6 +170,7 @@ class Workspace extends GTF {
* get informations about workspace
*/
function GET() {
$oFilesManager = new Files_manager($this->aProperties);
if (!empty($this->aValues["form"])) {
require $this->sRessourcesFile;
$this->aFields = $this->getFields($this->aProperties['schema_gtf'], "v_workspace", "workspace_id");
......@@ -186,19 +188,18 @@ class Workspace extends GTF {
$this->oError = new VitisError(1, "Error parameter is not a known mode");
}
// Contenu du fichier de formulaire.
$sFileContent = getFileContentInWsDataDir("gtf", "workspace", $this->aValues["my_vitis_id"], 'form', $sFile);
$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 = "";
// Url du fichier js du formulaire.
$sFileUrl = getFileUrlInWsDataDir('gtf', 'workspace', $this->aValues['my_vitis_id'], 'form/ressources', 'Subform.js');
if ($sFileUrl !== false)
$sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sDirPath . '/form/ressources/Subform.js');
$sJs = $sFileUrl;
// Url du fichier css du formulaire.
$sFileUrl = getFileUrlInWsDataDir('gtf', 'workspace', $this->aValues['my_vitis_id'], 'form/ressources', 'Subform.css');
if ($sFileUrl !== false)
$sFileUrl = $oFilesManager->oFileInterface->getProxyPassUrl($sDirPath . '/form/ressources/Subform.css');
$sCss = $sFileUrl;
//
array_push($this->aFields["json_form"], $sJs);
......@@ -212,13 +213,15 @@ class Workspace extends GTF {
$this->getGroups();
// Url vers le fichier fmw du projet.
if (!empty($this->aFields['fmw_file'])) {
$sFmwFileUrl = getFileUrlInWsDataDir('gtf', 'workspace', $this->aValues['my_vitis_id'], 'fme', $this->aFields['fmw_file']);
if ($sFmwFileUrl !== false)
$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".
if (!fileExistsInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], 'form', 'Subform.json'))
$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")
......@@ -258,7 +261,9 @@ class Workspace extends GTF {
$this->oError = new VitisError(1, $this->oConnection->oBd->getBDMessage());
} else {
// Suppression du répertoire du projet FME.
deleteDirectoryInWsDataDir('gtf', 'workspace', $this->aValues["my_vitis_id"], '', '');
$oFilesManager = new Files_manager($this->aProperties);
$sDirPath = $this->aProperties['workspace_dir'] . '/' . $this->aValues["my_vitis_id"];
$oFilesManager->oFileInterface->clearDir($sDirPath);
}
}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment