Random musings on Life, World, Technology

September 20, 2008

Liveblogging from PHPCamp

Filed under: India, PHPCamp, Technology, phpcamppune08 — prasoonk @ 2:03 pm

I am sitting here in a talk on OpenSocial by Pravin Nirmal. After small bashing of Facebook, he has begun doing a demo, yes, a live demo! This is what you’d expect in the congregation of geeks in the neo-Silicon Valley of India, Pune. We have a sizable participation from Mumbai, Ahmadnagar.

Update: The speaker has hosted his presentation and the demo programs on his site.

It is using opensocial-0.7. He has hosted it on http://sandbox.orkut.com. Here’s the code:

<?xml version=”1.0″ encoding=”UTF-8″?>
<Module>
<ModulePrefs title=”PHPCamp – List Friends”>
<Require feature=”opensocial-0.7″/>
</ModulePrefs>
<Content type=”html”>
<![CDATA[

<link rel="stylesheet" type="text/css" href="http://www.myphpdunia.com/gmap/main.css" />

<script type="text/javascript">
gadgets.util.registerOnLoadHandler(init);

function init() {
var req = opensocial.newDataRequest();
var opt_params = {};
opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 20;
req.add(req.newFetchPeopleRequest(‘OWNER_FRIENDS’,opt_params), ‘ownerFriends’);
req.send(onLoadFriends);
}

function onLoadFriends(data) {
var ownerFriends = data.get(‘ownerFriends’).getData();
var html=”";
html=’<ul>’;
ownerFriends.each(function(person) {
var friend_thumbnail=person.getField(opensocial.Person.Field.THUMBNAIL_URL);
html +=’<li>’ + person.getDisplayName() + ‘<img src=”‘+friend_thumbnail+’”> </li>’;

});
html +=’</ul>’;

document.getElementById(‘friends’).innerHTML = html;
}

</script>
<div id=’main’>
Your friends: <div id=’friends’></div>
</div>
]]>
</Content>
</Module>

Blog at WordPress.com.