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

Offline jonsjava

  • Jr. Member
  • **
  • Posts: 11
Global Address Book with additional fields and additional email addresses
« Reply #15 on: October 16, 2008, 05:11:19 PM »
Here's a mod to the script, to remove Global Address Book
I work for an ISP, and we don't want all users sharing their addresses, so I took what you had, and removed that feature.
<?php
# ----------------
#
# 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 `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 ;
 */
# -------------------------------------------------------------

#
# In file /program/include/rcube_contacts.inc
#
#Locate
var $table_cols = array('name''email''firstname''surname');
#
# and replace with
 
var $table_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
---------------------------------------------------------
#
# In file /program/include/main.inc
#
#Locate the following function
function rcmail_get_edit_field($col$value$attrib$type='text')
#
#and locate the following code
 
if ($type=='checkbox')
#
#and replace with the following code
 
if($col == "notice")
  {
        
$attrib['rows'] = "8";
        
$attrib['size'] = "40";
        
$attrib['cols'] = "40";
        
$input = new html_textarea($attrib);
        }
 elseif(
$col == "p_address" $col == "w_address")
  {
        
$attrib['rows'] = "4";
        
$attrib['size'] = "40";
        
$attrib['cols'] = "40";
        
$input = new html_textarea($attrib);
        }
 else if (
$type=='checkbox')
#
----------------------------------------------------------
#
# In File /program/localization/en_US/label.inc
#
#Locate // address boook
#
#and insert the following labels
$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';

$labels['email2']  = 'E-Mail 2';
$labels['email3']  = 'E-Mail 3';
$labels['email4']  = 'E-Mail 4';
#
# --------------------------------------------------------
#
# In file /program/steps/mail/compose.inc
#
#locate the following if statement
if ($result $CONTACTS->list_records())
#
#locate the following code
 
while ($sql_arr $result->iterate())
  if (
$sql_arr['email'])
           
$a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
#
#and insert the following code after that
  
if ($sql_arr['email2'])
   
$a_contacts[] = format_email_recipient($sql_arr['email2'], $sql_arr['name']);
  if (
$sql_arr['email3'])
   
$a_contacts[] = format_email_recipient($sql_arr['email3'], $sql_arr['name']);
  if (
$sql_arr['email4'])
   
$a_contacts[] = format_email_recipient($sql_arr['email4'], $sql_arr['name']);
#
# --------------------------------------------------------
#
# In file /program/steps/addressbook/edit.inc
#
#locate  // return the complete address edit form as table
#
#and the following code
 
$a_show_cols = array('name''firstname''surname''email');
#
#and replace with the following code
 
$a_show_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
# --------------------------------------------------------
#
# In file /program/steps/addressbook/show.inc
#
#Locate  // return the complete address record as table
#and the following code
 
$a_show_cols = array('name''firstname''surname''email');
#
#and replace with the following code
 
$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''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
#The old version of this had things like $out .=sprint#. I have found that all of this is unnecessary in the new version and also the closing table tags because of how the new
#handles the tags for this area.
#
#
#Locate the following code
  
if ($col=='email' && !empty($record[$col]))
#
#and replace with the following code
  
if (($col=='email' || $col=='email2' || $col=='email3' || $col=='email4') && !empty($record[$col]))
#
# ---------------------------------------------------------
#
# In file /program/steps/addressbook/save.inc
#
#Locate // setup some vars we need
#and the following code
$a_save_cols = array('name''firstname''surname''email');
#
#and replace with the following code
$a_save_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
#Locate the folllowing code
 
if (isset($_POST[$fname]))
#
#and replace with the following code
if (isset($_POST[$fname])){
  
$a_record[$col] = get_input_value($fnameRCUBE_INPUT_POST);
 }
#
# ---------------------------------------------------------
#I have left out the template piece because this can change depending on the template installed.
# ---------------------------------------------------------

Offline Yann

  • Jr. Member
  • **
  • Posts: 46
Global Address Book with additional fields and additional email addresses
« Reply #16 on: October 23, 2008, 07:38:37 PM »
Quote from: jonsjava;14689
Here's a mod to the script, to remove Global Address Book
I work for an ISP, and we don't want all users sharing their addresses, so I took what you had, and removed that feature.
<?php
# ----------------
#
# 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 `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 ;
 */
# -------------------------------------------------------------

#
# In file /program/include/rcube_contacts.inc
#
#Locate
var $table_cols = array('name''email''firstname''surname');
#
# and replace with
 
var $table_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
---------------------------------------------------------
#
# In file /program/include/main.inc
#
#Locate the following function
function rcmail_get_edit_field($col$value$attrib$type='text')
#
#and locate the following code
 
if ($type=='checkbox')
#
#and replace with the following code
 
if($col == "notice")
  {
        
$attrib['rows'] = "8";
        
$attrib['size'] = "40";
        
$attrib['cols'] = "40";
        
$input = new html_textarea($attrib);
        }
 elseif(
$col == "p_address" $col == "w_address")
  {
        
$attrib['rows'] = "4";
        
$attrib['size'] = "40";
        
$attrib['cols'] = "40";
        
$input = new html_textarea($attrib);
        }
 else if (
$type=='checkbox')
#
----------------------------------------------------------
#
# In File /program/localization/en_US/label.inc
#
#Locate // address boook
#
#and insert the following labels
$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';

$labels['email2']  = 'E-Mail 2';
$labels['email3']  = 'E-Mail 3';
$labels['email4']  = 'E-Mail 4';
#
# --------------------------------------------------------
#
# In file /program/steps/mail/compose.inc
#
#locate the following if statement
if ($result $CONTACTS->list_records())
#
#locate the following code
 
while ($sql_arr $result->iterate())
  if (
$sql_arr['email'])
           
$a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
#
#and insert the following code after that
  
if ($sql_arr['email2'])
   
$a_contacts[] = format_email_recipient($sql_arr['email2'], $sql_arr['name']);
  if (
$sql_arr['email3'])
   
$a_contacts[] = format_email_recipient($sql_arr['email3'], $sql_arr['name']);
  if (
$sql_arr['email4'])
   
$a_contacts[] = format_email_recipient($sql_arr['email4'], $sql_arr['name']);
#
# --------------------------------------------------------
#
# In file /program/steps/addressbook/edit.inc
#
#locate  // return the complete address edit form as table
#
#and the following code
 
$a_show_cols = array('name''firstname''surname''email');
#
#and replace with the following code
 
$a_show_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
# --------------------------------------------------------
#
# In file /program/steps/addressbook/show.inc
#
#Locate  // return the complete address record as table
#and the following code
 
$a_show_cols = array('name''firstname''surname''email');
#
#and replace with the following code
 
$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''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
#The old version of this had things like $out .=sprint#. I have found that all of this is unnecessary in the new version and also the closing table tags because of how the new
#handles the tags for this area.
#
#
#Locate the following code
  
if ($col=='email' && !empty($record[$col]))
#
#and replace with the following code
  
if (($col=='email' || $col=='email2' || $col=='email3' || $col=='email4') && !empty($record[$col]))
#
# ---------------------------------------------------------
#
# In file /program/steps/addressbook/save.inc
#
#Locate // setup some vars we need
#and the following code
$a_save_cols = array('name''firstname''surname''email');
#
#and replace with the following code
$a_save_cols = array('name''firstname''surname''email''email2''email3''email4''firm''position''p_tel''p_fax''p_mob''p_address''w_tel''w_fax''w_mob''w_address''notice');
#
#
#Locate the folllowing code
 
if (isset($_POST[$fname]))
#
#and replace with the following code
if (isset($_POST[$fname])){
  
$a_record[$col] = get_input_value($fnameRCUBE_INPUT_POST);
 }
#
# ---------------------------------------------------------
#I have left out the template piece because this can change depending on the template installed.
# ---------------------------------------------------------


