Owncloud contacts and address stickers

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Owncloud contacts and address stickers

Bert Haverkamp
Dear Owncloud developers.

Some months ago, I filed bug 284. (https://github.com/owncloud/contacts/issues/284) It is relating to the way owncloud updates (or doesn't update) the Address Label field in vcards. This field is used by many address-sticker programms like for instance Glabels. I would like to be able to download a subset of my contacts as a vcf file, import them in to Glabels and print address stickers very easily.

However, the interest in this bug is not very high. (Basically, just me at the moment:-)
So I'm looking into adding this to owncloud myself. It would greatly enhance the capability of printing address labels and I can't imagine there is no one else with a usecase for this (Hint, christmas card season is coming!)

In order to have this working correctly the address should be formatted according to the local situation.
I live in the Netherlands and addresses are formatted differently than for instance in the USA.
Also if an address is in another country, it should pick that up and format it accordingly.

I already downloaded the evolution sourcecode and found the code that is responsible for constructing the address labels and their country specific formats. They use a address_formats.dat file to list all countries and their official address layout.

I'd now need to add this to owncloud. There are two possibilities. Do this everytime when updating the address field, and doing this when exporting to vcf. Which would be best in your view?

Also I'm still struggling to understand the owncloud source. php is not my strongsuit:-(
Can anyone give some guidance? Where would I need to hook into the code that saves the vcf files? Or where is the code to store the fields in the database?

Kind regards,

Bert Haverkamp

P.S. I hope this wont become a double-post. My first post was rejected because I sent it before subscribing to the mailing-list.
Reply | Threaded
Open this post in threaded view
|

Re: Owncloud contacts and address stickers

Bert Haverkamp
Hello all,

I'd like to post an update on my progress with the formatted Address LABEL field
I discovered that besides my own ticket 284, an older ticket 114, refers to the same problem.
So at least I know now there are others in the world with the same problem/wish:-)

I have started digging in the owncloud sourcecode and it is slowly growing on me.
But I started with a stand-alone php script to play with the sabredav library.
This script is now able to read in a vcard, take the FN and ADR field
and create or update the LABEL field.
I have a few country specific address-formats in there now, based on the list I found in the evolution code. But I need to write a more versatile script to do them all. That's what I will be starting now.

Next I would need some help hooking this up with the ownclouds contact code. I have still only a rudimentary understanding of how to do this.

(first) two questions here:
1) How can I find out in owncloud what the home-country is? Is there a location set somewhere? Maybe for the timezone? How can I access that. I need the home-country for the default formatting when the country field in the address is empty.

2) How best to get the country from an address? Or set it in a new address? The country name will often be written in the local language, or in the target-countries language. At least not always in English. This will make it hard to recognize. I was thinking to solve the problem at least for new or edited contacts by using a dropdown box with all countrynames for the country field. That way it is at least a controlled  set of names. Maybe we can store the country shortcode (DE, NL, US, .. ) somewhere to make this even more streamlined. Any ideas are welcome.

Kind regards,

Bert
Reply | Threaded
Open this post in threaded view
|

Owncloud contact app address labels bug 284

Bert Haverkamp
In reply to this post by Bert Haverkamp
Hi,

This is a followup on my earlier mails in December on this bug 284 and a
call for help.
I have  now created a php script that can read a vcf file and outputs a
new vcf with the LABEL field added.
The label can be for 33 different countries. So it can output the
formatted address for 33 different layouts!

I have created this at the moment as a commandline tool. It consists of
3 files:
the example script labels.php
The actual algorithm: formatlabels.php
and a list of countrycodes vs country names, countrycodes.php


I run into 2 obstacles now that I need to clear.
1) the home country of the user. This is an unknown in the contacts app.
But it is needed to format the label when no country is specified in the
vcf, and to suppress the country name in the formatted addreslabel, when
it is the same as the country where the user lives.

I noticed that the calendar app already has a setting for this.
Presumably to get the right timezone for the calendar. I would propose
to make this a global parameter, somewhere in the user profile, so more
apps can make use of this info. That would at least solve my problem.
Alternatively, the contacts app has to be extended with a country field.

2) There is no clear way to get the country from an contact address. The
country name is a free format text field, so it can be in any spelling.

My proposal is to use a dropdown list, in order to make this more
structured. The names can be localized based on the language setting. I
noticed  Outlook has the same approach to country entry. And the
dropdown list already exists in the Calendar app for the setting I
mentioned earlier.

However, I have no idea how to program the UI. And I am sure there are
people who are very good at that in this list. I'm looking for help. I
have created the formatting algorithm, who can help me incorporate it in
the contact app?

Please let me know if you are interested in helping, or have any
feedback.

Kind regards,

Bert







On 2014-11-28 11:49, Bert Haverkamp wrote:

> Dear Owncloud developers.
>
> Some months ago, I filed bug 284.
> (https://github.com/owncloud/contacts/issues/284) It is relating to the
> way
> owncloud updates (or doesn't update) the Address Label field in vcards.
> This
> field is used by many address-sticker programms like for instance
> Glabels. I
> would like to be able to download a subset of my contacts as a vcf
> file,
> import them in to Glabels and print address stickers very easily.
>
> However, the interest in this bug is not very high. (Basically, just me
> at
> the moment:-)
> So I'm looking into adding this to owncloud myself. It would greatly
> enhance
> the capability of printing address labels and I can't imagine there is
> no
> one else with a usecase for this (Hint, christmas card season is
> coming!)
>
> In order to have this working correctly the address should be formatted
> according to the local situation.
> I live in the Netherlands and addresses are formatted differently than
> for
> instance in the USA.
> Also if an address is in another country, it should pick that up and
> format
> it accordingly.
>
> I already downloaded the evolution sourcecode and found the code that
> is
> responsible for constructing the address labels and their country
> specific
> formats. They use a address_formats.dat file to list all countries and
> their
> official address layout.
>
> I'd now need to add this to owncloud. There are two possibilities. Do
> this
> everytime when updating the address field, and doing this when
> exporting to
> vcf. Which would be best in your view?
>
> Also I'm still struggling to understand the owncloud source. php is not
> my
> strongsuit:-(
> Can anyone give some guidance? Where would I need to hook into the code
> that
> saves the vcf files? Or where is the code to store the fields in the
> database?
>
> Kind regards,
>
> Bert Haverkamp
>
> P.S. I hope this wont become a double-post. My first post was rejected
> because I sent it before subscribing to the mailing-list.
>
>
>
> --
> View this message in context:
> http://owncloud.10557.n7.nabble.com/Owncloud-contacts-and-address-stickers-tp13561.html
> Sent from the Developers mailing list archive at Nabble.com.
> _______________________________________________
> Devel mailing list
> [hidden email]
> http://mailman.owncloud.org/mailman/listinfo/devel
_______________________________________________
Devel mailing list
[hidden email]
http://mailman.owncloud.org/mailman/listinfo/devel

labels.php (3K) Download Attachment
countrycodes.php (8K) Download Attachment
formatlabel.php (15K) Download Attachment