Bug Dateien noch gelöst, hat was mit dem Signal und den Gruppen zu tun. Ansonsten Editor-Bug für IE gesondert gelöst.

This commit is contained in:
holger.trampe 2020-02-17 23:21:40 +01:00
parent ad5173f358
commit 923e400bc3
14 changed files with 90 additions and 32 deletions

View File

@ -64,17 +64,24 @@ a.disabled {
{% for d in dirs %}
{% setbool False %}
{% for ag in d.visibleby.all %}
{% if user|has_group:ag.group.name %}
{% setbool True %}
{% endif %}
{% endfor %}
{{d.name}}
{{d.visibleby.all|length}}
{% if d.visibleby.all|length == 0 %}
DARF
{% setbool True %}
{% endif %}
{% getbool as groupchecker %}
{{groupchecker}}
<tr id="dir_{{d.pk}}" class="droppable_tr">
<td id="dir_{{d.pk}}_icon"><i class="fas fa-folder" ></i>
</td>

View File

@ -55,7 +55,8 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'bootstrap_datepicker_plus',
'django_cleanup'
'django_cleanup',
'django_user_agents',
]
MIDDLEWARE = [
@ -66,6 +67,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_user_agents.middleware.UserAgentMiddleware',
]
ROOT_URLCONF = 'digitaleagentur.urls'

View File

@ -134,6 +134,27 @@
</div>
</div>
</div>
<!-- FILE FORBIDDEN DELETE FILE -->
<div class="modal fade" id="forbiddenFileType" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="groupDelFunction" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Datei nicht erlaubt</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Diesen Dateitypen dürfen Sie nicht hochladen.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//STANDARDS
actualStandards = [];

View File

@ -65,17 +65,15 @@
{% 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 %}
{% if groupchecker %}
<p class="card-text"><a href="{% url 'standard-single' standard.pk %}">{{standard.name|truncatechars:40}}</a></p>
<p class="card-text"><a href="{% url 'standard-single' standard.pk %}">{{standard.name|truncatechars:28}}</a></p>
{% else %}
<p class="card-text text-secondary"><i class="fas fa-lock"></i>&nbsp;{{standard.name|truncatechars:40}}</p>
<p class="card-text text-secondary"><i class="fas fa-lock"></i>&nbsp;{{standard.name|truncatechars:28}}</p>
{% endif %}
{% endif %}
{% endfor %}

View File

@ -131,6 +131,27 @@
<a class="btn" href="{% url 'standards' %} ">Abbrechen</a>
</form>
</div>
<!-- FILE FORBIDDEN DELETE FILE -->
<div class="modal fade" id="forbiddenFileType" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="groupDelFunction" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Datei nicht erlaubt</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
Diesen Dateitypen dürfen Sie nicht hochladen.
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
//STANDARD
function remStandard(sid, sname){

View File

@ -6,6 +6,8 @@ register = template.Library()
b = 0
groupbool = False
@register.simple_tag
def setvar(value):
global b
@ -30,7 +32,6 @@ def has_group(user, group_name):
return True if group in user.groups.all() else False
groupbool = False
@register.simple_tag
def setbool(value):
global groupbool

View File

@ -184,15 +184,18 @@ def StandardUpdate(request, id):
for file in allfiles:
user_can_view_file = False
parentdir = DataDir.objects.get(pk=file.parent.pk)
if(parentdir.is_root == False):
if(parentdir.is_root == False and len(parentdir.visibleby.all()) > 0):
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:
if file not in standard.addedfiles.all() and user_can_view_file:
possibleFilesByVisible.append(file)
possiblestandards = Standards.objects.filter(agency=request.user.profile.agency, public=True)
@ -336,10 +339,6 @@ def updatesbyajax(request, pk):
# ADD
elif(request.GET["action"] == "s_addstandard"):
workingstandard.linked_standards.add(Standards.objects.get(pk=request.GET["standardid"]))
else:
success = False

View File

@ -50,7 +50,8 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
# GROUPSETTINGS FOR SOME USER WAS CHANGED
if isinstance(instance, Group):
group_touched = AgencyGroup.objects.get(group=instance)
user_touched = User.objects.get(pk=list(pk_set)[0])
userid = list(pk_set)[0]
user_touched = User.objects.get(pk=userid)
# PUSH NOTIFICATION FOR GROUOPCHANGES
if(user_touched.profile.add_new_group_push):
@ -96,6 +97,7 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
fail_silently=False
)
# SIGNAL FOR NEWS
@receiver(post_save, sender=News)
def save_news(sender, instance, **kwargs):

View File

@ -26,9 +26,16 @@
<link href='https://fonts.googleapis.com/css?family=Roboto&display=swap' rel='stylesheet' type='text/css'>
<!-- include summernote css/js -->
<!--<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script>-->
{% if request.user_agent.browser.family == "IE" %}
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.12/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.12/dist/summernote.min.js"></script>
{% else %}
<link href="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/summernote@0.8.15/dist/summernote.min.js"></script>
{% endif %}
<!-- CROPPER -->
<link href="{% static 'users/css/cropper.min.css' %}" rel="stylesheet">