Actually, I was lazy and went with the approach of layering userprefs on top
of appdata as follows:
container.rpcRegister('set_pref', function(rpcArgs, data) {
var prefName = rpcArgs['a'][1];
var prefKey = 'up_' + prefName;
var prefValue = rpcArgs['a'][2];
var data = {};
data[prefKey] = prefValue;
osapi.appdata.update({
userid : '@me',
groupid : '@self',
appId : '@app',
data : data
}).execute(function(response) {
});
});
This is with anticipation that appdata and userprefs will align as discussed
here:
http://code.google.com/p/opensocial-resources/issues/detail?id=1182
Of course this also requires you to implement appdata server side. Right
now I¹m just using the JsonDb implementation (in-memory), but we¹ll be
writing a persistent layer soon.
I also ran into issues with the correct token (the gadget one with the appid
that you¹ll need to use to index the data) being passed to the appdata
request. You can search for my other thread about this.
doug
On 7/25/11 6:53 PM, "Henry Saputra" <[email protected]> wrote:
> If you want the user pref to be persisted in the database you need to
> implement the server handler for it.
>
> I remember Doug Davies has tried to add persistent layer for user
> pref. Maybe he could share his progress.
>
> Including him in the email.
>
> - Henry
>
> On Mon, Jul 25, 2011 at 3:42 PM, Mat Schaffer <[email protected]> wrote:
>> > So with some research it looks like I'm supposed to be implementing my own
>> > server module. Is that pretty much accurate?
>> >
>> > Again, any advice or RTFMs (with a link to the respective FMs) is
>> > appreciated.
>> >
>> > Thanks,
>> > Mat
>> >
>> > On Fri, Jul 22, 2011 at 10:20 AM, Mat Schaffer <[email protected]> wrote:
>> >
>>> >> So I noticed that UserPref items don't work on the sample container which
>>> >> makes sense after finding this thread:
>>> >> http://markmail.org/message/tlwtlo4mrnrpz4w5
>>> >>
>>> >> Is there any good example of best-practice for implementing user prefs in
>>> >> my containing application? Do I just make my own shindig-container.js and
>>> >> handleOpenUserPrefsDialog? And does the page we point to just render
>>> >> information into a div with id of `this.id`?
>>> >>
>>> >> The gmodule code appears to be obfuscated, so it's a bit hard to tell >>>
what
>>> >> the right course of action would be. Any documentation or assistance
>>> would
>>> >> be appreciated.
>>> >>
>>> >> Thanks,
>>> >> Mat
>>> >>
>> >
>
>