Standard Dateien verlinkung
This commit is contained in:
parent
9542989898
commit
ef068d1a99
|
|
@ -5,7 +5,7 @@
|
|||
<div class="content-section col-12">
|
||||
|
||||
{% if update == True %}
|
||||
<h3>Standard Bearbeiten{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier einen bestehenden Standard." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<h3>Standard Bearbeiten {% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Bearbeiten Sie hier einen bestehenden Standard." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
{% else %}
|
||||
<h3>Neuen Standard anlegen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Legen Sie hier einen neuen Standard an." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
{% endif %}
|
||||
|
|
@ -151,9 +151,12 @@
|
|||
</div>
|
||||
Verlinkte Dateien:
|
||||
<table id="linked_files" class="table table-hover table-sm">
|
||||
<!-- TODO: Hier die NCFile-Daten abfragen -->
|
||||
{% if update == True %}
|
||||
{% for f in standard.addedfiles.all %}
|
||||
<tr id="added_files_{{f.pk}}"><td>{{f.name}}</td><td><button type="button" class="btn btn-danger btn-sm" style="float: right;" onclick="javascript:remEle('files',{{f.pk}}, '{{f.name}}')"><i class="fas fa-trash"></i></button></td></tr>
|
||||
{% for f in standard.addedfiles_nc.all %}
|
||||
<!--<tr id="added_files_{{f.pk}}"><td>{{f.name}}</td><td><button type="button" class="btn btn-danger btn-sm" style="float: right;" onclick="javascript:remEle('files',{{f.pk}}, '{{f.name}}')"><i class="fas fa-trash"></i></button></td></tr>-->
|
||||
{% getNCFileInfos request f.nc_id as filename %}
|
||||
{{filename}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</table>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -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 = '<?xml version="1.0" encoding="UTF-8"?><d:searchrequest xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:basicsearch><d:select><d:prop><d:displayname/></d:prop></d:select><d:from><d:scope><d:href>/files/' + request.user.username + '</d:href><d:depth>infinity</d:depth></d:scope></d:from><d:where><d:eq><d:prop><oc:fileid/></d:prop><d:literal>' + str(ncid) + '</d:literal></d:eq></d:where></d:basicsearch></d:searchrequest>'
|
||||
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("<d:href>")
|
||||
split_fileele = split_response[1].split("</d:href>")
|
||||
split_filename = split_fileele[0].split("/")
|
||||
split_filenameclear = split_filename[len(split_filename)-1]
|
||||
return urllib.parse.unquote(split_filenameclear)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue