Commit 40131eda authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

default is stable

--HG--
branch : stable
Summary
-------
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.
......@@ -8,12 +8,10 @@ numversion = (1, 6, 0)
version = '.'.join(str(num) for num in numversion)
license = 'LGPL'
description = "address book component for the CubicWeb framework"
author = "Logilab"
author_email = "contact@logilab.fr"
description = "address book component for the CubicWeb framework"
web = 'http://www.cubicweb.org/project/%s' % distname
classifiers = [
'Environment :: Web Environment',
'Framework :: CubicWeb',
......@@ -21,35 +19,30 @@ classifiers = [
'Programming Language :: JavaScript',
]
__depends__ = {'cubicweb': '>= 3.9.0'}
__depends__ = {'cubicweb': '>= 3.6.0'}
# packages ###
# packaging ###
from os import listdir as _listdir
from os.path import join, isdir
from glob import glob
THIS_CUBE_DIR = join('share', 'cubicweb', 'cubes', modname)
def listdir(dirpath):
return [join(dirpath, fname) for fname in _listdir(dirpath)
if fname[0] != '.' and not fname.endswith('.pyc')
and not fname.endswith('~')]
CUBES_DIR = join('share', 'cubicweb', 'cubes')
THIS_CUBE_DIR = join(CUBES_DIR, modname)
try:
data_files = [
# common files
[THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
]
# check for possible extended cube layout
for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration'):
if isdir(dirname):
data_files.append([join(THIS_CUBE_DIR, dirname), listdir(dirname)])
# Note: here, you'll need to add subdirectories if you want
# them to be included in the debian package
except OSError:
# we are in an installed directory
pass
and not fname.endswith('~')
and not isdir(join(dirpath, fname))]
data_files = [
# common files
[THIS_CUBE_DIR, [fname for fname in glob('*.py') if fname != 'setup.py']],
]
# check for possible extended cube layout
for dirname in ('entities', 'views', 'sobjects', 'hooks', 'schema', 'data', 'i18n', 'migration', 'wdoc'):
if isdir(dirname):
data_files.append([join(THIS_CUBE_DIR, dirname), listdir(dirname)])
# Note: here, you'll need to add subdirectories if you want
# them to be included in the debian package
......@@ -18,7 +18,7 @@ cubicweb-addressbook (1.4.0-1) unstable; urgency=low
-- Sylvain Thénault <sylvain.thenault@logilab.fr> Wed, 13 May 2009 09:14:43 +0200
cubicweb-addressbook (1.3.0-1) DISTRIBUTION; urgency=low
cubicweb-addressbook (1.3.0-1) unstable; urgency=low
* initial public release
......
......@@ -9,7 +9,7 @@ Homepage: http://www.cubicweb.org/project/cubicweb-addressbook
Package: cubicweb-addressbook
Architecture: all
Depends: cubicweb-common (>= 3.8.0)
Depends: cubicweb-common (>= 3.9.0)
Description: contact information component for the CubicWeb framework
This CubicWeb component store contact information such as postal
addresses, phone numbers, instant messager address.
......
......@@ -6,8 +6,9 @@
"""
__docformat__ = "restructuredtext en"
from cubicweb.interfaces import IGeocodable
from cubicweb.entities import AnyEntity, fetch_config
from cubicweb.selectors import is_instance
from cubicweb.web.views.igeocodable import IGeocodableAdapter
class PhoneNumber(AnyEntity):
__regid__ = 'PhoneNumber'
......@@ -27,8 +28,6 @@ class PostalAddress(AnyEntity):
__regid__ = 'PostalAddress'
fetch_attrs, fetch_order = fetch_config(['street', 'street2', 'postalcode',
'city', 'country'])
__implements__ = AnyEntity.__implements__ + (IGeocodable,)
def dc_long_title(self):
lines = []
if self.street:
......@@ -42,3 +41,6 @@ class PostalAddress(AnyEntity):
if self.country:
lines.append(self.country)
return u' '.join(lines)
class PostalAddressIGeocodableAdapter(IGeocodableAdapter):
__select__ = is_instance('PostalAddress')
......@@ -10,12 +10,12 @@ __docformat__ = 'restructuredtext en'
from cubes.addressbook import geocoding
from cubicweb.selectors import implements
from cubicweb.selectors import is_instance
from cubicweb.server.hook import Hook
class AutoSetLatLng(Hook):
__regid__ = 'auto_lat_lng_hook'
__select__ = implements('PostalAddress')
__select__ = is_instance('PostalAddress')
events = ('before_add_entity', 'before_update_entity')
def __call__(self):
......
......@@ -4,6 +4,6 @@ options = (
{'type' : 'string',
'default': '',
'help': 'the google map key used to display postal address on google map',
'group': 'gmap', 'inputlevel': 0,
'group': 'gmap', 'level': 0,
}),
)
......@@ -9,24 +9,25 @@ __docformat__ = "restructuredtext en"
from logilab.mtconverter import xml_escape
from cubicweb.view import EntityView
from cubicweb.selectors import implements
from cubicweb.selectors import is_instance
from cubicweb.web import uicfg
from cubicweb.web.views import baseviews
uicfg.indexview_etype_section['PhoneNumber'] = 'subobject'
uicfg.indexview_etype_section['PostalAddress'] = 'subobject'
uicfg.indexview_etype_section['IMAddress'] = 'subobject'
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')
__select__ = is_instance('PhoneNumber')
def cell_call(self, row, col=0):
self.w(xml_escape(self.cw_rset.get_entity(row, col).dc_title()))
class PhoneNumberListItemView(baseviews.ListItemView):
__select__ = implements('PhoneNumber')
__select__ = is_instance('PhoneNumber')
def cell_call(self, row, col=0, vid=None):
entity = self.cw_rset.get_entity(row, col)
......@@ -36,7 +37,7 @@ class PhoneNumberListItemView(baseviews.ListItemView):
class PhoneNumberSipView(EntityView):
__regid__ = u'sip'
__select__ = implements('PhoneNumber')
__select__ = is_instance('PhoneNumber')
def cell_call(self, row, col, contexteid=None):
entity = self.cw_rset.get_entity(row, col)
......@@ -47,7 +48,7 @@ class PhoneNumberSipView(EntityView):
class PostalAddressInContextView(baseviews.InContextView):
__select__ = implements('PostalAddress')
__select__ = is_instance('PostalAddress')
def cell_call(self, row, col, contexteid=None):
entity = self.cw_rset.get_entity(row, col)
......
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