Standardsumbaum komplett fertig, 0.8.0 für QS bereit
This commit is contained in:
parent
8f87ed4f37
commit
ad5173f358
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -54,10 +54,29 @@
|
|||
</h5>
|
||||
{% setvar 0 %}
|
||||
{% for standard in standards_of_agency %}
|
||||
<!-- CHECK FOR GROUPVISIBLE -->
|
||||
{% setbool False %}
|
||||
{% for ag in standard.visibleby.all %}
|
||||
{% if request.user|has_group:ag.group.name %}
|
||||
{% setbool True %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if standard.visibleby.all|length == 0 %}
|
||||
{% setbool True %}
|
||||
{% endif %}
|
||||
|
||||
{% getbool as groupchecker %}
|
||||
|
||||
|
||||
{% getvar as varcounter %}
|
||||
{% if standard.task == task and standard.area == area and varcounter < 3 %}
|
||||
{% incvar %}
|
||||
<p class="card-text"><a href="{% url 'standard-single' standard.pk %}">{{standard.name}}</a></p>
|
||||
{% if groupchecker %}
|
||||
<p class="card-text"><a href="{% url 'standard-single' standard.pk %}">{{standard.name|truncatechars:40}}</a></p>
|
||||
{% else %}
|
||||
<p class="card-text text-secondary"><i class="fas fa-lock"></i> {{standard.name|truncatechars:40}}</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
<nav aria-label="breadcrumb">
|
||||
|
|
@ -39,7 +40,11 @@
|
|||
<hr>
|
||||
<div class="row col">
|
||||
|
||||
{% if standard.addedfiles.all|length == 0 and standard.linked_standards.all|length == 0 %}
|
||||
<div class="card col-12" style="min-height: 500px">
|
||||
{% else %}
|
||||
<div class="card col-9" style="min-height: 500px">
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h5 class="card-title"></h5>
|
||||
<p class="card-text">
|
||||
|
|
@ -50,9 +55,8 @@
|
|||
</div>
|
||||
<!-- FILES -->
|
||||
<div class="col-3">
|
||||
|
||||
{% if standard.addedfiles.all|length > 0 %}
|
||||
<div class="card col-14 ml-2" style="">
|
||||
<div class="card col-14 ml-2 mb-3" style="">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Dateien</h5>
|
||||
<p class="card-text">
|
||||
|
|
@ -65,12 +69,32 @@
|
|||
{% endif %}
|
||||
<!-- STANDARDS -->
|
||||
{% if standard.linked_standards.all|length > 0 %}
|
||||
<div class="card col-14 ml-2 mt-3" style="">
|
||||
<div class="card col-14 ml-2" style="">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">Verwandte Standards</h5>
|
||||
<p class="card-text">
|
||||
{% for standard in standard.linked_standards.all %}
|
||||
<a href="{% url 'standard-single' standard.pk %}">{{standard.name|truncatechars:30}}</a><br />
|
||||
|
||||
|
||||
{% setbool False %}
|
||||
{% for ag in standard.visibleby.all %}
|
||||
{% if request.user|has_group:ag.group.name %}
|
||||
{% setbool True %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
{% if standard.visibleby.all|length == 0 %}
|
||||
{% setbool True %}
|
||||
{% endif %}
|
||||
|
||||
{% getbool as groupchecker %}
|
||||
|
||||
{% if groupchecker %}
|
||||
<a href="{% url 'standard-single' standard.pk %}">{{standard.name|truncatechars:30}}</a><br />
|
||||
{% else %}
|
||||
<i class="fas fa-lock"></i> {{standard.name|truncatechars:30}}</p>
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</p>
|
||||
</div>
|
||||
|
|
@ -78,5 +102,8 @@
|
|||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% for g in standard.visibleby.all %}
|
||||
{{g.agencygroupname}}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
@ -1,13 +1,122 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
<div class="content-section col-6">
|
||||
<h3>Standard bearbeiten</h3>
|
||||
<div class="content-section col-12">
|
||||
<h3>Standard bearbeiten <small><i data-toggle="tooltip" data-placement="top" title="Aktualisieren Sie hier die Informationen des Standards." class="far fa-question-circle"></i></small></h3>
|
||||
<hr>
|
||||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
{{normalForm|crispy}}
|
||||
|
||||
|
||||
<div class="row"><div class="col-8">
|
||||
{% for field in normalForm %}
|
||||
{% if forloop.counter|divisibleby:5 %}
|
||||
</div><div class="col-3">
|
||||
{{field|as_crispy_field }}
|
||||
{% else %}
|
||||
{{field|as_crispy_field }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- COLLAPSE AREA FOR GROUPS FILES AND LINKED STANDARDS -->
|
||||
<div class="accordion" style="margin-top: 47px" id="additionalStandardInfos">
|
||||
<div class="card">
|
||||
<div class="card-header" id="st_groups">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#stgroups_content" aria-expanded="false" aria-controls="stgroups_content">
|
||||
Gruppen <small><i data-toggle="tooltip" data-placement="top" title="Legen Sie fest, welche Gruppe diesen Standard sehen kann. Ist keine ausgewählt, ist der Standard für alle sichtbar." class="far fa-question-circle"></i></small>
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
<div id="stgroups_content" class="collapse" aria-labelledby="st_groups" data-parent="#additionalStandardInfos">
|
||||
<div class="card-body">
|
||||
{% for g in agencygroups %}
|
||||
<div class="custom-control custom-checkbox mb-2">
|
||||
{% if g in standard.visibleby.all %}
|
||||
<input type="checkbox" class="custom-control-input groupclass" onclick="javascript:groupsChange({{g.pk}}, this.checked)" name="group_{{g.pk}}" id="group_{{g.pk}}" checked="true">
|
||||
{% else %}
|
||||
<input type="checkbox" class="custom-control-input groupclass" onclick="javascript:groupsChange({{g.pk}}, this.checked)" name="group_{{g.pk}}" id="group_{{g.pk}}">
|
||||
{% endif %}
|
||||
|
||||
<label class="custom-control-label" for="group_{{g.pk}}" >{{g.agencygroupname}}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if request.user.profile.agency.module_files %}
|
||||
<div class="card">
|
||||
<div class="card-header" id="st_files">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#st_files_content" aria-expanded="false" aria-controls="st_files_content">
|
||||
Dateien <small><i data-toggle="tooltip" data-placement="top" title="Fügen Sie ihren Standards Dateien zu. Diese liegen entweder bereits unter Dateien oder können iher direkt hochgeladen werden. Neu hochgeladene Dateien werden im Heimverzeichnis gespeichert." class="far fa-question-circle"></i></small>
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
<div id="st_files_content" class="collapse" aria-labelledby="st_files" data-parent="#additionalStandardInfos">
|
||||
<div class="card-body">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control searchuserfieldstask" list="possfiles" id="searchfiles" type="text" onkeyup="javascript:updateLinkedFiles()" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearSearchfieldAddFile()" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="possfiles">
|
||||
{% for f in possibleFilesByVisible %}
|
||||
<option id="file_{{f.pk}}" value="{{f.name}}">{{f.name}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
</div>
|
||||
Verlinkte Dateien:
|
||||
<table id="linkedfiles" class="table table-hover table-sm">
|
||||
{% for f in standard.addedfiles.all %}
|
||||
<tr id="fileadded_{{f.pk}}"><td>{{f.name|truncatechars:30}}</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remFile({{f.pk}}, '{{f.name}}')"><i class="fas fa-trash-alt"></i></button></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<input type="file" id="uploadedfile" name="uploadedfile" style="display:none">
|
||||
{% if user|usergperm:"filesmanager" %}
|
||||
<div class="alert alert-secondary text-center mt-5" id="directdiv" role="alert" style="line-height: 17px; text-align: center;">
|
||||
<button type="button" class="btn btn-primary btn-sm" id="uploadButton" onclick="javascript:uploadButtonPush()"><i class="fas fa-plus"></i></button> <small>klicken/hineinziehen<p class="mt-2">Dateien werden im <b>Heimverzeichnis</b>gespeichert.
|
||||
</small></p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="card">
|
||||
<div class="card-header" id="st_linked">
|
||||
<h5 class="mb-0">
|
||||
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#st_linked_content" aria-expanded="false" aria-controls="st_linked_content">
|
||||
Standards <small><i data-toggle="tooltip" data-placement="top" title="Verlinken Sie hier andere Standards, die etwas mit diesem Standard zutun haben." class="far fa-question-circle"></i></small>
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
<div id="st_linked_content" class="collapse" aria-labelledby="st_linked" data-parent="#additionalStandardInfos">
|
||||
<div class="card-body">
|
||||
<div class="input-group mb-3">
|
||||
<input class="form-control" list="possstandards" id="searchstandards" type="text" onkeyup="javascript:updateLinkedStandards()" >
|
||||
<div class="input-group-append">
|
||||
<button type="button" onclick="javascript:clearSearchfieldAddStandard()" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
|
||||
</div>
|
||||
<datalist id="possstandards">
|
||||
{% for s in possiblestandards %}
|
||||
<option id="standard_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
|
||||
{% endfor %}
|
||||
</datalist>
|
||||
</div>
|
||||
Verlinkte Standards:
|
||||
<table id="linkedstandards" class="table table-hover table-sm">
|
||||
{% for s in standard.linked_standards.all %}
|
||||
<tr id="standardadded_{{s.pk}}"><td>{{s.name|truncatechars:30}}</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remStandard({{s.pk}}, '{{s.name|truncatechars:30}}')"><i class="fas fa-trash-alt"></i></button></td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<p>Wenn ein Standard bearbeitet wurde, kann er nur von einer Person mit dem Recht <i>Standards bearbeiten und freischalten</i> wieder veröffentlicht werden. Ein Standard wird nach Bearbeitung als <i>Nicht veröffentlicht</i> gesetzt.</p>
|
||||
<hr>
|
||||
<button type="submit" class="btn btn-success" href="{% url 'standard-update' standard_id %} ">Aktualisieren</button>
|
||||
|
|
@ -23,6 +132,193 @@
|
|||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
//STANDARD
|
||||
function remStandard(sid, sname){
|
||||
console.log(sid, sname);
|
||||
}
|
||||
|
||||
function clearSearchfieldAddStandard(){
|
||||
$("#searchstandards").val("");
|
||||
}
|
||||
|
||||
|
||||
function remStandard(id, name){
|
||||
$('#possstandards').append('<option id="standard_'+id+'" value="'+ name +'">'+ name +'</option>');
|
||||
$("#standardadded_" + id).remove();
|
||||
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_remstandard',
|
||||
standardid : id
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
|
||||
function updateLinkedStandards(){
|
||||
var g = $('#searchstandards').val();
|
||||
var id = $('#possstandards').find('option[value="' + g + '"]').attr('id');
|
||||
if(id != undefined && id.length > 0){
|
||||
tempid_standard = id.split("_")[1];
|
||||
clearSearchfieldAddStandard();
|
||||
$("#" + id).remove();
|
||||
$("#linkedstandards").append('<tr id="standardadded_'+tempid_standard+'"><td>' + g + '</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remStandard('+tempid_standard+', \''+g+'\')"><i class="fas fa-trash-alt"></i></button></td></tr>');
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_addstandard',
|
||||
standardid : tempid_standard
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
|
||||
//FILES
|
||||
function remFile(fileid, filename){
|
||||
console.log(fileid);
|
||||
$("#fileadded_" + fileid).remove();
|
||||
$('#possfiles').append('<option id="file_'+fileid+'" value="'+ filename +'">'+ filename +'</option>');
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_remfile',
|
||||
fileid : fileid
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
|
||||
function clearSearchfieldAddFile(){
|
||||
$("#searchfiles").val("");
|
||||
}
|
||||
|
||||
function updateLinkedFiles(){
|
||||
var g = $('#searchfiles').val();
|
||||
var id = $('#possfiles').find('option[value="' + g + '"]').attr('id');
|
||||
if(id != undefined && id.length > 0){
|
||||
tempid_file = id.split("_")[1];
|
||||
clearSearchfieldAddFile();
|
||||
$("#" + id).remove();
|
||||
$("#linkedfiles") .append('<tr id="fileadded_'+tempid_file+'"><td>' + g + '</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remFile('+tempid_file+', \''+g+'\')"><i class="fas fa-trash-alt"></i></button></td></tr>');
|
||||
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_addfile',
|
||||
fileid : tempid_file
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//FILES
|
||||
// preventing page from redirecting
|
||||
$("html").on("dragover", function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
});
|
||||
$("html").on("drop", function(e) { e.preventDefault(); e.stopPropagation(); });
|
||||
|
||||
$( "#directdiv" ).on('dragenter', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
currentid = e["currentTarget"]['id'];
|
||||
$("#directdiv").addClass('bg-secondary');
|
||||
});
|
||||
|
||||
|
||||
$('#directdiv').on('drop', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
$("#directdiv").removeClass('bg-secondary');
|
||||
uploadAction(e.originalEvent.dataTransfer.files[0], e["currentTarget"]['id'].split("_")[0]);
|
||||
});
|
||||
|
||||
$('#directdiv').on('dragleave', function (e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
currentid = e["currentTarget"]['id'];
|
||||
$("#directdiv").removeClass('bg-secondary');
|
||||
});
|
||||
|
||||
allowedtypes = "application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*"
|
||||
|
||||
|
||||
|
||||
function uploadButtonPush(){
|
||||
$("#uploadedfile").click();
|
||||
}
|
||||
|
||||
$('#uploadedfile').on('change', function() {
|
||||
uploadAction($("#uploadedfile")[0]['files'][0], {{parentid}});
|
||||
});
|
||||
|
||||
function uploadAction(filetodo){
|
||||
var formData = new FormData();
|
||||
formData.append("uploadedfile", filetodo);
|
||||
if(allowedtypes.includes(filetodo.type) && filetodo.type.length > 0){
|
||||
$.ajax({
|
||||
url: "{% url 'cloud-adddir' parentid %}",
|
||||
headers: {
|
||||
"X-CSRFTOKEN": "{{ csrf_token }}"
|
||||
},
|
||||
data: formData,
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data) {
|
||||
if(data["success"] == true){
|
||||
$("#linkedfiles") .append('<tr id="fileadded_'+data["data"]["savedobj_id"]+'"><td>' + data["data"]["savedobj_name"] + '</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remFile('+data["data"]["savedobj_id"]+', \''+data["data"]["savedobj_name"]+'\')"><i class="fas fa-trash-alt"></i></button></td></tr>');
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_addfile',
|
||||
fileid : data["data"]["savedobj_id"]
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#forbiddenFileType").modal("toggle")
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$("#forbiddenFileType").modal("toggle")
|
||||
}
|
||||
}
|
||||
|
||||
//GROUP CHANGE
|
||||
function groupsChange(groupid, value){
|
||||
if(value){
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_addgroup',
|
||||
groupid : groupid
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: "{% url 'update_standard_by_ajax' standard.pk %}",
|
||||
data: {
|
||||
action : 's_remgroup',
|
||||
groupid : groupid
|
||||
},
|
||||
success: function (data) {}
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
Ajax-Request zum nachladen der Aufgaben nach Auswahl der Bereiche
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ urlpatterns = [
|
|||
path('standardadd/', views.StandardAdd, name='standard-add'),
|
||||
path('standardupdate/<int:id>', views.StandardUpdate, name='standard-update'),
|
||||
path('ajax/loadtasks/', views.load_tasks, name='ajax_loadtasks'),
|
||||
path('ajups/<int:pk>', views.updatesbyajax, name='update_standard_by_ajax'),
|
||||
path('standards/<int:pk>/delete', StandardDeleteView.as_view(), name='standard-delete'),
|
||||
path('standard/<int:pk>/changestat', views.StandardChangePublic, name="standard-status"),
|
||||
path('standard/<int:pk>/single', views.StandardSingle, name="standard-single"),
|
||||
|
|
|
|||
|
|
@ -176,14 +176,42 @@ def StandardUpdate(request, id):
|
|||
#normalForm = StandardUpdateStandard(instance=standard)
|
||||
normalForm = StandardUpdateStandard(instance=standard)
|
||||
editorForm = StandardUpdateStandardEditor(instance=standard)
|
||||
|
||||
|
||||
possibleFilesByVisible = []
|
||||
|
||||
allfiles = DataFile.objects.filter(agency=request.user.profile.agency)
|
||||
|
||||
for file in allfiles:
|
||||
user_can_view_file = False
|
||||
parentdir = DataDir.objects.get(pk=file.parent.pk)
|
||||
if(parentdir.is_root == False):
|
||||
for p_group in parentdir.visibleby.all():
|
||||
if p_group.group in request.user.groups.all():
|
||||
user_can_view_file = True
|
||||
else:
|
||||
user_can_view_file = True
|
||||
# Check if file is in standard
|
||||
if file not in standard.addedfiles.all():
|
||||
if user_can_view_file:
|
||||
possibleFilesByVisible.append(file)
|
||||
|
||||
possiblestandards = Standards.objects.filter(agency=request.user.profile.agency, public=True)
|
||||
possiblestandards_final = []
|
||||
for s in possiblestandards:
|
||||
if s not in standard.linked_standards.all():
|
||||
possiblestandards_final.append(s)
|
||||
|
||||
context = {
|
||||
'normalForm' : normalForm,
|
||||
'editorForm' : editorForm,
|
||||
'standard' : standard,
|
||||
'active_link' : 'standards',
|
||||
'standard_id' : standard.pk,
|
||||
'standard_status' : standard.public
|
||||
'standard_status' : standard.public,
|
||||
'possibleFilesByVisible' : possibleFilesByVisible,
|
||||
'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency),
|
||||
'parentid' : list(DataDir.objects.filter(agency=request.user.profile.agency, is_root=True))[0].pk,
|
||||
'possiblestandards' : possiblestandards_final
|
||||
}
|
||||
return render(request, 'standards/standards_update.html', context)
|
||||
|
||||
|
|
@ -225,12 +253,31 @@ def StandardChangePublic(request, pk):
|
|||
|
||||
@login_required
|
||||
def StandardSingle(request, pk):
|
||||
standard = Standards.objects.get(pk=pk)
|
||||
context = {
|
||||
'active_link':'standards',
|
||||
'standard' : standard
|
||||
}
|
||||
return render(request, 'standards/standards_single.html', context)
|
||||
|
||||
# CHECK IF USER HAS RIGHTS TO SEE THIS DIR
|
||||
groupsofstandard = Standards.objects.get(pk=pk, agency=request.user.profile.agency)
|
||||
|
||||
userisingroup = False
|
||||
|
||||
if len(groupsofstandard.visibleby.all()) == 0:
|
||||
userisingroup = True
|
||||
else:
|
||||
for ag in groupsofstandard.visibleby.all():
|
||||
if ag.group in request.user.groups.all():
|
||||
userisingroup = True
|
||||
|
||||
if userisingroup:
|
||||
standard = Standards.objects.get(pk=pk)
|
||||
context = {
|
||||
'active_link':'standards',
|
||||
'standard' : standard
|
||||
}
|
||||
return render(request, 'standards/standards_single.html', context)
|
||||
else:
|
||||
context = {
|
||||
'active_link':'standards'
|
||||
}
|
||||
return render(request, 'standards/standards_noentrie.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
@ -261,3 +308,39 @@ def StandardTask(request, pk):
|
|||
return render(request, 'standards/standard_task.html', context)
|
||||
|
||||
|
||||
@login_required
|
||||
def updatesbyajax(request, pk):
|
||||
if(request.method == "GET"):
|
||||
success = True
|
||||
workingstandard = Standards.objects.get(pk=pk)
|
||||
# Check for correct user and userrights
|
||||
if(request.user.profile.agency == workingstandard.agency and request.user.has_perm("standardmanager")):
|
||||
# CHANGE GROUP
|
||||
# ADD
|
||||
if(request.GET["action"] == "s_addgroup"):
|
||||
workingstandard.visibleby.add(AgencyGroup.objects.get(pk=request.GET["groupid"]))
|
||||
# REMOVE
|
||||
elif(request.GET["action"] == "s_remgroup"):
|
||||
workingstandard.visibleby.remove(AgencyGroup.objects.get(pk=request.GET["groupid"]))
|
||||
# FILES
|
||||
# REMOVE
|
||||
elif(request.GET["action"] == "s_remfile"):
|
||||
workingstandard.addedfiles.remove(DataFile.objects.get(pk=request.GET["fileid"]))
|
||||
# ADD
|
||||
elif(request.GET["action"] == "s_addfile"):
|
||||
workingstandard.addedfiles.add(DataFile.objects.get(pk=request.GET["fileid"]))
|
||||
# STANDARD
|
||||
# REMOVE
|
||||
elif(request.GET["action"] == "s_remstandard"):
|
||||
workingstandard.linked_standards.remove(Standards.objects.get(pk=request.GET["standardid"]))
|
||||
# ADD
|
||||
elif(request.GET["action"] == "s_addstandard"):
|
||||
workingstandard.linked_standards.add(Standards.objects.get(pk=request.GET["standardid"]))
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
success = False
|
||||
|
||||
return JsonResponse({"success" : success})
|
||||
|
|
@ -213,7 +213,7 @@
|
|||
<a style="color: #999; text-decoration: none;" href="{% url 'impressumda' %}">Impressum</a>
|
||||
</div>
|
||||
<div style="margin-top: 10px; margin-bottom: 5px;" class="sidebar-heading">
|
||||
Version 0.7.4
|
||||
Version 0.8.0
|
||||
</div>
|
||||
</div>
|
||||
</ul>
|
||||
|
|
|
|||
Loading…
Reference in New Issue