Commit 2f5d1026 by Dirk Benkert

limited file upload to 250M to match Uberspace server config

parent dfee9b04
......@@ -21,19 +21,15 @@
* limitations under the License.
*/
?>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $this->translate('Upload files'); ?></h4>
</div>
<div class="mod modFile">
<div class="inner">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel"><?php echo $this->translate('Upload files'); ?></h4>
</div>
<form method="post" id="uploadForm" action="<?php echo $this->url('application/default', array('controller' => 'files', 'action' => 'save')); ?>">
<div class="modal-body">
<!-- <div class="form-group">
<div class="col-sm-8 col-sm-offset-4">
<p><?php echo $this->translate('The upload of larger files may take some time, depending on your internet connection. Do not close this window!'); ?></p>
</div>
</div> -->
<?php
$form->prepare();
echo $this->formElement($form->get('id'));
......@@ -52,6 +48,10 @@
);
}
?>
<div>
<p><?php echo $this->translate('The upload of larger files may take some time, depending on your internet connection. Do not close this window!'); ?></p>
<p><?php echo $this->translate('If you upload multiple files make sure the sum is not larger than 250MB!'); ?></p>
</div>
<div class="form-group <?php echo $errorClass; ?>">
<?php echo $errorMessages; ?>
<div class="dropzone" id="my-awesome-dropzone"></div>
......
......@@ -5613,12 +5613,14 @@ define('modules/File',['require','jquery','Module','dropzone'],function(require)
initForm: function() {
var locale = this.sandbox.get('locale');
var that = this;
Dropzone.autoDiscover = false;
// The camelized version of the ID of the form element
Dropzone.options.myAwesomeDropzone = {
// The configuration we've talked about above
autoProcessQueue: false,
maxFilesize: 1024,
maxFilesize: 250,
uploadMultiple: true,
parallelUploads: 3,
url: jQuery('#uploadForm').attr('action'),
......@@ -5644,6 +5646,7 @@ define('modules/File',['require','jquery','Module','dropzone'],function(require)
init: function() {
var myDropzone = this;
var fileCount = 0;
var doNotReload = false;
// First change the button to actually tell Dropzone to process the queue.
jQuery("#submitFile").on("click", function(e) {
......@@ -5661,13 +5664,16 @@ define('modules/File',['require','jquery','Module','dropzone'],function(require)
myDropzone.processQueue();
} else {
jQuery('#dialog').modal('hide');
window.location.reload();
if (doNotReload == false) {
window.location.reload();
}
}
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
console.log(response);
doNotReload = true;
that.showError(response);
});
this.on("complete", function(file) {
jQuery(file.previewElement).fadeOut();
......@@ -5685,19 +5691,12 @@ define('modules/File',['require','jquery','Module','dropzone'],function(require)
}
};
jQuery("div#my-awesome-dropzone").dropzone();
},
// jQuery("#input-id").fileinput({
// showCaption: true,
// showPreview: false,
// showRemove: true,
// showUpload: false,
// showCancel: false
// });
//
// var AjaxForm = this.sandbox.getPlugin('AjaxForm');
// jQuery.when(AjaxForm).done(function(form) {
// form.run(jQuery('.modal-content'));
// });
showError: function (message) {
jQuery('.alertBox').append('<div class="alert alert-danger alert-dismissable">'
+ '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'
+ '<span>'+message+'</span></div>');
},
onHtmlResponse: function() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -71,12 +71,14 @@ define(function(require) {
initForm: function() {
var locale = this.sandbox.get('locale');
var that = this;
Dropzone.autoDiscover = false;
// The camelized version of the ID of the form element
Dropzone.options.myAwesomeDropzone = {
// The configuration we've talked about above
autoProcessQueue: false,
maxFilesize: 1024,
maxFilesize: 250,
uploadMultiple: true,
parallelUploads: 3,
url: jQuery('#uploadForm').attr('action'),
......@@ -102,6 +104,7 @@ define(function(require) {
init: function() {
var myDropzone = this;
var fileCount = 0;
var doNotReload = false;
// First change the button to actually tell Dropzone to process the queue.
jQuery("#submitFile").on("click", function(e) {
......@@ -119,13 +122,16 @@ define(function(require) {
myDropzone.processQueue();
} else {
jQuery('#dialog').modal('hide');
window.location.reload();
if (doNotReload == false) {
window.location.reload();
}
}
});
this.on("errormultiple", function(files, response) {
// Gets triggered when there was an error sending the files.
// Maybe show form again, and notify user of error
console.log(response);
doNotReload = true;
that.showError(response);
});
this.on("complete", function(file) {
jQuery(file.previewElement).fadeOut();
......@@ -143,19 +149,12 @@ define(function(require) {
}
};
jQuery("div#my-awesome-dropzone").dropzone();
},
// jQuery("#input-id").fileinput({
// showCaption: true,
// showPreview: false,
// showRemove: true,
// showUpload: false,
// showCancel: false
// });
//
// var AjaxForm = this.sandbox.getPlugin('AjaxForm');
// jQuery.when(AjaxForm).done(function(form) {
// form.run(jQuery('.modal-content'));
// });
showError: function (message) {
jQuery('.alertBox').append('<div class="alert alert-danger alert-dismissable">'
+ '<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>'
+ '<span>'+message+'</span></div>');
},
onHtmlResponse: function() {
......
......@@ -21,10 +21,6 @@
*/
.modFile {
.inner {
min-height: 150px;
}
.dz-message {
border: 1px solid #cccccc;
border-radius: 4px;
......
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 sign in to comment