LAdezeit Standard verbessert
This commit is contained in:
parent
b82d0f6a28
commit
1bbc1e7013
|
|
@ -145,10 +145,7 @@
|
||||||
</div>
|
</div>
|
||||||
<datalist id="poss_files">
|
<datalist id="poss_files">
|
||||||
{% for f in files %}
|
{% for f in files %}
|
||||||
{% getNCFileInfos request f as filename %}
|
<option id="files_{{f.0}}" value="{{f.1}}">{{f.1}}</option>
|
||||||
{% if filename != "FAIL_TO_LOAD_NC_FILE_DATA" %}
|
|
||||||
<option id="files_{{f}}" value="{{filename}}">{{filename}}</option>
|
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</datalist>
|
</datalist>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -603,27 +603,39 @@ def StandardAdd(request, id=False):
|
||||||
#filesearchdata = '<?xml version="1.0" encoding="UTF-8"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><oc:fileid /></d:prop><d:depth>infinity</d:depth></d:propfind>'
|
#filesearchdata = '<?xml version="1.0" encoding="UTF-8"?><d:propfind xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns"><d:prop><oc:fileid /></d:prop><d:depth>infinity</d:depth></d:propfind>'
|
||||||
r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
|
r = requests.request("SEARCH", settings.NEXTCLOUD_URL + "remote.php/dav/", data=filesearchdata, headers={'Content-Type' : 'text/xml', 'Authorization' : "Bearer " + request.user.profile.nc_sid})
|
||||||
# IDs filtern aus XML-Response
|
# IDs filtern aus XML-Response
|
||||||
try:
|
|
||||||
split_response = r.text.split("<oc:fileid>")
|
|
||||||
|
|
||||||
# Header des XML-Response entfernen
|
|
||||||
split_response.pop(0)
|
|
||||||
|
|
||||||
# IDs from the User
|
|
||||||
for ele in split_response:
|
|
||||||
new_id = ele.split("</oc:fileid>")[0]
|
|
||||||
|
|
||||||
file_free = True
|
|
||||||
# Prüfen, dass diese IDs nicht im aktuellen Standard sind
|
|
||||||
for sf in standard.addedfiles_nc.all():
|
|
||||||
if str(sf.nc_id) == str(new_id):
|
|
||||||
file_free = False
|
|
||||||
|
|
||||||
if file_free == True:
|
ncfileids = [str(s) for s in re.findall('<d:response>(.+?)</d:response>', r.text)]
|
||||||
possibleFilesByVisible.append(new_id)
|
final_nc_files = []
|
||||||
|
# IDs from the User
|
||||||
|
for ele in ncfileids:
|
||||||
|
nc_filename_with_path = [str(s) for s in re.findall('<d:href>(.+?)</d:href>', ele)][0]
|
||||||
|
nc_filename_with_path = nc_filename_with_path.split("/")
|
||||||
|
|
||||||
|
filename = nc_filename_with_path[len(nc_filename_with_path)-1]
|
||||||
|
|
||||||
|
nc_file_id = [str(s) for s in re.findall('<oc:fileid>(.+?)</oc:fileid>', ele)][0]
|
||||||
|
|
||||||
|
if(len(filename) > 0):
|
||||||
|
final_nc_files.append([nc_file_id, filename])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# IDs from the User
|
||||||
|
for ele in final_nc_files:
|
||||||
|
|
||||||
|
file_free = True
|
||||||
|
# Prüfen, dass diese IDs nicht im aktuellen Standard sind
|
||||||
|
for sf in standard.addedfiles_nc.all():
|
||||||
|
if str(sf.nc_id) == str(ele[0]):
|
||||||
|
file_free = False
|
||||||
|
|
||||||
|
if file_free == True:
|
||||||
|
possibleFilesByVisible.append([ele[0], ele[1]])
|
||||||
|
|
||||||
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
# STANDARDS
|
# STANDARDS
|
||||||
possible_standards = []
|
possible_standards = []
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue