From MWWiki
Back to GSoC 2008
For returning a NOT_IMPLEMENTED error, see this example:
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/social-api/samplecontainer/BasicMessagesService.php?view=markup
that's all there's to it :)
As far as the service implementations go, the idea is that you create 3 classes, like the ones in partuza/Shindig
/*Service.php or in the php/src/social-api/samplecontainer/*Service.php for example, where you implement the functions and
return the data that's requested... the params tell you which data it is, and as for return types go, taking a look at the
examples mentioned above is currently our best 'documentation' :)
It could probably help if you just copied the partuza db scheme and functions, and then make modifications where required
...
I imagine the fetch people you'll want to re-implement completely (based on joomla's idea of a 'person'), and you don't have
to support all the fields at all ... as long as you have an ID, profile_url, thumbnail_url and a name ... your fine :)
If you support more fields then that, don't forget to edit the supportedFields : {[]} property in the shindig/config
/container.js file btw, thats where you tell the JS API what fields are available.
So job #1, implement as much of the service code as joomla can support, and for everything else, return not implemented :)
Ps the more user info you have, the more interesting some social apps will be, so try to have the owner (site admin, or
creator of the page?) and viewer (in case the person is logged in, in any form) where ever you can.
The container sided javascript, http://code.google.com/p/partuza/source/browse/trunk/html/js/container.js is a good basic
example (written using prototype.js for the syntaxial sugar, but you can use anything, up to raw dom statements ofc). You
should support at least these 4 basic RPC services:
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 is the RPC call name (don't change those:P), and the second is the function to call when that RPC call
happens (basic call => function map).
resize_iframe and set_title modify the iframe that contain the gadget (either adjusting it's height or setting the title
above it), set_pref is a container call for storing a preference (which you later add to the URL with a up_<foo>=<bar> when
the gadget / page is reloaded).. it's pure container code so this would have to be added to joomla (partuza has the
Applications/Controllers/setpref event for that which is called through a simple ajax call), and requestNavigateTo() .. well
as the name implies it changes the URL of the container (site) to navigate to the specified URL / view (ie goto 'canvas'
view, with params ?foo=bar&bob=1).
As far as how you implement them, that's completely upto you and in what style Joomla does javascript, as long as they
perform those basic functions :)
At that point you have a 'working setup', and it's time to add the gravy.. a nice gadget gallery where people can pick the
gadget to add to a page and a UI for editing gadget settings (like 'which sign' in the horoscope gadget).
Hope that helps, and if i need to expand a bit more on any of those points please don't hesitate to ask!
-- Chris