You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Tony Mobily <me...@mobily1.com> on 2008/09/27 12:22:15 UTC

Drupal integration -- initial help wanted!

Hi,

I am looking into the quickest way of turning Drupal into a _full_
OpenSocial container.
I downloaded Shindig (PHP), but I am finding it rather hard to figure out
what to do next :-D

Drupal right now has really good modules to manage Friends (and any type of
relationship) as well as User Activities. I have a general understanding of
OpenSocial, although I am still "getting there".

My idea of "integration" is _not_ Drupal adding records to specific Shindig
tables in order for it to return the right values... That sort of solution
feels ugly. From my _limited_ understanding, though, that's how CMSs are
expected to integrate with Shindig, although I might be wrong (and in fact I
hope I am).

So... any pointers?

To simplify the question: I have this fantastic CMS, with Friends set up and
user activities there. How do I allow it to add OpenSocial applets?

Bye,

Merc.

Re: Drupal integration -- initial help wanted!

Posted by Chris Chabot <ch...@google.com>.
> > - AppData: persistent application data storage, used to store small and
> > simple things like highscores of games, etc
>
> Hummmm this is a little cloudy.
> What am I expected to do about this one, at server level?
>

It's a storage for gadgets to use, max size of it (per user+gadget combo) is
quite limited though, 2k or so on orkut.com for instance. See the opensocial
docs for reference:
http://code.google.com/apis/opensocial/docs/0.7/spec.html#persistence

(thats often a good place to learn about the general concepts & the spec;
Fortunately the spec is pretty well documented, as is the gadget development
side of things, it's just shindig that's lacking docs :P)

The php equiv of such a storage would be your $_SESSION data for instance :)


> Each class has a few functions defined, and the return values are not
> > documented, but the 2 examples (jsondb one and partuza's) are your guide
> > here,
>
> What is JasonDB?
>


JSON DB, not jason :) See:

http://svn.apache.org/repos/asf/incubator/shindig/trunk/php/src/social/sample/JsonDbOpensocialService.php

it's an example data back-end implementation using a simple plain text file
(with the data encoded in json format, hence the json db name), it's not at
all something you'd use for anything other then a quick-and-dirty-demo, but
it's the example we ship.

OK. The first two you gave me were easy. The AppData one... I am still a
> little confused about.
>

See description above :)


> OK. Just to make sure: the only difference between the views "profile" and
> "canvas" is in their sizes?
>

One is the size (like when you go to someone's profile on orkut he'll have 3
small applications there, thats their profile views), but when you click on
a link to choose your favorite songs in the iLike application, you go to a
full screen mode of that app, and only that app is shown, that's the canvas
view.

Another example, in the 'emote' gadget the profile view would show a smily
graphic and "i'm feeling excited today!", where as the link "change your
mood" brings you to a full screen view of the gadget where you can pick out
of hundreds of different smilies and enter the text you want to show.

So yea, size and if the page is dedicated to just one gadget or not is the
difference. (and the gadget iframe url has a view=<view name>, aka
view=canvas or view=profile)


> > and you will need to implement a few basic RPC services (gadget to
> > container
> > rpc through javascript that is), see partuza's container.js for example:
> >
> http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js
>
>
> Sorry, I lost you here. Can you please explain this in very simple words?
> In particular, can you give me an example of this?
>
> <http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js
> >Add
>

The linked javascript is the example of it :)

The container (the website) and the gadget often live on different domains
(especially on social network sites) since the cross domain policy provides
a solid protection against the gadget doing anything malicious with to
container.. so to communicate things like 'change my title' and 'resize my
height' there is a RPC service between the two to cross the cross domain
boundry.

So you want to implement these basic 4 functions in javascript, in a way
that will work in drupal:
gadgets.rpc.register('resize_iframe', this.setHeight);
gadgets.rpc.register('set_pref', this.setUserPref);
gadgets.rpc.register('set_title', this.setTitle);
gadgets.rpc.register('requestNavigateTo', this.requestNavigateTo);

(the first param being the rpc call name, the second being the function to
call when the gadget makes that request)


THANK YOU!


More then welcome of course! & please never hesitate to ask questions on the
list, we're friendly folk and always happy to help :)

  -- Chris

Re: Drupal integration -- initial help wanted!

Posted by Tony Mobily <me...@mobily1.com>.
Hi,

I'm afraid we're a bit short on documentation, other then the source code
> it's self :)
>

OK!


> Basically Shindig is an OpenSocial spec implementation that does everything
> for you, except the database integration and the container UI work. (With
> container we mean the website that will contain the opensocial apps).


OK.


> Shindig knows 3 basic classes you need to implement (see the sample &
> partuza implementations for examples):
> - People: the profile and relationship data


OK, that's easy


>
> - Activities: activity stream ("chris ate a peanut today")


OK, that's easy too.


> - AppData: persistent application data storage, used to store small and
> simple things like highscores of games, etc


Hummmm this is a little cloudy.
What am I expected to do about this one, at server level?


