Hello,

I'm new to opensocial (and to javascript and programming too)... I'm
wrote a piece of code that runs on coderunner and returns the desired
data, but it doesn't work on orkut sandbox. The code (i'm using
opensocial 0.7) is:

function getUser() {
  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonRequest
(opensocial.DataRequest.PersonId.VIEWER), 'viewer');
  req.add(req.newFetchPersonRequest
(opensocial.DataRequest.PersonId.OWNER), 'owner');
  req.add(req.newFetchPersonAppDataRequest
(opensocial.DataRequest.PersonId.OWNER, 'username'), 'data');
  req.send(testUser);
}

function testUser(data) {
  var owner = data.get('owner').getData();
  var viewer = data.get('viewer').getData();
  var user = data.get('data').getData();
  var userID = user[owner.getId()]["username"];
  if (!userID) {
    if (owner.getId() == viewer.getId()) {
      saveUser();
    }
  }
  else {
    main(userID);
  }
}

function saveUser() {
  var user = getName();
  var req = opensocial.newDataRequest();
  req.add(req.newUpdatePersonAppDataRequest
(opensocial.DataRequest.PersonId.VIEWER, 'username', user));
  req.add(req.newFetchPersonRequest
(opensocial.DataRequest.PersonId.VIEWER), 'viewer');
  req.add(req.newFetchPersonRequest
(opensocial.DataRequest.PersonId.OWNER), 'owner');
  req.add(req.newFetchPersonAppDataRequest
(opensocial.DataRequest.PersonId.OWNER, 'username'), 'data');
  req.send(testUser);
}

I know, it's a ugly piece of code but it do what i wan't on
coderunner. And I know that's something wrong on it, 'cause firebug
says that "user[owner_id] is undefined" when it runs on sandbox.

So, what's wrong with this code?

Thanks in advance

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Orkut Developer Forum" group.
To post to this group, send email to [email protected]
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