Commit 9b925c5b authored by asseldonk's avatar asseldonk
Browse files

filebrowser: removed permission-effects on drag and drop (too slow), fixed...

filebrowser: removed permission-effects on drag and drop (too slow), fixed chrome bug on drag and drop
parent fb64c99f
.file-view-table.row-tiny .node{height:34px}.file-view-table.row-tiny .icon{width:30px}.file-view-table.row-tiny .icon [class^="icon-"],.file-view-table.row-tiny .icon [class*=" icon-"]{font-size:24px}.file-view-table.row-tiny .icon .icon-folder,.file-view-table.row-tiny .icon .icon-folder-open,.file-view-table.row-tiny .icon .icon-folder-symlink{font-size:18px}.file-view-table.row-small .node{height:40px}.file-view-table.row-small .icon{width:45px}.file-view-table.row-small .icon [class^="icon-"],.file-view-table.row-small .icon [class*=" icon-"]{font-size:30px}.file-view-table.row-small .icon .icon-folder,.file-view-table.row-small .icon .icon-folder-open,.file-view-table.row-small .icon .icon-folder-symlink{font-size:24px}.file-view-table.row-medium .node{height:48px}.file-view-table.row-medium .icon{width:60px}.file-view-table.row-medium .icon [class^="icon-"],.file-view-table.row-medium .icon [class*=" icon-"]{font-size:38px}.file-view-table.row-medium .icon .icon-folder,.file-view-table.row-medium .icon .icon-folder-open,.file-view-table.row-medium .icon .icon-folder-symlink{font-size:32px}.file-view-table.row-large .node{height:56px}.file-view-table.row-large .icon{width:75px}.file-view-table.row-large .icon [class^="icon-"],.file-view-table.row-large .icon [class*=" icon-"]{font-size:46px}.file-view-table.row-large .icon .icon-folder,.file-view-table.row-large .icon .icon-folder-open,.file-view-table.row-large .icon .icon-folder-symlink{font-size:40px}.file-table-hidden{display:none !important;visibility:hidden !important}.file-table-select-column{width:70px;text-align:center}.file-table-icon-column{text-align:left}.file-table-size-column{width:120px;text-align:right}.file-table-time-column{width:215px;padding-left:20px;text-align:left}.file-table-options-column{width:50px;text-align:center}.file-view-table .file-list.edit-tools-hidden .edit-tools{color:#f00 !important;display:none !important;visibility:hidden !important}.file-view-table{width:100%}.file-view-table .file-table-head{position:absolute;top:44px;left:0;display:-webkit-flex;display:flex;width:100%;height:36px;padding-top:7px;border-bottom:3px solid #ddd}.file-view-table .file-table-head .glyphicon{margin-left:4px}.file-view-table .file-table-head>.select{width:70px;text-align:center}.file-view-table .file-table-head>.icon{text-align:left}.file-view-table .file-table-head>.name{webkit-flex:1;flex:1}.file-view-table .file-table-head>.size{width:120px;text-align:right}.file-view-table .file-table-head>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-table-head>.options{width:50px;text-align:center}.file-view-table .file-table-head>.name,.file-view-table .file-table-head>.size,.file-view-table .file-table-head>.time{cursor:pointer}.file-view-table .file-list{position:absolute;bottom:0;right:0;top:80px;left:0;overflow-y:auto;width:100%}.file-view-table .file-list>.node{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;width:100%}.file-view-table .file-list>.node:nth-child(2n){background-color:#f9f9f9}.file-view-table .file-list>.node:hover{background-color:#f5f5f5}.file-view-table .file-list>.node:not(:hover) .edit-tools{visibility:collapse}.file-view-table .file-list>.node[selected]{background-color:#f5f5f5}.file-view-table .file-list>.node.dragover{background-color:rgba(92,184,92,0.5) !important}.file-view-table .file-list>.node.dragover-denied{background-color:rgba(217,83,79,0.5) !important}.file-view-table .file-list>.node.dragstart{opacity:.4}.file-view-table .file-list>.node[draggable=true]{cursor:move;-khtml-user-drag:element}.file-view-table .file-list>.node>.select{width:70px;text-align:center}.file-view-table .file-list>.node>.icon{text-align:left}.file-view-table .file-list>.node>.name{-webkit-flex:1;flex:1}.file-view-table .file-list>.node>.name>.input-filename{background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset;color:#555;transition:border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s}.file-view-table .file-list>.node>.name>.input-filename:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.file-view-table .file-list>.node>.name>.input-filename::-webkit-input-placeholder{color:#999}.file-view-table .file-list>.node>.name>.input-filename:-moz-placeholder{color:#999;opacity:1}.file-view-table .file-list>.node>.name>.input-filename::-moz-placeholder{color:#999;opacity:1}.file-view-table .file-list>.node>.name>.input-filename:-ms-input-placeholder{color:#999}.file-view-table .file-list>.node>.name .filename-root{display:inline-block;vertical-align:middle;max-width:80%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.file-view-table .file-list>.node>.name .filename-ext{white-space:nowrap;vertical-align:middle}.file-view-table .file-list>.node>.edit-tools{font-size:12px;width:250px;text-align:right}.file-view-table .file-list>.node>.edit-tools .glyphicon{margin-left:14px}.file-view-table .file-list>.node>.edit-tools .glyphicon-pencil{margin-left:4px}@media (max-width:992px){.file-view-table .file-list>.node>.edit-tools{width:110px}.file-view-table .file-list>.node>.edit-tools .glyphicon{margin-left:10px;margin-right:10px}.file-view-table .file-list>.node>.edit-tools .glyphicon-pencil{margin-left:8px}}.file-view-table .file-list>.node>.size{width:120px;text-align:right}.file-view-table .file-list>.node>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-list>.node>.options{width:50px;text-align:center;cursor:pointer}.fileselector .node{height:38px}.fileselector .icon{width:40px}.fileselector .icon [class^="icon-"],.fileselector .icon [class*=" icon-"]{font-size:26px}.fileselector .icon .icon-folder,.fileselector .icon .icon-folder-open,.fileselector .icon .icon-folder-symlink{font-size:22px}.fileselector .edit-tools{display:none !important;visibility:hidden !important}.fileselector .size{display:none !important;visibility:hidden !important}.fileselector .time{display:none !important;visibility:hidden !important}
\ No newline at end of file
.file-view-table.row-tiny .node{height:34px}.file-view-table.row-tiny .icon{width:30px}.file-view-table.row-tiny .icon [class^="icon-"],.file-view-table.row-tiny .icon [class*=" icon-"]{font-size:24px}.file-view-table.row-tiny .icon .icon-folder,.file-view-table.row-tiny .icon .icon-folder-open,.file-view-table.row-tiny .icon .icon-folder-symlink{font-size:18px}.file-view-table.row-small .node{height:40px}.file-view-table.row-small .icon{width:45px}.file-view-table.row-small .icon [class^="icon-"],.file-view-table.row-small .icon [class*=" icon-"]{font-size:30px}.file-view-table.row-small .icon .icon-folder,.file-view-table.row-small .icon .icon-folder-open,.file-view-table.row-small .icon .icon-folder-symlink{font-size:24px}.file-view-table.row-medium .node{height:48px}.file-view-table.row-medium .icon{width:60px}.file-view-table.row-medium .icon [class^="icon-"],.file-view-table.row-medium .icon [class*=" icon-"]{font-size:38px}.file-view-table.row-medium .icon .icon-folder,.file-view-table.row-medium .icon .icon-folder-open,.file-view-table.row-medium .icon .icon-folder-symlink{font-size:32px}.file-view-table.row-large .node{height:56px}.file-view-table.row-large .icon{width:75px}.file-view-table.row-large .icon [class^="icon-"],.file-view-table.row-large .icon [class*=" icon-"]{font-size:46px}.file-view-table.row-large .icon .icon-folder,.file-view-table.row-large .icon .icon-folder-open,.file-view-table.row-large .icon .icon-folder-symlink{font-size:40px}.file-table-hidden{display:none !important;visibility:hidden !important}.file-table-select-column{width:70px;text-align:center}.file-table-icon-column{text-align:left}.file-table-size-column{width:120px;text-align:right}.file-table-time-column{width:215px;padding-left:20px;text-align:left}.file-table-options-column{width:50px;text-align:center}.file-view-table .file-list.edit-tools-hidden .edit-tools{color:#f00 !important;display:none !important;visibility:hidden !important}.file-view-table{width:100%}.file-view-table .file-table-head{position:absolute;top:44px;left:0;display:-webkit-flex;display:flex;width:100%;height:36px;padding-top:7px;border-bottom:3px solid #ddd}.file-view-table .file-table-head .glyphicon{margin-left:4px}.file-view-table .file-table-head>.select{width:70px;text-align:center}.file-view-table .file-table-head>.icon{text-align:left}.file-view-table .file-table-head>.name{webkit-flex:1;flex:1}.file-view-table .file-table-head>.size{width:120px;text-align:right}.file-view-table .file-table-head>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-table-head>.options{width:50px;text-align:center}.file-view-table .file-table-head>.name,.file-view-table .file-table-head>.size,.file-view-table .file-table-head>.time{cursor:pointer}.file-view-table .file-list{position:absolute;bottom:0;right:0;top:80px;left:0;overflow-y:auto;width:100%}.file-view-table .file-list>.node{display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-flex-align:center;-ms-flex-align:center;-webkit-align-items:center;align-items:center;width:100%}.file-view-table .file-list>.node:nth-child(2n){background-color:#f9f9f9}.file-view-table .file-list>.node:hover{background-color:#f5f5f5}.file-view-table .file-list>.node:not(:hover) .edit-tools{visibility:collapse}.file-view-table .file-list>.node[selected]{background-color:#f5f5f5}.file-view-table .file-list>.node.dragover{background-color:rgba(92,184,92,0.5) !important}.file-view-table .file-list>.node.dragover-denied{background-color:rgba(217,83,79,0.5) !important}.file-view-table .file-list>.node.dragstart{opacity:.4}.file-view-table .file-list>.node[draggable=true]{cursor:move;-khtml-user-drag:element}.file-view-table .file-list>.node.stop-pointer-events *{pointer-events:none}.file-view-table .file-list>.node>.select{width:70px;text-align:center}.file-view-table .file-list>.node>.icon{text-align:left}.file-view-table .file-list>.node>.name{-webkit-flex:1;flex:1}.file-view-table .file-list>.node>.name>.input-filename{background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;box-shadow:0 1px 1px rgba(0,0,0,0.075) inset;color:#555;transition:border-color .15s ease-in-out 0s,box-shadow .15s ease-in-out 0s}.file-view-table .file-list>.node>.name>.input-filename:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.file-view-table .file-list>.node>.name>.input-filename::-webkit-input-placeholder{color:#999}.file-view-table .file-list>.node>.name>.input-filename:-moz-placeholder{color:#999;opacity:1}.file-view-table .file-list>.node>.name>.input-filename::-moz-placeholder{color:#999;opacity:1}.file-view-table .file-list>.node>.name>.input-filename:-ms-input-placeholder{color:#999}.file-view-table .file-list>.node>.name .filename-root{display:inline-block;vertical-align:middle;max-width:80%;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.file-view-table .file-list>.node>.name .filename-ext{white-space:nowrap;vertical-align:middle}.file-view-table .file-list>.node>.edit-tools{font-size:12px;width:250px;text-align:right}.file-view-table .file-list>.node>.edit-tools .glyphicon{margin-left:14px}.file-view-table .file-list>.node>.edit-tools .glyphicon-pencil{margin-left:4px}@media (max-width:992px){.file-view-table .file-list>.node>.edit-tools{width:110px}.file-view-table .file-list>.node>.edit-tools .glyphicon{margin-left:10px;margin-right:10px}.file-view-table .file-list>.node>.edit-tools .glyphicon-pencil{margin-left:8px}}.file-view-table .file-list>.node>.size{width:120px;text-align:right}.file-view-table .file-list>.node>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-list>.node>.options{width:50px;text-align:center;cursor:pointer}.fileselector .node{height:38px}.fileselector .icon{width:40px}.fileselector .icon [class^="icon-"],.fileselector .icon [class*=" icon-"]{font-size:26px}.fileselector .icon .icon-folder,.fileselector .icon .icon-folder-open,.fileselector .icon .icon-folder-symlink{font-size:22px}.fileselector .edit-tools{display:none !important;visibility:hidden !important}.fileselector .size{display:none !important;visibility:hidden !important}.fileselector .time{display:none !important;visibility:hidden !important}
\ No newline at end of file
......@@ -124,7 +124,6 @@
}
}
/* tale view */
.file-view-table {
width: 100%;
......@@ -212,6 +211,9 @@
cursor: move;
-khtml-user-drag: element;
}
&.stop-pointer-events * {
pointer-events: none;
}
> .select {
.file-table-select-column;
}
......
......@@ -181,86 +181,62 @@ var FileBaseEvents = Class.extend({
// dragstart
node.on("dragstart", function(event) {
event.originalEvent.dataTransfer.setData("dataName", data.name);
// check permissions
var path = self.FileBase.workflow.path +"/" + data.name;
var dfd = self.FileBase.instance.GET("/ajax/fs/checkPermissions", {
"path": JSON.stringify(path)
});
dfd.done(function(result) {
// toggle class for node if permission = true
if (result.permission === true) {
$(node).toggleClass("dragstart", true);
}
else {
// if no permissions, do not allow any effects
event.originalEvent.dataTransfer.effectAllowed = "none";
}
});
// opacity on dragged node
node.toggleClass("dragstart", true);
});
// dragover
node.on("dragover", function(event) {
// dragend
node.on("dragend", function(event) {
event.preventDefault();
// remove all potential set css classes
node.toggleClass("stop-pointer-events", false);
node.toggleClass("dragstart", false);
node.toggleClass("dragover", false);
});
// dragenter
node.on("dragenter", function(event) {
event.preventDefault();
// do not change css when child of node is entered
var related = event.relatedTarget, inside = false;
if (related !== this) {
if (related) {
inside = jQuery.contains(this, related);
}
if (!inside) {
// only change css when destination node contains a folder
if (data.type == "d") {
var folderToBeMoved = (event.originalEvent.dataTransfer.getData("dataName"));
// only change css if source folder != destination folder
if (data.name != folderToBeMoved) {
// check permissions
var path = self.FileBase.workflow.path + "/" + data.name;
var dfd = self.FileBase.instance.GET("/ajax/fs/checkPermissions", {
"path": JSON.stringify(path)
});
dfd.done(function(result) {
// toggle class for node if destination and source permissions
// allow drag and drop operation
if (result.permission === true &&
event.originalEvent.dataTransfer.effectAllowed != "none") {
node.toggleClass("dragover", true);
} else {
node.toggleClass("dragover-denied", true);
}
});
}
}
if (data.type == "d") {
var folderToBeMoved = (event.originalEvent.dataTransfer.getData("dataName"));
// only change css if source folder != destination folder
if (data.name != folderToBeMoved) {
// no pointer events to prevent firing when entering child elements
node.toggleClass("stop-pointer-events", true);
// remove following line when permissions are switched on
node.toggleClass("dragover", true);
}
}
});
// dragleave
node.on("dragleave", function(event) {
// dragover
node.on("dragover", function(event) {
event.preventDefault();
// remove css after leavin a folder node
// do not remove css when entering a child of a node
var related = event.relatedTarget, inside = false;
if (related !== this) {
if (related) {
inside = jQuery.contains(this, related);
}
if (!inside) {
$(node).toggleClass("dragover", false);
$(node).toggleClass("dragover-denied", false);
// sometimes, dragenter does not work...
if (!node.hasClass("dragover")) {
// only change css when destination node contains a folder
if (data.type == "d") {
node.toggleClass("dragover", true);
}
}
});
// dragleave
node.on("dragleave", function(event) {
//event.preventDefault();
node.toggleClass("stop-pointer-events", false);
node.toggleClass("dragover", false);
});
// drop
node.on("drop", function(event) {
event.preventDefault();
$(node).toggleClass("dragover", false);
$(node).toggleClass("dragover-denied", false);
// remove all potential set css classes
node.toggleClass("stop-pointer-events", false);
node.toggleClass("dragstart", false);
node.toggleClass("dragover", false);
// get file which was dragged and now dropped
var fileToBeMoved = (event.originalEvent.dataTransfer.getData("dataName"));
// if transfered data empty: upload file
var path = "";
......@@ -285,13 +261,6 @@ var FileBaseEvents = Class.extend({
}
});
// dragend
node.on("dragend", function(event) {
event.preventDefault();
// remove all potential set css classes
$(node).toggleClass("dragover", false);
$(node).toggleClass("dragover-denied", false);
$(node).toggleClass("dragstart", false);
});
},
}
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment