2du 3 years ago
parent
commit
6b07c9e844
5 changed files with 38 additions and 22 deletions
  1. 2 1
      lang/en-US.json
  2. 3 2
      lang/ko-KR.json
  3. 31 17
      route/edit_move.py
  4. 1 1
      route/tool/func.py
  5. 1 1
      version.json

+ 2 - 1
lang/en-US.json

@@ -227,6 +227,7 @@
         "challenge" : "Challenge",
         "user_title" : "User title",
         "multiple_ban" : "Multiple ban",
+    	"dont_move" : "Don't move",
         "_comment_2.1_" : "Filter",
             "_comment_2.1.1_" : "List",
                 "interwiki_list" : "Interwiki(s) list",
@@ -451,7 +452,7 @@
             "edit_record_error" : "Edit reason can not be more than 500 characters.",
             "same_file_error" : "A file with the same name exists.",
             "file_capacity_error" : "Maximum file capacity (MB): ",
-            "decument_exist_error" : "The document with that title already exists.",
+            "move_error" : "An error occurred while moving. All or part of it has not been moved.",
             "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.",

+ 3 - 2
lang/ko-KR.json

@@ -171,7 +171,7 @@
     "copyright_checkbox_text": "저작권 동의 문구(체크박스 형태)",
     "authority": "권한",
     "document": "문서",
-    "decument_exist_error": "이동하려는 문서에 이미 문서가 존재합니다.",
+    "move_error": "이동하는 과정 중 오류가 발생하였습니다. 전부 또는 일부가 이동되지 않았습니다.",
     "skin_setting": "스킨 설정",
     "discussion_list": "토론 목록",
     "restart_required": "재시작 필요",
@@ -455,5 +455,6 @@
     "set_wiki_access_password": "위키 접속 비밀번호",
     "set_history_recording_off": "역사 기록 중지",
     "multiple_ban": "다중 차단",
-    "name_or_ip_or_regex_multiple": "한 줄에 IP나 정규식을 한 개씩 적어주세요."
+    "name_or_ip_or_regex_multiple": "한 줄에 IP나 정규식을 한 개씩 적어주세요.",
+    "dont_move" : "이동하지 않음"
 }

+ 31 - 17
route/edit_move.py

@@ -27,7 +27,8 @@ def edit_move(name):
             agree = flask.request.form.get('copyright_agreement', '')
             time = get_time()
             ip = ip_check()
-            move_option = flask.request.form.get('move_option', 'normal')
+            move_option = flask.request.form.get('move_option', 'none')
+            has_error = 0
             
             if do_edit_send_check(send) == 1:
                 return re_error('/error/37')
@@ -93,15 +94,12 @@ def edit_move(name):
                             move[0]
                         ])
                 elif move_option == 'reverse':
-                    var_name = ''
-
                     i = 0
-                    while 1:
+                    var_name = ''
+                    while var_name == '':
                         curs.execute(db_change("select title from history where title = ?"), ['test ' + str(i)])
                         if not curs.fetchall():
                             var_name = 'test ' + str(i)
-
-                            break
                         else:
                             i += 1
 
@@ -138,9 +136,9 @@ def edit_move(name):
 
                         curs.execute(db_change("update history set title = ? where title = ?"), [title_name[1], title_name[0]])
                         curs.execute(db_change("update rc set title = ? where title = ?"), [title_name[1], title_name[0]])
-                else:
-                	return re_error('/error/19')
-            else:                
+                elif move_option != 'none':
+                    has_error = 1
+            elif move_option != 'none':                
                 curs.execute(db_change("select data from data where title = ?"), [name])
                 data = curs.fetchall()
                 if data:
@@ -172,7 +170,6 @@ def edit_move(name):
             
             # 토론 이동 파트 S
             
-            '''
             move_option_topic = flask.request.form.get('move_topic_option', 'none')
             if (
                 move_option_topic == 'merge' and
@@ -180,18 +177,34 @@ def edit_move(name):
             ):
                 curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
             elif move_option_topic == 'reverse':
+                i = 0
+                var_name = ''
+                while var_name == '':
+                    curs.execute(db_change("select title from rd where title = ?"), ['test ' + str(i)])
+                    if not curs.fetchall():
+                        var_name = 'test ' + str(i)
+                    else:
+                        i += 1
                 
+                curs.execute(db_change("update rd set title = ? where title = ?"), [var_name, move_title])
+                curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
+                curs.execute(db_change("update rd set title = ? where title = ?"), [name, var_name])
             elif move_option_topic == 'normal':
-            '''
-            
-            # 토론 이동 파트 E 제작중
+                curs.execute(db_change("select title from rd where title = ?"), [move_title])
+                if curs.fetchall():
+                    has_error = 1
+                else:
+                    curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
+
+            # 토론 이동 파트 E
                 
             conn.commit()
 
-            return redirect('/w/' + url_pas(move_title))
+            if has_error == 0:
+                return redirect('/w/' + url_pas(move_title))
+            else:
+                return re_error('/error/19')
         else:
-            # 설정 값 제작 필요
-            
             return easy_minify(flask.render_template(skin_check(),
                 imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
                 data = '''
@@ -206,13 +219,14 @@ def edit_move(name):
                         
                         <h2>''' + load_lang('document') + '''</h2>
                         <select name="move_option">
+                            <option value="none"> ''' + load_lang('dont_move') + '''</option>
                             <option value="normal"> ''' + load_lang('normal') + '''</option>
                             <option value="reverse"> ''' + load_lang('replace_move') + '''</option>
                             ''' + ('<option value="merge"> ' + load_lang('merge_move') + '</option>' if admin_check() == 1 else '') + '''
                         </select>
                         <hr class="main_hr">
                         
-                        <h2>''' + load_lang('discussion') + ''' (''' + load_lang('not_working') + ''')</h2>
+                        <h2>''' + load_lang('discussion') + '''</h2>
                         <select name="move_topic_option">
                             <option value="none"> ''' + load_lang('dont_move') + '''</option>
                             <option value="normal"> ''' + load_lang('normal') + '''</option>

+ 1 - 1
route/tool/func.py

@@ -2176,7 +2176,7 @@ def re_error(data):
         elif num == 18:
             data = load_lang('email_send_error')
         elif num == 19:
-            data = load_lang('decument_exist_error')
+            data = load_lang('move_error')
         elif num == 20:
             data = load_lang('password_diffrent_error')
         elif num == 21:

+ 1 - 1
version.json

@@ -1,6 +1,6 @@
 {
     "beta" : {
-        "r_ver" : "v3.4.5 (stable2) (beta3) (dev26)",
+        "r_ver" : "v3.4.5 (stable2) (beta3) (dev27)",
         "c_ver" : "3500112",
         "s_ver" : "3500110"
     }