Permalink
Browse files

show where report will be sent

  • Loading branch information...
1 parent 6c07c66 commit ab546e82d4662fc697031d81e18b326174503093 @visiblegovernment visiblegovernment committed Mar 9, 2011
Binary file not shown.
@@ -8,19 +8,54 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2011-02-02 12:57-0500\n"
+"POT-Creation-Date: 2011-03-09 18:25-0500\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-#: mainapp/forms.py:13 mainapp/models.py:241 mainapp/models.py:289
+#: mainapp/emailrules.py:18 mainapp/emailrules.py:104
+msgid "All reports"
+msgstr "Tous les rapports"
+
+#: mainapp/emailrules.py:24
+msgid "the councillor's email address"
+msgstr "Qui peut voir mon adresse courriel?"
+
+#: mainapp/emailrules.py:37
+#, python-format
+msgid "'%s' reports"
+msgstr "'%s' rapports"
+
+#: mainapp/emailrules.py:56
+#, python-format
+msgid "non-'%s' reports"
+msgstr "non-'%s' rapports"
+
+#: mainapp/emailrules.py:75
+#, python-format
+msgid "%s will be "
+msgstr "%s seront "
+
+#: mainapp/emailrules.py:77
+msgid "sent to:"
+msgstr "envoyé à:"
+
+#: mainapp/emailrules.py:81
+msgid " and "
+msgstr " et "
+
+#: mainapp/emailrules.py:84
+msgid "cc'd to:"
+msgstr "cc'd à:"
+
+#: mainapp/forms.py:13 mainapp/models.py:266 mainapp/models.py:314
msgid "Name"
msgstr "Nom"
-#: mainapp/forms.py:16 mainapp/models.py:288
+#: mainapp/forms.py:16 mainapp/models.py:313
msgid "Email"
msgstr "Courriel"
@@ -32,44 +67,23 @@ msgstr "Message"
msgid "Select a Category"
msgstr "Choisissez une Catégorie"
-#: mainapp/models.py:216
+#: mainapp/models.py:241
msgid "Subject"
msgstr "Sujet"
-#: mainapp/models.py:239
+#: mainapp/models.py:264
msgid "* Photo"
msgstr "* Photo"
-#: mainapp/models.py:240 mainapp/models.py:283
+#: mainapp/models.py:265 mainapp/models.py:308
msgid "Details"
msgstr "Détails"
-#: mainapp/models.py:290
+#: mainapp/models.py:315
msgid "Phone"
msgstr "Téléphone"
-#: mainapp/views/main.py:43
-msgid ""
-"Sorry, we couldn't retreive the coordinates of that location, please use the "
-"Back button on your browser and try something more specific or include the "
-"city name at the end of your search."
-msgstr ""
-"Désolé, nous n'avons pas pu retrouver les coordonnées de cet endroit, s'il "
-"vous plaît cliquer sur le bouton de votre navigateur et essayez quelque "
-"chose de plus spécifique ou inclure le nom de la ville à la fin de votre "
-"recherche."
-
-#: mainapp/views/main.py:46
-msgid ""
-"Sorry, we couldn't find the address you entered. Please try again with "
-"another intersection, address or postal code, or add the name of the city to "
-"the end of the search."
-msgstr ""
-"Désolé, nous n'avons pas pu trouver l'adresse que vous avez entrée. S'il "
-"vous plaît essayer de nouveau avec une autre intersection, adresse ou le "
-"code postal, ou ajouter le nom de la ville."
-
-#: mainapp/views/main.py:65
+#: mainapp/views/main.py:51
msgid ""
"Sorry, we don't yet have that area in our database. Please have your area "
"councillor contact fixmystreet.ca."
@@ -85,7 +99,7 @@ msgstr "Vous vous avez déjà abonné aux mises à jour de ce rapport."
msgid "You have unsubscribed from updates to:"
msgstr "Vous vous avez désabonné des mises à jour de:"
-#: templates/about.html:4 templates/about.html.py:9 templates/base.html:60
+#: templates/about.html:4 templates/about.html.py:9 templates/base.html:61
#: templates/faq/show.html:3 templates/faq/show.html.py:7
msgid "About"
msgstr "À Propos"
@@ -148,49 +162,43 @@ msgstr "FixMyStreet (réparer ma rue) Canada"
msgid "Home"
msgstr "Page d'accueil"
-#: templates/base.html:58
+#: templates/base.html:59
msgid "Submit a Report"
msgstr "Soumettre un Rapport"
-#: templates/base.html:59
+#: templates/base.html:60
msgid "View Reports"
msgstr "Voyer Rapports"
-#: templates/base.html:61 templates/contact/new.html:8
+#: templates/base.html:62 templates/contact/new.html:8
msgid "Contact Us"
msgstr "Contactez Nous"
-#: templates/base.html:88
+#: templates/base.html:91
msgid "Promotions"
msgstr "Promotions"
-#: templates/home.html:18
-msgid ""
-"That address returned more than one result. Please try again, or select an "
-"option below:"
-msgstr ""
-
-#: templates/home.html:28
+#: templates/home.html:26
msgid "report/view/discuss"
msgstr "rapporter/voir/discuté"
-#: templates/home.html:29
+#: templates/home.html:27
msgid "graffiti."
msgstr "graffiti."
-#: templates/home.html:30
+#: templates/home.html:28
msgid "potholes."
msgstr "nid de poules."
-#: templates/home.html:31
+#: templates/home.html:29
msgid "excessive"
msgstr "excessif"
-#: templates/home.html:33
+#: templates/home.html:31
msgid "street"
msgstr "rue"
-#: templates/home.html:39
+#: templates/home.html:37
msgid "Enter a nearby postal code, or street name and city:"
msgstr ""
"Entrez un code postal à proximité, ou le nom de la rue et de la région:"
@@ -475,6 +483,10 @@ msgstr ""
msgid "Submit"
msgstr "Envoyez"
+#: templates/reports/new.html:98
+msgid "Where will my report be sent?"
+msgstr "Où en rapport soit envoyé?"
+
#: templates/reports/show.html:31 templates/reports/show.html.py:99
msgid "This problem has been fixed."
msgstr "Ce problème a été résolu."
@@ -648,11 +660,11 @@ msgstr ""
"filter les courriels indésirables, s.v.p. vérifier vos dossiers de courriel "
"spam.\n"
"Vous devez maintenant cliquer sur le lien dans le courriel que nous venons "
-"de vous envoyer – si vous ne le faite pas, votre mise à jour ne sera pas activée."
-"</p>\n"
+"de vous envoyer – si vous ne le faite pas, votre mise à jour ne sera pas "
+"activée.</p>\n"
"\n"
-"<p>(Ne vous inquiétez pas - nous nous rappellerons de votre mise à jour pendant "
-"que vous vérifier votre courriel.)</p>\n"
+"<p>(Ne vous inquiétez pas - nous nous rappellerons de votre mise à jour "
+"pendant que vous vérifier votre courriel.)</p>\n"
#: templates/wards/_info_box.html:6
msgid "Councillor"
@@ -676,6 +688,25 @@ msgstr ""
"Note: fixmystreet.ca s'appuie sur les utilisateurs pour signaler les "
"problèmes comme étant résolus."
+#~ msgid ""
+#~ "Sorry, we couldn't retreive the coordinates of that location, please use "
+#~ "the Back button on your browser and try something more specific or "
+#~ "include the city name at the end of your search."
+#~ msgstr ""
+#~ "Désolé, nous n'avons pas pu retrouver les coordonnées de cet endroit, "
+#~ "s'il vous plaît cliquer sur le bouton de votre navigateur et essayez "
+#~ "quelque chose de plus spécifique ou inclure le nom de la ville à la fin "
+#~ "de votre recherche."
+
+#~ msgid ""
+#~ "Sorry, we couldn't find the address you entered. Please try again with "
+#~ "another intersection, address or postal code, or add the name of the city "
+#~ "to the end of the search."
+#~ msgstr ""
+#~ "Désolé, nous n'avons pas pu trouver l'adresse que vous avez entrée. S'il "
+#~ "vous plaît essayer de nouveau avec une autre intersection, adresse ou le "
+#~ "code postal, ou ajouter le nom de la ville."
+
#~ msgid "Please select a category"
#~ msgstr "S'il vous plaît choisir une catégorie"
@@ -809,9 +840,6 @@ msgstr ""
#~ "mises à jour que nous considérons comme étant inappropriés une fois "
#~ "averti par un utilisateur du site."
-#~ msgid "Who gets to see my email address?"
-#~ msgstr "Qui peut voir mon adresse courriel?"
-
#~ msgid ""
#~ "If you submit a problem, we pass on your contact details, and details of "
#~ "the problem, to the municipality contact responsible for the area where "
View
@@ -91,6 +91,9 @@ class Meta:
class EmailRuleAdmin(admin.ModelAdmin):
+ change_list_template = 'admin/mainapp/emailrules/change_list.html'
+
+
def queryset(self,request):
if request.user.is_superuser:
return( super(EmailRuleAdmin,self).queryset(request) )
@@ -109,5 +112,14 @@ def get_form(self, request, obj=None, **kwargs):
return( SuperUserRuleForm )
else:
return( CityAdminRuleForm )
+
+ def changelist_view(self, request, extra_context=None):
+ if not request.user.is_superuser:
+ profile = request.user.get_profile()
+ if extra_context == None:
+ extra_context = {}
+ extra_context['city'] = profile.city
+ return(super(EmailRuleAdmin,self).changelist_view(request,extra_context))
+
admin.site.register(EmailRule,EmailRuleAdmin)
View
@@ -1,19 +1,28 @@
+from django.utils.translation import ugettext as _
class EmailRuleBehaviour(object):
def get_email(self,report,email_rule):
return(None)
def describe(self, email_rule):
return("")
-
+
class ToCouncillor(EmailRuleBehaviour):
def get_email(self, report, email_rule):
return( report.ward.councillor.email )
def describe(self, email_rule ):
return("Send Reports to Councillor's Email Address")
+
+ def report_group(self, email_rule):
+ return(_("All reports"))
+ def value_for_ward(self, email_rule, ward):
+ return( ward.councillor.email )
+ def value_for_city(self,email_rule):
+ return(_("the councillor's email address"))
+
class MatchingCategoryClass(EmailRuleBehaviour):
def get_email(self,report, email_rule):
if report.category.category_class == email_rule.category_class:
@@ -24,6 +33,15 @@ def get_email(self,report, email_rule):
def describe(self,email_rule):
return('Send All Reports Matching Category Type %s To %s' % (email_rule.category_class.name_en, email_rule.email))
+ def report_group(self, email_rule ):
+ return(_("'%s' reports") % ( email_rule.category_class.name ) )
+
+ def value_for_ward(self, email_rule, ward):
+ return( email_rule.email )
+
+ def value_for_city(self,email_rule):
+ return(email_rule.email)
+
class NotMatchingCategoryClass(EmailRuleBehaviour):
def get_email(self,report, email_rule):
if report.category.category_class != email_rule.category_class:
@@ -33,3 +51,71 @@ def get_email(self,report, email_rule):
def describe(self,email_rule):
return('Send All Reports Not Matching Category Type %s To %s' % (email_rule.category_class.name_en, email_rule.email))
+
+ def report_group(self, email_rule):
+ return(_("non-'%s' reports") % ( email_rule.category_class.name ) )
+
+ def value_for_ward(self, email_rule, ward):
+ return( email_rule.email )
+
+ def value_for_city(self,email_rule):
+ return(email_rule.email)
+
+# Creates a human-readable description of a single email rule
+# in the context of a particular ward or city.
+
+class EmailRuleDescriber:
+
+ def __init__(self, desc):
+ self.cc = []
+ self.to = []
+ self.desc = desc
+
+ def __unicode__(self):
+ s = _("%s will be ") % (self.desc)
+ if len(self.to) != 0:
+ s += _("sent to:")
+ s += ",".join(self.to)
+
+ if len(self.to) != 0 and len(self.cc) != 0:
+ s += _(" and ")
+
+ if len(self.cc) != 0:
+ s += _("cc'd to:")
+ s += ",".join(self.cc)
+ return( s )
+
+ def add_rule(self, rule, ward ):
+ value = rule.value(ward)
+ if rule.is_cc:
+ self.cc.append(value)
+ else:
+ self.to.append(value)
+
+
+# Creates a human-readable description of an email rule set
+# for a particular ward or city.
+
+class EmailRulesDesciber:
+
+ def __init__(self, rules, city, ward = None):
+ self.rule_set = {}
+ if city.email:
+ city_email = EmailRuleDescriber( _('All reports') )
+ city_email.to.append(city.email)
+ self.rule_set[city_email.desc] = city_email
+
+ for rule in rules:
+ label = rule.label()
+ if not self.rule_set.has_key( label ):
+ self.rule_set[ label ] = EmailRuleDescriber( label )
+
+ describer = self.rule_set[ label ]
+ describer.add_rule( rule, ward )
+
+ def values(self):
+ ret = self.rule_set.values()
+ ret.reverse()
+ return( ret )
+
+
Oops, something went wrong.

0 comments on commit ab546e8

Please sign in to comment.