Professional Documents
Culture Documents
Open Social: Google S
Open Social: Google S
Open Social
Christian Scholz
http://mrtopf.de/connect
http://comlounge.net Barcamp Berlin 2
Write once, run everywhere
Google Gadget
Application
Google Gadget
Application
Platform
Google Gadget
Application
OpenSocial API
Platform
Platform
OpenSocial API
Google Gadget
Application
OpenSocial API
Platform
Orkut
Flixter
Ning
Example
Writing Applications
1. Write a Google Gadget
Example GG HTML
<Module>
<ModulePrefs title="Go to Photo Album" height="250" scaling="false" />
<Content type="html">
<![CDATA[
<div style="text-align:center"><a
id="Riggs" title="My Photo Album" target="_blank"
href="http://picasaweb.google.com/doc.examples/ShelfBoy">
<img border="0" alt="Photo" src="http://doc.examples.googlepages.com/Riggsie-OP.jpg"
title="Click Here."></a>
</div>
]]>
</Content>
</Module>
2. Importing Open Social
/**
* Request for friend information when the page loads.
*/
function getData() {
document.getElementById('message').innerHTML = 'Requesting friends...';
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
req.add(req.newFetchPeopleRequest ('VIEWER_FRIENDS'), 'viewerFriends');
req.send(onLoadFriends);
};
3. Using Open Social
/**
* Parses the response to the friend information request and generates
* html to list the friends by their display name.
*
* @param {Object} dataResponse Friend information that was requested.
*/
function onLoadFriends(dataResponse) {
var viewer = dataResponse.get('viewer').getData();
var html = 'Friends of ' + viewer.getDisplayName();
html += ':<br><ul>';
var viewerFriends = dataResponse.get('viewerFriends').getData();
viewerFriends.each(function(person) {
html += '<li>' + person.getDisplayName();
});
html += '</ul>';
document.getElementById('message').innerHTML = html;
};
3 APIs