|
|
@@ -27,6 +27,7 @@ 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')
|
|
|
|
|
|
if do_edit_send_check(send) == 1:
|
|
|
return re_error('/error/37')
|
|
|
@@ -34,112 +35,112 @@ def edit_move(name):
|
|
|
if do_edit_text_bottom_check_box_check(agree) == 1:
|
|
|
return re_error('/error/29')
|
|
|
|
|
|
- curs.execute(db_change("select title from history where title = ?"), [move_title])
|
|
|
- if curs.fetchall():
|
|
|
- if flask.request.form.get('move_option', 'normal') == 'merge' and admin_check(None, 'merge documents') == 1:
|
|
|
- curs.execute(db_change("select data from data where title = ?"), [move_title])
|
|
|
- data = curs.fetchall()
|
|
|
- if data:
|
|
|
- curs.execute(db_change("delete from data where title = ?"), [move_title])
|
|
|
- curs.execute(db_change("delete from back where link = ?"), [move_title])
|
|
|
+ # 문서 이동 파트 S
|
|
|
+ if (
|
|
|
+ move_option == 'merge' and
|
|
|
+ admin_check(None, 'merge documents (' + name + ') (' + move_title + ')') == 1
|
|
|
+ ):
|
|
|
+ curs.execute(db_change("select data from data where title = ?"), [move_title])
|
|
|
+ data = curs.fetchall()
|
|
|
+ if data:
|
|
|
+ curs.execute(db_change("delete from data where title = ?"), [move_title])
|
|
|
+ curs.execute(db_change("delete from back where link = ?"), [move_title])
|
|
|
+
|
|
|
+ curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
+ data = curs.fetchall()
|
|
|
+ if data:
|
|
|
+ curs.execute(db_change("update data set title = ? where title = ?"), [move_title, name])
|
|
|
+ curs.execute(db_change("update back set link = ? where link = ?"), [move_title, name])
|
|
|
+
|
|
|
+ data_in = data[0][0]
|
|
|
+ else:
|
|
|
+ data_in = ''
|
|
|
|
|
|
- curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
+ history_plus(
|
|
|
+ name,
|
|
|
+ data_in,
|
|
|
+ time,
|
|
|
+ ip,
|
|
|
+ send,
|
|
|
+ '0',
|
|
|
+ t_check = 'merge <a>' + name + '</a> - <a>' + move_title + '</a> move',
|
|
|
+ mode = 'move'
|
|
|
+ )
|
|
|
+
|
|
|
+ curs.execute(db_change("update back set type = 'no' where title = ? and not type = 'cat' and not type = 'no'"), [name])
|
|
|
+ curs.execute(db_change("delete from back where title = ? and not type = 'cat' and type = 'no'"), [move_title])
|
|
|
+
|
|
|
+ curs.execute(db_change("select id from history where title = ? order by id + 0 desc limit 1"), [move_title])
|
|
|
+ data = curs.fetchall()
|
|
|
+
|
|
|
+ num = data[0][0]
|
|
|
+
|
|
|
+ curs.execute(db_change("select id from history where title = ? order by id + 0 asc"), [name])
|
|
|
+ data = curs.fetchall()
|
|
|
+ for move in data:
|
|
|
+ curs.execute(db_change("update rc set title = ?, id = ? where title = ? and id = ?"), [
|
|
|
+ move_title,
|
|
|
+ str(int(num) + int(move[0])),
|
|
|
+ name,
|
|
|
+ move[0]
|
|
|
+ ])
|
|
|
+ curs.execute(db_change("update history set title = ?, id = ? where title = ? and id = ?"), [
|
|
|
+ move_title,
|
|
|
+ str(int(num) + int(move[0])),
|
|
|
+ name,
|
|
|
+ move[0]
|
|
|
+ ])
|
|
|
+ elif move_option == 'reverse':
|
|
|
+ var_name = ''
|
|
|
+
|
|
|
+ i = 0
|
|
|
+ while 1:
|
|
|
+ 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
|
|
|
+
|
|
|
+ curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
+ data = curs.fetchall()
|
|
|
+ if data:
|
|
|
+ curs.execute(db_change("update data set title = ? where title = ?"), [var_name, name])
|
|
|
+ curs.execute(db_change("update back set link = ? where link = ?"), [var_name, name])
|
|
|
+
|
|
|
+ curs.execute(db_change("update history set title = ? where title = ?"), [var_name, name])
|
|
|
+ curs.execute(db_change("update rc set title = ? where title = ?"), [var_name, name])
|
|
|
+
|
|
|
+ for title_name in [[move_title, name], [var_name, move_title]]:
|
|
|
+ curs.execute(db_change("select data from data where title = ?"), [title_name[0]])
|
|
|
data = curs.fetchall()
|
|
|
if data:
|
|
|
- curs.execute(db_change("update data set title = ? where title = ?"), [move_title, name])
|
|
|
- curs.execute(db_change("update back set link = ? where link = ?"), [move_title, name])
|
|
|
+ curs.execute(db_change("update data set title = ? where title = ?"), [title_name[1], title_name[0]])
|
|
|
+ curs.execute(db_change("update back set link = ? where link = ?"), [title_name[1], title_name[0]])
|
|
|
|
|
|
data_in = data[0][0]
|
|
|
else:
|
|
|
data_in = ''
|
|
|
|
|
|
history_plus(
|
|
|
- name,
|
|
|
+ title_name[0],
|
|
|
data_in,
|
|
|
time,
|
|
|
ip,
|
|
|
send,
|
|
|
'0',
|
|
|
- t_check = 'merge <a>' + name + '</a> - <a>' + move_title + '</a> move',
|
|
|
+ t_check = '<a>' + (title_name[0] if title_name[0] != var_name else name) + '</a> - <a>' + title_name[1] + '</a> move',
|
|
|
mode = 'move'
|
|
|
)
|
|
|
|
|
|
- curs.execute(db_change("update back set type = 'no' where title = ? and not type = 'cat' and not type = 'no'"), [name])
|
|
|
- curs.execute(db_change("delete from back where title = ? and not type = 'cat' and type = 'no'"), [move_title])
|
|
|
-
|
|
|
- curs.execute(db_change("select id from history where title = ? order by id + 0 desc limit 1"), [move_title])
|
|
|
- data = curs.fetchall()
|
|
|
-
|
|
|
- num = data[0][0]
|
|
|
-
|
|
|
- curs.execute(db_change("select id from history where title = ? order by id + 0 asc"), [name])
|
|
|
- data = curs.fetchall()
|
|
|
- for move in data:
|
|
|
- curs.execute(db_change("update rc set title = ?, id = ? where title = ? and id = ?"), [
|
|
|
- move_title,
|
|
|
- str(int(num) + int(move[0])),
|
|
|
- name,
|
|
|
- move[0]
|
|
|
- ])
|
|
|
- curs.execute(db_change("update history set title = ?, id = ? where title = ? and id = ?"), [
|
|
|
- move_title,
|
|
|
- str(int(num) + int(move[0])),
|
|
|
- name,
|
|
|
- move[0]
|
|
|
- ])
|
|
|
-
|
|
|
- conn.commit()
|
|
|
-
|
|
|
- return redirect('/w/' + url_pas(move_title))
|
|
|
- elif flask.request.form.get('move_option', 'normal') == 'reverse':
|
|
|
- var_name = ''
|
|
|
- i = 0
|
|
|
- while 1:
|
|
|
- curs.execute(db_change("select title from history where title = ?"), ['test ' + str(i)])
|
|
|
- if not curs.fetchall():
|
|
|
- curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
- data = curs.fetchall()
|
|
|
- if data:
|
|
|
- curs.execute(db_change("update data set title = ? where title = ?"), ['test ' + str(i), name])
|
|
|
- curs.execute(db_change("update back set link = ? where link = ?"), ['test ' + str(i), name])
|
|
|
-
|
|
|
- curs.execute(db_change("update history set title = ? where title = ?"), ['test ' + str(i), name])
|
|
|
- curs.execute(db_change("update rc set title = ? where title = ?"), ['test ' + str(i), name])
|
|
|
-
|
|
|
- break
|
|
|
- else:
|
|
|
- i += 1
|
|
|
-
|
|
|
- for title_name in [[move_title, name], ['test ' + str(i), move_title]]:
|
|
|
- curs.execute(db_change("select data from data where title = ?"), [title_name[0]])
|
|
|
- data = curs.fetchall()
|
|
|
- if data:
|
|
|
- curs.execute(db_change("update data set title = ? where title = ?"), [title_name[1], title_name[0]])
|
|
|
- curs.execute(db_change("update back set link = ? where link = ?"), [title_name[1], title_name[0]])
|
|
|
-
|
|
|
- data_in = data[0][0]
|
|
|
- else:
|
|
|
- data_in = ''
|
|
|
-
|
|
|
- history_plus(
|
|
|
- title_name[0],
|
|
|
- data_in,
|
|
|
- time,
|
|
|
- ip,
|
|
|
- send,
|
|
|
- '0',
|
|
|
- t_check = '<a>' + (title_name[0] if title_name[0] != 'test ' + str(i) else name) + '</a> - <a>' + title_name[1] + '</a> move',
|
|
|
- mode = 'move'
|
|
|
- )
|
|
|
-
|
|
|
- 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]])
|
|
|
- conn.commit()
|
|
|
-
|
|
|
- return redirect('/w/' + url_pas(move_title))
|
|
|
- else:
|
|
|
- return re_error('/error/19')
|
|
|
+ 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:
|
|
|
+ curs.execute(db_change("select title from history where title = ?"), [move_title])
|
|
|
+ if curs.fetchall():
|
|
|
+ return re_error('/error/19')
|
|
|
+
|
|
|
curs.execute(db_change("select data from data where title = ?"), [name])
|
|
|
data = curs.fetchall()
|
|
|
if data:
|
|
|
@@ -166,26 +167,62 @@ def edit_move(name):
|
|
|
|
|
|
curs.execute(db_change("update history set title = ? where title = ?"), [move_title, name])
|
|
|
curs.execute(db_change("update rc set title = ? where title = ?"), [move_title, name])
|
|
|
- conn.commit()
|
|
|
+
|
|
|
+ # 문서 이동 파트 E
|
|
|
+
|
|
|
+ # 토론 이동 파트 S
|
|
|
+
|
|
|
+ '''
|
|
|
+ move_option_topic = flask.request.form.get('move_topic_option', 'none')
|
|
|
+ if (
|
|
|
+ move_option_topic == 'merge' and
|
|
|
+ admin_check(None, 'merge document\'s topics (' + name + ') (' + move_title + ')') == 1
|
|
|
+ ):
|
|
|
+ curs.execute(db_change("update rd set title = ? where title = ?"), [move_title, name])
|
|
|
+ elif move_option_topic == 'reverse':
|
|
|
+
|
|
|
+ elif move_option_topic == 'normal':
|
|
|
+ '''
|
|
|
+
|
|
|
+ # 토론 이동 파트 E 제작중
|
|
|
+
|
|
|
+ conn.commit()
|
|
|
|
|
|
- return redirect('/w/' + url_pas(move_title))
|
|
|
+ return redirect('/w/' + url_pas(move_title))
|
|
|
else:
|
|
|
+ # 설정 값 제작 필요
|
|
|
+
|
|
|
return easy_minify(flask.render_template(skin_check(),
|
|
|
imp = [name, wiki_set(), wiki_custom(), wiki_css(['(' + load_lang('move') + ')', 0])],
|
|
|
data = '''
|
|
|
<form method="post">
|
|
|
- ''' + ip_warning() + '''
|
|
|
- <input placeholder="''' + load_lang('document_name') + '" value="' + name + '''" name="title" type="text">
|
|
|
+ <span>''' + load_lang('document_name') + '''</span>
|
|
|
<hr class="main_hr">
|
|
|
+ <input value="''' + name + '''" name="title" type="text">
|
|
|
+ <hr class="main_hr">
|
|
|
+
|
|
|
<input placeholder="''' + load_lang('why') + '''" name="send" type="text">
|
|
|
<hr class="main_hr">
|
|
|
+
|
|
|
+ <h2>''' + load_lang('document') + '''</h2>
|
|
|
<select name="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>
|
|
|
+ <select name="move_topic_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">
|
|
|
+
|
|
|
''' + captcha_get() + ip_warning() + get_edit_text_bottom_check_box() + get_edit_text_bottom() + '''
|
|
|
+
|
|
|
<button type="submit">''' + load_lang('move') + '''</button>
|
|
|
</form>
|
|
|
''',
|