Getting Owner and Viewer info is not working.

1 view
Skip to first unread message

amit...@gmail.com

unread,
Sep 9, 2008, 2:33:41 AM9/9/08
to OpenSocial - OpenSocial Application Development
Hello,

Suddenly getting of owner and viewer info is not working in orkut
sandbox. The same code is working in hi5 sandbox.

It returns null for both owner and viewer.

It was working perfectly before yesterday.

The same code is working perfectly in code runner application.

Please check the below code.


<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="GetOwnerViewerTest" >
<Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html"><![CDATA[

<script language="javascript">

var _owner,_owner;
function loadOwnerAndViewerData()
{
var req = opensocial.newDataRequest();

req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),
"owner");
if (opensocial.hasPermission(opensocial.Permission.VIEWER))

req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),"viewer");
req.send(loadOwnerAndViewerDataComplete);
};
function loadOwnerAndViewerDataComplete(data)
{
_owner = data.get("owner").getData();
if(data.get("viewer"))
_viewer = data.get("viewer").getData();

alert("_owner="+_owner.getId());
alert("_viewer="+_viewer.getId());
};
loadOwnerAndViewerData();

</script>

]]></Content>
</Module>

Thanks,
Amit

snowdog

unread,
Sep 9, 2008, 12:51:09 PM9/9/08
to OpenSocial - OpenSocial Application Development
Hello, Amit.

Same thing around here... Did you find any solution?

[ ]!
SnowDog

anand sharma

unread,
Sep 9, 2008, 1:45:18 PM9/9/08
to opensoc...@googlegroups.com

HI Amit

now u  run below code . i just commented if condition and i highlighted that point .
may i know why u put if condition while requesting for 'VIEWER'.
its not necessary as far i know. but if u have to put any condition then its different story .
i tried that code on shindig 0.8 and its running fine .



Please check the below code.


<?xml version="1.0" encoding="UTF-8"?>
<Module>
<ModulePrefs title="GetOwnerViewerTest" >
<Require feature="opensocial-0.7"/>
</ModulePrefs>
<Content type="html"><![CDATA[

<script language="javascript">

var  _owner,_owner;
function loadOwnerAndViewerData()
{
   var req = opensocial.newDataRequest();

req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER),
"owner");
  //make if condition as comment
 
//  if (opensocial.hasPermission(opensocial.Permission.VIEWER))


req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER),"viewer");
   req.send(loadOwnerAndViewerDataComplete);
};
function loadOwnerAndViewerDataComplete(data)
{
   _owner = data.get("owner").getData();
   if(data.get("viewer"))
       _viewer = data.get("viewer").getData();

   alert("_owner="+_owner.getId());
   alert("_viewer="+_viewer.getId());
};
loadOwnerAndViewerData();

</script>

]]></Content>
</Module>

cheers
    Anand
 



Reply all
Reply to author
Forward
0 new messages