diff --git a/standards/templates/standards/standards_add.html b/standards/templates/standards/standards_add.html index a6be5e2..90bb9d3 100644 --- a/standards/templates/standards/standards_add.html +++ b/standards/templates/standards/standards_add.html @@ -1105,6 +1105,7 @@ function remEle(type, id, name){ index_to_rem = actualFiles.indexOf(id); actualFiles.splice(index_to_rem,1); $("#id_added_" + type).val(actualFiles); + } else if(type == 'quicklinks'){ index_to_rem = actualQuicklinks.indexOf(id); diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index d5ffc01..1f53759 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -27,7 +27,7 @@
- {% if standard.addedfiles.all|length > 0 or standard.linked_standards.all|length > 0 or standard.authority.count > 0 or standard.executor.count > 0 or standard.representative.count > 0 or standard.addedfiles.all|length > 0 or standard.linked_standards.all|length > 0 or standard.freefield_title|length > 0 or standard.addedcontacts.all|length > 0 or standard.addedpasswords.all|length > 0 or standard.addedquicklinks.all|length > 0 or standard.authority_group.count > 0 or standard.executor_group.count > 0 or standard.representative_group.count > 0 %} + {% if standard.addedfiles_nc.all|length > 0 or standard.linked_standards.all|length > 0 or standard.authority.count > 0 or standard.executor.count > 0 or standard.representative.count > 0 or standard.addedfiles_nc.all|length > 0 or standard.linked_standards.all|length > 0 or standard.freefield_title|length > 0 or standard.addedcontacts.all|length > 0 or standard.addedpasswords.all|length > 0 or standard.addedquicklinks.all|length > 0 or standard.authority_group.count > 0 or standard.executor_group.count > 0 or standard.representative_group.count > 0 %}
{% else %}
@@ -42,7 +42,7 @@
- {% if standard.addedfiles.all|length > 0 or standard.linked_standards.all|length > 0 or standard.authority.count > 0 or standard.executor.count > 0 or standard.representative.count > 0 or standard.addedfiles.all|length > 0 or standard.linked_standards.all|length > 0 or standard.freefield_title|length > 0 or standard.addedcontacts.all|length > 0 or standard.addedpasswords.all|length > 0 or standard.addedquicklinks.all|length > 0 or standard.authority_group.count > 0 or standard.executor_group.count > 0 or standard.representative_group.count > 0 %} + {% if standard.addedfiles_nc.all|length > 0 or standard.linked_standards.all|length > 0 or standard.authority.count > 0 or standard.executor.count > 0 or standard.representative.count > 0 or standard.addedfiles_nc.all|length > 0 or standard.linked_standards.all|length > 0 or standard.freefield_title|length > 0 or standard.addedcontacts.all|length > 0 or standard.addedpasswords.all|length > 0 or standard.addedquicklinks.all|length > 0 or standard.authority_group.count > 0 or standard.executor_group.count > 0 or standard.representative_group.count > 0 %}
@@ -131,13 +131,14 @@ - {% if standard.addedfiles.all|length > 0 %} + {% if standard.addedfiles_nc.all|length > 0 %}
Dateien

- {% for files in standard.addedfiles.all %} - {{files.name|truncatechars:30}}
+ {% for files in standard.addedfiles_nc.all %} + + TODO: HIER DOWNLOAD ERMÖGLICH: {{files.nc_id}} {% endfor %}

diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index 1d330fb..43c023f 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 0d81ed1..12b367c 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -1121,7 +1121,6 @@ import urllib.parse @register.simple_tag def getNCFileInfos(request, ncid): try: - print(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}) diff --git a/standards/views.py b/standards/views.py index 1e5ee2d..80dcc62 100644 --- a/standards/views.py +++ b/standards/views.py @@ -333,7 +333,7 @@ def StandardAdd(request, id=False): standard.visibleby.clear() standard.linked_standards.clear() - standard.addedfiles.clear() + standard.addedfiles_nc.clear() standard.addedquicklinks.clear() standard.addedpasswords.clear() standard.addedcontacts.clear() @@ -389,10 +389,23 @@ def StandardAdd(request, id=False): standard.linked_standards.add(Standards.objects.get(pk=s)) # ADD FILES + print("FILES IDS") + print(normalForm.cleaned_data['added_files']) files = normalForm.cleaned_data['added_files'].split(",") for f in files: + print(f) if(f.isdigit()): - standard.addedfiles.add(DataFile.objects.get(pk=f)) + print("PRÜFUNG") + ncfile = NCFile.objects.filter(nc_id=f).first() + # Wenn die NC-File in Django nicht existiert, dann neu erstellen und hinzufügen. Trifft für Dateien zu, die zwar in den Dateien waren, aber noch nicht in der NC! + if(ncfile == None): + print("NICHT GEFUNDEN - HINZUFÜGEN") + new_nc_file = NCFile(nc_id=f, agency=standard.agency) + new_nc_file.save() + standard.addedfiles_nc.add(new_nc_file) + else: + print("GEFUNDEN - HINZU") + standard.addedfiles_nc.add(ncfile) # ADD QUICKLINKS quicklinks = normalForm.cleaned_data['added_quicklinks'].split(",")