diff --git a/CHANGELOG.md b/CHANGELOG.md index 65db498..01555bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - save/restore current tile layer - integration in "Files" and "File sharing" context menu for .gpx files [#11](https://gitlab.com/eneiluj/gpxedit-oc/issues/11) @rugk +- add directory context menu option in files app : load in GpxEdit - notifications on tile layer add/remove - makefile signs the app code @@ -30,6 +31,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - app is now compliant to occ check-code - jshint and jslint in da place - do not put @NoCSRFRequired everywhere in controllers +- replace decodeURI by decodeURIComponent + [#12](https://gitlab.com/eneiluj/gpxedit-oc/issues/12) @gezgez +- remove escapeshellcmd to avoid errors with special char in file name ## 0.0.4 – 2017-01-17 ### Added diff --git a/js/filetypes.js b/js/filetypes.js index f9fc8b8..9dc61ab 100644 --- a/js/filetypes.js +++ b/js/filetypes.js @@ -2,6 +2,30 @@ $(document).ready(function() { if (OCA.Files && OCA.Files.fileActions && !$('#sharingToken').val()) { + var token = $('#sharingToken').val(); + + // file action for directories + if (!token) { + OCA.Files.fileActions.registerAction({ + name: 'viewDirectoryGpxEdit', + displayName: t('gpxedit','Load in GpxEdit'), + mime: 'httpd/unix-directory', + permissions: OC.PERMISSION_READ, + icon: function () {return OC.imagePath('gpxedit', 'app_black');}, + actionHandler: function(file, data){ + var dir; + if (data.dir === '/'){ + dir = data.dir+file; + } + else{ + dir = data.dir+'/'+file; + } + var url = OC.generateUrl('apps/gpxedit/?dir={dir}',{'dir': dir}); + window.open(url, '_blank'); + } + }); + } + function openFile(file, data){ var url = OC.generateUrl('apps/gpxedit/?file={filepath}',{'filepath': data.dir+'/'+file}); window.open(url, '_blank'); diff --git a/js/gpxedit.js b/js/gpxedit.js index 0fa355d..e00c059 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -1570,6 +1570,11 @@ if (fileparam && fileparam !== undefined) { loadAction(fileparam); } + // load a directory if 'dir' GET url parameter was given + var dirparam = getUrlParameter('dir'); + if (dirparam && dirparam !== undefined) { + loadFolderAction(dirparam); + } });