From 25562e67d9202480eb8faf4864adf04ebed67d9e Mon Sep 17 00:00:00 2001 From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de> Date: Mon, 6 Mar 2017 15:36:30 +0100 Subject: [PATCH] Show TOPs from every network. --- server.py | 12 ++++-------- templates/index.html | 6 +----- templates/protocol-show.html | 36 ++++++++++++++++++++---------------- 3 files changed, 25 insertions(+), 29 deletions(-) diff --git a/server.py b/server.py index 58c5268..2aeaf52 100755 --- a/server.py +++ b/server.py @@ -144,7 +144,7 @@ def index(): return protocol.date return datetime.now().date() current_day = datetime.now().date() - all_open_protocols = sorted( + open_protocols = sorted( [ protocol for protocol in protocols if not protocol.done @@ -152,10 +152,6 @@ def index(): ], key=_protocol_sort_key ) - open_protocols = [ - protocol for protocol in all_open_protocols - if protocol.protocoltype.has_public_view_right(user) - ] finished_protocols = sorted( [ protocol for protocol in protocols @@ -180,7 +176,7 @@ def index(): return protocol.date if protocol.date is not None else datetime.now().date() todos = sorted(todos, key=_todo_sort_key, reverse=True) todos_table = TodosTable(todos) if todos is not None else None - return render_template("index.html", open_protocols=open_protocols, protocol=protocol, todos=todos, todos_table=todos_table, all_open_protocols=all_open_protocols) + return render_template("index.html", open_protocols=open_protocols, protocol=protocol, todos=todos) @app.route("/documentation") @login_required @@ -377,7 +373,7 @@ def list_protocols(): )) protocols = [ protocol for protocol in protocol_query.all() - if protocol.protocoltype.has_public_view_right(user) + if protocol.protocoltype.has_public_view_right(user, check_networks=False) ] def _matches_search(content): content = content.lower() @@ -471,7 +467,7 @@ def new_protocol(): def show_protocol(protocol): user = current_user() errors_table = ErrorsTable(protocol.errors) - if not protocol.protocoltype.has_public_view_right(user): # yes, feature + if not protocol.protocoltype.has_public_view_right(user, check_networks=False): # yes, feature flash("Die fehlen die nötigen Zugriffsrechte.", "alert-error") return redirect(request.args.get("next") or url_for("login")) visible_documents = [ diff --git a/templates/index.html b/templates/index.html index fc3356a..d637666 100644 --- a/templates/index.html +++ b/templates/index.html @@ -18,11 +18,7 @@ <li><a href="{{url_for("show_protocol", protocol_id=protocol.id)}}">{{protocol.protocoltype.name}}</a> am {{protocol.date|datify}}</li> {% endfor %} {% else %} - {% if all_open_protocols|length == 0 %} - <li>Keine anstehenden Sitzungen</li> - {% else %} - <li>Die Sitzungen sind nur aus einem eingeschränkten Teil des Internets, nicht weltweit sichtbar.</li> - {% endif %} + <li>Keine anstehenden Sitzungen</li> {% endif %} </ul> {% if protocol is not none %} diff --git a/templates/protocol-show.html b/templates/protocol-show.html index 97ef0b5..d5bf5db 100644 --- a/templates/protocol-show.html +++ b/templates/protocol-show.html @@ -70,22 +70,26 @@ <h3>Tagesordnung{% if has_modify_right and not protocol.has_nonplanned_tops() %} <a href="{{url_for("new_top", protocol_id=protocol.id)}}">Top hinzufügen</a>{% endif %}</h3> {% include "protocol-tops-include.html" %} - {% if protocol.is_done() and has_public_view_right %} - <h3>Beschlüsse</h3> - <ul> - {% if protocol.decisions|length > 0 %} - {% for decision in protocol.decisions %} - <li> - {{decision.content}} - {% if config.PRINTING_ACTIVE and has_private_view_right and decision.document is not none %} - <a href="{{url_for("print_decision", document_id=decision.document.id)}}">Drucken</a> - {% endif %} - </li> - {% endfor %} - {% else %} - <li>Keine Beschlüsse</li> - {% endif %} - </ul> + {% if protocol.is_done() %} + <h3>Beschlüsse</h3> + <ul> + {% if protocol.decisions|length > 0 %} + {% if has_public_view_right %} + {% for decision in protocol.decisions %} + <li> + {{decision.content}} + {% if config.PRINTING_ACTIVE and has_private_view_right and decision.document is not none %} + <a href="{{url_for("print_decision", document_id=decision.document.id)}}">Drucken</a> + {% endif %} + </li> + {% endfor %} + {% else %} + <li>Protokoll und Beschlüsse sind in einem eingeschränkten Netzwerk sichtbar.</li> + {% endif %} + {% else %} + <li>Keine Beschlüsse</li> + {% endif %} + </ul> {% endif %} </div> <div id="right-column" class="col-lg-6"> -- GitLab