diff options
Diffstat (limited to 'templates/mod')
| -rw-r--r-- | templates/mod/ban_form.html | 4 | ||||
| -rw-r--r-- | templates/mod/config-editor-php.html | 63 | ||||
| -rw-r--r-- | templates/mod/config-editor.html | 34 | ||||
| -rw-r--r-- | templates/mod/dashboard.html | 32 | ||||
| -rw-r--r-- | templates/mod/debug/recent_posts.html | 4 | ||||
| -rw-r--r-- | templates/mod/edit_post_form.html | 2 | ||||
| -rw-r--r-- | templates/mod/log.html | 6 | ||||
| -rw-r--r-- | templates/mod/login.html | 52 | ||||
| -rw-r--r-- | templates/mod/news.html | 2 | ||||
| -rw-r--r-- | templates/mod/search_results.html | 97 |
10 files changed, 244 insertions, 52 deletions
diff --git a/templates/mod/ban_form.html b/templates/mod/ban_form.html index edc1ab3b..6c7560ad 100644 --- a/templates/mod/ban_form.html +++ b/templates/mod/ban_form.html @@ -41,11 +41,11 @@ <label for="reason">{% trans 'Message' %}</label> </th> <td> - <input type="checkbox" id="public_message" name="public_message"> + <input type="checkbox" id="public_message" name="public_message"{% if config.mod.check_ban_message %} checked{% endif %}> <input type="text" name="message" id="message" size="35" maxlength="200" value="{{ config.mod.default_ban_message|e }}"> <span class="unimportant">({% trans 'public; attached to post' %})</span> <script type="text/javascript"> - document.getElementById('message').disabled = true; + document.getElementById('message').disabled = !document.getElementById('public_message').checked; document.getElementById('public_message').onchange = function() { document.getElementById('message').disabled = !this.checked; } diff --git a/templates/mod/config-editor-php.html b/templates/mod/config-editor-php.html new file mode 100644 index 00000000..4f76b5dd --- /dev/null +++ b/templates/mod/config-editor-php.html @@ -0,0 +1,63 @@ +<div style="max-width:800px;margin:auto"> + <p> + Any changes you make here will simply be appended to <code>{{ file }}</code>. If you wish to make the most of Tinyboard's customizability, you can instead edit the file directly. This page is intended for making quick changes and for those who don't have a basic understanding of PHP code. + </p> + {% if boards|count %} + <ul> + {% if board %} + <li><a href="?/config">Edit site-wide config</a></li> + {% endif %} + {% for _board in boards if _board.uri != board %} + <li> + <a href="?/config/{{ _board.uri }}">Edit config for {{ config.board_abbreviation|sprintf(_board.uri) }}</a> + </li> + {% endfor %} + </ul> + {% endif %} + + {% if readonly %} + <p>Tinyboard does not have the required permissions to edit <code>{{ file }}</code>. To make changes, you will need to change the file's permissions first or manually edit the code.</p> + {% endif %} + + + {% if not readonly %}<form method="post" action="">{% endif %} + <textarea name="code" id="code" style="margin:auto;width:100%;height:500px{% if readonly %};background:#eee" readonly{% else %}"{% endif %}> + {{ php }} + </textarea> + + <ul style="padding:0;text-align:center;list-style:none"> + <li><input name="save" type="submit" value="{% trans 'Save changes' %}"{% if readonly %} disabled{% endif %}></li> + </ul> + {% if not readonly %}</form>{% endif %} +</div> + +<script type="text/javascript"> +var observe; +if (window.attachEvent) { + observe = function (element, event, handler) { + element.attachEvent('on'+event, handler); + }; +} +else { + observe = function (element, event, handler) { + element.addEventListener(event, handler, false); + }; +} + +var text = document.getElementById('code'); +function resize () { + text.style.height = 'auto'; + text.style.height = text.scrollHeight+'px'; +} +/* 0-timeout to get the already changed text */ +function delayedResize () { + window.setTimeout(resize, 0); +} +observe(text, 'change', resize); +observe(text, 'cut', delayedResize); +observe(text, 'paste', delayedResize); +observe(text, 'drop', delayedResize); +observe(text, 'keydown', delayedResize); + +resize(); +</script>
\ No newline at end of file diff --git a/templates/mod/config-editor.html b/templates/mod/config-editor.html index ec7213bb..a43f8cf7 100644 --- a/templates/mod/config-editor.html +++ b/templates/mod/config-editor.html @@ -1,10 +1,25 @@ +<p> + Any changes you make here will simply be appended to <code>{{ file }}</code>. If you wish to make the most of Tinyboard's customizability, you can instead edit the file directly. This page is intended for making quick changes and for those who don't have a basic understanding of PHP code. +</p> +{% if boards|count %} + <ul> + {% if board %} + <li><a href="?/config">Edit site-wide config</a></li> + {% endif %} + {% for _board in boards if _board.uri != board %} + <li> + <a href="?/config/{{ _board.uri }}">Edit config for {{ config.board_abbreviation|sprintf(_board.uri) }}</a> + </li> + {% endfor %} + </ul> +{% endif %} <form method="post" action=""> <table class="mod config-editor"> <tr> - <th class="minimal">Name</th> - <th>Value</th> - <th class="minimal">Type</th> - <th>Description</th> + <th class="minimal">{% trans 'Name' %}</th> + <th>{% trans 'Value' %}</th> + <th class="minimal">{% trans 'Type' %}</th> + <th>{% trans 'Description' %}</th> </tr> {% for var in conf if var.type != 'array' %} {% if var.name|count == 1 %} @@ -25,6 +40,13 @@ <td> {% if var.type == 'string' %} <input name="{{ name }}" type="text" value="{{ var.value|e }}"> + {% elseif var.permissions %} + <select name="{{ name }}"> + <option value="{{ constant('JANITOR') }}"{% if var.value == constant('JANITOR')%} selected{% endif %}>JANITOR</option> + <option value="{{ constant('MOD') }}"{% if var.value == constant('MOD')%} selected{% endif %}>MOD</option> + <option value="{{ constant('ADMIN') }}"{% if var.value == constant('ADMIN')%} selected{% endif %}>ADMIN</option> + <option value="{{ constant('DISABLED') }}"{% if var.value == constant('DISABLED')%} selected{% endif %}>DISABLED</option> + </select> {% elseif var.type == 'integer' %} <input name="{{ name }}" type="number" value="{{ var.value|e }}"> {% elseif var.type == 'boolean' %} @@ -42,8 +64,8 @@ {{ var.type|e }} </td> - <td> - {{ var.comment|join('<br>') }} + <td style="word-wrap:break-word;width:50%"> + {{ var.comment|join(' ') }} </td> </tr> {% endfor %} diff --git a/templates/mod/dashboard.html b/templates/mod/dashboard.html index 619663f5..e9fb7c9c 100644 --- a/templates/mod/dashboard.html +++ b/templates/mod/dashboard.html @@ -94,7 +94,7 @@ {% if mod|hasPermission(config.mod.rebuild) %} <li><a href="?/rebuild">{% trans 'Rebuild' %}</a></li> {% endif %} - {% if mod|hasPermission(config.mod.show_config) %} + {% if mod|hasPermission(config.mod.edit_config) %} <li><a href="?/config">{% trans 'Configuration' %}</a></li> {% endif %} @@ -102,17 +102,29 @@ </fieldset> {% if mod|hasPermission(config.mod.search) %} -<fieldset> - <legend>{% trans 'Search' %}</legend> - - <ul> - <li> - {% include 'mod/search_form.html' %} - </li> - </ul> -</fieldset> + <fieldset> + <legend>{% trans 'Search' %}</legend> + + <ul> + <li> + {% include 'mod/search_form.html' %} + </li> + </ul> + </fieldset> {% endif %} +{% if config.mod.dashboard_links|count %} + <fieldset> + <legend>{% trans 'Other' %}</legend> + + <ul> + {% for label,link in config.mod.dashboard_links %} + <li><a href="{{ link }}">{{ label }}</a></li> + {% endfor %} + </ul> + </fieldset> +{% endif %} + {% if config.debug %} <fieldset> <legend>{% trans 'Debug' %}</legend> diff --git a/templates/mod/debug/recent_posts.html b/templates/mod/debug/recent_posts.html index 740ed21e..b84d24ab 100644 --- a/templates/mod/debug/recent_posts.html +++ b/templates/mod/debug/recent_posts.html @@ -1,4 +1,4 @@ -<table class="modlog"> +<table class="modlog" style="word-wrap: break-word;"> <tr> <th>Time</th> <th>Board</th> @@ -24,7 +24,7 @@ {% else %} {% set thread = post.id %} {% endif %} - <a href="{{ config.root ~ post.board ~ '/' ~ config.dir.res}}{{ config.file_page|sprintf(thread) }}#{{ post.id }}"> + <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ config.file_page|sprintf(thread) }}#{{ post.id }}"> {{ post.id }} </a> </td> diff --git a/templates/mod/edit_post_form.html b/templates/mod/edit_post_form.html index 146e725b..a2980d35 100644 --- a/templates/mod/edit_post_form.html +++ b/templates/mod/edit_post_form.html @@ -32,7 +32,7 @@ {% trans %}Comment{% endtrans %} </th> <td> - <textarea name="body" id="body" rows="8" cols="35">{% if raw %}{{ post.body | e }}{% else %}{{ post.body_nomarkup }}{% endif %}</textarea> + <textarea name="body" id="body" rows="8" cols="35">{% if raw %}{{ post.body }}{% else %}{{ post.body_nomarkup }}{% endif %}</textarea> </td> </tr> </table> diff --git a/templates/mod/log.html b/templates/mod/log.html index e75330b5..0aa3f110 100644 --- a/templates/mod/log.html +++ b/templates/mod/log.html @@ -18,7 +18,11 @@ {% endif %} </td> <td class="minimal"> - <a href="?/IP/{{ log.ip }}">{{ log.ip }}</a> + {% if mod|hasPermission(config.mod.show_ip_modlog) %} + <a href="?/IP/{{ log.ip }}">{{ log.ip }}</a> + {% else %} + <em>hidden</em> + {% endif %} </td> <td class="minimal"> <span title="{{ log.time|date(config.post_date) }}">{{ log.time|ago }}</span> diff --git a/templates/mod/login.html b/templates/mod/login.html index 43a28d56..476897a6 100644 --- a/templates/mod/login.html +++ b/templates/mod/login.html @@ -1,26 +1,26 @@ -{% if error %}<h2 style="text-align:center">{{ error }}</h2>{% endif %}
-<form action="" method="post">
-<table style="margin-top:25px;">
- <tr>
- <th>
- {% trans 'Username' %}
- </th>
- <td>
- <input type="text" name="username" size="20" maxlength="30" value="{{ username|e }}">
- </td>
- </tr>
- <tr>
- <th>
- {% trans 'Password' %}
- </th>
- <td>
- <input type="password" name="password" size="20" maxlength="30" value="">
- </td>
- </tr>
- <tr>
- <td></td>
- <td>
- <input type="submit" name="login" value="{% trans %}Continue{% endtrans %}" />
- </td>
-</table>
-</form>
+{% if error %}<h2 style="text-align:center">{{ error }}</h2>{% endif %} +<form action="" method="post"> +<table style="margin-top:25px;"> + <tr> + <th> + {% trans 'Username' %} + </th> + <td> + <input type="text" name="username" size="20" maxlength="30" value="{{ username|e }}"> + </td> + </tr> + <tr> + <th> + {% trans 'Password' %} + </th> + <td> + <input type="password" name="password" size="20" maxlength="30" value=""> + </td> + </tr> + <tr> + <td></td> + <td> + <input type="submit" name="login" value="{% trans %}Continue{% endtrans %}" /> + </td> +</table> +</form> diff --git a/templates/mod/news.html b/templates/mod/news.html index b6c35798..b0335e0a 100644 --- a/templates/mod/news.html +++ b/templates/mod/news.html @@ -52,7 +52,7 @@ <em>{% trans 'no subject' %}</em> {% endif %} <small class="unimportant"> - — {% trans 'by' %} {{ post.name }} {% trans 'at' %} {{ notice.time|date(config.post_date) }} + — {% trans 'by' %} {{ post.name }} {% trans 'at' %} {{ post.time|date(config.post_date) }} </small> </h2> <p> diff --git a/templates/mod/search_results.html b/templates/mod/search_results.html index b441a28f..0c87f75f 100644 --- a/templates/mod/search_results.html +++ b/templates/mod/search_results.html @@ -39,7 +39,7 @@ </tr> {% endfor %} </table> -{% endif %} +{% endif %} {% if search_type == 'bans' %} <table class="modlog" style="width:100%"> @@ -125,7 +125,7 @@ </tr> {% endfor %} </table> -{% endif %} +{% endif %} {% if search_type == 'log' %} <table class="modlog"> @@ -166,7 +166,98 @@ </tr> {% endfor %} </table> -{% endif %} +{% endif %} + +{% if search_type == 'posts' %} + <table class="modlog" style="word-wrap: break-word;"> + <tr> + <th>Time</th> + <th>Board</th> + <th>ID</th> + <th>Thread</th> + <th>IP</th> + <th>Name</th> + <th>Subject</th> + <th>File</th> + <th>Body (snippet)</th> + </tr> + {% for post in results %} + <tr> + <td class="minimal"> + <small>{{ post.time | ago }} ago</small> + </td> + <td class="minimal"> + <a href="?/{{ config.board_path|sprintf(post.board) }}{{ config.file_index }}">{{ config.board_abbreviation|sprintf(post.board) }}</a> + </td> + <td class="minimal"> + {% if post.thread %} + {% set thread = post.thread %} + {% else %} + {% set thread = post.id %} + {% endif %} + <a href="?/{{ post.board ~ '/' ~ config.dir.res}}{{ config.file_page|sprintf(thread) }}#{{ post.id }}"> + {{ post.id }} + </a> + </td> + <td class="minimal"> + <small> + {% if post.thread %} + {{ post.thread }} + {% else %} + (OP) + {% endif %} + </small> + </td> + <td class="minimal"> + {% if mod|hasPermission(config.mod.show_ip, post.board) %} + <a href="?/IP/{{ post.ip }}"> + {{ post.ip }} + </a> + {% else %} + <em>hidden</em> + {% endif %} + </td> + <td style="max-width:100px"> + <small> + {% if post.email|length > 0 %} + {# start email #} + <a class="email" href="mailto:{{ post.email }}"> + {% endif %} + {% set capcode = post.capcode|capcode %} + <span {% if capcode.name %}style="{{ capcode.name }}" {% endif %}class="name">{{ post.name }}</span> + {% if post.trip|length > 0 %} + <span {% if capcode.trip %}style="{{ capcode.trip }}" {% endif %}class="trip">{{ post.trip }}</span> + {% endif %} + {% if post.email|length > 0 %} + {# end email #} + </a> + {% endif %} + {% if capcode %} + {{ capcode.cap }} + {% endif %} + </small> + </td> + <td style="max-width:250px"> + {% if post.subject %} + <small>{{ post.subject }}</small> + {% else %} + – + {% endif %} + </td> + <td style="max-width:200px"> + {% if post.file %} + <small>{{ post.filename }} ({{ post.filesize | filesize }})</small> + {% else %} + – + {% endif %} + </td> + <td> + <small><em>{{ post.snippet }}</em></small> + </td> + </tr> + {% endfor %} + </table> +{% endif %} {% if result_count > results|count %} <p class="unimportant" style="text-align:center;word-wrap:break-word"> |
