2du 4 лет назад
Родитель
Сommit
38e21405c2
8 измененных файлов с 70 добавлено и 21 удалено
  1. 15 12
      lang/en-US.json
  2. 5 2
      lang/ko-KR.json
  3. 3 0
      route/edit.py
  4. 3 0
      route/edit_move.py
  5. 15 2
      route/main_func_setting_main.py
  6. 25 3
      route/tool/func.py
  7. 1 1
      version.json
  8. 3 1
      views/main_css/js/render_onmark.js

+ 15 - 12
lang/en-US.json

@@ -22,8 +22,8 @@
         "port" : "Port",
         "restart" : "Restart",
         "shutdown" : "Shutdown",
-        "document_name" : "Document[s] name",
-        "discussion_name" : "Discussion[s] topic",
+        "document_name" : "Documents name",
+        "discussion_name" : "Discussions topic",
         "user_name" : "Username",
         "go" : "Go",
         "document" : "Document",
@@ -141,8 +141,8 @@
         "edit_filter_rule" : "Contents filter rule",
         "move_history" : "History of moveing",
         "other_tool" : "Other tools",
-        "admin_tool" : "Administrator[s] tools",
-        "check_user" : "Check user[s] login history",
+        "admin_tool" : "Administrators tools",
+        "check_user" : "Check users login history",
         "compare_target" : "Comparison target name",
         "authorize" : "Authorize",
         "indexing" : "Database Indexing",
@@ -175,8 +175,8 @@
         "edit_button_paragraph" : "Paragraph",
         "password_change" : "Change password",
         "email_change" : "Change email",
-        "acl_change" : "Change document[s] ACL",
-        "user_tool" : "User[s] tools",
+        "acl_change" : "Change documents ACL",
+        "user_tool" : "Users tools",
         "skin_info" : "Skin information",
         "closed_discussion" : "Closed discussions",
         "agreed_discussion" : "Agreed discussions",
@@ -218,7 +218,7 @@
         "2fa_password_change" : "Change 2FA password",
         "history_reset" : "Document history reset",
         "record_reset" : "User edit log reset",
-        "today_doc" : "Today[s] document",
+        "today_doc" : "Todays document",
         "send_edit" : "Modify reason",
         "password_instead_key" : "Authentication key",
         "key_change" : "Change key",
@@ -269,13 +269,13 @@
                 "edit_set" : "Edit-related settings",
                 "communication_set" : "Communication-related settings",
     
-                "wiki_name" : "Wiki[s] name",
-                "wiki_logo" : "Wiki[s] logo",
+                "wiki_name" : "Wikis name",
+                "wiki_logo" : "Wikis logo",
                 "main_page" : "Main page",
                 "bottom_text" : "License text",
                 "max_file_size" : "Max file size",
                 "backup_interval" : "Backup Cycles",
-                "wiki_skin" : "Wiki[s] default Skin",
+                "wiki_skin" : "Wikis default Skin",
                 "no_register" : "Disallow signing up",
                 "hide_ip" : "Hide IP address",
                 "wiki_host" : "Wiki host address",
@@ -293,6 +293,8 @@
                 "enable_comment_function" : "Using the comment function",
                 "enable_challenge_function" : "Using the challenge function",
                 "tls_method" : "TLS method",
+                "title_max_length" : "Documents title maximum length",
+                "title_topic_max_length" : "Discussions topic maximum length",
             "_comment_2.2.3_" : "Text",
                 "register_text" : "Terms of sign-up",
                 "non_login_alert" : "Non-login alert",
@@ -412,7 +414,7 @@
         "user_reset_sign" : "Your account information has changed like this.",
         "default_edit_help" : "Describe it here",
         "markup_enabled" : "Markup enabled",
-        "many_delete_help" : "Please write down the document[s] name one by one on the line.",
+        "many_delete_help" : "Please write down the documents name one by one on the line.",
         "sqlite_only" : "SQLite only",
         "approval_question_visible_only_when_approval_on" : "Approval questions are visible only when approval requirement is on",
         "msg_whatchlist_lmt": "You can add as many as",
