You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Hafiz A Haq <ha...@gmail.com> on 2009/04/02 12:29:03 UTC
Constructing a gadget with different preferences
Hi team,
I am not sure if this is the right place to ask this, but still i thought i
will shoot it.
First up let me clarify my dev environment.
I have setup Shindig in my webserver and i am using it to render various
igoogle gadgets and my custom gadgets into my dashboard.
We are developing our application with GWT/Flex and is converting these
pages into gadgets by makin use of google-gadgets-api.
The google gadget api provides a UserPreferences object in gadgets init
method and i could use this object to retrieve the preferences set by the
user.
My question, how could i populate this userpreferences object while
constructing the gadget?
Or rather is there a standard way i should construct my gadget url appending
the user preferences to let the gadget constructor code to render based on
the provided preferences?
I am using gadget metadata service retrieve the gadget metadata and render
the iframe using the javascript
newGadgetChrome.innerHTML = [
'<iframe src="', gadget.iframeUrl, '&libs=', libs ,
'" id="remote_iframe_', gadget.moduleId, '" name="remote_iframe_',
gadget.moduleId, '" style="height :', gadget.height, '"></iframe>'
].join("");
Thanks and Regards,
Hafiz
--
He who asks is a fool for five minutes, but he who does not ask remains a
fool forever.
Re: Constructing a gadget with different preferences
Posted by Hafiz A Haq <ha...@gmail.com>.
Thank you Tim.
It was actually simpler than i thought, but i had to debug RPCServlet.java
to understand how to pass preferences along with request object.
var requestObj = {
context: {
...
},
gadgets: [
{
url: gadgetUrl,
moduleId: 0,
* prefs:
{
pref1:val1,
pref2:val2
}*
}
]
};
The bold text was the key.
Thanks and Regards,
Hafiz
2009/4/2 Tim Moore <tm...@atlassian.com>
>
> On Apr 2, 2009, at 3:29 AM, Hafiz A Haq wrote:
>
> Or rather is there a standard way i should construct my gadget url
>> appending
>> the user preferences to let the gadget constructor code to render based on
>> the provided preferences?
>>
>
> Yes. Add a set of query parameters named like up_prefname with the value
> set to the string value of the user pref (list prefs are pipe (|) delimited;
> literal pipes should be URL-encoded).
>
> Look at getIframeUrl and getUserPrefsParams in <
> http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/gadgets.js?view=markup>
> for an example.
>
> Cheers,
> --
> Tim Moore
>
>
--
He who asks is a fool for five minutes, but he who does not ask remains a
fool forever.
Re: Constructing a gadget with different preferences
Posted by Tim Moore <tm...@atlassian.com>.
On Apr 2, 2009, at 3:29 AM, Hafiz A Haq wrote:
> Or rather is there a standard way i should construct my gadget url
> appending
> the user preferences to let the gadget constructor code to render
> based on
> the provided preferences?
Yes. Add a set of query parameters named like up_prefname with the
value set to the string value of the user pref (list prefs are pipe
(|) delimited; literal pipes should be URL-encoded).
Look at getIframeUrl and getUserPrefsParams in <http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/gadgets.js?view=markup
> for an example.
Cheers,
--
Tim Moore