![]() |
|
|
|||||||
| For more information about the ads and why they're here, please see the FAQ |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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.
|
|
#3
|
|||
|
|||
|
Great idea! Thanks allot!
|
|
#4
|
|||
|
|||
|
Hi,
could you update this for the 0.1.1 release? Thanks. hauke |
|
#5
|
|||
|
|||
|
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/"; 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 />
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>
Code:
<html> <head> <script type="text/javascript" src="https://www.plaxo.com/ab_chooser/abc_comm.jsdyn"></script> </head> <body></body> </html> -Roland Last edited by rosali; 05-02-2008 at 01:42 PM. Reason: step #4 was missing |
|
#6
|
||||
|
||||
|
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?
__________________
![]()
|
|
#7
|
|||
|
|||
|
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 |
|
#8
|
|||
|
|||
|
|
|
#9
|
|||
|
|||
|
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"; 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'] = "";
}
?>
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 />
-Roland |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
| For more information about the ads and why they're here, please see the FAQ |