You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Lublinsky, Boris" <bo...@navteq.com> on 2008/09/11 18:02:02 UTC

FW: Dafault values for user preferences.

 

 

________________________________

From: Lublinsky, Boris 
Sent: Sunday, September 07, 2008 8:19 PM
To: 'shindig-dev@incubator.apache.org'
Subject: Dafault values for user preferences.

 

For some reason, when using 

var prefs = new gadgets.Prefs();

 

the values are populated only if they are present in the URL. If I am
not trying to overwrite default values, the prefs is an empty object.

When I look at the javascript implementation, I can see that it uses
only URL variables to populate.

 

When I started digging into java implementation, I can see that
createGadgetFromSpec method in the Gadget server class invokes
UserPrefSubstituter, which is correctly populating Substitutions class
with the parameters from URL, but I do not see where this variables are
used. The gadget spec does not reflect these variables.

 

What an I missing?

 

 

Boris Lublinsky

Lead Architect, R&D

NAVTEQ

425 W Randolph Street

Chicago, IL 60606

(T) 312.780.3050

 



The information contained in this communication may be CONFIDENTIAL and is intended only for the use of the recipient(s) named above.  If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited.  If you have received this communication in error, please notify the sender and delete/destroy the original message and any copy of it from your computer or paper files.

Re: FW: Dafault values for user preferences.

Posted by John Hjelmstad <fa...@google.com>.
Boris:

Interesting how these problems arise in several places at once.

At present, JS initialization of Prefs from defaults is not implemented.
That is, if you manually generate a rendering URL (eg.
server.com/gadgets/ifr?url=gadget.xml&up_key1=val1...), the resulting
gadget's Prefs library doesn't know about UP defaults.

If you generate a rendering URL using /gadgets/metadata (or equivalent -
ultimately, code that uses UrlGenerator.getIframeUrl(Gadget)) - strongly
recommended in general - the URL you get back does include defaults.

I've posited on a separate thread (
http://shindig-dev.markmail.org/search/?q=default_value#query:default_value+page:1+mid:ep2vnfdzwmwtb2oa+state:results)
that we could support JS initialization of these values by injecting a JS
variable into rendered output with configured defaults. The Prefs JS library
would pick these up when overrides are not present. Still, this comes at the
cost of additional rendered output size (though not much), and subtly
discourages use of preferred mechanisms for generating rendering URLs.

Re: UserPrefSubstituter... UserPrefs may be substituted anywhere in gadget
<Content> section(s) through the use of syntax __UP_userPrefKey__, which is
expanded server-side (using URL-provided params or defaults) to the
correspondig UserPref value.

--John

On 9/11/08, Lublinsky, Boris <bo...@navteq.com> wrote:
>
>
>
>
>
> ________________________________
>
> From: Lublinsky, Boris
> Sent: Sunday, September 07, 2008 8:19 PM
> To: 'shindig-dev@incubator.apache.org'
> Subject: Dafault values for user preferences.
>
>
>
> For some reason, when using
>
> var prefs = new gadgets.Prefs();
>
>
>
> the values are populated only if they are present in the URL. If I am
> not trying to overwrite default values, the prefs is an empty object.
>
> When I look at the javascript implementation, I can see that it uses
> only URL variables to populate.
>
>
>
> When I started digging into java implementation, I can see that
> createGadgetFromSpec method in the Gadget server class invokes
> UserPrefSubstituter, which is correctly populating Substitutions class
> with the parameters from URL, but I do not see where this variables are
> used. The gadget spec does not reflect these variables.
>
>
>
> What an I missing?
>
>
>
>
>
> Boris Lublinsky
>
> Lead Architect, R&D
>
> NAVTEQ
>
> 425 W Randolph Street
>
> Chicago, IL 60606
>
> (T) 312.780.3050
>
>
>
>
>
> The information contained in this communication may be CONFIDENTIAL and is
> intended only for the use of the recipient(s) named above.  If you are not
> the intended recipient, you are hereby notified that any dissemination,
> distribution, or copying of this communication, or any of its contents, is
> strictly prohibited.  If you have received this communication in error,
> please notify the sender and delete/destroy the original message and any
> copy of it from your computer or paper files.
>