You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Paul Lindner <pl...@hi5.com> on 2008/02/11 22:00:51 UTC
gadgets.Prefs.parseUrl()
Hi,
To get the gadgets.Prefs.* functionality working I had to add this
line to my opensocial-0.7/feature.xml
gadgets.Prefs.parseUrl();
After this is executed then the following test cases succeed:
testPrefs: function () { with(this) {
testhead("testPrefs");
var p = new gadgets.Prefs()
assertNotNull(p, "cannot get gadgets.Prefs()");
assertNotNull(p.getCountry());
assertNotEqual(p.getCountry(), 'all', 'country cannot be "all"');
testoutput("Found country: '" + p.getCountry() + "'");
assertEqual(p.getCountry().length, 2);
assertNotNull(p.getLang());
assertNotEqual(p.getLang(), 'all', 'lang cannot be "all"');
testoutput("Found language: '" + p.getLang() + "'");
assertEqual(p.getLang().length, 2);
}},
(note this is when calling gadgets/ifr with country/lang parameters
set.)
Should we add this call to the samplecontainer too?
I'm also a little confused about what how one is supposed to use
moduelid in prefs.js...
--
Paul Lindner
hi5 Architect
plindner@hi5.com
Re: gadgets.Prefs.parseUrl()
Posted by Cassie <do...@google.com>.
That seems really strange. If the prefs library needs that call perhaps we
should just put it at the end of the prefs file? However, this seems more
like a bug.
Zhen or Kevin should know...
- Cassie
On Mon, Feb 11, 2008 at 1:00 PM, Paul Lindner <pl...@hi5.com> wrote:
> Hi,
>
> To get the gadgets.Prefs.* functionality working I had to add this
> line to my opensocial-0.7/feature.xml
>
> gadgets.Prefs.parseUrl();
>
> After this is executed then the following test cases succeed:
>
> testPrefs: function () { with(this) {
> testhead("testPrefs");
> var p = new gadgets.Prefs()
> assertNotNull(p, "cannot get gadgets.Prefs()");
>
> assertNotNull(p.getCountry());
> assertNotEqual(p.getCountry(), 'all', 'country cannot be
> "all"');
> testoutput("Found country: '" + p.getCountry() + "'");
> assertEqual(p.getCountry().length, 2);
>
> assertNotNull(p.getLang());
> assertNotEqual(p.getLang(), 'all', 'lang cannot be "all"');
> testoutput("Found language: '" + p.getLang() + "'");
> assertEqual(p.getLang().length, 2);
> }},
>
> (note this is when calling gadgets/ifr with country/lang parameters
> set.)
>
> Should we add this call to the samplecontainer too?
>
> I'm also a little confused about what how one is supposed to use
> moduelid in prefs.js...
>
> --
> Paul Lindner
> hi5 Architect
> plindner@hi5.com
>
Re: gadgets.Prefs.parseUrl()
Posted by Paul Lindner <pl...@hi5.com>.
On Mon, Feb 11, 2008 at 01:53:26PM -0800, Kevin Brown wrote:
> It looks like the bug here is that setLanguage / setCountry is only being
> called when there is a message bundle present. The fix would probably be to
> move this behavior out of the if (bundle == null) block in
> MessageBundleSubstituter.java and always perform it.
>
> Good find.
Latest head is working:
gadgets.prefs_.setLanguage(0, "en");gadgets.prefs_.setCountry(0, "US");
Thanks!
--
Paul Lindner
hi5 Architect
plindner@hi5.com
Re: gadgets.Prefs.parseUrl()
Posted by Kevin Brown <et...@google.com>.
It looks like the bug here is that setLanguage / setCountry is only being
called when there is a message bundle present. The fix would probably be to
move this behavior out of the if (bundle == null) block in
MessageBundleSubstituter.java and always perform it.
Good find.
On Feb 11, 2008 1:30 PM, Paul Lindner <pl...@hi5.com> wrote:
> On Mon, Feb 11, 2008 at 01:13:27PM -0800, Kevin Brown wrote:
> > gadgets.Prefs is populated by the server and emitted into the gadget
> output
> > ( are you actually running a shindig gadgets server when using this? see
> > UserPrefSubstituter.java for the intended behavior) parseUrl() is a hack
> for
> > dealing with type=url gadgets. I haven't found this to break anywhere
> else.
>
> My output has the following:
>
> gadgets.prefs_.setDefaultModuleId(0);
> gadgets.prefs_.setPref(0, {});
>
>
> It seems that the country/lang parameters are not getting injected
> into the preferences.
>
> Looking at BasicHttpContext.java it appears that no-one calls
> getCountry() or getLanguage(), so this data doesn't make it into the
> user prefs.
>
>
>
> --
> Paul Lindner
> hi5 Architect
> plindner@hi5.com
>
Re: gadgets.Prefs.parseUrl()
Posted by Paul Lindner <pl...@hi5.com>.
On Mon, Feb 11, 2008 at 01:13:27PM -0800, Kevin Brown wrote:
> gadgets.Prefs is populated by the server and emitted into the gadget output
> ( are you actually running a shindig gadgets server when using this? see
> UserPrefSubstituter.java for the intended behavior) parseUrl() is a hack for
> dealing with type=url gadgets. I haven't found this to break anywhere else.
My output has the following:
gadgets.prefs_.setDefaultModuleId(0);
gadgets.prefs_.setPref(0, {});
It seems that the country/lang parameters are not getting injected
into the preferences.
Looking at BasicHttpContext.java it appears that no-one calls
getCountry() or getLanguage(), so this data doesn't make it into the
user prefs.
--
Paul Lindner
hi5 Architect
plindner@hi5.com
Re: gadgets.Prefs.parseUrl()
Posted by Kevin Brown <et...@google.com>.
gadgets.Prefs is populated by the server and emitted into the gadget output
( are you actually running a shindig gadgets server when using this? see
UserPrefSubstituter.java for the intended behavior) parseUrl() is a hack for
dealing with type=url gadgets. I haven't found this to break anywhere else.
On Feb 11, 2008 1:00 PM, Paul Lindner <pl...@hi5.com> wrote:
> Hi,
>
> To get the gadgets.Prefs.* functionality working I had to add this
> line to my opensocial-0.7/feature.xml
>
> gadgets.Prefs.parseUrl();
>
> After this is executed then the following test cases succeed:
>
> testPrefs: function () { with(this) {
> testhead("testPrefs");
> var p = new gadgets.Prefs()
> assertNotNull(p, "cannot get gadgets.Prefs()");
>
> assertNotNull(p.getCountry());
> assertNotEqual(p.getCountry(), 'all', 'country cannot be
> "all"');
> testoutput("Found country: '" + p.getCountry() + "'");
> assertEqual(p.getCountry().length, 2);
>
> assertNotNull(p.getLang());
> assertNotEqual(p.getLang(), 'all', 'lang cannot be "all"');
> testoutput("Found language: '" + p.getLang() + "'");
> assertEqual(p.getLang().length, 2);
> }},
>
> (note this is when calling gadgets/ifr with country/lang parameters
> set.)
>
> Should we add this call to the samplecontainer too?
>
> I'm also a little confused about what how one is supposed to use
> moduelid in prefs.js...
>
> --
> Paul Lindner
> hi5 Architect
> plindner@hi5.com
>