Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
3pia
VISPA
VISPA web
Commits
19fdd9cd
Commit
19fdd9cd
authored
Dec 20, 2013
by
Marcel Rieger
Browse files
File: Fix collisions for multiple instances.
parent
e102f9b3
Changes
6
Hide whitespace changes
Inline
Side-by-side
vispa/controller/filesystem.py
View file @
19fdd9cd
...
...
@@ -6,6 +6,7 @@ import cherrypy
import
os
import
json
from
vispa.controller
import
AbstractController
from
vispa
import
MessageException
import
base64
...
...
@@ -56,25 +57,23 @@ class FSAjaxController(AbstractController):
return
self
.
fail
(
encode_json
=
True
)
@
cherrypy
.
expose
@
cherrypy
.
tools
.
allow
(
methods
=
[
'POST'
,
'GET'
])
def
filelist
(
self
,
path
,
deep
=
False
,
filter
=
[],
reverse
=
False
):
try
:
fs
=
self
.
get
(
'fs'
)
path
=
fs
.
expand
(
path
)
@
cherrypy
.
tools
.
ajax
(
encoded
=
True
)
def
filelist
(
self
,
path
,
deep
=
False
,
filter
=
None
,
reverse
=
False
):
filter
=
filter
or
[]
cherrypy
.
session
.
save
(
)
cherrypy
.
session
.
loaded
=
False
fs
=
self
.
get
(
'fs'
)
path
=
fs
.
expand
(
path
)
deep
=
self
.
convert
(
deep
,
bool
)
reverse
=
self
.
convert
(
reverse
,
bool
)
cherrypy
.
session
.
save
(
)
cherrypy
.
session
.
loaded
=
False
# get the files with the filter
files
=
fs
.
get_file_list
(
path
,
deep
=
deep
,
filter
=
filter
,
reverse
=
reverse
,
encode_json
=
True
)
deep
=
self
.
convert
(
deep
,
bool
)
reverse
=
self
.
convert
(
reverse
,
bool
)
return
self
.
success
(
files
,
encode_json
=
True
)
except
Exception
,
e
:
vispa
.
log_exception
()
return
self
.
fail
(
msg
=
'Couldn
\'
t load files: %s'
%
str
(
e
),
encode_json
=
True
)
# get the files with the filter
files
=
fs
.
get_file_list
(
path
,
deep
=
deep
,
filter
=
filter
,
reverse
=
reverse
,
encode_json
=
True
)
return
files
@
cherrypy
.
expose
@
cherrypy
.
tools
.
allow
(
methods
=
[
'POST'
,
'GET'
])
...
...
vispa/extensions/file/static/js/base/base.js
View file @
19fdd9cd
...
...
@@ -51,21 +51,12 @@ var FileBase = Class.extend({
promise
.
done
(
function
(
content
)
{
self
.
workflow
.
currentView
.
setContent
(
content
);
self
.
workflow
.
data
=
content
;
self
.
instance
.
setLoading
(
false
);
});
this
.
instance
.
setLoading
(
false
);
},
fixPath
:
function
(
path
)
{
sep
=
'
/
'
;
pathlen
=
path
.
length
path
=
path
.
substr
(
0
,
1
)
!=
sep
?
sep
+
path
:
path
;
path
=
path
.
substr
(
pathlen
-
1
,
pathlen
)
!=
sep
?
path
+
sep
:
path
;
return
path
;
},
abspath
:
function
(
name
)
{
return
this
.
fixPath
(
this
.
workflow
.
path
)
+
name
;
return
(
this
.
workflow
.
path
+
"
/
"
+
name
).
replace
(
/
\/{2,}
/g
,
"
/
"
)
;
},
upload
:
function
()
{
...
...
vispa/extensions/file/static/js/base/view.js
View file @
19fdd9cd
...
...
@@ -29,8 +29,6 @@ var FileBaseView = Class.extend({
};
},
setMainContainer
:
function
()
{
var
self
=
this
;
...
...
@@ -39,9 +37,9 @@ var FileBaseView = Class.extend({
// Get the template. When it is loaded append it to the maindiv
// Then the view can be loaded
var
dfd
=
this
.
instance
.
getTemplate
(
"
html/main.html
"
,
function
(
err
,
tmpl
,
dfd
)
{
$
(
tmpl
).
appendTo
(
maindiv
);
var
tmplNode
=
$
(
tmpl
).
appendTo
(
maindiv
);
// Save the content container
self
.
fileContentContainer
=
$
(
"
.file-content
"
);
self
.
fileContentContainer
=
$
(
"
.file-content
"
,
tmplNode
);
// Get the menu via AJAX rejquest and append it to the container
var
dfdMenu
=
self
.
instance
.
getTemplate
(
"
html/menu.html
"
,
function
(
err2
,
tmpl2
,
dfd2
)
{
maindiv
.
append
(
tmpl2
)
...
...
vispa/extensions/file/static/js/base/views/table/view.js
View file @
19fdd9cd
...
...
@@ -28,14 +28,8 @@ var Tableview = Class.extend({
this
.
FileBase
.
workflow
.
parentpath
=
data
.
parentpath
;
// render the content
$
(
"
.files-table
"
,
this
.
fileContentContainer
).
render
(
data
.
filelist
);
$
(
"
.files-table
"
,
this
.
fileContentContainer
).
render
(
data
.
filelist
,
this
.
FileBase
.
view
.
directives
);
// // Get the objects and append the data to them
$
(
"
.files-table
"
,
this
.
fileContentContainer
).
children
().
each
(
function
(
i
,
child
)
{
self
.
FileBase
.
view
.
setupDataActions
(
$
(
child
),
data
.
filelist
[
i
]);
self
.
FileBase
.
view
.
setupSymbols
(
$
(
child
),
data
.
filelist
[
i
],
-
1
,
"
30%
"
);
});
$
(
"
.tablesorter
"
).
tablesorter
({
// sort list by default
...
...
vispa/extensions/file/static/js/extension.js
View file @
19fdd9cd
...
...
@@ -92,13 +92,6 @@ var FileBrowserView = vispa.ExtensionView.Center.extend({
// hide the loader overlay
self
.
setLoading
(
false
);
// in case there was a change to the content, we can mark the instance as
// modified via this.setModified(true|false)
self
.
setModified
(
true
);
// revert for testing reasons after 3 seconds
// setTimeout(self.setModified.bind(self, false), 3000);
},
// called when the instance is resized
...
...
vispa/remote/filesystem.py
View file @
19fdd9cd
...
...
@@ -73,7 +73,8 @@ class FileSystem(object):
return
None
return
target_type
if
target_type
==
type
else
None
def
get_file_list
(
self
,
path
,
deep
=
False
,
filter
=
[],
reverse
=
False
,
hide_hidden
=
True
,
encode_json
=
True
):
def
get_file_list
(
self
,
path
,
deep
=
False
,
filter
=
None
,
reverse
=
False
,
hide_hidden
=
True
,
encode_json
=
True
):
filter
=
filter
or
[]
filelist
=
[]
path_expand
=
self
.
expand
(
path
)
try
:
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment