Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
protokollsystem
proto3
Commits
54b1574d
Commit
54b1574d
authored
Mar 22, 2017
by
Robin Sonnabend
Browse files
Make metadata internal optionally
/close
#80
parent
60452dce
Changes
9
Hide whitespace changes
Inline
Side-by-side
migrations/versions/4651698510d7_.py
0 → 100644
View file @
54b1574d
"""empty message
Revision ID: 4651698510d7
Revises: a06cc03bdef4
Create Date: 2017-03-22 21:42:04.880972
"""
from
alembic
import
op
import
sqlalchemy
as
sa
# revision identifiers, used by Alembic.
revision
=
'4651698510d7'
down_revision
=
'a06cc03bdef4'
branch_labels
=
None
depends_on
=
None
def
upgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
add_column
(
'defaultmetas'
,
sa
.
Column
(
'internal'
,
sa
.
Boolean
(),
nullable
=
True
))
op
.
add_column
(
'metas'
,
sa
.
Column
(
'internal'
,
sa
.
Boolean
(),
nullable
=
True
))
# ### end Alembic commands ###
def
downgrade
():
# ### commands auto generated by Alembic - please adjust! ###
op
.
drop_column
(
'metas'
,
'internal'
)
op
.
drop_column
(
'defaultmetas'
,
'internal'
)
# ### end Alembic commands ###
models/database.py
View file @
54b1574d
...
...
@@ -203,7 +203,7 @@ class Protocol(DatabaseModel):
for
default_meta
in
self
.
protocoltype
.
metas
:
if
default_meta
.
key
in
remarks
:
value
=
remarks
[
default_meta
.
key
].
value
.
strip
()
meta
=
Meta
(
protocol_id
=
self
.
id
,
name
=
default_meta
.
name
,
value
=
value
)
meta
=
Meta
(
protocol_id
=
self
.
id
,
name
=
default_meta
.
name
,
value
=
value
,
internal
=
default_meta
.
internal
)
db
.
session
.
add
(
meta
)
db
.
session
.
commit
()
...
...
@@ -657,6 +657,7 @@ class DefaultMeta(DatabaseModel):
protocoltype_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
"protocoltypes.id"
))
key
=
db
.
Column
(
db
.
String
)
name
=
db
.
Column
(
db
.
String
)
internal
=
db
.
Column
(
db
.
Boolean
)
def
get_parent
(
self
):
return
self
.
protocoltype
...
...
@@ -668,6 +669,7 @@ class Meta(DatabaseModel):
protocol_id
=
db
.
Column
(
db
.
Integer
,
db
.
ForeignKey
(
"protocols.id"
))
name
=
db
.
Column
(
db
.
String
)
value
=
db
.
Column
(
db
.
String
)
internal
=
db
.
Column
(
db
.
Boolean
)
def
get_parent
(
self
):
return
self
.
protocol
...
...
tasks.py
View file @
54b1574d
...
...
@@ -505,7 +505,7 @@ def send_protocol_async(protocol_id, show_private):
protocol
=
Protocol
.
query
.
filter_by
(
id
=
protocol_id
).
first
()
to_addr
=
protocol
.
protocoltype
.
private_mail
if
show_private
else
protocol
.
protocoltype
.
public_mail
subject
=
"{}{}-Protokoll vom {}"
.
format
(
"Internes "
if
show_private
else
""
,
protocol
.
protocoltype
.
short_name
,
date_filter
(
protocol
.
date
))
mail_content
=
render_template
(
"protocol-mail.txt"
,
protocol
=
protocol
)
mail_content
=
render_template
(
"protocol-mail.txt"
,
protocol
=
protocol
,
show_private
=
show_private
)
appendix
=
[(
document
.
name
,
document
.
as_file_like
())
for
document
in
protocol
.
documents
if
show_private
or
not
document
.
is_private
...
...
templates/protocol-mail.txt
View file @
54b1574d
...
...
@@ -5,7 +5,9 @@ Datum: {{protocol.date|datify_long}}
Zeit: von {{protocol.start_time|timify}} bis {{protocol.end_time|timify}}
{% endif %}
{% for meta in protocol.metas %}
{% if not meta.internal or show_private %}
{{meta.name}}: {{meta.value}}
{% endif %}
{% endfor %}
Die Tagesordnung ist:
...
...
templates/protocol-show.html
View file @
54b1574d
...
...
@@ -65,7 +65,9 @@
{% endif %}
{% if has_public_view_right %}
{% for meta in protocol.metas %}
<p><strong>
{{meta.name}}:
</strong>
{{meta.value}}
</p>
{% if not meta.internal or has_private_view_right %}
<p><strong>
{{meta.name}}:
</strong>
{{meta.value}}
</p>
{% endif %}
{% endfor %}
{% endif %}
{% else %}
...
...
templates/protocol.tex
View file @
54b1574d
...
...
@@ -27,7 +27,9 @@
{
\bf
Datum:
}
&
\VAR
{
protocol.date|datify
_
long|escape
_
tex
}
\\
\ENV
{
endif
}
\ENV
{
for meta in protocol.metas
}
{
\bf
\VAR
{
meta.name|escape
_
tex
}
:
}
&
\VAR
{
meta.value|escape
_
tex
}
\\
\ENV
{
if not meta.internal or show
_
private
}
{
\bf
\VAR
{
meta.name|escape
_
tex
}
:
}
&
\VAR
{
meta.value|escape
_
tex
}
\\
\ENV
{
endif
}
\ENV
{
endfor
}
\end{tabular}
\normalsize
...
...
templates/protocol.wiki
View file @
54b1574d
...
...
@@ -7,7 +7,9 @@
| zeit = von <var>protocol.start_time|timify</var> bis <var>protocol.end_time|timify</var>
<env> endif </env>
<env> for meta in protocol.metas </env>
<env> if not meta.internal or not protocol.protocoltype.wiki_only_public </env>
| <var>meta.name|lower</var> = <var>meta.value</var>
<env> endif </env>
<env> endfor </env>
}}
...
...
views/forms.py
View file @
54b1574d
...
...
@@ -243,10 +243,12 @@ class TodoMailForm(FlaskForm):
class
MetaForm
(
FlaskForm
):
name
=
StringField
(
"Name"
,
validators
=
[
InputRequired
(
"Bitte gib den Namen der Metadaten an."
)])
value
=
StringField
(
"Wert"
)
internal
=
BooleanField
(
"Intern"
)
class
DefaultMetaForm
(
FlaskForm
):
key
=
StringField
(
"Key"
,
validators
=
[
InputRequired
(
"Bitte gib den Protokoll-Syntax-Schlüssel der Metadaten an."
)])
name
=
StringField
(
"Name"
,
validators
=
[
InputRequired
(
"Bitte gib den Namen der Metadaten an."
)])
internal
=
BooleanField
(
"Intern"
)
class
DecisionCategoryForm
(
FlaskForm
):
name
=
StringField
(
"Name"
,
validators
=
[
InputRequired
(
"Bitte gib den Namen der Kategorie an."
)])
...
...
views/tables.py
View file @
54b1574d
...
...
@@ -474,13 +474,14 @@ class DefaultMetasTable(Table):
)
def
headers
(
self
):
return
[
"Name"
,
"Key"
,
""
]
return
[
"Name"
,
"Key"
,
"Intern"
,
""
]
def
row
(
self
,
meta
):
user
=
current_user
()
general_part
=
[
meta
.
name
,
meta
.
key
,
Table
.
bool
(
meta
.
internal
)
]
links
=
[
Table
.
link
(
url_for
(
"edit_defaultmeta"
,
defaultmeta_id
=
meta
.
id
),
"Ändern"
),
...
...
@@ -491,7 +492,6 @@ class DefaultMetasTable(Table):
class
DecisionCategoriesTable
(
Table
):
def
__init__
(
self
,
categories
,
protocoltype
):
print
(
categories
)
super
().
__init__
(
"Beschlusskategorien"
,
categories
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment