Ginger’s new functionalities for UWA developers (part 1)
With the arrival of Netvibes Ginger, users can now have two sides for their Netvibes account: one private (the classic page), where users put their favorite and most useful widgets like e-mails, feeds, social networks, all to be seen by them only ; and one public (the Netvibes Universe), where the users will tend to put widgets that present his/her online identity instead of giving access to private data.
These are two sides of a great coin, but obviously not all widgets can work for both sides: while games and feeds are just fine, some other widgets are so-so, like those fetching private data from Flickr, and others are a big no-no, like putting your gmail account on your Universe by mistake.
The read/write thingamagob
We call this conundrum the “read/write” paradigm* : basically, your private page should have widget that are able to display your private and let you send new data to your various accounts, whereas a public page (the Universe) should only allow widgets that are able to “read” data for which it has been set, NOT let visitors of your Universe send their data to your accounts.
In short, the ideal would be to have two sides to widget too: one allowing the widget viewer to read/write, one where only read is available. Let’s take the Twitter widget: if placed on your private page, it should display your twits and those from your followers, along with a form to let you send new twitts to the service ; if placed on your universe, it should only display your twitts and those from your followers.
Ok, you get it by now, so I’ll just answer the question that is clinging on your lips, “How can I know if my widget is used on private page or a Universe?”
Not “42″
The answer, in the eternal words of Obi-Wan Kenobi, is: use the widget.readOnly, Luke.
Ginger adds a handful of new functionalities to UWA, among which the widget.readOnly property, which is set by Netvibes to true or false, depending on where the widget is placed: true for a Universe, false for a private page.
From there, you can guess to code to use in order to your widget to take its placement into account:
if (!widget.readOnly) {
// private-only code
} else {
// in-Universe code
}
You can even go a bit further if your widget uses Netvibes-specific methods - which we’ll overview in a coming post:
if (!widget.readOnly && !widget.environment.netvibes) {
widget.setBody('This widget can only work in Netvibes!');
return false;
}
Now you are able to know when your widget is on a Universe or on a public page, and you can act accordingly. So if your widget is built to handle private data, start adapting it now!
* : well, we don’t really use it among us, but I wanted to use such words
Tags: ginger, private, universe, uwa, widget.readOnly
July 31st, 2008 at 12:27 am
i thing that widget not a popular and functionalty application
July 31st, 2008 at 11:34 am
@ahmbay: well that’s too bad, many widgets from Ecosystem aim at proving you wrong