diff --git a/dasettings/__pycache__/views.cpython-38.pyc b/dasettings/__pycache__/views.cpython-38.pyc index f4b5dd8..dcb87ca 100644 Binary files a/dasettings/__pycache__/views.cpython-38.pyc and b/dasettings/__pycache__/views.cpython-38.pyc differ diff --git a/dasettings/templates/dasettings/user_usprof.html b/dasettings/templates/dasettings/user_usprof.html index 294e25c..d35929b 100644 --- a/dasettings/templates/dasettings/user_usprof.html +++ b/dasettings/templates/dasettings/user_usprof.html @@ -51,7 +51,7 @@
-
+
Name

{{ user_fullname }} @@ -60,7 +60,10 @@

{{ mail }}

+
Stammdaten ändern +    +
@@ -218,6 +221,23 @@ function removeUserFromGroup(userid, groupid){ }); } +//Call Function in view to send e-mail with pass-reset-data + function sendPassMail(id){ + $.ajax( + { + type: "GET", + url: "/dashboard/sendpassmail", + data:{ + userid : id + }, + success: function( data ) + { + if(data["message"] == 0){ + $("#mailsend").fadeIn().delay(4000).fadeOut(); + } + } + }); + } function addUserToGroup(userid, groupid){ $.ajax( diff --git a/dasettings/views.py b/dasettings/views.py index 02ffe3f..b9bcb4a 100644 --- a/dasettings/views.py +++ b/dasettings/views.py @@ -10,6 +10,7 @@ from users.models import AgencyJob, AgencyGroup from django.contrib.auth.models import User, Group, Permission import random import string +from django.template.loader import render_to_string from users.usersforms import UsersPermForm from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import CreateView @@ -19,6 +20,7 @@ from tasks.models import Tasks import webcolors from datetime import datetime from standards.models import Standards +from django.core.mail import send_mail def randomString(stringLength=10): """Generate a random string of fixed length """ @@ -523,7 +525,8 @@ def NewUserFirstStep(request): if request.method == 'POST': newuserform = UserNewUserForm(request.POST) if newuserform.is_valid(): - if(request.POST.get("sendmailnewuser")): + if(request.POST.get("sendmailnewuser")): + msg_html = render_to_string('users/register_mail.html', {'username': newuserform.cleaned_data.get('first_name') + " " + newuserform.cleaned_data.get('last_name')}) send_mail( request.user.profile.agency.name + ' Account', 'Hallo ' + newuserform.cleaned_data.get('first_name') + ' ' + newuserform.cleaned_data.get('last_name') + '! Bitte setzen sie sich auf https://digitale-agentur.com/password-reset/ ein Passwort.', diff --git a/news/templates/news/news_addnews.html b/news/templates/news/news_addnews.html index 4e69de0..96eb55e 100644 --- a/news/templates/news/news_addnews.html +++ b/news/templates/news/news_addnews.html @@ -1,13 +1,18 @@ {% extends "users/base.html" %} {% load crispy_forms_tags %} +{% load static %} {% block content %} {% if request.user.profile.agency.module_news %}
+ +

News anlegen


