You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Cassie <do...@google.com> on 2008/07/08 22:34:13 UTC

Re: Questions about userPreferences

+ shindig-dev

Sorry for the late response, I've been on vacation. As a reminder you should
probably email shindig-dev to get the fastest most thorough response to any
of your questions. Answers below...


On Wed, Jun 25, 2008 at 8:54 AM, Youri op 't Roodt <yo...@hyves.nl> wrote:

> Hi Cassie,
>
> I'm working on the JS features of OpenSocial for our Hyves container and
> I have a few questions mostly regarding the userPrefs.
> When writing a gadget, you can have the user enter some preferences by
> including things like
>
> <UserPref name="username" display_name="Username" default_value=""
> required="true"/>
>
> in your spec. From a tutoial (can't seem to find the particular page
> right now...) page I'm assuming that the userprefs dialog is rendered by
> the JavaScript code that came with the Shindig project. Is this correct?


Shindig does have some code which does some basic rendering of userprefs and
has a simple ui. It is in cookiebaseduserprefstore.js and gadgets.js. This
provides a sample impl that stores the userprefs in the users cookies. We
don't recommend this for a prod launch (as using cookies for real data would
not be a good idea) but hopefully it will give you a basic example. Shindig
will hopefully get more advanced code for the container but nobody has been
working on it much lately.


>
> Do I set the userprefs using gadget.setUserPrefs({object})? If that's
> true, what format should the userprefs be?


If you need to set the userprefs by hand you could pass in a map from key to
value like
{key1 : value1, key2 : value2}

You can see an example of how this is used in gadgets.js line 220. (in the
setUserPref method)


>
>
> Another thing, in the gadget.js file there is
>        gadgets.Gadget.prototype.getUserPrefsDialogContent =
> function(continuation) {
>          throw Error(gadgets.error.SUBCLASS_RESPONSIBILITY);
>        };
>
> Does this mean we have to extend the gadgets.Gadget class, similar to
> the way we're extending the container? Sorry about all these questions,


exactly.


>
> but I'm a bit confused about how the userpreferences work and what parts
> of the reference implementation we can use out of the box and which ones
> we have to extend.


Yeah.. the whole story is sorta gross right now... Shindig has some stuff
but it isn't great. We would love more contributions though, so if you
figure out a fantastical solution please give back!

Let us know if you have any more questions and this list will be able to
help.

- Cassie



>
>
> Thanks in advance!
>
> Youri
>
> Hyves
>