it's code woking in sandbox.orkut.com. In prod.sandbox.orkut.com and
www.orkut.com not working (the app is approved - v0.7):

var idviewer;
var idowner;
var uid;

function getData() {
    var req = opensocial.newDataRequest();

    var opt_params = {};
 
opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.ID];
 
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
opt_params), "viewer");
 
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,
opt_params), "owner");

    var params = {};
    params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
= [opensocial.Person.Field.PROFILE_URL];
 
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,
params), "uid");

    req.send(onLoadFriends);
  };


  function onLoadFriends(dataResponse) {
    var viewer = dataResponse.get("viewer").getData();
    var owner = dataResponse.get("owner").getData();

    try {
    //if (viewer != null) {
        idviewer = viewer.getField(opensocial.Person.Field.ID);
    }
    catch (e) {
    }
    //if (owner != null) {
    idowner = owner.getField(opensocial.Person.Field.ID);
    //}

    var urlowner = dataResponse.get("uid").getData();
    var profile_url =
urlowner.getField(opensocial.Person.Field.PROFILE_URL);
    var regex = /uid=([^&#]+)/;
    var result = profile_url.match(regex);
    if (result.length == 2) {
      uid = result[1];
      // uid now contains the viewer's orkut UID
    } else {
      // there was a problem getting the UID
    }

    if (idviewer == idowner) {
      updateHTML("menulinks").style.display = 'block';
      buscaplaylist();
    } else {
      buscaplaylist(); //faz busca assim que entra na open
    }

};

gadgets.util.registerOnLoadHandler(getData);
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to opensocial-orkut@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to