Standrad Update Files add and remove
This commit is contained in:
parent
f289a24d82
commit
12d4de29d3
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
<hr>
|
||||
<div class="row col">
|
||||
|
||||
{% 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 %}
|
||||
<div class="card col-9" style="min-height: 500px">
|
||||
{% else %}
|
||||
<div class="card col-12" style="min-height: 500px">
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
</div>
|
||||
|
||||
<!-- PERSONEN -->
|
||||
{% 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 %}
|
||||
<div class="col-3">
|
||||
|
||||
|
||||
|
|
@ -131,13 +131,14 @@
|
|||
|
||||
|
||||
<!-- FILES -->
|
||||
{% if standard.addedfiles.all|length > 0 %}
|
||||
{% if standard.addedfiles_nc.all|length > 0 %}
|
||||
<div class="card col-14 ml-1 mb-2" style="min-width: 110%">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Dateien</h5>
|
||||
<p class="card-text">
|
||||
{% for files in standard.addedfiles.all %}
|
||||
<a href="{% url 'cloud-td' files.pk %}" target="_blank">{{files.name|truncatechars:30}}</a><br />
|
||||
{% for files in standard.addedfiles_nc.all %}
|
||||
<!--<a href="{% url 'cloud-td' files.pk %}" target="_blank">{{files.name|truncatechars:30}}</a><br />-->
|
||||
TODO: HIER DOWNLOAD ERMÖGLICH: {{files.nc_id}}
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1121,7 +1121,6 @@ import urllib.parse
|
|||
@register.simple_tag
|
||||
def getNCFileInfos(request, ncid):
|
||||
try:
|
||||
print(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})
|
||||
|
||||
|
|
|
|||
|
|
@ -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(",")
|
||||
|
|
|
|||
Loading…
Reference in New Issue