Hi guys,

I am building an application for orkut where in i need to fetch the
orkut user details like his orkut id, display name and his friends and
thumbnail urls....I am getting all the details but i am unable to pass
it to my application(because of the querystring limit)....I am using a
iframe approach.....
i need all the details in index page....

following is the sample code:


<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="" screenshot="" description="" thumbnail=""
author="" author_email="" author_location=""
author_affiliation="company" title_url="" directory_title="">
<Require feature="opensocial-0.7" />
<Require feature="views" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<script type="text/javascript" src='http://domain.com/orkutapp/js/
prototype.js'></script>
<script type="text/javascript">

var viewer_info;
var owner_info;
var owner_id;
var viewer_id;
var viewer_friends;
var err_conunt=0;
var pname_arr=new Array();
var puid_arr=new Array();
var thumb_arr=new Array();
var puid_url=new Array();
var list=new Array();
var fuidslist=new Array();
var param='edit';
var u=0;

var baseServer = "http://subdomain.domain.com";;
var appdomain="www";
var appPageURL="http://subdomain.domain.com/orkutapp";;
var appServletURL="http://subdomain.domain.com/orkutapp";;

function post_data()
{


        var postdata = {thumb_arr : thumb_arr.toString() , puid_arr :
puid_url.toString() , pname_arr : pname_arr.toString()};

        var params = {};

        var url = baseServer + '/orkutapp/updatejson.php';

        params[gadgets.io.RequestParameters.METHOD] =
gadgets.io.MethodType.POST;

        params[gadgets.io.RequestParameters.POST_DATA] =
gadgets.io.encodeValues(postdata);

        gadgets.io.makeRequest(url, responsedata, params);

}

function responsedata(obj) {
  alert(obj.text);
  alert('okresponse');
};







 function request() {
  var opt_params = {};
 
opt_params[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS]
=
[opensocial.Person.Field.PROFILE_URL];
opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 1000;

var req = opensocial.newDataRequest();


req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,
opt_params), "viewer");
req.add(req.newFetchPersonRequest(opensocial.DataRequest.PersonId.OWNER,
opt_params), "owner");
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.VIEWER_FRIENDS,
opt_params), "viewer_friends");
req.add(req.newFetchPeopleRequest(opensocial.DataRequest.Group.OWNER_FRIENDS,
opt_params), "owner_friends");

req.send(response);

};



