Commit 57b4ae79 authored by Administrator's avatar Administrator

actually use internal documents as implemented

/close #74
parent 501cd1f1
......@@ -487,7 +487,7 @@ def show_protocol(protocol):
if (not document.is_private and document.protocol.has_public_view_right(user))
or (document.is_private and document.protocol.protocoltype.has_private_view_right(user))
]
documents_table = DocumentsTable(visible_documents)
documents_table = DocumentsTable(visible_documents, protocol)
document_upload_form = DocumentUploadForm()
source_upload_form = KnownProtocolSourceUploadForm()
time_diff = protocol.date - datetime.now().date()
......
......@@ -153,7 +153,7 @@ class NewProtocolForm(FlaskForm):
class DocumentUploadForm(FlaskForm):
document = FileField("Datei")
private = BooleanField("Intern")
is_private = BooleanField("Intern")
class KnownProtocolSourceUploadForm(FlaskForm):
source = FileField("Quellcode")
......
......@@ -62,16 +62,13 @@ class ProtocolsTable(Table):
result = ["ID", "Sitzung", "Sitzung", "Datum"]
state_part = ["Status"]
search_part = ["Suchergebnis"]
login_part = ["Typ"]
admin_part = ["Löschen"]
login_part = ["Typ", ""]
if self.search_results is None:
result.extend(state_part)
else:
result.extend(search_part)
if check_login():
result.extend(login_part)
if protocol.protocoltype.has_admin_right(user):
result.extend(admin_part)
return result
def classes(self):
......@@ -101,6 +98,8 @@ class ProtocolsTable(Table):
result.append(Table.link(url_for("show_type", protocoltype_id=protocol.protocoltype.id), protocol.protocoltype.short_name))
if protocol.protocoltype.has_admin_right(user):
result.append(Table.link(url_for("delete_protocol", protocol_id=protocol.id), "Löschen", confirm="Bist du dir sicher, dass du das Protokoll {} löschen möchtest?".format(protocol.get_identifier())))
else:
result.append("")
else:
result.extend(["", ""])
return result
......@@ -410,14 +409,27 @@ class DecisionsTable(Table):
return content_part + category_part + action_part
class DocumentsTable(Table):
def __init__(self, documents):
def __init__(self, documents, protocol):
super().__init__("Anhang", documents)
self.protocol = protocol
def headers(self):
return ["ID", "Name", ""]
user = current_user()
general_headers = ["ID", "Name"]
visibility_headers = []
if self.protocol.has_private_view_right(user):
visibility_headers = ["Sichtbarkeit"]
action_headers=[""]
return general_headers + visibility_headers + action_headers
def classes(self):
return [None, None, "hidden-xs"]
user = current_user()
general_part = [None, None]
visibility_part = []
if self.protocol.has_private_view_right(user):
visibility_part = [None]
action_part = ["hidden-xs"]
return general_part + visibility_part + action_part
def row(self, document):
user = current_user()
......@@ -426,11 +438,15 @@ class DocumentsTable(Table):
links.append(Table.link(url_for("print_document", document_id=document.id), "Drucken"))
if document.protocol.protocoltype.has_admin_right(user):
links.append(Table.link(url_for("delete_document", document_id=document.id), "Löschen", confirm="Bist du dir sicher, dass du das Dokument {} löschen willst?".format(document.name)))
return [
general_part = [
document.id,
Table.link(url_for("download_document", document_id=document.id), document.name),
Table.concat(links)
]
visibility_part = []
if document.protocol.has_private_view_right(user):
visibility_part = ["Intern" if document.is_private else "Öffentlich"]
action_part = [Table.concat(links)]
return general_part + visibility_part + action_part
class TodoMailsTable(Table):
def __init__(self, todomails):
......
Markdown is supported
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