Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update download role for HTT #1045

Merged
merged 3 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion apps/labeling/downloadTable.html
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -382,7 +390,7 @@
keys.forEach((key, i) => {
rs.push(slide[key]);
});
const btn = `<button class="btn" data-id='${rs[0]}' onclick='downloadSlide(this)'>Download</button>`;
const btn = `<button class="btn" data-id='${rs[0]}' onclick='downloadSlide(this)'>Download</button> Select ROIs</button> &nbsp; <button style="background-color:#008000" class="btn" data-id='${rs[0]}' onclick='openGenericReview(this)'>Preview</button>`;
rs.push(btn);
return rs;
})
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions apps/managment/editUser.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ <h1>Editing User</h1>
<input class="form-check-input" type="radio" name="user_type" id="expert-select" value="expert">
<label class="form-check-label" for="expert-select">Expert</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="user_type" id="download-select" value="download">
<label class="form-check-label" for="download-select">Download</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="user_type" id="admin-select" value="admin">
<label class="form-check-label" for="admin-select">Admin</label>
Expand Down
4 changes: 4 additions & 0 deletions apps/managment/editUser.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ async function populateUserEdit(){
}
else if (user.userType == "Expert"){
document.getElementById('expert-select').checked=true;
} else if (user.userType == "Download"){
document.getElementById('download-select').checked=true;
} else {
document.getElementById('public-select').checked=true;
}
Expand Down Expand Up @@ -80,6 +82,8 @@ async function updateUser(e){
user.userType = "Admin"
} else if (document.getElementById('participant-select').checked){
user.userType = "Participant"
} else if (document.getElementById('download-select').checked){
user.userType = "Download"
} else {
user.userType = "Public"
}
Expand Down
Loading