From 37365f077a5646d3455c0b81286ecd29a7381b73 Mon Sep 17 00:00:00 2001 From: wronny Date: Fri, 20 Oct 2023 08:28:51 +0200 Subject: [PATCH 1/2] added "Download Track" button to AppNavigationTrackItem Signed-off-by: wronny --- lib/Controller/PublicTracksController.php | 5 ++++- src/components/AppNavigationTrackItem.vue | 26 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/lib/Controller/PublicTracksController.php b/lib/Controller/PublicTracksController.php index 1cc925641..c10707a80 100644 --- a/lib/Controller/PublicTracksController.php +++ b/lib/Controller/PublicTracksController.php @@ -45,6 +45,7 @@ use OCA\Maps\Service\TracksService; use OCP\Share\IManager as ShareManager; + /** * @param string $text * @return string @@ -151,6 +152,7 @@ private function getShareNode() { */ public function getTracks(): DataResponse { $share = $this->getShare(); + $hideDownload = (bool) $share->getHideDownload(); $permissions = $share->getPermissions(); $folder = $this->getShareNode(); $isReadable = (bool) ($permissions & (1 << 0)); @@ -158,12 +160,13 @@ public function getTracks(): DataResponse { $owner = $share->getShareOwner(); $pre_path = $this->root->getUserFolder($owner)->getPath(); $tracks = $this->tracksService->getTracksFromDB($owner, $folder, true, false, false); - $new_tracks = array_map(function ($track) use ($folder, $permissions, $pre_path) { + $new_tracks = array_map(function ($track) use ($folder, $permissions, $pre_path, $hideDownload) { $track['isCreatable'] = ($permissions & (1 << 2)) && $track['isCreatable']; $track['isUpdateable'] = ($permissions & (1 << 1)) && $track['isUpdateable']; $track['isDeletable'] = ($permissions & (1 << 3)) && $track['isDeletable']; $track['path'] = $folder->getRelativePath($pre_path.$track['path']); $track['filename'] = $track['path']; + $track['hideDownload'] = $hideDownload; return $track; }, $tracks); } else { diff --git a/src/components/AppNavigationTrackItem.vue b/src/components/AppNavigationTrackItem.vue index 20f46dfa0..ec79828f3 100644 --- a/src/components/AppNavigationTrackItem.vue +++ b/src/components/AppNavigationTrackItem.vue @@ -60,6 +60,21 @@ @click="$emit('add-to-map-track', track)"> {{ t('maps', 'Copy to map') }} + + {{ t('maps', 'Download track') }} + + + {{ t('maps', 'Download track') }} + + @@ -67,7 +82,9 @@