Addressbook improvements, first shot

Paul Carrasco paul.carrasco at gmail.com
Wed Oct 4 13:57:52 CEST 2006


On 10/4/06, shane at gnative.com <shane at gnative.com> wrote:
>
>
> Paul and dev's.
>
> Funny i should get this email now, i have just spent the day starting
> redeveloping of address book for my personal use (and hopefully others) by
> adding the function of grouping contacts. This is using drag and drop, the
> same as mail section and is using the same functions thou i need to sit back
> and address the javascript to make some of the functions universal as i can
> see them being used elsewhere ( actually the javascript is a completely
> different topic and one i would like to bring up once i have the
> architecture in my head more). The functionality will be almost idential to
> that of apples addressbook app.


Hello,
I don't know the apples addressbook (I am a linux user) so could you
describe shortly what this grouping functionality is? Does it allow to share
contacts (with other users) or is it only a way to display/sort/order your
contacts within the contact list?

What kind of new db attributes or tables do you need?


I'll post a link when i get it near complete just a few things to finish
> off  (almost there).
>
> I'm also implementing vCard support for import and export ( in a variety
> of formats ) i have the scripts handy just need to plug them in..


Great, so I won't develop it on my side (it was my proposal number 3).



Would also like to add the support of upcoming birthday alerts that can be
> turned off in "options".


Yes! I had the same idea  when I included  the birthdate attribute in the
contact profile. Is someone else already working on it?


As for the contact image if this is going to be added the we would need to
> look at GD/imagemagik for resizing of uploaded images to be added to the
> database when creating a contacts.


