Zwischecom 0.8.2
This commit is contained in:
parent
3c7ec09ee7
commit
06315cc953
|
|
@ -24,14 +24,14 @@ a.disabled {
|
|||
</div>
|
||||
</div>
|
||||
<div class="content-section col-12">
|
||||
<h3>Dateien <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Dateien und Ordner für ihre Agentur verwalten." class="far fa-question-circle"></i></small></h3>
|
||||
<h3>Dateien{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Dateien und Ordner für ihre Agentur verwalten." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="content-section col-12">
|
||||
|
||||
<div class="progress mb-2" style="height: 15px;">
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{{percent_quota}}" style="width: {{percent_quota}}%;" aria-valuemin="0" aria-valuemax="100"><b style="color: #000000; padding-left: 5px">Aktuelle Quota: {{actquota}} / 2 GB</b></div>
|
||||
<div class="progress-bar" role="progressbar" aria-valuenow="{{percent_quota}}" style="width: {{percent_quota}}%;" aria-valuemin="0" aria-valuemax="100"><b style="color: #000000; padding-left: 5px">Belegter Speicherplatz: {{actquota}} / 2 GB</b></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ a.disabled {
|
|||
<td>
|
||||
<i class="fas fa-file" ></i>
|
||||
</td>
|
||||
<td><a href="{{file.file.url}}" download>{{file.name}}</a></td>
|
||||
<td><a href="{% url 'cloud-td' file.pk %}" target="_blank">{{file.name}}</a></td>
|
||||
<td>{{file.owner.first_name}} {{file.owner.last_name}}</td>
|
||||
<td>{{file.date_created|date:"d.m.Y G:i"}}</td>
|
||||
<td>{{file.date_last_modified|date:"d.m.Y G:i"}}</td>
|
||||
|
|
@ -227,6 +227,26 @@ a.disabled {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- QUTOA ERROR -->
|
||||
<div class="modal fade" id="quotaerr" 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">Quota wird überschritten</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Ihr Speicherplatz ist aufgebraucht.
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">Schließen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CONFIRMA DELETE FILE -->
|
||||
<div class="modal fade" id="delDataFile" tabindex="-1" role="dialog" data-backdrop="static" aria-labelledby="groupDelFunction" aria-hidden="true">
|
||||
<div class="modal-dialog " role="document">
|
||||
|
|
@ -338,7 +358,27 @@ a.disabled {
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<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">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<i class="fas fa-spinner fa-spin"></i> Datei wird hochgeladen...
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
var actquotasize = {{actquota}};
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="popover"]').popover();
|
||||
$(".toast").toast({
|
||||
|
|
@ -526,7 +566,7 @@ $('.droppable_div').on('dragleave', function (e) {
|
|||
$("#{{parentid}}_div").removeClass('bg-secondary');
|
||||
});
|
||||
|
||||
allowedtypes = "application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*, image/x-png, image/gif, image/jpg, image/jpeg, image/JPEG, image/JPG"
|
||||
allowedtypes = "application/msword, application/vnd.ms-excel, application/vnd.ms-powerpoint, text/plain, application/pdf, image/*, image/x-png, image/gif, image/jpg, image/jpeg, image/JPEG, image/JPG, docx, JPEG, JPG, doc, odt, ODT, application/vnd.openxmlformats-officedocument.wordprocessingml.document"
|
||||
|
||||
|
||||
function uploadAction(filetodo, parid){
|
||||
|
|
@ -535,34 +575,46 @@ function uploadAction(filetodo, parid){
|
|||
formData.append("uploadsource", "cloud");
|
||||
var bar = $('.bar');
|
||||
var percent = $('.percent');
|
||||
if(allowedtypes.includes(filetodo.type) && filetodo.type.length > 0){
|
||||
$.ajax({
|
||||
url: "{% url 'cloud-adddir' %}" + parid,
|
||||
headers: {
|
||||
"X-CSRFTOKEN": "{{ csrf_token }}"
|
||||
},
|
||||
data: formData,
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function(){
|
||||
$("#uploadModalProgress").modal("toggle");
|
||||
},
|
||||
uploadProgress: function(event, position, total, percentComplete){
|
||||
var percentVal = percentComplete + '%';
|
||||
|
||||
},
|
||||
success: function(data) {
|
||||
if(data["success"] == true){
|
||||
window.location = window.location;
|
||||
console.log(filetodo.type);
|
||||
if(allowedtypes.indexOf(filetodo.type) != -1 && filetodo.type.length > 0){
|
||||
|
||||
|
||||
//CHECK QUOTA
|
||||
calculate_quota = filetodo.size / (1024* 1024*1024) + actquotasize
|
||||
console.log(calculate_quota);
|
||||
if(calculate_quota > 2){
|
||||
setTimeout(function(){$("#uploadModalProgress").modal("toggle");}, 1000);
|
||||
$('#uploadModalProgress').on('hidden.bs.modal', function (e) {
|
||||
$("#quotaerr").modal("toggle");
|
||||
})
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
url: "{% url 'cloud-adddir' %}" + parid,
|
||||
headers: {
|
||||
"X-CSRFTOKEN": "{{ csrf_token }}"
|
||||
},
|
||||
data: formData,
|
||||
type: 'POST',
|
||||
cache: false,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
beforeSend: function(){
|
||||
$("#uploadModalProgress").modal("toggle");
|
||||
},
|
||||
success: function(data) {
|
||||
if(data["success"] == true){
|
||||
setTimeout(function(){window.location = window.location;}, 1000);
|
||||
}
|
||||
else{
|
||||
setTimeout(function(){$("#uploadModalProgress").modal("toggle");}, 1000);
|
||||
$('#uploadModalProgress').on('hidden.bs.modal', function (e) {
|
||||
$("#forbiddenFileType").modal("toggle");
|
||||
})
|
||||
}
|
||||
}
|
||||
else{
|
||||
$("#forbiddenFileType").modal("toggle")
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
else{
|
||||
$("#forbiddenFileType").modal("toggle")
|
||||
|
|
|
|||
|
|
@ -6,4 +6,5 @@ urlpatterns = [
|
|||
path('<slug:pk>', CloudMain, name='cloud-main'),
|
||||
path('clajax/', views.adddirbyajax, name="cloud-adddir"),
|
||||
path('clajax/<slug:parent>', views.adddirbyajax, name="cloud-adddir"),
|
||||
path('trydown/<int:pk>', views.trydownloadfile, name="cloud-td"),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ from .models import DataDir, DataFile
|
|||
from datetime import datetime
|
||||
from users.models import AgencyGroup
|
||||
from django.conf import settings
|
||||
|
||||
from django.http import FileResponse
|
||||
|
||||
'''
|
||||
|
||||
|
|
@ -64,7 +64,7 @@ def folder_size(path='.'):
|
|||
elif entry.is_dir():
|
||||
total += folder_size(entry.path)
|
||||
|
||||
total_gb = round(total/1024.0**3, 4)
|
||||
total_gb = round(total/1024.0**3, 3)
|
||||
return total_gb
|
||||
|
||||
@login_required
|
||||
|
|
@ -87,7 +87,7 @@ def CloudMain(request, pk):
|
|||
'files' : DataFile.objects.filter(parent=diragency, agency=request.user.profile.agency).order_by("name"),
|
||||
'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"),
|
||||
"rootid" : rootid,
|
||||
"actquota" : folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files"),
|
||||
"actquota" : str(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")),
|
||||
"percent_quota" : int(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")/(2/100))
|
||||
}
|
||||
else:
|
||||
|
|
@ -113,7 +113,7 @@ def CloudMain(request, pk):
|
|||
'files' : DataFile.objects.filter(parent=vieweddir, agency=request.user.profile.agency).order_by("name"),
|
||||
'agencygroups' : AgencyGroup.objects.filter(agency=request.user.profile.agency).order_by("agencygroupname"),
|
||||
"rootid" : rootid,
|
||||
"actquota" : folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files"),
|
||||
"actquota" : str(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")),
|
||||
"percent_quota" : int(folder_size(BASE_DIR + "/media/agencydata/agency_"+str(request.user.profile.agency.pk)+"/files")/(2/100))
|
||||
}
|
||||
else:
|
||||
|
|
@ -202,7 +202,6 @@ def adddirbyajax(request, parent):
|
|||
uploadsource = request.POST["uploadsource"]
|
||||
# VALIDATE FILE-TYPE
|
||||
file_ext = request.FILES['uploadedfile'].name.split(".")[1]
|
||||
|
||||
allowed_types = ["txt", "TXT", "png", "PNG", "jpeg", "JPEG", "jpg", "JPG", "PDF", "pdf", "csv", "CSV", "DOC", "doc", "DOCX", "docx", "ODT", "odt", "PPT", "ppt", "PPTX", "pptx"]
|
||||
file_ok = False
|
||||
for t in allowed_types:
|
||||
|
|
@ -252,4 +251,28 @@ def getsubdirs(request, dirid):
|
|||
subdirs.append({"id" : subdir.pk, "parent" : actid, "name" : subdir.name, 'subdirs' : getsubdirs(request, subdir)})
|
||||
else:
|
||||
subdirs.append({"id" : subdir.pk, "parent" : actid, "name" : subdir.name, 'subdirs' : []})
|
||||
return subdirs
|
||||
return subdirs
|
||||
|
||||
'''
|
||||
|
||||
Hier wird geprüft, ob die angeforderte Datei für diesesn Nutzer herunterladbar ist oder nicht. Leitet auf die
|
||||
Kein-Zugriff-Seite weiter ODER sendet die Datei. Der "echte" Datei-Link bleibt jederzeit auf dem Server :)
|
||||
|
||||
'''
|
||||
@login_required
|
||||
def trydownloadfile(request, pk):
|
||||
file = DataFile.objects.get(pk=pk)
|
||||
filetodownload = file.file.open()
|
||||
checkuserrights = checkUserDirRights(request, file.parent, request.user.id)
|
||||
if(checkuserrights):
|
||||
response = FileResponse(filetodownload)
|
||||
return response
|
||||
else:
|
||||
context = {
|
||||
'active_link' : 'cloud',
|
||||
}
|
||||
return render(request, 'cloud/noentrie.html', context)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
<div id="agroup_{{aggroup.pk}}_card" class="collapse" aria-labelledby="agroup_{{aggroup.pk}}" data-parent="#groupAccordion">
|
||||
<div class="card-body">
|
||||
<h5>Gruppenrechte <small><i data-toggle="tooltip" data-placement="top" title="Gruppenrechte beeinflussen die Möglichkeiten der Mitarbeiter in einer Gruppe, z.B. dürfen nur Mitarbeiter in einer Gruppe mit dem Recht News entsprechend News erstellen, veröffentlichen und bearbeiten." class="far fa-question-circle"></i></small></h5>
|
||||
<h5>Gruppenrechte{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Gruppenrechte beeinflussen die Möglichkeiten der Mitarbeiter in einer Gruppe, z.B. dürfen nur Mitarbeiter in einer Gruppe mit dem Recht News entsprechend News erstellen, veröffentlichen und bearbeiten." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<div class="row">
|
||||
<div class="col-4">
|
||||
{% for perm in perms %}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
$('input:checkbox').change(
|
||||
function(){
|
||||
ele = $(this).prop("name");
|
||||
if(!ele.includes("module")){
|
||||
if(ele.indexOf("module") == -1){
|
||||
new_stat = 0;
|
||||
if($(this).prop("checked")){
|
||||
new_stat = 1;
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@
|
|||
{
|
||||
if(data['success'])
|
||||
{
|
||||
$('#notchange_done').toast('show');
|
||||
/*$('#notchange_done').toast('show');
|
||||
$("#toast_savecontent").html("Tooltipseinstellung erfolgreich gespeichert!");
|
||||
|
||||
if(data['data']['newttvalue']){
|
||||
|
|
@ -102,7 +102,8 @@
|
|||
}
|
||||
else{
|
||||
$('*').tooltip("disable");
|
||||
}
|
||||
}*/
|
||||
location.href = location.href;
|
||||
}
|
||||
else{
|
||||
$('#notchange_err').toast('show');
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
</div>
|
||||
<div class="content-section col-12">
|
||||
|
||||
<h3>Einstellungen</i></b> <small><i data-toggle="tooltip" data-placement="top" title="Hier können Agenturweite Einstellungen (Mitarbeiter, Gruppen, Agenturinfos, Bereiche und Tätigkeiten, Abrechnung, Module usw.) verwaltet werden." class="far fa-question-circle"></i></small></h3>
|
||||
<h3>Einstellungen</i></b>{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier können Agenturweite Einstellungen (Mitarbeiter, Gruppen, Agenturinfos, Bereiche und Tätigkeiten, Abrechnung, Module usw.) verwaltet werden." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<hr>
|
||||
<ul class="nav nav-tabs" id="settingsTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
|
|
@ -76,14 +76,14 @@
|
|||
</ul>
|
||||
<div class="tab-content" id="settingsTabsContent">
|
||||
<div class="tab-pane fade show" id="profil" role="tabpanel" aria-labelledby="profil-tab">
|
||||
<h5 class="mt-3">Profileinstellungen <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Einstellungen an ihrem Profil vornehmen (E-Mail, Passwort und, ob die Tooltips angezeigt werden sollen). Alle anderen Einstellungen werden von Mitarbeitern mit entsprechenden Gruppenrechten verwaltet." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Profileinstellungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie Einstellungen an ihrem Profil vornehmen (E-Mail, Passwort und, ob die Tooltips angezeigt werden sollen). Alle anderen Einstellungen werden von Mitarbeitern mit entsprechenden Gruppenrechten verwaltet." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block profil_content %}
|
||||
{% include "dasettings/profil_content.html" %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
<div class="tab-pane fade" id="notifications" role="tabpanel" aria-labelledby="notifications-tab">
|
||||
<h5 class="mt-3">Benachrichtigungen <small><i data-toggle="tooltip" data-placement="top" title="Stellen Sie hier ein, welche Art der Benachrichtigung (E-Mail oder Push) Sie für welches Ereignis (Gruppenzuweisungen, Veröffentlichung eines Standards, neue Agenturnews usw.) erhalten möchten." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Benachrichtigungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Stellen Sie hier ein, welche Art der Benachrichtigung (E-Mail oder Push) Sie für welches Ereignis (Gruppenzuweisungen, Veröffentlichung eines Standards, neue Agenturnews usw.) erhalten möchten." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
|
||||
{% block notifications_content %}
|
||||
{% include "dasettings/notifications_content.html" %}
|
||||
|
|
@ -91,7 +91,7 @@
|
|||
</div>
|
||||
{% if user|usergperm:"agencyinfo" %}
|
||||
<div class="tab-pane fade" id="agency" role="tabpanel" aria-labelledby="agency-tab">
|
||||
<h5 class="mt-3">Agenturinformationen <small><i data-toggle="tooltip" data-placement="top" title="Verwalten Sie hier die Informationen Ihrer Agentur, z.B. Adresse, E-Mailadresse und Telefon." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Agenturinformationen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verwalten Sie hier die Informationen Ihrer Agentur, z.B. Adresse, E-Mailadresse und Telefon." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block agency_content %}
|
||||
{% include "dasettings/agency_content.html" %}
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
{% endif %}
|
||||
{% if user|usergperm:"agencyinfo" %}
|
||||
<div class="tab-pane fade" id="calc" role="tabpanel" aria-labelledby="calc-tab">
|
||||
<h5 class="mt-3">Abrechnung <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie die aktuellen Abrechnungsinfos einsehen." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Abrechnung{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier können Sie die aktuellen Abrechnungsinfos einsehen." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block calc_content %}
|
||||
{% include "dasettings/calc_content.html" %}
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
{% endif %}
|
||||
{% if user|usergperm:"structuremanager" %}
|
||||
<div class="tab-pane fade" id="structure" role="tabpanel" aria-labelledby="structure-tab">
|
||||
<h5 class="mt-3">Struktur <small><i data-toggle="tooltip" data-placement="top" title="Richten Sie hier Bereiche und Tätigkeiten ein, um diese in Standards und Organigramm als Agenturstruktur zu nutzen." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Struktur{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Richten Sie hier Bereiche und Tätigkeiten ein, um diese in Standards und Organigramm als Agenturstruktur zu nutzen." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block structure_content %}
|
||||
{% include "dasettings/structure_content.html" %}
|
||||
|
|
@ -118,7 +118,7 @@
|
|||
{% endif %}
|
||||
{% if user|usergperm:"usermanager" %}
|
||||
<div class="tab-pane fade" id="user" role="tabpanel" aria-labelledby="user-tab">
|
||||
<h5 class="mt-3">Mtarbeiter <small><i data-toggle="tooltip" data-placement="top" title="Legen Sie hier neue Mtarbeiter an, weisen ihnen Gruppen zu und ändern Sie Stammdaten wie Foto, Namen und Agenturfunktion." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Mtarbeiter{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Legen Sie hier neue Mtarbeiter an, weisen ihnen Gruppen zu und ändern Sie Stammdaten wie Foto, Namen und Agenturfunktion." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block user_content %}
|
||||
{% include "dasettings/user_content.html" %}
|
||||
|
|
@ -127,7 +127,7 @@
|
|||
{% endif %}
|
||||
{% if user|usergperm:"groupmanager" %}
|
||||
<div class="tab-pane fade" id="groups" role="tabpanel" aria-labelledby="groups-tab">
|
||||
<h5 class="mt-3">Gruppen <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Gruppen erstellt und bearbeitet sowie Mitglieder der Gruppen hinzugefügt und entfernt. Zudem können Rechte der Gruppen vergeben werden." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Gruppen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Gruppen erstellt und bearbeitet sowie Mitglieder der Gruppen hinzugefügt und entfernt. Zudem können Rechte der Gruppen vergeben werden." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<hr>
|
||||
{% block groups_content %}
|
||||
{% include "dasettings/groups_content.html" %}
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
{% endif %}
|
||||
{% if user|usergperm:"modulesconfig" %}
|
||||
<div class="tab-pane fade" id="moduls" role="tabpanel" aria-labelledby="moduls-tab">
|
||||
<h5 class="mt-3">Module <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Module aktiviert oder deaktiviert sowie individuelle Einstellungen der Module gemacht. Wird ein Modul deaktiviert, gehen Einstellungen und Dateien nicht verloren." class="far fa-question-circle"></i></small></h5>
|
||||
<h5 class="mt-3">Module{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier werden Module aktiviert oder deaktiviert sowie individuelle Einstellungen der Module gemacht. Wird ein Modul deaktiviert, gehen Einstellungen und Dateien nicht verloren." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
{% block moduls_content %}
|
||||
{% include "dasettings/moduls_content.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -15,6 +15,11 @@ import os
|
|||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
#BASE_URL = "https://digitale-agentur.com/"
|
||||
|
||||
BASE_URL = "http://localhost:8000/"
|
||||
CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D"
|
||||
|
||||
# FOR SUMMERNOTE ORIGIN
|
||||
X_FRAME_OPTIONS = 'SAMEORIGIN'
|
||||
|
||||
|
|
@ -169,7 +174,6 @@ MEDIA_URL = '/media/'
|
|||
GRAPPELLI_CLEAN_INPUT_TYPES = False
|
||||
|
||||
# EMAILs
|
||||
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
|
||||
'''
|
||||
EMAIL_HOST = 'smtp.strato.de'
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1,3 +1,20 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from users.models import Agency
|
||||
from django.urls import reverse
|
||||
from datetime import datetime, timedelta
|
||||
from django.utils import timezone
|
||||
|
||||
# Create your models here.
|
||||
class Message(models.Model):
|
||||
|
||||
agency = models.ForeignKey(Agency, on_delete=models.CASCADE)
|
||||
target_user = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
content = models.TextField(blank=True, verbose_name='Inhalt', default="")
|
||||
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name="createdbyuser")
|
||||
created_date = models.DateTimeField(default=timezone.now, blank=True)
|
||||
|
||||
|
||||
# Hier Path für Templates des Models mit Parametern
|
||||
def get_absolute_url(self):
|
||||
return reverse('message-single', kwargs={'pk':self.pk})
|
||||
|
|
@ -2,20 +2,140 @@
|
|||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_messages %}
|
||||
<div class="content-section col-6">
|
||||
<h3>Mitteilungen <small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small></h3>
|
||||
|
||||
<div class="content-section col-12">
|
||||
<h3>Mitteilungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<hr>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{form|crispy}}
|
||||
<p>Ihrer Mitteilung wird Automatisch eine Anrede und eine Verabscheidung hinzugefügt!</p>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success">Mitteilung verschicken</button>
|
||||
<a href="{% url 'users-dashboard' %}" class="btn btn-success">Abbrechen</a>
|
||||
|
||||
|
||||
|
||||
<ul class="nav nav-tabs" id="messTabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link active" id="send-tab" data-toggle="tab" href="#send" role="tab" aria-controls="send" aria-selected="false" >Versenden</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="usermess-tab" data-toggle="tab" href="#usermess" role="tab" aria-controls="usermess" aria-selected="false" >Meine Mitteilungen</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content" id="settingsTabsContent">
|
||||
|
||||
<div class="tab-pane fade show" id="send" role="tabpanel" aria-labelledby="send-tab">
|
||||
<h5 class="mt-3">Mitteilung senden{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<div class="col-6 mt-3">
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
{% csrf_token %}
|
||||
{{form|crispy}}
|
||||
<p>Ihrer Mitteilung wird Automatisch eine Anrede und eine Verabscheidung hinzugefügt!</p>
|
||||
<div class="form-group">
|
||||
<button type="submit" class="btn btn-success">Mitteilung verschicken</button>
|
||||
<a href="{% url 'users-dashboard' %}" class="btn btn-success">Abbrechen</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="usermess" role="tabpanel" aria-labelledby="usermess-tab">
|
||||
<h5 class="mt-3">Meine Mitteilungen{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Hier sehen Sie Ihre erhaltenen Mitteilungen" class="far fa-question-circle"></i></small>{% endif %}</h5>
|
||||
<div class="col-6 mt-3">
|
||||
{% if usermessages|length > 0 %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Absender</th>
|
||||
<th scope="col">Datum</th>
|
||||
<th scope="col">Inhalt</th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="tableresults">
|
||||
{% for item in usermessages %}
|
||||
<tr id="us_{{item.pk}}">
|
||||
<td>{{ item.created_by.first_name }} {{ item.created_by.last_name }}</td>
|
||||
<td>{{ item.created_date }}</td>
|
||||
<td><a href="{% url 'message-single' item.pk %}">{{ item.content|truncatechars:30 }}</a></td>
|
||||
<td><button href="#" class="btn btn-sm btn-danger" style="float: right;" onclick="javascript:delMessage({{item.pk}})"><i class="fas fa-trash-alt"></i></button></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
Sie haben aktuell keine Mitteilungen.
|
||||
{% endif %}
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div><!-- END TABS CONTENT -->
|
||||
|
||||
<!-- CONFIRMA DELETE DIR -->
|
||||
<div class="modal fade" id="delMess" 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">Mitteilung löschen</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
<div class="modal-body">
|
||||
Wollen Sie die Mitteilung wirklich löschen?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:delAction()">Löschen</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
$('#send').tab('show');
|
||||
});
|
||||
|
||||
var delmessid = "";
|
||||
function delAction(){
|
||||
$.ajax(
|
||||
{
|
||||
type: "GET",
|
||||
url: "{% url 'delsinglemessage' %}",
|
||||
data : {
|
||||
action : "delsingle",
|
||||
todelid : delmessid
|
||||
},
|
||||
success: function( data )
|
||||
{
|
||||
$("#us_" + delmessid).remove();
|
||||
$("#delMess").modal("toggle");
|
||||
var newmesscount = $("#messcounter").html();
|
||||
newmesscount = newmesscount.replace("(", "");
|
||||
newmesscount = newmesscount.replace(")", "");
|
||||
newmesscount = parseInt(newmesscount);
|
||||
newmesscount = newmesscount - 1;
|
||||
if(newmesscount > 0){
|
||||
$("#messcounter").html("(" + newmesscount + ")");
|
||||
}
|
||||
else{
|
||||
$("#messcounter").html("");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function delMessage(id){
|
||||
delmessid = id;
|
||||
$("#delMess").modal("toggle");
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
{% else %}
|
||||
<h3>Das Modul Mitteilungen wurde in ihrer Agentur deaktiviert.</h3>
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_messages %}
|
||||
<div class="content-section col-6">
|
||||
<h3>Mitteilungen <small><i data-toggle="tooltip" data-placement="top" title="Verschicken Sie hier Nachrichten für Mitarbeiter." class="far fa-question-circle"></i></small></h3>
|
||||
<hr>
|
||||
Ihre Mitteilung wurde gesendet.
|
||||
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
<h3>Das Modul Mitteilungen wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% block content %}
|
||||
{% if request.user.profile.agency.module_messages %}
|
||||
<div class="content-section col-6">
|
||||
<h3>Mitteilung von {{mess.created_by.first_name}} {{mess.created_by.last_name}}</h3>
|
||||
<small>Versendet am {{mess.created_date}}</small>
|
||||
<hr>
|
||||
|
||||
Hallo {{request.user.first_name}} {{request.user.last_name}},<br /><br />
|
||||
{{mess.content}}
|
||||
<br /><br />
|
||||
Mit freundlichen Grüßen<br /><br />
|
||||
{{mess.created_by.first_name}} {{mess.created_by.last_name}}
|
||||
<hr>
|
||||
<button class="btn btn-danger" style="float: right;" onclick="javascript:showDelMod()"><i class="fas fa-trash-alt"></i></button>
|
||||
</div>
|
||||
|
||||
<!-- CONFIRMA DELETE DIR -->
|
||||
<div class="modal fade" id="delMess" 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">Mitteilung löschen</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Wollen Sie die Mitteilung wirklich löschen?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:delAction()">Löschen</button>
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">Abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
|
||||
function delAction(){
|
||||
location.href = "{% url 'delsinglemessagefromsingle' mess.pk %}"
|
||||
}
|
||||
|
||||
function showDelMod(){
|
||||
$("#delMess").modal("toggle");
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
{% else %}
|
||||
<h3>Das Modul Mitteilungen wurde in ihrer Agentur deaktiviert.</h3>
|
||||
{% endif %}
|
||||
{% endblock content %}
|
||||
|
|
@ -5,5 +5,10 @@ from . import views
|
|||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.mainmessageview, name="messages"),
|
||||
path('', views.mainmessageview, name="messages"),
|
||||
path('sl/<int:pk>', views.singelmessageview, name="message-single"),
|
||||
path('delsingle/', views.delsinglemessage, name='delsinglemessage'),
|
||||
path('delmessage/<int:pk>', views.delsinglemessagefromsingle, name='delsinglemessagefromsingle'),
|
||||
|
||||
|
||||
]
|
||||
114
message/views.py
114
message/views.py
|
|
@ -1,4 +1,4 @@
|
|||
from django.shortcuts import render, redirect
|
||||
from django.shortcuts import render, redirect, reverse
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.views.generic import CreateView, ListView, UpdateView, DetailView, DeleteView
|
||||
from django.contrib.auth.models import User
|
||||
|
|
@ -7,6 +7,11 @@ from .forms import MessageForm
|
|||
from notificsys.models import UserNotification
|
||||
from django.core.mail import send_mail
|
||||
from django.template.loader import render_to_string
|
||||
from .models import Message
|
||||
from django.contrib import messages
|
||||
from django.http import JsonResponse
|
||||
from notificsys.models import UserNotification
|
||||
|
||||
# ALLE STANDARDS EINER AGENTUR
|
||||
@login_required
|
||||
def mainmessageview(request):
|
||||
|
|
@ -15,39 +20,100 @@ def mainmessageview(request):
|
|||
'active_link' : 'messages'
|
||||
}
|
||||
|
||||
targetuser_id = request.POST["target_user"]
|
||||
message = request.POST["message_content"]
|
||||
formtocheck = MessageForm(request.user, request.POST)
|
||||
|
||||
targetuser = User.objects.get(pk=targetuser_id)
|
||||
|
||||
notificationtext = message + " Grüße, " + request.user.first_name + " " + request.user.last_name
|
||||
|
||||
if(targetuser.profile.user_messages_mail):
|
||||
if formtocheck.is_valid():
|
||||
targetuser_id = formtocheck.cleaned_data["target_user"]
|
||||
targetuser = User.objects.get(pk=targetuser_id)
|
||||
messagecontent = formtocheck.cleaned_data["message_content"]
|
||||
message = Message.objects.create(target_user=targetuser, agency=request.user.profile.agency, content=messagecontent, created_by=request.user)
|
||||
|
||||
username = targetuser.first_name + " " + targetuser.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext,
|
||||
'support@digitale-agentur.com',
|
||||
[targetuser.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
targeturl = request.build_absolute_uri() + "sl/" + str(message.id)
|
||||
notificationtext = "Sie haben eine neue Mitteilung erhalten."
|
||||
|
||||
if(targetuser.profile.user_messages_push):
|
||||
newnotification = UserNotification(touser=targetuser, notificationtext='Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext, notificationtype="messagereceived")
|
||||
newnotification.save()
|
||||
|
||||
return render (request, 'message/message_send.html', context)
|
||||
if(targetuser.profile.user_messages_mail):
|
||||
|
||||
username = targetuser.first_name + " " + targetuser.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext + " <a href='"+targeturl+"'>Klicken Sie hier.</a>",
|
||||
'support@digitale-agentur.com',
|
||||
[targetuser.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
|
||||
if(targetuser.profile.user_messages_push):
|
||||
newnotification = UserNotification(touser=targetuser, elementid=message.id, notificationtext='Hallo ' + targetuser.first_name + ' ' + targetuser.last_name + '! ' + notificationtext, notificationtype="messagereceived")
|
||||
newnotification.save()
|
||||
|
||||
else:
|
||||
messages.warning(request, f'Bitte valide Daten eingeben!')
|
||||
context = {
|
||||
'active_link' : 'messages',
|
||||
'form' : MessageForm(request.user),
|
||||
'usermessages' : Message.objects.filter(target_user=request.user, agency=request.user.profile.agency).order_by('-created_date')
|
||||
}
|
||||
return render (request, 'message/message.html', context)
|
||||
|
||||
context = {
|
||||
'active_link' : 'messages',
|
||||
'form' : MessageForm(request.user),
|
||||
'usermessages' : Message.objects.filter(target_user=request.user, agency=request.user.profile.agency).order_by('-created_date')
|
||||
}
|
||||
|
||||
messages.success(request, f'Ihre Nachricht wurde verschickt!')
|
||||
return render (request, 'message/message.html', context)
|
||||
else:
|
||||
context = {
|
||||
'active_link' : 'messages',
|
||||
'form' : MessageForm(request.user)
|
||||
'form' : MessageForm(request.user),
|
||||
'usermessages' : Message.objects.filter(target_user=request.user, agency=request.user.profile.agency).order_by('-created_date')
|
||||
}
|
||||
# Adding active_link
|
||||
# Loading only user same agency
|
||||
# Change context and return for template-data
|
||||
# # Get all Users of the Same Agency as logged user
|
||||
|
||||
return render (request, 'message/message.html', context)
|
||||
return render (request, 'message/message.html', context)
|
||||
|
||||
@login_required
|
||||
def singelmessageview(request, pk):
|
||||
|
||||
context = {
|
||||
'active_link' : 'messages',
|
||||
'mess' : Message.objects.get(pk=pk)
|
||||
}
|
||||
|
||||
return render (request, 'message/message_single.html', context)
|
||||
|
||||
@login_required
|
||||
def delsinglemessage(request):
|
||||
if request.method == 'GET':
|
||||
if request.GET['action'] == 'delsingle':
|
||||
Message.objects.get(pk=request.GET['todelid']).delete()
|
||||
UserNotification.objects.filter(elementid=request.GET['todelid']).delete()
|
||||
return JsonResponse({})
|
||||
|
||||
|
||||
@login_required
|
||||
def delsinglemessagefromsingle(request, pk):
|
||||
|
||||
context = {
|
||||
'active_link' : 'messages',
|
||||
'form' : MessageForm(request.user),
|
||||
'usermessages' : Message.objects.filter(target_user=request.user, agency=request.user.profile.agency).order_by('-created_date')
|
||||
}
|
||||
|
||||
todelmess = Message.objects.get(pk=pk)
|
||||
|
||||
if(todelmess.agency == request.user.profile.agency and todelmess.target_user == request.user):
|
||||
messages.success(request, f'Mitteilung gelöscht.')
|
||||
Message.objects.get(pk=pk).delete()
|
||||
UserNotification.objects.filter(elementid=pk).delete()
|
||||
else:
|
||||
messages.success(request, f'Sie dürfen diese Mitteilung nicht löschen.')
|
||||
|
||||
return render (request, 'message/message.html', context)
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -14,15 +14,17 @@ class News(models.Model):
|
|||
#content = RichTextUploadingField(blank=True, verbose_name='Inhalt')
|
||||
content = models.TextField(blank=True, verbose_name='Inhalt', default="")
|
||||
|
||||
created_by = models.ForeignKey(User, on_delete=models.PROTECT)
|
||||
created_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
|
||||
created_date = models.DateTimeField(default=timezone.now, blank=True)
|
||||
|
||||
go_online_on = models.DateTimeField(default=timezone.now, blank=True)
|
||||
# Default date plus two weeks
|
||||
go_offline_on = models.DateTimeField(default=timezone.now()+timedelta(days=14), blank=True)
|
||||
|
||||
last_modified_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name='news_mod_by', default=None)
|
||||
last_modified_by = models.ForeignKey(User, on_delete=models.SET_NULL, null=True, related_name='news_mod_by', default=None)
|
||||
last_modified_on = models.DateTimeField(default=timezone.now, blank=True)
|
||||
|
||||
agnotify = models.BooleanField(default=True)
|
||||
|
||||
def __str__(self):
|
||||
return f'{self.name}'
|
||||
|
|
|
|||
|
|
@ -4,8 +4,7 @@
|
|||
{% block content %}
|
||||
{% if request.user.profile.agency.module_news %}
|
||||
<div class="content-section col-6">
|
||||
|
||||
|
||||
|
||||
<h3>News anlegen</h3>
|
||||
<hr>
|
||||
<form method="POST">
|
||||
|
|
|
|||
|
|
@ -14,6 +14,10 @@
|
|||
<a href="/news/news/{{notification.elementid}}/single" class="" style="text-decoration: none; color: #000000">
|
||||
{{notification.notificationtext}}
|
||||
</a><br />
|
||||
{% elif notification.notificationtype == "messagereceived" %}
|
||||
<a href="/messages/sl/{{notification.elementid}}" class="" style="text-decoration: none; color: #000000">
|
||||
{{notification.notificationtext}}
|
||||
</a><br />
|
||||
{% else %}
|
||||
{{notification.notificationtext}}<br />
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -125,6 +125,9 @@
|
|||
<div style="font-family:Roboto;font-size:18px;line-height:1;text-align:left;color:#000000;">
|
||||
<p>Hallo {{username}},</p>
|
||||
<p>{{notificationtext}}</p>
|
||||
{% if linktarget|length > 0 %}
|
||||
<p><a href="{{linktarget}}">Hier klicken!</a></p>
|
||||
{% endif %}
|
||||
<p>Mit freundlichen Grüßen</p>
|
||||
<p>Ihr Team von Digitale Agentur</p>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -16,9 +16,14 @@ def CheckNotifications(request):
|
|||
i = 0
|
||||
for notify in unknownnotification:
|
||||
|
||||
elelink = "notifications/showallnotificaions/"
|
||||
elelink = ""
|
||||
if notify.notificationtype == "agencynews":
|
||||
elelink = "news/news/" + str(notify.elementid) + "/single"
|
||||
elif notify.notificationtype == "messagereceived":
|
||||
elelink = "messages/sl/" + str(notify.elementid)
|
||||
else:
|
||||
elelink = "notifications/showallnotificaions/"
|
||||
|
||||
|
||||
formatedDate = notify.created.strftime("%d.%m.20%y um %H:%M")
|
||||
|
||||
|
|
@ -46,9 +51,13 @@ def GetBasicNotifications(request):
|
|||
i = 0
|
||||
for notify in oldnotifications:
|
||||
|
||||
elelink = "notifications/showallnotificaions/"
|
||||
elelink = ""
|
||||
if notify.notificationtype == "agencynews":
|
||||
elelink = "news/news/" + str(notify.elementid) + "/single"
|
||||
elif notify.notificationtype == "messagereceived":
|
||||
elelink = "messages/sl/" + str(notify.elementid)
|
||||
else:
|
||||
elelink = "notifications/showallnotificaions/"
|
||||
|
||||
formatedDate = notify.created.strftime("%d.%m.20%y um %H:%M")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,12 @@
|
|||
{% extends "users/base.html" %}
|
||||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
<div class="content-section">
|
||||
<h3>Bereiche und Aufgaben von {{user_first_name}} {{user_last_name}}</h3>
|
||||
<h3>Bereiche und Aufgaben von {{user_first_name}} {{user_last_name}}<span style="float: right">
|
||||
{% if user|usergperm:"usermanager" %}
|
||||
<button type="button" style="float: right" class="btn btn-primary btn-sm" onclick="" data-toggle="tooltip" data-placement="top" title="Reihenfolge der Tätigkeiten anpassen"><small><i class="fas fa-pen"></i></small></button>
|
||||
{% endif %}
|
||||
</span></h3>
|
||||
<hr>
|
||||
<div class="media">
|
||||
<img class="img-profile" width="12%" src="{{ imageurl }}" >
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
<h3>Neuen Standard anlegen <small><i data-toggle="tooltip" data-placement="top" title="Legen Sie hier einen neuen Standard an." class="far fa-question-circle"></i></small></h3>
|
||||
<h3>Neuen Standard anlegen{% if request.user.profile.showtooltips %} <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 %}
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<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">
|
||||
Gruppen <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>
|
||||
Gruppen{% if request.user.profile.showtooltips %} <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>
|
||||
|
|
@ -45,7 +45,7 @@
|
|||
<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">
|
||||
Dateien <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 Heimverzeichnis gespeichert." class="far fa-question-circle"></i></small>
|
||||
Dateien{% if request.user.profile.showtooltips %} <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 Heimverzeichnis gespeichert." class="far fa-question-circle"></i></small>{% endif %}
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
|
@ -82,7 +82,7 @@
|
|||
<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">
|
||||
Standards <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>
|
||||
Standards{% if request.user.profile.showtooltips %} <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>
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
<h3>Standards <small><i data-toggle="tooltip" data-placement="top" title="Standards dokumentieren und erläutern verschiedenen Verfahren, strukturiert nach Bereichen und Tätigkeiten." class="far fa-question-circle"></i></small></h3>
|
||||
<h3>Standards{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Standards dokumentieren und erläutern verschiedenen Verfahren, strukturiert nach Bereichen und Tätigkeiten." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<small>Sichtbar sind alle veröffentlichten und von {{ user.first_name }} {{ user.last_name}} erstellten Standards.</small>
|
||||
<hr>
|
||||
<div class="row">
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
{% load counter_tag %}
|
||||
{% block content %}
|
||||
<div class="content-section col-12">
|
||||
<h3>Standard bearbeiten <small><i data-toggle="tooltip" data-placement="top" title="Aktualisieren Sie hier die Informationen des Standards." class="far fa-question-circle"></i></small></h3>
|
||||
<h3>Standard bearbeiten{% if request.user.profile.showtooltips %} <small><i data-toggle="tooltip" data-placement="top" title="Aktualisieren Sie hier die Informationen des Standards." class="far fa-question-circle"></i></small>{% endif %}</h3>
|
||||
<hr>
|
||||
<form method="POST" id="taskareaform">
|
||||
{% csrf_token %}
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
<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">
|
||||
Gruppen <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>
|
||||
Gruppen{% if request.user.profile.showtooltips %} <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>
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
<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">
|
||||
Dateien <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 Heimverzeichnis gespeichert." class="far fa-question-circle"></i></small>
|
||||
Dateien{% if request.user.profile.showtooltips %} <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 Heimverzeichnis gespeichert." class="far fa-question-circle"></i></small>{% endif %}
|
||||
</button>
|
||||
</h5>
|
||||
</div>
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
<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">
|
||||
Standards <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>
|
||||
Standards{% if request.user.profile.showtooltips %} <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>
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,6 +1,7 @@
|
|||
from django import template
|
||||
from django.contrib.auth.models import Group, User
|
||||
from users.models import AgencyGroup
|
||||
from message.models import Message
|
||||
import os
|
||||
register = template.Library()
|
||||
|
||||
|
|
@ -48,6 +49,9 @@ def getbool():
|
|||
return groupbool
|
||||
|
||||
|
||||
@register.simple_tag
|
||||
def getmesscounter(user):
|
||||
return len(Message.objects.filter(target_user=user))
|
||||
|
||||
|
||||
# usergperm
|
||||
|
|
@ -82,6 +86,9 @@ def split_dir_style(dirtosplit):
|
|||
@register.filter(name="filename")
|
||||
def filename(value):
|
||||
return os.path.basename(value.file.name)
|
||||
|
||||
|
||||
|
||||
'''
|
||||
class Counter:
|
||||
count = 0
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@ from django.contrib import admin
|
|||
from .models import Profile, Agency, AgencyGroup, AgencyJob
|
||||
from .priomodel import Prio
|
||||
from django.contrib.auth.models import Permission
|
||||
from message.models import Message
|
||||
admin.site.register(Permission)
|
||||
admin.site.register(Profile)
|
||||
admin.site.register(Agency)
|
||||
admin.site.register(AgencyGroup)
|
||||
admin.site.register(AgencyJob)
|
||||
admin.site.register(Prio)
|
||||
admin.site.register(Message)
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ from django.template.loader import render_to_string
|
|||
from tasks.models import Tasks
|
||||
from cloud.models import DataFile
|
||||
import os
|
||||
from django.conf import settings
|
||||
from django.utils import timezone
|
||||
|
||||
# Deletes all Notifications added to to delete news
|
||||
@receiver(pre_delete, sender=News)
|
||||
|
|
@ -107,26 +109,37 @@ def save_news(sender, instance, **kwargs):
|
|||
GLOBALSENDMAILS = True
|
||||
if(kwargs["created"]):
|
||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||
for user in usersofagency:
|
||||
|
||||
if(user.profile.news_mail):
|
||||
notificationtext = "Neue Agenturnews: " + instance.name
|
||||
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
|
||||
|
||||
if(instance.go_online_on < timezone.now() and instance.agnotify):
|
||||
|
||||
for user in usersofagency:
|
||||
|
||||
username = user.first_name + " " + user.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext})
|
||||
if(GLOBALSENDMAILS):
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
|
||||
'support@digitale-agentur.com',
|
||||
[user.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
if(user.profile.news_mail):
|
||||
notificationtext = "Neue Agenturnews: " + instance.name
|
||||
|
||||
if(user.profile.news_push):
|
||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
username = user.first_name + " " + user.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
|
||||
|
||||
|
||||
if(GLOBALSENDMAILS):
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
|
||||
'support@digitale-agentur.com',
|
||||
[user.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
|
||||
if(user.profile.news_push):
|
||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="agencynews", elementid=instance.pk)
|
||||
newnotification.save()
|
||||
else:
|
||||
instance.agnotify = False
|
||||
instance.save()
|
||||
|
||||
|
||||
# SIGNALS FOR TASK
|
||||
@receiver(signal=m2m_changed, sender=Tasks.usersfield.through)
|
||||
|
|
|
|||
|
|
@ -162,9 +162,13 @@
|
|||
{% else%}
|
||||
<li class="nav-item">
|
||||
{%endif%}
|
||||
|
||||
{% getmesscounter request.user as gs %}
|
||||
|
||||
|
||||
<a class="nav-link " href="{% url 'messages' %}" aria-expanded="true">
|
||||
<i class="fas fa-envelope"></i>
|
||||
<span>Mitteilungen</span>
|
||||
<span>Mitteilungen</span>{% if gs > 0 %} <small id="messcounter">({{gs}})</small>{% endif %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@ urlpatterns = [
|
|||
path('datenschutz/', views.datenschutz, name="datenschutzda"),
|
||||
path('impressum/', views.impressum, name="impressumda"),
|
||||
path('setuserparent/', views.setuserparent, name="users-setuserparent"),
|
||||
path('sendpassmail/', views.sendpassmail, name="users-sendpassmail")
|
||||
path('sendpassmail/', views.sendpassmail, name="users-sendpassmail"),
|
||||
path('dacron/<slug:code>', views.cronactions, name="cronmain"),
|
||||
|
||||
]
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ from quicklinks.models import QuickLinks
|
|||
from .priomodel import Prio
|
||||
from standards.models import Standards
|
||||
from datetime import datetime
|
||||
from django.utils import timezone
|
||||
from django.utils import formats
|
||||
from news.models import News
|
||||
import requests
|
||||
|
|
@ -30,6 +31,8 @@ from io import StringIO
|
|||
from users.models import AgencyJob, AgencyGroup
|
||||
from django.contrib.auth.models import Group
|
||||
from cloud.models import DataDir
|
||||
from message.models import Message
|
||||
from notificsys.models import UserNotification
|
||||
|
||||
def randomString(stringLength=10):
|
||||
"""Generate a random string of fixed length """
|
||||
|
|
@ -615,12 +618,7 @@ def support(request):
|
|||
# HEADERS CURL
|
||||
headers = {'X-API-Key': 'F025A238EB74914E3653BA2989BFF7C4'}
|
||||
subject = "Digitale Agentur: " + str(problemconc)
|
||||
|
||||
#final_img = image['image']
|
||||
|
||||
#fi = Image.open(final_img)
|
||||
#print(fi)
|
||||
|
||||
|
||||
# DataJSON
|
||||
ostdata = {
|
||||
"topicId" : '12',
|
||||
|
|
@ -670,4 +668,48 @@ def impressum(request):
|
|||
if request.user.is_authenticated:
|
||||
return render(request, 'users/impressum.html')
|
||||
else:
|
||||
return render(request, 'users/impressum_p.html')
|
||||
return render(request, 'users/impressum_p.html')
|
||||
|
||||
'''
|
||||
|
||||
CRONJOB FUNCTION
|
||||
|
||||
'''
|
||||
def cronactions(request, code):
|
||||
|
||||
if(code == settings.CRONAPIKEY):
|
||||
# NEWS CHECKING
|
||||
all_unnotifc_news = News.objects.filter(agnotify=False, go_online_on__lt=timezone.now())
|
||||
|
||||
for news in all_unnotifc_news:
|
||||
targeturl = settings.BASE_URL + "news/news/" + str(news.pk) + "/single"
|
||||
usersofagency = User.objects.filter(profile__agency=news.agency)
|
||||
news.agnotify = True
|
||||
news.save()
|
||||
|
||||
for user in usersofagency:
|
||||
if(user.profile.news_mail):
|
||||
notificationtext = "Neue Agenturnews: " + news.name
|
||||
username = user.first_name + " " + user.last_name
|
||||
msg_html = render_to_string('notificsys/notification_mail.html', {'username': username, 'notificationtext' : notificationtext, 'linktarget' : targeturl})
|
||||
GLOBALSENDMAILS = True
|
||||
|
||||
if(GLOBALSENDMAILS):
|
||||
send_mail(
|
||||
'Agentur-Benachrichtigung',
|
||||
'Hallo ' + user.first_name + ' ' + user.last_name + '! ' + notificationtext,
|
||||
'support@digitale-agentur.com',
|
||||
[user.email],
|
||||
html_message=msg_html,
|
||||
fail_silently=False
|
||||
)
|
||||
|
||||
if(user.profile.news_push):
|
||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + news.name, notificationtype="agencynews", elementid=news.pk)
|
||||
newnotification.save()
|
||||
|
||||
|
||||
|
||||
else:
|
||||
print("API CODE FAILED")
|
||||
return JsonResponse({})
|
||||
Loading…
Reference in New Issue