new person fields salutation and (academic) title

This commit is contained in:
Helmut Merz 2013-05-17 11:26:36 +02:00
parent 0bb012a9c6
commit e1ba407209
4 changed files with 82 additions and 28 deletions

View file

@ -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 # 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 # 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... Interfaces for organizational stuff like persons, addresses, tasks, services...
$Id$
""" """
from zope import schema from zope import schema
@ -30,6 +28,7 @@ from zope.i18nmessageid import MessageFactory
from cybertools.composer.schema.factory import Email from cybertools.composer.schema.factory import Email
from cybertools.tracking.interfaces import ITrack from cybertools.tracking.interfaces import ITrack
from cybertools.util.jeep import Jeep, Term from cybertools.util.jeep import Jeep, Term
from cybertools.util import KeywordVocabulary
_ = MessageFactory('cybertools.organize') _ = MessageFactory('cybertools.organize')
@ -43,31 +42,48 @@ class LinesList(schema.List): pass
# persons, addresses, ... # persons, addresses, ...
salutations = ((None, u''),
('m', _(u'Mr')),
('f', _(u'Mrs')))
class IPerson(Interface): class IPerson(Interface):
""" Resembles a human being with a name (first and last name), """ Resembles a human being with a name (first and last name),
a birth date, and a set of addresses. 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( firstName = schema.TextLine(
title=_(u'First name'), title=_(u'First Name'),
description=_(u'The first name'), description=_(u'The first name.'),
required=False,) required=False,)
lastName = schema.TextLine( lastName = schema.TextLine(
title=_(u'Last name'), title=_(u'Last Name'),
description=_(u'The last name or surname'),) description=_(u'The last name or surname.'),)
email = Email(title=_(u'E-Mail address'), email = Email(title=_(u'E-Mail Address'),
description=_(u'The standard email address of the person'),) description=_(u'The standard email address of the person.'),)
#phoneNumbers = SimpleList( #phoneNumbers = SimpleList(
phoneNumbers = schema.List( phoneNumbers = schema.List(
value_type=schema.TextLine(), value_type=schema.TextLine(),
default=[], default=[],
title=_(u'Phone numbers'), title=_(u'Phone Numbers'),
description=_(u'Note one or more phone numbers here'), description=_(u'Note one or more phone numbers here.'),
required=False,) required=False,)
birthDate = schema.Date( birthDate = schema.Date(
title=_(u'Date of birth'), title=_(u'Date of Birth'),
description=_(u'The date of birth - should be a ' description=_(u'The date of birth - should be a '
'datetime.date object'), 'datetime.date object.'),
required=False,) required=False,)
age = schema.Int( age = schema.Int(

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\n" "Project-Id-Version: $Id$\n"
"POT-Creation-Date: 2008-12-01 12:00 CET\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 <helmutm@cy55.de>\n" "Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n" "Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -11,31 +11,49 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Generated-By: kwrite\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" msgstr "Vorname"
msgid "The first name" msgid "The first name."
msgstr "Bitte den oder die Vornamen eingeben" msgstr "Bitte den Vornamen eingeben."
msgid "Last name" msgid "Last Name"
msgstr "Nachname" msgstr "Nachname"
msgid "The last name or surname" msgid "The last name or surname."
msgstr "Bitte den Nachnamen eingeben" msgstr "Bitte den Nachnamen eingeben."
msgid "E-Mail address" msgid "E-Mail Address"
msgstr "E-Mail-Adresse" msgstr "E-Mail-Adresse"
msgid "The standard email address of the person" msgid "The standard email address of the person."
msgstr "Bitte eine gültige E-Mail-Adresse eingeben" msgstr "Bitte eine gültige E-Mail-Adresse eingeben."
msgid "Phone numbers" msgid "Phone Numbers"
msgstr "Telefonnummern" msgstr "Telefonnummern"
msgid "Note one or more phone numbers here" msgid "Note one or more phone numbers here."
msgstr "Bitte eine oder mehrere Telefonnummern (je Zeile eine) eingeben" msgstr "Bitte eine oder mehrere Telefonnummern (je Zeile eine) eingeben."
msgid "Date of birth" msgid "Date of Birth"
msgstr "Geburtsdatum" msgstr "Geburtsdatum"
msgid "Age" msgid "Age"

View file

@ -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)