فهرست منبع

파일 기타란 기본값 지정

잉여개발기 (SPDV) 5 سال پیش
والد
کامیت
2545de3387
7فایلهای تغییر یافته به همراه29 افزوده شده و 31 حذف شده
  1. 1 0
      language/en-US.json
  2. 2 1
      language/ko-KR.json
  3. 1 1
      route/edit.py
  4. 12 6
      route/func_upload.py
  5. 5 20
      route/give_history_add.py
  6. 7 2
      route/setting.py
  7. 1 1
      version.json

+ 1 - 0
language/en-US.json

@@ -282,6 +282,7 @@
                 "error_404" : "Missing document notice",
                 "edit_help" : "Editing textarea phrase",
                 "upload_help" : "File upload phrase",
+                "upload_default" : "File upload other Default",
             "_comment_2.2.4_" : "Google",
                 "recaptcha" : "reCAPTCHA",
                 "smtp_setting" : "Email SMTP setting",

+ 2 - 1
language/ko-KR.json

@@ -394,5 +394,6 @@
     "2fa_password" : "2차 비밀번호",
     "2fa_password_change" : "2차 비밀번호 변경",
     "vote_acl" : "투표 ACL",
-    "upload_help" : "파일 올리기 문구"
+    "upload_help" : "파일 올리기 문구",
+    "upload_default" : "파일 기타란 기본값"
 }

+ 1 - 1
route/edit.py

@@ -194,7 +194,7 @@ def edit_2(conn, name):
 
         curs.execute(db_change('select data from other where name = "edit_help"'))
         sql_d = curs.fetchall()
-        p_text = sql_d[0][0] if sql_d and sql_d[0][0] != '' else load_lang('default_edit_help')
+        p_text = html.escape(sql_d[0][0]) if sql_d and sql_d[0][0] != '' else load_lang('default_edit_help')
 
         data = re.sub(r'\n+$', '', data)
         data_old = re.sub(r'\n+$', '', data_old)

+ 12 - 6
route/func_upload.py

@@ -75,19 +75,20 @@ def func_upload_2(conn, app_var):
                 file_d = '' + \
                     '[[file:' + name + ']]\n' + \
                     '{{{[[file:' + name + ']]}}}\n\n' + \
-                    (g_lice + '\n' if g_lice != '' else '') + \
                     flask.request.form.get('f_lice_sel', 'direct_input') + '\n' + \
                     (ip if ip_or_user(ip) != 0 else '[[user:' + ip + ']]') + '\n' + \
                     str(file_size) + ' Byte\n' + \
-                    '[[category:' + re.sub(r'\]', '_', flask.request.form.get('f_lice_sel', '')) + ']]' + \
+                    '[[category:' + re.sub(r'\]', '_', flask.request.form.get('f_lice_sel', '')) + ']]\n' + \
+                    (g_lice if g_lice != '' else '') + \
                 ''
             else:
                 file_d = '' + \
+                    'file:' + name + '\n' + \
                     '/image/' + e_data + '\n\n' + \
-                    (g_lice + '\n' if g_lice != '' else '') + \
                     flask.request.form.get('f_lice_sel', 'direct_input') + '\n' + \
                     ip + \
-                    str(file_size) + ' Byte\n' + \
+                    str(file_size) + ' Byte\n\n' + \
+                    (g_lice if g_lice != '' else '') + \
                 ''
 
             curs.execute(db_change("insert into data (title, data) values (?, ?)"), ['file:' + name, file_d])
@@ -118,6 +119,7 @@ def func_upload_2(conn, app_var):
         return redirect('/w/file:' + name)
     else:
         license_list = '<option value="direct_input">' + load_lang('direct_input') + '</option>'
+        file_name = flask.request.args.get('name', '')
 
         curs.execute(db_change("select html from html_filter where kind = 'image_license'"))
         db_data = curs.fetchall()
@@ -127,6 +129,10 @@ def func_upload_2(conn, app_var):
         db_data = curs.fetchall()
         upload_help = ('<hr class="main_hr">' + db_data[0][0]) if db_data and db_data[0][0] != '' else ''
 
+        curs.execute(db_change("select data from other where name = 'upload_default'"))
+        db_data = curs.fetchall()
+        upload_default = html.escape(db_data[0][0]) if db_data and db_data[0][0] != '' else ''
+
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('upload'), wiki_set(), custom(), other2([0, 0])],
             data = '''
@@ -138,13 +144,13 @@ def func_upload_2(conn, app_var):
                 <form method="post" enctype="multipart/form-data" accept-charset="utf8">
                     <input multiple="multiple" type="file" name="f_data[]">
                     <hr class="main_hr">
-                    <input placeholder="''' + load_lang('file_name') + '''" name="f_name" value="''' + flask.request.args.get('name', '') + '''">
+                    <input placeholder="''' + load_lang('file_name') + '''" name="f_name" value="''' + file_name + '''">
                     <hr class="main_hr">
                     <select name="f_lice_sel">
                         ''' + license_list + '''
                     </select>
                     <hr class="main_hr">
-                    <textarea rows="10" placeholder="''' + load_lang('other') + '''" name="f_lice"></textarea>
+                    <textarea rows="10" placeholder="''' + load_lang('other') + '''" name="f_lice">''' + upload_default + '''</textarea>
                     <hr class="main_hr">
                     ''' + captcha_get() + '''
                     <button id="save" type="submit">''' + load_lang('save') + '''</button>

+ 5 - 20
route/give_history_add.py

@@ -29,37 +29,22 @@ def give_history_add_2(conn, name):
 
         return redirect('/history/' + url_pas(name))
     else:
-        curs.execute(db_change('select data from other where name = "edit_bottom_text"'))
-        sql_d = curs.fetchall()
-        if sql_d and sql_d[0][0] != '':
-            b_text = '<hr class=\"main_hr\">' + sql_d[0][0]
-        else:
-            b_text = ''
-
-        curs.execute(db_change('select data from other where name = "edit_help"'))
-        sql_d = curs.fetchall()
-        if sql_d and sql_d[0][0] != '':
-            p_text = sql_d[0][0]
-        else:
-            p_text = load_lang('default_edit_help')
-
         return easy_minify(flask.render_template(skin_check(),
             imp = [load_lang('history_add'), wiki_set(), custom(), other2(['(' + name + ')', 0])],
             data = '''
                 <form method="post">
                     <script>do_stop_exit();</script>
                     ''' + edit_button() + '''
-                    <textarea rows="25" id="content" placeholder="''' + p_text + '''" name="content"></textarea>
-                    <hr class=\"main_hr\">
+                    <textarea rows="25" id="content" name="content"></textarea>
+                    <hr class="main_hr">
                     <input placeholder="''' + load_lang('why') + '''" name="send" type="text">
-                    <hr class=\"main_hr\">
+                    <hr class="main_hr">
                     <input placeholder="''' + load_lang('name') + '''" name="get_ip" type="text">
-                    <hr class=\"main_hr\">
+                    <hr class="main_hr">
                     <button id="save" type="submit" onclick="go_save_zone = 1;">''' + load_lang('save') + '''</button>
                     <button id="preview" type="button" onclick="load_preview(\'''' + url_pas(name) + '\')">' + load_lang('preview') + '''</button>
                 </form>
-                ''' + b_text + '''
-                <hr class=\"main_hr\">
+                <hr class="main_hr">
                 <div id="see_preview"></div>
             ''',
             menu = [['history/' + url_pas(name), load_lang('return')]]

+ 7 - 2
route/setting.py

@@ -228,7 +228,8 @@ def setting_2(conn, num, db_set):
             'error_404',
             'approval_question',
             'edit_help',
-            'upload_help'
+            'upload_help',
+            'upload_default'
         ]
         if flask.request.method == 'POST':
             for i in i_list:
@@ -317,10 +318,14 @@ def setting_2(conn, num, db_set):
                         <hr class="main_hr">
                         <textarea rows="3" name="''' + i_list[13] + '''">''' + html.escape(d_list[13]) + '''</textarea>
                         <hr class="main_hr">
-                        <span>''' + load_lang('upload_help') + '''</span>
+                        <span>''' + load_lang('upload_help') + ''' (HTML)</span>
                         <hr class="main_hr">
                         <textarea rows="3" name="''' + i_list[14] + '''">''' + html.escape(d_list[14]) + '''</textarea>
                         <hr class="main_hr">
+                        <span>''' + load_lang('upload_default') + '''</span>
+                        <hr class="main_hr">
+                        <textarea rows="3" name="''' + i_list[15] + '''">''' + html.escape(d_list[15]) + '''</textarea>
+                        <hr class="main_hr">
                         <button id="save" type="submit">''' + load_lang('save') + '''</button>
                         <hr class="main_hr">
                         <ul>

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.2.0-stable-13 (beta-34) (dev-2020-09-13-01)",
+        "r_ver" : "v3.2.0-stable-13 (beta-35) (dev-2020-09-16-01)",
         "c_ver" : "3203400",
         "s_ver" : "10"
     }