RoundCube Webmail Forum  

Go Back   RoundCube Webmail Forum > Third Party Contributions > Plug-Ins

For more information about the ads and why they're here, please see the FAQ
Reply
  #1  
Old 02-10-2007, 01:10 PM
Registered User
 
Join Date: Feb 2007
Posts: 1
Downloads: 0
Uploads: 0
Default Plaxo integration (Ticket #1449767)

Hi,

Like the user who raised this ticket, I store my addresses in Plaxo (synchronised with Outlook). Plaxo has produced an address book widget that integrates with other web pages to return addresses stored in Plaxo (or AOL, Yahoo, hotmail, gmail, etc). The Plaxo instructions are really simple, so I had a go at integrating it into roundcube (the version hosted by Westhost, which appears to be 0.1-20060914).

To do this I created a directory in the root roundcube directory called plaxo and added the following file plaxo_cb.html (make sure all the permissions are right):

[~/www/roundcube/plaxo]$ cat plaxo_cb.html
<html>
<head>
<script type="text/javascript" src="https://www.plaxo.com/ab_chooser/abc...dyn"></script>
</head>
<body></body>
</html>
[~/www/roundcube/plaxo]$

In addition, in skins/default/templates I made the following diffs:

[~/www/roundcube/skins/default/templates]$ diff compose.html.backup compose.html
24a25,38
> <!-- plaxo -->
> <script type="text/javascript"
> src="http://www.plaxo.com/css/m/js/util.js"></script>
> <script type="text/javascript"
> src="http://www.plaxo.com/css/m/js/basic.js"></script>
> <script type="text/javascript"
> src="http://www.plaxo.com/css/m/js/abc_la....js"></script>
> <script type="text/javascript"><!--
> function onABCommComplete() {
> // OPTIONAL: do something here after the new data has been populated in
> your text area
> }
> //--></script>
> <!-- plaxo -->
67,68c81,85
< <a href="#" onclick="return rcmail_toggle_display('compose-bcc')">[Bcc]</a><br /></td>
<
---
> <a href="#" onclick="return rcmail_toggle_display('compose-bcc')">[Bcc]</a><br />
> <!-- plaxo -->
> <a href="#" onclick="showPlaxoABChooser('rcmcomposeto',
> '/roundcube/plaxo/plaxo_cb.html'); return false">[Add]</a></td>
> <!-- plaxo -->
[~/www/roundcube/skins/default/templates]$

Replace '/roundcube/plaxo/plaxo_cb.html' with whatever the absolute path to the first file above is on the webserver.

Apologies for the fairly crappy description - I mainly did this for myself but thought someone else might be able to use it. Perhaps someone can develop this up into a proper plugin or whatever, if others find it useful.

Andrew.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 03-22-2007, 06:29 PM
Registered User
 
