+ Reply to Thread
Page 3 of 7 FirstFirst 1 2 3 4 5 ... LastLast
Results 21 to 30 of 68

Thread: advanced Adressbook

  1. #21
    kevenages is offline Registered User
    Join Date
    May 2007
    Posts
    2
    Downloads
    0
    Uploads
    0

    Default Re: advanced Adressbook

    Quote Originally Posted by CEC
    Is this contribution consistent with the latest stable release. It's not working for me -- significant differences between instructions and what's actually in the files -- e.g., edit, show.
    I'm having the same issue, perhaps someone could do one of 2 things:

    1. give updated instructions on the plugin
    2. provide the files and simply allow users to overwrite the files to be updated (once backed up, of course)

    Thanks, I'd really love to utilize this plugin

  2. #22
    Gus
    Gus is offline Registered User
    Join Date
    Aug 2007
    Posts
    9
    Downloads
    0
    Uploads
    0

    Default Re: advanced Adressbook

    Hi,

    i've added these changes to the latest RC1 files, and although some of the line numbers were wrong, it all seemed fairly correct and all went OK.
    However none of my new contact fields are written back my mySQL table?
    I dont get any errors, and i can change the standard fields OK.
    Also, i can use phpmyadmin to manually add data to the new fields, and they show OK in the show contact page. but i still cannot edit of the new fields using RC.

    Any ideas?

    thanks.

  3. #23
    oldschool's Avatar
    oldschool is offline Registered User
    Join Date
    Jul 2007
    Posts
    173
    Downloads
    8
    Uploads
    0

    Default Re: advanced Adressbook

    An update for RC1 would be great...!

    Rgds.


  4. #24
    fritzferr is offline Registered User
    Join Date
    Jun 2007
    Posts
    1
    Downloads
    1
    Uploads
    0

    Default Re: advanced Adressbook

    This thread looks like it has winded down. After review I'm not sure where it stands - did the latest RC have the advanced address book in it? When I went through the sql statements it didn't appear to be the case, but I don't know enough to be sure.

    Personally, I'd love to have advance stuff in there...

    FF

  5. #25
    GunFro is offline Registered User
    Join Date
    Jun 2006
    Posts
    42
    Downloads
    2
    Uploads
    0

    Default Re: advanced Adressbook

    .......................
    Last edited by GunFro; 07-16-2011 at 05:31 PM.

  6. #26
    dloendorf is offline Registered User
    Join Date
    Sep 2007
    Location
    Santa Fe, NM USA
    Posts
    16
    Downloads
    0
    Uploads
    0

    Default Re: advanced Adressbook

    This is an updated version of the advanced addressbook for RC1. Download and unzip the attached file to a temporary folder. Refer to Helga's original post for setting the language specific file. Rename the following files ../program/include/main.php to main.php.orig, ../program/include/rcube_contacts.inc to rcube_contacts.inc.orig, ../program/steps/addressbook/edit.inc to edit.inc.orig, ../program/steps/addressbook/save.inc to save.inc.orig, ../program/steps/addressbook/show.inc to show.inc.orig.

    Replace the files renamed above with the files from the temporary zip folder. When you are certain the new files work correctly, you can remove the .orig files.

    OK! I am not allowed to post a zip file. If you are interested in receiving a zip file, send me a message. Trying to delineate line numbers where to delete and insert is too hard.

    David


  7. #27
    dloendorf is offline Registered User
    Join Date
    Sep 2007
    Location
    Santa Fe, NM USA
    Posts
    16
    Downloads
    0
    Uploads
    0

    Default Re: advanced Adressbook

    Here are the updates required for the advanced address book in rc1. These updates also include the global contact option.

    The line numbers for inserts may not be exact depending on the version of rc1 you are using.

    If you have any questions as to where modification should go, do not hesitate to contact me.

    Remember - backup or make copies of all original files before making any modifications suggested here.

    Code:
    # First posted by Helga as
    # http://roundcubeforum.net/forum/inde...sg3238#msg3238
    # Modified by David Loendorf for RC1 and global contact option
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In file /program/include/rcube_contacts.inc
    #
    # Replace Line 31 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');
    # Replace Line 145 with
         AND  (user_id=? OR global_contact = 1)" .
    # Replace Line 216
        AND  (user_id=? OR global_contact = 1)".
    # Replace Line 251 with
        AND  (user_id=? OR global_contact = 1)
    # Replace Line 342 with
         AND  (user_id=? OR global_contact = 1)
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In file /program/include/main.inc
    # 
    # Find the line that reads: if ($type=='checkbox')
    # It should be around Line 1230
    # 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')
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In File /program/localization/en_US/label.inc
    # Insert after line 163
    $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']   = 'Notice';
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In file /program/steps/addressbook/edit.inc
    # Replace Line 64 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');
    
    # Insert after line that contains: $attrib['id'] = 'rcmfd_'.$col; (should be line 67 or 68)
      if($col == "global_contact")
      	$value = rcmail_get_edit_field($col, $record[$col], $attrib, 'checkbox');
      else
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In file /program/steps/addressbook/save.inc
    # Replace line 40 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');
    
    # Replace Line 48 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);
     }
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In file /program/steps/addressbook/show.inc
    # Replace Line 46 with
     $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');
    
    #
    # Replace Old Lines that contain the following (beginning around line 59-62)
      $out .= sprintf("<tr><td class=\"title\">%s</td><td>%s</td></tr>\n",
              Q(rcube_label($col)),
              $value);
      }
     
     $out .= "\n</table>";
    
    # with these new lines
    
    	$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, 'Yes');
    			else
    	  		 $data .= sprintf("<tr><td>%s</td><td>%s</td></tr>\n",$title, 'No');
    		} 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>";
    
    # -------------------------------------------------------------------------------------------------------------
    #
    
    # Database Additions for extended contact information
    #
    # 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 `rc_contacts` ADD `global_contact` TINYINT(1) NOT NULL default '0';
     ALTER TABLE `rc_contacts` ADD `firm` VARCHAR(128) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `position` VARCHAR(50) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `p_tel` VARCHAR(30) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `p_fax` VARCHAR(30) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `p_mob` VARCHAR(20) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `p_address` TEXT NOT NULL;
     ALTER TABLE `rc_contacts` ADD `w_tel` VARCHAR(20) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `w_fax` VARCHAR(20) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `w_mob` VARCHAR(20) NOT NULL ;
     ALTER TABLE `rc_contacts` ADD `w_address` TEXT NOT NULL;
     ALTER TABLE `rc_contacts` ADD `notice` TEXT NOT NULL;
    If you would also like to allow your users to modify their passwords while in RC and your ISP supports CPanel 11 make the following updates
    Code:
    # Support password modification using CPanel 11
    #
    #  Code written by Danny Herran <danny@ingeniarte.com>
    #  with small modification by David Loendorf <dloendorf@gmail.com>
    #  Original post is here http://roundcubeforum.net/forum/inde...sg3155#msg3155
    #  You can find original code at http://www.ingeniarte.com/rcpasswd.php
    #  All of this is included below plus the few modifications I have made.
    
    # In file /program/js/app.js
    
    # Replace Line 264 with
        this.enable_command('preferences', 'identities', 'save', 'folders', 'passwd', true);
    
    # Insert after Line 274
        if (this.env.action=='passwd' || this.env.action=='save-passwd')
         {
         var input_curpasswd = rcube_find_object('_curpasswd');
         var input_newpasswd = rcube_find_object('_newpasswd');
         var input_confpasswd = rcube_find_object('_confpasswd');
         if (input_curpasswd && input_curpasswd.value=='')
           input_curpasswd.focus();
         else if (input_confpasswd)
           input_confpasswd.focus();
    
         this.enable_command('save-passwd', true);
         }
    
    # Insert after old Line 932 new Line 945
        break;
    
       case 'passwd':
        this.goto_url('passwd');
        break;
    
       case 'save-passwd':
        var input_curpasswd = rcube_find_object('_curpasswd');
        var input_newpasswd = rcube_find_object('_newpasswd');
        var input_confpasswd = rcube_find_object('_confpasswd');
        if (input_curpasswd && input_curpasswd.value=='')
          {
            alert(this.get_label('nocurrentpassword'));
            input_curpasswd.focus();
          }
        else if ((input_newpasswd && input_newpasswd.value=='') && (input_confpasswd && input_confpasswd.value==''))
          {
            alert(this.get_label('nopassword'));
            input_newpasswd.focus();
          }
        else if ((input_newpasswd && input_confpasswd) && ( input_newpasswd.value != input_confpasswd.value))
          {
            alert(this.get_label('passwordinconsistency'));
            input_newpasswd.focus();
          }
        else
            this.gui_objects.editform.submit();
    
    # -------------------------------------------------------------------------------------------------------------
    
    # In file /program/localizations/en_US/labels.inc
    
    # Insert before the last line
    
    $labels['changepasswd'] = 'Change Password';
    $labels['curpasswd'] = 'Current Password';
    $labels['newpasswd'] = 'New Password';
    $labels['confpasswd'] = 'Confirm New Password';
    
    # -------------------------------------------------------------------------------------------------------------
    
    # In file /program/localizations/en_US/messages.inc
    
    # Insert after line 78
    $messages['nocurrentpassword'] = "Please input current password.";
    $messages['nopassword'] = "Please input new password.";
    $messages['passwordinconsistency'] = "Inconsistency of password, please try again.";
    
    # -------------------------------------------------------------------------------------------------------------
    
    # Add File /program/steps/settings/passwd.inc that contains
    
    <?php
    
    /*
     -----------------------------------------------------------------------
     | program/steps/settings/passwd.inc                  |
     |                                   |
     | This file is part of the RoundCube Webmail client          |
     | Copyright (C) 2007, RoundCube Dev. - Switzerland          |
     | Licensed under the GNU GPL                     |
     |                                   |
     | PURPOSE:                              |
     |  Change IMAP user password ONLY FOR cPanel 11 installations!    |
     |                                   |
     | REQUIREMENTS:                            |
     |  PHP with cURL installed, cPanel 11                |
     |                                   |
     -----------------------------------------------------------------------
     | Author: Danny Herran <danny@ingeniarte.com             |
     -----------------------------------------------------------------------
    
     $Id: passwd.inc,v 0.2 2007/06/08 11:16:03 roundcube Exp $
    
    */
    
    function rcmail_save_passwd($curpasswd, $newpasswd){
     global $CONFIG, $_SESSION, $OUTPUT;
    
     //Basically this sends a request to dopasswdpop.html and change the password for the IMAP account
     //this is different from cPanel 10 which uses dowebmailpasswd.cgi instead
    
     $cpaneluser = $_SESSION['username'];
     $cpanelpass = $curpasswd;
     $data=explode('@', $_SESSION['username']);
     $domain=$data[1];
     $uname=$data[0];
    
     // First do a check if curl_init exists:
     if (function_exists("curl_init")) {
      $authstr = "$cpaneluser:$cpanelpass";
      $postfields="email=$uname&domain=$domain&password=$newpasswd";
    
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $domain.":2095/webmail/x3/mail/dopasswdpop.html");
      curl_setopt($ch, CURLOPT_HEADER, 0);
      curl_setopt($ch, CURLOPT_USERPWD, $authstr);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 1);
      curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
      curl_setopt($ch, CURLOPT_POST, 1);
      curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
    
    
      $cbsreturn = curl_exec($ch);
    //  echo "Result: " . $cbsreturn; // Returns all the html from cPanel, uncomment to view (debugging)
    
      if ((strpos($cbsreturn, "successfully modified")) and (!strpos($cbsreturn, "result in failure"))) {
    	 //We update the password for the current session
    	 $_SESSION['password'] = encrypt_passwd($newpasswd);
       curl_close($ch);
       return true;
      } else {
       curl_close($ch);
       return false;
      }
     }
    }
    
    
    function rcmail_passwd_form($attrib){
     global $CONFIG, $OUTPUT;
    
     list($form_start, $form_end) = get_form_tags($attrib, 'save-passwd');
     unset($attrib['form']);
    
     if (!$attrib['id'])
      $attrib['id'] = 'rcmSavepassword';
    
     // allow the following attributes to be added to the <table> tag
     $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id', 'cellpadding', 'cellspacing', 'border', 'summary'));
    
     // return the complete edit form as table
     $out = "$form_start<table" . $attrib_str . ">\n\n";
    
     $a_show_cols = array('curpasswd'  => array('type' => 'text'), 'newpasswd'  => array('type' => 'text'), 'confpasswd'  => array('type' => 'text'));
    
     // show current password field
     $field_id = 'curpasswd';
     $input_curpasswd = new passwordfield(array('name' => '_curpasswd', 'id' => $field_id, 'size' => 30));
    
     $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", $field_id, rep_specialchars_output(rcube_label('curpasswd')), $input_curpasswd->show($CONFIG['curpasswd']));
    
     // show new password selection
     $field_id = 'newpasswd';
     $input_newpasswd = new passwordfield(array('name' => '_newpasswd', 'id' => $field_id, 'size' => 30));
    
     $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", $field_id, rep_specialchars_output(rcube_label('newpasswd')), $input_newpasswd->show($CONFIG['newpasswd']));
    
     // show confirm password selection
     $field_id = 'confpasswd';
     $input_confpasswd = new passwordfield(array('name' => '_confpasswd', 'id' => $field_id, 'size' => 30));
    
     $out .= sprintf("<tr><td class=\"title\"><label for=\"%s\">%s</label></td><td>%s</td></tr>\n", $field_id, rep_specialchars_output(rcube_label('confpasswd')), $input_confpasswd->show($CONFIG['confpasswd']));
    
     $out .= "\n</table>$form_end";
    
     return $out;
    }
    
    // Handle user request
    if ($_action=='save-passwd'){
    
     if (!isset($_POST['_curpasswd']))
      $OUTPUT->show_message('errorsaving', 'error');
     else if (!isset($_POST['_newpasswd']))
      $OUTPUT->show_message('errorsaving', 'error');
     else if (rcmail_save_passwd(get_input_value('_curpasswd', RCUBE_INPUT_POST), get_input_value('_newpasswd', RCUBE_INPUT_POST))){
      $OUTPUT->show_message('successfullysaved', 'confirmation');
     } else
      $OUTPUT->show_message('errorsaving', 'error');
    
     // overwrite action variable
     rcmail_overwrite_action('passwd');
    
    }
    
    // add some labels to client
    rcube_add_label('nocurrentpassword');
    rcube_add_label('nopassword');
    rcube_add_label('passwordinconsistency');
    parse_template('passwd');
    ?>
    
    # -------------------------------------------------------------------------------------------------------------
    
    # In file /skins/default/includes/settingstabs.html
    
    # Insert after Line 2
    <span id="settingstabpasswd" class="tablink"><roundcube:button command="passwd" type="link" label="password" title="changepasswd" class="tablink" /></span>
    
    # -------------------------------------------------------------------------------------------------------------
    
    # Add File /skins/default/templates/passwd.html that contains
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtm...sitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<title><roundcube:object name="pagetitle" /></title>
    		<roundcube:include file="/includes/links.html" />
    		<link rel="stylesheet" type="text/css" href="/settings.css" />
    	</head>
    	<body>
    
    		<roundcube:include file="/includes/taskbar.html" />
    		<roundcube:include file="/includes/header.html" />
    		<roundcube:include file="/includes/settingstabs.html" />
    
    		<div id="userprefs-box">
    			<div id="userprefs-title"><roundcube:label name="changepasswd" /></div>
    
    			<div style="padding:15px">
    				<roundcube:object name="userpasswd">
    
    				<p><br /><roundcube:button command="save-passwd" type="input" class="button" label="save" /></p>
    			</div>
    		</div>
    
    		<roundcube:include file="/includes/settingscripts.html" />
    
    	</body>
    </html>
    
    # -------------------------------------------------------------------------------------------------------------
    #
    # In File index.php
    #
    # Insert after line that reads:  include_once('program/steps/settings/func.inc'); (about line 343)
    
     if (($_action=='passwd') or ($_action=='save-passwd'))
      include('program/steps/settings/passwd.inc');
    David

  8. #28
    Rudy is offline Registered User
    Join Date
    Sep 2007
    Posts
    17
    Downloads
    2
    Uploads
    0

    Default Re: advanced Adressbook

    Works like a charm. Thanks a lot! Is there any way to implement multiple E-Mail addresses for one contact in this plugin/mod?

  9. #29
    dloendorf is offline Registered User
    Join Date
    Sep 2007
    Location
    Santa Fe, NM USA
    Posts
    16
    Downloads
    0
    Uploads
    0

    Default Re: advanced Adressbook

    Of course, the short answer is Yes - But...

    I am leaving for Europe a week from today, so will probably not have a chance to look into adding that function. Come mid-January, when I return, if someone else has not implemented it, I will be happy to make an attempt.

    David

  10. #30
    Rudy is offline Registered User
    Join Date
    Sep 2007
    Posts
    17
    Downloads
    2
    Uploads
    0

    Default Re: advanced Adressbook

    I just found a little typo in your instructions:

    Code:
    # Replace Line 46 with
     $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', 'g_adresse', 'notice');
    Last line, there it should say "w_address" instead of "g_adresse".



+ Reply to Thread
Page 3 of 7 FirstFirst 1 2 3 4 5 ... LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts