Author Topic: Global Address Book with additional fields and additional email addresses  (Read 52958 times)

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
birtday field for Global Addressbook
« Reply #30 on: March 13, 2009, 09:30:08 AM »
i have add the birtday field to Addressbook Birtday must DD.MM.YYYY onfocus field will blank i have add onfocus to allowed inputfield parameters when Birtday is empty show DD.MM.YYYY on editpage and addpage.
and i have optimized the fieldset html output on show add and editpage for an better display and formating.

Code: [Select]
ALTER  TABLE  `contacts`  ADD  `birth` VARCHAR( 10  )  NOT  NULL ;

view attached diff
« Last Edit: February 01, 2011, 04:29:26 AM by lacri »

Offline Aoster

  • Newbie
  • *
  • Posts: 3
Global Address Book with additional fields and additional email addresses
« Reply #31 on: March 13, 2009, 02:50:55 PM »
Hello lacri,

would it be possible for you to create a patch for the changes
you have described in your "port to 0.2 stable / 0.2.1 " posting ?
It would be much easier to apply :-)

Thanks for your great work !!!

kind regards

Andreas

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Global Address Book with additional fields and additional email addresses
« Reply #32 on: March 13, 2009, 04:43:51 PM »
i commit a patch at next monday,
the weekend is time for my kids ;)

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Global Address Book with additional fields and additional email addresses
« Reply #33 on: March 16, 2009, 05:20:53 AM »
here is the patch

  not forgett

Code: [Select]
# Database Additions for contact multiple emails
# Run in PhpMyAdmin on the database that holds the RC Contacts table. Change the table name rc_contacts to your contacts table name:
#
 ALTER TABLE `contacts` ADD `global_contact` TINYINT(1) NOT NULL default '0';
 ALTER TABLE `contacts` ADD `firm` VARCHAR(128) NOT NULL ;
 ALTER TABLE `contacts` ADD `position` VARCHAR(50) NOT NULL ;
 ALTER TABLE `contacts` ADD `p_tel` VARCHAR(30) NOT NULL ;
 ALTER TABLE `contacts` ADD `p_fax` VARCHAR(30) NOT NULL ;
 ALTER TABLE `contacts` ADD `p_mob` VARCHAR(20) NOT NULL ;
 ALTER TABLE `contacts` ADD `p_address` TEXT NOT NULL;
 ALTER TABLE `contacts` ADD `w_tel` VARCHAR(20) NOT NULL ;
 ALTER TABLE `contacts` ADD `w_fax` VARCHAR(20) NOT NULL ;
 ALTER TABLE `contacts` ADD `w_mob` VARCHAR(20) NOT NULL ;
 ALTER TABLE `contacts` ADD `w_address` TEXT NOT NULL;
 ALTER TABLE `contacts` ADD `notice` TEXT NOT NULL;
 ALTER TABLE `contacts` ADD `email2` VARCHAR(128) NOT NULL ;
 ALTER TABLE `contacts` ADD `email3` VARCHAR(128) NOT NULL ;
 ALTER TABLE `contacts` ADD `email4` VARCHAR(128) NOT NULL ;
 ALTER TABLE `contacts` ADD `birth` VARCHAR(10) NOT NULL ;

« Last Edit: February 01, 2011, 04:29:26 AM by lacri »

Offline atuin

  • Newbie
  • *
  • Posts: 3
Extended add book full compatible with thunderbird ldap
« Reply #34 on: March 16, 2009, 07:42:25 AM »
Based on work of lacri

I remove global contact from database, we use ldap for this

part 1

Add /etc/ldap/schema/mozillaorgperson.schema (debian)
and include it on /etc/ldap/slapd.conf
Code: [Select]

#
# mozillaOrgPerson schema v. 0.6.3
#

# req. core
# req. cosine
# req. inetorgperson

# attribute defs

attributetype ( 1.3.6.1.4.1.13769.2.1.1
        NAME ( 'mozillaNickname' )
        SUP name )

attributetype ( 1.3.6.1.4.1.13769.2.1.2
        NAME ( 'mozillaUseHtmlMail' )
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
        SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.13769.2.1.3
        NAME 'mozillaSecondEmail'
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

attributetype ( 1.3.6.1.4.1.13769.2.1.4
        NAME 'mozillaHomeLocalityName'
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )

attributetype ( 1.3.6.1.4.1.13769.2.1.5
        NAME 'mozillaPostalAddress2'
        EQUALITY caseIgnoreListMatch
        SUBSTR caseIgnoreListSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )

attributetype ( 1.3.6.1.4.1.13769.2.1.6
        NAME 'mozillaHomePostalAddress2'
        EQUALITY caseIgnoreListMatch
        SUBSTR caseIgnoreListSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )

attributetype ( 1.3.6.1.4.1.13769.2.1.7
        NAME ( 'mozillaHomeState' ) SUP name )

attributetype ( 1.3.6.1.4.1.13769.2.1.8
        NAME 'mozillaHomePostalCode'
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{40} )

attributetype ( 1.3.6.1.4.1.13769.2.1.9
        NAME ( 'mozillaHomeCountryName' )
        SUP name SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.13769.2.1.10
        NAME ( 'mozillaHomeFriendlyCountryName' )
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )

attributetype ( 1.3.6.1.4.1.13769.2.1.11
        NAME ( 'mozillaHomeUrl' )
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

attributetype ( 1.3.6.1.4.1.13769.2.1.12
        NAME ( 'mozillaWorkUrl' )
        EQUALITY caseIgnoreIA5Match
        SUBSTR caseIgnoreIA5SubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{256} )

# un-comment for all LDAP server NOT supporting SYNTAX 2.16.840.1.113730.3.7.1
attributetype ( 1.3.6.1.4.1.13769.2.1.13
        NAME ( 'nsAIMid' )
        DESC 'AOL Instant Messenger (AIM) Identity'
        EQUALITY telephoneNumberMatch
        SUBSTR telephoneNumberSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )

attributetype ( 1.3.6.1.4.1.13769.2.1.14 NAME ( 'mozillaHomeStreet' )
        EQUALITY caseIgnoreMatch
        SUBSTR caseIgnoreSubstringsMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )

# un-comment for Netscape 6.x and all other LDAP server supporting SYNTAX 2.16.840.1.113730.3.7.1
# attributeTypes ( 2.16.840.1.113730.3.1.2013
#       NAME ( 'nsAIMid' )
#       DESC 'AOL Instant Messenger (AIM) Identity'
#       SYNTAX 2.16.840.1.113730.3.7.1 )

attributetype ( 1.3.6.1.4.1.13769.2.1.96
        NAME ( 'mozillaCustom1' )
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
        SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.13769.2.1.97
        NAME ( 'mozillaCustom2' )
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
        SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.13769.2.1.98
        NAME ( 'mozillaCustom3' )
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
        SINGLE-VALUE )

attributetype ( 1.3.6.1.4.1.13769.2.1.99
        NAME ( 'mozillaCustom4' )
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.15
        SINGLE-VALUE )
 
# defined in "A Summary of the X.500(96) User Schema for use with LDAPv3" - RFC 2256
#
# attributetype ( 2.5.4.6 NAME ( 'c' 'countryName' )
#       DESC 'RFC2256: ISO-3166 country 2-letter code'
#       SUP name SINGLE-VALUE )

# defined in "The COSINE and Internet X.500 Schema" - RFC 1274
#
# attributetype ( 0.9.2342.19200300.100.1.43
#       NAME ( 'co' 'friendlyCountryName' )
#       DESC 'RFC1274: friendly country name'
#       EQUALITY caseIgnoreMatch
#       SUBSTR caseIgnoreSubstringsMatch
#       SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )


# objectClass defs

objectclass ( 1.3.6.1.4.1.13769.2.2.1
        NAME 'mozillaOrgPerson'
        SUP top
        AUXILIARY
        MAY (    
        sn $    
        givenName $
        cn $
        mozillaNickname $
        title $
        telephoneNumber $
        facsimileTelephoneNumber $
        mobile $
        pager $  
        homePhone $
        street $  
        postalCode $
        mozillaPostalAddress2 $
        mozillaHomeStreet $    
        mozillaHomePostalAddress2 $
        l $
        mozillaHomeLocalityName $
        st $
        mozillaHomeState $
        mozillaHomePostalCode $
        c $
        mozillaHomeCountryName $
        co $
        mozillaHomeFriendlyCountryName $
        ou $
        o $  
        mail $
        mozillaSecondEmail $
        mozillaUseHtmlMail $
        nsAIMid $
        mozillaHomeUrl $
        mozillaWorkUrl $
        description $  
        mozillaCustom1 $
        mozillaCustom2 $
        mozillaCustom3 $
        mozillaCustom4 ) )

# not part of the official Mozilla schema but read by Mozilla: 'departmentNumber' and 'postOfficeBox'
#
 


modifie /program/config/main.inc.php
and add this on your $rcmail_config['ldap_public']['XXX'] section

  
'writable'      => true,   // Indicates if we can write to the LDAP directory or not.
  // If writable is true then these fields need to be populated:
  // LDAP_Object_Classes, required_fields, LDAP_rdn
  
'LDAP_Object_Classes' => array("top""inetOrgPerson""mozillaOrgPerson"), // To create a new contact these are the object classes to specify (or any oth
  
'required_fields'     => array("cn""sn""mail"),     // The required fields needed to build a new contact as required by the object classes (can includ
  
'LDAP_rdn'      => 'mail'// The RDN field that is used for new entries, this field needs to be one of the search_fields, the base of base_dn is appended
  
'ldap_version'  => 3,       // using LDAPv3
  
'search_fields' => array('mail''cn','mozillaSecondEmail' ),  // fields to search in

// identity block
  
'name_field'    => 'cn',
  
'surname_field' => 'sn',
  
'firstname_field' => 'givenName',
  
'email_field'   => 'mail',
  
'email2_field'  => 'mozillaSecondEmail',

// telephone block
  
'w_tel_field' => 'telephoneNumber',
  
'p_tel_field' => 'homePhone',
  
'w_fax_field' => 'facsimileTelephoneNumber',
  
'w_mob_field' => 'mobile',
  
// business data block
  
'company_field'       => 'o',
  
'w_address_field'     => 'street',
  
'w_postcode_field'    => 'postalCode',
  
'w_city_field'        => 'l',
  
'w_url_field'         => 'mozillaWorkUrl',
  
// personel data block
  
'p_address_field'     => 'mozillaHomeStreet',
  
'p_postcode_field'    => 'mozillaHomePostalCode',
  
'p_city_field'        => 'mozillaHomeLocalityName',
  
'p_url_field'         => 'mozillaHomeUrl',  

// description block
  
'desc_field'          => 'description',
    
  
'sort'          => 'cn',    // The field to sort the listing by.
  
'scope'         => 'sub',   // search mode: sub|base|list
  
'filter'        => '',      // used for basic listing (if not empty) and will be &'d with search queries. example: status=act
  
'fuzzy_search'  => true);   // server allows wildcard search




modiefie /program/include/main.inc
search for

if ($type=='checkbox')
     {
     
$attrib['value'] = '1';
     
$input = new html_checkbox($attrib);


and replace with

  
if($col == "desc")
    {
        
$attrib['rows'] = "5";
        
$attrib['size'] = "60";
        
$attrib['cols'] = "60";
        
$input = new html_textarea($attrib);
    }
    else if (
$type=='checkbox')
     {
     
$attrib['value'] = '1';
     
$input = new html_checkbox($attrib);



modifie /program/include/rcube_contacts.php
search for

var $table_cols = array('name''email''firstname''surname');  


and replace with

 
var $table_cols = array('name''firstname''surname''email''email2''w_tel''p_tel''w_fax''w_mob''company''w_address''w_postcode''w_city''w_url''p_address''p_postcode''p_city''p_url''desc');


modifie /program/localization/fr_FR/labels.inc
add the lines

/* ========================
   Extended Adress Book
   ======================== */

// identity block
$labels['namelegend'] = $labels['surnamelegend'] = 'Identité';

// mail block
$labels['emaillegend'] = $labels['email2legend'] = 'E-mail';
$labels['email2'] = 'Adresse alternative   ';

// telephone block
$labels['w_tellegend'] = $labels['w_moblegend'] = 'Numéros de téléphone';
$labels['w_tel'] = 'Travail   ';
$labels['p_tel'] = 'Domicile';
$labels['w_fax'] = 'Fax';
$labels['w_mob'] = 'Portable';

// business block
$labels['companylegend'] = $labels['w_urllegend'] = 'Professionnel';
$labels['company'] = 'Société';
$labels['w_address'] = 'Adresse';
$labels['w_postcode'] = 'Code postal';
$labels['w_city'] = 'Ville';  
$labels['w_url'] = 'Page Web';

// home block
$labels['p_addresslegend'] = $labels['p_urllegend'] = 'Personnel';
$labels['p_address']   = 'Adresse';
$labels['p_postcode'] = 'Code postal';
$labels['p_city'] = 'Ville';
$labels['p_url'] = 'Page Web';

// description block
$labels['desc']   = ' ';
$labels['desclegend'] = 'Remarques';


Offline atuin

  • Newbie
  • *
  • Posts: 3
Extended add book full compatible with thunderbird ldap
« Reply #35 on: March 16, 2009, 08:29:23 AM »
part 2

modifie /program/include/rcube_ldap.php
search for

// The field does exist, add it to the entry.
$newentry[$fld] = $val;


and replace with

// The field does exist, add it to the entry.
// correct bug ldap_add() - null values in fields produce an "value #0 invalid per syntax" error on openldap 2.4
if ($val != "" $newentry[$fld] = $val;


modiefie /program/steps/addressbook/copy.inc
search for
$success $TARGET->insert($CONTACTS->search($CONTACTS->primary_key$cid), true);

and replace with

    $ids explode','$cid );

  foreach ( 
$ids as $id )
  {
    
$record $CONTACTS->search$CONTACTS->primary_key$id );
    
$success[$id] = $TARGET->insert$record->records[0], true );
  }


modiefie /program/steps/addressbook/edit.inc
search for
$out "$form_start<table>\n\n";

and replace with
$out "$form_start\n\n";

search for
$a_show_cols = array('name''firstname''surname''email');

and replace with
$a_show_cols = array('name''firstname''surname''email''email2''w_tel''p_tel''w_fax''w_mob''company''w_address''w_postcode''w_city'
'w_url''p_address''p_postcode''p_city''p_url''desc');


search for

foreach ($a_show_cols as $col)
   { 


and add after

if($col=='name' or $col=='email' or $col=='w_tel' or $col=='company' or $col=='p_address' or $col=='desc')
  
$out .= "<div class='contactdetails-block'><fieldset><legend>".Q(rcube_label($col.'legend'))."</legend><table>";


search for
Q(rcube_label($col)),
                     
$value);
   }  


and replace with

Q
(rcube_label($col)),
              
$value);
    if(
$col=='surname' or $col=='email2' or $col=='w_mob' or $col=='w_url' or $col=='p_url' or $col=='desc')
      
$out .= "</fieldset></table></div>";
   }


search for
$out .= "\n</table>$form_end";

and replace with
$out .= "\n$form_end";

modiefie /program/steps/addressbook/save.inc
search for
$a_save_cols = array('name''firstname''surname''email');

and replace with
$a_save_cols = array('name''firstname''surname''email''email2''w_tel''p_tel''w_fax''w_mob''company''w_address''w_postcode''w_city''w_url''p_address''p_postcode''p_city''p_url''desc');

modiefie /program/steps/addressbook/show.inc
search for
$a_show_cols = array('name''firstname''surname''email');

and replace with
$a_show_cols = array('name''firstname''surname''email''email2''w_tel''p_tel''w_fax''w_mob''company''w_address''w_postcode''w_city''w_url''p_address''p_postcode''p_city''p_url''desc');

search for
if ($col == 'email' && !empty($record[$col])) {

and replace with
    if($col=='name' or $col=='email' or $col=='w_tel' or $col=='company' or $col=='p_address' or $col=='desc')
      
$table = new html_table(array('cols' => 2));

    if ((
$col=='email' || $col=='email2') && !empty($record[$col])) {


add just after

         
'class' => $microformats[$col],
       ), 
Q($record[$col]));
     }



    
else if (($col=='w_url' || $col=='p_url') && !empty($record[$col])) {  
      
$value html::a(array(
        
'href' => $record[$col],
	
'target' => '_blank',
        
'class' => $microformats[$col],
      ), 
Q($record[$col]));
    }



search for
}
return 
$table->show($attrib + array('class' => 'vcard'));


and replace with


    
if ($table->size() and ($col=='surname' or $col=='email2' or $col=='w_mob' or $col=='w_url' or $col=='p_url' or $col=='desc'))
      
$out .= html::tag('div', array('class' => 'contactdetails-block'),html::tag('fieldset'nullhtml::tag('legend'nullQ(rcube_label($col.'legend'))) . $table->show($attrib  array('class' => 'vcard'))));
   

  }
  return 
$out;  






modiefie  how lacri has :
    • /program/steps/mail/autocomplete.inc
    • /skins/default/addresses.css
    • /skins/default/templates/editcontact.html
    • /skins/default/templates/showcontact.html[/I][/B]
    execute on your db this sql script
    ALTER TABLE `contactsADD `email2VARCHAR(128NOT NULL ;
    ALTER TABLE `contactsADD `w_telVARCHAR(20NOT NULL ;
    ALTER TABLE `contactsADD `p_telVARCHAR(30NOT NULL ;
    ALTER TABLE `contactsADD `w_faxVARCHAR(20NOT NULL ;
    ALTER TABLE `contactsADD `w_mobVARCHAR(20NOT NULL ;
    ALTER TABLE `contactsADD `companyVARCHAR(50NOT NULL ;
    ALTER TABLE `contactsADD `w_addressTEXT NOT NULL;
    ALTER TABLE `contactsADD `w_postcodeVARCHAR(10NOT NULL;
    ALTER TABLE `contactsADD `w_cityVARCHAR(15NOT NULL;
    ALTER TABLE `contactsADD `w_urlVARCHAR(64NOT NULL;
    ALTER TABLE `contactsADD `p_addressTEXT NOT NULL;
    ALTER TABLE `contactsADD `p_postcodeVARCHAR(10NOT NULL;
    ALTER TABLE `contactsADD `p_cityVARCHAR(15NOT NULL;
    ALTER TABLE `contactsADD `p_urlVARCHAR(64NOT NULL;
    ALTER TABLE `contactsADD `descTEXT NOT NULL;


    Now, when you add a contact in roundcube, all field are present in your
    thunderbird add book like screenshots

    Offline Aoster

    • Newbie
    • *
    • Posts: 3
    Global Address Book with additional fields and additional email addresses
    « Reply #36 on: March 16, 2009, 10:43:25 AM »
    Hi lacri,

    thank you very much for the patch :-)

    kind regards

    Andreas

    Offline Dan69

    • Newbie
    • *
    • Posts: 1
    Patch
    « Reply #37 on: March 19, 2009, 11:19:46 AM »
    Hi,
    How can I apply the patch *.diff?
    Thanks
    Dan

    Offline jjhunt

    • Jr. Member
    • **
    • Posts: 27
    Global Address Book with additional fields and additional email addresses
    « Reply #38 on: March 24, 2009, 10:02:18 PM »
    We're running RoundCube v0.2-stable, and our users are missing the ability to create contact groups.  I just discovered this patch.  We don't really need the global address book feature, but sure could use the ability to allow users to create contact groups, so they can send mail to groups of people easily.  It looks like this patch will do that.

    I also see in the roadmap, that RoundCube will implement contact groups in v0.4.   Will this patch be the basis for that feature implementation?  The reason I ask is that it looks like this patch required changes to the MySQL database.  I'm wondering if that will be compatible with the actual contact group integrated into RoundCube.

    Thanks for any information,
    Jackie

    Offline black_13

    • Newbie
    • *
    • Posts: 1
      • http://diff.org.ua
    is this work with virsion 0.3
    « Reply #39 on: August 04, 2009, 11:14:05 AM »
    Enybody using global adresbook on version 0.3 ?

    Offline kendokar

    • Newbie
    • *
    • Posts: 4
    Global Address Book with additional fields and additional email addresses
    « Reply #40 on: August 06, 2009, 03:08:30 AM »
    Hi,
    Please I'm sorry for my dumb question..
    Can anyone tell me what for this global addressbook plugin..

    thanks..

    Offline duyn

    • Newbie
    • *
    • Posts: 2
    add drop-down menu
    « Reply #41 on: September 17, 2009, 11:28:17 AM »
    Hi all,

    Thank you for the advanced address book. It's awesome. I would like to know how can I add drop-down menu type in the advanced address book. For example, I want to categorize my contacts list in : friend / family / co-worker etc... It is cool if I can assign each contact to a category using drop-down menu.

    I appreciate for any guidance.


    Thank you

    Offline aaronsaks

    • Newbie
    • *
    • Posts: 1
    Global Address book for .3
    « Reply #42 on: September 17, 2009, 10:32:50 PM »
    Has anyone successfully added the global address patch for version .3?

    I found some lines missing, and it didn't work.

    Any help would be greatly appriciated...

    -Aaron

    Offline utiltiy

    • Newbie
    • *
    • Posts: 4
    HOW TO, current SVN Version for Global Adressbook
    « Reply #43 on: October 08, 2009, 02:33:15 AM »
    Hello,

    i will use the Global Adress Book with the Current SVN Version.

    Have anyone a HOW TO for me in one Post please. I'm not sure whatever it's do change and modified on PHP and MySQL.

    Thanks :)

    Offline JohnDoh

    • Global Moderator
    • Hero Member
    • *****
    • Posts: 2,845
    Global Address Book with additional fields and additional email addresses
    « Reply #44 on: October 08, 2009, 04:26:30 AM »
    Making a global address book plugin is really easy - if any one is interested I can put one online this evening. It wont have the extended fields though, since that requires patching the core. I think having a global address book and having more fields are 2 different issues.

    I submitted a patch to the dev mailing list which adds more fields to the address book, I think we are on about version 3 now, you can see the thread here RoundCube Mailing Lists if you want to try it then the SVN version the patch is intended for is in the file name - you need the right SVN version not the 0.3 release.

    Update: A plugin which adds an sql based global address book is available here: http://tehinterweb.co.uk/roundcube/#piglobaladdressbook
    « Last Edit: October 08, 2009, 02:30:19 PM by JohnDoh »
    Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…