shindig-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Wyllie <>
Subject RE: userPrefs is undefined / getting UserPreferences to work
Date Fri, 29 Oct 2010 10:47:30 GMT

Hi Peter
I don't think this will fully answer your question but hopefully will help;
I assume your gadget has <Require feature="setprefs"/>?
Your container needs to register a function to handle calls to set prefs e.g. gadgets.rpc.register('set_pref',
That function needs to be implemented by you and it saves the prefs to your own backend data
store e.g using AJAX. It seems to be passed the token, the pref name and the pref value. 
The sample function is setUserPref in shindig-container.js. I don't know how far that goes
i.e whether it actually attempts to save the prefs. Looking through the code  I don't think
it does. 
We copied one from the Partuza sample container which obtains the iframe element from this.f
which is magically present in the function you've registered and from which you can  obtain
the mod id:
var elm = $('#' + this.f);var params = _parseIframeUrl(elm.attr('src'));mod_id = params.mid;
Then we save to our backend using AJAX.
When you render your gadgets - we are building the iframe and its src on the server - you
need to get the relevant prefs out of your database and build them onto the iframe source
like up_prefname=prefvalue. We wrote code which gets the default pref out of the metadata
call and replaces it if we have a user saved one. The rendering then takes care of setting
up the prefs object in the gadget.
The edit box that you see on iGoogle where the user can edit their preference settings - you
have to make your own.
Justin Wyllie

> Date: Fri, 29 Oct 2010 11:08:09 +0200
> From:
> To:
> Subject: userPrefs is undefined / getting UserPreferences to work
> Hi everyone,
> I am using "" (JAVA) downloaded from [1]. Going
> through the samples available via [2], I'm getting several errors which
> I have problems dealing with on my own - especially regarding the
> UserPreferences (sample 4 and 5).
> Both Samples procude the following error (using Firefox 3.6.12 + Firebug
> 1.5.4):
> > expect_true(true, 'setprefs done'); 
> >
> > expect_true is not defined
> > http://localhost:8080/gadgets/ifr?container=default&mid=0&nocache=1&country=ALL&lang=ALL&view=default&parent=http%3A%2F%2Flocalhost%3A8080%2Fcontainer%2Fsample5.html%3A%2F%2Flocalhost%3A8080&st=john.doe:john.doe:appid:cont:url:0:default&
> > Line 40
> and
> > this.userPrefs[arguments[i]].value = arguments[i + 1]; 
> >
> > this.userPrefs is undefined
> > http://localhost:8080/gadgets/js/shindig-container:rpc.js?c=1&debug=1
> > Line 5796
> I have already successfully implemented my own PersonService to retrieve
> Person Data from my backend-db. The gadget-renderer is up and running
> just fine and I have already implemented my own gadgets (testing my
> gadgets in iGoogle). Sadly, having the users store preferences is
> crucial to my gadgets and my backend to I'm somehow stuck.
> I could not find documentation on the further steps in ceating my own
> OpenSocialBackend using Shindig - the getting-started [3] just states
> that I should implement "PersonService, AppDataService, ActivityService,
> MessagesService" which is no problem for me, however I'm asking myself
> if I should/could implement my own PrefStore using the backend Database
> on my server (and how).
> Also, sample2 and 6 produce the following error (same setting as above):
> > for(var i = 0; i < arr.length; i++) { 
> >
> > arr is undefined
> > http://localhost:8080/gadgets/js/shindig-container:rpc.js?c=1&debug=1
> > Line 6266
> I would really appreciate your help since shindig 2.0 so far has really
> proven very very useful to me and I'm looking forward to fully integrate
> shindig into my social network.
> Best,
> Peter
> [1]
> [2] http://localhost:8080/container/
> [3]
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message