models add field DocbowProfile.accept_notifications to allow user to block notifications, fixes #3635

This commit is contained in:
Benjamin Dauvergne 2013-09-17 21:23:45 +02:00
parent a208f055ed
commit b72fd7cd0a
4 changed files with 132 additions and 107 deletions

View File

@ -408,6 +408,7 @@ class ProfileForm(ModelForm):
self.request = request
self.layout = Layout(
'accept_notifications',
'personal_email',
HTML(_(u'<p class="formHint">If You would like to receive a SMS alert each '
u'time your inbox receives a document, provide your '
@ -472,7 +473,7 @@ class ProfileForm(ModelForm):
class Meta:
model = DocbowProfile
fields = ('personal_email', 'mobile_phone')
fields = ('accept_notifications', 'personal_email', 'mobile_phone')
class Media:
js = ('js/askdirtyform.js',)

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: docbow 1.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-09-13 19:00+0200\n"
"PO-Revision-Date: 2013-09-13 19:01+0200\n"
"POT-Creation-Date: 2013-09-17 21:20+0200\n"
"PO-Revision-Date: 2013-09-17 21:21+0200\n"
"Last-Translator: Benjamin Dauvergne <bdauvergne@entrouvert.com>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -27,11 +27,11 @@ msgstr "Activer les objets sélectionnés"
msgid "De-activate selected objects"
msgstr ""
#: admin.py:40 models.py:696
#: admin.py:40 models.py:697
msgid "Limitation des destinataires"
msgstr ""
#: admin.py:45 models.py:693
#: admin.py:45 models.py:694
msgid "Limitation des types de fichier"
msgstr ""
@ -76,7 +76,7 @@ msgid "Clear failure and done field, resubmitting the notifications."
msgstr ""
"Réinitialise les champs accompli et erreur, et re-soumet la notification."
#: admin.py:224 models.py:183
#: admin.py:224 models.py:184
msgid "Document"
msgstr "Document"
@ -142,7 +142,7 @@ msgstr "Contacter un administrateur du système"
msgid "Your delegation does not allow you to do this action"
msgstr "Votre délégation ne vous permet pas d'accomplir cette action"
#: fields.py:69 forms.py:61 forms.py:115 models.py:260
#: fields.py:69 forms.py:61 forms.py:115 models.py:261
msgid "Recipients"
msgstr "Destinataire(s)"
@ -151,7 +151,7 @@ msgid "you must set at least one user recipient or one list recipient..."
msgstr ""
"Vous devez choisir au moins un utilisateur ou une liste destinataire..."
#: forms.py:62 models.py:190
#: forms.py:62 models.py:191
msgid "Sender"
msgstr "Expéditeur"
@ -163,7 +163,7 @@ msgstr "Transférer le document"
msgid "send a file"
msgstr "Envoyer le document"
#: forms.py:170 models.py:221 models.py:239
#: forms.py:170 models.py:222 models.py:240
msgid "Attached files"
msgstr "Fichiers attaché(s)"
@ -194,7 +194,7 @@ msgstr "Sujet"
msgid "Message"
msgstr "Message"
#: forms.py:291 models.py:486 models.py:575
#: forms.py:291 models.py:487 models.py:576
msgid "Name"
msgstr "Nom"
@ -272,7 +272,7 @@ msgstr ""
"Une règle de transfert doit contenir au moins un nouveau destinataire; une "
"personne ou une liste."
#: forms.py:412
#: forms.py:413
msgid ""
"<p class=\"formHint\">If You would like to receive a SMS alert each time "
"your inbox receives a document, provide your mobile phone number. If you do "
@ -283,15 +283,15 @@ msgstr ""
"de téléphone. Si vous ne remplissez pas ce champ, vous ne recevrez pas de "
"SMS.</p>"
#: forms.py:418
#: forms.py:419
msgid "Clear SMS alert"
msgstr "Supprimer l'alerte par SMS"
#: forms.py:419
#: forms.py:420
msgid "Validate"
msgstr "Valider"
#: forms.py:426
#: forms.py:427
msgid ""
"Use international phone number format, i.e +[country code][number]. A "
"challenge SMS will be sent to you to validate it."
@ -301,20 +301,21 @@ msgstr ""
"code vous sera envoyé et il vous faudra valider une deuxième fois votre "
"numéro avec le code."
#: forms.py:458
#: forms.py:459
msgid "Unable to send you the SMS code, try again."
msgstr "L'envoi du code de vérification de votre numéro mobile a échoué; "
"veuillez ré-essayer plus tard."
msgstr ""
"L'envoi du code de vérification de votre numéro mobile a échoué; veuillez ré-"
"essayer plus tard."
#: forms.py:462
#: forms.py:463
msgid "Enter code received by SMS"
msgstr "Entrez le code reçu par SMS"
#: forms.py:483
#: forms.py:484
msgid "E-mail or identifier"
msgstr "E-mail ou nom d'utilisateur"
#: forms.py:499
#: forms.py:500
msgid ""
"That e-mail address or identifier doesn't have an associated user account. "
"Are you sure you've registered?"
@ -322,172 +323,172 @@ msgstr ""
"Cette adresse email ou cet identifiant n'ont pas de compte utilisateur "
"associé.Êtes-vous bien sûr d'être enregistré?"
#: forms.py:517
#: forms.py:518
msgid "From"
msgstr "De"
#: forms.py:518 templates/docbow/message.html:34
#: forms.py:519 templates/docbow/message.html:34
msgid "To"
msgstr "Destinataire(s)"
#: forms.py:533
#: forms.py:534
msgid "From must be inferior or equal to To"
msgstr "Le début de la période doit être inférieur ou égal à sa fin"
#: models.py:27
#: models.py:28
msgid "docbow"
msgstr "Plateforme sécurisée d'échange de documents"
#: models.py:28
#: models.py:29
msgid "Docbow_App"
msgstr "Plate-forme sécurisée d'échange de documents"
#: models.py:29
#: models.py:30
msgid "Docbow_app"
msgstr "Plate-forme sécurisée d'échange de documents"
#: models.py:59 models.py:581
#: models.py:60 models.py:582
msgid "is active"
msgstr "Activé"
#: models.py:66
#: models.py:67
msgid "File type"
msgstr "Type de fichier"
#: models.py:67
#: models.py:68
msgid "File types"
msgstr "Types de fichier"
#: models.py:82
#: models.py:83
msgid "name"
msgstr "Nom"
#: models.py:83
#: models.py:84
msgid "document type"
msgstr "Type de document"
#: models.py:84
#: models.py:85
msgid "mime types"
msgstr "Types MIME"
#: models.py:88
#: models.py:89
msgid "cardinality"
msgstr "nombre de fichiers maximum"
#: models.py:89
#: models.py:90
msgid "zero is a special value setting no limitation"
msgstr "zéro est une valeur spéciale qui signifie \"sans limitation\""
#: models.py:91
#: models.py:92
msgid "minimum number of files"
msgstr "nombre de fichiers minimum"
#: models.py:92
#: models.py:93
msgid "position"
msgstr ""
#: models.py:96
#: models.py:97
msgid ""
"minimum must be inferior to maximum number of files if maximum is not zero"
msgstr ""
"le minimum doit être inférieur au maximum du nombre de fichiers si le "
"maximum n'est pas nul"
#: models.py:99
#: models.py:100
msgid "invalid mime types list"
msgstr "liste de types MIME invalide"
#: models.py:116
#: models.py:117
msgid "file type attached file kind"
msgstr "Type de fichiers attachés pour un type de document"
#: models.py:117
#: models.py:118
msgid "file type attached file kinds"
msgstr "Types de fichiers attachés pour un type de document"
#: models.py:131
#: models.py:132
msgid "Content"
msgstr "Description des contenus"
#: models.py:132
#: models.py:133
msgid "Contents"
msgstr "Descriptions des contenus"
#: models.py:184 templates/docbow/mailbox_list.html:18
#: models.py:185 templates/docbow/mailbox_list.html:18
msgid "Documents"
msgstr "Documents"
#: models.py:186
#: models.py:187
msgid "Can forward documents"
msgstr "Peut transférer des documents"
#: models.py:192
#: models.py:193
msgid "Real sender"
msgstr "Expéditeur réel"
#: models.py:194
#: models.py:195
msgid "Date d'envoi"
msgstr ""
#: models.py:196
#: models.py:197
msgid "Users to send to"
msgstr "Aux utilisateurs"
#: models.py:198
#: models.py:199
msgid "Groups to send to"
msgstr "Aux listes des"
#: models.py:199
#: models.py:200
msgid "Document type"
msgstr "Type de document"
#: models.py:201
#: models.py:202
msgid "Comments"
msgstr "Description du contenu"
#: models.py:203
#: models.py:204
msgid "Reply to"
msgstr "Réponse à"
#: models.py:215
#: models.py:216
msgid ""
"document {id} sent on {date} of type {filetype} about {comment} by {sender}"
msgstr ""
"document {id} envoyé le {date} du type {filetype} à propos de {comment} par "
"{sender}"
#: models.py:407
#: models.py:408
msgid ""
"forwarded document {from_document} as {to_document} on {date} automatically"
msgstr ""
"document {from_document} transféré en {to_document} le {date} automatiquement"
#: models.py:412
#: models.py:413
msgid "forwarded document {from_document} as {to_document} on {date}"
msgstr "document {from_document} transféré en {to_document} le {date}"
#: models.py:435
#: models.py:436
msgid "filetype"
msgstr "Type de fichier"
#: models.py:438
#: models.py:439
msgid "Original recipients"
msgstr "Destinataires d'origine"
#: models.py:439
#: models.py:440
msgid "At least one recipient must match for the rule to apply."
msgstr ""
"Au moins un destinataire doit correspondre pour que la règle s'applique."
#: models.py:442
#: models.py:443
msgid "Users to forward to"
msgstr "Aux utilisateurs"
#: models.py:444
#: models.py:445
msgid "Groups to forward to"
msgstr "Aux listes des"
#: models.py:455
#: models.py:456
msgid ""
"Forward documents of type {filetypes} and to {originaly_to_user} "
"automatically to {to}"
@ -495,95 +496,95 @@ msgstr ""
"Transfert les documents du type {filetypes} et à destination de "
"{originaly_to_user} automatiquement à {to}"
#: models.py:457
#: models.py:458
msgid "Forward documents of type {filetypes} automatically to {to}"
msgstr "Transfert les documents du type {filetypes} automatiquement à {to}"
#: models.py:459
#: models.py:460
msgid "Forward documents to {originaly_to_user} automatically to {to}"
msgstr ""
"Transfert les documents à destination de {originaly_to_user} automatiquement "
"à {to}"
#: models.py:480
#: models.py:481
msgid "Automatic forwarding rule"
msgstr "Règle de transfert automatique"
#: models.py:481
#: models.py:482
msgid "Automatic forwarding rules"
msgstr "Règles de transfert automatique"
#: models.py:487
#: models.py:488
msgid "File"
msgstr "Fichier"
#: models.py:488
#: models.py:489
msgid "Attached to"
msgstr "Attaché à"
#: models.py:491
#: models.py:492
msgid "attached file kind"
msgstr "Type de fichiers attachés pour un type de document"
#: models.py:531
#: models.py:532
msgid "Account delegation"
msgstr "Délégation de compte"
#: models.py:532
#: models.py:533
msgid "Account delegations"
msgstr "Délégations de compte"
#: models.py:536
#: models.py:537
msgctxt "delegation from"
msgid "From"
msgstr "Par"
#: models.py:538
#: models.py:539
msgctxt "delegation to"
msgid "To"
msgstr "À"
#: models.py:573
#: models.py:574
msgid "Mailing list"
msgstr "Liste de destinataires"
#: models.py:574
#: models.py:575
msgid "Mailing lists"
msgstr "Listes de destinataires"
#: models.py:576
#: models.py:577
msgid "Members"
msgstr "Membres"
#: models.py:579
#: models.py:580
msgid "Mailing lists members"
msgstr "Listes membres"
#: models.py:623
#: models.py:624
msgid "Mailbox owner"
msgstr "Propriétaire de la boite de courrier"
#: models.py:627
#: models.py:628
msgid "Seen"
msgstr "Vu"
#: models.py:628
#: models.py:629
msgid "Deleted"
msgstr "Effacé"
#: models.py:629
#: models.py:630
msgid "Outbox message"
msgstr "Boite d'émission"
#: models.py:635
#: models.py:636
msgid "Mailbox"
msgstr "Boite de réception"
#: models.py:636
#: models.py:637
msgid "Mailboxes"
msgstr "Boites de réception"
#: models.py:640
#: models.py:641
msgid ""
"seen and deleted mailbox entry {id} of user {user}:{user.id} created on "
"{date} for {document}"
@ -591,7 +592,7 @@ msgstr ""
"entrée {id} de la boite au lettre de l'utilisateur {user}:{user.id} créée le "
"{date} pour le document {document} puis lue et supprimée"
#: models.py:645
#: models.py:646
msgid ""
"deleted mailbox entry {id} of user {user}:{user.id} created on {date} for "
"{document}"
@ -599,7 +600,7 @@ msgstr ""
"entrée {id} de la boite au lettre de l'utilisateur {user}:{user.id} créée le "
"{date} pour le document {document} puis jamais lue et supprimée"
#: models.py:650
#: models.py:651
msgid ""
"seen mailbox entry {id} of user {user}:{user.id} created on {date} for "
"{document}"
@ -607,42 +608,42 @@ msgstr ""
"entrée {id} de la boite au lettre de l'utilisateur {user}:{user.id} créée le "
"{date} pour le document {document} puis jamais lue"
#: models.py:655
#: models.py:656
msgid ""
"mailbox entry {id} of user {user}:{user.id} created on {date} for {document}"
msgstr ""
"entrée {id} de la boite au lettre de l'utilisateur {user}:{user.id} créée le "
"{date} pour le document {document}"
#: models.py:662
#: models.py:663
msgid "Docbow admin user"
msgstr "Utilisateur"
#: models.py:669
#: models.py:670
msgid "Docbow admin group"
msgstr "Profil"
#: models.py:677
#: models.py:678
msgid "Inbox"
msgstr "Message(s) reçu(s)"
#: models.py:678
#: models.py:679
msgid "Inboxes"
msgstr "Message(s) reçu(s)"
#: models.py:684
#: models.py:685
msgid "Outbox"
msgstr "Message(s) émi(s)"
#: models.py:685
#: models.py:686
msgid "Outboxes"
msgstr "Message(s) émi(s)"
#: models.py:699 models.py:700
#: models.py:700 models.py:701
msgid "Limitation par liste de destinataires"
msgstr ""
#: models.py:704
#: models.py:705
msgid ""
"sending limitation for list {mailing_list} to filetypes{filetypes} and lists "
"{lists}"
@ -650,19 +651,19 @@ msgstr ""
"limitation d'envoi pour la liste {mailing_list} restreinte auxtypes de "
"fichier {filetypes} et aux listes {lists}"
#: models.py:714
#: models.py:715
msgid "Guest user"
msgstr "Utilisateur invité"
#: models.py:715
#: models.py:716
msgid "Mobile phone"
msgstr "Téléphone mobile"
#: models.py:717
#: models.py:718
msgid "personal email address"
msgstr "Adresse email personnelle"
#: models.py:718
#: models.py:719
msgid ""
"if you provide a personal email address, notifications of new documents will "
"also be sent to this address."
@ -672,12 +673,22 @@ msgstr ""
"(identique au mail que vous recevez sur votre adresse institutionnelle)."
#: models.py:722
msgid "Accept to be notified"
msgstr "Accepte les notifications"
#: models.py:723
msgid ""
"If unchecked you will not received notifications anymore, by email or SMS."
msgstr ""
"Si décoché, vous ne recevrez plus aucune notification, ni par email ni par SMS."
#: models.py:727
msgid ""
"docbow profile of {user}:{user.id} with mobile phone {mobile_phone} and "
"personal email {personal_email}"
msgstr ""
#: models.py:760
#: models.py:769
msgid "notification {0}:{1}"
msgstr ""
@ -762,7 +773,7 @@ msgstr "nom de fichier trop long, seulement %d caractères sont permis"
msgid "too much file attached, delete to add a new one"
msgstr "trop de fichiers attachés, supprimez en un pour en ajouter un autre"
#: views.py:172
#: views.py:196
msgid ""
"An internal error occured, administrators have been notified; sending seems "
"blocked at the moment. You should try agrain later. If it still does not "
@ -773,26 +784,26 @@ msgstr ""
"incitons à réessayer plus tard. Si cela ne fonctionne toujours pas, prenez "
"contact avec les gestionnaires."
#: views.py:233
#: views.py:257
msgid "back to inbox"
msgstr "Retour aux documents reçus"
#: views.py:235
#: views.py:259
msgid "back to outbox"
msgstr "Retour aux documents envoyés"
#: views.py:249
#: views.py:276
msgid "Document forwarded to {recipients_count} recipient."
msgid_plural "Document forwarded to {recipients_count} recipients."
msgstr[0] "Document tranféré à {recipients_count} destinataire."
msgstr[1] "Document tranféré à {recipients_count} destinataires."
#: views.py:319 views.py:323
#: views.py:347 views.py:351
#, python-format
msgid "Message from %(name)s <%(email)s>"
msgstr "Message de %(name)s <%(email)s>"
#: views.py:325
#: views.py:353
#, python-format
msgid ""
"\n"
@ -801,17 +812,17 @@ msgstr ""
"\n"
"Numéro de téléphone: %s"
#: views.py:330
#: views.py:358
#, python-format
msgid "Your message was sent to %d administrators"
msgstr "Votre message a été envoyé à %d administrateurs."
#: views.py:365
#: views.py:393
#, python-format
msgid "back to %s"
msgstr "Retour à %s"
#: views.py:443
#: views.py:471
msgid "Email with password reset instruction has been sent."
msgstr ""
"Un email avec les instructions pour la réinitialisation de votre mot de "

View File

@ -718,6 +718,10 @@ class DocbowProfile(Model):
personal_email = EmailField(_('personal email address'), blank=True,
help_text=_('if you provide a personal email address, notifications '
'of new documents will also be sent to this address.'))
accept_notifications = BooleanField(
verbose_name=_('Accept to be notified'), blank=True, default=True,
help_text=_("If unchecked you will not received notifications "
"anymore, by email or SMS."))
def __unicode__(self):
return _(u'docbow profile of {user}:{user.id} with mobile phone '
@ -732,6 +736,8 @@ class NotificationManager(Manager):
'''Build notifications in bulk'''
users = utils.queryset_fixpoint(users,
lambda s: User.objects.filter(delegations_by__by__in=s))
users = User.objects.filter(pk__in=[u.pk for u in users]) \
.exclude(docbowprofile__accept_notifications=False)
notifications = [Notification(user=user, document=document, kind=kind, ctx=ctx)
for user in users]
self.bulk_create(notifications)

View File

@ -533,3 +533,10 @@ tr.last-connection td {
font-style: italic;
font-size: 90%;
}
#div_id_profile-accept_notifications label {
display: inline;
}
.ctrlHolder {
margin-bottom: 10px;
}