diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js
index 086d46a6b..d1b5f96df 100644
--- a/styles/bootstrap/application.js
+++ b/styles/bootstrap/application.js
@@ -545,7 +545,6 @@ function onAddClipboard(ev) { /* {{{ */
}
function sendFileToServer(formData,status) {
- formData.append('command', 'uploaddocument');
var uploadURL = ajaxurl; //Upload URL
var extraData ={}; //Extra Data.
var jqXHR=$.ajax({
@@ -641,18 +640,28 @@ function onAddClipboard(ev) { /* {{{ */
}
}
- SeedDMSUpload.handleFileUpload = function(files,obj) {
- var target = obj.data('target');
- if(target) {
+ SeedDMSUpload.handleFileUpload = function(files,obj,statusbar) {
+ /* target is set for the quick upload area */
+ var target_id = obj.data('target');
+ var target_type = 'folder';
+ /* droptarget is set for folders and documents in lists */
+ var droptarget = obj.data('droptarget');
+ if(droptarget) {
+ target_type = droptarget.split("_")[0];
+ target_id = droptarget.split("_")[1];
+ }
+ if(target_type == 'folder' && target_id) {
for (var i = 0; i < files.length; i++) {
if(files[i].size <= maxFileSize) {
var fd = new FormData();
- fd.append('folderid', target);
- fd.append('formtoken', obj.data('formtoken'));
+ fd.append('targettype', target_type);
+ fd.append('folderid', target_id);
+ fd.append('formtoken', obj.data('uploadformtoken'));
fd.append('userfile', files[i]);
+ fd.append('command', 'uploaddocument');
// fd.append('path', files[i].webkitRelativePath);
- var status = new createStatusbar(obj);
+ var status = new createStatusbar(statusbar);
status.setFileNameSize(files[i].name,files[i].size);
sendFileToServer(fd,status);
} else {
@@ -666,6 +675,32 @@ 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');
+
+ var status = new createStatusbar(statusbar);
+ status.setFileNameSize(files[i].name,files[i].size);
+ sendFileToServer(fd,status);
+ } else {
+ noty({
+ text: maxFileSizeMsg + '
' + files[i].name + ' (' + files[i].size + ' Bytes)',
+ type: 'error',
+ dismissQueue: true,
+ layout: 'topRight',
+ theme: 'defaultTheme',
+ timeout: 5000,
+ });
+ }
+ }
+ */
}
}
}( window.SeedDMSUpload = window.SeedDMSUpload || {}, jQuery )); /* }}} */
@@ -690,120 +725,209 @@ $(document).ready(function() { /* {{{ */
var files = e.originalEvent.dataTransfer.files;
//We need to send dropped files to Server
- SeedDMSUpload.handleFileUpload(files,obj);
+ SeedDMSUpload.handleFileUpload(files,obj,obj);
});
- $(document).on('dragenter', '.table-row-folder', function (e) {
+ $(document).on('dragenter', '.droptarget', function (e) {
e.stopPropagation();
e.preventDefault();
$(e.currentTarget).css('border', '2px dashed #0B85A1');
});
- $(document).on('dragleave', '.table-row-folder', function (e) {
+ $(document).on('dragleave', '.droptarget', function (e) {
e.stopPropagation();
e.preventDefault();
$(e.currentTarget).css('border', '0px solid white');
});
- $(document).on('dragover', '.table-row-folder', function (e) {
+ $(document).on('dragover', '.droptarget', function (e) {
e.stopPropagation();
e.preventDefault();
});
- $(document).on('drop', '.table-row-folder', function (e) {
+ $(document).on('drop', '.droptarget', function (e) {
e.preventDefault();
e.stopPropagation();
$(e.currentTarget).css('border', '0px solid white');
- attr_rel = $(e.currentTarget).attr('rel');
+ attr_rel = $(e.currentTarget).data('droptarget');
target_type = attr_rel.split("_")[0];
target_id = attr_rel.split("_")[1];
- console.log(e.originalEvent.dataTransfer.getData("text"));
- var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
- 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" : " "+trans.move_document,
- "class" : "btn-danger",
- "callback": function() {
- $.get('../op/op.Ajax.php',
- { command: 'movedocument', docid: source_id, targetfolderid: 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.cancel,
- "class" : "btn-cancel",
- "callback": function() {
- }
- }]);
+ if(target_type == 'folder') {
+ var files = e.originalEvent.dataTransfer.files;
+ if(files.length > 0) {
+ console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
+ SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$(e.currentTarget).find("span"));
+ } else {
+ var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
+ source_type = source_info.type;
+ source_id = source_info.id;
+ 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, [{
+ "label" : " "+trans.move_document,
+ "class" : "btn-danger",
+ "callback": function() {
+ $.get('../op/op.Ajax.php',
+ { command: 'movedocument', docid: source_id, targetfolderid: 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.cancel,
+ "class" : "btn-cancel",
+ "callback": 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, [{
- "label" : " "+trans.move_folder,
- "class" : "btn-danger",
- "callback": function() {
- $.get('../op/op.Ajax.php',
- { command: 'movefolder', folderid: source_id, targetfolderid: target_id, formtoken: formtoken },
- function(data) {
- if(data.success) {
- $('#table-row-folder-'+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.cancel,
- "class" : "btn-cancel",
- "callback": 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, [{
+ "label" : " "+trans.move_folder,
+ "class" : "btn-danger",
+ "callback": function() {
+ $.get('../op/op.Ajax.php',
+ { command: 'movefolder', folderid: source_id, targetfolderid: target_id, formtoken: formtoken },
+ function(data) {
+ if(data.success) {
+ $('#table-row-folder-'+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.cancel,
+ "class" : "btn-cancel",
+ "callback": function() {
+ }
+ }]);
- url = "../out/out.MoveFolder.php?folderid="+source_id+"&targetid="+target_id;
-// document.location = url;
+ url = "../out/out.MoveFolder.php?folderid="+source_id+"&targetid="+target_id;
+ // document.location = url;
+ }
+ }
+ } else if(target_type == 'document') {
+ var files = e.originalEvent.dataTransfer.files;
+ if(files.length > 0) {
+ console.log('Drop '+files.length+' files on '+target_type+' '+target_id);
+ SeedDMSUpload.handleFileUpload(files,$(e.currentTarget),$(e.currentTarget).find("span"));
+ } else {
+ var source_info = JSON.parse(e.originalEvent.dataTransfer.getData("text"));
+ source_type = source_info.type;
+ source_id = source_info.id;
+ 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" : " "+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;
+ }
+ }
}
});
$(document).on('dragstart', '.table-row-folder', function (e) {
@@ -816,9 +940,6 @@ $(document).ready(function() { /* {{{ */
formtoken : $(e.target).attr('formtoken')
};
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
-// e.originalEvent.dataTransfer.setData("id", attr_rel.split("_")[1]);
-// e.originalEvent.dataTransfer.setData("type","folder");
-// e.originalEvent.dataTransfer.setData("formtoken", $(e.target).attr('formtoken'));
});
$(document).on('dragstart', '.table-row-document', function (e) {
@@ -831,9 +952,6 @@ $(document).ready(function() { /* {{{ */
formtoken : $(e.target).attr('formtoken')
};
e.originalEvent.dataTransfer.setData("text", JSON.stringify(dragStartInfo));
-// e.originalEvent.dataTransfer.setData("id", attr_rel.split("_")[1]);
-// e.originalEvent.dataTransfer.setData("type","document");
-// e.originalEvent.dataTransfer.setData("formtoken", $(e.target).attr('formtoken'));
});
/* Dropping item on alert below clipboard */
diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php
index 1644d6de3..792e8960d 100644
--- a/views/bootstrap/class.Bootstrap.php
+++ b/views/bootstrap/class.Bootstrap.php
@@ -398,7 +398,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
for ($i = 0; $i < count($path); $i++) {
$txtpath .= "