@@ -443,7 +445,7 @@
             "password_diffrent_error" : "Reconfirm password and input password are different.",
             "edit_filter_error" : "Censored by edit filter.",
             "file_name_error" : "Only English alphabets, Korean alphabets, spaces, underscore, and hyphens are allowed for the file name.",
-            "topic_long_error" : "The discussion[s] topic must not exceed 256 characters.",
+            "topic_long_error" : "The discussions topic must not exceed 256 characters.",
             "email_error" : "No one has this email.",
             "regex_error" : "There is an error in the regular expression.",
             "decument_404_error" : "This document does not exist.",
@@ -458,6 +460,7 @@
             "same_email_error" : "There are users using the same email.",
             "input_email_error" : "There is a problem with the input value.",
             "error_edit_send_request" : "Entering a reason is required.",
+            "error_title_length_too_long" : "Documents title or Discussion topic length is too long. Maximum number of characters : ",
         "_comment_3.2_" : "Warning",
             "http_warning" : "Warning: If you are not on HTTPS connection, your information can be leaked. The users themselves have responsibility to any problems that happen because of this.",
             "user_head_warning" : "User data will be deleted if you close the browser or when you sign in.",

+ 5 - 2
lang/ko-KR.json

@@ -160,7 +160,7 @@
     "admin_group": "관리자 그룹",
     "all": "전체",
     "error_skin_set": "사용 중인 스킨은 스킨 설정 기능을 지원하지 않습니다.",
-    "error_skin_set_old" : "일부 오래된 스킨은 구버전 링크를 이용해야만 작동할 수도 있습니다.",
+    "error_skin_set_old": "일부 오래된 스킨은 구버전 링크를 이용해야만 작동할 수도 있습니다.",
     "member": "가입자",
     "backlink": "역링크",
     "no_admin_block_error": "관리자를 검사하거나 차단할 수 없습니다.",
@@ -440,5 +440,8 @@
     "enable_comment_function": "댓글 기능 사용",
     "enable_challenge_function": "도전과제 기능 사용",
     "error_edit_send_request": "편집 사유가 필요합니다.",
-    "tls_method": "TLS 방식"
+    "tls_method": "TLS 방식",
+    "title_max_length": "문서 제목 최대 길이",
+    "title_topic_max_length": "토론 제목 최대 길이",
+    "error_title_length_too_long": "문서 제목이나 토론 제목의 길이가 너무 깁니다. 최대 글자 수 : "
 }

+ 3 - 0
route/edit.py

@@ -8,6 +8,9 @@ def edit(name = 'Test', name_load = 0, section = 0):
         if acl_check(name) == 1:
             return redirect('/raw_acl/' + url_pas(name))
         
+        if do_title_length_check(name) == 1:
+            return re_error('/error/38')
+        
         curs.execute(db_change("select id from history where title = ? order by id + 0 desc"), [name])
         doc_ver = curs.fetchall()
         doc_ver = doc_ver[0][0] if doc_ver else '0'

+ 3 - 0
route/edit_move.py

@@ -6,6 +6,9 @@ def edit_move(name):
 
         if acl_check(name) == 1:
             return re_error('/ban')
+        
+        if do_title_length_check(name) == 1:
+            return re_error('/error/38')
 
         if flask.request.method == 'POST':
             move_title = flask.request.form.get('title', 'test')

+ 15 - 2
route/main_func_setting_main.py

@@ -28,7 +28,9 @@ def main_func_setting_main(db_set):
             24 : ['enable_comment', ''],
             25 : ['enable_challenge', ''],
             26 : ['edit_bottom_compulsion', ''],
-            27 : ['http_select', 'http']
+            27 : ['http_select', 'http'],
+            28 : ['title_max_length', ''],
+            29 : ['title_topic_max_length', '']
         }
 
         if flask.request.method == 'POST':
