Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
vMap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marty Fabien
vMap
Commits
a0d802c3
Commit
a0d802c3
authored
Dec 7, 2018
by
Frédéric Carretero
Browse files
Options
Downloads
Patches
Plain Diff
Classe Files_manager dans les web services (GTF)
parent
9c7997d1
No related branches found
No related tags found
No related merge requests found
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/module_gtf/web_service/ws/Workspace.class.inc
+19
-14
19 additions, 14 deletions
src/module_gtf/web_service/ws/Workspace.class.inc
src/module_gtf/web_service/ws/Workspaces.class.inc
+96
-73
96 additions, 73 deletions
src/module_gtf/web_service/ws/Workspaces.class.inc
with
115 additions
and
87 deletions
src/module_gtf/web_service/ws/Workspace.class.inc
+
19
−
14
View file @
a0d802c3
...
...
@@ -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.
Click to expand it.
src/module_gtf/web_service/ws/Workspaces.class.inc
+
96
−
73
View file @
a0d802c3
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment