2019-09-06 10:00:39 +02:00
|
|
|
{% extends "base/base.html" %}
|
2019-09-08 14:34:51 +02:00
|
|
|
{% import "widgets/editor.html" as widget_editor %}
|
2020-08-02 17:28:43 +02:00
|
|
|
{% import "widgets/pagination.html" as widget_pagination with context %}
|
2019-09-06 10:00:39 +02:00
|
|
|
|
|
|
|
{% block title %}
|
|
|
|
<a href='/forum'>Forum de Planète Casio</a> » <h1>{{ f.name }}</h1>
|
|
|
|
{% endblock %}
|
|
|
|
|
|
|
|
{% block content %}
|
|
|
|
<section>
|
2019-09-09 08:03:23 +02:00
|
|
|
<p>{{ f.descr }}</p>
|
2019-09-08 14:34:51 +02:00
|
|
|
|
2020-08-02 17:28:43 +02:00
|
|
|
{% if topics.items %}
|
2019-12-03 20:32:01 +01:00
|
|
|
<h2>Sujets</h2>
|
2020-08-02 17:28:43 +02:00
|
|
|
|
|
|
|
{{ widget_pagination.paginate(topics, 'forum_page', None, {'f': f}) }}
|
|
|
|
|
2019-09-09 08:03:23 +02:00
|
|
|
<table class=topiclist>
|
|
|
|
<tr><th>Sujet</th><th>Auteur</th><th>Date de création</th>
|
2020-08-02 17:28:43 +02:00
|
|
|
<th>Commentaires</th><th>Vues</th></tr>
|
2019-09-09 08:03:23 +02:00
|
|
|
|
2020-08-02 17:28:43 +02:00
|
|
|
{% for t in topics.items %}
|
2020-07-16 23:58:21 +02:00
|
|
|
<tr><td><a href='{{ url_for('forum_topic', f=t.forum, page=(t,1)) }}'>{{ t.title }}</a></td>
|
2019-12-03 20:32:01 +01:00
|
|
|
<td><a href='{{ url_for('user', username=t.author.name) }}'>{{ t.author.name }}</a></td>
|
|
|
|
<td>{{ t.date_created | date }}</td>
|
2019-12-07 16:12:23 +01:00
|
|
|
<td>{{ t.thread.comments.count() }}</td>
|
2019-12-03 20:32:01 +01:00
|
|
|
<td>{{ t.views }} </td></tr>
|
2019-09-08 14:34:51 +02:00
|
|
|
{% endfor %}
|
2019-09-09 08:03:23 +02:00
|
|
|
</table>
|
2020-08-02 17:28:43 +02:00
|
|
|
|
|
|
|
{{ widget_pagination.paginate(topics, 'forum_page', None, {'f': f}) }}
|
|
|
|
|
2019-12-07 16:12:23 +01:00
|
|
|
{% elif not f.sub_forums %}
|
2020-08-02 17:28:43 +02:00
|
|
|
<p>Il n'y a aucun topic sur ce forum ! Animons-le vite !</p>
|
2019-09-08 14:34:51 +02:00
|
|
|
{% endif %}
|
|
|
|
|
2019-12-07 16:12:23 +01:00
|
|
|
{% if f.sub_forums %}
|
2019-12-03 20:32:01 +01:00
|
|
|
<h2>Forums</h2>
|
|
|
|
<table class=forumlist>
|
|
|
|
<tr><th>{{ f.name }}</th><th>Nombre de sujets</th></tr>
|
|
|
|
|
|
|
|
{% for sf in f.sub_forums %}
|
|
|
|
<tr><td><a href='/forum{{ sf.url }}'>{{ sf.name }}</td>
|
2020-08-02 17:28:43 +02:00
|
|
|
<td>{{ sf.topics.count() }}</td></tr>
|
2019-12-03 20:32:01 +01:00
|
|
|
<tr><td>{{ sf.descr }}</td><td></td></tr>
|
|
|
|
{% endfor %}
|
2019-09-08 14:34:51 +02:00
|
|
|
|
2019-12-03 20:32:01 +01:00
|
|
|
</table>
|
|
|
|
{% endif %}
|
|
|
|
|
review of privileges and forum permissions
* Sorted privileges into categories, similar to the v4.3 style
Added privilege check utilities:
* Forum: is_news(), is_default_accessible() and is_default_postable()
* Member: can_access_forum(), can_post_in_forum(), can_edit_post(),
and can_delete_post()
Unfortunately current_user is not a Guest when logged out, so one
cannot usually write current_user.can_*() without checking for
authentication first, so the checks are still somewhat verbose.
Reviewed forum permissions; the following permission issues have been
fixed (I have tested most but not all of them prior to fixing):
* app/routes/forum/index.py: Users that were not meant to access a
forum could still obtain a listing of the topics
* app/routes/forum/topic.py: Users that were not meant to see topics
could still read them by browsing the URL
* app/routes/forum/topic.py: Authenticated users could post in any
topic, including ones that they should not have access to
* app/routes/posts/edit.py: Users with edit.posts (eg. mods) could edit
and delete messages in forums they can't access (eg. creativecalc)
* app/templates/account/user.html: Users with admin panel access would
see account editing links they can't use (affects developers)
* app/templates/base/navbar/forum.html: The "Forum" tab would list all
forums including ones the user doesn't have access to
* app/templates/forum/index.html: Users would see every single forum,
including ones they can't access
* app/template/widgets/thread.html: Anyone would see Edit/Delete links
on every message, even though most were unusable
Miscellaneous changes:
* app/routes/forum/topic.py: Ordered comments by date as intended,
which I assume worked by chance until now
* Removed the old assets/privs.txt files which is now superseded by the
list implemented in app/data/groups.yaml
This commit changes group and forum information, run master.py with:
@> forums update
@> groups update
2021-02-26 18:29:25 +01:00
|
|
|
{% if (V5Config.ENABLE_GUEST_POST and f.is_default_postable())
|
|
|
|
or (current_user.is_authenticated and current_user.can_post_in_forum(f)) %}
|
2019-12-03 20:32:01 +01:00
|
|
|
<div class=form>
|
|
|
|
<h2>Créer un nouveau sujet</h2>
|
2019-09-08 14:34:51 +02:00
|
|
|
<form action="" method="post" enctype="multipart/form-data">
|
|
|
|
{{ form.hidden_tag() }}
|
2020-07-18 07:52:29 +02:00
|
|
|
{% if form.pseudo %}
|
|
|
|
<div>
|
|
|
|
{{ form.pseudo.label }}
|
|
|
|
{{ form.pseudo() }}
|
|
|
|
{% for error in form.pseudo.errors %}
|
|
|
|
<span class="msgerror">{{ error }}</span>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
{% endif %}
|
2019-09-08 14:34:51 +02:00
|
|
|
|
|
|
|
<div>
|
|
|
|
{{ form.title.label }}
|
|
|
|
{{ form.title() }}
|
|
|
|
{% for error in form.title.errors %}
|
|
|
|
<span class="msgerror">{{ error }}</span>
|
|
|
|
{% endfor %}
|
|
|
|
</div>
|
|
|
|
|
2019-12-03 20:32:01 +01:00
|
|
|
{{ widget_editor.text_editor(form.message) }}
|
2019-09-08 14:34:51 +02:00
|
|
|
|
2020-08-01 21:26:06 +02:00
|
|
|
{{ form.attachments }}
|
|
|
|
{% for error in form.attachments.errors %}
|
|
|
|
<span class="msgerror">{{ error }}</span>
|
|
|
|
{% endfor %}
|
|
|
|
|
2020-07-13 22:54:34 +02:00
|
|
|
<div>{{ form.submit(class_='bg-ok') }}</div>
|
2019-09-08 14:34:51 +02:00
|
|
|
</form>
|
|
|
|
</div>
|
2019-12-03 20:32:01 +01:00
|
|
|
{% endif %}
|
2019-09-06 10:00:39 +02:00
|
|
|
</section>
|
|
|
|
{% endblock %}
|