<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="Sandbox Friends" >
  <Require feature="views"/>
  <Require feature="dynamic-height"/>
  <Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html" view="home"><![CDATA[
  <script type="text/javascript">
    function loadFriends() {
      var req = opensocial.newDataRequest();
      req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
      req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS'), 'viewerFriends');
      req.send(printFriendsList);
    };
		
    function printFriendsList(data) {
      var viewerFriends = data.get('viewerFriends').getData();	  
      var html = "<ul>";
      viewerFriends.each(function(person) {
        html += '<li>' + person.getDisplayName() + "</li>";
      });
      html += '</ul>';
      document.getElementById('friends').innerHTML = html;
      gadgets.window.adjustHeight();
    };            
    gadgets.util.registerOnLoadHandler(loadFriends);
    
    </script>
	
    <div>
      <button onclick="gadgets.views.requestNavigateTo(new gadgets.views.View('canvas'));">Show and edit my friends list</button>
    </div>
    <em>This gadget is for testing purposes only.</em><br><br>

    <div>	   
     <b>Your current friends:</b><div id='friends'>You don't have any friends yet. Please choose some with the button above.</div>
    </div>
  ]]>
</Content>
<Content type="html" view="canvas"><![CDATA[  
  <iframe id="contactManagerFrame" src="http://www.google.com/ig/c/ui/ContactManager?titleBar=false"
   style="height:100%; width:100%; border:0"/>
  ]]>
</Content>
</Module>
