cancel drag&drop if source document equals target document

This commit is contained in:
Uwe Steinmann 2019-07-19 12:52:33 +02:00
parent 111a2beec6
commit b83ef1dd66

View File

@ -857,73 +857,75 @@ $(document).ready(function() { /* {{{ */
formtoken = source_info.formtoken; formtoken = source_info.formtoken;
console.log('Drop '+source_type+' '+source_id+' on '+target_type+' '+target_id); console.log('Drop '+source_type+' '+source_id+' on '+target_type+' '+target_id);
if(source_type == 'document') { if(source_type == 'document') {
bootbox.dialog(trans.confirm_transfer_link_document, [{ if(source_id != target_id) {
"label" : "<i class='icon-remove'></i> "+trans.transfer_content, bootbox.dialog(trans.confirm_transfer_link_document, [{
"class" : "btn-danger", "label" : "<i class='icon-remove'></i> "+trans.transfer_content,
"callback": function() { "class" : "btn-danger",
$.get('../op/op.Ajax.php', "callback": function() {
{ command: 'transfercontent', docid: source_id, targetdocumentid: target_id, formtoken: formtoken }, $.get('../op/op.Ajax.php',
function(data) { { command: 'transfercontent', docid: source_id, targetdocumentid: target_id, formtoken: formtoken },
if(data.success) { function(data) {
$('#table-row-document-'+source_id).hide('slow'); if(data.success) {
noty({ $('#table-row-document-'+source_id).hide('slow');
text: data.message, noty({
type: 'success', text: data.message,
dismissQueue: true, type: 'success',
layout: 'topRight', dismissQueue: true,
theme: 'defaultTheme', layout: 'topRight',
timeout: 1500, theme: 'defaultTheme',
}); timeout: 1500,
} else { });
noty({ } else {
text: data.message, noty({
type: 'error', text: data.message,
dismissQueue: true, type: 'error',
layout: 'topRight', dismissQueue: true,
theme: 'defaultTheme', layout: 'topRight',
timeout: 3500, theme: 'defaultTheme',
}); timeout: 3500,
} });
}, }
'json' },
); 'json'
} );
}, { }
"label" : trans.link_document, }, {
"class" : "btn-danger", "label" : trans.link_document,
"callback": function() { "class" : "btn-danger",
$.get('../op/op.Ajax.php', "callback": function() {
{ command: 'linkdocument', docid: source_id, targetdocumentid: target_id, formtoken: formtoken }, $.get('../op/op.Ajax.php',
function(data) { { command: 'linkdocument', docid: source_id, targetdocumentid: target_id, formtoken: formtoken },
if(data.success) { function(data) {
noty({ if(data.success) {
text: data.message, noty({
type: 'success', text: data.message,
dismissQueue: true, type: 'success',
layout: 'topRight', dismissQueue: true,
theme: 'defaultTheme', layout: 'topRight',
timeout: 1500, theme: 'defaultTheme',
}); timeout: 1500,
} else { });
noty({ } else {
text: data.message, noty({
type: 'error', text: data.message,
dismissQueue: true, type: 'error',
layout: 'topRight', dismissQueue: true,
theme: 'defaultTheme', layout: 'topRight',
timeout: 3500, theme: 'defaultTheme',
}); timeout: 3500,
} });
}, }
'json' },
); 'json'
} );
}, { }
"label" : trans.cancel, }, {
"class" : "btn-cancel", "label" : trans.cancel,
"callback": function() { "class" : "btn-cancel",
} "callback": function() {
}]); }
}]);
}
url = "../out/out.MoveDocument.php?documentid="+source_id+"&targetid="+target_id; url = "../out/out.MoveDocument.php?documentid="+source_id+"&targetid="+target_id;
// document.location = url; // document.location = url;