0

Capturing User Preferences

Is there anything built into the API for displaying and capturing user preferences on the front-end side? For example, is there anything similar to the <UserPref> tags offered in the iGoogle API? Or would I need to build a custom form for capturing user preferences using <yml:form>? Then I can save and manage them using gadgets.Prefs from the OpenSocial API right?

by
2 Replies
  • Hi burntber,

    Besides the OpenSocial JavaScript API support, the only other methods I am aware of for using user data without the help of the SDK & without authenticating using OAuth is to use yml which is pre-formatted and is probably not exactly what you are looking for.

    - Jon

    QUOTE (burntber @ Feb 13 2009, 01:27 PM) <{POST_SNAPBACK}>
    Is there anything built into the API for displaying and capturing user preferences on the front-end side? For example, is there anything similar to the <UserPref> tags offered in the iGoogle API? Or would I need to build a custom form for capturing user preferences using <yml:form>? Then I can save and manage them using gadgets.Prefs from the OpenSocial API right?
    0
  • Thanks Jon. Quick follow-up question...

    I'm trying to set preferences by doing something along the lines of:

    var prefs = new gadgets.Prefs();
    prefs.set('key', 'value');

    I'm getting the following error:

    Error: setprefs feature required to make this call.
    Source File: http://l.yimg.com/kj/yap/combo?/common/js/...jzEFXUKkxxQ-.js
    Line: 28

    I read the following in the docs:

    "YAP supports the Gadget Core APIs, except for Prefs, Views, and the Feature-Specific API."
    "However, YAP v1.0 does not support the OpenSocial RESTful API or Gadget XML definitions."

    Can I set prefs or is this functionality not yet supported? If it is supported, how do I require the setprefs feature? Since YAP doesn't support GadgetXML definitions, I don't think I can use <Require feature="setprefs"/> in the ModulePrefs correct?
    0
  • Hi burntber,

    It looks like, from the documentation you posted, that setprefs is not currently a supported feature on YAP. Since we don't use the gadgets XML spec file you won't be able to set prefs in that way. Which prefs are you attempting to set? They may be a way around this.

    - Jon

    QUOTE (burntber @ Feb 18 2009, 06:50 AM) <{POST_SNAPBACK}>
    Thanks Jon. Quick follow-up question...

    I'm trying to set preferences by doing something along the lines of:

    var prefs = new gadgets.Prefs();
    prefs.set('key', 'value');

    I'm getting the following error:

    Error: setprefs feature required to make this call.
    Source File: http://l.yimg.com/kj/yap/combo?/common/js/...jzEFXUKkxxQ-.js
    Line: 28

    I read the following in the docs:

    "YAP supports the Gadget Core APIs, except for Prefs, Views, and the Feature-Specific API."
    "However, YAP v1.0 does not support the OpenSocial RESTful API or Gadget XML definitions."

    Can I set prefs or is this functionality not yet supported? If it is supported, how do I require the setprefs feature? Since YAP doesn't support GadgetXML definitions, I don't think I can use <Require feature="setprefs"/> in the ModulePrefs correct?
    0
  • I'm fetching and displaying content from my own custom RSS feed. I'd like to let users set preferences/settings for things like:

    - how many items they would like to display.
    - which dates (pubDate RSS node) to display items from.
    - which categories (category RSS node) to display items from.

    So basically these would be preference specific to my application, not related to OpenSocial or YAP functionality/integration.

    This is easily done with Google Gadgets by using <UserPref> tags and gadgets.Prefs from the OpenSocial API.

    Without <UserPref> and gadgets.Prefs support, I'd have to code my own HTML form to capture the user preferences, but they would only persist for the user's current session; I couldn't save them for return use.
    0
  • What I can think of for this implementation is to store this information manually on your side (i.e. through a database implementation), or you can cookie the user with that preference information and store it that way. Those are a few of the options that I can think of to accomplish the same task.

    - Jon

    QUOTE (burntber @ Feb 23 2009, 07:12 AM) <{POST_SNAPBACK}>
    I'm fetching and displaying content from my own custom RSS feed. I'd like to let users set preferences/settings for things like:

    - how many items they would like to display.
    - which dates (pubDate RSS node) to display items from.
    - which categories (category RSS node) to display items from.

    So basically these would be preference specific to my application, not related to OpenSocial or YAP functionality/integration.

    This is easily done with Google Gadgets by using <UserPref> tags and gadgets.Prefs from the OpenSocial API.

    Without <UserPref> and gadgets.Prefs support, I'd have to code my own HTML form to capture the user preferences, but they would only persist for the user's current session; I couldn't save them for return use.
    0

Recent Posts

in YAP