Commit 8d82b431 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

default is now stable

--HG--
branch : stable
......@@ -3,3 +3,5 @@
a1a9e8d1eded8ad709b124cc709edf1182f7d09c cubicweb-addressbook-version-1.5.0
30fe171fdf6e16939bb2392b3a4a6e902fb5c9b5 cubicweb-addressbook-debian-version-1.5.0-1
872bdea044200b0a9980ef7327e344b92fa13fdb oldstable
f8e8c25ede97879057b57cd12dc872a00d0e0c2b cubicweb-addressbook-version-1.6.0
7b23909c781d815513bddb0ccadea6b5f206349a cubicweb-addressbook-debian-version-1.6.0-1
......@@ -4,11 +4,11 @@
modname = 'addressbook'
distname = "cubicweb-%s" % modname
numversion = (1, 5, 0)
numversion = (1, 6, 0)
version = '.'.join(str(num) for num in numversion)
license = 'LGPL'
copyright = '''Copyright (c) 2003-2009 LOGILAB S.A. (Paris, FRANCE).
copyright = '''Copyright (c) 2003-2010 LOGILAB S.A. (Paris, FRANCE).
http://www.logilab.fr/ -- mailto:contact@logilab.fr'''
author = "Logilab"
......@@ -18,10 +18,16 @@ web = 'http://www.cubicweb.org/project/%s' % distname
ftp = ''
short_desc = "address book component for the CubicWeb framework"
long_desc = """This CubicWeb component models postal addresses and phone numbers
(to store contact information).
long_desc = """\
Summary
-------
CubicWeb is a semantic web application framework, see http://www.cubicweb.org
The addressbook cube adds a phone number, postal address and instant
messenger address (supports icq, msn and jabber) to the schema.
Views description
-----------------
There's only basic entity views in there.
"""
web = 'http://www.cubicweb.org/project/%s' % distname
......@@ -34,7 +40,7 @@ classifiers = [
__depends_cubes__ = {}
__depends__ = {'cubicweb': '>= 3.2.0'}
__depends__ = {'cubicweb': '>= 3.6.0'}
__use__ = tuple(__depends_cubes__)
pyversions = ['2.4']
......@@ -60,5 +66,3 @@ try:
except OSError:
# we are in an installed directory
pass
template_eid = 20275
cubicweb-addressbook (1.6.0-1) unstable; urgency=low
* new upstream release for cw 3.6
-- Sylvain Thénault <sylvain.thenault@logilab.fr> Wed, 27 Jan 2010 11:46:01 +0100
cubicweb-addressbook (1.5.0-1) unstable; urgency=low
* add IM address entity
......
......@@ -9,9 +9,9 @@ Homepage: http://www.cubicweb.org/project/cubicweb-addressbook
Package: cubicweb-addressbook
Architecture: all
Depends: cubicweb-common (>= 3.2.0)
Description: address book component for the CubicWeb framework
This CubicWeb component models postal addresses and phone numbers
(to store contact information).
Depends: cubicweb-common (>= 3.6.0)
Description: contact information component for the CubicWeb framework
This CubicWeb component store contact information such as postal
addresses, phone numbers, instant messager address.
.
CubicWeb is a semantic web application framework, see http://www.cubicweb.org
......@@ -10,7 +10,7 @@ from cubicweb.interfaces import IGeocodable
from cubicweb.entities import AnyEntity, fetch_config
class PhoneNumber(AnyEntity):
id = 'PhoneNumber'
__regid__ = 'PhoneNumber'
fetch_attrs = fetch_config(['number', 'type'])[0]
@classmethod
......@@ -20,11 +20,11 @@ class PhoneNumber(AnyEntity):
return None
def dc_title(self):
return u'%s (%s)' % (self.number, self.req._(self.type))
return u'%s (%s)' % (self.number, self._cw._(self.type))
class PostalAddress(AnyEntity):
id = 'PostalAddress'
__regid__ = 'PostalAddress'
fetch_attrs, fetch_order = fetch_config(['street', 'street2', 'postalcode',
'city', 'country'])
__implements__ = AnyEntity.__implements__ + (IGeocodable,)
......
......@@ -9,25 +9,28 @@
__docformat__ = 'restructuredtext en'
from cubes.addressbook import geocoding
from cubicweb.server.hooksmanager import Hook
from cubicweb.selectors import implements
from cubicweb.server.hook import Hook
class AutoSetLatLng(Hook):
__regid__ = 'auto_lat_lng_hook'
__select__ = implements('PostalAddress')
events = ('before_add_entity', 'before_update_entity')
accepts = ('PostalAddress',)
def call(self, session, entity):
gmapkey = session.vreg.config.get('gmap-key')
def __call__(self):
gmapkey = self._cw.vreg.config.get('gmap-key')
if not gmapkey:
return
geoattrs = set(('street', 'street2', 'postalcode', 'city', 'country'))
changed_attrs = set(entity.keys())
changed_attrs = set(self.entity.keys())
if (geoattrs & changed_attrs
and not entity.get('latitude')
and not entity.get('longitude')):
and not self.entity.get('latitude')
and not self.entity.get('longitude')):
try:
latlng = geocoding.get_latlng(entity.dc_long_title(), gmapkey)
latlng = geocoding.get_latlng(self.entity.dc_long_title(), gmapkey)
except geocoding.UnknownAddress:
session.warning('unable to get latitude / longitude for %s',
entity.eid)
self._cw.warning('unable to get latitude / longitude for %s',
self.entity.eid)
else:
entity.update(latlng)
self.entity.update(latlng)
......@@ -76,11 +76,11 @@ msgid "home"
msgstr "home"
msgid "im_account"
msgstr "instant messenger account"
msgstr "account"
msgctxt "IMAddress"
msgid "im_account"
msgstr "instant messenger account"
msgstr "account"
msgid "latitude"
msgstr "lalitude"
......@@ -147,24 +147,3 @@ msgstr "type"
msgctxt "IMAddress"
msgid "type"
msgstr "type"
#~ msgid "add a IMAddress"
#~ msgstr "add an instant messenger address"
#~ msgid "add a PhoneNumber"
#~ msgstr "add a phone number"
#~ msgid "add a PostalAddress"
#~ msgstr "add an address"
#~ msgid "remove this IMAddress"
#~ msgstr "remove this instant messenger address"
#~ msgid "remove this PhoneNumber"
#~ msgstr "remove this phone number"
#~ msgid "remove this PostalAddress"
#~ msgstr "remove this address"
#~ msgid "type"
#~ msgstr "type"
......@@ -15,10 +15,10 @@ msgstr ""
#
# singular and plural forms for each entity type
msgid "IMAddress"
msgstr "Adresse de messagerie instantanée"
msgstr "Adresse messagerie instantanée"
msgid "IMAddress_plural"
msgstr "Adresses de messagerie instantanée"
msgstr "Adresses messagerie instantanée"
msgid "New IMAddress"
msgstr "Nouvelle adresse instantanée"
......@@ -51,7 +51,7 @@ msgid "This PhoneNumber"
msgstr "Ce numéro de téléphone"
msgid "This PostalAddress"
msgstr "Cette adresse"
msgstr "Cette adresse postale"
# subject and object forms for each relation type
# (no object form for final relation types)
......@@ -67,7 +67,7 @@ msgstr "pays"
msgctxt "PostalAddress"
msgid "country"
msgstr ""
msgstr "pays"
msgid "fax"
msgstr "fax"
......@@ -147,30 +147,3 @@ msgstr "type"
msgctxt "IMAddress"
msgid "type"
msgstr "type"
#~ msgid "add a IMAddress"
#~ msgstr "ajouter une adresse de messagerie instantanée"
#~ msgid "add a PhoneNumber"
#~ msgstr "ajouter un numéro de téléphone"
#~ msgid "add a PostalAddress"
#~ msgstr "ajouter une adresse"
#~ msgid "google map"
#~ msgstr "carte google"
#~ msgid "map with google"
#~ msgstr "cartographier avec google"
#~ msgid "remove this IMAddress"
#~ msgstr "effacer cette adresse de messagerie instantanée"
#~ msgid "remove this PhoneNumber"
#~ msgstr "effacer ce numéro de téléphone"
#~ msgid "remove this PostalAddress"
#~ msgstr "effacer cette adresse"
#~ msgid "type"
#~ msgstr "type"
"""Specific views for address book entities (eg PhoneNumber and PostalAddress)
:organization: Logilab
:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:copyright: 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__docformat__ = "restructuredtext en"
......@@ -16,30 +16,30 @@ from cubicweb.web.views import baseviews
uicfg.indexview_etype_section['PhoneNumber'] = 'subobject'
uicfg.indexview_etype_section['PostalAddress'] = 'subobject'
uicfg.autoform_section.tag_attribute(('PostalAddress', 'latitude'), 'generated')
uicfg.autoform_section.tag_attribute(('PostalAddress', 'longitude'), 'generated')
uicfg.autoform_section.tag_attribute(('PostalAddress', 'latitude'), 'main', 'hidden')
uicfg.autoform_section.tag_attribute(('PostalAddress', 'longitude'), 'main', 'hidden')
class PhoneNumberInContextView(baseviews.InContextView):
__select__ = implements('PhoneNumber')
def cell_call(self, row, col=0):
self.w(xml_escape(self.entity(row, col).dc_title()))
self.w(xml_escape(self.cw_rset.get_entity(row, col).dc_title()))
class PhoneNumberListItemView(baseviews.ListItemView):
__select__ = implements('PhoneNumber')
def cell_call(self, row, col=0, vid=None):
entity = self.entity(row, col)
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="tel"><span class="type">%s</span> %s</div>'
% (xml_escape(entity.type),
xml_escape(entity.number)))
class PhoneNumberSipView(EntityView):
id = u'sip'
__regid__ = u'sip'
__select__ = implements('PhoneNumber')
def cell_call(self, row, col, contexteid=None):
entity = self.entity(row, col)
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="phonenumber">')
number = xml_escape(entity.number)
self.w(u'<a href="sip:%s">%s</a>' % (number.replace(" ", ""), number))
......@@ -50,7 +50,7 @@ class PostalAddressInContextView(baseviews.InContextView):
__select__ = implements('PostalAddress')
def cell_call(self, row, col, contexteid=None):
entity = self.entity(row, col)
entity = self.cw_rset.get_entity(row, col)
self.w(u'<div class="adr">')
if entity.street: # may be set optional by client cubes
self.w(u'<div class="street-address">%s' %
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment