mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +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);
|
var $newstate = $(html);
|
||||||
return $newstate;
|
return $newstate;
|
||||||
};
|
};
|
||||||
|
function escapeHtml(text) {
|
||||||
|
var map = {
|
||||||
|
'&': '&',
|
||||||
|
'<': '<',
|
||||||
|
'>': '>',
|
||||||
|
'"': '"',
|
||||||
|
"'": '''
|
||||||
|
};
|
||||||
|
|
||||||
|
return text.replace(/[&<>"']/g, function(m) { return map[m]; });
|
||||||
|
}
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
/* close popovers when clicking somewhere except in the popover or the
|
/* close popovers when clicking somewhere except in the popover or the
|
||||||
* remove icon
|
* remove icon
|
||||||
|
@ -166,9 +177,7 @@ $(document).ready( function() {
|
||||||
{ command: 'addtoclipboard', type: type, id: id },
|
{ command: 'addtoclipboard', type: type, id: id },
|
||||||
function(data) {
|
function(data) {
|
||||||
if(data.success) {
|
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')
|
$("#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')
|
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||||
noty({
|
noty({
|
||||||
text: attr_msg,
|
text: attr_msg,
|
||||||
|
@ -203,9 +212,7 @@ $(document).ready( function() {
|
||||||
{ command: 'removefromclipboard', type: type, id: id },
|
{ command: 'removefromclipboard', type: type, id: id },
|
||||||
function(data) {
|
function(data) {
|
||||||
if(data.success) {
|
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')
|
$("#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')
|
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||||
noty({
|
noty({
|
||||||
text: attr_msg,
|
text: attr_msg,
|
||||||
|
@ -443,9 +450,7 @@ $(document).ready( function() {
|
||||||
success: function(data){
|
success: function(data){
|
||||||
if(data.success) {
|
if(data.success) {
|
||||||
if(element.data('param1') == 'command=clearclipboard') {
|
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')
|
$("#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')
|
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||||
}
|
}
|
||||||
noty({
|
noty({
|
||||||
|
@ -481,16 +486,12 @@ function onAddClipboard(ev) { /* {{{ */
|
||||||
source_type = source_info.type;
|
source_type = source_info.type;
|
||||||
source_id = source_info.id;
|
source_id = source_info.id;
|
||||||
formtoken = source_info.formtoken;
|
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') {
|
if(source_type == 'document' || source_type == 'folder') {
|
||||||
$.get('../op/op.Ajax.php',
|
$.get('../op/op.Ajax.php',
|
||||||
{ command: 'addtoclipboard', type: source_type, id: source_id },
|
{ command: 'addtoclipboard', type: source_type, id: source_id },
|
||||||
function(data) {
|
function(data) {
|
||||||
if(data.success) {
|
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')
|
$("#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')
|
$("#menu-clipboard").html('Loading').load('../out/out.Clipboard.php?action=menuclipboard')
|
||||||
noty({
|
noty({
|
||||||
text: data.message,
|
text: data.message,
|
||||||
|
@ -757,6 +758,7 @@ $(document).ready(function() { /* {{{ */
|
||||||
attr_rel = $(e.currentTarget).data('droptarget');
|
attr_rel = $(e.currentTarget).data('droptarget');
|
||||||
target_type = attr_rel.split("_")[0];
|
target_type = attr_rel.split("_")[0];
|
||||||
target_id = attr_rel.split("_")[1];
|
target_id = attr_rel.split("_")[1];
|
||||||
|
target_name = $(e.currentTarget).data('name')
|
||||||
if(target_type == 'folder') {
|
if(target_type == 'folder') {
|
||||||
var files = e.originalEvent.dataTransfer.files;
|
var files = e.originalEvent.dataTransfer.files;
|
||||||
if(files.length > 0) {
|
if(files.length > 0) {
|
||||||
|
@ -769,7 +771,10 @@ $(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_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,
|
"label" : "<i class='icon-remove'></i> "+trans.move_document,
|
||||||
"class" : "btn-danger",
|
"class" : "btn-danger",
|
||||||
"callback": function() {
|
"callback": function() {
|
||||||
|
@ -810,7 +815,10 @@ $(document).ready(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;
|
||||||
} else if(source_type == 'folder' && source_id != target_id) {
|
} 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,
|
"label" : "<i class='icon-remove'></i> "+trans.move_folder,
|
||||||
"class" : "btn-danger",
|
"class" : "btn-danger",
|
||||||
"callback": function() {
|
"callback": function() {
|
||||||
|
@ -947,8 +955,22 @@ $(document).ready(function() { /* {{{ */
|
||||||
var dragStartInfo = {
|
var dragStartInfo = {
|
||||||
id : attr_rel.split("_")[1],
|
id : attr_rel.split("_")[1],
|
||||||
type : "folder",
|
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));
|
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -959,7 +981,8 @@ $(document).ready(function() { /* {{{ */
|
||||||
var dragStartInfo = {
|
var dragStartInfo = {
|
||||||
id : attr_rel.split("_")[1],
|
id : attr_rel.split("_")[1],
|
||||||
type : "document",
|
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));
|
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
|
||||||
});
|
});
|
||||||
|
@ -1014,9 +1037,6 @@ $(document).ready(function() { /* {{{ */
|
||||||
source_type = source_info.type;
|
source_type = source_info.type;
|
||||||
source_id = source_info.id;
|
source_id = source_info.id;
|
||||||
formtoken = source_info.formtoken;
|
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') {
|
if(source_type == 'document') {
|
||||||
bootbox.dialog(trans.confirm_move_document, [{
|
bootbox.dialog(trans.confirm_move_document, [{
|
||||||
"label" : "<i class='icon-remove'></i> "+trans.move_document,
|
"label" : "<i class='icon-remove'></i> "+trans.move_document,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user