Have a look at the (unfinished, currently not really working)
gpe-contacts module in CVS.
It uses a very simple schema:
create table person (
id int NOT NULL,
name text NOT NULL,
PRIMARY KEY(id)
);
create table person_attr (
person int NOT NULL,
attr int NOT NULL,
value text
);
Everything other than a person's name is stored in the "person_attr"
table, as a set of (tag, value) tuples. The "attr" tags are just
arbitrarily assigned integers, e.g:
#define TAG_PHONE_HOME 100
#define TAG_PHONE_WORK 101
#define TAG_PHONE_MOBILE 102
#define TAG_PHONE_FAX 103
#define TAG_PHONE_PAGER 104
#define TAG_PHONE_TELEX 105
#define TAG_ADDRESS_HOME 200
#define TAG_ADDRESS_WORK 201
If you wanted to make the tags a bit more mnemonic, you could use the
hex encoding of a 4-byte ASCII string. But it probably doesn't buy very
much, to be honest.
The on-screen layout is defined in a separate file, see
contacts-layout.xml for an example. This controls the arrangement of
fields in the window, and allows each one to have some kind of
descriptive label assigned to it.
As Tom mentioned already, we want to be able to configure the
presentation on a per-contact basis. I think the easiest way to do this
is just to define a range of tags to be application-specific, and use
one of them to hold layout customisations for the entry in question.
p.
Received on Thu Jun 06 2002 - 08:43:24 EDT
This archive was generated by hypermail 2.2.0 : Mon Jul 25 2005 - 17:19:00 EDT