@@ -207,9 +209,20 @@ def main_func_setting_main(db_set):
                         <span>''' + load_lang('slow_edit') + ' (' + load_lang('second') + ') (' + load_lang('off') + ''' : 0)</span>
                         <hr class="main_hr">
                         <input name="slow_edit" value="''' + html.escape(d_list[19]) + '''">
-                        
                         <hr class="main_hr">
+                        
                         <input type="checkbox" name="edit_bottom_compulsion" ''' + check_box_div[7] + '''> ''' + load_lang('edit_bottom_compulsion') + ''' (''' + load_lang('beta') + ''')
+                        <hr class="main_hr">
+                        
+                        <span>''' + load_lang('title_max_length') + ''' (''' + load_lang('beta') + ''')</span>
+                        <hr class="main_hr">
+                        <input name="title_max_length" value="''' + html.escape(d_list[28]) + '''">
+                        <hr class="main_hr">
+                        
+                        <span>''' + load_lang('title_topic_max_length') + ''' (''' + load_lang('not_working') + ''')</span>
+                        <hr class="main_hr">
+                        <input name="title_topic_max_length" value="''' + html.escape(d_list[29]) + '''">
+                        <hr class="main_hr">
 
                         <hr class="main_hr">
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>

+ 25 - 3
route/tool/func.py

@@ -1786,6 +1786,18 @@ def do_edit_filter(data):
 
     return 0
 
+def do_title_length_check(name):
+    curs = conn.cursor()
+    
+    curs.execute(db_change('select data from other where name = "title_max_length"'))
+    db_data = curs.fetchall()
+    if db_data and db_data[0][0] != '':
+        db_data = int(number_check(db_data[0][0]))
+        if len(name) > db_data:        
+            return 1
+    
+    return 0
+
 # Func-insert
 def add_alarm(who, context):
     curs = conn.cursor()
@@ -2075,9 +2087,9 @@ def re_error(data):
             data = load_lang('regex_error')
         elif num == 24:
             curs.execute(db_change("select data from other where name = 'slow_edit'"))
-            slow_edit = curs.fetchall()
-            slow_edit = '' if not slow_edit else slow_edit[0][0]
-            data = load_lang('fast_edit_error') + slow_edit
+            db_data = curs.fetchall()
+            db_data = '' if not db_data else db_data[0][0]
+            data = load_lang('fast_edit_error') + db_data
         elif num == 25:
             data = load_lang('too_many_dec_error')
         elif num == 26:
@@ -2100,6 +2112,16 @@ def re_error(data):
             data = load_lang('input_email_error')
         elif num == 37:
             data = load_lang('error_edit_send_request')
+        elif num == 38:
+            curs.execute(db_change("select data from other where name = 'title_max_length'"))
+            db_data = curs.fetchall()
+            db_data = '' if not db_data else db_data[0][0]
+            data = load_lang('error_title_length_too_long') + db_data
+        elif num == 39:
+            curs.execute(db_change("select data from other where name = 'title_topic_max_length'"))
+            db_data = curs.fetchall()
+            db_data = '' if not db_data else db_data[0][0]
+            data = load_lang('error_title_length_too_long') + db_data
         else:
             data = '???'
 

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.5 (stable1) (beta3) (dev11)",
+        "r_ver" : "v3.4.5 (stable1) (beta3) (dev12)",
         "c_ver" : "3500106",
         "s_ver" : "3500110"
     }

+ 3 - 1
views/main_css/js/render_onmark.js

@@ -849,7 +849,9 @@ function do_onmark_last_render(data, name_include, data_category) {
         document.cookie.match(main_css_regex_data('main_css_category_set')) &&
         document.cookie.match(main_css_regex_data('main_css_category_set'))[1] === '1'
     ) {
-        data = data_category + '<hr class="main_hr">' + data;
+        if(data_category !== '') {
+            data = data_category + '<hr class="main_hr">' + data;
+        }
     } else {
         data += data_category;
     }