{% csrf_token %} {{normalForm.media}} + + {{normalForm|crispy}}
  diff --git a/standards/__pycache__/forms.cpython-38.pyc b/standards/__pycache__/forms.cpython-38.pyc index a786155..72fba67 100644 Binary files a/standards/__pycache__/forms.cpython-38.pyc and b/standards/__pycache__/forms.cpython-38.pyc differ diff --git a/standards/__pycache__/views.cpython-38.pyc b/standards/__pycache__/views.cpython-38.pyc index 6ba1f57..5f92789 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 0d826c2..4b354f1 100644 --- a/standards/forms.py +++ b/standards/forms.py @@ -19,7 +19,7 @@ class StandardAddStandard(forms.ModelForm): labels = { "name" : "Titel", "area" : "Übergeordneter Bereich", - "task" : "Aufgabenbereich", + "task" : "Tätigkeitsbereich", "content": "Inhalt", "public" : "Direkt veröffentlichen?", "representative" : "Vertreter", @@ -81,7 +81,7 @@ class StandardUpdateStandard(forms.ModelForm): labels = { "name" : "Titel", "area" : "Übergeordneter Bereich", - "task" : "Aufgabenbereich", + "task" : "Tätigkeitsbereich", "content": "Inhalt", "representative" : "Vertreter", "executor" : "Ausführender", diff --git a/standards/templates/standards/standards_single.html b/standards/templates/standards/standards_single.html index e97f652..b127ac2 100644 --- a/standards/templates/standards/standards_single.html +++ b/standards/templates/standards/standards_single.html @@ -102,8 +102,5 @@ {% endif %}
- {% for g in standard.visibleby.all %} - {{g.agencygroupname}} - {% endfor %} {% endblock content %} \ No newline at end of file diff --git a/standards/views.py b/standards/views.py index cc92fa5..d69e4e6 100644 --- a/standards/views.py +++ b/standards/views.py @@ -23,7 +23,7 @@ class StandardsManagement(LoginRequiredMixin, ListView): def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) # # Get all Users of the Same Agency as logged user - areas = Areas.objects.filter(agency__pk=self.request.user.profile.agency.pk) + areas = Areas.objects.filter(agency__pk=self.request.user.profile.agency.pk).order_by("areaorder") standards_of_user = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, created_standard_by=self.request.user.pk) standards_of_agency = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, public=True) unpubstandards_of_user = Standards.objects.filter(agency__pk=self.request.user.profile.agency.pk, public=False) @@ -100,20 +100,36 @@ def StandardAdd(request): # GROUPS new_standard.save() + + ''' + + HIER WEITER MACHEN: Gruppen, Dateien und Files werden nicht gespeichert, Länge des übergebenen + Arrays ist komisch, da Strings ankommen und es umgebaut werden muss. Wenn das Array aber LEER + ist, gibt es '' zurück und das ist komisch... + + + ''' + # ADD GROUPS groups = normalForm.cleaned_data['checked_groups'].split(",") + + for g in groups: - new_standard.visibleby.add(AgencyGroup.objects.get(pk=g)) + if(g.isdigit()): + new_standard.visibleby.add(AgencyGroup.objects.get(pk=g)) # ADD STANDARDS standards = normalForm.cleaned_data['added_standards'].split(",") for s in standards: - new_standard.linked_standards.add(Standards.objects.get(pk=s)) + if(s.isdigit()): + new_standard.linked_standards.add(Standards.objects.get(pk=s)) # ADD FILES files = normalForm.cleaned_data['added_files'].split(",") + for f in files: - new_standard.addedfiles.add(DataFile.objects.get(pk=f)) + if(f.isdigit()): + new_standard.addedfiles.add(DataFile.objects.get(pk=f)) tempstandardname = normalForm.cleaned_data['name'] if(new_standard.public and request.user.has_perm('users.standardmanager')): diff --git a/users/static/users/css/datepicker.css b/users/static/users/css/datepicker.css new file mode 100644 index 0000000..892816c --- /dev/null +++ b/users/static/users/css/datepicker.css @@ -0,0 +1,121 @@ +@font-face { + font-family: 'Glyphicons Halflings'; + src: url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot'); + src: url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), + url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff2') format('woff2'), + url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.woff') format('woff'), + url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.ttf') format('truetype'), + url('//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); +} + +.glyphicon { + position: relative; + top: 1px; + display: inline-block; + font-family: 'Glyphicons Halflings'; + font-style: normal; + font-weight: normal; + line-height: 1; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.glyphicon-time:before { + content: "\e023"; +} + +.glyphicon-chevron-left:before { + content: "\e079"; +} + +.glyphicon-chevron-right:before { + content: "\e080"; +} + +.glyphicon-chevron-up:before { + content: "\e113"; +} + +.glyphicon-chevron-down:before { + content: "\e114"; +} + +.glyphicon-calendar:before { + content: "\e109"; +} + +.glyphicon-screenshot:before { + content: "\e087"; +} + +.glyphicon-trash:before { + content: "\e020"; +} + +.glyphicon-remove:before { + content: "\e014"; +} + +.bootstrap-datetimepicker-widget .btn { + display: inline-block; + padding: 6px 12px; + margin-bottom: 0; + font-size: 14px; + font-weight: normal; + line-height: 1.42857143; + text-align: center; + white-space: nowrap; + vertical-align: middle; + -ms-touch-action: manipulation; + touch-action: manipulation; + cursor: pointer; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; +} + +.bootstrap-datetimepicker-widget.dropdown-menu { + position: absolute; + left: 0; + z-index: 1000; + display: none; + float: left; + min-width: 160px; + padding: 5px 0; + margin: 2px 0 0; + font-size: 14px; + text-align: left; + list-style: none; + background-color: #fff; + -webkit-background-clip: padding-box; + background-clip: padding-box; + border: 1px solid #ccc; + border: 1px solid rgba(0, 0, 0, .15); + border-radius: 4px; + -webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, .175); + box-shadow: 0 6px 12px rgba(0, 0, 0, .175); +} + +.bootstrap-datetimepicker-widget .list-unstyled { + padding-left: 0; + list-style: none; +} + +.bootstrap-datetimepicker-widget .collapse { + display: none; +} + +.bootstrap-datetimepicker-widget .collapse.in { + display: block; +} + +/* fix for bootstrap4 */ +.bootstrap-datetimepicker-widget .table-condensed > thead > tr > th, +.bootstrap-datetimepicker-widget .table-condensed > tbody > tr > td, +.bootstrap-datetimepicker-widget .table-condensed > tfoot > tr > td { + padding: 5px; +} \ No newline at end of file diff --git a/users/static/users/js/datepicker.js b/users/static/users/js/datepicker.js new file mode 100644 index 0000000..5aec7a9 --- /dev/null +++ b/users/static/users/js/datepicker.js @@ -0,0 +1,55 @@ +jQuery(function ($) { + var datepickerDict = {}; + var isBootstrap4 = $.fn.collapse.Constructor.VERSION.split('.').shift() == "4"; + function fixMonthEndDate(e, picker) { + e.date && picker.val().length && picker.val(e.date.endOf('month').format('YYYY-MM-DD')); + } + $("[dp_config]:not([disabled])").each(function (i, element) { + var $element = $(element), data = {}; + try { + data = JSON.parse($element.attr('dp_config')); + } + catch (x) { } + if (data.id && data.options) { + data.$element = $element.datetimepicker(data.options); + data.datepickerdata = $element.data("DateTimePicker"); + datepickerDict[data.id] = data; + data.$element.next('.input-group-addon').on('click', function(){ + data.datepickerdata.show(); + }); + if(isBootstrap4){ + data.$element.on("dp.show", function (e) { + $('.collapse.in').addClass('show'); + }); + } + } + }); + $.each(datepickerDict, function (id, to_picker) { + if (to_picker.linked_to) { + var from_picker = datepickerDict[to_picker.linked_to]; + from_picker.datepickerdata.maxDate(to_picker.datepickerdata.date() || false); + to_picker.datepickerdata.minDate(from_picker.datepickerdata.date() || false); + from_picker.$element.on("dp.change", function (e) { + to_picker.datepickerdata.minDate(e.date || false); + }); + to_picker.$element.on("dp.change", function (e) { + if (to_picker.picker_type == 'MONTH') fixMonthEndDate(e, to_picker.$element); + from_picker.datepickerdata.maxDate(e.date || false); + }); + if (to_picker.picker_type == 'MONTH') { + to_picker.$element.on("dp.hide", function (e) { + fixMonthEndDate(e, to_picker.$element); + }); + fixMonthEndDate({ date: to_picker.datepickerdata.date() }, to_picker.$element); + } + } + }); + if(isBootstrap4) { + $('body').on('show.bs.collapse','.bootstrap-datetimepicker-widget .collapse',function(e){ + $(e.target).addClass('in'); + }); + $('body').on('hidden.bs.collapse','.bootstrap-datetimepicker-widget .collapse',function(e){ + $(e.target).removeClass('in'); + }); + } +}); \ No newline at end of file