diff --git a/scribeengine/controllers/media.py b/scribeengine/controllers/media.py index f3d0436..43b7cff 100644 --- a/scribeengine/controllers/media.py +++ b/scribeengine/controllers/media.py @@ -72,7 +72,7 @@ class MediaController(BaseController): self._get_directories(path, directories) c.directories = json.dumps(directories) c.files = self._get_files(path) - #return pformat(c.directories, indent=2) + c.page_title = u'Media Browser' return render(u'/media/index.mako') @jsonify @@ -80,7 +80,7 @@ class MediaController(BaseController): path = request.GET.get(u'path', u'').split(u',') dirpath = os.path.join(config[u'paths.media'], *path) #log.debug(dirpath) - return self._get_files(dirpath) + return {u'results': self._get_files(dirpath)} @jsonify def create_directory(self): diff --git a/scribeengine/public/images/file-image.png b/scribeengine/public/images/file-image.png new file mode 100644 index 0000000..a56f9af Binary files /dev/null and b/scribeengine/public/images/file-image.png differ diff --git a/scribeengine/public/images/file-unknown.png b/scribeengine/public/images/file-unknown.png new file mode 100644 index 0000000..dc28b5a Binary files /dev/null and b/scribeengine/public/images/file-unknown.png differ diff --git a/scribeengine/public/scripts/ScribeEngine.Media.js b/scribeengine/public/scripts/ScribeEngine.Media.js index 323e718..2ee0875 100644 --- a/scribeengine/public/scripts/ScribeEngine.Media.js +++ b/scribeengine/public/scripts/ScribeEngine.Media.js @@ -18,6 +18,10 @@ *****************************************************************************/ ScribeEngine.Namespace.create("ScribeEngine.Media", { + closeWindow: function () + { + window.close(); + }, newDirectory: function () { var dirname = prompt("New Directory:", "directory"); @@ -31,24 +35,44 @@ ScribeEngine.Namespace.create("ScribeEngine.Media", { {"path": path.toString()}, function (data, textStatus) { $("#file-list > ul").html(""); - $.each(data, function () { + $.each(data.results, function () { var filename = this; + var extension = filename.substr(filename.length - 4); + if (extension == ".png" || extension == ".jpg") + { + var filetype = "file-image"; + } + else + { + var filetype = "file-unknown"; + } if (filename.length > 15) { filename = filename.substr(0, 12) + "..."; } $("#file-list > ul").append( $("