diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index 74d64fe..018ac0f 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -138,9 +138,13 @@

{% for file in standard.addedfiles_nc.all %} {% getNCFileInfos request file.nc_id as filename %} - {% getNCFileInfosURL request file.nc_id as filelink %} - {% getNextcloudURL as nc_url %} - {{filename|truncatechars:30}}
+ {% getNCFileInfosURL request file.nc_id as filelink %} + {% getNCDirInfosURL request file.nc_id as dirlink %} + {% getNextcloudURL as nc_url %} + {{dirlink}} + + {{filename|truncatechars:30}} +
{% endfor %}

diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 3861a20..c62ecaf 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 a70e798..54ddcda 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1149,4 +1149,31 @@ def getNCFileInfosURL(request, ncid): except: return "" +@register.simple_tag +def getNCDirInfosURL(request, ncid): + try: + 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("") + + # Generating Dir-Link + finaldirlink = "" + counter = 0 + dirpre = split_fileele[0].split("/") + dirpre.pop(0) + dirpre.pop(0) + dirpre.pop(0) + dirpre.pop(0) + dirpre.pop(0) + for ele in dirpre: + if counter < len(dirpre) - 1: + finaldirlink += ele + "/" + counter += 1 + # Return file-link except first slash in string + return finaldirlink[:-1] + #return urllib.parse.unquote(split_filenameclear) + except: + return "" +