Commit 17559935 authored by Fabian-Andree Heidemann's avatar Fabian-Andree Heidemann
Browse files

Change upload from blueimp jquery-file-upload to bootstrap-fileinput:

- adjust controller
- add some css
- change upload function
parent 3d15786d
......@@ -233,14 +233,14 @@ class FSAjaxController(AbstractController):
# extract the path
# prepare the parts
parts = kwargs['files[]']
parts = kwargs['file_data']
# force parts to be a list
if not isinstance(parts, list):
parts = [parts]
path = kwargs['path']
filename = fs.handle_file_name_collision(parts[0].filename, path)
for part in parts:
filename = fs.handle_file_name_collision(part.filename, path)
append = False
force = True
while True:
......
.file-rightclickmenu-itemhide{display:none;visibility:hidden}.file-rightclickmenu-itemshow{display:block;visibility:visible}.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}.file-content>.alert{position:absolute;top:40px;width:100%}.fileselector{height:300px}.fileselector>.file-content>.alert{top:55px}.fileselector .file-path-bar{position:absolute;top:3px}.file-rightclickmenu{position:absolute}.file-rightclickmenu .glyphicon,.file-rightclickmenu .fa{margin:0 10px 0 0 !important}.file-rightclickmenu.filemenu .openFile,.file-rightclickmenu.filemenu .rename,.file-rightclickmenu.filemenu .copy,.file-rightclickmenu.filemenu .cut,.file-rightclickmenu.filemenu .remove,.file-rightclickmenu.filemenu .download,.file-rightclickmenu.filemenu .compress,.file-rightclickmenu.filemenu .divider,.file-rightclickmenu.filemenu .info{display:block;visibility:visible}.file-rightclickmenu.filemenu .openFolder,.file-rightclickmenu.filemenu .createFile,.file-rightclickmenu.filemenu .createFolder,.file-rightclickmenu.filemenu .upload,.file-rightclickmenu.filemenu .paste{display:none;visibility:hidden}.file-rightclickmenu.foldermenu .openFolder,.file-rightclickmenu.foldermenu .rename,.file-rightclickmenu.foldermenu .copy,.file-rightclickmenu.foldermenu .cut,.file-rightclickmenu.foldermenu .remove,.file-rightclickmenu.foldermenu .compress,.file-rightclickmenu.foldermenu .divider,.file-rightclickmenu.foldermenu .info{display:block;visibility:visible}.file-rightclickmenu.foldermenu .openFile,.file-rightclickmenu.foldermenu .createFile,.file-rightclickmenu.foldermenu .createFolder,.file-rightclickmenu.foldermenu .download,.file-rightclickmenu.foldermenu .upload,.file-rightclickmenu.foldermenu .paste{display:none;visibility:hidden}.file-rightclickmenu.bkgmenu .createFile,.file-rightclickmenu.bkgmenu .createFolder,.file-rightclickmenu.bkgmenu .upload{display:block;visibility:visible}.file-rightclickmenu.bkgmenu .openFile,.file-rightclickmenu.bkgmenu .openFolder,.file-rightclickmenu.bkgmenu .rename,.file-rightclickmenu.bkgmenu .copy,.file-rightclickmenu.bkgmenu .cut,.file-rightclickmenu.bkgmenu .remove,.file-rightclickmenu.bkgmenu .compress,.file-rightclickmenu.bkgmenu .info,.file-rightclickmenu.bkgmenu .download{display:none;visibility:hidden}.file-rightclickmenu.selectionmenu .copy,.file-rightclickmenu.selectionmenu .cut,.file-rightclickmenu.selectionmenu .remove,.file-rightclickmenu.selectionmenu .compress,.file-rightclickmenu.selectionmenu .divider,.file-rightclickmenu.selectionmenu .info{display:block;visibility:visible}.file-rightclickmenu.selectionmenu .download,.file-rightclickmenu.selectionmenu .openFile,.file-rightclickmenu.selectionmenu .openFolder,.file-rightclickmenu.selectionmenu .rename,.file-rightclickmenu.selectionmenu .createFile,.file-rightclickmenu.selectionmenu .createFolder,.file-rightclickmenu.selectionmenu .upload,.file-rightclickmenu.selectionmenu .paste{display:none;visibility:hidden}.table-info-dialog>tbody>tr>td{border:none;border: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}
\ No newline at end of file
.file-rightclickmenu-itemhide{display:none;visibility:hidden}.file-rightclickmenu-itemshow{display:block;visibility:visible}.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}.file-content>.alert{position:absolute;top:40px;width:100%}.file-input{width:100%;position:absolute;bottom:0;padding:6px 12px}.fileselector{height:300px}.fileselector>.file-content>.alert{top:55px}.fileselector .file-path-bar{position:absolute;top:3px}.file-rightclickmenu{position:absolute}.file-rightclickmenu .glyphicon,.file-rightclickmenu .fa{margin:0 10px 0 0 !important}.file-rightclickmenu.filemenu .openFile,.file-rightclickmenu.filemenu .rename,.file-rightclickmenu.filemenu .copy,.file-rightclickmenu.filemenu .cut,.file-rightclickmenu.filemenu .remove,.file-rightclickmenu.filemenu .download,.file-rightclickmenu.filemenu .compress,.file-rightclickmenu.filemenu .divider,.file-rightclickmenu.filemenu .info{display:block;visibility:visible}.file-rightclickmenu.filemenu .openFolder,.file-rightclickmenu.filemenu .createFile,.file-rightclickmenu.filemenu .createFolder,.file-rightclickmenu.filemenu .upload,.file-rightclickmenu.filemenu .paste{display:none;visibility:hidden}.file-rightclickmenu.foldermenu .openFolder,.file-rightclickmenu.foldermenu .rename,.file-rightclickmenu.foldermenu .copy,.file-rightclickmenu.foldermenu .cut,.file-rightclickmenu.foldermenu .remove,.file-rightclickmenu.foldermenu .compress,.file-rightclickmenu.foldermenu .divider,.file-rightclickmenu.foldermenu .info{display:block;visibility:visible}.file-rightclickmenu.foldermenu .openFile,.file-rightclickmenu.foldermenu .createFile,.file-rightclickmenu.foldermenu .createFolder,.file-rightclickmenu.foldermenu .download,.file-rightclickmenu.foldermenu .upload,.file-rightclickmenu.foldermenu .paste{display:none;visibility:hidden}.file-rightclickmenu.bkgmenu .createFile,.file-rightclickmenu.bkgmenu .createFolder,.file-rightclickmenu.bkgmenu .upload{display:block;visibility:visible}.file-rightclickmenu.bkgmenu .openFile,.file-rightclickmenu.bkgmenu .openFolder,.file-rightclickmenu.bkgmenu .rename,.file-rightclickmenu.bkgmenu .copy,.file-rightclickmenu.bkgmenu .cut,.file-rightclickmenu.bkgmenu .remove,.file-rightclickmenu.bkgmenu .compress,.file-rightclickmenu.bkgmenu .info,.file-rightclickmenu.bkgmenu .download{display:none;visibility:hidden}.file-rightclickmenu.selectionmenu .copy,.file-rightclickmenu.selectionmenu .cut,.file-rightclickmenu.selectionmenu .remove,.file-rightclickmenu.selectionmenu .compress,.file-rightclickmenu.selectionmenu .divider,.file-rightclickmenu.selectionmenu .info{display:block;visibility:visible}.file-rightclickmenu.selectionmenu .download,.file-rightclickmenu.selectionmenu .openFile,.file-rightclickmenu.selectionmenu .openFolder,.file-rightclickmenu.selectionmenu .rename,.file-rightclickmenu.selectionmenu .createFile,.file-rightclickmenu.selectionmenu .createFolder,.file-rightclickmenu.selectionmenu .upload,.file-rightclickmenu.selectionmenu .paste{display:none;visibility:hidden}.table-info-dialog>tbody>tr>td{border:none;border: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}/*# sourceMappingURL=base.css.map */
\ No newline at end of file
......@@ -4,6 +4,9 @@
@table-border-color: #ddd;
@breadcrumb-bg: #f5f5f5;
@breadcrumb-padding-vertical: 8px;
@padding-base-vertical: 6px;
@padding-base-horizontal: 12px;
.file-rightclickmenu-itemhide {
display: none;
......@@ -34,6 +37,14 @@
width: 100%;
}
}
.file-input {
width: 100%;
position: absolute;
bottom: 0px;
padding: @padding-base-vertical @padding-base-horizontal;
}
/* file selector */
.fileselector {
......
......@@ -398,31 +398,28 @@ define(["jquery", "jclass"], function($, JClass) {
},
upload: function(path) {
// blueimp jquery file upload
// bootstrap fileinput
var self = this;
if (path === undefined) {
path = this.FileBase.instance.getState("path");
}
$("<input />")
.attr({
type: "file",
name: "files[]",
"multiple": true
}).css("display", "none")
.appendTo(this.FileBase.instance._nodes.content)
.fileupload({
url: vispa.url.dynamic("ajax/fs/upload?path=" + path +
"&_workspaceId=" + String(self.FileBase.instance.getWorkspaceId())),
done: function() {
//self.FileBase.updateView();
vispa.messenger.info("Upload succeeded", "glyphicon glyphicon-ok-sign");
$(this).remove();
},
fail: function() {
vispa.messenger.info("Upload failed", "glyphicon glyphicon-warning-sign");
$(this).remove();
}
}).trigger("click");
var input = $("<input />");
input.attr({
"type": "file",
"multiple": true,
"data-show-preview": false,
});
input.appendTo(this.FileBase.instance._nodes.content)
input.fileinput({
uploadUrl: vispa.url.dynamic("ajax/fs/upload?path=" + path +
"&_workspaceId=" + String(self.FileBase.instance.getWorkspaceId())),
});
// add close button
var closeButton = $("<div class='btn btn-danger'><i class='glyphicon glyphicon-remove'></i>close</div>")
.appendTo(input.parent().parent());
closeButton.on(vispa.hasTouch? "tab": "click", function(event) {
$(".file-input").remove();
});
},
filter: function() {
......
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