2017-03-15 06:29:51 +00:00
|
|
|
$(document).ready(function() {
|
|
|
|
|
2017-03-15 06:47:12 +00:00
|
|
|
if (OCA.Files && OCA.Files.fileActions && !$('#sharingToken').val()) {
|
2017-03-15 06:29:51 +00:00
|
|
|
|
2018-09-17 10:26:40 +00:00
|
|
|
var token = $('#sharingToken').val();
|
2017-04-04 23:59:28 +00:00
|
|
|
|
|
|
|
// 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,
|
2018-09-17 10:26:40 +00:00
|
|
|
iconClass: 'icon-gpxedit-black',
|
2017-04-04 23:59:28 +00:00
|
|
|
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');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2017-03-15 06:29:51 +00:00
|
|
|
function openFile(file, data){
|
|
|
|
var url = OC.generateUrl('apps/gpxedit/?file={filepath}',{'filepath': data.dir+'/'+file});
|
|
|
|
window.open(url, '_blank');
|
|
|
|
}
|
|
|
|
|
|
|
|
OCA.Files.fileActions.registerAction({
|
|
|
|
name: 'editFileGpxEdit',
|
2017-06-05 23:21:36 +00:00
|
|
|
displayName: t('gpxedit', 'Edit with GpxEdit'),
|
2017-03-15 06:29:51 +00:00
|
|
|
mime: 'application/gpx+xml',
|
|
|
|
permissions: OC.PERMISSION_READ,
|
2018-09-17 10:26:40 +00:00
|
|
|
iconClass: 'icon-gpxedit-black',
|
2017-03-15 06:29:51 +00:00
|
|
|
actionHandler: openFile
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|