modiefie /program/steps/addressbook/show.inc
search for
PHP Code:
$a_show_cols = array('name', 'firstname', 'surname', 'email');
and replace with
PHP Code:
$a_show_cols = array('global_contact', 'name', 'firstname', 'surname', 'email', 'notice', 'firm', 'position', 'w_address', 'w_tel', 'w_fax', 'w_mob', 'email2', 'email3', 'email4', 'p_address', 'p_tel', 'p_fax', 'p_mob');
search for and delete
PHP Code:
$table = new html_table(array('cols' => 2));
search for
PHP Code:
$microformats = array('name' => 'fn', 'email' => 'email');
and add after
PHP Code:
$i = 1;
foreach ($a_show_cols as $col) {
if($col=='global_contact' or $col=='email2' or $col=='firm' or $col=='p_address')
$table = new html_table(array('cols' => 2));
search for and delete
PHP Code:
foreach ($a_show_cols as $col) {
search for
PHP Code:
}
return $table->show($attrib + array('class' => 'vcard'));
and replace with
PHP Code:
if ($table->size() and ($col=='notice' or $col=='email4' or $col=='w_mob' or $col=='p_mob'))
{
$out .= html::tag('div', array('class' => 'contactdetails-block'),html::tag('fieldset', null, html::tag('legend', null, Q(rcube_label($col.'legend'))) . $table->show($attrib + array('class' => 'vcard'))));
}
$i++;
}
return $out;
search for
PHP Code:
if ($col == 'email' && !empty($record[$col])) {
and replace with
PHP Code:
if (($col=='email' || $col=='email2' || $col=='email3' || $col=='email4') && !empty($record[$col])) {
search for
PHP Code:
'class' => $microformats[$col],
), Q($record[$col]));
}
else if (!empty($record[$col])) {
$value = html::span($microformats[$col], Q($record[$col]));
}
and replace with
PHP Code:
'class' => $microformats[$col],
), Q($record[$col]));
}
else if ($col=='global_contact') {
$value = html::span($microformats[$col],rcube_label($record[$col]== 1 ?'globalyes':'globalno'));
}
else if (!empty($record[$col])) {
$value = html::span($microformats[$col], Q($record[$col]));
}
search for
PHP Code:
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
$OUTPUT->send('showcontact');
and replace with
PHP Code:
$OUTPUT->add_handler('contactdetails', 'rcmail_contact_details');
if($record['global_contact'] != 1)
{
$OUTPUT->send('showcontact');
}
else
{
$OUTPUT->send('noedit_showcontact');
}
modiefie /program/steps/addressbook/delete.inc
search for
PHP Code:
preg_match('/^[a-zA-Z0-9=]+(,[a-zA-Z0-9=]+)*$/', $cid))
)
{
$deleted = $CONTACTS->delete($cid);
and replace with
PHP Code:
preg_match('/^[a-zA-Z0-9=]+(,[a-zA-Z0-9=]+)*$/', $cid))
)
{
if ($record = $CONTACTS->get_record($cid, true))
$OUTPUT->set_env('cid', $record['ID']);
// adding not allowed here
if ($CONTACTS->readonly)
{
$OUTPUT->show_message('sourceisreadonly');
rcmail_overwrite_action('show');
}
elseif($record['global_contact'] == 1) {
$OUTPUT->show_message('addressisreadonly', 'error');
rcmail_overwrite_action('show');
$OUTPUT->send();
exit();
}
else
{
$deleted = $CONTACTS->delete($cid);
search for
PHP Code:
// send error message
exit;
and replace with
PHP Code:
$OUTPUT->show_message('contacterrorsaved', 'warning');
rcmail_overwrite_action('show');
$OUTPUT->send();
exit();
search for
PHP Code:
if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages)
rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted));
and add the lines
PHP Code:
$OUTPUT->show_message('successfullysaved', 'confirmation');
rcmail_overwrite_action('show');
search for
PHP Code:
$OUTPUT->send();
exit();
}
// count contacts for this user
and replace with
PHP Code:
$OUTPUT->send();
exit();
}
else
{
// count contacts for this user
search for
PHP Code:
// send response
$OUTPUT->send();
}
?>
and replace with
PHP Code:
// send response
$OUTPUT->send();
}
}
}
?>
modiefie /program/steps/addressbook/edit.inc
search for
PHP Code:
rcmail_overwrite_action('show');
return;
}
function rcmail_contact_editform($attrib)
{
and replace with
PHP Code:
rcmail_overwrite_action('show');
return;
}
elseif($record['global_contact'] == 1) {
$OUTPUT->show_message('addressisreadonly', 'error');
rcmail_overwrite_action('show');
return;
}
function rcmail_contact_editform($attrib)
{
search for
PHP Code:
$a_show_cols = array('name', 'firstname', 'surname', 'email');
and replace with
PHP Code:
$a_show_cols = array('name', 'firstname', 'surname', 'email', 'notice', 'firm', 'position', 'w_address', 'w_tel', 'w_fax', 'w_mob', 'email2', 'email3', 'email4', 'p_address', 'p_tel', 'p_fax', 'p_mob');
search for
PHP Code:
// this will be executed if no template for addcontact exists
$OUTPUT->send('editcontact');
and replace with
PHP Code:
// this will be executed if no template for addcontact exists
if($record['global_contact'] != 1)
$OUTPUT->send('editcontact');
else
$OUTPUT->send('noedit_editcontact');
search for
PHP Code:
$out = "$form_start<table>\n\n";
and replace with
PHP Code:
$out = "$form_start\n\n";
search for
PHP Code:
foreach ($a_show_cols as $col)
{
and add after
PHP Code:
if($col=='name' or $col=='email2' or $col=='firm' or $col=='p_address')
$out .= "<div class='contactdetails-block'><fieldset><legend>".Q(rcube_label($col.'legend'))."</legend><table>";
search for
PHP Code:
Q(rcube_label($col)),
$value);
}
and replace with
PHP Code:
Q(rcube_label($col)),
$value);
if($col=='notice' or $col=='email4' or $col=='w_mob' or $col=='p_mob')
$out .= "</fieldset></table></div>";
}
search for
PHP Code:
$out .= "\n</table>$form_end";
and replace with
PHP Code:
$out .= "\n$form_end";
modiefie /program/steps/mail/autocomplete.inc
search for
PHP Code:
if ($result = $abook->search(array('email','name'), $search)) {
while ($sql_arr = $result->iterate()) {
if (stripos((string)$sql_arr['email'], $search) !== false || stripos((string)$sql_arr['name'], $search) !== false) {
$contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
}
and replace with
PHP Code:
if ($result = $abook->search(array('email','name','email2','email3','email4'), $search)) {
while ($sql_arr = $result->iterate()) {
if (stripos((string)$sql_arr['email'], $search) !== false || stripos((string)$sql_arr['name'], $search) !== false) {
$contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
}
if (stripos((string)$sql_arr['email2'], $search) !== false) {
$contacts[] = format_email_recipient($sql_arr['email2'], $sql_arr['name']);
}
if (stripos((string)$sql_arr['email3'], $search) !== false) {
$contacts[] = format_email_recipient($sql_arr['email3'], $sql_arr['name']);
}
if (stripos((string)$sql_arr['email4'], $search) !== false) {
$contacts[] = format_email_recipient($sql_arr['email4'], $sql_arr['name']);
}
to disabled the delete button and DEL/Entf Key add the ID from Global Contact to
/program/js/app.js
search for
PHP Code:
this.enable_command('delete', list.selection.length && this.env.address_sources && !this.env.address_sources[this.env.source].readonly);
and add at the end this replace 275 with your global contacts id you can add more then one id
PHP Code:
this.enable_command('delete', list.selection.length && this.env.address_sources && !this.env.address_sources[this.env.source].readonly && id != 275);
and at the end
PHP Code:
# ----------------
#
# 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 ;
# -------------------------------------------------------------