diff --git a/dasettings/templates/dasettings/structure_content.html b/dasettings/templates/dasettings/structure_content.html index 39f5b6b..6ef1633 100644 --- a/dasettings/templates/dasettings/structure_content.html +++ b/dasettings/templates/dasettings/structure_content.html @@ -242,7 +242,7 @@ noclickeffect:active { border-style: outset !important;} + + + + + + + + + + + + -{% if not perms.users.standard_management %} +{% if not perms.users.standardmanager %} + +{% if not perms.users.standard_management %} + + + +{% endif %} + +{% endblock content %} diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index 6cfd266..f1e8491 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -23,7 +23,7 @@
- {% 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 %}
{% else %}
@@ -38,7 +38,7 @@
- {% 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 %}
@@ -106,6 +106,53 @@
{% endif %} + + + {% if standard.addedquicklinks.all|length > 0 %} +
+
+
Quicklinks
+

+ {% for ql in standard.addedquicklinks.all %} + {{ ql.link|truncatechars:30 }} + {% endfor %} +

+
+
+ {% endif %} + + + + {% if standard.addedcontacts.all|length > 0 %} +
+
+
Kontakte
+

+ {% for agc in standard.addedcontacts.all %} + {{agc.company}}
+ {% endfor %} +

+
+
+ {% endif %} + + + {% if standard.addedpasswords.all|length > 0 %} +
+
+
Passwörter
+

+ {% for s in standard.addedpasswords.all %} + {{s.name}}
+ {% endfor %} +

+
+
+ {% endif %} + + + + {% if standard.linked_standards.all|length > 0 %}
@@ -148,4 +195,88 @@
+ + +{% for pass in standard.addedpasswords.all %} + +{% endfor %} + + + +{% for agc in standard.addedcontacts.all %} + +{% endfor %} + {% endblock content %} \ No newline at end of file diff --git a/standards/views.py b/standards/views.py index a3a4c18..0c85d19 100644 --- a/standards/views.py +++ b/standards/views.py @@ -15,6 +15,7 @@ from cloud.models import DataFile, DataDir from django.contrib.auth.decorators import login_required import re from django.template import defaultfilters +from organizer.models import QuickLinks, AGContacts, AGPassword # ALLE STANDARDS EINER AGENTUR class StandardsManagement(LoginRequiredMixin, ListView): @@ -165,7 +166,6 @@ def StandardAdd(request): # ADD GROUPS groups = normalForm.cleaned_data['checked_groups'].split(",") - for g in groups: if(g.isdigit()): @@ -179,11 +179,29 @@ def StandardAdd(request): # ADD FILES files = normalForm.cleaned_data['added_files'].split(",") - for f in files: if(f.isdigit()): 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'] if(new_standard.public and request.user.has_perm('users.standardmanager')): 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), 'files' : possibleFilesByVisible, '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) @@ -312,9 +333,14 @@ def StandardUpdate(request, id): if pv not in standard.representative.all(): 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 = { 'normalForm' : normalForm,