mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-25 14:50:29 +00:00
[system admin] settings: fix & improvement
This commit is contained in:
@@ -3659,6 +3659,11 @@ img.thumbnail {
|
||||
.web-setting-input .input {
|
||||
margin:0;
|
||||
}
|
||||
.web-setting-input .textarea {
|
||||
box-sizing:content-box;
|
||||
height:95px;
|
||||
margin:0;
|
||||
}
|
||||
.web-setting-ops {
|
||||
width:100px;
|
||||
vertical-align:top;
|
||||
|
@@ -326,10 +326,7 @@ FILE_ENCODING_LIST = ['auto', 'utf-8', 'gbk', 'ISO-8859-1', 'ISO-8859-5']
|
||||
FILE_ENCODING_TRY_LIST = ['utf-8', 'gbk']
|
||||
HIGHLIGHT_KEYWORD = False # If True, highlight the keywords in the file when the visit is via clicking a link in 'search result' page.
|
||||
# extensions of previewed files
|
||||
TEXT_PREVIEW_EXT = """ac, am, bat, c, cc, cmake, cpp, cs, css, diff, el, h, html,
|
||||
htm, java, js, json, less, make, org, php, pl, properties, py, rb,
|
||||
scala, script, sh, sql, txt, text, tex, vi, vim, xhtml, xml, log, csv,
|
||||
groovy, rst, patch, go"""
|
||||
TEXT_PREVIEW_EXT = """ac, am, bat, c, cc, cmake, cpp, cs, css, diff, el, h, html, htm, java, js, json, less, make, org, php, pl, properties, py, rb, scala, script, sh, sql, txt, text, tex, vi, vim, xhtml, xml, log, csv, groovy, rst, patch, go"""
|
||||
|
||||
# Common settings(file extension, storage) for avatar and group avatar.
|
||||
AVATAR_FILE_STORAGE = '' # Replace with 'seahub.base.database_storage.DatabaseStorage' if save avatar files to database
|
||||
|
@@ -15,6 +15,21 @@
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if type == 'textarea' %}
|
||||
<form class="web-setting-form web-textarea-setting-form" action="">
|
||||
<h5 class="web-setting-name">{{ setting_display_name }}</h5>
|
||||
<div class="web-setting-input">
|
||||
<textarea class="textarea" name="{{ setting_name }}" data-cur="{{ setting_val }}">{{ setting_val }}</textarea>
|
||||
<p class="error hide"></p>
|
||||
<p class="tip">{{ help_tip }}</p>
|
||||
</div>
|
||||
<div class="web-setting-ops">
|
||||
<button type="submit" class="submit sf2-icon-tick tick-green vam hide" title="{% trans "Submit" %}"></button>
|
||||
<button type="button" class="cancel sf2-icon-x2 vam hide" title="{% trans "Cancel" %}"></button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% if type == 'checkbox' %}
|
||||
<form class="web-setting-form web-checkbox-setting-form" action="">{% csrf_token %}
|
||||
<h5 class="web-setting-name">{{ setting_display_name }}</h5>
|
||||
|
@@ -43,7 +43,7 @@
|
||||
|
||||
{% with type="checkbox" setting_name="ACTIVATE_AFTER_REGISTRATION" setting_val=config_dict.ACTIVATE_AFTER_REGISTRATION %}
|
||||
{% trans "activate after registration" as setting_display_name %}
|
||||
{% trans "Activate user immediately after registration. If unchecked, an user need to be activated by administrator or via activation email" as help_tip %}
|
||||
{% trans "Activate user immediately after registration. If unchecked, a user need to be activated by administrator or via activation email" as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -116,13 +116,13 @@
|
||||
|
||||
{% with type="checkbox" setting_name="ENABLE_REPO_HISTORY_SETTING" setting_val=config_dict.ENABLE_REPO_HISTORY_SETTING %}
|
||||
{% trans "library history" as setting_display_name %}
|
||||
{% trans "Allow user to keep library history" as help_tip %}
|
||||
{% trans "Allow user to change library history settings" as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
{% with type="checkbox" setting_name="ENABLE_ENCRYPTED_LIBRARY" setting_val=config_dict.ENABLE_ENCRYPTED_LIBRARY %}
|
||||
{% trans "encrypted library" as setting_display_name %}
|
||||
{% trans "Allow user to create encrypted library" as help_tip %}
|
||||
{% trans "Allow user to create encrypted libraries" as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -132,18 +132,22 @@
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
{% with type="input" setting_name="SHARE_LINK_PASSWORD_MIN_LENGTH" setting_val=config_dict.SHARE_LINK_PASSWORD_MIN_LENGTH %} {% include "snippets/web_settings_form.html" %}
|
||||
{% with type="input" setting_name="SHARE_LINK_PASSWORD_MIN_LENGTH" setting_val=config_dict.SHARE_LINK_PASSWORD_MIN_LENGTH %}
|
||||
{% trans "download/upload link password minimum length" as setting_display_name %}
|
||||
{% trans "The least number of characters a download/upload link password should include." as help_tip %}
|
||||
{% endwith %}
|
||||
|
||||
{% with type="checkbox" setting_display_name="ENABLE_USER_CREATE_ORG_REPO" setting_name="ENABLE_USER_CREATE_ORG_REPO" setting_val=config_dict.ENABLE_USER_CREATE_ORG_REPO %}
|
||||
{% trans "Allow user to add organization library. If unchecked, only system admin can add library." as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
{% with type="input" setting_display_name="Preview File Extensions" setting_name="TEXT_PREVIEW_EXT" setting_val=config_dict.TEXT_PREVIEW_EXT %}
|
||||
{% trans "Extensions of online previewed files, each suffix is separated by a comma." as help_tip %}
|
||||
{% with type="checkbox" setting_display_name="ENABLE_USER_CREATE_ORG_REPO" setting_name="ENABLE_USER_CREATE_ORG_REPO" setting_val=config_dict.ENABLE_USER_CREATE_ORG_REPO %}
|
||||
{% trans "Allow user to add organization libraries. Otherwise, only system admin can add organization libraries." as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
<h4>{% trans "Online Preview" %}</h4>
|
||||
|
||||
{% with type="textarea" setting_name="TEXT_PREVIEW_EXT" setting_val=config_dict.TEXT_PREVIEW_EXT %}
|
||||
{% trans "text file extensions" as setting_display_name %}
|
||||
{% trans "Extensions of text files that can be online previewed, each suffix is separated by a comma." as help_tip %}
|
||||
{% include "snippets/web_settings_form.html" %}
|
||||
{% endwith %}
|
||||
|
||||
@@ -158,12 +162,11 @@
|
||||
|
||||
{% block extra_script %}
|
||||
<script type="text/javascript">
|
||||
$('.web-setting-form .input').focus(function() {
|
||||
$('.input, .textarea', $('.web-setting-form')).focus(function() {
|
||||
var $otherFormSubmit = $('.web-setting-form .submit:visible');
|
||||
if ($otherFormSubmit.length > 0) {
|
||||
$otherFormSubmit.siblings('.cancel').click();
|
||||
}
|
||||
|
||||
var $form = $(this).closest('form');
|
||||
$('.submit, .cancel', $form).show();
|
||||
});
|
||||
@@ -178,7 +181,7 @@ $('.web-setting-form .cancel').click(function() {
|
||||
$(document).click(function(e) {
|
||||
var target = e.target || event.srcElement;
|
||||
var $op = $('.web-setting-form .submit:visible');
|
||||
if ($op.length && !$('.input, .submit, .cancel', $op.closest('form')).is(target)) {
|
||||
if ($op.length && !$('.input, .textarea, .submit, .cancel', $op.closest('form')).is(target)) {
|
||||
$('.cancel', $op.closest('form')).click();
|
||||
}
|
||||
});
|
||||
@@ -208,10 +211,10 @@ $('.web-setting-checkbox').change(function() {
|
||||
});
|
||||
});
|
||||
|
||||
$('.web-input-setting-form').submit(function() {
|
||||
$('.web-input-setting-form, .web-textarea-setting-form').submit(function() {
|
||||
var $form = $(this),
|
||||
$error = $form.find('.error'),
|
||||
$input = $form.find('.input'),
|
||||
$input = $form.hasClass('web-input-setting-form') ? $('.input', $form) : $('.textarea', $form),
|
||||
$sb_btn = $('.submit', $form),
|
||||
$cancel_btn = $('.cancel', $form),
|
||||
key = $input.attr('name'),
|
||||
|
Reference in New Issue
Block a user