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

images in subdirs #655

Merged
merged 1 commit into from
Sep 11, 2023
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion apps/batchloader/batchLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@ $(document).ready(function() {
store.findSlide().then((response) => {
for (i=0; i<response.length; i++) {
existingSlides.push(response[i].name);
existingFiles.push((response[i].location).substring((response[i].location).lastIndexOf('/')+1,
if (response[i].filepath) {
existingFiles.push(response[i].filepath);
} else {
existingFiles.push((response[i].location).substring((response[i].location).lastIndexOf('/')+1,
(response[i].location).length));
}
}
}).catch((error) => {
console.log(error);
Expand Down Expand Up @@ -403,6 +407,9 @@ function finishUpload(token, filename, i) {
fileNames[i] = newName;
$('tr:eq('+(i+1)+') td:nth-child(2) span')[0].innerText = newName;
}
if (a.relpath) {
fileNames[i] = a.relpath;
}
if (typeof a === 'object' && a.error) {
finishUploadSuccess = false;
// $('#check_btn').hide();
Expand Down
6 changes: 5 additions & 1 deletion apps/loader/chunked_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ function finishUpload() {
regReq.then((x)=>x.json()).then((a)=>{
changeStatus('UPLOAD | Finished', a, reset); reset = false;
console.log(a);
if (a.filepath) {
if (a.relpath) {
document.getElementById('filename'+0).value = a.relpath;
} else if (a.filename) {
document.getElementById('filename'+0).value = a.filename;
} else if (a.filepath) {
document.getElementById('filename'+0).value = a.filepath.slice(a.filepath.lastIndexOf('/')+1);
}
if (typeof a === 'object' && a.error) {
Expand Down
9 changes: 6 additions & 3 deletions apps/loader/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,15 @@ function handleDownload(id) {
store.getSlide(id)
.then((response) => {
if (response[0]) {
return response[0]['location'];
if (response[0]['filepath']) {
return response[0]['filepath'];
}
let location = response[0]['location'];
return location.substring(location.lastIndexOf('/')+1, location.length);
} else {
throw new Error('Slide not found');
}
}).then((location) => {
fileName = location.substring(location.lastIndexOf('/')+1, location.length);
}).then((fileName) => {
console.log(fileName);
return fileName;
}).then((fileName) =>{
Expand Down
14 changes: 8 additions & 6 deletions apps/model/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,15 +408,17 @@ function initCore() {

$CAMIC.store.getSlide($D.params.slideId).then((response) => {
if (response[0]) {
return response[0]['location'];
if (response[0]["filepath"]) {
return response[0]["filepath"];
}
return location.substring(
location.lastIndexOf('/') + 1,
location.length,
);
} else {
throw new Error('Slide not found');
}
}).then((location) => {
fileName = location.substring(
location.lastIndexOf('/') + 1,
location.length,
);
}).then((fileName) => {
console.log(fileName);
});

Expand Down
16 changes: 8 additions & 8 deletions apps/viewer/uicallbacks.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,18 +586,18 @@ function imageDownload() {
.getSlide(id)
.then((response) => {
if (response[0]) {
return response[0]['location'];
if (response[0]['filepath']) {
return response[0]['filepath']
}
let location = response[0]['location'];
return location.substring(
location.lastIndexOf('/') + 1,
location.length,
);
} else {
throw new Error('Slide not found');
}
})
.then((location) => {
fileName = location.substring(
location.lastIndexOf('/') + 1,
location.length,
);
return fileName;
})
.then((fileName) => {
fetch(downloadURL + fileName, {
credentials: 'same-origin',
Expand Down