Addressbook improvements, first shot

phil phil at cryer.us
Wed Oct 4 16:17:27 CEST 2006



On Wed, 4 Oct 2006 13:57:52 +0200, "Paul Carrasco" <paul.carrasco at gmail.com> wrote:
> On 10/4/06, shane at gnative.com <shane at gnative.com> wrote:
> 
> Yes! I had the same idea  when I included  the birthdate attribute in the
> contact profile. Is someone else already working on it?

Sounds trivial, but I know that would be a cool feature for many, me included.

> 
> 
> 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.

This makes me think of my blog, and how it handles 'Gravitars' by simply displaying an existing one pulled via the author's email address.  

http://www.gravatar.com/

What is a gravatar?

A gravatar, or globally recognized avatar, is quite simply an 80×80 pixel avatar image that follows you from weblog to weblog appearing beside your name when you comment on gravatar enabled sites. Avatars help identify your posts on web forums, so why not on weblogs?

more info on it, how to tie it in: http://www.gravatar.com/implement.php -- Pros would be very little lifting on RC's end, but a simple way to lookup user's icons via email addy (which we'll already have)

Not sure if this would be better/worse than picon, whichever is further along, more reliable in the long run perhaps.

P


>     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)
>> >   {
<