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