mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 19:01:42 +00:00
[file update] checked file size before upload & fixed upload-cancel bug
This commit is contained in:
@@ -259,10 +259,10 @@
|
||||
<h3>{% trans "Library Settings" %}</h3>
|
||||
<label>{% trans "History" %}</label><br />
|
||||
<input type="hidden" name="repo_id" value="{{ repo.id }}" />
|
||||
<input type="radio" name="history" value="full_history" {% if history_limit < 0 %}checked="checked"{% endif %} /> {% trans "Keep full history" %}<br />
|
||||
<input type="radio" name="history" value="no_history" {% if history_limit == 0 %}checked="checked"{% endif %} /> {% trans "Don't keep history" %}<br />
|
||||
<input type="radio" name="history" value="partial_history" {% if history_limit > 0 %}checked="checked"{% endif %} /> {% trans "Only keep a period of history:" %}
|
||||
<input type="text" name="days" size="4" {% if history_limit <= 0 %} disabled="disabled" class="input-disabled" {% else %} value="{{history_limit}}" {% endif %} /> {% trans "days" %}<br />
|
||||
<input type="radio" name="history" value="full_history" {% if history_limit < 0 %}checked="checked"{% endif %} /> {% trans "Keep full history" %}<br />
|
||||
<input type="radio" name="history" value="no_history" {% if history_limit == 0 %}checked="checked"{% endif %} /> {% trans "Don't keep history" %}<br />
|
||||
<input type="radio" name="history" value="partial_history" {% if history_limit > 0 %}checked="checked"{% endif %} /> {% trans "Only keep a period of history:" %}
|
||||
<input type="text" name="days" size="4" {% if history_limit <= 0 %} disabled="disabled" class="input-disabled" {% else %} value="{{history_limit}}" {% endif %} /> {% trans "days" %}<br />
|
||||
<p class="error hide"></p>
|
||||
<input type="submit" value="{% trans "Submit" %}" class="submit" />
|
||||
<button class="simplemodal-close">{% trans "Cancel" %}</button>
|
||||
|
@@ -64,7 +64,6 @@ $('#upload-file-form .submit').click(function () {
|
||||
}
|
||||
|
||||
$('#upload-file-form .error').addClass('hide');
|
||||
|
||||
$.fn.MultiFile.disableEmpty(); // disable dummy element before submiting the form
|
||||
submitAndShowProgress($('#upload-file-form'), $('#upload-progress-con'))
|
||||
return false;
|
||||
@@ -76,12 +75,23 @@ $('#update-file-form .submit').click(function () {
|
||||
$('#update-file-form .error').html('{% trans "Please choose a file at first." %}').removeClass('hide');
|
||||
return false;
|
||||
}
|
||||
var file = $('#file-update-input')[0];
|
||||
var size = 0;
|
||||
if (file.files && file.files.length > 0) {
|
||||
size = file.files[0].size;
|
||||
}
|
||||
|
||||
if (size > {{ max_upload_file_size }}) {
|
||||
$('#update-file-form .error').html('{% trans "File size surpasses the limit." %}').removeClass('hide');
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#update-file-form .error').addClass('hide');
|
||||
submitAndShowProgress($('#update-file-form'), $('#update-progress-con'))
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#upload-progress-con .upload-cancel, #update-progress-con .unload-cancel').click(function() {
|
||||
$('.upload-cancel').click(function() {
|
||||
location.reload();
|
||||
});
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user