Author: etnu
Date: Wed Jan 23 02:28:26 2008
New Revision: 614483
URL: http://svn.apache.org/viewvc?rev=614483&view=rev
Log:
Updated JS libraries to match the current (new) gadget spec standards. Since
these are still in progress, expect more changes to these files in the coming
days.
Modified:
incubator/shindig/trunk/features/core/io.js
incubator/shindig/trunk/features/core/json.js
incubator/shindig/trunk/features/core/legacy.js
incubator/shindig/trunk/features/core/prefs.js
incubator/shindig/trunk/features/dynamic-height/dynamic-height.js
incubator/shindig/trunk/features/flash/flash.js
incubator/shindig/trunk/features/ifpc/ifpc.js
incubator/shindig/trunk/features/setprefs/setprefs.js
incubator/shindig/trunk/features/settitle/settitle.js
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/MessageBundleSubstituter.java
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/ModuleSubstituter.java
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/UserPrefSubstituter.java
Modified: incubator/shindig/trunk/features/core/io.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/io.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/io.js (original)
+++ incubator/shindig/trunk/features/core/io.js Wed Jan 23 02:28:26 2008
@@ -60,19 +60,18 @@
// to begin with, and we can solve this problem by using post requests
// and / or passing the url in the http headers.
txt = txt.substr(UNPARSEABLE_CRUFT.length);
- // TODO: safe JSON parser.
- var data = gadgets.JSON.parse(txt);
+ var data = gadgets.json.parse(txt);
data = data[url];
var resp = {
text: data.body,
errors: []
};
- switch (params.contentType) {
- case "json":
- // TODO: safe JSON parser.
- resp.data = gadgets.JSON.parse(resp.text);
+ switch (params.CONTENT_TYPE) {
+ case "JSON":
+ case "FEED":
+ resp.data = gadgets.json.parse(resp.text);
break;
- case "dom":
+ case "DOM":
var dom;
if (window.ActiveXObject) {
dom = new ActiveXObject("Microsoft.XMLDOM");
@@ -95,24 +94,31 @@
return /** @scope gadgets.io */ {
/**
- * Retrieves the content at the specified url.
+ * Fetches content from the provided URL and feeds that content into the
+ * callback function.
*
* Example:
* <pre>
- * gadgets.IO.makeRequest(url, fn, {type: gadgets.IO.ContentType.JSON});
+ * gadgets.io.makeRequest(url, fn,
+ * {contentType: gadgets.io.ContentType.FEED});
* </pre>
*
- * @param {String} url The url to fetch.
- * @param {Function} callback Invoked when the request completes. The
- * response object will be passed in as a parameter.
- * @param {Object} opt_params Optional parameters. May be modified.
+ * @param {String} url The URL where the content is located
+ * @param {Function} callback The function to call with the data from the
+ * URL once it is fetched
+ * @param {Map.<gadgets.io.RequestParameters, Object>} opt_params
+ * Additional
+ * <a href="gadgets.io.RequestParameters.html">parameters</a>
+ * to pass to the request
*/
makeRequest : function (url, callback, opt_params) {
+ // TODO: This method also needs to respect all members of
+ // gadgets.io.RequestParameters, and validate them.
var xhr = makeXhr();
var params = opt_params || {};
var newUrl = config.jsonProxyUrl.replace("%url%",
encodeURIComponent(url));
- xhr.open(params.postData ? "POST" : "GET", newUrl, true);
+ xhr.open(params.METHOD || "GET", newUrl, true);
if (callback) {
xhr.onreadystatechange = gadgets.util.makeClosure(null,
processResponse, url, callback, params, xhr);
@@ -166,3 +172,175 @@
}
};
}();
+
+// TODO: This can all be removed after the spec is published. This is only
+// here to satisfy documentation requirements.
+
+/**
+ * @static
+ * @class
+ * Used by the
+ * <a href="gadgets.io.html#makeRequest">
+ * <code>gadgets.io.makeRequest()</code></a> method.
+ * @name gadgets.io.RequestParameters
+ */
+gadgets.io.RequestParameters = {
+ /**
+ * The method to use when fetching content from the URL;
+ * defaults to <code>MethodType.GET</a></code>.
+ * Specified as a
+ * <a href="gadgets.io.MethodType.html">MethodType</a>.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ METHOD : 'METHOD',
+
+ /**
+ * The type of content that lives at the URL;
+ * defaults to <code>ContentType.HTML</code>.
+ * Specified as a
+ * <a href="gadgets.io.ContentType.html">
+ * ContentType</a>.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ CONTENT_TYPE : "CONTENT_TYPE",
+
+ /**
+ * The data to send to the URL using the POST method.
+ * Specified as a <code>String</code>
+ * Defaults to null.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ POST_DATA : "POST_DATA",
+
+ /**
+ * The HTTP headers to send to the URL.
+ * Specified as a <code>Map.<String,String></code>
+ * Defaults to null.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ HEADERS : "HEADERS",
+
+ /**
+ * The type of authentication to use when fetching the content;
+ * defaults to <code>AuthorizationType.NONE</code>.
+ * Specified as an
+ * <a href="gadgets.io.AuthorizationType.html">
+ * AuthorizationType</a>.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ AUTHORIZATION : 'AUTHORIZATION',
+
+
+ /**
+ * If the content is a feed, the number of entries to fetch;
+ * defaults to 3.
+ * Specified as a <code>Number</code>.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ NUM_ENTRIES : 'NUM_ENTRIES',
+
+ /**
+ * If the content is a feed, whether to fetch summaries for that feed;
+ * defaults to false.
+ * Specified as a <code>Boolean</code>.
+ *
+ * @member gadgets.io.RequestParameters
+ */
+ GET_SUMMARIES : 'GET_SUMMARIES'
+};
+
+
+/**
+ * @static
+ * @class
+ * Used by
+ * <a href="gadgets.io.RequestParameters.html">
+ * RequestParameters</a>.
+ * @name gadgets.io.MethodType
+ */
+gadgets.io.MethodType = {
+ /** @member gadgets.io.MethodType */
+ GET : 'GET',
+
+ /** @member gadgets.io.MethodType */
+ POST : 'POST',
+
+ /**
+ * @member gadgets.io.MethodType
+ * Not supported by all containers.
+ */
+ PUT : 'PUT',
+
+ /**
+ * @member gadgets.io.MethodType
+ * Not supported by all containers.
+ */
+ DELETE : 'DELETE',
+
+ /**
+ * @member gadgets.io.MethodType
+ * Not supported by all containers.
+ */
+ HEAD : 'HEAD'
+};
+
+
+/**
+ * @static
+ * @class
+ * Used by
+ * <a href="gadgets.io.RequestParameters.html">
+ * RequestParameters</a>.
+ * @name gadgets.io.ContentType
+ */
+gadgets.io.ContentType = {
+ /**
+ * Returns text, used for fetching html.
+ * @member gadgets.io.ContentType
+ */
+ TEXT : 'TEXT',
+
+ /**
+ * Returns a dom object, used for fetching xml.
+ * @member gadgets.io.ContentType
+ */
+ DOM : 'DOM',
+
+ /**
+ * Returns a json object.
+ * @member gadgets.io.ContentType
+ */
+ JSON : 'JSON',
+
+ /**
+ * Returns a json representation of a feed.
+ * @member gadgets.io.ContentType
+ */
+ FEED : 'FEED'
+};
+
+
+/**
+ * @static
+ * @class
+ * Used by
+ * <a href="gadgets.io.RequestParameters.html">
+ * RequestParameters</a>.
+ * @name gadgets.io.AuthorizationType
+ */
+gadgets.io.AuthorizationType = {
+ /** @member gadgets.io.AuthorizationType */
+ NONE : 'NONE',
+
+ /** @member gadgets.io.AuthorizationType */
+ SIGNED : 'SIGNED',
+
+ /** @member gadgets.io.AuthorizationType */
+ AUTHENTICATED : 'AUTHENTICATED'
+};
Modified: incubator/shindig/trunk/features/core/json.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/json.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/json.js (original)
+++ incubator/shindig/trunk/features/core/json.js Wed Jan 23 02:28:26 2008
@@ -35,7 +35,7 @@
/**
* @scope gadgets.JSON
*/
-gadgets.JSON = function () {
+gadgets.json = function () {
var m = {
'\b': '\\b',
'\t': '\\t',
Modified: incubator/shindig/trunk/features/core/legacy.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/legacy.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/legacy.js (original)
+++ incubator/shindig/trunk/features/core/legacy.js Wed Jan 23 02:28:26 2008
@@ -34,34 +34,19 @@
function _IG_FetchXmlContent(url, callback, opt_params) {
var params = opt_params || {};
- params.contentType = "dom";
+ params.CONTENT_TYPE = "DOM";
var cb = gadgets.util.makeClosure(null, _IG_Fetch_wrapper, callback);
gadgets.io.makeRequest(url, cb, params);
}
-function _IG_FetchFeedAsJSON_cb(callback, obj) {
- if (obj.data.fr_1) {
- callback(obj.data.fr_1);
- } else {
- callback(null);
- }
-}
-
-// NOTE: this implementation does not batch calls as is the case on igoogle.
+// TODO: The server doesn't actually support FEED. Fix this!
function _IG_FetchFeedAsJSON(url, callback, numItems, getDescriptions,
opt_params) {
var params = opt_params || {};
- // TODO: this no longer works. The proxy needs to support POST requests
- // to make it work.
- var finalUrl = "http://www.gmodules.com/ig/feedjson?fr_1=";
- finalUrl += gadgets.io.encodeValues({
- url: encodeURIComponent(url),
- val: numItems,
- sum: getDescriptions ? 1 : 0
- });
- params.contentType = "json";
- var cb = gadgets.util.makeClosure(null, _IG_FetchFeedAsJSON_cb, callback);
- gadgets.io.makeRequest(finalUrl, cb, params);
+ params.CONTENT_TYPE = "FEED";
+ params.NUM_ENTRIES = numItems;
+ params.GET_SUMMARIES = getDescriptions;
+ gadgets.io.makeRequest(url, callback, params);
}
function _IG_GetCachedUrl(url) {
Modified: incubator/shindig/trunk/features/core/prefs.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/core/prefs.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/core/prefs.js (original)
+++ incubator/shindig/trunk/features/core/prefs.js Wed Jan 23 02:28:26 2008
@@ -41,7 +41,7 @@
* Stores preferences for the default shindig implementation.
* @private
*/
-gadgets.PrefStore_ = function() {
+gadgets.prefs_ = function() {
var modules = {};
/**
@@ -160,11 +160,11 @@
*/
gadgets.Prefs = function(moduleId) {
if (typeof moduleId === "undefined") {
- this.moduleId_ = gadgets.PrefStore_.getDefaultModuleId();
+ this.moduleId_ = gadgets.prefs_.getDefaultModuleId();
} else {
this.moduleId_ = moduleId;
}
- this.data_ = gadgets.PrefStore_.getModuleData(this.moduleId_);
+ this.data_ = gadgets.prefs_.getModuleData(this.moduleId_);
// This is used to eliminate one hash table lookup per value fetched.
this.prefs_ = this.data_.prefs;
this.msgs_ = this.data_.msgs;
@@ -198,11 +198,11 @@
}
}
}
- gadgets.PrefStore_.setDefaultModuleId(moduleId);
- gadgets.PrefStore_.setPref(moduleId, prefs);
- gadgets.PrefStore_.setMsg(moduleId, msgs);
- gadgets.PrefStore_.setLanguage(moduleId, language);
- gadgets.PrefStore_.setCountry(moduleId, country);
+ gadgets.prefs_.setDefaultModuleId(moduleId);
+ gadgets.prefs_.setPref(moduleId, prefs);
+ gadgets.prefs_.setMsg(moduleId, msgs);
+ gadgets.prefs_.setLanguage(moduleId, language);
+ gadgets.prefs_.setCountry(moduleId, country);
};
/**
Modified: incubator/shindig/trunk/features/dynamic-height/dynamic-height.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/dynamic-height/dynamic-height.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/dynamic-height/dynamic-height.js (original)
+++ incubator/shindig/trunk/features/dynamic-height/dynamic-height.js Wed Jan
23 02:28:26 2008
@@ -17,19 +17,19 @@
*/
/**
- * @fileoverview This library augments gadgets.Window with functionality
+ * @fileoverview This library augments gadgets.window with functionality
* to change the height of a gadget dynamically.
*/
var gadgets = gadgets || {};
-gadgets.Window = gadgets.Window || {};
+gadgets.window = gadgets.window || {};
/**
* Detects the inner dimensions of a frame.
* See: http://www.quirksmode.org/viewport/compatibility.html
* @returns {Object} An object with width and height properties.
*/
-gadgets.Window.getViewportDimensions = function() {
+gadgets.window.getViewportDimensions = function() {
var x,y;
if (self.innerHeight) {
// all except Explorer
@@ -55,7 +55,7 @@
* Adjusts the gadget height
* @param {Number} opt_height Preferred height in pixels.
*/
-gadgets.Window.adjustHeight = function(opt_height) {
+gadgets.window.adjustHeight = function(opt_height) {
var newHeight = parseInt(opt_height, 10);
if (isNaN(newHeight)) {
// Resize the gadget to fit its content.
@@ -71,7 +71,7 @@
// to figure out.
// Get the height of the viewport
- var vh = gadgets.Window.getViewportDimensions().height;
+ var vh = gadgets.window.getViewportDimensions().height;
var body = document.body;
var docEl = document.documentElement;
if (document.compatMode == 'CSS1Compat' && docEl.scrollHeight) {
@@ -113,17 +113,17 @@
}
// Only make the IFPC call if height has changed
- if (newHeight != gadgets.Window.oldHeight_) {
- gadgets.Window.oldHeight_ = newHeight;
+ if (newHeight != gadgets.window.oldHeight_) {
+ gadgets.window.oldHeight_ = newHeight;
var modId = 'remote_module_' + (new gadgets.Prefs()).getModuleId();
var ifpcRelay = gadgets.util.getUrlParameters().parent || '';
- gadgets.IFPC_.call(modId, "resize_iframe", [modId, newHeight],
+ gadgets.ifpc_.call(modId, "resize_iframe", [modId, newHeight],
ifpcRelay, null, '');
}
};
// Alias for legacy code
-var _IG_AdjustIFrameHeight = gadgets.Window.adjustHeight;
+var _IG_AdjustIFrameHeight = gadgets.window.adjustHeight;
-// TODO Attach gadgets.Window.adjustHeight to the onresize event
+// TODO Attach gadgets.window.adjustHeight to the onresize event
Modified: incubator/shindig/trunk/features/flash/flash.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/flash/flash.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/flash/flash.js (original)
+++ incubator/shindig/trunk/features/flash/flash.js Wed Jan 23 02:28:26 2008
@@ -22,14 +22,14 @@
*/
var gadgets = gadgets || {};
-gadgets.Flash = gadgets.Flash || {};
+gadgets.flash = gadgets.flash || {};
/**
* Detects Flash Player and its major version.
* @return {Number} The major version of Flash Player
* or 0 if Flash is not supported.
*/
-gadgets.Flash.getMajorVersion = function() {
+gadgets.flash.getMajorVersion = function() {
var flashMajorVersion = 0;
if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
// Flash detection for browsers using Netscape's plugin architecture
@@ -71,7 +71,7 @@
* passed to the Flash movie on creation. The values must be
HTML-escaped.
* @return {Boolean} Whether the function call completes successfully.
*/
-gadgets.Flash.embedFlash = function(swfUrl, swfContainer, opt_params) {
+gadgets.flash.embedFlash = function(swfUrl, swfContainer, opt_params) {
switch (typeof swfContainer) {
case 'string':
swfContainer = document.getElementById(swfContainer);
@@ -92,7 +92,7 @@
return false;
}
- var ver = gadgets.Flash.getMajorVersion();
+ var ver = gadgets.flash.getMajorVersion();
if (ver) {
var swfVer = parseInt(opt_params.swf_version, 10);
if (isNaN(swfVer)) {
@@ -166,18 +166,19 @@
/**
* Injects a cached Flash file into the DOM tree.
- * Accepts the same parameters as gadgets.Flash.embedFlash does.
+ * Accepts the same parameters as gadgets.flash.embedFlash does.
* @return {Boolean} Whether the function call completes successfully.
*/
-gadgets.Flash.embedCachedFlash = function() {
+gadgets.flash.embedCachedFlash = function() {
var args = Array.prototype.slice.call(arguments);
+ // TODO: This needs to use gadgets.io.getProxyUrl()
args[0] = 'http://' + document.location.host + '/gadgets/proxy?url=' +
args[0];
- gadgets.Flash.embedFlash.apply(this, args);
+ gadgets.flash.embedFlash.apply(this, args);
};
// Aliases for legacy code
-var _IG_GetFlashMajorVersion = gadgets.Flash.getMajorVersion;
-var _IG_EmbedFlash = gadgets.Flash.embedFlash;
-var _IG_EmbedCachedFlash = gadgets.Flash.embedCachedFlash;
+var _IG_GetFlashMajorVersion = gadgets.flash.getMajorVersion;
+var _IG_EmbedFlash = gadgets.flash.embedFlash;
+var _IG_EmbedCachedFlash = gadgets.flash.embedCachedFlash;
Modified: incubator/shindig/trunk/features/ifpc/ifpc.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/ifpc/ifpc.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/ifpc/ifpc.js (original)
+++ incubator/shindig/trunk/features/ifpc/ifpc.js Wed Jan 23 02:28:26 2008
@@ -113,7 +113,7 @@
/**
* Inter-frame procedure call
*/
-gadgets.IFPC_ = function() {
+gadgets.ifpc_ = function() {
var CALLBACK_ID_PREFIX_ = "cbid";
var CALLBACK_SERVICE_NAME_ = "ifpc_callback";
@@ -253,7 +253,7 @@
// Also see this blogged account of the bug:
//
http://the-stickman.com/web-development/javascript/iframes-xmlhttprequest-bug-in-firefox
var fn = function() {
- win.gadgets.IFPC_.handleRequest(argsString);
+ win.gadgets.ifpc_.handleRequest(argsString);
};
if (window.ActiveXObject) { // MSIE
@@ -409,7 +409,7 @@
for(var i = 0; i < args.length; i++) {
var arg = decodeURIComponent(args[i]);
try {
- arg = gadgets.JSON.parse(arg);
+ arg = gadgets.json.parse(arg);
} catch (e) {
// unexpected, but ok - treat as a string
}
@@ -458,7 +458,7 @@
function encodeArgs_(args) {
var argsEscaped = [];
for(var i = 0; i < args.length; i++) {
- var arg = gadgets.JSON.stringify(args[i]);
+ var arg = gadgets.json.stringify(args[i]);
argsEscaped.push(encodeURIComponent(arg));
}
return argsEscaped.join('&');
@@ -481,5 +481,5 @@
}();
// Alias for legacy code
-var _IFPC = gadgets.IFPC_;
+var _IFPC = gadgets.ifpc_;
Modified: incubator/shindig/trunk/features/setprefs/setprefs.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/setprefs/setprefs.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/setprefs/setprefs.js (original)
+++ incubator/shindig/trunk/features/setprefs/setprefs.js Wed Jan 23 02:28:26
2008
@@ -36,9 +36,9 @@
for (var i = 0, j = arguments.length; i < j; i += 2) {
obj[arguments[i]] = arguments[i + 1];
}
- gadgets.PrefStore_.setPref(this.moduleId_, obj);
+ gadgets.prefs_.setPref(this.moduleId_, obj);
} else {
- gadgets.PrefStore_.setPref(this.moduleId_, key, value);
+ gadgets.prefs_.setPref(this.moduleId_, key, value);
}
var modId = 'remote_module_' + this.getModuleId();
@@ -47,7 +47,7 @@
var ifpcArgs = Array.prototype.slice.call(arguments);
ifpcArgs.unshift(''); // security token placeholder
ifpcArgs.unshift(modId);
- gadgets.IFPC_.call(modId, 'set_pref', ifpcArgs, ifpcRelay, null, '');
+ gadgets.ifpc_.call(modId, 'set_pref', ifpcArgs, ifpcRelay, null, '');
};
/**
Modified: incubator/shindig/trunk/features/settitle/settitle.js
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/features/settitle/settitle.js?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
--- incubator/shindig/trunk/features/settitle/settitle.js (original)
+++ incubator/shindig/trunk/features/settitle/settitle.js Wed Jan 23 02:28:26
2008
@@ -17,23 +17,23 @@
*/
/**
- * @fileoverview This library augments gadgets.Window with functionality
+ * @fileoverview This library augments gadets.window with functionality
* to set the title of a gadget dynamically.
*/
var gadgets = gadgets || {};
-gadgets.Window = gadgets.Window || {};
+gadets.window = gadets.window || {};
/**
* Sets the gadget title.
* @param {String} title Preferred title.
*/
-gadgets.Window.setTitle = function(title) {
+gadets.window.setTitle = function(title) {
var modId = 'remote_module_' + (new gadgets.Prefs()).getModuleId();
var ifpcRelay = gadgets.util.getUrlParameters().parent || '';
gadgets.IFPC_.call(modId, 'set_title', [modId, title], ifpcRelay, null, '');
};
// Alias for legacy code
-var _IG_SetTitle = gadgets.Window.setTitle;
+var _IG_SetTitle = gadets.window.setTitle;
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/MessageBundleSubstituter.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/MessageBundleSubstituter.java?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
---
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/MessageBundleSubstituter.java
(original)
+++
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/MessageBundleSubstituter.java
Wed Jan 23 02:28:26 2008
@@ -125,9 +125,9 @@
int moduleId = gadget.getId().getModuleId();
Locale locale = context.getLocale();
StringBuilder js = new StringBuilder();
- String setMsgFmt = "gadgets.PrefStore_.setMsg(%d, %s);";
- String setLangFmt = "gadgets.PrefStore_.setLanguage(%d, \"%s\");";
- String setCountryFmt = "gadgets.PrefStore_.setCountry(%d, \"%s\");";
+ String setMsgFmt = "gadgets.prefs_.setMsg(%d, %s);";
+ String setLangFmt = "gadgets.prefs_.setLanguage(%d, \"%s\");";
+ String setCountryFmt = "gadgets.prefs_.setCountry(%d, \"%s\");";
js.append(String.format(setMsgFmt, moduleId, json.toString()));
js.append(String.format(setLangFmt, moduleId, locale.getLanguage()));
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/ModuleSubstituter.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/ModuleSubstituter.java?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
---
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/ModuleSubstituter.java
(original)
+++
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/ModuleSubstituter.java
Wed Jan 23 02:28:26 2008
@@ -49,7 +49,7 @@
Integer.toString(gadget.getId().getModuleId()));
if (context.getRenderingContext() == RenderingContext.GADGET) {
- String format = "gadgets.PrefStore_.setDefaultModuleId(%d);";
+ String format = "gadgets.prefs_.setDefaultModuleId(%d);";
String fmtStr = String.format(format, gadget.getId().getModuleId());
gadget.addJsLibrary(JsLibrary.create(JsLibrary.Type.INLINE, fmtStr));
}
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/UserPrefSubstituter.java
URL:
http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/UserPrefSubstituter.java?rev=614483&r1=614482&r2=614483&view=diff
==============================================================================
---
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/UserPrefSubstituter.java
(original)
+++
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/UserPrefSubstituter.java
Wed Jan 23 02:28:26 2008
@@ -77,7 +77,7 @@
}
if (json != null) {
- String setPrefFmt = "gadgets.PrefStore_.setPref(%d, %s);";
+ String setPrefFmt = "gadgets.prefs_.setPref(%d, %s);";
int moduleId = gadget.getId().getModuleId();
String setPrefStr = String.format(setPrefFmt, moduleId, json.toString());
gadget.addJsLibrary(JsLibrary.create(JsLibrary.Type.INLINE, setPrefStr));