diff --git a/server.py b/server.py index 7f8edb671d3b58499b9a7cb952200f60291130c6..cb8b2c8f3cb9c2e6fa68f17feaf6504b88bd9ef4 100755 --- a/server.py +++ b/server.py @@ -637,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 @@ -833,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>