Join Date: Nov 2006
Posts: 7
Downloads: 0
Uploads: 0
Default Re: Plaxo integration (Ticket #1449767)

What a great idea. This works perfectly. Thanks for posting this. In addition to your Plaxo address book, this widget allows you to import addresses from AOL, Hotmail, Yahoo, Gmail, and Outlook.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3  
Old 03-23-2007, 11:17 AM
Registered User
 
Join Date: Mar 2007
Posts: 2
Downloads: 0
Uploads: 0
Default Re: Plaxo integration (Ticket #1449767)

Great idea! Thanks allot!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4  
Old 04-16-2008, 04:24 PM
Registered User
 
Join Date: Apr 2008
Posts: 3
Downloads: 0
Uploads: 0
Default Re: Plaxo integration (Ticket #1449767)

Hi,

could you update this for the 0.1.1 release? Thanks.

hauke
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5  
Old 05-02-2008, 01:40 PM
Super Moderator
 
Join Date: Dec 2007
Location: Germany
Posts: 425
Downloads: 10
Uploads: 0
Send a message via MSN to rosali
Default

Update for 0.1.1 stable:

#1 - config/main.inc.php
Code:
// use Plaxo addressbook widget
$rcmail_config['plaxo_widget'] = TRUE;
// RoundCube Base URL
$rcmail_config['roundcube_url'] =  "http://localhost/webmail/work/";
$rcmail_config['roundcube_path'] = "/webmail/work/";
#2 - skins/default/templates/compose.html

a) between head tags
Code:
<roundcube:if condition="config:plaxo_widget == true" />
<!-- plaxo -->
<script type="text/javascript" src="http://www.plaxo.com/css/m/js/util.js"></script>
<script type="text/javascript" src="http://www.plaxo.com/css/m/js/basic.js"></script>
<script type="text/javascript" src="http://www.plaxo.com/css/m/js/abc_launcher.js"></script>
<script type="text/javascript"><!--
function onABCommComplete() {
  // OPTIONAL: do something here after the new data has been populated in your text area
}
function doshowPlaxoABChooser(){
  var fld = document.getElementById("plaxo_fld").value;
  if(fld != "to"){
    rcmail_show_header_form('compose-' + fld, document.getElementById('add' + fld + 'link'));
  }
  showPlaxoABChooser('rcmcompose' + fld,'<roundcube:var name='config:roundcube_path' />plaxo/plaxo_cb.html')
}
//--></script>
<!-- plaxo -->
<roundcube:endif />
b) in body
Code:
<td class="formlinks">
  <a href="#cc" onclick="return rcmail_show_header_form('compose-cc', this);" id="addcclink"><roundcube:label name="addcc" /></a>
  <span class="separator">|</span>
  <a href="#bcc" onclick="return rcmail_show_header_form('compose-bcc', this);" id="addbcclink"><roundcube:label name="addbcc" /></a>
  <span class="separator">|</span>
  <a href="#reply-to" onclick="return rcmail_show_header_form('compose-replyto', this);" id="addreplytolink"><roundcube:label name="addreplyto" /></a>
  <roundcube:if condition="config:plaxo_widget == true" />
  <!-- plaxo -->
  <span class="separator">|</span>
  <a href="#" onclick="doshowPlaxoABChooser(); return false"><roundcube:label name="plaxo_select" /></a>
  <select class="plaxo_fld" id="plaxo_fld" onchange="javascript:doshowPlaxoABChooser()">
    <option value="to"><roundcube:label name="to" /></option>
    <option value="cc"><roundcube:label name="cc" /></option>
    <option value="bcc"><roundcube:label name="bcc" /></option>
  </select>
  <a href="#" onclick="doshowPlaxoABChooser(); return false"><roundcube:label name="from_plaxo_Addressbook" /></a>
  <!-- plaxo -->
  <roundcube:endif />
</td>
#3 - new folder/file plaxo/plaxo_cb.html
Code:
<html>
<head>
<script type="text/javascript" src="https://www.plaxo.com/ab_chooser/abc_comm.jsdyn"></script>
</head>
<body></body>
</html>
#4 - create missing labels in localization folder

-Roland

Last edited by rosali; 05-02-2008 at 01:42 PM. Reason: step #4 was missing
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6  
Old 05-02-2008, 01:56 PM
bpat1434's Avatar
Administrator
 
Join Date: Jun 2006
Location: Maryland, USA
Posts: 599
Downloads: 17
Uploads: 0
Send a message via ICQ to bpat1434 Send a message via AIM to bpat1434 Send a message via MSN to bpat1434 Send a message via Yahoo to bpat1434 Send a message via Skype™ to bpat1434
Default

Wow, that's utterly fantastic. Have you created a Trac ticket for this with these exact directions (or a link to these) so that it could possibly be added to 0.1.2?
__________________

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7  
Old 05-02-2008, 02:21 PM
Super Moderator
 
Join Date: Dec 2007
Location: Germany
Posts: 425
Downloads: 10
Uploads: 0
Send a message via MSN to rosali
Default

Yes, I submitted a feature request ticket.

BTW, you can use Plaxo widget also to import various addressbooks into RC ... That's on my TODO's for later on.

-Roland

Last edited by rosali; 05-02-2008 at 02:24 PM. Reason: typo
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8  
Old 05-04-2008, 10:00 AM
Registered User
 
Join Date: Apr 2008
Posts: 3
Downloads: 0
Uploads: 0
Talking

Quote:
Originally Posted by rosali View Post
Update for 0.1.1 stable:
Thank you!

cheers
hauke
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9  
Old 05-04-2008, 02:13 PM
Super Moderator
 
Join Date: Dec 2007
Location: Germany
Posts: 425
Downloads: 10
Uploads: 0
Send a message via MSN to rosali
Default

Quote:
Originally Posted by hauke View Post
Thank you!

cheers
hauke
Here is a hack if you run RoundCube not on SSL (avoid annoying browser unsecure warning):

#1-config/main.inc.php (add at very bottom)
Code:
require_once "config_check.php";
#2-config/config_check.php (new file)
Code:
<?php

// disable ads on SSL connections
if(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE){
  $rcmail_config['google_ads'] = FALSE;
  $rcmail_config['ssl_append'] = "s";
}
else{
  $rcmail_config['ssl_append'] = "";
}
?>
#3-skins/default/template/compse.html (between head tags)
Code:
<roundcube:if condition="config:plaxo_widget == true" />
<!-- plaxo -->
<script type="text/javascript" src="http<roundcube:var name="config:ssl_append" />://www.plaxo.com/css/m/js/util.js"></script>
<script type="text/javascript" src="http<roundcube:var name="config:ssl_append" />://www.plaxo.com/css/m/js/basic.js"></script>

<!-- Workaround for running plaxo widget under http instead of https ... (avoid browser insecure warning) -->
<!-- Source: www.plaxo.com/css/m/js/abc_launcher.js -->
<script type="text/javascript"><!--
/*
  Launcher for remote-scripted popup window to select name/email pairs from a Plaxo member's address book.
  Contact: Joseph Smarr (joseph@plaxo.com)

  Dependencies: {{{
  - util.js (everyone needs this)
  - basic.js (for popup)
  }}}
*/

registerNamespaces("Plaxo");

Plaxo.Util.Timer.setTimersEnabled(false);

// {{{ stolen from prototype.js so partners don't need to include it (js: moved under Plaxo namespace to play nice with jQuery)

Plaxo.byId = function(elem) {
  if (typeof elem == 'string') {
    elem = document.getElementById(elem);
  }
  return elem;
};

Plaxo.Class = {
  create: function() {
    return function() {
      this.initialize.apply(this, arguments);
    }
  }
};

// }}}

Plaxo.ABLauncher = Plaxo.Class.create();
Plaxo.ABLauncher.prototype = {

  initialize: function() {
      Plaxo.Debug.trace('initializing');
    // {{{ member vars
    this.name =             "Plaxo.ABLauncher 1.0";
    this.abWin =             null;    // popup window

    this.textArea =          null;    // text area with name/emails we're controlling
    this.currentEmails =     {};      // emails currently in text box
    // }}}
  },

  dialogWidth: 460,
  dialogHeight: 480, // if you change this, also change ab_chooser.css (main_content, ab_contents)
 
  /** Turns a map of options into a query string. */
  toQueryString: function(options) {
    var queryComponents = [];
    for (key in options) {
      if (typeof options[key] == 'function') continue;
      var queryComponent = encodeURIComponent(key) + '=' + encodeURIComponent(options[key]);
      queryComponents.push(queryComponent);
    }
    return queryComponents.join('&');
  },

  showABChooser: function(textArea, plaxoHost, callbackPage, extraOptions) {

    this.textArea = Plaxo.byId(textArea);
    if (!this.textArea) {
      Plaxo.Debug.error("can't find text area -> aborting");
      return;
    }
    this.currentEmails = {};
    this.extractEmails(this.textArea.value);

    if (!this.abWin || this.abWin.closed) {
      // ensure callback is on the same domain as the caller
      if (callbackPage.length > 0 && callbackPage.charAt(0) != '/') {
        callbackPage = '/' + callbackPage; // make sure we have a true absolute path
      }
      var cb = location.protocol + '//' + location.host + callbackPage;
      extraOptions.cb = cb;
      
      // record partner URL and when we opened the widget
      extraOptions.host = location.href;
      extraOptions.ts = new Date().getTime();

      var qs = this.toQueryString(extraOptions);
      var url = 'http<roundcube:var name="config:ssl_append" />://' + plaxoHost + '/ab_chooser?' + qs; //'ts=' + ts + '&cb=' + escape(cb) + '&host=' + escape(location.href);
      if (extraOptions.plaxoMembersOnly) {
        url += '&direct=1';
      } else {
        var emails = this.getCurrentEmailList().join(',');
        url += '&t=import&emails=' + escape(emails);
      }
      this.abWin = popup(url, "PlaxoABC", this.dialogWidth, this.dialogHeight, 'resizable=no,scrollbars=no');
    }
    if (this.abWin) {
      this.abWin.focus();
    }
  },

  getCurrentEmailList: function() {
    var emails = [];
    for (email in this.currentEmails) {
      emails.push(email);
    }
    return emails;
  },

  /** Extracts all the e-mail addresses in the given string. */
  extractEmails: function(str) {
    var index = 0;
    while (true) {
      index = str.indexOf('@', index);
      if (index == -1) break;

      // for each @, find the beginning and end and extract the email
      var start = Plaxo.String.findBoundary(str, index - 1, false);
      var end = Plaxo.String.findBoundary(str, index + 1, true);
      var email = str.substring(start, end + 1).toLowerCase();
      this.currentEmails[email] = 1;

      index++;
    }
  },
 
  // {{{ adding checked recipients to textbox

  /** Returns true iff the given email is already in the text area. */
  hasCurrentEmail: function(email) {
    return this.currentEmails[email.toLowerCase()];
  },

  addCheckedRecipients: function(text) {
    // TODO: kill first line
    if (!text) return false;

    if (!this.textArea) {
      Plaxo.Debug.error('no text area to add recipients to');
      return false;
    }

    var curText = this.textArea.value;
    if (curText && !curText.trim().endsWith(',')) curText += ', ';
    curText += text;
    this.setTextAreaValue(curText);
    return true;
  },

  setTextAreaValue: function(str) {
    this.textArea.value = str;
  }

  // }}}

};

// shared instance of ab launcher
Plaxo.abl = null;

/**
 * Opens the Plaxo AB Chooser widget.
 *
 * @param textArea the id of the textarea to fill in name/email pairs, or a ref to the textArea
 * @param callbackPage uri on caller's site for page to complete adding the data (e.g. /site/ifr.html)
 * @param plaxoHost (optional) plaxo domain to host ab chooser (for testing only, default: www.plaxo.com)
 * @param plaxoMembersOnly (optional) only show UI to sign in as an existing plaxo member (default: false)
 * @param extraOptions (optional) map of string->string key/value pairs for extra options:
 *        - selType -> multiple (default) | single (allow one or multiple contacts to be chosen)
 *        - fieldType -> email (default) | address (what contact info to choose (email, mailing address)
 *        - plaxoMembersOnly -> false (default) | true (whether to not show import for non-plaxo members)
 */
function showPlaxoABChooser(textArea, callbackPage, plaxoHost, extraOptions) {
  if (!Plaxo.abl) Plaxo.abl = new Plaxo.ABLauncher();
  if (!plaxoHost) plaxoHost = 'www.plaxo.com';
  if (!extraOptions) extraOptions = {};
  Plaxo.abl.showABChooser(textArea, plaxoHost, callbackPage, extraOptions);
}
//-->
</script>
<!-- End Workaround for running plaxo widget under http instead of https ... (avoid browser insecure warning) -->

<script type="text/javascript"><!--

function onABCommComplete() {
  // OPTIONAL: do something here after the new data has been populated in your text area
}
function doshowPlaxoABChooser(){
  var fld = document.getElementById("plaxo_fld").value;
  if(fld != "to"){
    rcmail_show_header_form('compose-' + fld, document.getElementById('add' + fld + 'link'));
  }
  showPlaxoABChooser('rcmcompose' + fld,'<roundcube:var name='config:roundcube_path' />plaxo/plaxo_cb.html')
}
//--></script>
<!-- plaxo -->
<roundcube:endif />
NOTICE: If you use this hack you have to look frequently about updates of http://www.plaxo.com/css/m/js/abc_launcher.js !!!

-Roland
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

For more information about the ads and why they're here, please see the FAQ

All times are GMT. The time now is 09:43 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright © 2006-2008 RoundCube Webmail Community