Zwischenpush für Umbau Standards und Kleinkram

This commit is contained in:
holger.trampe 2020-04-25 02:06:35 +02:00
parent ad20748d5c
commit 6363b110bc
10 changed files with 1206 additions and 161 deletions

View File

@ -242,7 +242,7 @@ noclickeffect:active { border-style: outset !important;}
</button> </button>
</div> </div>
<div class="modal-body"> <div class="modal-body">
Möchten Sie den Bereich <b><span id="taskName"></span></b> wirklich löschen? Alle darin enthaltenen <u>Standards</u> werden ebenfalls entfernt! Möchten Sie den Bereich <b><span id="taskName"></span></b> wirklich löschen? Alle darin enthaltenen <u>Standards</u> müssen eine Tätigkeit erhalten!
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:doDelTask()">Tätigkeit löschen</button>&nbsp;&nbsp; <button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:doDelTask()">Tätigkeit löschen</button>&nbsp;&nbsp;

View File

@ -15,32 +15,35 @@ import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
############################################## PROD ##################################### ############################################## LOCAL #####################################
BASE_URL = "https://digitale-agentur.com/" BASE_URL = "http://localhost:8000/"
CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D" CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D"
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True DEBUG = True
# MAIL PROD # Database
EMAIL_HOST = 'smtp.strato.de' # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
EMAIL_PORT = 587 # DEV
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "support@digitale-agentur.com"
EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t"
DEFAULT_FROM_EMAIL = "support@digitale-agentur.com"
# PROD
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'NAME' : 'digitaleagentur', 'NAME' : 'digitaleagentur',
'USER' : 'digitaleagentur', 'USER' : 'root',
'PASSWORD' : 'H9hzbzyBqtUCnZlIwL1qSrzh', 'PASSWORD' : '',
'PORT' : 3306 'PORT' : 3306
} }
} }
############################################## PROD ##################################### # MAIL DEV
EMAIL_HOST = 'gymhum.de'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = "holger.trampe"
EMAIL_HOST_PASSWORD = "Motte2016_!"
DEFAULT_FROM_EMAIL = "holger.trampe@gymhum.de"
################################################### LOCAL ###############################
# Nach zehn Stunden läuft der Cookie ab! # Nach zehn Stunden läuft der Cookie ab!

View File

@ -15,14 +15,14 @@
{% if request.user.profile.agency.dynamicprofile %} {% if request.user.profile.agency.dynamicprofile %}
<div class="dropdown"> <div class="dropdown">
<button class="btn btn-primary dropdown-toggle btn-sm mr-1" type="button" id="changeViewDynamic" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button class="btn btn-primary dropdown-toggle btn-sm mr-1" type="button" id="changeViewDynamic" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span id="view_info_drop_1" style="">Ausführender</span> <span id="view_info_drop_1" style="">Ausführend</span>
<span id="view_info_drop_2" style="display: none;">Vertreter</span> <span id="view_info_drop_2" style="display: none;">Vertretend</span>
<span id="view_info_drop_0" style="display: none;">Verantwortlicher</span> <span id="view_info_drop_0" style="display: none;">Verantwortlich</span>
</button> </button>
<div class="dropdown-menu" aria-labelledby="changeViewDynamic"> <div class="dropdown-menu" aria-labelledby="changeViewDynamic">
<a class="dropdown-item" href="#\" onclick="javascript:changeView(1)">Ausführender</a> <a class="dropdown-item" href="#\" onclick="javascript:changeView(1)">Ausführend</a>
<a class="dropdown-item" href="#\" onclick="javascript:changeView(2)">Vertreter</a> <a class="dropdown-item" href="#\" onclick="javascript:changeView(2)">Vertretend</a>
<a class="dropdown-item" href="#\" onclick="javascript:changeView(0)">Verantwortlicher</a> <a class="dropdown-item" href="#\" onclick="javascript:changeView(0)">Verantwortlich</a>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@ -65,6 +65,10 @@ class StandardAddStandard(forms.ModelForm):
self.fields['added_files'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput()) self.fields['added_files'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['added_standards'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput()) self.fields['added_standards'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['added_quicklinks'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['added_contacts'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['added_passwords'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['us_verant'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput()) self.fields['us_verant'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['us_ex'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput()) self.fields['us_ex'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())
self.fields['us_ver'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput()) self.fields['us_ver'] = forms.CharField(initial="", required=False, widget=forms.HiddenInput())

View File

@ -6,6 +6,7 @@ from areas.models import Areas
from tasks.models import Tasks from tasks.models import Tasks
from cloud.models import DataFile from cloud.models import DataFile
from users.models import AgencyGroup from users.models import AgencyGroup
from organizer.models import AGPassword, AGContacts, QuickLinks
import datetime import datetime
from django.utils import timezone from django.utils import timezone
@ -24,8 +25,8 @@ class StandardComments(models.Model):
class Standards(models.Model): class Standards(models.Model):
agency = models.ForeignKey(Agency, on_delete=models.CASCADE) agency = models.ForeignKey(Agency, on_delete=models.CASCADE)
area = models.ForeignKey(Areas, on_delete=models.CASCADE, blank=True, null=True) area = models.ForeignKey(Areas, on_delete=models.SET_NULL, blank=True, null=True)
task = models.ForeignKey(Tasks, on_delete=models.CASCADE, blank=True, null=True) task = models.ForeignKey(Tasks, on_delete=models.SET_NULL, blank=True, null=True)
name = models.CharField(max_length=200, blank=False, default="") name = models.CharField(max_length=200, blank=False, default="")
content = models.TextField(blank=True, verbose_name='Inhalt', default="") content = models.TextField(blank=True, verbose_name='Inhalt', default="")
@ -63,14 +64,20 @@ class Standards(models.Model):
# VERLINKTE STANDARDS # VERLINKTE STANDARDS
linked_standards = models.ManyToManyField('Standards', blank=True) linked_standards = models.ManyToManyField('Standards', blank=True)
# GORUPS # GORUPS
visibleby = models.ManyToManyField(AgencyGroup, blank=True) visibleby = models.ManyToManyField(AgencyGroup, blank=True)
# Contacts
addedcontacts = models.ManyToManyField(AGContacts, blank=True)
# Passwords
addedpasswords = models.ManyToManyField(AGPassword, blank=True)
# Quicklinks
addedquicklinks = models.ManyToManyField(QuickLinks, blank=True, related_name="standard_quicklinks")
#indi_name = models.CharField(max_length=200, blank=False, default="") #indi_name = models.CharField(max_length=200, blank=False, default="")
#indi_conmtent = models.CharField(max_length=500, blank=False, default="") #indi_conmtent = models.CharField(max_length=500, blank=False, default="")
# FIELD FOR AGENCYNETWORK # FIELD FOR AGENCYNETWORK
comments = models.ManyToManyField("StandardComments", blank=True, related_name='comments') comments = models.ManyToManyField("StandardComments", blank=True, related_name='comments')
parent_standard = models.ForeignKey("Standards", related_name='partentedstandard', on_delete=models.PROTECT, blank=True, null=True, default=None) parent_standard = models.ForeignKey("Standards", related_name='partentedstandard', on_delete=models.SET_NULL, blank=True, null=True, default=None)
shared_on = models.DateTimeField(default=timezone.now, blank=True) shared_on = models.DateTimeField(default=timezone.now, blank=True)
favoritfrom = models.ManyToManyField(User, blank=True, related_name="FavoritFrom") favoritfrom = models.ManyToManyField(User, blank=True, related_name="FavoritFrom")

View File

@ -32,7 +32,7 @@
<!-- COLLAPSE AREA FOR GROUPS FILES AND LINKED STANDARDS --> <!-- COLLAPSE AREA FOR GROUPS FILES AND LINKED STANDARDS -->
<div class="accordion" id="additionalStandardInfos"> <div class="accordion" id="additionalStandardInfos">
<div class="card"> <div class="card">
<div class="card-header" id="st_freefield"> <div class="card-header" id="st_freefield">
<h5 class="mb-0"> <h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#freefield_content" aria-expanded="false" aria-controls="freefield_content"> <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#freefield_content" aria-expanded="false" aria-controls="freefield_content">
@ -48,9 +48,7 @@
</div> </div>
</div> </div>
<div class="card">
<div class="card">
<div class="card-header" id="st_useraut"> <div class="card-header" id="st_useraut">
<h5 class="mb-0"> <h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#useraut_content" aria-expanded="false" aria-controls="useraut_content"> <button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#useraut_content" aria-expanded="false" aria-controls="useraut_content">
@ -65,18 +63,95 @@
</div> </div>
</div> </div>
<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">
<i class="fas fa-fw fa-lightbulb"></i>&nbsp;Standards{% if request.user.profile.showtooltips %}&nbsp;<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>{% endif %}
</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="poss_standards" id="searchfield_standards" type="text" onkeyup="javascript:updateLinkedElements('standards')" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearSearchField('standards')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="poss_standards">
{% for s in standards %}
<option id="standards_{{s.pk}}" value="{{s.name|truncatechars:30}}">{{s.name|truncatechars:30}}</option>
{% endfor %}
</datalist>
</div>
Verlinkte Standards:
<table id="linked_standards" class="table table-hover table-sm">
</table>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="organizer_linked">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#organizer_linked_content" aria-expanded="false" aria-controls="organizer_linked_content">
<i class="fas fa-fw fa-address-book"></i>&nbsp;Organizer{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Verlinken Sie hier Quicklinks, Kontakte und Passwörter." class="far fa-question-circle"></i></small>{% endif %}
</button>
</h5>
</div>
<div id="organizer_linked_content" class="collapse" aria-labelledby="organizer_linked" data-parent="#additionalStandardInfos">
<div class="card-body">
<button type="button" class="btn btn-primary mb-2" onclick="javascript:$('#addModalQuicklinks').modal('toggle');">Quicklinks</button><br />
<button type="button" class="btn btn-primary mb-2" onclick="javascript:$('#addModalContacts').modal('toggle');">Kontakte</button><br />
<button type="button" class="btn btn-primary mb-2" onclick="javascript:$('#addModalPasswords').modal('toggle');">Passwörter</button><br />
</div>
</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">
<i class="fas fa-file"></i>&nbsp;Dateien{% if request.user.profile.showtooltips %}&nbsp;<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 Uploadordner für Standards gespeichert." class="far fa-question-circle"></i></small>{% endif %}
</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="poss_files" id="searchfield_files" type="text" onkeyup="javascript:updateLinkedElements('files')" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearSearchField('files')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="poss_files">
{% for f in files %}
<option id="files_{{f.pk}}" value="{{f.name}}">{{f.name}}</option>
{% endfor %}
</datalist>
</div>
Verlinkte Dateien:
<table id="linked_files" class="table table-hover table-sm">
</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>&nbsp;&nbsp;<small>klicken/hineinziehen<p class="mt-2">Dateien werden im <b>Uploadordner für Standards</b> gespeichert.
</small></p>
</div>
{% endif %}
</div>
</div>
</div>
{% endif %}
<hr>
<!-- ZUGRIFF -->
<div class="card"> <div class="card">
<div class="card-header" id="st_groups"> <div class="card-header" id="st_groups">
<h5 class="mb-0"> <h5 class="mb-0">
@ -97,72 +172,7 @@
</div> </div>
</div> </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">
<i class="fas fa-file"></i>&nbsp;Dateien{% if request.user.profile.showtooltips %}&nbsp;<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 Uploadordner für Standards gespeichert." class="far fa-question-circle"></i></small>{% endif %}
</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 files %}
<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">
</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>&nbsp;&nbsp;<small>klicken/hineinziehen<p class="mt-2">Dateien werden im <b>Uploadordner für Standards</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">
<i class="fas fa-fw fa-lightbulb"></i>&nbsp;Standards{% if request.user.profile.showtooltips %}&nbsp;<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>{% endif %}
</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 standards %}
<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">
</table>
</div>
</div>
</div>
</div>
<div class="card"> <div class="card">
<div class="card-header" id="st_agencynetwork"> <div class="card-header" id="st_agencynetwork">
@ -353,6 +363,109 @@
</div> </div>
</div> </div>
</div> </div>
<!-- ORGANIZER Quicklinks -->
<div class="modal fade" id="addModalQuicklinks" 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">Quicklinks hinzufügen</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">
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="poss_quicklinks" id="searchfield_quicklinks" type="text" onkeyup="javascript:updateLinkedElements('quicklinks')" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearSearchField('quicklinks')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="poss_quicklinks">
{% for q in quicklinks %}
<option id="quicklinks_{{q.pk}}" value="{{q.name}}">{{q.name}}</option>
{% endfor %}
</datalist>
</div>
Verlinkte Quicklinks:
<table id="linked_quicklinks" class="table table-hover table-sm">
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<!-- ORGANIZER Contacts -->
<div class="modal fade" id="addModalContacts" 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">Kontakte hinzufügen</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">
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="poss_contacts" id="searchfield_contacts" type="text" onkeyup="javascript:updateLinkedElements('contacts')" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearSearchField('contacts')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="poss_contacts">
{% for q in contacts %}
<option id="contacts_{{q.pk}}" value="{{q.company}}">{{q.company}}</option>
{% endfor %}
</datalist>
</div>
Verlinkte Kontakte:
<table id="linked_contacts" class="table table-hover table-sm">
</table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
<!-- ORGANIZER Passwords -->
<div class="modal fade" id="addModalPasswords" 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">Passwords hinzufügen</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">
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="poss_passwords" id="searchfield_passwords" type="text" onkeyup="javascript:updateLinkedElements('passwords')" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearSearchField('passwords')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="poss_passwords">
{% for q in passwords %}
<option id="passwords_{{q.pk}}" value="{{q.name}}">{{q.name}}</option>
{% endfor %}
</datalist>
</div>
Verlinkte Passwörter:
<table id="linked_passwords" class="table table-hover table-sm">
</table>
</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"> <script type="text/javascript">
var ua = window.navigator.userAgent; var ua = window.navigator.userAgent;
var isIE = /MSIE|Trident/.test(ua); var isIE = /MSIE|Trident/.test(ua);
@ -363,6 +476,7 @@ if ( isIE ) {
alluserfields = $(".searchuserfieldstask").each(function(key, value){ alluserfields = $(".searchuserfieldstask").each(function(key, value){
specific_userfield_id = value['id'].split("_")[1]; specific_userfield_id = value['id'].split("_")[1];
updateLinkedStandards(); updateLinkedStandards();
updateLinkedQuicklinks();
updateLinkedFiles(); updateLinkedFiles();
checkUserVerant(); checkUserVerant();
checkUserEx(); checkUserEx();
@ -454,42 +568,120 @@ function clearUserSearchFields(opt){
$("#searchuser_" + opt).val(""); $("#searchuser_" + opt).val("");
} }
//STANDARDS
actualStandards = [];
function changeAddedUsers(){ function changeAddedUsers(){
$("#addUsersToStandard").modal("toggle"); $("#addUsersToStandard").modal("toggle");
} }
/*
function clearSearchfieldAddStandard(){ Functions to control the dynamic element fields:
$("#searchstandards").val(""); - standards
- quicklinks
- contacts
- passwords
- files
*/
//Temp Fields
//Helpfer function to check actual field content
function showAllFields(){
console.log(actualStandards);
console.log(actualFiles);
console.log(actualQuicklinks);
console.log(actualContacts);
console.log(actualPasswords);
} }
function updateLinkedStandards(){ //STANDARDS
var g = $('#searchstandards').val(); actualStandards = [];
var id = $('#possstandards').find('option[value="' + g + '"]').attr('id'); actualFiles = [];
actualQuicklinks = [];
actualContacts = [];
actualPasswords = [];
//Clear the Searchfield with the given type
function clearSearchField(type){
$("#searchfield_" + type).val("");
}
//Add new Elements by given Type
function updateLinkedElements(type){
var g = $('#searchfield_' + type).val();
var id = $('#poss_' + type).find('option[value="' + g + '"]').attr('id');
if(id != undefined && id.length > 0){ if(id != undefined && id.length > 0){
tempid_standard = id.split("_")[1]; clearSearchField(type);
actualStandards.push(tempid_standard); tempid = id.split("_")[1];
clearSearchfieldAddStandard();
if(type == 'standards'){
actualStandards.push(tempid);
$("#id_added_" + type).val(actualStandards);
}
else if(type == 'files'){
actualFiles.push(tempid);
$("#id_added_" + type).val(actualFiles);
}
else if(type == 'quicklinks'){
actualQuicklinks.push(tempid);
$("#id_added_" + type).val(actualQuicklinks);
}
else if(type == 'contacts'){
actualContacts.push(tempid);
$("#id_added_" + type).val(actualContacts);
}
else if(type == 'passwords'){
actualPasswords.push(tempid);
$("#id_added_" + type).val(actualPasswords);
}
$("#" + id).remove(); $("#" + 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>'); $("#linked_" + type).append('<tr id="added_'+ type +'_' + tempid+'"><td>' + g + '</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remEle(\''+type+'\','+tempid+', \''+g+'\')"><i class="fas fa-trash-alt"></i></button></td></tr>');
} }
$("#id_added_standards").val(actualStandards); //showAllFields();
} }
function remStandard(id, name){ //Remove an added Element from View and placeholder-arrays and hidden fields
index_to_rem = actualStandards.indexOf(id); function remEle(type, id, name){
actualStandards.splice(index_to_rem,1);
$('#possstandards').append('<option id="standard_'+id+'" value="'+ name +'">'+ name +'</option>'); index_to_rem = 0;
$("#standardadded_" + id).remove(); if(type == 'standards'){
$("#id_added_standards").val(actualStandards); index_to_rem = actualStandards.indexOf(id);
actualStandards.splice(index_to_rem,1);
$("#id_added_standards").val(actualStandards);
}
else if(type == 'files'){
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);
actualQuicklinks.splice(index_to_rem,1);
$("#id_added_" + type).val(actualQuicklinks);
}
else if(type == 'contacts'){
index_to_rem = actualContacts.indexOf(id);
actualContacts.splice(index_to_rem,1);
$("#id_added_" +type).val(actualContacts);
}
else if(type == 'passwords'){
index_to_rem = actualPasswords.indexOf(id);
actualPasswords.splice(index_to_rem,1);
$("#id_added_" +type).val(actualPasswords);
}
$('#poss_' + type).prepend('<option id="'+type+'_'+id+'" value="'+ name +'">'+ name +'</option>');
$("#added_" + type + '_' + id).remove();
//showAllFields();
} }
//FILES //FILES
// preventing page from redirecting // preventing page from redirecting
$("html").on("dragover", function(e) { $("html").on("dragover", function(e) {
@ -616,7 +808,8 @@ function doUploadAction(filetodo, replacestat){
hideUpload(); hideUpload();
actualFiles.push(String(data["data"]["savedobj_id"])); actualFiles.push(String(data["data"]["savedobj_id"]));
$("#id_added_files").val(actualFiles); $("#id_added_files").val(actualFiles);
$("#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>'); type = "files";
$("#linked_files").append('<tr id="added_files_'+data["data"]["savedobj_id"]+'"><td>' + data["data"]["savedobj_name"] + '</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remEle(\''+type+'\','+data["data"]["savedobj_id"]+', \''+data["data"]["savedobj_name"]+'\')"><i class="fas fa-trash-alt"></i></button></td></tr>');
}, 1000); }, 1000);
} }
else{ else{
@ -630,37 +823,8 @@ function doUploadAction(filetodo, replacestat){
} }
} }
actualFiles = [];
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];
actualFiles.push(tempid_file);
$("#id_added_files").val(actualFiles)
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>');
}
}
function remFile(id, name){
index_to_rem = actualFiles.indexOf(id);
actualFiles.splice(index_to_rem,1);
$('#possfiles').append('<option id="file_'+id+'" value="'+ name +'">'+ name +'</option>');
$("#fileadded_" + id).remove();
$("#id_added_files").val(actualFiles);
}
//GROUPS //GROUPS
actualGroups = []; actualGroups = [];
function groupsChange(groupid, value){ function groupsChange(groupid, value){
if(value){ if(value){
actualGroups.push(groupid); actualGroups.push(groupid);
@ -699,7 +863,7 @@ $(document).ready(function() {
</script> </script>
{% if not perms.users.standard_management %} {% if not perms.users.standardmanager %}
<script type="text/javascript"> <script type="text/javascript">
$("#div_id_public").hide(); $("#div_id_public").hide();

View File

@ -0,0 +1,710 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% load counter_tag %}
{% block content %}
<div class="content-section col-12">
<h3>Neuen Standard anlegen{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Legen Sie hier einen neuen Standard an." class="far fa-question-circle"></i></small>{% endif %}</h3>
<hr>
<form method="POST" id="addstandardform">
{% csrf_token %}
<div class="row"><div class="col-8">
{% for field in normalForm %}
{% if field.is_hidden == False %}
{% if forloop.counter|divisibleby:6 %}
</div><div class="col-3">
{% if field.name != 'freefield_content' and field.name != 'freefield_title' %}
{{field|as_crispy_field }}
{% endif %}
{% else %}
{% if field.name != 'freefield_content' and field.name != 'freefield_title' %}
{{field|as_crispy_field }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% for field in normalForm %}
{% if field.is_hidden %}
{{field}}
{% endif %}
{% endfor %}
<!-- COLLAPSE AREA FOR GROUPS FILES AND LINKED STANDARDS -->
<div class="accordion" id="additionalStandardInfos">
<div class="card">
<div class="card-header" id="st_freefield">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#freefield_content" aria-expanded="false" aria-controls="freefield_content">
<i class="fas fa-file-alt"></i>&nbsp;Freitextfeld{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Vergeben Sie für ein freies Textfeld einen Titel und einen entsprechenden Inhalt." class="far fa-question-circle"></i></small>{% endif %}
</button>
</h5>
</div>
<div id="freefield_content" class="collapse" aria-labelledby="st_freefield" data-parent="#additionalStandardInfos">
<div class="card-body">
{{ normalForm.freefield_title|as_crispy_field }}
{{ normalForm.freefield_content|as_crispy_field }}
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="st_useraut">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#useraut_content" aria-expanded="false" aria-controls="useraut_content">
<i class="fas fa-user"></i>&nbsp;Mitarbeiterzuweisung{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Weisen Sie dem Standard verantwortliche, ausführende und vertretende Mitarbeiter zu." class="far fa-question-circle"></i></small>{% endif %}
</button>
</h5>
</div>
<div id="useraut_content" class="collapse" aria-labelledby="st_useraut" data-parent="#additionalStandardInfos">
<div class="card-body">
<button type="button" class="btn btn-primary mb-2" onclick="javascript:changeAddedUsers()">Mitarbeiter zuweisen</button>
</div>
</div>
</div>
<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">
<i class="fas fa-lock"></i>&nbsp;Zugriffsbeschränkung{% if request.user.profile.showtooltips %}&nbsp;<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>{% endif %}
</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">
<input type="checkbox" class="custom-control-input groupclass" onclick="javascript:groupsChange({{g.pk}}, this.checked)" name="group_{{g.pk}}" id="group_{{g.pk}}">
<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">
<i class="fas fa-file"></i>&nbsp;Dateien{% if request.user.profile.showtooltips %}&nbsp;<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 Uploadordner für Standards gespeichert." class="far fa-question-circle"></i></small>{% endif %}
</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 files %}
<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">
</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>&nbsp;&nbsp;<small>klicken/hineinziehen<p class="mt-2">Dateien werden im <b>Uploadordner für Standards</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">
<i class="fas fa-fw fa-lightbulb"></i>&nbsp;Standards{% if request.user.profile.showtooltips %}&nbsp;<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>{% endif %}
</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 standards %}
<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">
</table>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="st_agencynetwork">
<h5 class="mb-0">
<button class="btn btn-link collapsed" type="button" data-toggle="collapse" data-target="#agnetwork_content" aria-expanded="false" aria-controls="agnetwork_content">
<i class="fas fa-users"></i>&nbsp;Agenturverbund{% if request.user.profile.showtooltips %}&nbsp;<small><i data-toggle="tooltip" data-placement="top" title="Wählen Sie hier aus, in welchen Agenturverbund dieser Standard geteilt werden soll." class="far fa-question-circle"></i></small>{% endif %}
</button>
</h5>
</div>
<div id="agnetwork_content" class="collapse" aria-labelledby="st_agencynetwork" data-parent="#additionalStandardInfos">
<div class="card-body">
Das Zuweisen zu einem Agenturverbund ist erst nach dem Anlegen eines neuen Standards möglich.
</div>
</div>
</div>
</div></div>
<p>Wenn ein Standard erstellt wurde, kann er nur von einer Person mit dem Recht <i>Standards bearbeiten und freischalten</i> veröffentlicht werden.</p>
<hr>
<button type="submit" class="btn btn-success">Standard anlegen</button>&nbsp;
<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>
<!-- 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>
<!-- Add Users to Standard -->
<div class="modal fade" id="addUsersToStandard" tabindex="-1" data-backdrop="static" aria-labelledby="" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Mitarbeiter zuweisen</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">
<!--
Verantwortlicher
Ausführender
Vertreter
-->
<h6>Verantwortlicher:</h6>
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="possusers_verant" id="searchuser_verant" type="text" onkeyup="javascript:checkUserVerant()" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearUserSearchFields('verant')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="possusers_verant">
{% for us in usersofagency %}
<option id="{{us.pk}}_verant" value="{{us.first_name}} {{us.last_name}}"></option>
{% endfor %}
</datalist>
</div>
<!--<h6>Verantwortliche Mitarbeiter:</h6>-->
<div id="added_users_verant_buttons"></div>
<hr>
<!--
Ausführender
Vertreter
-->
<h6>Ausführender:</h6>
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="possusers_ex" id="searchuser_ex" type="text" onkeyup="javascript:checkUserEx()" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearUserSearchFields('ex')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="possusers_ex">
{% for us in usersofagency %}
<option id="{{us.pk}}_ex" value="{{us.first_name}} {{us.last_name}}"></option>
{% endfor %}
</datalist>
</div>
<!--<h6>Ausführende Mitarbeiter:</h6>-->
<div id="added_users_ex_buttons"></div>
<hr>
<!--
Vertreter
-->
<h6>Vertreter:</h6>
<div class="input-group mb-3">
<input class="form-control searchuserfieldstask" list="possusers_ver" id="searchuser_ver" type="text" onkeyup="javascript:checkUserVer()" >
<div class="input-group-append">
<button type="button" onclick="javascript:clearUserSearchFields('ver')" class="btn btn-secondary" ><i class="fas fa-times"></i></button>
</div>
<datalist id="possusers_ver">
{% for us in usersofagency %}
<option id="{{us.pk}}_ver" value="{{us.first_name}} {{us.last_name}}"></option>
{% endfor %}
</datalist>
</div>
<!--<h6>Vertretende Mitarbeiter:</h6>-->
<div id="added_users_ver_buttons"></div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Fertig</button>
</div>
</div>
</div>
</div>
<!-- UPLOADING PROCESS -->
<div class="modal fade" id="uploadModalProgress" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Hochladen</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<i class="fas fa-spinner fa-spin"></i> Datei wird hochgeladen...
<div class="progress">
<div class="progress-bar" id="uploadprocessbar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100"></div>
</div>
</div>
</div>
</div>
</div>
<!-- CONFIRMA DOUBLE FILE -->
<div class="modal fade" id="doubleFileChoiceModal" 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 bereits vorhanden</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">
Die Datei <b><span id="doublefile_name"></span></b> ist bereits vorhanden. Soll die Datei ersetzt oder beide behalten werden?
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:replaceFileDirectChoice(filetodo_ex, 1)">Alte Datei ersetzen</button>&nbsp;&nbsp;
<button type="button" class="btn btn-success" data-dismiss="modal" onclick="javascript:replaceFileDirectChoice(filetodo_ex, 0)">Beide behalten</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var ua = window.navigator.userAgent;
var isIE = /MSIE|Trident/.test(ua);
if ( isIE ) {
//IE specific code goes here
setInterval(function()
{
alluserfields = $(".searchuserfieldstask").each(function(key, value){
specific_userfield_id = value['id'].split("_")[1];
updateLinkedStandards();
updateLinkedFiles();
checkUserVerant();
checkUserEx();
checkUserVer();
});
},400);
}
//USERSTOSTANDARDS
//Verantwortlicher
act_verant = [];
function checkUserVerant(){
var g = $('#searchuser_verant').val();
var id = $('#possusers_verant').find('option[value="' + g + '"]').attr('id');
if(id != undefined && id.length > 0){
tempid = id.split("_")[0];
clearUserSearchFields("verant");
$("#added_users_verant_buttons").append('<span id="span_btn_verant_'+tempid+'" class="badge badge-pill badge-primary mr-2 mt-2"><a class="btn btn-primary" onclick="javascript:removeUserFromVeran('+tempid+', \''+g+'\')">'+g+'&nbsp;&nbsp;<i class="fas fa-times"></i></a ></span>');
$("#" + tempid + "_verant").remove();
act_verant.push(tempid);
$("#id_us_verant").val(act_verant);
}
}
function removeUserFromVeran(id, name){
index_to_rem = act_verant.indexOf(id.toString());
act_verant.splice(index_to_rem,1);
$('#possusers_verant').append('<option id="'+id+'_verant" value="'+ name +'">'+ name +'</option>');
$("#id_us_verant").val(act_verant);
$("#span_btn_verant_" + id).remove();
}
//Ausführender
act_ex = [];
function checkUserEx(){
var g = $('#searchuser_ex').val();
var id = $('#possusers_ex').find('option[value="' + g + '"]').attr('id');
if(id != undefined && id.length > 0){
tempid = id.split("_")[0];
clearUserSearchFields("ex");
$("#added_users_ex_buttons").append('<span id="span_btn_ex_'+tempid+'" class="badge badge-pill badge-primary mr-2 mt-2"><a class="btn btn-primary" onclick="javascript:removeUserFromEx('+tempid+', \''+g+'\')">'+g+'&nbsp;&nbsp;<i class="fas fa-times"></i></a ></span>');
$("#" + tempid + "_ex").remove();
act_ex.push(tempid);
$("#id_us_ex").val(act_ex);
}
}
function removeUserFromEx(id, name){
index_to_rem = act_ex.indexOf(id.toString());
act_ex.splice(index_to_rem,1);
$('#possusers_ex').append('<option id="'+id+'_ex" value="'+ name +'">'+ name +'</option>');
$("#id_us_ex").val(act_ex);
$("#span_btn_ex_" + id).remove();
}
//Vertreter
act_ver = [];
function checkUserVer(){
var g = $('#searchuser_ver').val();
var id = $('#possusers_ver').find('option[value="' + g + '"]').attr('id');
if(id != undefined && id.length > 0){
tempid = id.split("_")[0];
clearUserSearchFields("ver");
$("#added_users_ver_buttons").append('<span id="span_btn_ver_'+tempid+'" class="badge badge-pill badge-primary mr-2 mt-2"><a class="btn btn-primary" onclick="javascript:removeUserFromVer('+tempid+', \''+g+'\')">'+g+'&nbsp;&nbsp;<i class="fas fa-times"></i></a ></span>');
$("#" + tempid + "_ver").remove();
act_ver.push(tempid);
$("#id_us_ver").val(act_ver);
}
}
function removeUserFromVer(id, name){
index_to_rem = act_ver.indexOf(id.toString());
act_ver.splice(index_to_rem,1);
$('#possusers_ver').append('<option id="'+id+'_ver" value="'+ name +'">'+ name +'</option>');
$("#id_us_ver").val(act_ver);
$("#span_btn_ver_" + id).remove();
}
//Clear user search fields
function clearUserSearchFields(opt){
$("#searchuser_" + opt).val("");
}
//STANDARDS
actualStandards = [];
function changeAddedUsers(){
$("#addUsersToStandard").modal("toggle");
}
function clearSearchfieldAddStandard(){
$("#searchstandards").val("");
}
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];
actualStandards.push(tempid_standard);
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>');
}
$("#id_added_standards").val(actualStandards);
}
function remStandard(id, name){
index_to_rem = actualStandards.indexOf(id);
actualStandards.splice(index_to_rem,1);
$('#possstandards').append('<option id="standard_'+id+'" value="'+ name +'">'+ name +'</option>');
$("#standardadded_" + id).remove();
$("#id_added_standards").val(actualStandards);
}
//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 = ['doc','docx','odt','ods','xls','xlsx','xlsm','ppt','pptx','mov','avi','svg','png','jpg','jpeg','mp3', 'wav', 'zip', 'rar', 'mp4', 'mwv', 'flv', 'eps', 'txt', 'pdf']
function uploadButtonPush(){
$("#uploadedfile").click();
}
$('#uploadedfile').on('change', function() {
uploadAction($("#uploadedfile")[0]['files'][0], {{parentid}});
});
function hideUpload(){
$("#uploadModalProgress").modal("hide");
}
function replaceFileDirectChoice(filetodo, choice){
$("#doubleFileChoiceModal").modal("toggle");
doUploadAction(filetodo_ex, choice);
}
function uploadAction(filetodo){
filetodo_ex = filetodo;
$.ajax(
{
type: "GET",
url: "{% url 'cloud-adddir' parentid %}",
data:{
action : "check_doublefile",
name : filetodo.name
},
success: function( data )
{
if(data["data"]["found"]){
$("#doubleFileChoiceModal").modal("toggle");
$("#doublefile_name").html(filetodo.name);
}
else{
doUploadAction(filetodo, 0);
}
}
});
}
function getFileExtension1(filename) {
return (/[.]/.exec(filename)) ? /[^.]+$/.exec(filename)[0] : undefined;
}
function doUploadAction(filetodo, replacestat){
var formData = new FormData();
formData.append("uploadedfile", filetodo);
formData.append("uploadsource", "standards");
formData.append("replace", replacestat);
var c = false;
for (i = 0; i < allowedtypes.length; i++) {
if (allowedtypes[i].localeCompare(getFileExtension1(filetodo.name)) == 0)
{
c = true;
}
}
if(c && 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,
beforeSend: function(){
$("#uploadModalProgress").modal("toggle");
},
xhr: function() {
var xhr = new window.XMLHttpRequest();
xhr.upload.addEventListener("progress", function(evt) {
if (evt.lengthComputable) {
var percentComplete = (evt.loaded / evt.total) * 100;
$("#uploadprocessbar").css("width", percentComplete + "%");
}
}, false);
return xhr;
},
success: function(data) {
if(data["success"] == true){
setTimeout(function(){
hideUpload();
actualFiles.push(String(data["data"]["savedobj_id"]));
$("#id_added_files").val(actualFiles);
$("#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>');
}, 1000);
}
else{
$("#forbiddenFileType").modal("toggle")
}
}
});
}
else{
$("#forbiddenFileType").modal("toggle")
}
}
actualFiles = [];
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];
actualFiles.push(tempid_file);
$("#id_added_files").val(actualFiles)
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>');
}
}
function remFile(id, name){
index_to_rem = actualFiles.indexOf(id);
actualFiles.splice(index_to_rem,1);
$('#possfiles').append('<option id="file_'+id+'" value="'+ name +'">'+ name +'</option>');
$("#fileadded_" + id).remove();
$("#id_added_files").val(actualFiles);
}
//GROUPS
actualGroups = [];
function groupsChange(groupid, value){
if(value){
actualGroups.push(groupid);
}
else {
index_to_rem = actualGroups.indexOf(groupid)
actualGroups.splice(index_to_rem,1);
}
$("#id_checked_groups").val(actualGroups);
}
/*
Ajax-Request zum nachladen der Aufgaben nach Auswahl der Bereiche
*/
$("#id_area").change(function () {
var areaid = $(this).val();
$.ajax({
url: "/standards/ajax/loadtasks/",
data: {
'areaid': areaid
},
success: function (data) {
$("#id_task").html(data);
}
});
});
$(document).ready(function() {
$('#id_content').summernote({
height: 400,
lang: "de-DE",
disableDragAndDrop: true
});
});
</script>
{% if not perms.users.standard_management %}
<script type="text/javascript">
$("#div_id_public").hide();
</script>
{% endif %}
{% endblock content %}

View File

@ -23,7 +23,7 @@
<hr> <hr>
<div class="row col"> <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 %} {% 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 %}
<div class="card col-9" style="min-height: 500px"> <div class="card col-9" style="min-height: 500px">
{% else %} {% else %}
<div class="card col-12" style="min-height: 500px"> <div class="card col-12" style="min-height: 500px">
@ -38,7 +38,7 @@
</div> </div>
<!-- PERSONEN --> <!-- PERSONEN -->
{% if 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 %} {% 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 %}
<div class="col-3"> <div class="col-3">
@ -106,6 +106,53 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
<!-- Quicklinks -->
{% if standard.addedquicklinks.all|length > 0 %}
<div class="card col-14 ml-1 mb-2" style="">
<div class="card-body">
<h5 class="card-title">Quicklinks</h5>
<p class="card-text">
{% for ql in standard.addedquicklinks.all %}
<a href="{{ ql.link }}" target="_blank">{{ ql.link|truncatechars:30 }}</a>
{% endfor %}
</p>
</div>
</div>
{% endif %}
<!-- Contacts -->
{% if standard.addedcontacts.all|length > 0 %}
<div class="card col-14 ml-1 mb-2" style="">
<div class="card-body">
<h5 class="card-title">Kontakte</h5>
<p class="card-text">
{% for agc in standard.addedcontacts.all %}
<a href="#/" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.company}}</a><br />
{% endfor %}
</p>
</div>
</div>
{% endif %}
<!-- Passwords -->
{% if standard.addedpasswords.all|length > 0 %}
<div class="card col-14 ml-1 mb-2" style="">
<div class="card-body">
<h5 class="card-title">Passwörter</h5>
<p class="card-text">
{% for s in standard.addedpasswords.all %}
<a onclick="javascript:$('#infos_searchres_pass_{{s.pk}}').modal('toggle');" href="#\">{{s.name}}</a><br />
{% endfor %}
</p>
</div>
</div>
{% endif %}
<!-- STANDARDS --> <!-- STANDARDS -->
{% if standard.linked_standards.all|length > 0 %} {% if standard.linked_standards.all|length > 0 %}
<div class="card col-14 ml-1" style=""> <div class="card col-14 ml-1" style="">
@ -148,4 +195,88 @@
</small> </small>
</div> </div>
</div> </div>
{% for pass in standard.addedpasswords.all %}
<div class="modal fade " id="infos_searchres_pass_{{pass.pk}}" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">{{pass.name}}</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">
{% setbool False %}
{% for passgrous in pass.visibleby.all %}
{% if user|has_group:passgrous.group.name %}
{% setbool True %}
{% endif %}
{% endfor %}
{% if pass.visibleby.all|length == 0 %}
{% setbool True %}
{% endif %}
{% getbool as groupchecker %}
{% if groupchecker %}
Name: <b>{{pass.name }}</b><br />
Benutzername: <b/>{{pass.agpass_username }}</b><br />
Passwort: <b/>{{pass.agpass_username }}</b><br />
{% else %}
Sie dürfen keine Informationen dieses Passwords einsehen.
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
{% endfor %}
{% for agc in standard.addedcontacts.all %}
<div class="modal fade " id="infos_{{agc.pk}}" tabindex="-1" role="dialog" data-backdrop="static" aria-hidden="true">
<div class="modal-dialog " role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.company}}</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">
{% if agc.personname|length > 0 %}
Ansprechpartner: {{agc.personname}}<br/>
{% endif %}
{% if agc.mail|length > 0 %}
E-Mailadresse: <a href="mailto:{{agc.mail}}">{{agc.mail}}</a><br />
{% endif %}
{% if agc.phone1|length > 0 %}
Telefon 1: <a href="tel::{{agc.phone1}}">{{agc.phone1}}</a><br />
{% endif %}
{% if agc.phone2|length > 0 %}
Telefon 1: <a href="tel::{{agc.phone2}}">{{agc.phone2}}</a><br />
{% endif %}
{% if agc.street|length > 0 %}
Adresse: {{agc.street}} {{agc.plz}} {{agc.city}} <br />
{% endif %}
{% if agc.desc|length > 0 %}
Anmerkungen: {{agc.desc}}<br />
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
</div>
</div>
</div>
</div>
{% endfor %}
{% endblock content %} {% endblock content %}

