refs #56 add file actions to import gpx/kml/kmz files as devices
This commit is contained in:
Родитель
77f3287630
Коммит
6b0fd44feb
|
@ -34,6 +34,28 @@ $(document).ready(function() {
|
|||
});
|
||||
}
|
||||
|
||||
function importDevicesFile(file, data) {
|
||||
$('#content').css('cursor', 'wait');
|
||||
var dir = (data.dir === '/') ? '' : data.dir;
|
||||
var path = dir + '/' + file;
|
||||
var req = {
|
||||
path: path
|
||||
};
|
||||
var url = OC.generateUrl('/apps/maps/import/devices');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: url,
|
||||
data: req,
|
||||
async: true
|
||||
}).done(function (response) {
|
||||
OC.Notification.showTemporary(t('maps', '{nb} devices imported from {path}', {nb: response, path: path}));
|
||||
}).always(function (response) {
|
||||
$('#content').css('cursor', 'default');
|
||||
}).fail(function(response) {
|
||||
OC.Notification.showTemporary(t('maps', 'Failed to import devices') + ': ' + response.responseText);
|
||||
});
|
||||
}
|
||||
|
||||
// default action is set only for logged in users
|
||||
if (!$('#sharingToken').val()){
|
||||
|
||||
|
@ -58,7 +80,7 @@ $(document).ready(function() {
|
|||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importFavoritesFile
|
||||
});
|
||||
// TODO import kmz files as favorites
|
||||
// import kmz files as favorites
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'importKmzFavoritesMaps',
|
||||
displayName: t('maps', 'Import as favorites in Maps'),
|
||||
|
@ -67,7 +89,7 @@ $(document).ready(function() {
|
|||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importFavoritesFile
|
||||
});
|
||||
// TODO import kml files as favorites
|
||||
// import kml files as favorites
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'importKmlFavoritesMaps',
|
||||
displayName: t('maps', 'Import as favorites in Maps'),
|
||||
|
@ -76,6 +98,34 @@ $(document).ready(function() {
|
|||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importFavoritesFile
|
||||
});
|
||||
|
||||
// import gpx files as devices
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'importGpxDevicesMaps',
|
||||
displayName: t('maps', 'Import as devices in Maps'),
|
||||
mime: 'application/gpx+xml',
|
||||
permissions: OC.PERMISSION_READ,
|
||||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importDevicesFile
|
||||
});
|
||||
// import kmz files as devices
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'importKmzDevicesMaps',
|
||||
displayName: t('maps', 'Import as devices in Maps'),
|
||||
mime: 'application/vnd.google-earth.kmz',
|
||||
permissions: OC.PERMISSION_READ,
|
||||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importDevicesFile
|
||||
});
|
||||
// import kml files as devicess
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'importKmlDevicesMaps',
|
||||
displayName: t('maps', 'Import as devices in Maps'),
|
||||
mime: 'application/vnd.google-earth.kml+xml',
|
||||
permissions: OC.PERMISSION_READ,
|
||||
iconClass: 'icon-maps-black',
|
||||
actionHandler: importDevicesFile
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче