Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-09-07 15:51:36 +02:00
commit 5bb70b82aa
4 changed files with 165 additions and 59 deletions

View File

@ -276,7 +276,7 @@
- groups from ldap can be synced with seeddms groups - groups from ldap can be synced with seeddms groups
- fix error when sending notification to group of reviewers - fix error when sending notification to group of reviewers
- seperate some notification messages for folders and documents - seperate some notification messages for folders and documents
- fix drag&drop of attachments - fix various drag&drop operations
- do not sent notifidation mail to uploader if owner has received on already - do not sent notifidation mail to uploader if owner has received on already
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------

View File

@ -130,7 +130,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Theme_Style {
$sitename = trim(strip_tags($this->params['sitename'])); $sitename = trim(strip_tags($this->params['sitename']));
header('Content-Type: application/javascript; charset=UTF-8'); header('Content-Type: application/javascript; charset=UTF-8');
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder')); parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder', 'must_drop_one_file','confirm_upload_new_version', 'upload_new_version'));
?> ?>
$(document).ready(function() { $(document).ready(function() {
$('#searchfield').focus(); $('#searchfield').focus();

View File

@ -840,7 +840,7 @@ function onAddClipboard(ev) { /* {{{ */
} }
if(target_type == 'folder' && target_id) { if(target_type == 'folder' && target_id) {
for (var i = 0; i < items.length; i++) { for (var i = 0; i < items.length; i++) {
var item = items[i].webkitGetAsEntry(); var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) { if (item.isFile) {
item.file(function(file) { item.file(function(file) {
if(file.size <= maxFileSize) { if(file.size <= maxFileSize) {
@ -876,6 +876,11 @@ function onAddClipboard(ev) { /* {{{ */
} }
}); });
} else if(item.isDirectory) { } else if(item.isDirectory) {
var dirReader = item.createReader();
dirReader.readEntries(function(entries) {
SeedDMSUpload.handleFileUpload(entries, obj, statusbar);
});
/*
noty({ noty({
text: 'Folders currently not supported', text: 'Folders currently not supported',
type: 'error', type: 'error',
@ -884,30 +889,36 @@ function onAddClipboard(ev) { /* {{{ */
theme: 'defaultTheme', theme: 'defaultTheme',
timeout: 5000 timeout: 5000
}); });
*/
} }
} }
} else if(target_type == 'document' && target_id) { } else if(target_type == 'document' && target_id) {
/* /*
for (var i = 0; i < files.length; i++) { for (var i = 0; i < items.length; i++) {
if(files[i].size <= maxFileSize) { var item = items[i]; //.webkitGetAsEntry();
var fd = new FormData(); if (item.isFile) {
fd.append('targettype', target_type); item.file(function(file) {
fd.append('documentid', target_id); if(file.size <= maxFileSize) {
fd.append('formtoken', obj.data('uploadformtoken')); var fd = new FormData();
fd.append('userfile', files[i]); fd.append('targettype', target_type);
fd.append('command', 'uploaddocument'); fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
var status = new SeedDMSUpload.createStatusbar(statusbar); var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size); status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status); SeedDMSUpload.sendFileToServer(fd,status);
} else { } else {
noty({ noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>', text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error', type: 'error',
dismissQueue: true, dismissQueue: true,
layout: 'topRight', layout: 'topRight',
theme: 'defaultTheme', theme: 'defaultTheme',
timeout: 5000 timeout: 5000
});
}
}); });
} }
} }
@ -967,8 +978,12 @@ $(document).ready(function() { /* {{{ */
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server //We need to send dropped files to Server
newitems = [];
if(items.length > 0) { if(items.length > 0) {
SeedDMSUpload.handleFileUpload(items, $(this), $(this)); for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems, $(this), $(this));
} }
}); });
@ -997,10 +1012,16 @@ $(document).ready(function() { /* {{{ */
if(target_type == 'folder') { if(target_type == 'folder') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { /* check for files, because items has an entry if no file was dropped */
if(files.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id); // console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/); newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else { } else {
/* The data is passed in dataTransfer. The items are meaning less. */
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text")); var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type; source_type = source_info.type;
source_id = source_info.id; source_id = source_info.id;
@ -1099,9 +1120,50 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'document') { } else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { /* check for files, because items has an entry if no file was dropped */
if(files.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id); // console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/); if(files.length > 1) {
noty({
text: trans.must_drop_one_file,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
} else if(0) {
bootbox.dialog({
"message" : trans.confirm_upload_new_version,
"buttons" : {
"cancel" : {
"label" : trans.cancel,
"className" : "btn-secondary",
"callback": function() {
}
},
"newversion" : {
"label" : "<i class='fa fa-link'></i> "+trans.upload_new_version,
"className" : "btn-danger",
"callback": function() {
console.log('Hallo');
/*
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1'));
*/
}
}
}
});
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
}
} else { } else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text")); var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type; source_type = source_info.type;
@ -1185,8 +1247,12 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'attachment') { } else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { if(files.length > 0) {
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/); newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} }
} }
}); });