function response(data)
{
        var owner = data.get('owner').getData();
        //alert(owner.getField(opensocial.Person.Field.PROFILE_URL));
        var profileurl = owner.getField(opensocial.Person.Field.PROFILE_URL);

        var editstatus =0;



        var arr_index=0;
        if(data.get("viewer")!= null)
        {
                viewer_info = data.get("viewer").getData();
                if(viewer_info==null)
                {

                }
                else
                {
                        viewer_id = viewer_info.getId();
                }
        }



        if(viewer_info!=null)
        {
                if(data.get("owner")!= null)
                {
                        owner_info = data.get("owner").getData();
                        if(owner_info!=null)
                        {
                                owner_id = owner_info.getId();
                        }
                }



        if(viewer_id!=owner_id)
        {
                hostid= viewer_info.getId();
                puid_arr[0]=hostid;
                profile_url =
viewer_info.getField(opensocial.Person.Field.PROFILE_URL);
                var regex = /uid=([^&#]+)/;
                result = profile_url.match(regex);
                puid_host = result[1];
                puid_url[0]=puid_host;
                pname_arr[0]=viewer_info.getDisplayName();
                //alert("displayname" + pname_arr[0]);
        
thumb_arr[0]=viewer_info.getField(opensocial.Person.Field.THUMBNAIL_URL);
                //alert("thumb=" + thumb_arr[0]);
                var viewer_friends = data.get("viewer_friends").getData();
                viewer_friends.each
                (
                        function(person)
                        {
                                var uid =  person.getId();
                                //alert("frd_uid=" . uid);
                                puid_arr[arr_index+1]=uid;
                                var name = person.getDisplayName();
                                //alert("frd_name=" . name);
                                pname_arr[arr_index+1]=name;
                                var profile_friend =
person.getField(opensocial.Person.Field.PROFILE_URL);
                                var regex = /uid=([^&#]+)/;
                                var res = profile_friend.match(regex);
                                var puid_friends = res[1];
                                //alert("uid_frd="+puid_friends);
                                puid_url[arr_index+1]=escape(puid_friends);
                                var thumb =
person.getField(opensocial.Person.Field.THUMBNAIL_URL);
                                
if(thumb=="http://img3.orkut.com/images/img/i_nophoto128.gif";)
                                {
                                        thumb=appPageURL+"/images/nophoto.gif";
                                }
                                //alert("thumb_frd="+thumb);
                                thumb_arr[arr_index+1]=thumb;
                                arr_index=arr_index+1;
                        }
                );
          }
          else
          {
                hostid=owner_info.getId();
                puid_arr[0]=hostid;
                //alert("hostid=" + hostid); //opensocial ID
                profile_url =
owner_info.getField(opensocial.Person.Field.PROFILE_URL);
                var regex = /uid=([^&#]+)/;
                result = profile_url.match(regex);
                puid_host = result[1];
                //alert("puid_host=" + puid_host);  //orkut ID
                puid_url[0]=puid_host;
                pname_arr[0]=owner_info.getDisplayName();
                //alert("owner_name=" + pname_arr[0]);  //Orkut Display
Name
        
thumb_arr[0]=owner_info.getField(opensocial.Person.Field.THUMBNAIL_URL);
                //alert("owner_thumb=" + thumb_arr[0]); //Owner
Thumbnail
                var owner_friends = data.get("owner_friends").getData();
                owner_friends.each
                (
                        function(person)
                        {
                                var uid =  person.getId();
                                //alert("friend_uid=" + uid);   //friend
opensocialID
                                puid_arr[arr_index+1]=uid;
                                var name = person.getDisplayName();
                                //alert("friend_name=" + name);   //FRIEND
NAME
                                pname_arr[arr_index+1]=name;
                                var profile_friend =
person.getField(opensocial.Person.Field.PROFILE_URL);
                                var regex = /uid=([^&#]+)/;
                                var res = profile_friend.match(regex);
                                var puid_friends = res[1];
                                //alert("friend_UID=" + puid_friends);  //
FRIEND_UID
                                puid_url[arr_index+1]=escape(puid_friends);
                                var thumb =
person.getField(opensocial.Person.Field.THUMBNAIL_URL);

                                
if(thumb=="http://img3.orkut.com/images/img/i_nophoto128.gif";)
                                {
                                        thumb=appPageURL+"/images/nophoto.gif";
                                }
                                //alert("friend_thumb=" +
thumb);        //FRIEND THUMBNAIL
                                thumb_arr[arr_index+1]=thumb;
                                arr_index=arr_index+1;
                        }
                );
             }

                if(owner_id==viewerID)
                {
                        editstatus =1;
                }
                else
                {
                        editstatus =0;
                }
        post_data();

        }

        var z = profileurl.split("=");


        if (getViewName() == "canvas")
        {
                /* Do canvas specific stuff here */

                var Url123=baseServer+'/orkutapp/index.php?viewerID=' + viewerID
+'&viewerName=' +                               viewerName
+'&profileid='+z[1]+'&ownerid='+owner_id+'&editstatus='+editstatus;

                makeIFrameCallCanvas(Url123) ;

        }

        if (getViewName() == "profile")
        {
                /* Do profile specific stuff here */

                var Url123=baseServer+'/orkutapp/index.php?viewerID=' + viewerID
+'&viewerName=' +                               viewerName
+'&profileid='+z[1]+'&ownerid='+owner_id+'&editstatus='+editstatus;

        }


//var Url123=baseServer+'/orkutapp/index.php';
//makeIFrameCall(Url123) ;
//CreateFriendList();
};



function makeIFrameCall(Url123) {
    var frameElem = document.createElement("iframe");
    frameElem.setAttribute("src", Url123);
    frameElem.setAttribute("frameborder", "1");
    frameElem.setAttribute("scrolling", "yes");
    frameElem.setAttribute("align", "middle");
    frameElem.setAttribute("style", "width:600px;height:400px;");
    frameElem.setAttribute("width","800px");
    frameElem.setAttribute("height","600px");

    //console.log(friendUpdateUrl);
    var frameContainer = document.getElementById('iframe_container');
    frameContainer.innerHTML = "";
    frameContainer.appendChild(frameElem);

}




function makeIFrameCallProfile(Url123) {
    var frameElem = document.createElement("iframe");
    frameElem.setAttribute("src", Url123);
    frameElem.setAttribute("frameborder", "0");
    frameElem.setAttribute("scrolling", "no");
    frameElem.setAttribute("align", "middle");
        frameElem.setAttribute("width", "100%");
        frameElem.setAttribute("height", "280px");

    frameElem.setAttribute("style","overflow:none;width:100%;height:
280px;");
    //console.log(friendUpdateUrl);
    var frameContainer = document.getElementById('iframe_container');
    frameContainer.innerHTML = "";
    frameContainer.appendChild(frameElem);
}


function makeIFrameCallCanvas(Url123) {
    var frameElem = document.createElement("iframe");
    frameElem.setAttribute("src", Url123);
    frameElem.setAttribute("frameborder", "0");
    frameElem.setAttribute("scrolling", "no");
    frameElem.setAttribute("align", "middle");
                frameElem.setAttribute("width", "800px");
        frameElem.setAttribute("height", "600px");

    frameElem.setAttribute("style","overflow:none;width:800px;height:
600px;");

    //console.log(friendUpdateUrl);
    var frameContainer = document.getElementById('iframe_container');
    frameContainer.innerHTML = "";
    frameContainer.appendChild(frameElem);
}





function init()
{

  request();

}


</script>
<script>
        gadgets.util.registerOnLoadHandler(init);
</script>
<div id="iframe_container"></div>


]]>
</Content>
</Module>




Please let me know how to do that...help appreciated....

--~--~---------~--~----~------------~-------~--~----~
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