ソースを参照

관심 문서 기능 추가

Surplus_Up (2DU) 6 年 前
コミット
67d2d99287

+ 7 - 7
app.py

@@ -190,7 +190,7 @@ if setup_tool != 0:
     create_data['alarm'] = ['name', 'data', 'date']
     create_data['ua_d'] = ['name', 'ip', 'ua', 'today', 'sub']
     create_data['filter'] = ['name', 'regex', 'sub']
-    create_data['scan'] = ['user', 'title']
+    create_data['scan'] = ['user', 'title', 'type']
     create_data['acl'] = ['title', 'decu', 'dis', 'view', 'why']
     create_data['inter'] = ['title', 'link', 'icon']
     create_data['html_filter'] = ['html', 'kind', 'plus']
@@ -628,13 +628,13 @@ def func_upload():
 def user_info():
     return user_info_2(conn)
 
-@app.route('/watch_list')
-def watch_list():
-    return watch_list_2(conn)
+@app.route('/<regex("watch_list|star_doc"):tool>')
+def watch_list(tool = 'star_doc'):
+    return watch_list_2(conn, tool)
 
-@app.route('/watch_list/<everything:name>')
-def watch_list_name(name = None):
-    return watch_list_name_2(conn, name)
+@app.route('/<regex("watch_list|star_doc"):tool>/<everything:name>')
+def watch_list_name(tool = 'star_doc', name = 'Test'):
+    return watch_list_name_2(conn, tool, name)
 
 @app.route('/custom_head', methods=['GET', 'POST'])
 def user_custom_head_view():

+ 2 - 0
language/en-US.json

@@ -204,6 +204,8 @@
         "main_skin_set" : "Main skin setting(s)",
         "reset_backlink" : "Reset backlink",
         "link_in_this" : "Links in this document",
+        "star_doc" : "Document(s) of interest",
+        "add_star_doc" : "Add document(s) of interest",
         "_comment_2.1_" : "Filter",
             "_comment_2.1.1_" : "List",
                 "interwiki_list" : "Interwiki(s) list",

+ 3 - 1
language/ko-KR.json

@@ -361,5 +361,7 @@
     "image_file_list" : "이미지 파일 목록",
     "many_upload_acl" : "다중 파일 업로드 ACL",
     "reset_backlink" : "역링크 초기화",
-    "link_in_this" : "이 문서의 링크"
+    "link_in_this" : "이 문서의 링크",
+    "star_doc" : "관심 문서",
+    "add_star_doc" : "관심 문서 추가"
 }

+ 1 - 1
route/edit.py

@@ -77,7 +77,7 @@ def edit_2(conn, name):
             curs.execute(db_change('select data from other where name = "count_all_title"'))
             curs.execute(db_change("update other set data = ? where name = 'count_all_title'"), [str(int(curs.fetchall()[0][0]) + 1)])
 
