+{% endif %}
{% endblock content %}
\ No newline at end of file
diff --git a/news/templates/news/news_management.html b/news/templates/news/news_management.html
index baa7359..3799591 100644
--- a/news/templates/news/news_management.html
+++ b/news/templates/news/news_management.html
@@ -1,14 +1,12 @@
{% extends "users/base.html" %}
{% block content %}
+{% if request.user.profile.agency.module_news %}
-
News
+
News
-
- Hier können aktuelle Nachrichten für die Agentur erstellt und verwaltet werden.
-
@@ -162,4 +160,7 @@ $('#news_tabs a').on('click', function (e) {
});
+{% else %}
+
Das Modul News wurde in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
diff --git a/news/templates/news/news_single.html b/news/templates/news/news_single.html
index 228a5d4..36f0844 100644
--- a/news/templates/news/news_single.html
+++ b/news/templates/news/news_single.html
@@ -1,5 +1,6 @@
{% extends "users/base.html" %}
{% block content %}
+{% if request.user.profile.agency.module_news %}
{{news.name}}
@@ -12,4 +13,7 @@
{{news.media}}
{{news.content|safe}}
+{% else %}
+
Das Modul News wurde in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
\ No newline at end of file
diff --git a/news/templates/news/news_update.html b/news/templates/news/news_update.html
index da53bfc..9c0d3d1 100644
--- a/news/templates/news/news_update.html
+++ b/news/templates/news/news_update.html
@@ -1,6 +1,7 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
+{% if request.user.profile.agency.module_news %}
News bearbeiten
@@ -20,4 +21,7 @@ $(document).ready(function() {
});
});
+{% else %}
+
Das Modul News wurde in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
\ No newline at end of file
diff --git a/news/urls.py b/news/urls.py
index 6e3ca0e..9cbd455 100644
--- a/news/urls.py
+++ b/news/urls.py
@@ -1,5 +1,6 @@
from django.urls import path
from .views import NewsManagement, NewsAdd, NewsDeleteView
+from django.contrib.auth.decorators import login_required, permission_required
from . import views
'''
Permissions definiert in models.py bei USERS und dann hier vor die View geschrieben!
@@ -7,9 +8,9 @@ Permissions definiert in models.py bei USERS und dann hier vor die View geschrie
urlpatterns = [
path('', NewsManagement.as_view(template_name="news/news_management.html"), name='news-management'),
- path('newsadd/', views.NewsAdd, name='news-add'),
- path('newsupdate/
/', views.NewsUpdate, name='news-update'),
- path('news//delete', NewsDeleteView.as_view(), name='news-delete'),
+ path('newsadd/', permission_required('users.modulenews')(views.NewsAdd), name='news-add'),
+ path('newsupdate//', permission_required('users.modulenews')(views.NewsUpdate), name='news-update'),
+ path('news//delete', permission_required('users.modulenews')(NewsDeleteView.as_view()), name='news-delete'),
#path('ajax/loadtasks/', views.load_tasks, name='ajax_loadtasks'),
#path('standard//changestat', views.StandardChangePublic, name="standard-status"),
path('news//single', views.NewsSingle, name="news-single"),
diff --git a/news/views.py b/news/views.py
index 9d32a42..6c2627c 100644
--- a/news/views.py
+++ b/news/views.py
@@ -21,7 +21,7 @@ class NewsManagement(LoginRequiredMixin, ListView):
news = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_online_on__lt=filterdate).filter(go_offline_on__gt=filterdate).order_by('-created_date')
news_arch = News.objects.filter(agency__pk=self.request.user.profile.agency.pk).filter(go_offline_on__lt=filterdate).order_by('-created_date')
context = super().get_context_data(**kwargs)
- context.update({'active_link' : 'newsmanagement', 'news' : news, 'news_arch' : news_arch})
+ context.update({'active_link' : 'dashboard', 'news' : news, 'news_arch' : news_arch})
return context
'''
class NewsAddNews(LoginRequiredMixin, CreateView):
@@ -57,7 +57,7 @@ def NewsAdd(request):
new_news.save()
messages.success(request, f'News gespeichert!')
- return redirect('news-management')
+ return redirect('users-dashboard')
else:
normalForm = NewsAddNews(instance=request.user)
@@ -67,19 +67,19 @@ def NewsAdd(request):
context = {
'normalForm' : normalForm,
#'editorForm' : editorForm,
- 'active_link' : 'newsmanagement'
+ 'active_link' : 'dashboard'
}
return render(request, 'news/news_addnews.html', context)
@login_required
def NewsUpdate(request, id):
- news = News.objects.get(pk=id)
+ news = News.objects.get(pk=id, agency=request.user.profile.agency)
if request.method == 'POST':
normalForm = NewsAddNews(request.POST, instance=news)
#editorForm = NewsAddNewsEditor(request.POST, instance=news)
if normalForm.is_valid():
- news = News.objects.get(pk=id)
+ news = News.objects.get(pk=id, agency=request.user.profile.agency)
news.last_modified_by = request.user
news.last_modified_on = datetime.now()
news.go_online_on = normalForm.cleaned_data['go_online_on']
@@ -98,7 +98,7 @@ def NewsUpdate(request, id):
context = {
'normalForm' : normalForm,
#'editorForm' : editorForm,
- 'active_link' : 'newsmanagement',
+ 'active_link' : 'dashboard',
'news_id' : news.pk,
}
return render(request, 'news/news_update.html', context)
@@ -116,9 +116,10 @@ class NewsDeleteView(LoginRequiredMixin, DeleteView):
@login_required
def NewsSingle(request, pk):
- news = News.objects.get(pk=pk)
+ news = News.objects.get(pk=pk, agency=request.user.profile.agency)
context = {
- 'active_link':'newsmanagement',
+ 'active_link':'dashboard',
'news' : news
- }
+ }
+
return render(request, 'news/news_single.html', context)
\ No newline at end of file
diff --git a/orga/__pycache__/views.cpython-38.pyc b/orga/__pycache__/views.cpython-38.pyc
index 81e7621..d4b4c39 100644
Binary files a/orga/__pycache__/views.cpython-38.pyc and b/orga/__pycache__/views.cpython-38.pyc differ
diff --git a/orga/templates/orga/orga_main.html b/orga/templates/orga/orga_main.html
index f522382..f54d321 100644
--- a/orga/templates/orga/orga_main.html
+++ b/orga/templates/orga/orga_main.html
@@ -50,6 +50,7 @@ for(i = 0; i < data.length; i++){
//Creates nested array from data
function unflatten(arr) {
+ console.log(arr);
var tree = [],
mappedArr = {},
arrElem,
@@ -78,7 +79,7 @@ function unflatten(arr) {
return tree;
}
-var html = [''];
+var html = [''];
//Create UL-LI-List for tree
function createList(arr) {
diff --git a/orga/templates/orga/orga_main_ALT.html b/orga/templates/orga/orga_main_ALT.html
deleted file mode 100644
index 6120fc5..0000000
--- a/orga/templates/orga/orga_main_ALT.html
+++ /dev/null
@@ -1,153 +0,0 @@
-{% extends "users/base.html" %}
-{% block content %}
-
-
-
-
{{request.user.profile.agency.name}}
-
-
Organigramm
-
-
-
-
-{% endblock content %}
\ No newline at end of file
diff --git a/orga/views.py b/orga/views.py
index 06f201c..69352e8 100644
--- a/orga/views.py
+++ b/orga/views.py
@@ -17,9 +17,12 @@ def mainorga(request):
# Check, if parented users are invisible. Remove them and give user an info!
for ele in nonvisibleuser:
for vis in agencyuser:
- if vis.profile.parent.profile.pk == ele.pk:
- agencyuser.remove(vis)
- invisible_users += 1
+ try:
+ if vis.profile.parent.profile.pk == ele.pk:
+ agencyuser.remove(vis)
+ invisible_users += 1
+ except:
+ pass
context = {
'active_link' : 'orga',
@@ -32,7 +35,7 @@ def mainorga(request):
@login_required
def singleorga(request, pk):
- user = User.objects.get(pk=pk)
+ user = User.objects.get(pk=pk, profile__agency=request.user.profile.agency)
'''
VON GROß NACH KLEIN - SINNLOS
prios = Prio.objects.filter(user__pk=pk).order_by('-prio')[::-1]
@@ -64,7 +67,7 @@ def singleorga(request, pk):
'user_id' : user_id,
'prios' : prios,
'mail' : user.email,
- 'userfunc' : user.profile.get_func_display,
+ 'userfunc' : "CHANGE",
'imageurl' : user.profile.get_photo_url,
'compfunc' : user.profile.compfunc,
'phoneland' : user.profile.phoneland,
diff --git a/quicklinks/__pycache__/urls.cpython-38.pyc b/quicklinks/__pycache__/urls.cpython-38.pyc
index 5a2f4d8..89da134 100644
Binary files a/quicklinks/__pycache__/urls.cpython-38.pyc and b/quicklinks/__pycache__/urls.cpython-38.pyc differ
diff --git a/quicklinks/__pycache__/views.cpython-38.pyc b/quicklinks/__pycache__/views.cpython-38.pyc
index f99d89d..cc462e6 100644
Binary files a/quicklinks/__pycache__/views.cpython-38.pyc and b/quicklinks/__pycache__/views.cpython-38.pyc differ
diff --git a/quicklinks/templates/quicklinks/ql_add.html b/quicklinks/templates/quicklinks/ql_add.html
index ec325ca..e5caa0d 100644
--- a/quicklinks/templates/quicklinks/ql_add.html
+++ b/quicklinks/templates/quicklinks/ql_add.html
@@ -1,6 +1,7 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
+{% if request.user.profile.agency.module_quicklinks %}
Quicklink anlegen
@@ -13,4 +14,7 @@
Abbrechen
+{% else %}
+Das Modul Quicklinks wurden in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
diff --git a/quicklinks/templates/quicklinks/ql_confirm_delete.html b/quicklinks/templates/quicklinks/ql_confirm_delete.html
index 3501d6d..cda46f5 100644
--- a/quicklinks/templates/quicklinks/ql_confirm_delete.html
+++ b/quicklinks/templates/quicklinks/ql_confirm_delete.html
@@ -1,6 +1,7 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
+{% if request.user.profile.agency.module_quicklinks %}
+{% else %}
+
Das Modul Quicklinks wurden in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
\ No newline at end of file
diff --git a/quicklinks/templates/quicklinks/ql_management.html b/quicklinks/templates/quicklinks/ql_management.html
index 9437c1f..e23b351 100644
--- a/quicklinks/templates/quicklinks/ql_management.html
+++ b/quicklinks/templates/quicklinks/ql_management.html
@@ -1,15 +1,14 @@
{% extends "users/base.html" %}
+{% load counter_tag %}
{% block content %}
+{% if request.user.profile.agency.module_quicklinks %}
-
Quicklinks
+
Quicklinks
-
- Quicklinks helfen zur schnellen Verlinkung von oft genutzten Diensten.
-
- {% if perms.users.ql_management %}
+ {% if user|usergperm:"modulequicklinks" %}
{% endif %}
@@ -86,4 +85,7 @@ function saveDefQL(){
});
}
+{% else %}
+
Das Modul Quicklinks wurden in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
diff --git a/quicklinks/templates/quicklinks/ql_update.html b/quicklinks/templates/quicklinks/ql_update.html
index 5608ca4..7188b02 100644
--- a/quicklinks/templates/quicklinks/ql_update.html
+++ b/quicklinks/templates/quicklinks/ql_update.html
@@ -1,6 +1,7 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
{% block content %}
+{% if request.user.profile.agency.module_quicklinks %}
Quicklink aktualisieren
@@ -15,4 +16,7 @@
Abbrechen
+{% else %}
+
Das Modul Quicklinks wurden in ihrer Agentur deaktiviert.
+{% endif %}
{% endblock content %}
diff --git a/quicklinks/urls.py b/quicklinks/urls.py
index 6a0ffa1..2b140a4 100644
--- a/quicklinks/urls.py
+++ b/quicklinks/urls.py
@@ -6,11 +6,10 @@ from . import views
'''
Permissions definiert in models.py bei USERS und dann hier vor die View geschrieben!
'''
-
urlpatterns = [
path('', QlManagement.as_view(template_name="quicklinks/ql_management.html"), name='ql-management'),
- path('addql/', permission_required('users.ql_management')(QlAdd.as_view(template_name="quicklinks/ql_add.html")), name='ql-addql'),
- path('addql/
/delete', permission_required('users.ql_management')(QlDeleteView.as_view()), name='ql-delete'),
- path('addql//', permission_required('users.ql_management')(QlUpdateView.as_view()), name='ql-update'),
+ path('addql/', permission_required('users.modulequicklinks')(QlAdd.as_view(template_name="quicklinks/ql_add.html")), name='ql-addql'),
+ path('addql//delete', permission_required('users.modulequicklinks')(QlDeleteView.as_view()), name='ql-delete'),
+ path('addql//', permission_required('users.modulequicklinks')(QlUpdateView.as_view()), name='ql-update'),
path('lerg/', views.loaddefaultql, name="ql-ajaxloaddef"),
]
diff --git a/quicklinks/views.py b/quicklinks/views.py
index 8b6de6b..a2bd21f 100644
--- a/quicklinks/views.py
+++ b/quicklinks/views.py
@@ -5,12 +5,12 @@ from .models import QuickLinks
from .forms import QlAddQlForm
from django.contrib import messages
from django.shortcuts import redirect
-from django.http import HttpResponse
+from django.http import HttpResponse, HttpResponseRedirect
+from django.contrib.auth.decorators import login_required
# Create your views here.
class QlManagement(LoginRequiredMixin, ListView):
model = QuickLinks
-
# Adding active_link
# Loading only user same agency
# Change context and return for template-data
@@ -68,6 +68,7 @@ class QlUpdateView(LoginRequiredMixin, UpdateView):
context['active_link'] = 'quicklinks'
return context
+@login_required
def loaddefaultql(request):
if request.method == 'GET':
if request.GET['action'] == 'adddefql':
diff --git a/standards/__pycache__/forms.cpython-38.pyc b/standards/__pycache__/forms.cpython-38.pyc
index f5b1160..a91b5bb 100644
Binary files a/standards/__pycache__/forms.cpython-38.pyc and b/standards/__pycache__/forms.cpython-38.pyc differ
diff --git a/standards/__pycache__/models.cpython-38.pyc b/standards/__pycache__/models.cpython-38.pyc
index 6a49b2a..6e67bcb 100644
Binary files a/standards/__pycache__/models.cpython-38.pyc and b/standards/__pycache__/models.cpython-38.pyc differ
diff --git a/standards/__pycache__/urls.cpython-38.pyc b/standards/__pycache__/urls.cpython-38.pyc
index 29e42d3..ca04469 100644
Binary files a/standards/__pycache__/urls.cpython-38.pyc and b/standards/__pycache__/urls.cpython-38.pyc differ
diff --git a/standards/__pycache__/views.cpython-38.pyc b/standards/__pycache__/views.cpython-38.pyc
index 504f2af..2fee452 100644
Binary files a/standards/__pycache__/views.cpython-38.pyc and b/standards/__pycache__/views.cpython-38.pyc differ
diff --git a/standards/forms.py b/standards/forms.py
index affe678..0d826c2 100644
--- a/standards/forms.py
+++ b/standards/forms.py
@@ -3,6 +3,8 @@ from django.forms import ModelForm
from .models import Standards
from areas.models import Areas
from tasks.models import Tasks
+from django.contrib.auth.models import User
+from users.models import Profile, UserFullName
from django_summernote.widgets import SummernoteInplaceWidget
@@ -12,16 +14,19 @@ class StandardAddStandard(forms.ModelForm):
class Meta:
model =Standards
widgets = {
- 'content': SummernoteInplaceWidget(),
+ 'content': SummernoteInplaceWidget()
}
labels = {
"name" : "Titel",
"area" : "Übergeordneter Bereich",
"task" : "Aufgabenbereich",
"content": "Inhalt",
- "public" : "Direkt veröffentlichen?"
+ "public" : "Direkt veröffentlichen?",
+ "representative" : "Vertreter",
+ "executor" : "Ausführender",
+ "authority" : "Verantwortlicher",
}
- fields = ['name', 'area', 'task', 'content', 'public']
+ fields = ['name', 'area', 'task', 'content', 'public', "authority", "executor", "representative"]
'''
Hier werden die Elemente für die DropDowns erstellt, damit
@@ -45,6 +50,13 @@ class StandardAddStandard(forms.ModelForm):
elif self.instance.pk:
self.fields['task'].queryset = Tasks.objects.none()
+ self.fields['representative'].queryset = UserFullName.objects.filter(profile__agency__pk=kwargs['instance'].profile.agency.pk)
+ self.fields['executor'].queryset = UserFullName.objects.filter(profile__agency__pk=kwargs['instance'].profile.agency.pk)
+ self.fields['authority'].queryset = UserFullName.objects.filter(profile__agency__pk=kwargs['instance'].profile.agency.pk)
+
+ self.fields['checked_groups'] = 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())
class StandardAddStandardEditor(forms.ModelForm):
@@ -70,9 +82,12 @@ class StandardUpdateStandard(forms.ModelForm):
"name" : "Titel",
"area" : "Übergeordneter Bereich",
"task" : "Aufgabenbereich",
- "content": "Inhalt"
+ "content": "Inhalt",
+ "representative" : "Vertreter",
+ "executor" : "Ausführender",
+ "authority" : "Verantwortlicher",
}
- fields = ['name', 'area', 'task', 'content']
+ fields = ['name', 'area', 'task', 'content', "authority", "executor", "representative"]
'''
Hier werden die Elemente für die DropDowns erstellt, damit
@@ -99,6 +114,9 @@ class StandardUpdateStandard(forms.ModelForm):
elif loggeduser.pk:
self.fields['task'].queryset = Tasks.objects.filter(area__pk=standard.area.pk)
+ self.fields['representative'].queryset = UserFullName.objects.filter(profile__agency__pk=loggeduser.profile.agency.pk)
+ self.fields['executor'].queryset = UserFullName.objects.filter(profile__agency__pk=loggeduser.profile.agency.pk)
+ self.fields['authority'].queryset = UserFullName.objects.filter(profile__agency__pk=loggeduser.profile.agency.pk)
class StandardUpdateStandardEditor(forms.ModelForm):
diff --git a/standards/models.py b/standards/models.py
index 1284a6b..5fff059 100644
--- a/standards/models.py
+++ b/standards/models.py
@@ -4,6 +4,8 @@ from users.models import Agency
from django.urls import reverse
from areas.models import Areas
from tasks.models import Tasks
+from cloud.models import DataFile
+from users.models import AgencyGroup
import datetime
from django.utils import timezone
#from ckeditor_uploader.fields import RichTextUploadingField
@@ -13,11 +15,9 @@ class Standards(models.Model):
agency = models.ForeignKey(Agency, on_delete=models.CASCADE)
area = models.ForeignKey(Areas, on_delete=models.CASCADE)
task = models.ForeignKey(Tasks, on_delete=models.CASCADE)
- name = models.CharField(max_length=200, blank=False, default="")
- #content = RichTextUploadingField(blank=True, verbose_name='Inhalt')
+ name = models.CharField(max_length=200, blank=False, default="")
content = models.TextField(blank=True, verbose_name='Inhalt', default="")
- #content = models.CharField(max_length=200000, blank=True, verbose_name='Inhalt')
-
+
created_standard_by = models.ForeignKey(User, on_delete=models.PROTECT)
created_standard_date = models.DateTimeField(default=timezone.now, blank=True)
@@ -29,6 +29,21 @@ class Standards(models.Model):
public = models.BooleanField(default=False)
+
+ # USER
+ # VERTRETER
+ representative = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_repr", blank=True, null=True)
+ # AUSFÜHRENDER
+ executor = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_executor", blank=True, null=True)
+ # VERANTWORTLICHER
+ authority = models.ForeignKey(User, on_delete=models.PROTECT, related_name="user_authority", blank=True, null=True)
+ # FILES
+ addedfiles = models.ManyToManyField(DataFile, blank=True)
+ # VERLINKTE STANDARDS
+ linked_standards = models.ManyToManyField('Standards', blank=True)
+ # GORUPS
+ visibleby = models.ManyToManyField(AgencyGroup, blank=True)
+
def __str__(self):
return f'{self.name}'
diff --git a/standards/templates/standards/standards_add.html b/standards/templates/standards/standards_add.html
index 908c4fa..cd3d9b6 100644
--- a/standards/templates/standards/standards_add.html
+++ b/standards/templates/standards/standards_add.html
@@ -1,19 +1,307 @@
{% extends "users/base.html" %}
{% load crispy_forms_tags %}
+{% load counter_tag %}
{% block content %}
-
-
Neuen Standard anlegen
+
+
Neuen Standard anlegen
-
+
+
+
+
+
+
+
+
+ Diesen Dateitypen dürfen Sie nicht hochladen.
+
+
+
+
+
+
+
+
+
+
+
+
+ Diesen Dateitypen dürfen Sie nicht hochladen.
+
+
+
+
+
+
+
+ {% if request.user_agent.browser.family == "IE" %}
+
+
+ {% else %}
+
+
+ {% endif %}
+
@@ -35,8 +44,8 @@
-
-
+
@@ -44,18 +53,18 @@
-
-
+
-