Commit 199f59e8 authored by asseldonk's avatar asseldonk
Browse files

filebrowser:

- check permissions when drag and drop
- hide edit tools on touch devices
parent ec4a25a9
......@@ -343,3 +343,13 @@ class FSAjaxController(AbstractController):
# 'path' can be a unicode/string or list of unicodes/strings
# so convert it with the convert function
return fs.expand(path)
@cherrypy.expose
@cherrypy.tools.ajax()
def checkPermissions(self, path):
self.release_session()
fs = self.get('fs')
self.release_database()
path = json.loads(path)
path = fs.expand(path)
return {"permission": fs.checkPermissions(path)}
.file-content{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;position:absolute;height:100%;bottom:0;right:0;top:0;left:0;overflow:hidden}.fileselector{height:300px}.actionmenu{position:absolute;display:none}.file-menu{height:0;overflow:auto;visibility:hidden}.table-info-dialog>tbody>tr>td{border:none;border:0;border-top:0}.table-info-dialog-width{width:114px}.table-info-dialog{overflow:hidden;table-layout:fixed;word-wrap:break-word}.file-info-dialog-header{margin-bottom:20px}.filterField{bottom:5px;right:5px;position:absolute;visibility:hidden;width:300px;z-index:99}.file-dragover{background-color:#5cb85c !important;opacity:.5}.file-dragstart{opacity:.4}[draggable=true]{cursor:move;-khtml-user-drag:element}@font-face{font-family:'file_icons';src:url('../../fonts/file_icons.eot');src:url('../../fonts/file_icons.eot') format('embedded-opentype'),url('../../fonts/file_icons.woff') format('woff'),url('../../fonts/file_icons.ttf') format('truetype'),url('../../fonts/file_icons.svg#file_icons') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'file_icons';color:#444;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-bmp:before{content:"\e600"}.icon-c:before{content:"\e601"}.icon-cc:before{content:"\e602"}.icon-conf:before{content:"\e603"}.icon-cpp:before{content:"\e604"}.icon-csh:before{content:"\e605"}.icon-css:before{content:"\e606"}.icon-default:before{content:"\e607"}.icon-default-alt:before{content:"\e608"}.icon-default-symlink:before{content:"\e609"}.icon-eps:before{content:"\e60a"}.icon-f:before{content:"\e60b"}.icon-f03:before{content:"\e60c"}.icon-f90:before{content:"\e60d"}.icon-f95:before{content:"\e60e"}.icon-F:before{content:"\e60f"}.icon-F03:before{content:"\e610"}.icon-F90:before{content:"\e611"}.icon-F95:before{content:"\e612"}.icon-folder:before{content:"\e613"}.icon-folder-open:before{content:"\e614"}.icon-folder-symlink:before{content:"\e615"}.icon-gif:before{content:"\e616"}.icon-h:before{content:"\e617"}.icon-html:before{content:"\e618"}.icon-ico:before{content:"\e619"}.icon-ini:before{content:"\e61a"}.icon-jade:before{content:"\e61b"}.icon-jpeg:before{content:"\e61c"}.icon-jpg:before{content:"\e61d"}.icon-js:before{content:"\e61e"}.icon-less:before{content:"\e61f"}.icon-lnk:before{content:"\e620"}.icon-log:before{content:"\e621"}.icon-mako:before{content:"\e622"}.icon-pdf:before{content:"\e623"}.icon-png:before{content:"\e624"}.icon-ps:before{content:"\e625"}.icon-pxlio:before{content:"\e626"}.icon-py:before{content:"\e627"}.icon-pyc:before{content:"\e628"}.icon-rar:before{content:"\e629"}.icon-raw:before{content:"\e62a"}.icon-root:before{content:"\e62b"}.icon-sh:before{content:"\e62c"}.icon-svg:before{content:"\e62d"}.icon-tar:before{content:"\e62e"}.icon-targz:before{content:"\e62f"}.icon-tex:before{content:"\e630"}.icon-tif:before{content:"\e631"}.icon-tiff:before{content:"\e632"}.icon-txt:before{content:"\e633"}.icon-xml:before{content:"\e634"}.icon-yaml:before{content:"\e635"}.icon-yml:before{content:"\e636"}.icon-zip:before{content:"\e637"}.icon-bmp,.icon-gif,.icon-ico,.icon-jpeg,.icon-jpg,.icon-png,.icon-raw,.icon-svg,.icon-tif,.icon-tiff{color:#003b0b}.icon-c,.icon-cc,.icon-cpp,.icon-h{color:#3a539b}.icon-f,.icon-f03,.icon-f90,.icon-f95,.icon-F,.icon-F03,.icon-F90,.icon-F95{color:#3a539b}.icon-sh,.icon-csh{color:#3a539b}.icon-css,.icon-html,.icon-jade,.icon-js,.icon-less,.icon-mako{color:#913d88}.icon-tex,.icon-xml,.icon-yaml,.icon-yml{color:#913d88}.icon-py,.icon-pyc{color:#d99305}.icon-pxlio{color:#59abe3}.icon-root{color:#008a1a}.icon-eps,.icon-pdf,.icon-ps{color:#96281b}.icon-rar,.icon-tar,.icon-targz,.icon-zip{color:#4a1402}
\ No newline at end of file
.file-content{-moz-user-select:none;-khtml-user-select:none;-webkit-user-select:none;-o-user-select:none;user-select:none;position:absolute;height:100%;bottom:0;right:0;top:0;left:0;overflow:hidden}.fileselector{height:300px}.actionmenu{position:absolute;display:none}.file-menu{height:0;overflow:auto;visibility:hidden}.table-info-dialog>tbody>tr>td{border:none;border:0;border-top:0}.table-info-dialog-width{width:114px}.table-info-dialog{overflow:hidden;table-layout:fixed;word-wrap:break-word}.file-info-dialog-header{margin-bottom:20px}.filterField{bottom:5px;right:5px;position:absolute;visibility:hidden;width:300px;z-index:99}@font-face{font-family:'file_icons';src:url('../../fonts/file_icons.eot');src:url('../../fonts/file_icons.eot') format('embedded-opentype'),url('../../fonts/file_icons.woff') format('woff'),url('../../fonts/file_icons.ttf') format('truetype'),url('../../fonts/file_icons.svg#file_icons') format('svg');font-weight:normal;font-style:normal}[class^="icon-"],[class*=" icon-"]{font-family:'file_icons';color:#444;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.icon-bmp:before{content:"\e600"}.icon-c:before{content:"\e601"}.icon-cc:before{content:"\e602"}.icon-conf:before{content:"\e603"}.icon-cpp:before{content:"\e604"}.icon-csh:before{content:"\e605"}.icon-css:before{content:"\e606"}.icon-default:before{content:"\e607"}.icon-default-alt:before{content:"\e608"}.icon-default-symlink:before{content:"\e609"}.icon-eps:before{content:"\e60a"}.icon-f:before{content:"\e60b"}.icon-f03:before{content:"\e60c"}.icon-f90:before{content:"\e60d"}.icon-f95:before{content:"\e60e"}.icon-F:before{content:"\e60f"}.icon-F03:before{content:"\e610"}.icon-F90:before{content:"\e611"}.icon-F95:before{content:"\e612"}.icon-folder:before{content:"\e613"}.icon-folder-open:before{content:"\e614"}.icon-folder-symlink:before{content:"\e615"}.icon-gif:before{content:"\e616"}.icon-h:before{content:"\e617"}.icon-html:before{content:"\e618"}.icon-ico:before{content:"\e619"}.icon-ini:before{content:"\e61a"}.icon-jade:before{content:"\e61b"}.icon-jpeg:before{content:"\e61c"}.icon-jpg:before{content:"\e61d"}.icon-js:before{content:"\e61e"}.icon-less:before{content:"\e61f"}.icon-lnk:before{content:"\e620"}.icon-log:before{content:"\e621"}.icon-mako:before{content:"\e622"}.icon-pdf:before{content:"\e623"}.icon-png:before{content:"\e624"}.icon-ps:before{content:"\e625"}.icon-pxlio:before{content:"\e626"}.icon-py:before{content:"\e627"}.icon-pyc:before{content:"\e628"}.icon-rar:before{content:"\e629"}.icon-raw:before{content:"\e62a"}.icon-root:before{content:"\e62b"}.icon-sh:before{content:"\e62c"}.icon-svg:before{content:"\e62d"}.icon-tar:before{content:"\e62e"}.icon-targz:before{content:"\e62f"}.icon-tex:before{content:"\e630"}.icon-tif:before{content:"\e631"}.icon-tiff:before{content:"\e632"}.icon-txt:before{content:"\e633"}.icon-xml:before{content:"\e634"}.icon-yaml:before{content:"\e635"}.icon-yml:before{content:"\e636"}.icon-zip:before{content:"\e637"}.icon-bmp,.icon-gif,.icon-ico,.icon-jpeg,.icon-jpg,.icon-png,.icon-raw,.icon-svg,.icon-tif,.icon-tiff{color:#003b0b}.icon-c,.icon-cc,.icon-cpp,.icon-h{color:#3a539b}.icon-f,.icon-f03,.icon-f90,.icon-f95,.icon-F,.icon-F03,.icon-F90,.icon-F95{color:#3a539b}.icon-sh,.icon-csh{color:#3a539b}.icon-css,.icon-html,.icon-jade,.icon-js,.icon-less,.icon-mako{color:#913d88}.icon-tex,.icon-xml,.icon-yaml,.icon-yml{color:#913d88}.icon-py,.icon-pyc{color:#d99305}.icon-pxlio{color:#59abe3}.icon-root{color:#008a1a}.icon-eps,.icon-pdf,.icon-ps{color:#96281b}.icon-rar,.icon-tar,.icon-targz,.icon-zip{color:#4a1402}
\ No newline at end of file
@brand-success: #5cb85c;
@gray-dark: lighten(#000, 20%);
@gray-lighter: lighten(#000, 93.5%);
@table-bg-hover: #f5f5f5;
......@@ -81,19 +80,6 @@
z-index: 99;
}
/* drag and drop */
.file-dragover {
background-color: @brand-success !important;
opacity: 0.5;
}
.file-dragstart {
opacity: 0.4;
}
[draggable=true] {
cursor: move;
-khtml-user-drag: element;
}
/* font for file icons */
@font-face {
font-family: 'file_icons';
......
.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{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-table{position:absolute;bottom:0;right:0;top:80px;left:0;overflow-y:auto;width:100%}.file-view-table .file-table>.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-table>.node:nth-child(2n){background-color:#f9f9f9}.file-view-table .file-table>.node:hover{background-color:#f5f5f5}.file-view-table .file-table>.node:not(:hover) .edit-tools{visibility:collapse}.file-view-table .file-table>.node[selected]{background-color:#f5f5f5}.file-view-table .file-table>.node>.select{width:70px;text-align:center}.file-view-table .file-table>.node>.icon{text-align:left}.file-view-table .file-table>.node>.name{-webkit-flex:1;flex:1}.file-view-table .file-table>.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-table>.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-table>.node>.name>.input-filename::-webkit-input-placeholder{color:#999}.file-view-table .file-table>.node>.name>.input-filename:-moz-placeholder{color:#999;opacity:1}.file-view-table .file-table>.node>.name>.input-filename::-moz-placeholder{color:#999;opacity:1}.file-view-table .file-table>.node>.name>.input-filename:-ms-input-placeholder{color:#999}.file-view-table .file-table>.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-table>.node>.name .filename-ext{white-space:nowrap;vertical-align:middle}.file-view-table .file-table>.node>.edit-tools{font-size:12px;width:250px;text-align:right}.file-view-table .file-table>.node>.edit-tools .glyphicon{margin-left:14px}.file-view-table .file-table>.node>.edit-tools .glyphicon-pencil{margin-left:4px}@media (max-width:992px){.file-view-table .file-table>.node>.edit-tools{width:110px}.file-view-table .file-table>.node>.edit-tools .glyphicon{margin-left:10px;margin-right:10px}.file-view-table .file-table>.node>.edit-tools .glyphicon-pencil{margin-left:8px}}.file-view-table .file-table>.node>.size{width:120px;text-align:right}.file-view-table .file-table>.node>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-table>.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-table.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-table{position:absolute;bottom:0;right:0;top:80px;left:0;overflow-y:auto;width:100%}.file-view-table .file-table>.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-table>.node:nth-child(2n){background-color:#f9f9f9}.file-view-table .file-table>.node:hover{background-color:#f5f5f5}.file-view-table .file-table>.node:not(:hover) .edit-tools{visibility:collapse}.file-view-table .file-table>.node[selected]{background-color:#f5f5f5}.file-view-table .file-table>.node.dragover{background-color:rgba(92,184,92,0.5) !important}.file-view-table .file-table>.node.dragover-denied{background-color:rgba(217,83,79,0.5) !important}.file-view-table .file-table>.node.dragstart{opacity:.4}.file-view-table .file-table>.node[draggable=true]{cursor:move;-khtml-user-drag:element}.file-view-table .file-table>.node>.select{width:70px;text-align:center}.file-view-table .file-table>.node>.icon{text-align:left}.file-view-table .file-table>.node>.name{-webkit-flex:1;flex:1}.file-view-table .file-table>.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-table>.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-table>.node>.name>.input-filename::-webkit-input-placeholder{color:#999}.file-view-table .file-table>.node>.name>.input-filename:-moz-placeholder{color:#999;opacity:1}.file-view-table .file-table>.node>.name>.input-filename::-moz-placeholder{color:#999;opacity:1}.file-view-table .file-table>.node>.name>.input-filename:-ms-input-placeholder{color:#999}.file-view-table .file-table>.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-table>.node>.name .filename-ext{white-space:nowrap;vertical-align:middle}.file-view-table .file-table>.node>.edit-tools{font-size:12px;width:250px;text-align:right}.file-view-table .file-table>.node>.edit-tools .glyphicon{margin-left:14px}.file-view-table .file-table>.node>.edit-tools .glyphicon-pencil{margin-left:4px}@media (max-width:992px){.file-view-table .file-table>.node>.edit-tools{width:110px}.file-view-table .file-table>.node>.edit-tools .glyphicon{margin-left:10px;margin-right:10px}.file-view-table .file-table>.node>.edit-tools .glyphicon-pencil{margin-left:8px}}.file-view-table .file-table>.node>.size{width:120px;text-align:right}.file-view-table .file-table>.node>.time{width:215px;padding-left:20px;text-align:left}.file-view-table .file-table>.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
......@@ -2,6 +2,8 @@
@screen-md: 992px;
@gray: lighten(#000, 33.5%); // #555
@brand-success: #5cb85c;
@brand-danger: #d9534f;
@table-bg-accent: #f9f9f9;
@table-bg-hover: #f5f5f5;
......@@ -109,6 +111,19 @@
text-align: center;
}
/* hide edit tools on touch displays */
.file-view-table {
.file-table {
&.edit-tools-hidden {
.edit-tools {
color: red !important;
display: none !important;
visibility: hidden !important;
}
}
}
}
/* tale view */
.file-view-table {
......@@ -184,6 +199,19 @@
&[selected] {
background-color: @table-bg-active;
}
&.dragover {
background-color: fade(@brand-success, 50%) !important;
}
&.dragover-denied {
background-color: fade(@brand-danger, 50%) !important;
}
&.dragstart {
opacity: 0.4;
}
&[draggable=true] {
cursor: move;
-khtml-user-drag: element;
}
> .select {
.file-table-select-column;
}
......
......@@ -18,7 +18,7 @@
<input type="checkbox" class="file-selection-checkbox"/></span></div>
<div class="icon"><span data-bind="icon"></span></div>
<div class="name"><span class="completename"><span data-bind="root" class="filename-root"></span><span data-bind="ext" class="filename-ext"></span></span></div>
<div class="edit-tools hidden-xs"><a href="#" class="edit-rename"><i class="glyphicon glyphicon-pencil"></i><span class="hidden-sm hidden-xs">Rename</span></a><a href="#" class="edit-download"><i class="glyphicon glyphicon-download"></i><span class="hidden-sm hidden-xs">Download</span></a>
<div class="edit-tools"><a href="#" class="edit-rename"><i class="glyphicon glyphicon-pencil"></i><span class="hidden-sm hidden-xs">Rename</span></a><a href="#" class="edit-download"><i class="glyphicon glyphicon-download"></i><span class="hidden-sm hidden-xs">Download</span></a>
<!-- a.edit-share(href="#")-->
<!-- i.glyphicon.glyphicon-link-->
<!-- span.hidden-sm.hidden-xs Share--><a href="#" class="edit-remove"><i class="glyphicon glyphicon-remove"></i><span class="hidden-sm hidden-xs">Remove</span></a>
......
......@@ -23,7 +23,7 @@
span.completename
span.filename-root(data-bind="root")
span.filename-ext(data-bind="ext")
.edit-tools.hidden-xs
.edit-tools
a.edit-rename(href="#")
i.glyphicon.glyphicon-pencil
span.hidden-sm.hidden-xs Rename
......
......@@ -178,37 +178,94 @@ var FileBaseEvents = Class.extend({
dragAndDrop: function(node, data) {
var self = this;
// dragstart
node.on("dragstart", function(event) {
event.originalEvent.dataTransfer.setData("dataName", data.name);
$(node).addClass("file-dragstart");
// 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";
}
});
});
// dragover
node.on("dragover", function(event) {
event.preventDefault();
if (data.type == "d") {
var folderToBeMoved = (event.originalEvent.dataTransfer.getData("dataName"));
if (data.name != folderToBeMoved) {
$(node).addClass("file-dragover");
}
}
});
// 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);
}
});
}
}
}
}
});
// dragleave
node.on("dragleave", function(event) {
event.preventDefault();
$(node).removeClass("file-dragover");
// 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);
}
}
});
// drop
node.on("drop", function(event) {
event.preventDefault();
$(node).removeClass("file-dragover");
$(node).toggleClass("dragover", false);
$(node).toggleClass("dragover-denied", false);
var fileToBeMoved = (event.originalEvent.dataTransfer.getData("dataName"));
// if transfered data empty: upload
// if transfered data empty: upload file
var path = "";
if (fileToBeMoved === "") {
// set path of file/folder to move
if (data.type == "d") {
path = self.FileBase.workflow.path + "/" + data.name;
} else {
......@@ -216,7 +273,7 @@ var FileBaseEvents = Class.extend({
}
self.FileBase.actions.upload(path);
}
// if transfered data not empty: move
// if transfered data not empty: move file
else {
if (data.type == "d") {
var source = self.FileBase.workflow.path + "/" + fileToBeMoved;
......@@ -228,10 +285,13 @@ var FileBaseEvents = Class.extend({
}
});
// dragend
node.on("dragend", function(event) {
event.preventDefault();
$(node).removeClass("file-dragover");
$(node).removeClass("file-dragstart");
// remove all potential set css classes
$(node).toggleClass("dragover", false);
$(node).toggleClass("dragover-denied", false);
$(node).toggleClass("dragstart", false);
});
},
});
......@@ -47,10 +47,15 @@ var Tableview = Class.extend({
self.resizeHeader();
});
// make edit buttons clickable
self.makeEditButtonsClickable();
// make edit buttons clickable, only when display is no touch display
if (vispa.device.hasTouch) {
$(".file-table", this.fileContentContainer).toggleClass("edit-tools-hidden", true);
}
else {
self.makeEditButtonsClickable();
}
// make select-all-checkboc clickable
// make select-all-checkbox clickable
$(".select-all", self.fileContentContainer).click(function() {
setTimeout(function() {
$(this).prop("checked", $(this).prop("checked") ? "" : "checked");
......
......@@ -438,7 +438,7 @@ class FileSystem(object):
})
def checkPermissions(self, path):
return os.access(path, os.W_OK)
return os.access(path, os.W_OK)
def save_file_content(self, filename, content,
path=None, force=True, append=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