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
- fix error when sending notification to group of reviewers
- 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
--------------------------------------------------------------------------------

View File

@ -130,7 +130,7 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Theme_Style {
$sitename = trim(strip_tags($this->params['sitename']));
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() {
$('#searchfield').focus();

View File

@ -840,7 +840,7 @@ function onAddClipboard(ev) { /* {{{ */
}
if(target_type == 'folder' && target_id) {
for (var i = 0; i < items.length; i++) {
var item = items[i].webkitGetAsEntry();
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
@ -876,6 +876,11 @@ function onAddClipboard(ev) { /* {{{ */
}
});
} else if(item.isDirectory) {
var dirReader = item.createReader();
dirReader.readEntries(function(entries) {
SeedDMSUpload.handleFileUpload(entries, obj, statusbar);
});
/*
noty({
text: 'Folders currently not supported',
type: 'error',
@ -884,30 +889,36 @@ function onAddClipboard(ev) { /* {{{ */
theme: 'defaultTheme',
timeout: 5000
});
*/
}
}
} else if(target_type == 'document' && target_id) {
/*
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
for (var i = 0; i < items.length; i++) {
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
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);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
}
}
@ -967,8 +978,12 @@ $(document).ready(function() { /* {{{ */
var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server
newitems = [];
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') {
var files = e.originalEvent.dataTransfer.files;
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);
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 {
/* The data is passed in dataTransfer. The items are meaning less. */
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
source_id = source_info.id;
@ -1099,9 +1120,50 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files;
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);
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 {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1185,8 +1247,12 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
SeedDMSUpload.handleFileUpload(items,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
if(files.length > 0) {
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) {
/*
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
fd.append('documentid', target_id);
fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
fd.append('command', 'uploaddocument');
for (var i = 0; i < items.length; i++) {
var item = items[i]; //.webkitGetAsEntry();
if (item.isFile) {
item.file(function(file) {
if(file.size <= maxFileSize) {
var fd = new FormData();
fd.append('targettype', target_type);
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);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
var status = new SeedDMSUpload.createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
SeedDMSUpload.sendFileToServer(fd,status);
} else {
noty({
text: maxFileSizeMsg + '<br /><em>' + files[i].name + ' (' + files[i].size + ' Bytes)</em>',
type: 'error',
dismissQueue: true,
layout: 'topRight',
theme: 'defaultTheme',
timeout: 5000
});
}
});
}
}
@ -1004,15 +1009,11 @@ $(document).ready(function() { /* {{{ */
var items = e.originalEvent.dataTransfer.items;
//We need to send dropped files to Server
console.log(items[0]);
console.log(items[0].webkitGetAsEntry());
newitems = [];
if(items.length > 0) {
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
}
console.log(newitems);
SeedDMSUpload.handleFileUpload(newitems, $(this), $(this));
}
});
@ -1042,7 +1043,8 @@ $(document).ready(function() { /* {{{ */
if(target_type == 'folder') {
var files = e.originalEvent.dataTransfer.files;
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);
newitems = [];
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")*/);
} else {
/* The data is passed in dataTransfer. The items are meaning less. */
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
source_id = source_info.id;
@ -1160,13 +1163,50 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'document') {
var files = e.originalEvent.dataTransfer.files;
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);
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());
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")*/);
}
SeedDMSUpload.handleFileUpload(newitems,$(e.currentTarget),$('div.statusbar-container h1')/*$(e.currentTarget).find("span")*/);
} else {
var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
source_type = source_info.type;
@ -1257,7 +1297,7 @@ $(document).ready(function() { /* {{{ */
} else if(target_type == 'attachment') {
var files = e.originalEvent.dataTransfer.files;
var items = e.originalEvent.dataTransfer.items;
if(items.length > 0) {
if(files.length > 0) {
newitems = [];
for (var i=0; i<items.length; i++) {
newitems.push(items[i].webkitGetAsEntry());