View File

@ -925,26 +925,31 @@ function onAddClipboard(ev) { /* {{{ */
} }
} else if(target_type == 'document' && target_id) { } else if(target_type == 'document' && target_id) {
/* /*
for (var i = 0; i < files.length; i++) { for (var i = 0; i < items.length; i++) {
if(files[i].size <= maxFileSize) { var item = items[i]; //.webkitGetAsEntry();
var fd = new FormData(); if (item.isFile) {
fd.append('targettype', target_type); item.file(function(file) {
fd.append('documentid', target_id); if(file.size <= maxFileSize) {
fd.append('formtoken', obj.data('uploadformtoken')); var fd = new FormData();
fd.append('userfile', files[i]); fd.append('targettype', target_type);
fd.append('command', 'uploaddocument'); fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
var status = new SeedDMSUpload.createStatusbar(statusbar); var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size); status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status); SeedDMSUpload.sendFileToServer(fd,status);
} else { } else {
noty({ noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>', text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error', type: 'error',
dismissQueue: true, dismissQueue: true,
layout: 'topRight', layout: 'topRight',
theme: 'defaultTheme', theme: 'defaultTheme',
timeout: 5000 timeout: 5000
});
}
}); });
} }
} }
@ -1004,15 +1009,11 @@ $(document).ready(function() { /* {{{ */
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server //We need to send dropped files to Server
console.log(items[0]);
console.log(items[0].webkitGetAsEntry());
newitems = []; newitems = [];
if(items.length > 0) { if(items.length > 0) {
for (var i=0; i<items.length; i++) { for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry()); newitems.push(items[i].webkitGetAsEntry());
} }
console.log(newitems);
SeedDMSUpload.handleFileUpload(newitems, $(this), $(this)); SeedDMSUpload.handleFileUpload(newitems, $(this), $(this));
} }
}); });
@ -1042,7 +1043,8 @@ $(document).ready(function() { /* {{{ */
if(target_type == 'folder') { if(target_type == 'folder') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { /* check for files, because items has an entry if no file was dropped */
if(files.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id); // console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
newitems = []; newitems = [];
for (var i=0; i<items.length; i++) { for (var i=0; i<items.length; i++) {
@ -1050,6 +1052,7 @@ $(document).ready(function() { /* {{{ */
} }
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/); SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else { } else {
/* The data is passed in dataTransfer. The items are meaning less. */
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text")); var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type; source_type = source_info.type;
source_id = source_info.id; source_id = source_info.id;
@ -1160,13 +1163,50 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'document') { } else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { /* check for files, because items has an entry if no file was dropped */
if(files.length > 0) {
// console.log('Drop '+files.length+' files on '+target_type+' '+target_id); // console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
newitems = []; if(files.length > 1) {
for (var i=0; i<items.length; i++) { noty({
newitems.push(items[i].webkitGetAsEntry()); text: trans.must_drop_one_file,
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
} else if(0) {
bootbox.dialog({
"message" : trans.confirm_upload_new_version,
"buttons" : {
"cancel" : {
"label" : trans.cancel,
"className" : "btn-secondary",
"callback": function() {
}
},
"newversion" : {
"label" : "<i class='fa fa-link'></i> "+trans.upload_new_version,
"className" : "btn-danger",
"callback": function() {
console.log('Hallo');
/*
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1'));
*/
}
}
}
});
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} }
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else { } else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text")); var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type; source_type = source_info.type;
@ -1257,7 +1297,7 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'attachment') { } else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files; var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items; var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) { if(files.length > 0) {
newitems = []; newitems = [];
for (var i=0; i<items.length; i++) { for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry()); newitems.push(items[i].webkitGetAsEntry());