View File

@ -15,6 +15,7 @@ from cloud.models import DataFile, DataDir
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
import re import re
from django.template import defaultfilters from django.template import defaultfilters
from organizer.models import QuickLinks, AGContacts, AGPassword
# ALLE STANDARDS EINER AGENTUR # ALLE STANDARDS EINER AGENTUR
class StandardsManagement(LoginRequiredMixin, ListView): class StandardsManagement(LoginRequiredMixin, ListView):
@ -165,7 +166,6 @@ def StandardAdd(request):
# ADD GROUPS # ADD GROUPS
groups = normalForm.cleaned_data['checked_groups'].split(",") groups = normalForm.cleaned_data['checked_groups'].split(",")
for g in groups: for g in groups:
if(g.isdigit()): if(g.isdigit()):
@ -179,11 +179,29 @@ def StandardAdd(request):
# ADD FILES # ADD FILES
files = normalForm.cleaned_data['added_files'].split(",") files = normalForm.cleaned_data['added_files'].split(",")
for f in files: for f in files:
if(f.isdigit()): if(f.isdigit()):
new_standard.addedfiles.add(DataFile.objects.get(pk=f)) new_standard.addedfiles.add(DataFile.objects.get(pk=f))
# ADD QUICKLINKS
quicklinks = normalForm.cleaned_data['added_quicklinks'].split(",")
for f in quicklinks:
if(f.isdigit()):
new_standard.addedquicklinks.add(QuickLinks.objects.get(pk=f))
# ADD PASSWORDS
addedpasswords = normalForm.cleaned_data['added_passwords'].split(",")
for f in addedpasswords:
if(f.isdigit()):
new_standard.addedpasswords.add(AGPassword.objects.get(pk=f))
# ADD CONTACTS
contacts = normalForm.cleaned_data['added_contacts'].split(",")
for f in contacts:
if(f.isdigit()):
new_standard.addedcontacts.add(AGContacts.objects.get(pk=f))
tempstandardname = normalForm.cleaned_data['name'] tempstandardname = normalForm.cleaned_data['name']
if(new_standard.public and request.user.has_perm('users.standardmanager')): if(new_standard.public and request.user.has_perm('users.standardmanager')):
messages.success(request, f'Standard {tempstandardname} hinzugefügt und veröffentlicht.') messages.success(request, f'Standard {tempstandardname} hinzugefügt und veröffentlicht.')
@ -218,7 +236,10 @@ def StandardAdd(request):
'usersofagency' : User.objects.filter(profile__agency=request.user.profile.agency), 'usersofagency' : User.objects.filter(profile__agency=request.user.profile.agency),
'files' : possibleFilesByVisible, 'files' : possibleFilesByVisible,
'parentid' : list(DataDir.objects.filter(agency=request.user.profile.agency, is_root=True))[0].pk, 'parentid' : list(DataDir.objects.filter(agency=request.user.profile.agency, is_root=True))[0].pk,
'standards' : Standards.objects.filter(agency=request.user.profile.agency, public=True) 'standards' : Standards.objects.filter(agency=request.user.profile.agency, public=True),
'quicklinks' : QuickLinks.objects.filter(agency=request.user.profile.agency),
'contacts' : AGContacts.objects.filter(agency=request.user.profile.agency),
'passwords' : AGPassword.objects.filter(agency=request.user.profile.agency),
} }
return render(request, 'standards/standards_add.html', context) return render(request, 'standards/standards_add.html', context)
@ -312,9 +333,14 @@ def StandardUpdate(request, id):
if pv not in standard.representative.all(): if pv not in standard.representative.all():
possible_ver_final.append(pv) possible_ver_final.append(pv)
agencynetworks = AgencyNetwork.objects.filter(creator_agency=request.user.profile.agency) | AgencyNetwork.objects.filter(adminagencys__in=[request.user.profile.agency.pk]) | AgencyNetwork.objects.filter(members__in=[request.user.profile.agency.pk]) | AgencyNetwork.objects.filter(sharemembers__in=[request.user.profile.agency.pk]) #agencynetworks = AgencyNetwork.objects.filter(creator_agency=request.user.profile.agency) | AgencyNetwork.objects.filter(adminagencys__in=[request.user.profile.agency.pk]) | AgencyNetwork.objects.filter(members__in=[request.user.profile.agency.pk]) | AgencyNetwork.objects.filter(sharemembers__in=[request.user.profile.agency.pk])
agencynetworks_all = AgencyNetwork.objects.all()
agencynetworks = []
for a in agencynetworks_all:
if self.request.user.profile.agency in a.adminagencys.all() or self.request.user.profile.agency in a.members.all() or self.request.user.profile.agency in a.sharemembers.all():
agencynetworks.append(a)
context = { context = {
'normalForm' : normalForm, 'normalForm' : normalForm,