This depends on how we want to manage images:
- the KISS solution (keep it simple stupid) is to use a link to an image
already hosted on the internet.
    Pros: no need for a graphic library, really simple (actually already
supported by the patch I proposed), my contacts can update their image
without resending me the image
    Cons: cross-linking, stability not guaranted (if the image vanishes or
is renamed, it doesn't work anymore)
- the full solution is to load the image in the db, resize/convert it
    Pros: stable
    Cons: lots of dev, copyright issues (are you allowed to store these
images?), if you want to update your image you have to send it to your
contacts and have it reloaded in the db

I prefer the first solution : simple and more manageable


Any other thoughts would be great as I'm fully enjoying getting into the
> redesign of this.
>
> Shane
>
> On Wed, 4 Oct 2006 10:29:09 +0200, "Paul Carrasco" <
> paul.carrasco at gmail.com> wrote:
> > Hello everybody,
> >
> > I use roundcube for my emails but I think the adressbook is lacking a
> lot
> > of
> > interesting features.
> >  1) Ability to store multiple email adresses, phones numbers, pictures
> and
> > other info about my contacts
> >  2) Ability to share contacts (eg : my contacts could be seen by my
> wife,
> > since we have  some friends in common ;)
> >  3) Ability to import/export from csv files or other adequate format
> >  4) Ability to display pictures of my contacts when I receive mail from
> > them
> > (can anyone remember of the "picons" idea? see
> > http://www.cs.indiana.edu/picons/ftp/faq.html#what)
> >
> >
> > So I propose the following:
> >  1) see the code below to implement an extended version of the contacts.
> > At the moment it can :
> > - eidt, save and display multiple info about your contacts
> > - mailto links working with the various emails of the contact
> > - I chose not to store the image in the db itself but only a link to it,
> > since it was simpler; but it means cross-linking between your roudcube
> web
> > site and the site hosting the image
> > Todo :
> > - when auto-completing recipient address only the first email of the
> > contacts can be matched
> > - when adding a new contact, only the first email address is checked for
> > redundancy
> >
> > 2) Not implemented yet
> > To share contacts, I have included a "global" attribute in the contact
> > profile. When set to True this will make the contact visible to
> everybody,
> > but editable only by the user who created it.
> > There will be a config attribute to disable this behaviour.
> >
> > 3) Not implemented yet, but should'nt be hard
> >
> > 4) I really like this idea (try gmail to see how it could work). I think
> I
> > will add :
> > - mouse-over info box that displays the contact profile when the mouse
> is
> > over a mail
> > - when displaying a message, show at the top the picture and some info
> > from
> > the addressbook
> >
> >
> >
> > Please tell me if you think this can be included in roundcube 'official'
> > version, and in that case I will send you the future updates.
> >
> > If you find bugs, please send them to me. It seems to work ok for me. If
> > you
> > prefer to work with cvs, I can do so, but on the web site it is said to
> > propose code by mail.
> >
> > Bye
> > Paul
> >
> >
> >
> > Code to implement feature 1)
> >
> > A/ DB modification (I use mysql, so this is the code to update the db
> > scheme).
> >
> > ALTER TABLE `contacts` ADD `email2` VARCHAR( 128 ) NOT NULL ,
> > ADD `email3` VARCHAR( 128 ) NOT NULL ,
> > ADD `email4` VARCHAR( 128 ) NOT NULL ,
> > ADD `im` VARCHAR( 128 ) NOT NULL ,
> > ADD `homephone` VARCHAR( 128 ) NOT NULL ,
> > ADD `mobilephone` VARCHAR( 128 ) NOT NULL ,
> > ADD `workphone` VARCHAR( 128 ) NOT NULL ,
> > ADD `sip` VARCHAR( 128 ) NOT NULL ,
> > ADD `webpage` VARCHAR( 256 ) NOT NULL ,
> > ADD `birthdate` DATE NOT NULL ,
> > ADD `pgppublickey` TEXT NOT NULL ,
> > ADD `homeaddress` TEXT NOT NULL ,
> > ADD `workaddress` TEXT NOT NULL ,
> > ADD `company` VARCHAR( 128 ) NOT NULL ,
> > ADD `comments` TEXT NOT NULL ,
> > ADD `picture` VARCHAR( 256 ) NOT NULL ,
> > ADD `globalcontact` BOOL NOT NULL ;
> >
> >
> >
> >
> > B/ Localization files updates (done only for US and fr files)
> > US file: program/localization/en_US/labels.inc.php
> > // address boook
> > $labels['name']      = 'Display name';
> > $labels['firstname'] = 'First name';
> > $labels['surname']   = 'Last name';
> > $labels['email']     = 'E-Mail';
> > //new labels
> > $labels[email2]      = 'E-Mail 2';
> > $labels[email3]      = 'E-Mail 3';
> > $labels[email4]      = 'E-Mail 4';
> > $labels[im]          = 'Instant messaging';
> > $labels[homephone]   = 'Home phone';
> > $labels[mobilephone] = 'Mobile phone';
> > $labels[workphone]   = 'Work phone';
> > $labels[sip]         = 'SIP';
> > $labels[webpage]     = 'Web page';
> > $labels[birthdate]   = 'Birth date';
> > $labels[pgppublickey]= 'PGP public key';
> > $labels[homeaddress] = 'Home address';
> > $labels[workaddress] = 'Work address';
> > $labels[company]     = 'Company';
> > $labels[comments]    = 'Comments';
> > $labels[picture]     = 'Picture';
> > $labels[globalcontact]= 'Global contact';
> >
> >
> >
> > fr file: program/localization/fr/labels.inc.php
> > // address boook
> > $labels['name']      = 'Nom à afficher';
> > $labels['firstname'] = 'Prénom';
> > $labels['surname']   = 'Nom';
> > $labels['email']     = 'e-Mail';
> > //new labels
> > $labels[email2]      = 'e-Mail 2';
> > $labels[email3]      = 'e-Mail 3';
> > $labels[email4]      = 'e-Mail 4';
> > $labels[im]          = 'Messagerie instantanée';
> > $labels[homephone]   = 'Téléphone domicile';
> > $labels[mobilephone] = 'Téléphone mobile';
> > $labels[workphone]   = 'Téléphone professionnel';
> > $labels[sip]         = 'SIP';
> > $labels[webpage]     = 'Page web';
> > $labels[birthdate]   = 'Date de naissance';
> > $labels[pgppublickey]= 'Clé publique PGP';
> > $labels[homeaddress] = 'Adresse domicile';
> > $labels[workaddress] = 'Adresse professionnelle';
> > $labels[company]     = 'Société';
> > $labels[comments]    = 'Commentaires';
> > $labels[picture]     = 'Image';
> > $labels[globalcontact]= 'Contact global';
> >
> >
> >
> >
> > C/ New config options
> > To be appended at the end of the file: config/main.inc.php
> > // addressbook configuration
> > // chose which columns in the addressbook to enable, the columns are
> > displayed in the specified order
> > $rcmail_config['addressbook_show_cols'] = array('picture', 'name',
> > 'firstname', 'surname', 'email', 'email2', 'email3', 'email4', 'im',
> > 'homephone', 'mobilephone', 'workphone', 'sip', 'webpage', 'birthdate',
> > 'pgppublickey', 'homeaddress', 'workaddress', 'company', 'comments',
> > 'globalcontact');
> >
> > // image size in address book
> > $rcmail_config['addressbook_image_width'] = '100';
> > $rcmail_config['addressbook_image_height'] = '100';
> >
> > // enable global contacts
> > $rcmail_config['adressbook_enable_global_contacts'] = 'true';
> >
> >
> >
> >
> >
> > D/ Show contact update
> > Update the rcmail_contact_details function in the file:
> > program/steps/addressbook/show.inc
> > function rcmail_contact_details($attrib)
> >   {
> >   global $CONFIG, $CONTACT_RECORD, $JS_OBJECT_NAME;
> >
> >   if (!$CONTACT_RECORD)
> >     return show_message('contactnotfound');
> >
> >   // a specific part is requested
> >   if ($attrib['part'])
> >     return rep_specialchars_output($CONTACT_RECORD[$attrib['part']]);
> >
> >
> >   // return the complete address record as table
> >   $out = "<table>\n\n";
> >
> >   $a_show_cols = $CONFIG['addressbook_show_cols'];
> >   foreach ($a_show_cols as $col)
> >     {
> >     if (substr($col,0,5)=='email' && $CONTACT_RECORD[$col])
> >       $value = sprintf('<a href="#compose"
> > onclick="%s.command(\'compose\',
> > \'%d_%s\')" title="%s">%s</a>',
> >                        $JS_OBJECT_NAME,
> >                        $CONTACT_RECORD['contact_id'],
> >                        $col,
> >                        rcube_label('composeto'),
> >                        $CONTACT_RECORD[$col]);
> >     elseif ($col=="picture" && $CONTACT_RECORD[$col])
> >       $value = sprintf('<img height="%s" width="%s" src="%s" />',
> >                        $CONFIG['addressbook_image_height'],
> >                        $CONFIG['addressbook_image_width'],
> >                        $CONTACT_RECORD[$col]);
> >     else
> >       $value = rep_specialchars_output($CONTACT_RECORD[$col]);
> >
> >     $title = rcube_label($col);
> >     $out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n",
> > $title, $value);
> >     }
> >
> >
> >   $out .= "\n</table>";
> >
> >   return $out;
> >   }
> >
> >
> >
> >
> > E/ Edit contact update
> > Update the rcmail_contact_editform function in the file:
> > program/steps/addressbook/edit.inc
> > function rcmail_contact_editform($attrib)
> >   {
> >   global $CONFIG, $CONTACT_RECORD, $JS_OBJECT_NAME;
> >
> >   if (!$CONTACT_RECORD && $GLOBALS['_action']!='add')
> >     return rcube_label('contactnotfound');
> >
> >   // add some labels to client
> >   rcube_add_label('noemailwarning');
> >   rcube_add_label('nonamewarning');
> >
> >   list($form_start, $form_end) = get_form_tags($attrib);
> >   unset($attrib['form']);
> >
> >
> >   // a specific part is requested
> >   if ($attrib['part'])
> >     {
> >     $out = $form_start;
> >     $out .= rcmail_get_edit_field($attrib['part'],
> > $CONTACT_RECORD[$attrib['part']], $attrib);
> >     return $out