Create activity

function postActivity(nut, friend) {
  var options = ["Gift1", "Gift2"]
var pic = friendspicturevarible;

  var title = 'Gifted ' + globalFriends[friend];
  var params = {};
  params[opensocial.Activity.Field.TITLE] = title;
  params[opensocial.Activity.Field.BODY] = 'give a message that your friend
given gift';
  var activity = opensocial.newActivity(params);
  opensocial.requestCreateActivity(activity,
opensocial.CreateActivityPriority.HIGH, function() {});
}


Call the activity function


function giveGift() {
  var nut = document.getElementById('nut').value;
  var friend = document.getElementById('person').value;

  globalGivenGifts[friend] = nut;
  var json = gadgets.json.stringify(globalGivenGifts);

  var req = opensocial.newDataRequest();
  
req.add(req.newUpdatePersonAppDataRequest(opensocial.DataRequest.PersonId.VIEWER,
'gifts', json));
  req.add(req.newFetchPersonRequest('VIEWER'), 'viewer');
  req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS'), 'viewerFriends');
  req.add(req.newFetchPersonAppDataRequest('VIEWER', 'gifts'), 'data');
  req.add(req.newFetchPersonAppDataRequest('VIEWER_FRIENDS', 'gifts'),
'viewerFriendData');
  req.send(onLoadFriends);

   postActivity(nut, friend);

}


hope this will help you..

regards
kcjagadeep

On Thu, Sep 18, 2008 at 8:37 PM, Javediq143 <[EMAIL PROTECTED]> wrote:

>
> Hi All,
>
> I've successfully created one application which works fine in all
> respect, thanks to the orkut developers guide. But Im facing a serious
> problem in creating "Activity" of user action. I hope you all must
> have got what I meant to say here.
>
> Like, if a user views a video on my API and finally ADDs it to his
> Favourite, then I want to create an activity of this so all of "his
> friend" should come to know about this action.
>
> I've done this work in my other API where its working fine. I copied
> the code which is given in the developers guide in the section where
> we learn how to create an activity. The thing is getting done over
> here because there is one single XML file which creates the activity
> but here in my case I'm passing the URL of an ASP page which resides
> on my server which calls a "Javascript" function define in a
> Javascript file which creates the Activity.
>
> Below is the complete code for this. It is just a test so please don't
> look for the video thing:
> -----------:XML File:------
> <?xml version="1.0" encoding="UTF-8" ?>
> <Module>
>  <ModulePrefs title="Test Activity" >
>    <Require feature="opensocial-0.7"/>
>  </ModulePrefs>
>  <Content type="html">
>  <![CDATA[
>  <script src="http://go2bollywood.tv/orkut/activity/activity.js";></
> script>
>
>  <div id="main_content"></div>
>
>  <script type="text/javascript">
>  gadgets.util.registerOnLoadHandler(init);
> </script>
>  ]]>
>  </Content>
> </Module>
> -----------:XML File:------
>
> -----------:JAVASCRIPT File:------
> function init()
> {
>        var url = "http://go2bollywood.tv/orkut/activity/index.asp";;
>
>        var params ={};
>        params[gadgets.io.RequestParameters.CONTENT_TYPE] =
> gadgets.io.ContentType.TEXT;
>
>        gadgets.io.makeRequest(url, callback, params);
> }
>
> function callback(resp)
> {
>        document.getElementById('main_content').innerHTML = resp.text;
> };
>
> function postActivity() {
>  var title =  'I have created an activity at ' + new
> Date().toString();
>  var params = {};
>  params[opensocial.Activity.Field.TITLE] = title;
>  var activity = opensocial.newActivity(params);
>  opensocial.requestCreateActivity(activity,
> opensocial.CreateActivityPriority.HIGH, getActivity);
> }
>
>  function getActivity(status) {
>    if (status.hadError())
>    {
>      alert("Error creating activity.");
>    }
>    else
>    {
>      alert("Activity successfully created.");
>    }
>  };
> -----------:JAVASCRIPT File:------
>
> -----------:ASP File:------
> <%@ Language=VBScript %>
> <% Option Explicit %>
> <script src="http://go2bollywood.tv/orkut/activity/activity.js";></
> script>
> <BODY>
> <%
> response.write "hi<BR>Im here to create activity on Orkut"
> %>
> <script>
> postActivity();
> </script>
> </BODY>
> -----------:ASP File:------
>
> When I run this API the "postActivity();" is not being called but the
> text "Hi Im here to.." gets displayed in the targeted DIV.
>
> I've looked out my best but didnt find a possible solution for this. I
> know that there is one but Im not able to find it. Any body could
> please help me as how to call this function which will create the
> activity or some other way.
>
> Im in a very urgent need of help because my API has been completed 99%
> and the remaining 1% is what I've shared with you all.
>
> Thanks in advance.
> Javed
>
> >
>


-- 
"How you do a thing is more important than what you do." —Amma

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