From e1ba40720937af85499f99dd5cbd1a3745703790 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Fri, 17 May 2013 11:26:36 +0200 Subject: [PATCH] new person fields salutation and (academic) title --- organize/interfaces.py | 42 +++++++++++----- .../de/LC_MESSAGES/cybertools.organize.mo | Bin 1134 -> 1402 bytes .../de/LC_MESSAGES/cybertools.organize.po | 46 ++++++++++++------ util/__init__.py | 22 ++++++++- 4 files changed, 82 insertions(+), 28 deletions(-) diff --git a/organize/interfaces.py b/organize/interfaces.py index bfd2b3b..afc3568 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2011 Helmut Merz helmutm@cy55.de +# Copyright (c) 2013 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Interfaces for organizational stuff like persons, addresses, tasks, services... - -$Id$ """ from zope import schema @@ -30,6 +28,7 @@ from zope.i18nmessageid import MessageFactory from cybertools.composer.schema.factory import Email from cybertools.tracking.interfaces import ITrack from cybertools.util.jeep import Jeep, Term +from cybertools.util import KeywordVocabulary _ = MessageFactory('cybertools.organize') @@ -43,31 +42,48 @@ class LinesList(schema.List): pass # persons, addresses, ... +salutations = ((None, u''), + ('m', _(u'Mr')), + ('f', _(u'Mrs'))) + + class IPerson(Interface): """ Resembles a human being with a name (first and last name), a birth date, and a set of addresses. """ + salutation = schema.Choice( + title=_(u'Salutation'), + description=_(u'Salutation in letter.'), + vocabulary=KeywordVocabulary(salutations), + default=None, + required=False) + + academicTitle = schema.TextLine( + title=_(u'Academic Title'), + description=_(u'Academic title or name affix.'), + required=False) + firstName = schema.TextLine( - title=_(u'First name'), - description=_(u'The first name'), + title=_(u'First Name'), + description=_(u'The first name.'), required=False,) lastName = schema.TextLine( - title=_(u'Last name'), - description=_(u'The last name or surname'),) - email = Email(title=_(u'E-Mail address'), - description=_(u'The standard email address of the person'),) + title=_(u'Last Name'), + description=_(u'The last name or surname.'),) + email = Email(title=_(u'E-Mail Address'), + description=_(u'The standard email address of the person.'),) #phoneNumbers = SimpleList( phoneNumbers = schema.List( value_type=schema.TextLine(), default=[], - title=_(u'Phone numbers'), - description=_(u'Note one or more phone numbers here'), + title=_(u'Phone Numbers'), + description=_(u'Note one or more phone numbers here.'), required=False,) birthDate = schema.Date( - title=_(u'Date of birth'), + title=_(u'Date of Birth'), description=_(u'The date of birth - should be a ' - 'datetime.date object'), + 'datetime.date object.'), required=False,) age = schema.Int( diff --git a/organize/locales/de/LC_MESSAGES/cybertools.organize.mo b/organize/locales/de/LC_MESSAGES/cybertools.organize.mo index 60bf080b4c0310608a53e795c62ba0499a332ac6..14b572521c0a5bb42d67be95e4b5511fe9813517 100644 GIT binary patch literal 1402 zcmZvbL5~wR6vs_V3xrZ&5fVtP^rS9Qk#IIyx?&ZeBD>APN}DZ$6bUZKn|YZrcs!BE z1MG6?k!w}87moBJ^w>(R_yT+Y)N2n&9QXwNze&{>oQdVDe1}6x83%5voAuoGWKP{Su8Jnw!q0t@_2f844o!7Cnh+P(PPS%v+TG8&(lkPzpRh?yiJ2}bN2Lr~$NCKL~N81-hN?_df# zI<&Z%EH-X_JJ9QaYiU}prbElE)~aqV>sFiE%biw>)_Vi^>0A8B%Fch?+81?eMYk`_ zxyfDWK`_2_CKjPXH`wJ>q&|l|x{}pKer>qBveHcW>&BMxX=PH@12%bwTv3cmO861G zLX`i{j{au9x1U10*=np8KC(yD-7&;ReiE0)&RBn$hM5T^$E)8BHuUPgpQsyg&^dmoeoX#-sn&QFVP_M4TKuG00Tq#6m>cgJ~I}_p2|0epGpET0?a_Y5vb=0`AO=5CzCQJh3c!b#FwihFVL zgeQ_0(@=1A-006C-Hp0&wKn^udfdEIy=(UG(vIXZau&Z_h_|#Va?y@o2^?j^c!**fyw{? diff --git a/organize/locales/de/LC_MESSAGES/cybertools.organize.po b/organize/locales/de/LC_MESSAGES/cybertools.organize.po index 3f1f5c8..4744b23 100644 --- a/organize/locales/de/LC_MESSAGES/cybertools.organize.po +++ b/organize/locales/de/LC_MESSAGES/cybertools.organize.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: $Id$\n" "POT-Creation-Date: 2008-12-01 12:00 CET\n" -"PO-Revision-Date: 2010-02-20 12:00 CET\n" +"PO-Revision-Date: 2013-05-17 12:00 CET\n" "Last-Translator: Helmut Merz \n" "Language-Team: loops developers \n" "MIME-Version: 1.0\n" @@ -11,31 +11,49 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Generated-By: kwrite\n" -msgid "First name" +msgid "Salutation" +msgstr "Anrede" + +msgid "Salutation in letter." +msgstr "Bitte Anrede auswählen." + +msgid "Academic Title" +msgstr "Titel/Namenszusatz" + +msgid "Academic title or name affix." +msgstr "Akademischer Titel oder Namenszusatz." + +msgid "Mr" +msgstr "Herr" + +msgid "Mrs" +msgstr "Frau" + +msgid "First Name" msgstr "Vorname" -msgid "The first name" -msgstr "Bitte den oder die Vornamen eingeben" +msgid "The first name." +msgstr "Bitte den Vornamen eingeben." -msgid "Last name" +msgid "Last Name" msgstr "Nachname" -msgid "The last name or surname" -msgstr "Bitte den Nachnamen eingeben" +msgid "The last name or surname." +msgstr "Bitte den Nachnamen eingeben." -msgid "E-Mail address" +msgid "E-Mail Address" msgstr "E-Mail-Adresse" -msgid "The standard email address of the person" -msgstr "Bitte eine gültige E-Mail-Adresse eingeben" +msgid "The standard email address of the person." +msgstr "Bitte eine gültige E-Mail-Adresse eingeben." -msgid "Phone numbers" +msgid "Phone Numbers" msgstr "Telefonnummern" -msgid "Note one or more phone numbers here" -msgstr "Bitte eine oder mehrere Telefonnummern (je Zeile eine) eingeben" +msgid "Note one or more phone numbers here." +msgstr "Bitte eine oder mehrere Telefonnummern (je Zeile eine) eingeben." -msgid "Date of birth" +msgid "Date of Birth" msgstr "Geburtsdatum" msgid "Age" diff --git a/util/__init__.py b/util/__init__.py index 38314f3..20f22a4 100644 --- a/util/__init__.py +++ b/util/__init__.py @@ -1,3 +1,23 @@ """ -$Id$ +common utilities """ + +from zope.schema import vocabulary + + +class KeywordVocabulary(vocabulary.SimpleVocabulary): + + def __init__(self, items, *interfaces): + """ ``items`` may be a tuple of (token, title) or a dictionary + with corresponding elements named 'token' and 'title'. + """ + terms = [] + for t in items: + if type(t) is dict: + token, title = t['token'], t['title'] + else: + token, title = t + terms.append(vocabulary.SimpleTerm(token, token, title)) + super(KeywordVocabulary, self).__init__(terms, *interfaces) + +