Commit 6e410949 authored by murban's avatar murban
Browse files

Raise warning when trying to access a folder without permission. Fix a small...

Raise warning when trying to access a folder without permission. Fix a small bug in the remote filesystem: Line indentation of the parentfolder has been wrong
parent 0ab07dc2
...@@ -89,19 +89,6 @@ class FSAjaxController(AbstractController): ...@@ -89,19 +89,6 @@ class FSAjaxController(AbstractController):
vispa.log_exception() vispa.log_exception()
return self.fail(msg='Couldn\'t load files: %s' % str(e), encode_json=True) return self.fail(msg='Couldn\'t load files: %s' % str(e), encode_json=True)
@cherrypy.expose
@cherrypy.tools.allow(methods=['POST', 'GET'])
@cherrypy.tools.json_out()
def folderup(self, path):
try:
path = os.path.expanduser(os.path.expandvars(path))
path = path[:-1] if path.endswith(os.sep) and path!=os.sep else path
path = os.path.dirname(path)
path = self.convert(path, 'string')
return self.success({'folderuppath': path})
except Exception, e:
return self.fail(msg='Couldn\'t load files: %s' % str(e))
@cherrypy.expose @cherrypy.expose
@cherrypy.tools.allow(methods=['POST', 'GET']) @cherrypy.tools.allow(methods=['POST', 'GET'])
@cherrypy.tools.json_out() @cherrypy.tools.json_out()
......
...@@ -72,6 +72,7 @@ class FileSystem(object): ...@@ -72,6 +72,7 @@ class FileSystem(object):
def get_file_list(self, path, deep=False, filter=[], reverse=False, hide_hidden=True, encode_json=False): def get_file_list(self, path, deep=False, filter=[], reverse=False, hide_hidden=True, encode_json=False):
filelist = [] filelist = []
path_expand = os.path.expanduser(os.path.expandvars(path)) path_expand = os.path.expanduser(os.path.expandvars(path))
try:
for elem in os.listdir(path_expand): for elem in os.listdir(path_expand):
# hide hidden files? # hide hidden files?
if elem.startswith('.') and hide_hidden: if elem.startswith('.') and hide_hidden:
...@@ -100,6 +101,8 @@ class FileSystem(object): ...@@ -100,6 +101,8 @@ class FileSystem(object):
else: else:
extension = elem.split('.')[-1] extension = elem.split('.')[-1]
filelist.append({'name': elem, 'type': 'f', 'parent': path, 'extension': extension, 'mtime': mtime, 'size': size, 'path': fullpath}) filelist.append({'name': elem, 'type': 'f', 'parent': path, 'extension': extension, 'mtime': mtime, 'size': size, 'path': fullpath})
except Exception, e:
filelist.append({'warning': str(e)})
# Determine the parent # Determine the parent
parentpath = path_expand[:-1] if path_expand.endswith(os.sep) and path_expand!=os.sep else path_expand parentpath = path_expand[:-1] if path_expand.endswith(os.sep) and path_expand!=os.sep else path_expand
......
...@@ -48,7 +48,11 @@ var Symbolview = Class.extend({ ...@@ -48,7 +48,11 @@ var Symbolview = Class.extend({
_this.owner.view.mainContainer.append(folderup); _this.owner.view.mainContainer.append(folderup);
$.each(data.filelist, function(i, file) { $.each(data.filelist, function(i, file) {
if (file.warning) {
alert(file.warning)
} else {
var contentdiv = _this.makeIcon(file); var contentdiv = _this.makeIcon(file);
};
// owner.view.mainContainer.isotope('insert', contentdiv); // owner.view.mainContainer.isotope('insert', contentdiv);
_this.owner.view.mainContainer.append(contentdiv); _this.owner.view.mainContainer.append(contentdiv);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment