#1484923 closed Feature Requests (wontfix)
Add advanced addressbook to future release. (patch included)
| Reported by: | cornbread | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | |
| Component: | Core functionality | Version: | 0.1-stable |
| Severity: | major | Keywords: | contacts patch |
| Cc: |
Description
Lots of people would like o see this in the future release.
+------------------------------------------------------------------------+
| ADVANCED ADDRESSBOOK plugin for RoundCube 0.1stable |
| |
| Use this plugin at your own risk!! BACK UP YOUR FILES AND DATABASE |
| BEFORE SAVING CHANGES!! You've been warned!! |
| |
| PURPOSE: |
| Adds additional fields to RC's addressbook and global contact feature! |
| |
+------------------------------------------------------------------------+
| Author: Helga |
| => http://roundcubeforum.net/forum/index.php?topic=737.msg3238#msg3238 |
| |
| Modified by David Loendorf for RC1 and global contact option |
| Modified/updated by Rudy for 0.1stable |
+------------------------------------------------------------------------+
#
# ------[ 1 . 0 ]----------------------------------------------------------------------------------------------------
#
##################
###[ STEP 1.1 ]###
# OPEN
/program/include/rcube_contacts.inc
# FIND (line 37)
var $table_cols = array('name', 'email', 'firstname', 'surname');
# REPLACE with
var $table_cols = array('name', 'firstname', 'surname', 'email', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
##################
###[ STEP 1.2 ]###
# FIND (line 159)
AND user_id=?" .
# REPLACE with
AND (user_id=? OR global_contact = 1)" .
##################
###[ STEP 1.2 ]###
# FIND (line 232)
AND user_id=?".
# REPLACE with
AND (user_id=? OR global_contact = 1)".
##################
###[ STEP 1.3 ]###
# FIND (line 267)
AND user_id=?
# REPLACE with
AND (user_id=? OR global_contact = 1)
##################
###[ STEP 1.4 ]###
# FIND (line 358)
AND user_id=?
# REPLACE with
AND (user_id=? OR global_contact = 1)
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 2 . 0 ]----------------------------------------------------------------------------------------------------
#
##################
###[ STEP 2.1 ]###
# OPEN
/program/include/main.inc
# FIND (line1327)
if ($type=='checkbox')
# REPLACE with
if($col == "notice")
{
$attrib['rows'] = "8";
$attrib['size'] = "40";
$attrib['cols'] = "40";
$input = new textarea($attrib);
}
elseif($col == "p_address" | $col == "w_address")
{
$attrib['rows'] = "4";
$attrib['size'] = "40";
$attrib['cols'] = "40";
$input = new textarea($attrib);
}
else if ($type=='checkbox')
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 3 . 0 ]----------------------------------------------------------------------------------------------------
#
# NOTE: You have to add (or translate) the following changes to all language files you want to use! Below you'll find the
# English and German translations.
##################
###[ STEP 3.1 ]###
# OPEN (English localization file)
/program/localization/en_US/label.inc
# FIND the line which contains
$labels['email']
# ADD BELOW
$labels['global_contact'] = 'Global Contact?';
$labels['firm'] = 'Organization:';
$labels['position'] = 'Position:';
$labels['p_tel'] = 'Telephone:';
$labels['p_fax'] = 'Fax:';
$labels['p_mob'] = 'Mobile:';
$labels['p_address'] = 'Address:';
$labels['w_tel'] = 'Business Telephone:';
$labels['w_fax'] = 'Business Fax:';
$labels['w_mob'] = 'Business Mobile:';
$labels['w_address'] = 'Business Address:';
$labels['notice'] = 'Notes:';
##################
###[ STEP 3.2 ]###
# SKIP this step if you don't need the german localization.
# OPEN (German localization file)
/program/localization/de_DE/label.inc
# FIND the line which contains
$labels['email']
# ADD BELOW
$labels['global_contact'] = 'Globaler Kontakt?';
$labels['firm'] = 'Organisation:';
$labels['position'] = 'Position:';
$labels['p_tel'] = 'Telefon:';
$labels['p_fax'] = 'Fax:';
$labels['p_mob'] = 'Mobil:';
$labels['p_address'] = 'Adresse Privat:';
$labels['w_tel'] = 'Telefon Geschäftlich:';
$labels['w_fax'] = 'Fax Geschäftlich:';
$labels['w_mob'] = 'Mobil Geschäftlich:';
$labels['w_address'] = 'Adresse Geschäftlich:';
$labels['notice'] = 'Bemerkung:';
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 4 . 0 ]----------------------------------------------------------------------------------------------------
#
##################
###[ STEP 4.1 ]###
# OPEN
/program/steps/addressbook/edit.inc
# FIND (line 64)
$a_show_cols = array('name', 'firstname', 'surname', 'email');
# REPLACE with
$a_show_cols = array('name', 'firstname', 'surname', 'global_contact', 'email', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
##################
###[ STEP 4.2 ]###
# FIND (line 67)
$attrib['id'] = 'rcmfd_'.$col;
# ADD BELOW
if($col == "global_contact")
$value = rcmail_get_edit_field($col, $record[$col], $attrib, 'checkbox');
else
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 5 . 0 ]----------------------------------------------------------------------------------------------------
#
##################
###[ STEP 5.1 ]###
# OPEN
/program/steps/addressbook/save.inc
# FIND (line 40)
$a_save_cols = array('name', 'firstname', 'surname', 'email');
# REPLACE with
$a_save_cols = array('name', 'firstname', 'surname', 'email', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
##################
###[ STEP 5.2 ]###
# FIND (line 48)
if (isset($_POST[$fname]))
$a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST);
# REPLACE WITH
if($col == 'global_contact'){
if(isset($_POST[$fname])){
$a_record[$col] = 1;
}else{
$a_record[$col] = 0;
}
} else if (isset($_POST[$fname])){
$a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST);
}
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 6 . 0 ]----------------------------------------------------------------------------------------------------
#
##################
###[ STEP 6.1 ]###
# OPEN
/program/steps/addressbook/show.inc
# FIND (line 46)
$a_show_cols = array('name', 'firstname', 'surname', 'email');
# REPLACE with (NOTE: Unfortunately the two labels "Data" and "Contact" are not yet included in the roundcube localization
# file. If someone could help me out on this one I would really appreciate it. As it is for now just translate these two
# labels into your default language.
$data ="<td width=\"45%\" valign=\"top\">\n<fieldset width=\"45%\" class=\"title\"><legend><b>Data</b></legend><table>\n\n";
$contact ="<td width=\"45%\" valign=\"top\">\n<fieldset width=\"45%\" class=\"title\"><legend><b>Contact</b></legend><table>\n\n";
$a_show_cols = array('name', 'firstname', 'surname', 'email', 'global_contact', 'firm', 'position', 'p_tel', 'p_fax', 'p_mob', 'p_address', 'w_tel', 'w_fax', 'w_mob', 'w_address', 'notice');
# FIND (line 59-64)
$out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n",
Q(rcube_label($col)),
$value);
}
$out .= "\n</table>";
# REPLACE with
$title = Q(rcube_label($col));
if($col == "notice"){
$out2 = "<td colspan=\"3\" width=\"100%\" valign=\"top\"><fieldset width=\"100%\" class=\"title\"><legend><b>$title</b></legend><table>\n";
$out2 .= sprintf("<tr><td>%s</td></tr>\n", $value);
$out2 .= "</table></fieldset></td>\n\n";
}
elseif($col == "p_tel" | $col == "p_fax" | $col == "p_mob" | $col == "w_tel" | $col == "w_fax" | $col == "w_mob"){
if(!$value == ""){
$contact .= sprintf("<tr><td>%s</td><td>%s</td></tr>\n",$title, $value);
}
}
elseif($col == "p_address"){
$p_address = "<td width=\"45%\" valign=\"top\"><fieldset width=\"45%\" class=\"title\"><legend><b>$title</b></legend><table>\n";
$p_address .= sprintf("<tr><td>%s</td></tr>\n", $value);
$p_address .= "</table></fieldset></td>\n\n";
}
elseif($col == "w_address"){
$w_address = "<td width=\"45%\" valign=\"top\"><fieldset width=\"45%\" class=\"title\"><legend><b>$title</b></legend><table>\n";
$w_address .= sprintf("<tr><td>%s</td></tr>\n", $value);
$w_address .= "</table></fieldset></td>\n\n";
}
else{
if($col == "global_contact"){
if($value == 1)
$data .= sprintf("<tr><td>%s</td><td>%s</td></tr>\n",$title, '✔');
else
$data .= sprintf("<tr><td>%s</td><td>%s</td></tr>\n",$title, '✘');
} else if(!$value == "")
$data .= sprintf("<tr><td>%s</td><td>%s</td></tr>\n",$title, $value);
}
}
$data .= "</table></td>";
$contact .= "</table></td>";
$out .= "$data<td width=\"2%\">$contact\n\n";
$out .= "</tr><tr>";
$out .= "$p_address<td width=\"2%\">$w_address\n\n";
$out .= "</tr><tr>";
$out .= $out2;
$out .= "\n</tr></table>";
#
# ------[ CLOSE & SAVE ]---------------------------------------------------------------------------------------------
#
#
# ------[ 7 . 0 ]----------------------------------------------------------------------------------------------------
#
# MySQL Database Update
#
# Run this code in phpMyAdmin on the database that holds the RoundCube contacts table. If you changed the contact table
# name to something different you need to adjust the following code!
# RUN this SQL code:
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;
#
# ------[ THE END =) ]----------------------------------------------------------------------------------------------
#
That's it! You're all set. Have fun and enjoy. Thank you Helga for this essential plugin and many thanks to David Loendor
for updating it to RC1. :D
Attachments (1)
Change History (4)
comment:1 Changed 5 years ago by xyanide
comment:2 Changed 5 years ago by thomasb
- Keywords contacts patch added; feature request removed
- Milestone 0.1.2 deleted
- Resolution set to wontfix
- Status changed from new to closed
You should definitely learn about http://en.wikipedia.org/wiki/Diff diff :-)
What we have in mind is a rich address book with flexible fields and no fixed structure. Your approach surely works but it's not what is planned for the RoundCube address book. Sorry!
comment:3 Changed 5 years ago by ASeques
I just made a patch of your changes versus 0.1.1, nice feature by the way.
Otherwise it's impossible to migrate from existing horde setups ...
Note: See
TracTickets for help on using
tickets.

+1 I`d also like to see this to in a future release.