Each class has a few functions defined, and the return values are not
> documented, but the 2 examples (jsondb one and partuza's) are your guide
> here,


What is JasonDB?


> just return exactly the same as those examples do (and learn how to
> parse the params you get in those functions from the examples too), and it
> should be relatively easy to implement your own version, that reads it's
> data from drupal's db :)


OK. The first two you gave me were easy. The AppData one... I am still a
little confused about.


> Also you'll need to create an iframe when viewing a gadget on a page, and
> it
> requires a security token.. best reference on how to do this magic in php
> is
> partuza:
>
> http://code.google.com/p/partuza/source/browse/trunk/Application/Views/gadget/gadget.php


OK.


>
> <http://code.google.com/p/partuza/source/browse/trunk/Application/Views/gadget/gadget.php>also
> keep in mind that gadgets know 'views' (profile, canvas), so you
> probably will have to add a 'canvas page'  to drupal (profile is the small
> box format, canvas is the full page view)


OK. Just to make sure: the only difference between the views "profile" and
"canvas" is in their sizes?


> and you will need to implement a few basic RPC services (gadget to
> container
> rpc through javascript that is), see partuza's container.js for example:
> http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js


Sorry, I lost you here. Can you please explain this in very simple words?
In particular, can you give me an example of this?

<http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js>Add
> a gallery (browse avail gadgets), and other basic UI elements
> (preferences, remove gadget, etc) and your done :)
>

That's the _easy_ part for me...

THANK YOU!

Merc.

Re: Drupal integration -- initial help wanted!

Posted by Chris Chabot <ch...@google.com>.
Hey Tony,

I'm afraid we're a bit short on documentation, other then the source code
it's self :)

Basically Shindig is an OpenSocial spec implementation that does everything
for you, except the database integration and the container UI work. (With
container we mean the website that will contain the opensocial apps).

Shindig knows 3 basic classes you need to implement (see the sample &
partuza implementations for examples):
- People: the profile and relationship data
- Activities: activity stream ("chris ate a peanut today")
- AppData: persistent application data storage, used to store small and
simple things like highscores of games, etc

Each class has a few functions defined, and the return values are not
documented, but the 2 examples (jsondb one and partuza's) are your guide
here, just return exactly the same as those examples do (and learn how to
parse the params you get in those functions from the examples too), and it
should be relatively easy to implement your own version, that reads it's
data from drupal's db :)

Also you'll need to create an iframe when viewing a gadget on a page, and it
requires a security token.. best reference on how to do this magic in php is
partuza:
http://code.google.com/p/partuza/source/browse/trunk/Application/Views/gadget/gadget.php

also keep in mind that gadgets know 'views' (profile, canvas), so you
probably will have to add a 'canvas page'  to drupal (profile is the small
box format, canvas is the full page view)

and you will need to implement a few basic RPC services (gadget to container
rpc through javascript that is), see partuza's container.js for example:
http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js

Add a gallery (browse avail gadgets), and other basic UI elements
(preferences, remove gadget, etc) and your done :)

Hope that helps!

  -- Chris


On Mon, Sep 29, 2008 at 4:56 AM, Tony Mobily <me...@mobily1.com> wrote:

> Hi,
>
>
> Shindig doesn't *have* tables. It's intended that the conatiner (Drupal, in
> > your case) will provide that data that it needs to feed to the gadgets.
> So,
> > what you need to write is some glue code that reads Drupal's data and
> > presents
> > it in the format Shinding needs it.
> >
> > Look for the Partuza project, that's a sample PHP container that uses
> > Shindig.
> >
>
> This is exactly what I was hoping.
> Other than looking at Partuza's glue code, is there some documentation
> somewhere that explains what the glue code should be and what it should do?
>
> Bye,
>
> Merc.
>

Re: Drupal integration -- initial help wanted!

Posted by Tony Mobily <me...@mobily1.com>.
Hi,


Shindig doesn't *have* tables. It's intended that the conatiner (Drupal, in
> your case) will provide that data that it needs to feed to the gadgets. So,
> what you need to write is some glue code that reads Drupal's data and
> presents
> it in the format Shinding needs it.
>
> Look for the Partuza project, that's a sample PHP container that uses
> Shindig.
>

This is exactly what I was hoping.
Other than looking at Partuza's glue code, is there some documentation
somewhere that explains what the glue code should be and what it should do?

Bye,

Merc.

Re: Drupal integration -- initial help wanted!

Posted by Rodrigo Gallardo <ro...@nul-unu.com>.
On Sat, Sep 27, 2008 at 06:22:15PM +0800, Tony Mobily wrote:
> Hi,
> 
> I am looking into the quickest way of turning Drupal into a _full_
> OpenSocial container.
> I downloaded Shindig (PHP), but I am finding it rather hard to figure out
> what to do next :-D
> 
> Drupal right now has really good modules to manage Friends (and any type of
> relationship) as well as User Activities. I have a general understanding of
> OpenSocial, although I am still "getting there".
> 
> My idea of "integration" is _not_ Drupal adding records to specific Shindig
> tables in order for it to return the right values... That sort of solution
> feels ugly. From my _limited_ understanding, though, that's how CMSs are
> expected to integrate with Shindig, although I might be wrong (and in fact I
> hope I am).

Shindig doesn't *have* tables. It's intended that the conatiner (Drupal, in 
your case) will provide that data that it needs to feed to the gadgets. So, 
what you need to write is some glue code that reads Drupal's data and presents
it in the format Shinding needs it.

Look for the Partuza project, that's a sample PHP container that uses Shindig.