Post on 15-Jan-2015
description
Integrating Google With Your Drupal Site• Google Drive• Google Talk (Gtalk)
Google Drive / Droogle Module
The Droogle module: created for Babson College and in production presently. http://drupal.org/project/droogle
Pulls in all your documents and folders for display sitewide or within organic groups.
Babson pulls in Google drive documents for each course. Documents are uploaded via Blackboard into Google Drive, are displayed in Blackboard and Drupal.
Droogle Site-wide page
DROOGLE Block Within Organic Group
Droogle Block
The Droogle Settings Page
Gtalk and Drupal – The Jabber module
The Jabber module is available at http://drupal.org/project/jabber
Jabber integrates Drupal with any XMPP Jabber server. Gtalk, Facebook, and most major chat networks are using XMPP protocol
JABBER requires a punjab server, which is a BOSH server which integrates with any federated XMPP jabber server.
Jabber Notes
Jabber is working presently at Babson now for a few months successfully
If you show users pictures, be wary of having so many pictures on each page, use sprites if possible
Dynamically load photos upon opening the Jabber roster
Jabber Notes 2
Jabber connects securely via php first using the PHP Speaks XMPP library which I authored for Babson and published on github https://github.com/barnettech/PHP_SPEAKS_XMPP
After connecting via php the Jabber module “attaches” the returned rid and sid to the strophe.js library, and reuses this same session. In this way no username or password is passed insecurely over javascript on the client side
Jabber Notes 3
Strophe: http://strophe.im/
Strophe is a javscript based XMPP library which is popular, and very tested in the wild, and most importantly efficiently handles XMPP traffic.
To learn more about XMPP I recommend the book Professional XMLL Programming with Javascript and Jquery by Jack Motiff. Jack is also active in Google Groups supporting strophe and punjab, and he was extremely helpful along my journey to success in getting Jabber for Drupal working. His book is really really great, and XMPP is a really underutilized protocol and I recommend his book highly.
Jabber Screenshot
Jabber Screenshot 2
Jabber tricks and tips
Since we know if you’re online in gtalk in the roster which is on the page, any mention of a username can have a “presence icon” by using some jquery and theme username http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_username/7
Basically in jabber roster if you give each username a class with their unique user name and then also use the same class in theme username, if one is green (online), red (busy), or grey (offline), all classes can be displaying presence wherever said username is on the page.
XMPP $xmlposts[] = '<body rid="'.$_jabber_rid_.'" xmlns="http://jabber.org/protocol/httpbind" sid="'.
$_jabber_sid_.'"><auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="PLAIN">'.$thepw.'</auth></body>';
$xmlposts[] = "<body rid='" . jabber_get_next_rid() . "' xmlns='http://jabber.org/protocol/httpbind' sid='$_jabber_sid_' to='babson.edu' xml:lang='en' xmpp:restart='true' xmlns:xmpp='urn:xmpp:xbosh'/>";
$xmlposts[] = "<body rid='" . jabber_get_next_rid() . "' xmlns='http://jabber.org/protocol/httpbind' sid='$_jabber_sid_'><iq type='set' id='_bind_auth_2' xmlns='jabber:client'><bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/></iq></body>";
$xmlposts[] = "<body rid='" . jabber_get_next_rid() . "' xmlns='http://jabber.org/protocol/httpbind' sid='$_jabber_sid_'><iq type='set' id='_session_auth_2' xmlns='jabber:client'><session xmlns='urn:ietf:params:xml:ns:xmpp-session'/></iq></body>";
$xmlposts[] = "<body rid='" . jabber_get_next_rid() . "' xmlns='http://jabber.org/protocol/httpbind' sid='$_jabber_sid_'><message to='barnettech@gmail.com' type='chat' xmlns='jabber:client'><body>test helloworld from my php xmpp api!</body><active xmlns='http://jabber.org/protocol/chatstates'/></message></body>";
$xmlposts[] = "<body rid='" . jabber_get_next_rid() . "' xmlns='http://jabber.org/protocol/httpbind' sid='$_jabber_sid_'><iq type='get'><query xmlns='jabber:iq:roster'/></iq></body>”;
$xml_response = jabber_send_xml($xmlposts);