From 371525595673eabc91aec922545f6d9d9e35b656 Mon Sep 17 00:00:00 2001 From: Birm Date: Tue, 19 Nov 2024 21:49:14 -0500 Subject: [PATCH] add download button for entire collection --- apps/labeling/downloadTable.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/labeling/downloadTable.html b/apps/labeling/downloadTable.html index 45d34ead0..dbded30b5 100644 --- a/apps/labeling/downloadTable.html +++ b/apps/labeling/downloadTable.html @@ -364,6 +364,14 @@ document.getElementById("collectionName").innerText = collectionInfo[0].name document.getElementById("collectionDesc").innerText = collectionInfo[0].description } + if (collectionInfo[0].zip){ + let zipButton = document.createElement("button") + zipButton.innerText = "Download Whole Collection"; + zipButton.classList.add(["btn"]); + zipButton.dataset.zipurl = collectionInfo[0].zip; + zipButton.onclick = downloadCollection; + document.getElementById("collectionInfo").appendChild(zipButton) + } // set slides const slides = await store.findSlideLabelingStat(cid, getUserId()); if (slides && Array.isArray(slides)) { @@ -450,6 +458,19 @@ } } + async function downloadCollection(evt) { + console.log(evt) + let e = evt.target + let store = new Store("../../data/"); + const zipUrl = e.dataset.zipurl; + const a = document.createElement('a'); + a.href = zipUrl; + a.download = ''; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + } + function openGenericReview(e){ const oid = e.dataset.id; if (oid) {