diff --git a/standards/templates/standards/standards_add.html b/standards/templates/standards/standards_add.html index 264876e..f682829 100644 --- a/standards/templates/standards/standards_add.html +++ b/standards/templates/standards/standards_add.html @@ -5,7 +5,7 @@
{% if update == True %} -

Standard Bearbeiten{% if request.user.profile.showtooltips %} {% endif %}

+

Standard Bearbeiten {% if request.user.profile.showtooltips %} {% endif %}

{% else %}

Neuen Standard anlegen{% if request.user.profile.showtooltips %} {% endif %}

{% endif %} @@ -151,9 +151,12 @@
Verlinkte Dateien: + {% if update == True %} - {% for f in standard.addedfiles.all %} - + {% for f in standard.addedfiles_nc.all %} + + {% getNCFileInfos request f.nc_id as filename %} + {{filename}} {% endfor %} {% endif %}
{{f.name}}
diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index f4ce452..0f425a6 100644 Binary files a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index 7ecf0b6..2b1f830 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1110,3 +1110,23 @@ def getAbsenceLastHistory(absence): return absence.history.first() +''' + Dateinamen umbauen, damit im Standard die verlinkte Datei korrekt angezeigt wird. + + TODO: Thread auf github beobachten, https://github.com/nextcloud/server/issues/17778 wenn dann displayname wieder bei WebDav geht! + + Gibt den Dateinamen sauber als String zurück, wie sie in NC heißt! +''' +import urllib.parse +@register.simple_tag +def getNCFileInfos(request, ncid): + filesearchdata = '/files/' + request.user.username + 'infinity' + str(ncid) + '' + r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid}) + + split_response = r.text.split("") + split_fileele = split_response[1].split("") + split_filename = split_fileele[0].split("/") + split_filenameclear = split_filename[len(split_filename)-1] + return urllib.parse.unquote(split_filenameclear) + +