You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Akash Xavier <ak...@gmail.com> on 2008/03/25 14:03:54 UTC

The method to connect to backend data

Hi
I created my gadget parser (a few days back) and the correct a few bugs and
the ported from the SAX parser to the SimpleXML parser. And then jumping
stuff like that. This way I was able to run the Mario is Back gadget (that I
found in the igoogle directory)

And now I would like to connect opensocial to my site's backend.
I am planning to edit(or extend) the OpenSocial *.js files to do that.

I was just going thru the opensocial *.js files. And I found this in the
datarequest.js file:

opensocial.DataRequest.PersonId = {
 /**
  * @member opensocial.DataRequest.PersonId
  */
  OWNER : 'OWNER',
 /**
  * @member opensocial.DataRequest.PersonId
  */
  VIEWER : 'VIEWER'
};

I read in the example (in the comments in the file) and found that the
application developer uses "opensocial.DataRequest.PersonId.VIEWER" to get
the ID of the person (viewer in this case).

Now am I going the right way if I let these OpenSocial *.js files alone and
instead create another file called mycontainer.js and use the 'prototype'
feature in javascript to extend these stuff?
Here is an example of what I might do to make the above VIEWER thing
'actually' working.

opensocial.DataRequest.PersonId.prototype.VIEWER=function(){
/*** do something here and get the viewer's ID from the database or any
other source ***/
}

Is it right?

(please direct me to any docs if my idea of Javascript Objects is wrong. And
also point me to any docs)


-- 
Akash Xavier
akashmanohar@gmail.com

Re: The method to connect to backend data

Posted by Cassie <do...@apache.org>.
Yes, if you wish to create your own opensocial javascript you can simply
depend on the opensocial-reference feature and extend the container.js class
using prototype modification. As the api evolves, it will be very beneficial
for you to leave the opensocial-reference code untouched so that you can
upgrade from version to version more easily.

- Cassie


On Tue, Mar 25, 2008 at 2:03 PM, Akash Xavier <ak...@gmail.com>
wrote:

> Hi
> I created my gadget parser (a few days back) and the correct a few bugs
> and
> the ported from the SAX parser to the SimpleXML parser. And then jumping
> stuff like that. This way I was able to run the Mario is Back gadget (that
> I
> found in the igoogle directory)
>
> And now I would like to connect opensocial to my site's backend.
> I am planning to edit(or extend) the OpenSocial *.js files to do that.
>
> I was just going thru the opensocial *.js files. And I found this in the
> datarequest.js file:
>
> opensocial.DataRequest.PersonId = {
>  /**
>  * @member opensocial.DataRequest.PersonId
>  */
>  OWNER : 'OWNER',
>  /**
>  * @member opensocial.DataRequest.PersonId
>  */
>  VIEWER : 'VIEWER'
> };
>
> I read in the example (in the comments in the file) and found that the
> application developer uses "opensocial.DataRequest.PersonId.VIEWER" to get
> the ID of the person (viewer in this case).
>
> Now am I going the right way if I let these OpenSocial *.js files alone
> and
> instead create another file called mycontainer.js and use the 'prototype'
> feature in javascript to extend these stuff?
> Here is an example of what I might do to make the above VIEWER thing
> 'actually' working.
>
> opensocial.DataRequest.PersonId.prototype.VIEWER=function(){
> /*** do something here and get the viewer's ID from the database or any
> other source ***/
> }
>
> Is it right?
>
> (please direct me to any docs if my idea of Javascript Objects is wrong.
> And
> also point me to any docs)
>
>
> --
> Akash Xavier
> akashmanohar@gmail.com
>