MySpace Open Platform

A Place For Developers

Welcome Developers!

in

Welcome!

in

javascript client library

Last post 05-11-2009 5:53 AM by dan. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 04-08-2008 6:46 AM

    javascript client library

     I want to use javascript library in my app. I download javascript library and upload it in my server and write a following code in a page, but get javascript error like "MyOpenSpace is not defined", "opensocial.Container.get() has no properties" etc. . Anyone can have any idea how to use those js library ? please help me.

     

    <html><head><title></title>
    <script type='text/javascript' src='OpenSocial/references/gadgets001.js'></script>
    <script type='text/javascript' src='OpenSocial/references/opensocialreference001.v07.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace002.Util.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace001.Entities.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace002.Mappers.v07.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace001.Enums.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace003.Core.v07.js'></script>
    <script type='text/javascript' src='OpenSocial/MyOpenSpace002.Engine.js'></script>

    <script type='text/javascript' src='OpenSocial/references/json001.js'></script>
    <script type='text/javascript' src='OpenSocial/references/ifpc001.js'></script>



    <script type="text/javascript">

    var os;
    var dataReqObj;
    var html = '';
    var heading = '';

    function init() {

    os = opensocial.Container.get();
    dataReqObj = os.newDataRequest();
    var viewerReq = os.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER);

     var param = {};
        param[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
        [opensocial.Person.Field.ID,
        MyOpenSpace.Person.Field.ABOUT,
        MyOpenSpace.Person.Field.GENDER,
        MyOpenSpace.Person.Field.POSTALCODE];

     
      var viewerReq = os.newFetchPersonRequest(opensocial.DataRequest.PersonId.VIEWER,param);
      dataReqObj.add(viewerReq);
      dataReqObj.send(dataLoadCallback);

    }

    function dataLoadCallback(data) {

    var viewer = data.get(opensocial.DataRequest.PersonId.VIEWER).getData();
    heading = 'Hi ' + viewer.getDisplayName() + ', Welcome To Myspace Food presented by FriendsEAT.com';

    document.getElementById('heading').innerHTML = heading;
    document.getElementById('hdThumbnail_url').value = viewer.getField(opensocial.Person.Field.THUMBNAIL_URL);
    document.getElementById('hdProfile_url').value = viewer.getField(opensocial.Person.Field.PROFILE_URL);
    document.getElementById('hdUser_id').value = viewer.getField(opensocial.Person.Field.ID);
    document.getElementById('hdUser_name').value = viewer.getDisplayName();
    document.getElementById('hdUser_gender').value = viewer.getField(MyOpenSpace.Person.Field.GENDER);
    document.getElementById('hdUser_zipcode').value = viewer.getField(MyOpenSpace.Person.Field.POSTALCODE);
    document.getElementById('hdUser_about').value = viewer.getField(MyOpenSpace.Person.Field.ABOUT);
       
    }

    init();

    </script>

    </head>
    <body >
    <div >
    <div>Hi , Welcome To my page</div>

    <div class="pad2">
    <input name="hdThumbnail_url" id="hdThumbnail_url" type="text"/>
    <input name="hdProfile_url" id="hdProfile_url" type="text" />
    <input name="hdUser_id" id="hdUser_id" type="text" />
    <input name="hdUser_name" id="hdUser_name" type="text" />
    <input name="hdUser_gender" id="hdUser_gender" type="text" />
    <input name="hdUser_zipcode" id="hdUser_zipcode" type="text" />
    <input name="hdUser_about" id="hdUser_about" type="text" />

     
    </div>
    </div>
    </body>
    </html>

    Filed under: , ,
  • 04-08-2008 8:01 AM In reply to

    Re: javascript client library

    Hi,

    This library has the implementation for MySpace. If you have to test applications for any social networking site that support opensocial API, then you should think of setting up a 'Shindig' server. You can get more details of it from Apache website.

    You can test your applications on MySpace by registering to MDP (MySpace Developer Platform).

  • 04-14-2008 10:56 AM In reply to

    Re: javascript client library

    The JS libraries depend on support form a container. Simply importing thm onto your server will not help. However You can download the Libraries to help with autocomplete for JS functions in Aptana or Netbeans during development. Other than that you shouldn not need to add these libraries.  The container will transparently provide support for all OS classes. 

  • 05-11-2009 5:53 AM In reply to

    • dan
    • Not Ranked
    • Joined on 02-24-2009
    • Posts 5

    Re: javascript client library

    Did this ever get resolved, I'm having the same issues!
Page 1 of 1 (4 items)