From cca91db5fcf85b095b98e275ed53a1cd799e8d7e Mon Sep 17 00:00:00 2001 From: llj Date: Sat, 12 Aug 2017 17:58:21 +0800 Subject: [PATCH] [system admin] settings: fix & improvement --- media/css/seahub.css | 5 +++ seahub/settings.py | 5 +-- .../templates/snippets/web_settings_form.html | 15 +++++++++ seahub/templates/sysadmin/settings.html | 33 ++++++++++--------- 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/media/css/seahub.css b/media/css/seahub.css index 83548fedf6..506569f054 100644 --- a/media/css/seahub.css +++ b/media/css/seahub.css @@ -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; diff --git a/seahub/settings.py b/seahub/settings.py index f108fb3d50..d55ad60d54 100644 --- a/seahub/settings.py +++ b/seahub/settings.py @@ -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 diff --git a/seahub/templates/snippets/web_settings_form.html b/seahub/templates/snippets/web_settings_form.html index 22dda8d6c5..d3f031abcd 100644 --- a/seahub/templates/snippets/web_settings_form.html +++ b/seahub/templates/snippets/web_settings_form.html @@ -15,6 +15,21 @@ {% endif %} +{% if type == 'textarea' %} +
+
{{ setting_display_name }}
+
+ +

+

{{ help_tip }}

+
+
+ + +
+
+{% endif %} + {% if type == 'checkbox' %}
{% csrf_token %}
{{ setting_display_name }}
diff --git a/seahub/templates/sysadmin/settings.html b/seahub/templates/sysadmin/settings.html index d3a6d88097..cd24eeb529 100644 --- a/seahub/templates/sysadmin/settings.html +++ b/seahub/templates/sysadmin/settings.html @@ -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 %} + +

{% trans "Online Preview" %}

+ + {% 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 %}