Any help here, I used the code in RC 0.2Beta, everything displayed correctly but I could NOT save the address book. I received "The website cannot display the page" error.

cicadess

  • Guest
wow gold or powerleveing
« Reply #17 on: October 25, 2008, 05:21:05 AM »
Looking for the best places to buy wow gold  wow gold,buy wow gold,wow Power Leveling,buy wow gold,cheap wow power leveling or WOW gold reviews? I have listed what I consider the best places to buy wow gold. Be careful where you buy gold from as a lot of companies use practices such as in game spaming, spaming, spamvertising, key logging, etc. I have used most of these companies for a long time and they are good companies. Companies that do not continue to perform well are removed from my list below. I also get a lot of information  and they list the same sites as here for top sites.
Top World of Warcraft Gold and Powerleveling2000 Sites WOW Power Leveling
 Powerleveling2000.com review- Best of the best for sites I have seen. I have talked to a lot of people that have the same good things to say about them. Powerleveling2000.com has been around for a long time and I   think they will be going anywhere anytime soon.
Buy  wow gold WOW Power Leveling Buy WoW Gold
Buy  wow power leveling WOW Power Leveling PowerLeveling

Offline jonsjava

  • Jr. Member
  • **
  • Posts: 11
Global Address Book with additional fields and additional email addresses
« Reply #18 on: October 27, 2008, 12:29:01 PM »
Quote from: Yann;14821
Any help here, I used the code in RC 0.2Beta, everything displayed correctly but I could NOT save the address book. I received "The website cannot display the page" error.


Here's a compressed version of my patch. It's the latest SVN release already patched.
« Last Edit: October 27, 2008, 03:02:35 PM by jonsjava »

Offline Yann

  • Jr. Member
  • **
  • Posts: 46
Global Address Book with additional fields and additional email addresses
« Reply #19 on: October 28, 2008, 10:59:22 PM »
Quote from: jonsjava;14879
Here's a compressed version of my patch. It's the latest SVN release already patched.


Works like a charm, Thanks

Offline jonsjava

  • Jr. Member
  • **
  • Posts: 11
Global Address Book with additional fields and additional email addresses
« Reply #20 on: October 29, 2008, 10:48:26 AM »
Glad to be of service

Offline henlon

  • Jr. Member
  • **
  • Posts: 40
Error in Addressbook
« Reply #21 on: November 02, 2008, 06:03:31 AM »
Hi
I have just installed rc02-beta and it works fine.
I installed the Plug in Global addressbook with additional fields and got en error when trying to edit/insert a new contact.

I have made the db conversion and the update of the files.

When I try to add a new contact my browser gives me the http 500 error.
I can read this line in my error log:

[02-Nov-2008 11:53:21] PHP Fatal error:  Class 'textarea' not found in C:\Inetpub\wwwroot\rc02\program\include\main.inc on line 665

What's wrong?

Offline browndrake

  • Newbie
  • *
  • Posts: 1
saves all as global, also problem adding address from emails
« Reply #22 on: November 09, 2008, 11:21:18 PM »
I am very new to this type of code but I managed to make the changes from this thread and most things seem to be working well.  There are two issues that I have not been able to fix.

I am using version: v.0.1.1

Wup.nu stated:
Quote
I cannot added the addresses from my e-mail. when I press in the plus button, a message box tell me that I cannot save the receiver...


When I click the pluse (+) I don't get an error message or anything else.  However, it fails to let me add the address. Nothing seems to happen.

I would appreciate it if somebody could send me in the right direction to find a solution for that.

Also, when adding new contacts everything works well EXCEPT: it adds everybody as global.  It does not matter wether I enter 0 or 1, it saves it as global and upon edit shows a "1" .  Upon editing the entry and re-saving, it saves correctly.   I believe that this is the code that affects it but I can not see why it is behaving as it is:

Code: [Select]
// read POST values into hash array
foreach ($a_save_cols as $col)
{
  $fname = '_'.$col;
   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);
 }
    $a_record[$col] = get_input_value($fname, RCUBE_INPUT_POST);
}

