mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-11 16:35:38 +00:00
show target and source document/folder when moving on object
This commit is contained in:
parent
b9bbb8739f
commit
ff0d550144
|
@ -20,6 +20,17 @@ chzn_template_func = function (state) {
|
|||
var $newstate = $(html);
|
||||
return $newstate;
|
||||
};
|
||||
function escapeHtml(text) {
|
||||
var map = {
|
||||
'&': '&',
|
||||
'<': '<',
|
||||
'>': '>',
|
||||
'"': '"',
|
||||
"'": '''
|
||||
};
|
||||
|
||||
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
|
||||
}
|
||||
$(document).ready( function() {
|
||||
/* close popovers when clicking somewhere except in the popover or the
|
||||
* remove icon
|
||||
|
@ -166,9 +177,7 @@ $(document).ready( function() {
|
|||
{ command: 'addtoclipboard', type: type, id: id },
|
||||
function(data) {
|
||||
if(data.success) {
|
||||
// $("#main-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=mainclipboard')
|
||||
$("#main-clipboard").html('Loading').load('../out/out.Clipboard.php?action=mainclipboard')
|
||||
//$("#menu-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=menuclipboard')
|
||||
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||
noty({
|
||||
text: attr_msg,
|
||||
|
@ -203,9 +212,7 @@ $(document).ready( function() {
|
|||
{ command: 'removefromclipboard', type: type, id: id },
|
||||
function(data) {
|
||||
if(data.success) {
|
||||
// $("#main-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=mainclipboard')
|
||||
$("#main-clipboard").html('Loading').load('../out/out.Clipboard.php?action=mainclipboard')
|
||||
//$("#menu-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=menuclipboard')
|
||||
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||
noty({
|
||||
text: attr_msg,
|
||||
|
@ -443,9 +450,7 @@ $(document).ready( function() {
|
|||
success: function(data){
|
||||
if(data.success) {
|
||||
if(element.data('param1') == 'command=clearclipboard') {
|
||||
// $("#main-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=mainclipboard')
|
||||
$("#main-clipboard").html('Loading').load('../out/out.Clipboard.php?action=mainclipboard')
|
||||
//$("#menu-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=menuclipboard')
|
||||
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||
}
|
||||
noty({
|
||||
|
@ -481,16 +486,12 @@ function onAddClipboard(ev) { /* {{{ */
|
|||
source_type = source_info.type;
|
||||
source_id = source_info.id;
|
||||
formtoken = source_info.formtoken;
|
||||
// source_type = ev.originalEvent.dataTransfer.getData("type");
|
||||
// source_id = ev.originalEvent.dataTransfer.getData("id");
|
||||
if(source_type == 'document' || source_type == 'folder') {
|
||||
$.get('../op/op.Ajax.php',
|
||||
{ command: 'addtoclipboard', type: source_type, id: source_id },
|
||||
function(data) {
|
||||
if(data.success) {
|
||||
// $("#main-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=mainclipboard')
|
||||
$("#main-clipboard").html('Loading').load('../out/out.Clipboard.php?action=mainclipboard')
|
||||
//$("#menu-clipboard").html('Loading').load('../op/op.Ajax.php?command=view&view=menuclipboard')
|
||||
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||
noty({
|
||||
text: data.message,
|
||||
|
@ -757,6 +758,7 @@ $(document).ready(function() { /* {{{ */
|
|||
attr_rel = $(e.currentTarget).data('droptarget');
|
||||
target_type = attr_rel.split("_")[0];
|
||||
target_id = attr_rel.split("_")[1];
|
||||
target_name = $(e.currentTarget).data('name')
|
||||
if(target_type == 'folder') {
|
||||
var files = e.originalEvent.dataTransfer.files;
|
||||
if(files.length > 0) {
|
||||
|
@ -769,7 +771,10 @@ $(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_move_document, [{
|
||||
var bootbox_message = trans.confirm_move_document;
|
||||
if(source_info.name)
|
||||
bootbox_message += "<p> "+escapeHtml(source_info.name)+' <i class="icon-arrow-right"></i> '+escapeHtml(target_name)+"</p>";
|
||||
bootbox.dialog(bootbox_message, [{
|
||||
"label" : "<i class='icon-remove'></i> "+trans.move_document,
|
||||
"class" : "btn-danger",
|
||||
"callback": function() {
|
||||
|
@ -810,7 +815,10 @@ $(document).ready(function() { /* {{{ */
|
|||
url = "../out/out.MoveDocument.php?documentid="+source_id+"&targetid="+target_id;
|
||||
// document.location = url;
|
||||
} else if(source_type == 'folder' && source_id != target_id) {
|
||||
bootbox.dialog(trans.confirm_move_folder, [{
|
||||
var bootbox_message = trans.confirm_move_folder;
|
||||
if(source_info.name)
|
||||
bootbox_message += "<p> "+escapeHtml(source_info.name)+' <i class="icon-arrow-right"></i> '+escapeHtml(target_name)+"</p>";
|
||||
bootbox.dialog(bootbox_message, [{
|
||||
"label" : "<i class='icon-remove'></i> "+trans.move_folder,
|
||||
"class" : "btn-danger",
|
||||
"callback": function() {
|
||||
|
@ -947,8 +955,22 @@ $(document).ready(function() { /* {{{ */
|
|||
var dragStartInfo = {
|
||||
id : attr_rel.split("_")[1],
|
||||
type : "folder",
|
||||
formtoken : $(e.target).attr('formtoken')
|
||||
formtoken : $(e.target).attr('formtoken'),
|
||||
name: $(e.target).data('name')
|
||||
};
|
||||
/* Currently not used
|
||||
$.ajax({url: '../out/out.ViewFolder.php',
|
||||
type: 'GET',
|
||||
dataType: "json",
|
||||
data: {action: 'data', folderid: attr_rel.split("_")[1]},
|
||||
success: function(data) {
|
||||
if(data) {
|
||||
dragStartInfo.source = data;
|
||||
}
|
||||
},
|
||||
timeout: 3000
|
||||
});
|
||||
*/
|
||||
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
|
||||
});
|
||||
|
||||
|
@ -959,7 +981,8 @@ $(document).ready(function() { /* {{{ */
|
|||
var dragStartInfo = {
|
||||
id : attr_rel.split("_")[1],
|
||||
type : "document",
|
||||
formtoken : $(e.target).attr('formtoken')
|
||||
formtoken : $(e.target).attr('formtoken'),
|
||||
name: $(e.target).data('name')
|
||||
};
|
||||
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
|
||||
});
|
||||
|
@ -1014,9 +1037,6 @@ $(document).ready(function() { /* {{{ */
|
|||
source_type = source_info.type;
|
||||
source_id = source_info.id;
|
||||
formtoken = source_info.formtoken;
|
||||
// source_type = e.originalEvent.dataTransfer.getData("type");
|
||||
// source_id = e.originalEvent.dataTransfer.getData("id");
|
||||
// formtoken = e.originalEvent.dataTransfer.getData("formtoken");
|
||||
if(source_type == 'document') {
|
||||
bootbox.dialog(trans.confirm_move_document, [{
|
||||
"label" : "<i class='icon-remove'></i> "+trans.move_document,
|
||||
|
|
Loading…
Reference in New Issue
Block a user