Răsfoiți Sursa

권한 사용 목록 검색 추가

Surplus_Up (2DU) 7 ani în urmă
părinte
comite
6029bb8d42
3 a modificat fișierele cu 29 adăugiri și 14 ștergeri
  1. 1 1
      app.py
  2. 26 12
      route/list_admin_use.py
  3. 2 1
      views/main_css/css/main.css

+ 1 - 1
app.py

@@ -339,7 +339,7 @@ def give_history_hidden(name = None):
 def list_user():
     return list_user_2(conn)
 
-@app.route('/admin_log')
+@app.route('/admin_log', methods=['POST', 'GET'])
 def list_admin_use():
     return list_admin_use_2(conn)
 

+ 26 - 12
route/list_admin_use.py

@@ -9,18 +9,32 @@ def list_admin_use_2(conn):
     else:
         sql_num = 0
 
-    list_data = '<ul>'
+    if flask.request.method == 'POST':
+        return redirect('/admin_log?search=' + flask.request.form.get('search', 'normal'))
+    else:
+        list_data = '<ul>'
+
+        if flask.request.args.get('search', 'normal') == 'normal':
+            curs.execute("select who, what, time from re_admin order by time desc limit ?, '50'", [str(sql_num)])
+        else:
+            curs.execute("select who, what, time from re_admin where what like ? order by time desc limit ?, '50'", [
+                flask.request.args.get('search', 'normal') + "%",
+                str(sql_num)
+            ])
 
-    curs.execute("select who, what, time from re_admin order by time desc limit ?, '50'", [str(sql_num)])
-    get_list = curs.fetchall()
-    for data in get_list:            
-        list_data += '<li>' + ip_pas(data[0]) + ' / ' + data[1] + ' / ' + data[2] + '</li>'
+        get_list = curs.fetchall()
+        for data in get_list:            
+            list_data += '<li>' + ip_pas(data[0]) + ' / ' + data[1] + ' / ' + data[2] + '</li>'
 
-    list_data += '</ul>'
-    list_data += next_fix('/admin_log?num=', num, get_list)
+        list_data += '</ul>'
+        list_data += next_fix('/admin_log?num=', num, get_list)
 
-    return easy_minify(flask.render_template(skin_check(), 
-        imp = [load_lang('authority_use_list'), wiki_set(), custom(), other2([0, 0])],
-        data = list_data,
-        menu = [['other', load_lang('return')]]
-    ))
+        return easy_minify(flask.render_template(skin_check(), 
+            imp = [load_lang('authority_use_list'), wiki_set(), custom(), other2([0, 0])],
+            data = '''
+                <form method="post">
+                    <input name="search" id="admin_log_search"> <button type="submit">''' + load_lang('search') + '''</button>
+                </form>
+            ''' + list_data,
+            menu = [['other', load_lang('return')]]
+        ))

+ 2 - 1
views/main_css/css/main.css

@@ -36,4 +36,5 @@ hr.main_hr { border: none; }
 #include_link { display: none; }
 .foot_plus { background: gainsboro; }
 #toc_title { font-size: 18px; }
-blockquote { background-image: url(/views/acme/img/quote.png); background-position: calc(100% - 10px) 10px; background-repeat: no-repeat; background-size: 25px; }
+blockquote { background-image: url(/views/acme/img/quote.png); background-position: calc(100% - 10px) 10px; background-repeat: no-repeat; background-size: 25px; }
+#admin_log_search { width: 100px; }