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.
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..
Would also like to add the support of upcoming birthday alerts that can be turned off in "options".
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.
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@gmail.com wrote:
Hello everybody,
I use roundcube for my emails but I think the adressbook is lacking a lot of interesting features.
- 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:
- 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
- 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.
Not implemented yet, but should'nt be hard
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
ADDemail2
VARCHAR( 128 ) NOT NULL , ADDemail3
VARCHAR( 128 ) NOT NULL , ADDemail4
VARCHAR( 128 ) NOT NULL , ADDim
VARCHAR( 128 ) NOT NULL , ADDhomephone
VARCHAR( 128 ) NOT NULL , ADDmobilephone
VARCHAR( 128 ) NOT NULL , ADDworkphone
VARCHAR( 128 ) NOT NULL , ADDsip
VARCHAR( 128 ) NOT NULL , ADDwebpage
VARCHAR( 256 ) NOT NULL , ADDbirthdate
DATE NOT NULL , ADDpgppublickey
TEXT NOT NULL , ADDhomeaddress
TEXT NOT NULL , ADDworkaddress
TEXT NOT NULL , ADDcompany
VARCHAR( 128 ) NOT NULL , ADDcomments
TEXT NOT NULL , ADDpicture
VARCHAR( 256 ) NOT NULL , ADDglobalcontact
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; }
// return the complete address edit form as table $out = "$form_start<table>\n\n";
#$a_show_cols = array('name', 'firstname', 'surname', 'email'); $a_show_cols = $CONFIG['addressbook_show_cols']; foreach ($a_show_cols as $col) { $attrib['id'] = 'rcmfd_'.$col; $title = rcube_label($col); if (($col=='homeaddress' || $col=='workaddress' || $col=='comments') && $CONTACT_RECORD[$col]) $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col], $attrib, 'textarea'); else $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col], $attrib);
$out .= sprintf("<tr><td class=\"title\"><label
for="%s">%s</label></td><td>%s</td></tr>\n", $attrib['id'], $title, $value); }
$out .= "\n</table>$form_end";
return $out; }
F/ Save contact update Replace the line $a_save_cols = array('name', 'firstname', 'surname', 'email'); by $a_save_cols = $CONFIG['addressbook_show_cols']; in the file: program/steps/addressbook/save.inc
G/ Compose mail update (to to chose not only the first email, but also one of the others depending on which link was clicked in the contact profile) Update the "case 'to'" in the compose action, in the file: program/steps/mail/compose.inc case 'to': $fname = '_to'; $header = 'to';
// we have contact id's as get parameters if (!empty($_GET['_to']) && preg_match('/^[0-9]+(,[0-9]+)*$/',
$_GET['_to'])) { $a_recipients = array(); $sql_result = $DB->query("SELECT name, email FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN (".$_GET['_to'].")", $_SESSION['user_id']);
while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] = format_email_recipient($sql_arr['email'],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to']) &&
preg_match('/^[0-9]+_email[0-9]*$/', $_GET['_to'])) { $a_recipients = array(); preg_match('/^([0-9])+_(email[0-9]*)$/', $_GET['_to'], $matches); $sql_result = $DB->query("SELECT name, ".$matches[2]." FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN (".$matches[1].")", $_SESSION['user_id']);
while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] = format_email_recipient($sql_arr[$matches[2]],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to'])) $fvalue = $_GET['_to'];
Variety is the spice of life .. except in Thailand where the spice makes
your life slip out your arsehole.
On 10/4/06, shane@gnative.com shane@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:
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)
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@gmail.com> wrote:
Hello everybody,
I use roundcube for my emails but I think the adressbook is lacking a
lot
of interesting features.
- 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:
- 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
- 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.
Not implemented yet, but should'nt be hard
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
ADDemail2
VARCHAR( 128 ) NOT NULL , ADDemail3
VARCHAR( 128 ) NOT NULL , ADDemail4
VARCHAR( 128 ) NOT NULL , ADDim
VARCHAR( 128 ) NOT NULL , ADDhomephone
VARCHAR( 128 ) NOT NULL , ADDmobilephone
VARCHAR( 128 ) NOT NULL , ADDworkphone
VARCHAR( 128 ) NOT NULL , ADDsip
VARCHAR( 128 ) NOT NULL , ADDwebpage
VARCHAR( 256 ) NOT NULL , ADDbirthdate
DATE NOT NULL , ADDpgppublickey
TEXT NOT NULL , ADDhomeaddress
TEXT NOT NULL , ADDworkaddress
TEXT NOT NULL , ADDcompany
VARCHAR( 128 ) NOT NULL , ADDcomments
TEXT NOT NULL , ADDpicture
VARCHAR( 256 ) NOT NULL , ADDglobalcontact
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; }
// return the complete address edit form as table $out = "$form_start<table>\n\n";
#$a_show_cols = array('name', 'firstname', 'surname', 'email'); $a_show_cols = $CONFIG['addressbook_show_cols']; foreach ($a_show_cols as $col) { $attrib['id'] = 'rcmfd_'.$col; $title = rcube_label($col); if (($col=='homeaddress' || $col=='workaddress' || $col=='comments') && $CONTACT_RECORD[$col]) $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col],
$attrib,
'textarea'); else $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col], $attrib);
$out .= sprintf("<tr><td class=\"title\"><label
for="%s">%s</label></td><td>%s</td></tr>\n", $attrib['id'], $title, $value); }
$out .= "\n</table>$form_end";
return $out; }
F/ Save contact update Replace the line $a_save_cols = array('name', 'firstname', 'surname', 'email'); by $a_save_cols = $CONFIG['addressbook_show_cols']; in the file: program/steps/addressbook/save.inc
G/ Compose mail update (to to chose not only the first email, but also
one
of the others depending on which link was clicked in the contact
profile)
Update the "case 'to'" in the compose action, in the file: program/steps/mail/compose.inc case 'to': $fname = '_to'; $header = 'to';
// we have contact id's as get parameters if (!empty($_GET['_to']) && preg_match('/^[0-9]+(,[0-9]+)*$/',
$_GET['_to'])) { $a_recipients = array(); $sql_result = $DB->query("SELECT name, email FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN (".$_GET['_to'].")", $_SESSION['user_id']);
while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] = format_email_recipient($sql_arr['email'],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to']) &&
preg_match('/^[0-9]+_email[0-9]*$/', $_GET['_to'])) { $a_recipients = array(); preg_match('/^([0-9])+_(email[0-9]*)$/', $_GET['_to'],
$matches);
$sql_result = $DB->query("SELECT name, ".$matches[2]." FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN
(".$matches[1].")",
$_SESSION['user_id']); while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] =
format_email_recipient($sql_arr[$matches[2]],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to'])) $fvalue = $_GET['_to'];
Variety is the spice of life .. except in Thailand where the spice
makes your life slip out your arsehole.
On Wed, 4 Oct 2006 13:57:52 +0200, "Paul Carrasco" paul.carrasco@gmail.com wrote:
On 10/4/06, shane@gnative.com shane@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.
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@gmail.com> wrote:
Hello everybody,
I use roundcube for my emails but I think the adressbook is lacking a
lot
of interesting features.
- 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:
- 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
- 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.
Not implemented yet, but should'nt be hard
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
ADDemail2
VARCHAR( 128 ) NOT NULL , ADDemail3
VARCHAR( 128 ) NOT NULL , ADDemail4
VARCHAR( 128 ) NOT NULL , ADDim
VARCHAR( 128 ) NOT NULL , ADDhomephone
VARCHAR( 128 ) NOT NULL , ADDmobilephone
VARCHAR( 128 ) NOT NULL , ADDworkphone
VARCHAR( 128 ) NOT NULL , ADDsip
VARCHAR( 128 ) NOT NULL , ADDwebpage
VARCHAR( 256 ) NOT NULL , ADDbirthdate
DATE NOT NULL , ADDpgppublickey
TEXT NOT NULL , ADDhomeaddress
TEXT NOT NULL , ADDworkaddress
TEXT NOT NULL , ADDcompany
VARCHAR( 128 ) NOT NULL , ADDcomments
TEXT NOT NULL , ADDpicture
VARCHAR( 256 ) NOT NULL , ADDglobalcontact
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; }
// return the complete address edit form as table $out = "$form_start<table>\n\n";
#$a_show_cols = array('name', 'firstname', 'surname', 'email'); $a_show_cols = $CONFIG['addressbook_show_cols']; foreach ($a_show_cols as $col) { $attrib['id'] = 'rcmfd_'.$col; $title = rcube_label($col); if (($col=='homeaddress' || $col=='workaddress' ||
$col=='comments')
&& $CONTACT_RECORD[$col]) $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col],
$attrib,
'textarea'); else $value = rcmail_get_edit_field($col, $CONTACT_RECORD[$col], $attrib);
$out .= sprintf("<tr><td class=\"title\"><label
for="%s">%s</label></td><td>%s</td></tr>\n", $attrib['id'], $title, $value); }
$out .= "\n</table>$form_end";
return $out; }
F/ Save contact update Replace the line $a_save_cols = array('name', 'firstname', 'surname', 'email'); by $a_save_cols = $CONFIG['addressbook_show_cols']; in the file: program/steps/addressbook/save.inc
G/ Compose mail update (to to chose not only the first email, but also
one
of the others depending on which link was clicked in the contact
profile)
Update the "case 'to'" in the compose action, in the file: program/steps/mail/compose.inc case 'to': $fname = '_to'; $header = 'to';
// we have contact id's as get parameters if (!empty($_GET['_to']) && preg_match('/^[0-9]+(,[0-9]+)*$/',
$_GET['_to'])) { $a_recipients = array(); $sql_result = $DB->query("SELECT name, email FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN (".$_GET['_to'].")", $_SESSION['user_id']);
while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] = format_email_recipient($sql_arr['email'],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to']) &&
preg_match('/^[0-9]+_email[0-9]*$/', $_GET['_to'])) { $a_recipients = array(); preg_match('/^([0-9])+_(email[0-9]*)$/', $_GET['_to'],
$matches);
$sql_result = $DB->query("SELECT name, ".$matches[2]." FROM ".get_table_name('contacts')." WHERE user_id=? AND del<>1 AND contact_id IN
(".$matches[1].")",
$_SESSION['user_id']); while ($sql_arr = $DB->fetch_assoc($sql_result)) $a_recipients[] =
format_email_recipient($sql_arr[$matches[2]],
$sql_arr['name']);
if (sizeof($a_recipients)) $fvalue = join(', ', $a_recipients); } else if (!empty($_GET['_to'])) $fvalue = $_GET['_to'];
Variety is the spice of life .. except in Thailand where the spice
makes your life slip out your arsehole.
-- http://fak3r.com - you don't have to kick it
yay for addressbook management!
as a thought though, rather than re-work stuff that's already been created, why not use existing tools. in particular, plaxo. i've been using it for a while as a sync tool between my treo, thunderbird, & outlook and by-and-large, it's been great! and they have an API: http://www.plaxo.com/api/
and a really nifty widget demo (access address lists from other apps): http://www.plaxo.com/api/widget_demo
but using their (already well-thought out) field set as a guideline might be a good way to go.
just a couple of thoughts. i love the enthusiasm in this community!
thanks, randy
phil wrote:
On Wed, 4 Oct 2006 13:57:52 +0200, "Paul Carrasco" paul.carrasco@gmail.com wrote:
On 10/4/06, shane@gnative.com shane@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.
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
Speaking personally, I would not want this. Part of the reason I moved from using a gmail account as my primary account was so that I had complete control of MY emails. I'm sure google would not do anything bad with my data, but it's MY data, and I want it where only I have access to it. Implementing an external address book system would be opening that information up for abuse. Can you really guarantee that plaxo aren't going to sell that data to spammers or have it stolen by crackers?
Besides, what happens if their service goes down? You might lose access to your address book, even temporarily this could be a royal PITA.
Just by tuppence worth
pixel
On Wed, 04 Oct 2006 10:26:22 -0400, Randy Noval randy@sermo.net wrote:
yay for addressbook management!
as a thought though, rather than re-work stuff that's already been created, why not use existing tools. in particular, plaxo. i've been using it for a while as a sync tool between my treo, thunderbird, & outlook and by-and-large, it's been great! and they have an API: http://www.plaxo.com/api/
and a really nifty widget demo (access address lists from other apps): http://www.plaxo.com/api/widget_demo
but using their (already well-thought out) field set as a guideline might be a good way to go.
just a couple of thoughts. i love the enthusiasm in this community!
thanks, randy
phil wrote:
On Wed, 4 Oct 2006 13:57:52 +0200, "Paul Carrasco"
paul.carrasco@gmail.com wrote:
On 10/4/06, shane@gnative.com shane@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.
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