Commit 36f4d4d7 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

Merge branch 'master' of git.fsmpi.rwth-aachen.de:protokollsystem/proto3

parents 48ff2ad7 038648f4
......@@ -281,7 +281,6 @@ def edit_reminder(type_id, reminder_id):
@app.route("/type/reminder/delete/<int:type_id>/<int:reminder_id>")
@login_required
@group_required(config.ADMIN_GROUP)
def delete_reminder(type_id, reminder_id):
protocoltype = ProtocolType.query.filter_by(id=type_id).first()
if protocoltype is None:
......@@ -638,7 +637,17 @@ def upload_new_protocol_by_file():
return redirect(request.args.get("next") or url_for("show_protocol", protocol_id=protocol.id))
return redirect(request.args.get("fail") or url_for("new_protocol"))
@app.route("/protocol/recompile/<int:protocol_id>")
@login_required
@group_required(config.ADMIN_GROUP)
def recompile_protocol(protocol_id):
user = current_user()
protocol = Protocol.query.filter_by(id=protocol_id).first()
if protocol is None or not protocol.protocoltype.has_modify_right(user):
flash("Invalides Protokoll oder keine Berechtigung.", "alert-error")
return redirect(request.args.get("next") or url_for("index"))
tasks.parse_protocol(protocol)
return redirect(request.args.get("next") or url_for("show_protocol", protocol_id=protocol.id))
@app.route("/protocol/source/<int:protocol_id>")
@login_required
......@@ -834,9 +843,7 @@ def list_todos():
if search_term.lower() in todo.description.lower()
]
def _sort_key(todo):
first_protocol = todo.get_first_protocol()
result = (not todo.is_done(), first_protocol.date if first_protocol is not None else datetime.now().date())
return result
return (not todo.is_done(), todo.get_id())
todos = sorted(todos, key=_sort_key, reverse=True)
page = _get_page()
page_count = int(math.ceil(len(todos) / config.PAGE_LENGTH))
......
......@@ -25,7 +25,7 @@
{% if not protocol.is_done() %}
<a class="btn btn-default" href="{{url_for("get_protocol_template", protocol_id=protocol.id)}}">Vorlage</a>
{% if config.ETHERPAD_ACTIVE %}
<a class="btn btn-primary" href="{{url_for("etherpush_protocol", protocol_id=protocol.id)}}">In Etherpad</a>
<a class="btn btn-primary" href="{{url_for("etherpush_protocol", protocol_id=protocol.id)}}">Etherpad</a>
{% endif %}
{% else %}
{% if config.MAIL_ACTIVE %}
......@@ -35,15 +35,13 @@
<a class="btn btn-default" href="{{url_for("publish_protocol", protocol_id=protocol.id)}}">Veröffentlichen</a>
{% endif %}
{% endif %}
{% if config.ETHERPAD_ACTIVE %}
<a class="btn btn-default" href="{{protocol.get_etherpad_link()}}" target="_blank">Etherpad</a>
{% endif %}
<a class="btn btn-default" href="{{url_for("show_type", type_id=protocol.protocoltype.id)}}">Typ</a>
{% if protocol.has_compiled_document() %}
<a class="btn btn-success" href="{{url_for("download_document", document_id=protocol.get_compiled_document().id)}}">Download</a>
{% endif %}
{% if has_admin_right %}
<a class="btn btn-danger" href="{{url_for("delete_protocol", protocol_id=protocol.id)}}" onclick="return confirm('Bist du dir sicher, dass du das Protokoll {{protocol.get_identifier()}} löschen möchtest?');">Löschen</a>
<a class="btn btn-default" href="{{url_for("recompile_protocol", protocol_id=protocol.id)}}">Neu kompilieren</a>
<a class="btn btn-danger" href="{{url_for("delete_protocol", protocol_id=protocol.id)}}" onclick="return confirm('Bist du dir sicher, dass du das Protokoll {{protocol.get_identifier()}} löschen möchtest?');">Löschen</a>
{% endif %}
{% endif %}
</div>
......
......@@ -209,9 +209,8 @@ class MeetingRemindersTable(Table):
]
action_links = [
Table.link(url_for("edit_reminder", type_id=self.protocoltype.id, reminder_id=reminder.id), "Ändern"),
Table.link(url_for("delete_reminder", type_id=self.protocoltype.id, reminder_id=reminder.id), "Löschen", confirm="Bist du dir sicher, dass du die Einladungsmail {} Tage vor der Sitzung löschen willst?".format(reminder.days_before))
]
if self.protocoltype.has_admin_right(user):
action_links.append(Table.link(url_for("delete_reminder", type_id=self.protocoltype.id, reminder_id=reminder.id), "Löschen", confirm="Bist du dir sicher, dass du die Einladungsmail {} Tage vor der Sitzung löschen willst?".format(reminder.days_before)))
action_part = [Table.concat(action_links)]
return general_part + action_part
......@@ -387,10 +386,9 @@ class DefaultMetasTable(Table):
meta.key,
]
links = [
Table.link(url_for("edit_defaultmeta", meta_id=meta.id), "Ändern")
Table.link(url_for("edit_defaultmeta", meta_id=meta.id), "Ändern"),
Table.link(url_for("delete_defaultmeta", meta_id=meta.id, confirm="Bist du dir sicher, dass du das Metadatenfeld {} löschen willst?".format(meta.name)), "Löschen")
]
if meta.protocoltype.has_admin_right(user):
links.append(Table.link(url_for("delete_defaultmeta", meta_id=meta.id, confirm="Bist du dir sicher, dass du das Metadatenfeld {} löschen willst?".format(meta.name)), "Löschen"))
link_part = [Table.concat(links)]
return general_part + link_part
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment