You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by li...@apache.org on 2008/03/03 22:37:14 UTC
svn commit: r633284 -
/incubator/shindig/trunk/javascript/container/gadgets.js
Author: lindner
Date: Mon Mar 3 13:37:12 2008
New Revision: 633284
URL: http://svn.apache.org/viewvc?rev=633284&view=rev
Log:
Step 1 - add in the api methods to set all the values we want to control
from the front end. Will incorporate json rpc mechanism next..
Modified:
incubator/shindig/trunk/javascript/container/gadgets.js
Modified: incubator/shindig/trunk/javascript/container/gadgets.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/javascript/container/gadgets.js?rev=633284&r1=633283&r2=633284&view=diff
==============================================================================
--- incubator/shindig/trunk/javascript/container/gadgets.js (original)
+++ incubator/shindig/trunk/javascript/container/gadgets.js Mon Mar 3 13:37:12 2008
@@ -354,12 +354,17 @@
* "private": Whether gadget spec is accessible only privately, which means
* browser can load it but not gadget server
* "spec": Gadget Specification in XML
+ * "viewParams": a javascript object containing attribute value pairs
+ * for this gadgets
+ * "secureToken": an encoded token that is passed on the URL hash
+ * "hashData": Query-string like data that will be added to the
+ * hash portion of the URL.
*/
gadgets.Gadget = function(params) {
this.userPrefs_ = {};
if (params) {
- for (var name in params) {
+ for (var name in params) if (params.hasOwnProperty(name)) {
this[name] = params[name];
}
}
@@ -499,9 +504,20 @@
};
gadgets.IfrGadget.prototype.getIframeUrl = function() {
- return this.serverBase_ + 'ifr?url=' +
- encodeURIComponent(this.specUrl) + '&synd=' + this.SYND + '&mid=' +
- this.id + "&rpctoken=" + this.rpcToken + this.getUserPrefsParams();
+ return this.serverBase_ + 'ifr?' +
+ 'url=' + encodeURIComponent(this.specUrl) +
+ '&synd=' + this.SYND +
+ '&mid=' + this.id +
+ '&nocache=' + gadgets.container.nocache_ +
+ '&country=' + gadgets.container.country_ +
+ '&lang=' + gadgets.container.language_ +
+ '&view=' + gadgets.container.view_ +
+ this.getUserPrefsParams() +
+ '#rpctoken=' + this.rpcToken +
+ (this.secureToken ? '&st=' + (this.secureToken || "") : '') +
+ (this.viewParams ?
+ '&view-params=' + encodeURIComponent(JSON.stringify(this.viewParams)) : '') +
+ (this.hashData ? this.hashData : '');
};
gadgets.IfrGadget.prototype.getUserPrefsParams = function() {
@@ -602,6 +618,10 @@
gadgets.Container = function() {
this.gadgets_ = {};
this.parentUrl_ = '';
+ this.country_ = 'ALL';
+ this.language_ = 'ALL';
+ this.view_ = 'default';
+ this.nocache_ = 1;
};
gadgets.Container.inherits(gadgets.Extensible);
@@ -626,6 +646,22 @@
gadgets.Container.prototype.setParentUrl = function(url) {
this.parentUrl_ = url;
+};
+
+gadgets.Container.prototype.setCountry = function(country) {
+ this.country_ = country;
+};
+
+gadgets.Container.prototype.setNoCache = function(nocache) {
+ this.nocache_ = nocache;
+};
+
+gadgets.Container.prototype.setLanguage = function(language) {
+ this.language_ = language;
+};
+
+gadgets.Container.prototype.setView = function(view) {
+ this.view_ = view;
};
gadgets.Container.prototype.getGadgetKey_ = function(instanceId) {