2DU 8 лет назад
Родитель
Сommit
772c63a7fd
4 измененных файлов с 56 добавлено и 200 удалено
  1. 56 27
      app.py
  2. 0 44
      views/ban.tpl
  3. 0 98
      views/base.tpl
  4. 0 31
      views/vstopic.tpl

+ 56 - 27
app.py

@@ -1915,23 +1915,36 @@ def topic(name = None, sub = None):
                     <br>'
                     <br>'
                 
                 
             i += 1
             i += 1
-            
+
+        l_c = login_check()
+
+        if(not ban == 1):
+            data = '<a id="reload" href="javascript:void(0);" onclick="location.href.endsWith(\'#reload\') ?  location.reload(true) : location.href = \'#reload\'"> \
+                        <i aria-hidden="true" class="fa fa-refresh"></i> \
+                    </a> \
+                    <form style="' + style + '" method="post"> \
+                        <br> \
+                        <textarea style="width: 100%; height: 100px;" name="content"></textarea> \
+                        <br> \
+                        <br> \
+                        <button class="btn btn-primary" type="submit">전송</button> \
+                    </form>'
+
+            if(l_c == 0 and style == ''):
+                data += '<span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 토론에 기록됩니다.</span>'
+        else:
+            data = ''
+
+
         return(
         return(
-            template('vstopic', 
-                custom_css = custom_css(), 
-                custom_js = custom_js(),
-                license = wiki_set(3), 
-                login = login_check(), 
-                title = name, 
-                page = url_pas(name), 
-                suburl = url_pas(sub), 
-                toron = sub, 
-                logo = wiki_set(1), 
-                rows = div, 
-                ban = ban, 
-                style = style, 
-                sub = '토론'
-            )
+            template('index', 
+                imp = [name, wiki_set(1), wiki_set(3), login_check(), custom_css(), custom_js(), ' (토론)'],
+                data =  '<h2 style="margin-top: -15px;">' + sub + '</h2> \
+                        <br> \
+                        ' + div + ' \
+                        ' + data,
+                menu = [['topic/' + url_pas(name), '목록']]
+            )    
         )
         )
         
         
 @route('/topic/<name:path>', method=['POST', 'GET'])
 @route('/topic/<name:path>', method=['POST', 'GET'])
@@ -2335,25 +2348,41 @@ def user_ban(name = None):
             row = curs.fetchall()
             row = curs.fetchall()
             if(row):
             if(row):
                 now = '차단 해제'
                 now = '차단 해제'
+                data = ''
             else:
             else:
                 b = re.search("^([0-9]{1,3}\.[0-9]{1,3})$", name)
                 b = re.search("^([0-9]{1,3}\.[0-9]{1,3})$", name)
                 if(b):
                 if(b):
                     now = '대역 차단'
                     now = '대역 차단'
                 else:
                 else:
                     now = '차단'
                     now = '차단'
+                
+                data = '<input class="form-control" name="end" style="width: 100%;"> \
+                        <br> \
+                        <br> \
+                        <span>아무것도 안 적으면 무기한 차단입니다.</span> \
+                        <br> \
+                        <br> \
+                        <span>차단 일 지정시 형식은 YYYY-MM-DD로 기록해야 합니다. (예시: 2017-01-20, 2017-10-15)</span> \
+                        <br> \
+                        <br> \
+                        <span>지금 시각은 ' + get_time() + ' 입니다.</span> \
+                        <br> \
+                        <br> \
+                        <input class="form-control" name="why" style="width: 100%;"> \
+                        <br> \
+                        <br> \
+                        <span>사유를 쓰는 곳입니다.</span> \
+                        <br> \
+                        <br>'
 
 
             return(
             return(
-                template('ban', 
-                    custom_css = custom_css(), 
-                    custom_js = custom_js(),
-                    license = wiki_set(3), 
-                    login = login_check(), 
-                    title = name, 
-                    page = url_pas(name), 
-                    logo = wiki_set(1), 
-                    now = now, 
-                    today = get_time(), 
-                    sub = '차단'
+                template('index', 
+                    imp = [name, wiki_set(1), wiki_set(3), login_check(), custom_css(), custom_js(), ' (' + now + ')'],
+                    data = '<form method="post"> \
+                                ' + data + ' \
+                                <button class="btn btn-primary" type="submit">' + now + '</button> \
+                            </form>',
+                    menu = [['manager', '관리자']]
                 )
                 )
             )
             )
         else:
         else:

+ 0 - 44
views/ban.tpl

@@ -1,44 +0,0 @@
-<!-- 차단 -->
-% rebase('base.tpl')
-<div id="tool">
-    <nav class="menu">
-        <a class="menu-item selected" href="#" onclick="return false">
-            {{sub}}
-        </a>
-        <a class="menu-item" href="javascript:history.back(-1);">뒤로</a>
-    </nav>
-</div>
-<h1 class="title">
-    {{title}}
-    <sub> ({{sub}})</sub>
-</h1>
-<form id="usrform" method="POST" action="/ban/{{page}}">
-    % if(now == '차단' or now == '대역 차단'):
-        <input class="form-control" name="end" style="width: 100%">
-        <br>
-        <br>
-        <span>아무것도 안 적으면 무기한 차단입니다.</span>
-        <br>
-        <br>
-        <span>차단 일 지정시 형식은 YYYY-MM-DD로 기록해야 합니다. (예시: 2017-01-20, 2017-10-15)</span>
-        <br>
-        <br>
-        <span>지금 시각은 {{today}} 입니다.</span>
-        <br>
-        <br>
-        <input class="form-control" name="why" style="width: 100%">
-        <br>
-        <br>
-        <span>사유를 쓰는 곳입니다.</span>
-        % if(defined('allif')):
-            <br>
-            <br>
-            <input type="checkbox" name="band">
-                <span>대역 차단</span>
-            </input>
-        % end
-        <br>
-        <br>
-    % end
-    <button class="btn btn-primary" type="submit">{{now}}</button>
-</form>

+ 0 - 98
views/base.tpl

@@ -1,98 +0,0 @@
-<html>
-    <head>
-        <title>{{title}} - {{logo}}</title>
-        <link rel="stylesheet" href="/views/css/primer.css">
-        <link rel="stylesheet" href="/views/css/style.css">
-        <!-- 필수 CSS, JS -->
-        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/styles/default.min.css">
-        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.7/highlight.min.js"></script>
-        <script>hljs.initHighlightingOnLoad();</script>
-        <link rel="stylesheet" href="/views/css/awesome/font-awesome.min.css">
-        <script type="text/x-mathjax-config">MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});</script>
-        <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_CHTML"></script>
-        <script>
-            function folding(num) {
-                var fol = document.getElementById('folding_' + num);
-                if(fol.style.display == 'inline-block' || fol.style.display == 'block') {
-                    fol.style.display = 'none';
-                } else {
-                    if(num % 3 == 0) {
-                        fol.style.display = 'block';
-                    } else {
-                        fol.style.display = 'inline-block';
-                    }
-                }
-            }
-        </script>
-        <!-- 필수 부분 끝 -->
-        <meta name="twitter:creator" content="@{{logo}}">
-        <meta name="twitter:title" content="{{title}}">
-        <meta name="twitter:site" content="@{{logo}}">
-        <meta name="twitter:card" content="summary">
-        <link rel="shortcut icon" href="/views/img/on.ico">
-        <meta name="viewport" content="width=device-width, initial-scale=1">
-        <style>{{!get('custom_css', '')}}</style>
-        <script>{{!get('custom_js', '')}}</script>
-    </head>
-    <body>
-        <br>
-        <div class="one-fifth column">
-            <div id="top">
-                <a href="/" id="logo">{{logo}}</a>
-                <div>
-                    <a href="/recent_changes" id="RecentChanges">
-                        <i class="fa fa-refresh" aria-hidden="true"></i>
-                        <span id="is_mobile">최근 변경</span>
-                    </a>
-                    <a href="/recent_discuss" id="RecentChanges">
-                        <i class="fa fa-comment" aria-hidden="true"></i>
-                        <span id="is_mobile">최근 토론</span>
-                    </a>
-                    <a href="/random" id="log">
-                        <i class="fa fa-random" aria-hidden="true"></i>
-                    </a>
-                    <a href="/user" id="log">
-                        % if(login == 1):
-                            <i class="fa fa-user" aria-hidden="true"></i>
-                        % elif(login == 0):
-                            <i class="fa fa-user-times" aria-hidden="true"></i>
-                        % else:
-                            <i class="fa fa-user-secret" aria-hidden="true"></i>
-                        % end
-                    </a>
-                    <a href="/other" id="log">
-                        <i class="fa fa-cogs" aria-hidden="true"></i>
-                    </a>
-                </div>
-                <form method="POST" action="/search" id="search">
-                    <div class="input-group">
-                        <input class="form-control" name="search" type="text">
-                        <span class="input-group-button">
-                            <button id="goto" class="btn" formaction="/goto"><i class="fa fa-share" aria-hidden="true"></i></button>
-                        </span>
-                        <span class="input-group-button">
-                            <button class="btn"><i class="fa fa-search" aria-hidden="true"></i></button>
-                        </span>
-                    </div>
-                </form>
-            </div>
-        </div>
-        <div class="scroll-buttons">
-            <a class="scroll-toc" href="#toc"><i class="fa fa-list-alt" aria-hidden="true"></i></a>
-            <a class="scroll-button" href="#" id="left"><i class="fa fa-arrow-up" aria-hidden="true"></i></a>
-            <a class="scroll-bottom" href="#powered" id="right"><i class="fa fa-arrow-down" aria-hidden="true"></i></a>
-        </div>
-        <div id="all_contect">
-            <div class="four-fifths column">
-                {{!base}}
-                <hr id="last">
-                <p>
-                    {{!license}}
-                </p>
-                <div id="powered">
-                    <a href="https://github.com/2DU/openNAMU"><img src="/views/img/on2.png" width="100px"></a>
-                </div>
-            </div>
-        </div>
-    </body>
-</html>

+ 0 - 31
views/vstopic.tpl

@@ -1,31 +0,0 @@
-<!-- 토론장 -->
-% rebase('base.tpl')
-<div id="tool">
-    <nav class="menu">
-        <a class="menu-item selected" href="#" onclick="return false">
-            {{sub}}
-        </a>
-        <a class="menu-item" href="/topic/{{page}}">토론 목록</a>
-    </nav>
-</div>
-<h1 class="title">
-    {{title}}
-    <sub> ({{sub}})</sub>
-</a>
-</h1>
-<h2 style="margin-top: -15px;">{{toron}}</h2>
-<br>
-{{!rows}}
-<a id="reload" href="javascript:void(0);" onclick="location.href.endsWith('#reload') ?  location.reload(true) : location.href = '#reload'"><i aria-hidden="true" class="fa fa-refresh"></i></a>
-% if(not ban == 1):
-    <form id="usrform" style="{{style}}" method="POST" action="/topic/{{page}}/sub/{{suburl}}">
-        <br>
-        <textarea rows="10" cols="100" name="content" form="usrform"></textarea>
-        <br>
-        <br>
-        <button class="btn btn-primary" type="submit">전송</button>
-    </form>
-    % if(login == 0 and style == ''):
-        <span>비 로그인 상태입니다. 비 로그인으로 작업 시 아이피가 토론에 기록됩니다.</span>
-    % end
-% end