Benachrichtungen Organizer fertig und mainfunciotn umgebaut
This commit is contained in:
parent
c1950648e4
commit
5331dad88a
|
|
@ -205,8 +205,8 @@ a.disabled {
|
||||||
Mit dem Löschen fortfahren? Alle Dateien in diesem Verzeichnis werden ebenfalls gelöscht!
|
Mit dem Löschen fortfahren? Alle Dateien in diesem Verzeichnis werden ebenfalls gelöscht!
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-danger" data-dismiss="modal" onclick="javascript:doDelDataDir()">Löschen</button>
|
<button type="button" class="btn btn-primary" data-dismiss="modal" onclick="javascript:doDelDataDir()">Löschen</button>
|
||||||
<button type="button" class="btn btn-success" data-dismiss="modal">Abbrechen</button>
|
<button type="button" class="btn" data-dismiss="modal">Abbrechen</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ class OrganizerAddContact(forms.ModelForm):
|
||||||
model = AGContacts
|
model = AGContacts
|
||||||
labels = {
|
labels = {
|
||||||
'personname' : "Ansprechpartner",
|
'personname' : "Ansprechpartner",
|
||||||
'company' : "Organisation",
|
'name' : "Organisation",
|
||||||
'mail' : "E-Mailadresse",
|
'mail' : "E-Mailadresse",
|
||||||
'phone1' : "Telefon 1",
|
'phone1' : "Telefon 1",
|
||||||
'phone2' : "Telefon 2",
|
'phone2' : "Telefon 2",
|
||||||
|
|
@ -43,12 +43,12 @@ class OrganizerAddContact(forms.ModelForm):
|
||||||
'desc' : "Anmerkungen"
|
'desc' : "Anmerkungen"
|
||||||
}
|
}
|
||||||
|
|
||||||
fields = ['company', 'personname', 'mail', 'phone1', 'phone2', 'street', 'plz', 'city', "category", 'desc']
|
fields = ['name', 'personname', 'mail', 'phone1', 'phone2', 'street', 'plz', 'city', "category", 'desc']
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, user, *args, **kwargs):
|
def __init__(self, user, *args, **kwargs):
|
||||||
super(OrganizerAddContact, self).__init__(*args, **kwargs)
|
super(OrganizerAddContact, self).__init__(*args, **kwargs)
|
||||||
self.fields['company'].required = False
|
self.fields['name'].required = False
|
||||||
self.fields['personname'].required = False
|
self.fields['personname'].required = False
|
||||||
self.fields['mail'].required = False
|
self.fields['mail'].required = False
|
||||||
self.fields['phone1'].required = False
|
self.fields['phone1'].required = False
|
||||||
|
|
@ -65,7 +65,7 @@ class OrganizerUpdateContact(forms.ModelForm):
|
||||||
model = AGContacts
|
model = AGContacts
|
||||||
labels = {
|
labels = {
|
||||||
'personname' : "Ansprechpartner",
|
'personname' : "Ansprechpartner",
|
||||||
'company' : "Organisation",
|
'name' : "Organisation",
|
||||||
'mail' : "E-Mailadresse",
|
'mail' : "E-Mailadresse",
|
||||||
'phone1' : "Telefon 1",
|
'phone1' : "Telefon 1",
|
||||||
'phone2' : "Telefon 2",
|
'phone2' : "Telefon 2",
|
||||||
|
|
@ -76,12 +76,12 @@ class OrganizerUpdateContact(forms.ModelForm):
|
||||||
'desc' : "Anmerkungen"
|
'desc' : "Anmerkungen"
|
||||||
}
|
}
|
||||||
|
|
||||||
fields = ['company', 'personname', 'mail', 'phone1', 'phone2', 'street', 'plz', 'city', "category", 'desc']
|
fields = ['name', 'personname', 'mail', 'phone1', 'phone2', 'street', 'plz', 'city', "category", 'desc']
|
||||||
|
|
||||||
def __init__(self, user, *args, **kwargs):
|
def __init__(self, user, *args, **kwargs):
|
||||||
super(OrganizerUpdateContact, self).__init__(*args, **kwargs)
|
super(OrganizerUpdateContact, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.fields['company'].required = False
|
self.fields['name'].required = False
|
||||||
self.fields['personname'].required = False
|
self.fields['personname'].required = False
|
||||||
self.fields['mail'].required = False
|
self.fields['mail'].required = False
|
||||||
self.fields['phone1'].required = False
|
self.fields['phone1'].required = False
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ class AGContactsCagetory(models.Model):
|
||||||
class AGContacts(models.Model):
|
class AGContacts(models.Model):
|
||||||
agency = models.ForeignKey(Agency, on_delete=models.PROTECT)
|
agency = models.ForeignKey(Agency, on_delete=models.PROTECT)
|
||||||
personname = models.CharField(default="", max_length=200, blank=False)
|
personname = models.CharField(default="", max_length=200, blank=False)
|
||||||
company = models.CharField(default="", max_length=200, blank=False)
|
name = models.CharField(default="", max_length=200, blank=False)
|
||||||
mail = models.CharField(default="", max_length=200, blank=False)
|
mail = models.CharField(default="", max_length=200, blank=False)
|
||||||
phone1 = models.CharField(default="", max_length=200, blank=False)
|
phone1 = models.CharField(default="", max_length=200, blank=False)
|
||||||
phone2 = models.CharField(default="", max_length=200, blank=False)
|
phone2 = models.CharField(default="", max_length=200, blank=False)
|
||||||
|
|
@ -58,7 +58,7 @@ class AGContacts(models.Model):
|
||||||
category = models.ForeignKey("AGContactsCagetory", default=None, on_delete=models.SET_DEFAULT, null=True, blank=True)
|
category = models.ForeignKey("AGContactsCagetory", default=None, on_delete=models.SET_DEFAULT, null=True, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.company}'
|
return f'{self.name}'
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse('cont-update', kwargs={'pk':self.pk})
|
return reverse('cont-update', kwargs={'pk':self.pk})
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
{% for agc in contacts %}
|
{% for agc in contacts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.company}}</a>
|
<a href="#" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.name}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if agc.mail|length > 0 %}
|
{% if agc.mail|length > 0 %}
|
||||||
|
|
@ -68,7 +68,7 @@
|
||||||
<div class="modal-dialog " role="document">
|
<div class="modal-dialog " role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.company}}</h5>
|
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.name}}</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
{% for agc in contacts %}
|
{% for agc in contacts %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="#" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.company}}</a>
|
<a href="#" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.name}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if agc.mail|length > 0 %}
|
{% if agc.mail|length > 0 %}
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
<div class="modal-dialog " role="document">
|
<div class="modal-dialog " role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.company}}</h5>
|
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.name}}</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -509,11 +509,11 @@
|
||||||
<datalist id="poss_contacts">
|
<datalist id="poss_contacts">
|
||||||
{% if update == True %}
|
{% if update == True %}
|
||||||
{% for q in possible_contacts %}
|
{% for q in possible_contacts %}
|
||||||
<option id="contacts_{{q.pk}}" value="{{q.company}}">{{q.company}}</option>
|
<option id="contacts_{{q.pk}}" value="{{q.name}}">{{q.name}}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% for q in contacts %}
|
{% for q in contacts %}
|
||||||
<option id="contacts_{{q.pk}}" value="{{q.company}}">{{q.company}}</option>
|
<option id="contacts_{{q.pk}}" value="{{q.name}}">{{q.name}}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</datalist>
|
</datalist>
|
||||||
|
|
@ -522,7 +522,7 @@
|
||||||
<table id="linked_contacts" class="table table-hover table-sm">
|
<table id="linked_contacts" class="table table-hover table-sm">
|
||||||
{% if update == True %}
|
{% if update == True %}
|
||||||
{% for q in standard.addedcontacts.all %}
|
{% for q in standard.addedcontacts.all %}
|
||||||
<tr id="added_contacts_{{q.pk}}"><td>{{q.company}}</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remEle('contacts',{{q.pk}}, '{{q.company}}')" style="float: right;" ><i class="fas fa-trash"></i></button></td></tr>
|
<tr id="added_contacts_{{q.pk}}"><td>{{q.name}}</td><td><button type="button" class="btn btn-danger btn-sm" onclick="javascript:remEle('contacts',{{q.pk}}, '{{q.name}}')" style="float: right;" ><i class="fas fa-trash"></i></button></td></tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</table>
|
</table>
|
||||||
|
|
|
||||||
|
|
@ -133,7 +133,7 @@
|
||||||
<h5 class="card-title">Kontakte</h5>
|
<h5 class="card-title">Kontakte</h5>
|
||||||
<p class="card-text">
|
<p class="card-text">
|
||||||
{% for agc in standard.addedcontacts.all %}
|
{% for agc in standard.addedcontacts.all %}
|
||||||
<a href="#/" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.company}}</a><br />
|
<a href="#/" onclick="javascript:$('#infos_{{agc.pk}}').modal('toggle');">{{agc.name}}</a><br />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -248,7 +248,7 @@
|
||||||
<div class="modal-dialog " role="document">
|
<div class="modal-dialog " role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.company}}</h5>
|
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.name}}</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,229 @@
|
||||||
|
|
||||||
|
'''
|
||||||
|
@receiver(post_save, sender=DataDir)
|
||||||
|
def save_dir(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
# CREATED
|
||||||
|
if(kwargs["created"]):
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_created_mail):
|
||||||
|
notificationtext = " es gibt neue Ordner: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_created_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Neuer Ordner: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Neuer Ordner: " + instance.name})
|
||||||
|
# UPDATED
|
||||||
|
else:
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_update_mail):
|
||||||
|
notificationtext = " Ordner wurden aktualisiert: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_update_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Aktualisierter Ordner: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Aktualisierter Ordner: " + instance.name})
|
||||||
|
'''
|
||||||
|
|
||||||
|
'''
|
||||||
|
@receiver(pre_delete, sender=DataDir)
|
||||||
|
def del_dir(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_delete_mail):
|
||||||
|
notificationtext = " ein Ordner wurde gelöscht: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_delete_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Ordner gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Ordner gelöscht: " + instance.name})
|
||||||
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=DataFile)
|
||||||
|
def del_file(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_delete_mail):
|
||||||
|
notificationtext = " eine Datei wurde gelöscht: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_delete_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Datei gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateiein | Datei gelöscht: " + instance.name})
|
||||||
|
# Signals for FILES
|
||||||
|
@receiver(post_save, sender=DataFile)
|
||||||
|
def save_file(sender, instance, **kwargs):
|
||||||
|
|
||||||
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt eine neue Datei: ", "Neue Datei: ", "Dateien | ", "", "")
|
||||||
|
elif(len(instance.name) > 0):
|
||||||
|
newNotifiyPush(1, instance, " Datei wurde aktualisiert: ", "Aktualisierter Datei: ", "Dateien | ", "", "")
|
||||||
|
|
||||||
|
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
# CREATED
|
||||||
|
if(kwargs["created"]):
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_created_mail):
|
||||||
|
notificationtext = " es gibt eine neue Datei: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_created_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Neue Datei: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateien | Neue Datei: " + instance.name})
|
||||||
|
# UPDATED
|
||||||
|
else:
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_update_mail):
|
||||||
|
notificationtext = " Datei wurden aktualisiert: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_update_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Aktualisierte Datei: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateien | Aktualisierte Datei: " + instance.name})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(post_save, sender=QuickLinks)
|
||||||
|
def save_ql(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
# CREATED
|
||||||
|
if(kwargs["created"]):
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.ql_created_mail):
|
||||||
|
notificationtext = " es gibt einen neuen Quicklink: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.ql_created_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Neuer Quicklink: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Neuer Quicklink: " + instance.name})
|
||||||
|
# UPDATED
|
||||||
|
else:
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.ql_update_mail):
|
||||||
|
notificationtext = " Quicklink wurde aktualisiert: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.ql_update_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Quicklink aktualisiert: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Aktualisierter Quicklink: " + instance.name})
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=QuickLinks)
|
||||||
|
def del_ql(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.ql_delete_mail):
|
||||||
|
notificationtext = " ein Quicklink wurde gelöscht: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.ql_delete_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Quicklink gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Quicklink gelöscht: " + instance.name})
|
||||||
|
@receiver(post_save, sender=Standards)
|
||||||
|
def save_standard(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
targeturl = settings.BASE_URL + "standards/standard/" + str(instance.pk) + "/single"
|
||||||
|
# NEW STANDARD
|
||||||
|
if(kwargs["created"]):
|
||||||
|
if(instance.public):
|
||||||
|
for user in usersofagency:
|
||||||
|
|
||||||
|
if(user.usernotifications.standard_created_mail):
|
||||||
|
notificationtext = " es wurde ein neuer Agenturstandard erstellt: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.standard_created_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Neuer Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer Agenturstandard: " + instance.name})
|
||||||
|
else:
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Neuer unveröffentlichter Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer unveröffentlichter Agenturstandard: " + instance.name})
|
||||||
|
|
||||||
|
if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_mail):
|
||||||
|
notificationtext = " es wurde ein neuer unveröffentlichter Agenturstandard erstellt: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
# Standard wurde aktualisiert
|
||||||
|
else:
|
||||||
|
for user in usersofagency:
|
||||||
|
|
||||||
|
if(user.usernotifications.standard_update_mail):
|
||||||
|
notificationtext = " es wurde ein neuer Agenturstandard aktualisiert: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
if(user.usernotifications.standard_update_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Agenturstandard aktualisiert: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard aktualisiert: " + instance.name})
|
||||||
|
|
||||||
|
|
||||||
|
# DELETE
|
||||||
|
@receiver(pre_delete, sender=Standards)
|
||||||
|
def delete_standard(sender, instance, **kwargs):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.standard_delete_mail):
|
||||||
|
notificationtext = " es wurde ein neuer Agenturstandard gelöscht: " + instance.name
|
||||||
|
sendMailNoti(notificationtext, user)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.standard_delete_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext="Agenturstandard gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard gelöscht: " + instance.name})
|
||||||
268
users/signals.py
268
users/signals.py
|
|
@ -240,42 +240,20 @@ def adjust_group_notifications(instance, action, reverse, model, pk_set, using,
|
||||||
# DELETE
|
# DELETE
|
||||||
@receiver(pre_delete, sender=Standards)
|
@receiver(pre_delete, sender=Standards)
|
||||||
def delete_standard(sender, instance, **kwargs):
|
def delete_standard(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
newNotifiyPush(2, instance, " es wurde ein neuer Agenturstandard gelöscht: ", "Agenturstandard gelöscht: ", "Standards | ", "", "")
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.standard_delete_mail):
|
|
||||||
notificationtext = " es wurde ein neuer Agenturstandard gelöscht: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.standard_delete_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Agenturstandard gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard gelöscht: " + instance.name})
|
|
||||||
|
|
||||||
# SAVE AND UPDATE
|
# SAVE AND UPDATE
|
||||||
@receiver(post_save, sender=Standards)
|
@receiver(post_save, sender=Standards)
|
||||||
def save_standard(sender, instance, **kwargs):
|
def save_standard(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
|
||||||
targeturl = settings.BASE_URL + "standards/standard/" + str(instance.pk) + "/single"
|
targeturl = settings.BASE_URL + "standards/standard/" + str(instance.pk) + "/single"
|
||||||
# NEW STANDARD
|
# NEW STANDARD
|
||||||
if(kwargs["created"]):
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
if(instance.public):
|
if(instance.public):
|
||||||
for user in usersofagency:
|
newNotifiyPush(0, instance, " es wurde ein neuer Agenturstandard erstellt: ", "Neuer Agenturstandard: ", "Standards | ", "newstandard", targeturl)
|
||||||
|
|
||||||
if(user.usernotifications.standard_created_mail):
|
|
||||||
notificationtext = " es wurde ein neuer Agenturstandard erstellt: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.standard_created_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neuer Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Neuer Agenturstandard: " + instance.name})
|
|
||||||
else:
|
else:
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
for user in usersofagency:
|
for user in usersofagency:
|
||||||
if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_push):
|
if(user.has_perm("users.standardmanager") and user.usernotifications.standard_created_unpub_push):
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neuer unveröffentlichter Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
newnotification = UserNotification(touser=user, notificationtext="Neuer unveröffentlichter Agenturstandard: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
||||||
|
|
@ -289,45 +267,18 @@ def save_standard(sender, instance, **kwargs):
|
||||||
sendMailNoti(notificationtext, user)
|
sendMailNoti(notificationtext, user)
|
||||||
# Standard wurde aktualisiert
|
# Standard wurde aktualisiert
|
||||||
else:
|
else:
|
||||||
for user in usersofagency:
|
newNotifiyPush(1, instance, " es wurde ein neuer Agenturstandard aktualisiert: ", "Agenturstandard aktualisiert: ", "Standards | ", "newstandard", targeturl)
|
||||||
|
|
||||||
if(user.usernotifications.standard_update_mail):
|
|
||||||
notificationtext = " es wurde ein neuer Agenturstandard aktualisiert: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
if(user.usernotifications.standard_update_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Agenturstandard aktualisiert: " + instance.name, notificationtype="newstandard", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Standards | Agenturstandard aktualisiert: " + instance.name})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# SIGNAL FOR NEWS
|
# SIGNAL FOR NEWS
|
||||||
@receiver(post_save, sender=News)
|
@receiver(post_save, sender=News)
|
||||||
def save_news(sender, instance, **kwargs):
|
def save_news(sender, instance, **kwargs):
|
||||||
if(kwargs["created"]):
|
if(kwargs["created"]):
|
||||||
|
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
|
||||||
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
|
targeturl = settings.BASE_URL + "news/news/" + str(instance.pk) + "/single"
|
||||||
|
|
||||||
# Prüfung, ob die News SOFORT online geht oder später
|
# Prüfung, ob die News SOFORT online geht oder später
|
||||||
if(instance.go_online_on < timezone.now() and instance.agnotify):
|
if(instance.go_online_on < timezone.now() and instance.agnotify):
|
||||||
|
newNotifiyPush(0, instance, " es gibt neue Agenturnews: ", "Neue Agenturnews: ", "News | ", "", targeturl)
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.news_created_mail):
|
|
||||||
notificationtext = " es gibt neue Agenturnews: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user, targeturl)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.news_created_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neue Agenturnews: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__News | Neue Agenturnews: " + instance.name})
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
instance.agnotify = False
|
instance.agnotify = False
|
||||||
instance.save()
|
instance.save()
|
||||||
|
|
@ -371,158 +322,137 @@ def adjust_group_notifications_task(instance, action, reverse, model, pk_set, us
|
||||||
sendMailNoti(notificationtext, user_touched)
|
sendMailNoti(notificationtext, user_touched)
|
||||||
|
|
||||||
|
|
||||||
# Signals for FILES
|
|
||||||
@receiver(post_save, sender=DataFile)
|
'''
|
||||||
def save_file(sender, instance, **kwargs):
|
|
||||||
|
newNotifiyPush
|
||||||
|
|
||||||
|
@param:
|
||||||
|
instance - Objekt des Signals
|
||||||
|
mode - Modus 0 --> CREATED, 1 --> UPDATE, 3 --> DELETE
|
||||||
|
mailtext - Text in der Benachrichtigung
|
||||||
|
zB " es gibt neue Ordner: "
|
||||||
|
notifytext - Text in der PUSH-Nachricht
|
||||||
|
zB "Neuer Ordner: "
|
||||||
|
pushtext - Typ bei PUSH (hinter pushnotification__)
|
||||||
|
zB "Ordner | " + notifytext
|
||||||
|
notifytype - Typ für Verlinkung
|
||||||
|
targeturl - URL für Verlinkung, Default = ""
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
def newNotifiyPush(mode, instance, mailtext, notifytext, pushtext, notifytype, targeturl=""):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
# CREATED
|
# CREATED
|
||||||
if(kwargs["created"]):
|
if(mode == 0):
|
||||||
for user in usersofagency:
|
for user in usersofagency:
|
||||||
if(user.usernotifications.filedir_created_mail):
|
if(user.usernotifications.filedir_created_mail):
|
||||||
notificationtext = " es gibt eine neue Datei: " + instance.name
|
notificationtext = mailtext + instance.name
|
||||||
sendMailNoti(notificationtext, user)
|
sendMailNoti(notificationtext, user, targeturl)
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.filedir_created_push):
|
if(user.usernotifications.filedir_created_push):
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neue Datei: " + instance.name, notificationtype="", elementid=instance.pk)
|
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
newnotification.save()
|
newnotification.save()
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateien | Neue Datei: " + instance.name})
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__"+ pushtext + notifytext + instance.name})
|
||||||
# UPDATED
|
# UPDATED
|
||||||
else:
|
elif(mode == 1):
|
||||||
for user in usersofagency:
|
for user in usersofagency:
|
||||||
if(user.usernotifications.filedir_update_mail):
|
if(user.usernotifications.filedir_update_mail):
|
||||||
notificationtext = " Datei wurden aktualisiert: " + instance.name
|
notificationtext = mailtext + instance.name
|
||||||
sendMailNoti(notificationtext, user)
|
sendMailNoti(notificationtext, user, targeturl)
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.filedir_update_push):
|
if(user.usernotifications.filedir_update_push):
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Aktualisierte Datei: " + instance.name, notificationtype="", elementid=instance.pk)
|
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
newnotification.save()
|
newnotification.save()
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateien | Aktualisierte Datei: " + instance.name})
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||||
|
#DELETE
|
||||||
|
elif(mode == 2):
|
||||||
|
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
||||||
|
|
||||||
|
for user in usersofagency:
|
||||||
|
if(user.usernotifications.filedir_delete_mail):
|
||||||
|
notificationtext = mailtext + instance.name
|
||||||
|
sendMailNoti(notificationtext, user, targeturl)
|
||||||
|
|
||||||
|
|
||||||
|
if(user.usernotifications.filedir_delete_push):
|
||||||
|
newnotification = UserNotification(touser=user, notificationtext=notifytext + instance.name, notificationtype="", elementid=instance.pk)
|
||||||
|
newnotification.save()
|
||||||
|
|
||||||
|
channel_layer = channels.layers.get_channel_layer()
|
||||||
|
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__" + pushtext + notifytext + instance.name})
|
||||||
|
|
||||||
|
# DIRS
|
||||||
@receiver(post_save, sender=DataDir)
|
@receiver(post_save, sender=DataDir)
|
||||||
def save_dir(sender, instance, **kwargs):
|
def save_dir(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt neue Ordner: ", "Neuer Ordner: ", "Ordner | ", "", "")
|
||||||
# CREATED
|
elif(len(instance.name) > 0):
|
||||||
if(kwargs["created"]):
|
newNotifiyPush(1, instance, " Ordner wurden aktualisiert: ", "Aktualisierter Ordner: ", "Ordner | ", "", "")
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.filedir_created_mail):
|
|
||||||
notificationtext = " es gibt neue Ordner: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.filedir_created_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neuer Ordner: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Neuer Ordner: " + instance.name})
|
|
||||||
# UPDATED
|
|
||||||
else:
|
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.filedir_update_mail):
|
|
||||||
notificationtext = " Ordner wurden aktualisiert: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.filedir_update_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Aktualisierter Ordner: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Aktualisierter Ordner: " + instance.name})
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=DataDir)
|
@receiver(pre_delete, sender=DataDir)
|
||||||
def del_dir(sender, instance, **kwargs):
|
def del_dir(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
newNotifiyPush(2, instance, " ein Ordner wurde gelöscht: ", "Ordner gelöscht: ", "Ordner | ", "", "")
|
||||||
|
|
||||||
for user in usersofagency:
|
# Signals for FILES
|
||||||
if(user.usernotifications.filedir_delete_mail):
|
@receiver(post_save, sender=DataFile)
|
||||||
notificationtext = " ein Ordner wurde gelöscht: " + instance.name
|
def save_file(sender, instance, **kwargs):
|
||||||
sendMailNoti(notificationtext, user)
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt eine neue Datei: ", "Neue Datei: ", "Dateien | ", "", "")
|
||||||
|
elif(len(instance.name) > 0):
|
||||||
if(user.usernotifications.filedir_delete_push):
|
newNotifiyPush(1, instance, " Datei wurde aktualisiert: ", "Aktualisierter Datei: ", "Dateien | ", "", "")
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Ordner gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Ordner | Ordner gelöscht: " + instance.name})
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=DataFile)
|
@receiver(pre_delete, sender=DataFile)
|
||||||
def del_file(sender, instance, **kwargs):
|
def del_file(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
newNotifiyPush(2, instance, " eine Datei wurde gelöscht: ", "Datei gelöscht: ", "Dateien | ", "", "")
|
||||||
|
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.filedir_delete_mail):
|
|
||||||
notificationtext = " eine Datei wurde gelöscht: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.filedir_delete_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Datei gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Dateiein | Datei gelöscht: " + instance.name})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# QUICKLINKS
|
||||||
@receiver(post_save, sender=QuickLinks)
|
@receiver(post_save, sender=QuickLinks)
|
||||||
def save_ql(sender, instance, **kwargs):
|
def save_ql(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt einen neuen Quicklink: ", "Neuer Quicklink: ", "Quicklinks | ", "", "")
|
||||||
# CREATED
|
elif(len(instance.name) > 0):
|
||||||
if(kwargs["created"]):
|
newNotifiyPush(1, instance, " Quicklink wurde aktualisiert: ", "Aktualisierter Quicklink: ", "Quicklinks | ", "", "")
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.ql_created_mail):
|
|
||||||
notificationtext = " es gibt einen neuen Quicklink: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.ql_created_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Neuer Quicklink: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Neuer Quicklink: " + instance.name})
|
|
||||||
# UPDATED
|
|
||||||
else:
|
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.ql_update_mail):
|
|
||||||
notificationtext = " Quicklink wurde aktualisiert: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.ql_update_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Quicklink aktualisiert: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Aktualisierter Quicklink: " + instance.name})
|
|
||||||
|
|
||||||
@receiver(pre_delete, sender=QuickLinks)
|
@receiver(pre_delete, sender=QuickLinks)
|
||||||
def del_ql(sender, instance, **kwargs):
|
def del_ql(sender, instance, **kwargs):
|
||||||
usersofagency = User.objects.filter(profile__agency__pk=instance.agency.pk)
|
newNotifiyPush(2, instance, " ein Quicklink wurde gelöscht: ", "Quicklink gelöscht: ", "Quicklinks | ", "", "")
|
||||||
|
|
||||||
|
# CONTACTS
|
||||||
|
@receiver(post_save, sender=AGContacts)
|
||||||
|
def save_contact(sender, instance, **kwargs):
|
||||||
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt einen neuen Kontakt: ", "Neuer Kontakt: ", "Kontakte | ", "", "")
|
||||||
|
elif(len(instance.name) > 0):
|
||||||
|
newNotifiyPush(1, instance, " Kontakt wurde aktualisiert: ", "Aktualisierter Kontakt: ", "Kontakte | ", "", "")
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=AGContacts)
|
||||||
|
def del_contact(sender, instance, **kwargs):
|
||||||
|
newNotifiyPush(2, instance, " ein Kontakt wurde gelöscht: ", "Kontakt gelöscht: ", "Kontakte | ", "", "")
|
||||||
|
|
||||||
|
# PASSWORDS
|
||||||
|
@receiver(post_save, sender=AGPassword)
|
||||||
|
def save_password(sender, instance, **kwargs):
|
||||||
|
if(kwargs["created"] and len(instance.name) > 0):
|
||||||
|
newNotifiyPush(0, instance, " es gibt ein neues Passwort: ", "Neues Passwort: ", "Passwörter | ", "", "")
|
||||||
|
elif(len(instance.name) > 0):
|
||||||
|
newNotifiyPush(1, instance, " Passwort wurde aktualisiert: ", "Aktualisiertes Passwort: ", "Passwörter | ", "", "")
|
||||||
|
|
||||||
|
@receiver(pre_delete, sender=AGPassword)
|
||||||
|
def del_password(sender, instance, **kwargs):
|
||||||
|
newNotifiyPush(2, instance, " ein Passwort wurde gelöscht: ", "Passwort gelöscht: ", "Passwörter | ", "", "")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for user in usersofagency:
|
|
||||||
if(user.usernotifications.ql_delete_mail):
|
|
||||||
notificationtext = " ein Quicklink wurde gelöscht: " + instance.name
|
|
||||||
sendMailNoti(notificationtext, user)
|
|
||||||
|
|
||||||
|
|
||||||
if(user.usernotifications.ql_delete_push):
|
|
||||||
newnotification = UserNotification(touser=user, notificationtext="Quicklink gelöscht: " + instance.name, notificationtype="", elementid=instance.pk)
|
|
||||||
newnotification.save()
|
|
||||||
|
|
||||||
channel_layer = channels.layers.get_channel_layer()
|
|
||||||
async_to_sync(channel_layer.group_send)("user_" + str(user.pk), {'type' : 'pushhandler', 'pushtext' : "pushnotification__Organizer | Quicklink gelöscht: " + instance.name})
|
|
||||||
|
|
||||||
# Join eines Agenturverbunds
|
# Join eines Agenturverbunds
|
||||||
@receiver(signal=post_save, sender=AgencyNetworkPreperation)
|
@receiver(signal=post_save, sender=AgencyNetworkPreperation)
|
||||||
|
|
|
||||||
|
|
@ -31,4 +31,4 @@ learn about Font Awesome.
|
||||||
All brand icons are trademarks of their respective owners. The use of these
|
All brand icons are trademarks of their respective owners. The use of these
|
||||||
trademarks does not indicate endorsement of the trademark holder by Font
|
trademarks does not indicate endorsement of the trademark holder by Font
|
||||||
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
|
Awesome, nor vice versa. **Please do not use brand logos for any purpose except
|
||||||
to represent the company, product, or service to which they refer.**
|
to represent the name, product, or service to which they refer.**
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
<h4>Kontakte</h4>
|
<h4>Kontakte</h4>
|
||||||
{% if res_contacts|length > 0 %}
|
{% if res_contacts|length > 0 %}
|
||||||
{% for s in res_contacts %}
|
{% for s in res_contacts %}
|
||||||
<i class="fas fa-users"></i> <a onclick="javascript:$('#infos_searchres_agc_{{s.pk}}').modal('toggle');" href="#\" ><b>{{s.company}}</b></a><br /><br />
|
<i class="fas fa-users"></i> <a onclick="javascript:$('#infos_searchres_agc_{{s.pk}}').modal('toggle');" href="#\" ><b>{{s.name}}</b></a><br /><br />
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% else %}
|
{% else %}
|
||||||
<p>Keine Ergebnisse in Kontakten</p>
|
<p>Keine Ergebnisse in Kontakten</p>
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
<div class="modal-dialog " role="document">
|
<div class="modal-dialog " role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.company}}</h5>
|
<h5 class="modal-title" id="exampleModalLongTitle">{{agc.name}}</h5>
|
||||||
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
<button type="button" class="close" data-dismiss="modal" aria-label="Schließen">
|
||||||
<span aria-hidden="true">×</span>
|
<span aria-hidden="true">×</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -635,7 +635,7 @@ def GlobalSearch(request):
|
||||||
res_news = News.objects.filter(agency__pk=ag).filter(name__icontains=searchfor) | News.objects.filter(agency__pk=ag).filter(content__icontains=searchfor) | News.objects.filter(agency__pk=ag).filter(created_by__last_name__icontains=searchfor)|News.objects.filter(agency__pk=ag).filter(created_by__first_name__icontains=searchfor)
|
res_news = News.objects.filter(agency__pk=ag).filter(name__icontains=searchfor) | News.objects.filter(agency__pk=ag).filter(content__icontains=searchfor) | News.objects.filter(agency__pk=ag).filter(created_by__last_name__icontains=searchfor)|News.objects.filter(agency__pk=ag).filter(created_by__first_name__icontains=searchfor)
|
||||||
|
|
||||||
res_pass = AGPassword.objects.filter(agency__pk=ag).filter(name__icontains=searchfor)
|
res_pass = AGPassword.objects.filter(agency__pk=ag).filter(name__icontains=searchfor)
|
||||||
res_contacts = AGContacts.objects.filter(agency__pk=ag).filter(personname__icontains=searchfor) | AGContacts.objects.filter(agency__pk=ag).filter(company__icontains=searchfor)
|
res_contacts = AGContacts.objects.filter(agency__pk=ag).filter(personname__icontains=searchfor) | AGContacts.objects.filter(agency__pk=ag).filter(name__icontains=searchfor)
|
||||||
|
|
||||||
|
|
||||||
res_areas = Areas.objects.filter(agency__pk=ag).filter(name__icontains=searchfor)
|
res_areas = Areas.objects.filter(agency__pk=ag).filter(name__icontains=searchfor)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue