diff --git a/server.py b/server.py index 0df8286ed68797bbbdb902d20062cccc63ec9ee1..84559ee4f0d5bcfa94834671a72aeae3e7531246 100755 --- a/server.py +++ b/server.py @@ -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)) diff --git a/templates/protocol-show.html b/templates/protocol-show.html index 3ea41a707c23eae6afb0b0760653ea3b265bf5e6..b840e2bab725daf630e3a9826d998bbba0286564 100644 --- a/templates/protocol-show.html +++ b/templates/protocol-show.html @@ -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> diff --git a/views/tables.py b/views/tables.py index c64aa40a18ee12e3d4abb67aec85caf555dc2930..9ac653db4170bc49006d2da802b26ed322e8ab11 100644 --- a/views/tables.py +++ b/views/tables.py @@ -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