-        curs.execute(db_change("select user from scan where title = ?"), [name])
+        curs.execute(db_change("select user from scan where title = ? and type = ''"), [name])
         for scan_user in curs.fetchall():
             curs.execute(db_change("insert into alarm (name, data, date) values (?, ?, ?)"), [
                 scan_user[0],

+ 1 - 1
route/edit_req.py

@@ -76,7 +76,7 @@ def edit_req_2(conn, name):
                 curs.execute(db_change('select data from other where name = "count_all_title"'))
                 curs.execute(db_change("update other set data = ? where name = 'count_all_title'"), [str(int(curs.fetchall()[0][0]) + 1)])
 
-            curs.execute(db_change("select user from scan where title = ?"), [name])
+            curs.execute(db_change("select user from scan where title = ? and type = ''"), [name])
             for scan_user in curs.fetchall():
                 curs.execute(db_change("insert into alarm (name, data, date) values (?, ?, ?)"), [
                     scan_user[0],

+ 2 - 1
route/main_manager.py

@@ -17,7 +17,8 @@ def main_manager_2(conn, num, r_ver):
         10 : [0, 'block_admin', load_lang('blocked_admin')],
         11 : [load_lang('document_name'), 'watch_list', load_lang('add_watchlist')],
         12 : [load_lang('compare_target'), 'check', load_lang('compare_target')],
-        13 : [load_lang('document_name'), 'edit', load_lang('load')]
+        13 : [load_lang('document_name'), 'edit', load_lang('load')],
+        14 : [load_lang('document_name'), 'star_doc', load_lang('add_star_doc')]
     }
 
     if num == 1:

+ 1 - 0
route/user_info.py

@@ -19,6 +19,7 @@ def user_info_2(conn):
         '''
 
         plus2 += '<li><a href="/watch_list">' + load_lang('watchlist') + '</a></li>'
+        plus2 += '<li><a href="/star_doc">' + load_lang('star_doc') + '</a></li>'
         plus3 = '<li><a href="/acl/user:' + url_pas(ip) + '">' + load_lang('user_document_acl') + '</a></li>'
     else:
         plus = '''

+ 35 - 6
route/watch_list.py

@@ -1,29 +1,58 @@
 from .tool.func import *
 
-def watch_list_2(conn):
+def watch_list_2(conn, tool):
     curs = conn.cursor()
 
-    div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class=\"main_hr\">'
+    if tool == 'watch_list':
+        div = load_lang("msg_whatchlist_lmt") + ' : 10 <hr class=\"main_hr\">'
+    else:
+        div = ''
+
     ip = ip_check()
 
     if ip_or_user(ip) != 0:
         return redirect('/login')
 
+
     curs.execute(db_change("delete from scan where user = ? and title = ''"), [ip])
     conn.commit()
 
-    curs.execute(db_change("select title from scan where user = ?"), [ip])
+    if tool == 'watch_list':
+        curs.execute(db_change("select title from scan where type = '' and user = ?"), [ip])
+
+        title_name = load_lang('watchlist')
+    else:
+        curs.execute(db_change("select title from scan where type = 'star' and user = ?"), [ip])
+
+        title_name = load_lang('star_doc')
+
     data = curs.fetchall()
     for data_list in data:
-        div += '<li><a href="/w/' + url_pas(data_list[0]) + '">' + data_list[0] + '</a> <a href="/watch_list/' + url_pas(data_list[0]) + '">(' + load_lang('delete') + ')</a></li>'
+        if tool == 'star_doc':
+            curs.execute(db_change("select date from history where title = ? order by id + 0 desc limit 1"), [data_list[0]])
+            get_data = curs.fetchall()
+            if get_data:
+                plus = '(' + get_data[0][0] + ') '
+            else:
+                plus = ''
+        else:
+            plus = ''
+
+        div += '' + \
+            '<li>' + \
+                '<a href="/w/' + url_pas(data_list[0]) + '">' + data_list[0] + '</a> ' + \
+                plus + \
+                '<a href="/watch_list/' + url_pas(data_list[0]) + '">(' + load_lang('delete') + ')</a>' + \
+            '</li>' + \
+        ''
 
     if data:
         div = '<ul>' + div + '</ul><hr class=\"main_hr\">'
 
-    div += '<a href="/manager/13">(' + load_lang('add') + ')</a>'
+    div += '<a href="/manager/' + ('13' if tool == 'watch_list' else '16') + '">(' + load_lang('add') + ')</a>'
 
     return easy_minify(flask.render_template(skin_check(),
-        imp = [load_lang('watchlist'), wiki_set(), custom(), other2([0, 0])],
+        imp = [title_name, wiki_set(), custom(), other2([0, 0])],
         data = div,
         menu = [['manager', load_lang('return')]]
     ))

+ 17 - 9
route/watch_list_name.py

@@ -1,23 +1,31 @@
 from .tool.func import *
 
-def watch_list_name_2(conn, name):
+def watch_list_name_2(conn, tool, name):
     curs = conn.cursor()
 
     ip = ip_check()
     if ip_or_user(ip) != 0:
         return redirect('/login')
 
-    curs.execute(db_change("select count(title) from scan where user = ?"), [ip])
-    count = curs.fetchall()
-    if count and count[0][0] > 9:
-        return re_error('/error/28')
+    if tool == 'watch_list':
+        curs.execute(db_change("select count(title) from scan where user = ?"), [ip])
+        count = curs.fetchall()
+        if count and count[0][0] > 9:
+            return re_error('/error/28')
 
-    curs.execute(db_change("select title from scan where user = ? and title = ?"), [ip, name])
+        type_data = ''
+    else:
+        type_data = 'star'
+
+    curs.execute(db_change("select title from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
     if curs.fetchall():
-        curs.execute(db_change("delete from scan where user = ? and title = ?"), [ip, name])
+        curs.execute(db_change("delete from scan where user = ? and title = ? and type = ?"), [ip, name, type_data])
     else:
-        curs.execute(db_change("insert into scan (user, title) values (?, ?)"), [ip, name])
+        curs.execute(db_change("insert into scan (user, title, type) values (?, ?, ?)"), [ip, name, type_data])
 
     conn.commit()
 
-    return redirect('/watch_list')
+    if tool == 'watch_list':
+        return redirect('/watch_list')
+    else:
+        return redirect('/star_doc')

+ 2 - 2
version.json

@@ -1,7 +1,7 @@
 {
     "master" : {
-        "r_ver" : "v3.1.8-master-29",
-        "c_ver" : "3182000",
+        "r_ver" : "v3.1.8-master-30",
+        "c_ver" : "3183000",
         "s_ver" : "8"
     }, "stable" : {
         "r_ver" : "v3.1.7-stable-04",

+ 1 - 0
views/marisa/css/main.css

@@ -311,6 +311,7 @@ pre, #toc, #cate, #redirect {
 }
 
 textarea, input {
+    font-family: 'Apple SD Gothic', '맑은고딕', 'Nanum Gothic', 'Noto Sans KR', sans-serif;
     border: 1px solid #aaa;
     padding: 5px;
     margin-left: -5px;

+ 1 - 1
views/marisa/index.html

@@ -8,7 +8,7 @@
             <title>{{imp[0]}} - {{imp[1][0]}}</title>
         {% endif %}
         {{imp[3][3]|safe}}
-        <link rel="stylesheet" href="/views/marisa/css/main.css?ver=12">
+        <link rel="stylesheet" href="/views/marisa/css/main.css?ver=13">
         <script src="/views/marisa/js/skin_set.js?ver=4"></script>
         <script src="/views/marisa/js/main.js?ver=3"></script>
         <script>main_load(); window.addEventListener('DOMContentLoaded', function() { skin_set(); });</script>

+ 1 - 1
views/marisa/info.json

@@ -1,5 +1,5 @@
 {
     "name" : "Marisa",
-    "skin_ver" : "v1.2.4",
+    "skin_ver" : "v1.2.5",
     "require_ver" : "8"
 }