.......................
note:  until somebody figures out how to make a drop down to select yes or no, as to wether a contact is global or not, I edited the html so that it reads:
Global Contact (1 for yes, 0 for no)
That way users know they need to enter 0 or 1.
.......................

Thanks to anybody that can help with the above issues.

browndrake
« Last Edit: November 09, 2008, 11:24:08 PM by browndrake »

Offline Wazooka

  • Jr. Member
  • **
  • Posts: 22
Global Address Book with additional fields and additional email addresses
« Reply #23 on: November 12, 2008, 07:08:30 AM »
Quote from: jonsjava;14879
Here's a compressed version of my patch. It's the latest SVN release already patched.


Could you explain what's different from your non-Global plugin posted and this patched RC?

Offline moody_styley

  • Newbie
  • *
  • Posts: 2
2.0 Stable ?
« Reply #24 on: January 18, 2009, 11:23:26 AM »
Hi all,

I have tried to apply the Global Address Book script for 0.2 Stable and nothing worked.

I was running 0.2 Beta before and script was OK.

Can anybody help me to apply this great plugin to 0.2 Stable ?

Thanks in davance for your help.
« Last Edit: January 20, 2009, 09:46:05 AM by moody_styley »

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
Global Address Book with additional fields and additional email addresses
« Reply #25 on: January 28, 2009, 04:17:01 AM »
Hi all,

plz modify this plugin to RC 0.2 Stable ?

yea my english is bad ;)

Thx

Offline tfyisupportteam

  • Newbie
  • *
  • Posts: 4
GAL for 0.2 Stable
« Reply #26 on: February 17, 2009, 04:09:29 PM »
Is any going to be working on a mod for 0.2 stable, also i was wondering if anyone has figured out a way to only allow admins access to change information in the global address list.

Thanks

Offline BruderTack

  • Newbie
  • *
  • Posts: 3
Global Address Book with additional fields and additional email addresses
« Reply #27 on: February 18, 2009, 09:38:30 AM »
Quote from: jonsjava;14879
Here's a compressed version of my patch. It's the latest SVN release already patched.

Thanks for your package! It works fine, but I found one bug in the code. The database fields email2, email3, email4 don't popup in the autocomplete list when you enter an recipient. (only email is shown)

File: /program/steps/mail/compose.inc
Line: 915

// search for
while ($sql_arr $result->iterate())
if (
$sql_arr['email'])$a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
if (
$sql_arr['email2'])$a_contacts[] = format_email_recipient($sql_arr['email2'], $sql_arr['name']);
if (
$sql_arr['email3'])$a_contacts[] = format_email_recipient($sql_arr['email3'], $sql_arr['name']);
if (
$sql_arr['email4'])$a_contacts[] = format_email_recipient($sql_arr['email4'], $sql_arr['name']);

// and change this to (took be about an hour to find this *lol*):
while ($sql_arr $result->iterate()) {
	
if (
$sql_arr['email'])$a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
	
if (
$sql_arr['email2'])$a_contacts[] = format_email_recipient($sql_arr['email2'], $sql_arr['name']);
	
if (
$sql_arr['email3'])$a_contacts[] = format_email_recipient($sql_arr['email3'], $sql_arr['name']);
	
if (
$sql_arr['email4'])$a_contacts[] = format_email_recipient($sql_arr['email4'], $sql_arr['name']);
}

Offline jonsjava

  • Jr. Member
  • **
  • Posts: 11
Global Address Book with additional fields and additional email addresses
« Reply #28 on: March 10, 2009, 02:27:43 PM »
I noticed that issue as well.  I'll work on it when I get a chance. I just noticed this post, so I apologize for the delay in response.

Offline lacri

  • Full Member
  • ***
  • Posts: 179
    • http://www.php-lexikon.de
port to 0.2 stable / 0.2.1 part 1
« Reply #29 on: March 11, 2009, 05:40:58 AM »
« Last Edit: March 11, 2009, 06:20:07 AM by lacri »