Commit 57b4ae79 authored by Administrator's avatar Administrator
Browse files

actually use internal documents as implemented

/close #74
parent 501cd1f1
...@@ -487,7 +487,7 @@ def show_protocol(protocol): ...@@ -487,7 +487,7 @@ def show_protocol(protocol):
if (not document.is_private and document.protocol.has_public_view_right(user)) 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)) 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() document_upload_form = DocumentUploadForm()
source_upload_form = KnownProtocolSourceUploadForm() source_upload_form = KnownProtocolSourceUploadForm()
time_diff = protocol.date - datetime.now().date() time_diff = protocol.date - datetime.now().date()
......
...@@ -153,7 +153,7 @@ class NewProtocolForm(FlaskForm): ...@@ -153,7 +153,7 @@ class NewProtocolForm(FlaskForm):
class DocumentUploadForm(FlaskForm): class DocumentUploadForm(FlaskForm):
document = FileField("Datei") document = FileField("Datei")
private = BooleanField("Intern") is_private = BooleanField("Intern")
class KnownProtocolSourceUploadForm(FlaskForm): class KnownProtocolSourceUploadForm(FlaskForm):
source = FileField("Quellcode") source = FileField("Quellcode")
......
...@@ -62,16 +62,13 @@ class ProtocolsTable(Table): ...@@ -62,16 +62,13 @@ class ProtocolsTable(Table):
result = ["ID", "Sitzung", "Sitzung", "Datum"] result = ["ID", "Sitzung", "Sitzung", "Datum"]
state_part = ["Status"] state_part = ["Status"]
search_part = ["Suchergebnis"] search_part = ["Suchergebnis"]
login_part = ["Typ"] login_part = ["Typ", ""]
admin_part = ["Löschen"]
if self.search_results is None: if self.search_results is None:
result.extend(state_part) result.extend(state_part)
else: else:
result.extend(search_part) result.extend(search_part)
if check_login(): if check_login():
result.extend(login_part) result.extend(login_part)
if protocol.protocoltype.has_admin_right(user):
result.extend(admin_part)
return result return result
def classes(self): def classes(self):
...@@ -101,6 +98,8 @@ class ProtocolsTable(Table): ...@@ -101,6 +98,8 @@ class ProtocolsTable(Table):
result.append(Table.link(url_for("show_type", protocoltype_id=protocol.protocoltype.id), protocol.protocoltype.short_name)) result.append(Table.link(url_for("show_type", protocoltype_id=protocol.protocoltype.id), protocol.protocoltype.short_name))
if protocol.protocoltype.has_admin_right(user): 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()))) 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: else:
result.extend(["", ""]) result.extend(["", ""])
return result return result
...@@ -410,14 +409,27 @@ class DecisionsTable(Table): ...@@ -410,14 +409,27 @@ class DecisionsTable(Table):
return content_part + category_part + action_part return content_part + category_part + action_part
class DocumentsTable(Table): class DocumentsTable(Table):
def __init__(self, documents): def __init__(self, documents, protocol):
super().__init__("Anhang", documents) super().__init__("Anhang", documents)
self.protocol = protocol
def headers(self): 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): 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): def row(self, document):
user = current_user() user = current_user()
...@@ -426,11 +438,15 @@ class DocumentsTable(Table): ...@@ -426,11 +438,15 @@ class DocumentsTable(Table):
links.append(Table.link(url_for("print_document", document_id=document.id), "Drucken")) links.append(Table.link(url_for("print_document", document_id=document.id), "Drucken"))
if document.protocol.protocoltype.has_admin_right(user): 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))) 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, document.id,
Table.link(url_for("download_document", document_id=document.id), document.name), 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): class TodoMailsTable(Table):
def __init__(self, todomails): 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