<?xml version="1.0" encoding="UTF-8" ?>
<Module> 
<ModulePrefs title="List Friends Example" title_url="http://www.ibibo.com"  author="chitra" author_link="http://www.ibibo.com/flopush" author_email="flochitu@gmail.com" author_affiliation="ibibo web pvt ltd" author_location="bangalore, INDIA" description="this is just for testing purpose" screenshot="http://farm2.static.flickr.com/1180/1387773216_9fbb6e3023_s.jpg" thumbnail="http://www.ibibo.com/images/ibibo-logo.gif">  
 <Require feature="opensocial-0.7" /> 
 <Require feature="dynamic-height" />  
 <Require feature="flash" />  
 <Require feature="setprefs" />  
 <Require feature="views" />   
 </ModulePrefs> 
 <Content type="html"> 
 <![CDATA[ <script type="text/javascript"> 
 /**  * Request for friend information.  */  
 function getData() {        
     var req = opensocial.newDataRequest();    
     req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER), 'viewer');    
     req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS), 'viewerFriends');    
     req.send(onLoadFriends);  
  }; 
  /**  * Parses the response to the friend information request and generates  
       * html to list the friends along with their display name.  
       *  * @param {Object} dataResponse Friend information that was requested.  
   */  
   function onLoadFriends(dataResponse) {  
       alert( "loading friends");
       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() + '</li>';    
    });    
      html += '</ul>';    
      document.getElementById('message').innerHTML = html;  };  
      gadgets.util.registerOnLoadHandler(getData);  
</script>  
<div id="message"> </div>  
]]>  
</Content>
</Module>




