You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/10/07 17:54:40 UTC
svn commit: r1005506 [42/45] - in /shindig/branches/2.0.x: ./
content/editor/ content/editor/CodeMirror-0.8/
content/editor/CodeMirror-0.8/css/ content/editor/CodeMirror-0.8/js/
content/samplecontainer/examples/media/ etc/ etc/checkstyle/ extras/src/ma...
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/shindig-container.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/shindig-container.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/shindig-container.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/shindig-container.js Thu Oct 7 15:54:09 2010
@@ -17,7 +17,7 @@
*/
/**
- * @fileoverview Open Gadget Container
+ * @fileoverview Open Gadget Container.
*/
shindig.errors = {};
@@ -33,11 +33,11 @@ shindig.errors.TO_BE_DONE = 'to be done'
* function(continuation) {
* // compute result asynchronously
* continuation(result);
- * }
+ * }.
* @param {Function} continuation Function to call when all results are in. It
- * is pass an array of all results of all functions
+ * is pass an array of all results of all functions.
* @param {Object} opt_this Optional object used as "this" when calling each
- * function
+ * function.
*/
shindig.callAsyncAndJoin = function(functions, continuation, opt_this) {
var pending = functions.length;
@@ -71,7 +71,7 @@ shindig.Extensible = function() {
/**
* Sets the dependencies.
* @param {Object} dependencies Object whose properties are set on this
- * container as dependencies
+ * container as dependencies.
*/
shindig.Extensible.prototype.setDependencies = function(dependencies) {
for (var p in dependencies) {
@@ -81,8 +81,8 @@ shindig.Extensible.prototype.setDependen
/**
* Returns a dependency given its name.
- * @param {String} name Name of dependency
- * @return {Object} Dependency with that name or undefined if not found
+ * @param {String} name Name of dependency.
+ * @return {Object} Dependency with that name or undefined if not found.
*/
shindig.Extensible.prototype.getDependencies = function(name) {
return this[name];
@@ -102,8 +102,8 @@ shindig.UserPrefStore = function() {
/**
* Gets all user preferences of a gadget.
- * @param {Object} gadget Gadget object
- * @return {Object} All user preference of given gadget
+ * @param {Object} gadget Gadget object.
+ * @return {Object} All user preference of given gadget.
*/
shindig.UserPrefStore.prototype.getPrefs = function(gadget) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -111,8 +111,8 @@ shindig.UserPrefStore.prototype.getPrefs
/**
* Saves user preferences of a gadget in the store.
- * @param {Object} gadget Gadget object
- * @param {Object} prefs User preferences
+ * @param {Object} gadget Gadget object.
+ * @param {Object} prefs User preferences.
*/
shindig.UserPrefStore.prototype.savePrefs = function(gadget) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -200,9 +200,9 @@ shindig.IfrGadgetService.prototype.setTi
/**
* Sets one or more user preferences
* @param {String} editToken
- * @param {String} name Name of user preference
+ * @param {String} name Name of user preference.
* @param {String} value Value of user preference
- * More names and values may follow
+ * More names and values may follow.
*/
shindig.IfrGadgetService.prototype.setUserPref = function(editToken, name,
value) {
@@ -218,23 +218,23 @@ shindig.IfrGadgetService.prototype.setUs
* Requests the container to send a specific message to the specified users.
* @param {Array.<String>, String} recipients An ID, array of IDs, or a group reference;
* the supported keys are VIEWER, OWNER, VIEWER_FRIENDS, OWNER_FRIENDS, or a
- * single ID within one of those groups
- * @param {opensocial.Message} message The message to send to the specified users
+ * single ID within one of those groups.
+ * @param {opensocial.Message} message The message to send to the specified users.
* @param {Function} opt_callback The function to call once the request has been
* processed; either this callback will be called or the gadget will be reloaded
- * from scratch
+ * from scratch.
* @param {opensocial.NavigationParameters} opt_params The optional parameters
* indicating where to send a user when a request is made, or when a request
- * is accepted; options are of type NavigationParameters.DestinationType
+ * is accepted; options are of type NavigationParameters.DestinationType.
*/
shindig.IfrGadgetService.prototype.requestSendMessage = function(recipients,
message, opt_callback, opt_params) {
- if (opt_callback) {
- window.setTimeout(function() {
- opt_callback(new opensocial.ResponseItem(
- null, null, opensocial.ResponseItem.Error.NOT_IMPLEMENTED, null));
- }, 0);
- }
+ if (opt_callback) {
+ window.setTimeout(function() {
+ opt_callback(new opensocial.ResponseItem(
+ null, null, opensocial.ResponseItem.Error.NOT_IMPLEMENTED, null));
+ }, 0);
+ }
};
/**
@@ -263,10 +263,9 @@ shindig.IfrGadgetService.prototype.reque
* real containers.
* TODO: Find a better default for this function
*
- * @param view The view name to get the url for
+ * @param {string} view The view name to get the url for.
*/
-shindig.IfrGadgetService.prototype.getUrlForView = function(
- view) {
+shindig.IfrGadgetService.prototype.getUrlForView = function(view) {
if (view === 'canvas') {
return '/canvas';
} else if (view === 'profile') {
@@ -296,8 +295,8 @@ shindig.LayoutManager = function() {
/**
* Gets the HTML element that is the chrome of a gadget into which the content
* of the gadget can be rendered.
- * @param {Object} gadget Gadget instance
- * @return {Object} HTML element that is the chrome for the given gadget
+ * @param {Object} gadget Gadget instance.
+ * @return {Object} HTML element that is the chrome for the given gadget.
*/
shindig.LayoutManager.prototype.getGadgetChrome = function(gadget) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -318,7 +317,7 @@ shindig.StaticLayoutManager.inherits(shi
/**
* Sets chrome ids, whose indexes are gadget instance ids (starting from 0).
- * @param {Array} gadgetChromeIds Gadget id to chrome id map
+ * @param {Array} gadgetChromeIds Gadget id to chrome id map.
*/
shindig.StaticLayoutManager.prototype.setGadgetChromeIds =
function(gadgetChromeIds) {
@@ -386,13 +385,13 @@ shindig.FloatLeftLayoutManager.prototype
* "height": height of the gadget
* "width": width of the gadget
* "debug": send debug=1 to the gadget server, gets us uncompressed
- * javascript
+ * javascript.
*/
shindig.Gadget = function(params) {
this.userPrefs = {};
if (params) {
- for (var name in params) if (params.hasOwnProperty(name)) {
+ for (var name in params) if (params.hasOwnProperty(name)) {
this[name] = params[name];
}
}
@@ -429,16 +428,16 @@ shindig.Gadget.prototype.render = functi
shindig.Gadget.prototype.getContent = function(continuation) {
shindig.callAsyncAndJoin([
- 'getTitleBarContent', 'getUserPrefsDialogContent',
- 'getMainContent'], function(results) {
- continuation(results.join(''));
- }, this);
+ 'getTitleBarContent', 'getUserPrefsDialogContent',
+ 'getMainContent'], function(results) {
+ continuation(results.join(''));
+ }, this);
};
/**
* Gets title bar content asynchronously or synchronously.
* @param {Function} continuation Function that handles title bar content as
- * the one and only argument
+ * the one and only argument.
*/
shindig.Gadget.prototype.getTitleBarContent = function(continuation) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -447,7 +446,7 @@ shindig.Gadget.prototype.getTitleBarCont
/**
* Gets user preferences dialog content asynchronously or synchronously.
* @param {Function} continuation Function that handles user preferences
- * content as the one and only argument
+ * content as the one and only argument.
*/
shindig.Gadget.prototype.getUserPrefsDialogContent = function(continuation) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -456,7 +455,7 @@ shindig.Gadget.prototype.getUserPrefsDia
/**
* Gets gadget content asynchronously or synchronously.
* @param {Function} continuation Function that handles gadget content as
- * the one and only argument
+ * the one and only argument.
*/
shindig.Gadget.prototype.getMainContent = function(continuation) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -536,7 +535,7 @@ shindig.BaseIfrGadget.prototype.getServe
shindig.BaseIfrGadget.prototype.getMainContent = function(continuation) {
// proper sub-class has not been mixed-in yet
var gadget = this;
- window.setTimeout( function() {
+ window.setTimeout(function() {
gadget.getMainContent(continuation);
}, 0);
};
@@ -551,7 +550,7 @@ shindig.BaseIfrGadget.prototype.getUserP
shindig.BaseIfrGadget.prototype.getUserPrefsParams = function() {
var params = '';
- for(var name in this.getUserPrefs()) {
+ for (var name in this.getUserPrefs()) {
params += '&up_' + encodeURIComponent(name) + '=' +
encodeURIComponent(this.getUserPrefValue(name));
}
@@ -569,7 +568,7 @@ shindig.BaseIfrGadget.prototype.handleTo
shindig.BaseIfrGadget.prototype.hasViewablePrefs_ = function() {
- for(var name in this.getUserPrefs()) {
+ for (var name in this.getUserPrefs()) {
var pref = this.userPrefs[name];
if (pref.type != 'hidden') {
return true;
@@ -593,7 +592,7 @@ shindig.BaseIfrGadget.prototype.handleOp
var script = document.createElement('script');
script.src = 'http://www.gmodules.com/ig/gadgetsettings?mid=' + this.id +
- '&output=js' + this.getUserPrefsParams() + '&url=' + this.specUrl;
+ '&output=js' + this.getUserPrefsParams() + '&url=' + this.specUrl;
document.body.appendChild(script);
}
};
@@ -603,8 +602,8 @@ shindig.BaseIfrGadget.prototype.buildUse
userPrefsDialog.innerHTML = content +
'<div class="' + this.cssClassGadgetUserPrefsDialogActionBar +
'"><input type="button" value="Save" onclick="shindig.container.getGadget(' +
- this.id +').handleSaveUserPrefs()"> <input type="button" value="Cancel" onclick="shindig.container.getGadget(' +
- this.id +').handleCancelUserPrefs()"></div>';
+ this.id + ').handleSaveUserPrefs()"> <input type="button" value="Cancel" onclick="shindig.container.getGadget(' +
+ this.id + ').handleCancelUserPrefs()"></div>';
userPrefsDialog.childNodes[0].style.display = '';
};
@@ -650,10 +649,10 @@ shindig.BaseIfrGadget.prototype.queryIfr
// the iframe. Otherwise, we create the iframe ourselves.
var request = {
context: {
- country: "default",
- language: "default",
- view: "default",
- container: "default"
+ country: 'default',
+ language: 'default',
+ view: 'default',
+ container: 'default'
},
gadgets: [{
url: this.specUrl,
@@ -662,25 +661,25 @@ shindig.BaseIfrGadget.prototype.queryIfr
};
var makeRequestParams = {
- "CONTENT_TYPE" : "JSON",
- "METHOD" : "POST",
- "POST_DATA" : gadgets.json.stringify(request)
+ 'CONTENT_TYPE' : 'JSON',
+ 'METHOD' : 'POST',
+ 'POST_DATA' : gadgets.json.stringify(request)
};
- var url = this.serverBase_+"metadata?st=" + this.secureToken;
+ var url = this.serverBase_ + 'metadata?st=' + this.secureToken;
gadgets.io.makeNonProxiedRequest(url,
- handleJSONResponse,
- makeRequestParams,
- "application/javascript"
+ handleJSONResponse,
+ makeRequestParams,
+ 'application/javascript'
);
-
+
var gadget = this;
function handleJSONResponse(obj) {
var requiresPubSub2 = false;
var arr = obj.data.gadgets[0].features;
- for(var i = 0; i < arr.length; i++) {
- if (arr[i] === "pubsub-2") {
+ for (var i = 0; i < arr.length; i++) {
+ if (arr[i] === 'pubsub-2') {
requiresPubSub2 = true;
break;
}
@@ -708,15 +707,15 @@ shindig.IfrGadget = {
(this.width ? ' width="' + this.width + '"' : '') +
'></iframe></div>');
},
-
+
finishRender: function(chrome) {
window.frames[this.getIframeId()].location = this.getIframeUrl();
},
-
+
getIframeUrl: function() {
return this.serverBase_ + 'ifr?' +
'container=' + this.CONTAINER +
- '&mid=' + this.id +
+ '&mid=' + this.id +
'&nocache=' + shindig.container.nocache_ +
'&country=' + shindig.container.country_ +
'&lang=' + shindig.container.language_ +
@@ -730,7 +729,7 @@ shindig.IfrGadget = {
'&url=' + encodeURIComponent(this.specUrl) +
'#rpctoken=' + this.rpcToken +
(this.viewParams ?
- '&view-params=' + encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
+ '&view-params=' + encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
(this.hashData ? '&' + this.hashData : '');
}
};
@@ -744,12 +743,12 @@ shindig.OAAIfrGadget = {
continuation('<div id="' + this.cssClassGadgetContent + '-' + this.id +
'" class="' + this.cssClassGadgetContent + '"></div>');
},
-
+
finishRender: function(chrome) {
var iframeAttrs = {
className: this.cssClassGadget,
- frameborder: "no",
- scrolling: "no"
+ frameborder: 'no',
+ scrolling: 'no'
};
if (this.height) {
iframeAttrs.height = this.height;
@@ -757,50 +756,50 @@ shindig.OAAIfrGadget = {
if (this.width) {
iframeAttrs.width = this.width;
}
-
+
new OpenAjax.hub.IframeContainer(
- gadgets.pubsub2router.hub,
- this.getIframeId(),
- {
- Container: {
- onSecurityAlert: function( source, alertType) {
- gadgets.error("Security error for container " + source.getClientID() + " : " + alertType);
- source.getIframe().src = "about:blank";
-// for debugging
- // },
- // onConnect: function( container ) {
- // gadgets.log("++ connected: " + container.getClientID());
+ gadgets.pubsub2router.hub,
+ this.getIframeId(),
+ {
+ Container: {
+ onSecurityAlert: function(source, alertType) {
+ gadgets.error('Security error for container ' + source.getClientID() + ' : ' + alertType);
+ source.getIframe().src = 'about:blank';
+ // for debugging
+ // },
+ // onConnect: function( container ) {
+ // gadgets.log("++ connected: " + container.getClientID());
}
- },
- IframeContainer: {
- parent: document.getElementById(this.cssClassGadgetContent + '-' + this.id),
- uri: this.getIframeUrl(),
- tunnelURI: shindig.uri(this.serverBase_ + this.rpcRelay).resolve(shindig.uri(window.location.href)),
- iframeAttrs: iframeAttrs
+ },
+ IframeContainer: {
+ parent: document.getElementById(this.cssClassGadgetContent + '-' + this.id),
+ uri: this.getIframeUrl(),
+ tunnelURI: shindig.uri(this.serverBase_ + this.rpcRelay).resolve(shindig.uri(window.location.href)),
+ iframeAttrs: iframeAttrs
+ }
}
- }
);
},
-
+
getIframeUrl: function() {
return this.serverBase_ + 'ifr?' +
'container=' + this.CONTAINER +
- '&mid=' + this.id +
+ '&mid=' + this.id +
'&nocache=' + shindig.container.nocache_ +
'&country=' + shindig.container.country_ +
'&lang=' + shindig.container.language_ +
'&view=' + shindig.container.view_ +
(this.specVersion ? '&v=' + this.specVersion : '') +
- // (shindig.container.parentUrl_ ? '&parent=' + encodeURIComponent(shindig.container.parentUrl_) : '') +
+ // (shindig.container.parentUrl_ ? '&parent=' + encodeURIComponent(shindig.container.parentUrl_) : '') +
(this.debug ? '&debug=1' : '') +
this.getAdditionalParams() +
this.getUserPrefsParams() +
(this.secureToken ? '&st=' + this.secureToken : '') +
'&url=' + encodeURIComponent(this.specUrl) +
- // '#rpctoken=' + this.rpcToken +
+ // '#rpctoken=' + this.rpcToken +
(this.viewParams ?
- '&view-params=' + encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
- // (this.hashData ? '&' + this.hashData : '');
+ '&view-params=' + encodeURIComponent(gadgets.json.stringify(this.viewParams)) : '') +
+ // (this.hashData ? '&' + this.hashData : '');
(this.hashData ? '#' + this.hashData : '');
}
};
@@ -902,7 +901,7 @@ shindig.Container.prototype.renderGadget
/**
* Renders a gadget. Gadgets are rendered inside their chrome element.
- * @param {Object} gadget Gadget object
+ * @param {Object} gadget Gadget object.
*/
shindig.Container.prototype.renderGadget = function(gadget) {
throw Error(shindig.errors.SUBCLASS_RESPONSIBILITY);
@@ -951,7 +950,7 @@ shindig.IfrContainer.prototype.setParent
/**
* Renders a gadget using ifr.
- * @param {Object} gadget Gadget object
+ * @param {Object} gadget Gadget object.
*/
shindig.IfrContainer.prototype.renderGadget = function(gadget) {
var chrome = this.layoutManager.getGadgetChrome(gadget);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/util.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/util.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/util.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.container/util.js Thu Oct 7 15:54:09 2010
@@ -17,7 +17,7 @@
*/
/**
- * @fileoverview Utility functions for the Open Gadget Container
+ * @fileoverview Utility functions for the Open Gadget Container.
*/
Function.prototype.inherits = function(parentCtor) {
@@ -26,4 +26,4 @@ Function.prototype.inherits = function(p
this.superClass_ = parentCtor.prototype;
this.prototype = new tempCtor();
this.prototype.constructor = this;
-};
\ No newline at end of file
+};
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/feature.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/feature.xml?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/feature.xml (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/feature.xml Thu Oct 7 15:54:09 2010
@@ -22,6 +22,10 @@ A JavaScript "more-secure-random" implem
-->
<name>shindig.random</name>
<dependency>globals</dependency>
+ <gadget>
+ <script src="sha1.js"/>
+ <script src="random.js"/>
+ </gadget>
<container>
<script src="sha1.js"/>
<script src="random.js"/>
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/random.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/random.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/random.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.random/random.js Thu Oct 7 15:54:09 2010
@@ -46,7 +46,7 @@ shindig.random = (function() {
return hash;
}
- var orig_onmousemove = window.onmousemove || function() { return false };
+ var orig_onmousemove = window.onmousemove || function() { return false; };
window.onmousemove = function(e) {
if (window.event) {
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri.ext/util.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri.ext/util.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri.ext/util.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri.ext/util.js Thu Oct 7 15:54:09 2010
@@ -40,7 +40,7 @@ shindig.uri = (function() {
/**
* Fully qualifies this Uri if it is relative, using a given base Uri.
- *
+ *
* @param {Uri} self The base Uri.
* @param {Uri} base The Uri to resolve.
*/
@@ -53,7 +53,7 @@ shindig.uri = (function() {
}
var selfPath = self.getPath();
if (selfPath == '' || selfPath.charAt(0) != '/') {
- var basePath = base.getPath();
+ var basePath = base.getPath();
var lastSlash = basePath.lastIndexOf('/');
if (lastSlash != -1) {
basePath = basePath.substring(0, lastSlash + 1);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri/uri.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri/uri.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri/uri.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.uri/uri.js Thu Oct 7 15:54:09 2010
@@ -30,7 +30,7 @@
* Further, only set operations are provided for query/fragment params,
* in order to keep the API relatively small, yet sufficiently flexible. Values set to
* null are equivalent to being removed, for instance.
- *
+ *
* Limitations include, but are not limited to:
* + Multiple params with the same key not supported via set APIs.
* + Full RPC-compliant parsing not supported. A "highly useful" subset is impl'd.
@@ -46,15 +46,15 @@
* alert(other); // Emits "http://other.com/bar?hi=bye"
*/
shindig.uri = (function() {
- var PARSE_REGEX = new RegExp("^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?");
+ var PARSE_REGEX = new RegExp('^(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\\?([^#]*))?(?:#(.*))?');
return function(opt_in) {
- var schema_ = "";
- var authority_ = "";
- var path_ = "";
- var query_ = "";
+ var schema_ = '';
+ var authority_ = '';
+ var path_ = '';
+ var query_ = '';
var qparms_ = null;
- var fragment_ = "";
+ var fragment_ = '';
var fparms_ = null;
var unesc = window.decodeURIComponent ? decodeURIComponent : unescape;
var esc = window.encodeURIComponent ? encodeURIComponent : escape;
@@ -62,7 +62,7 @@ shindig.uri = (function() {
function parseFrom(url) {
if (url.match(PARSE_REGEX) === null) {
- throw "Malformed URL: " + url;
+ throw 'Malformed URL: ' + url;
}
schema_ = RegExp.$1;
authority_ = RegExp.$2;
@@ -79,7 +79,7 @@ shindig.uri = (function() {
if (val === undefined) {
continue;
}
- str.push(esc(key) + (val !== null ? '=' + esc(val) : ""));
+ str.push(esc(key) + (val !== null ? '=' + esc(val) : ''));
}
return str.join('&');
}
@@ -119,19 +119,19 @@ shindig.uri = (function() {
fparms_ = setParams(fparms_ || parseParams(fragment_), argOne, argTwo);
return bundle;
}
-
+
function getOrigin() {
return [
- schema_,
- schema_ !== "" ? ":" : "",
- authority_ !== "" ? "//" : "",
- authority_
- ].join("");
+ schema_,
+ schema_ !== '' ? ':' : '',
+ authority_ !== '' ? '//' : '',
+ authority_
+ ].join('');
}
/**
* Returns a readable representation of the URL.
- *
+ *
* @return {string} A readable URL.
*/
function toString() {
@@ -140,24 +140,24 @@ shindig.uri = (function() {
return [
getOrigin(),
path_,
- query !== "" ? "?" : "",
+ query !== '' ? '?' : '',
query,
- fragment !== "" ? "#" : "",
+ fragment !== '' ? '#' : '',
fragment
- ].join("");
+ ].join('');
}
function parseParams(str) {
var params = [];
- var pairs = str.split("&");
+ var pairs = str.split('&');
for (var i = 0, j = pairs.length; i < j; ++i) {
var kv = pairs[i].split('=');
var key = kv.shift();
var value = null;
if (kv.length > 0) {
- value = kv.join('').replace(/\+/g, " ");
+ value = kv.join('').replace(/\+/g, ' ');
}
- params.push([ key, value != null ? unesc(value) : null ]);
+ params.push([key, value != null ? unesc(value) : null]);
}
return params;
}
@@ -190,14 +190,14 @@ shindig.uri = (function() {
}
}
if (!found) {
- pset.push([ key, newParams[key] ]);
+ pset.push([key, newParams[key]]);
}
}
return pset;
}
function stripPrefix(str, pfx) {
- str = str || "";
+ str = str || '';
if (str[0] === pfx) {
str = str.substr(pfx.length);
}
@@ -205,8 +205,8 @@ shindig.uri = (function() {
}
// CONSTRUCTOR
- if (typeof opt_in === "object" &&
- typeof opt_in.toString === "function") {
+ if (typeof opt_in === 'object' &&
+ typeof opt_in.toString === 'function') {
// Assume it's another shindig.uri, or something that can be parsed from one.
parseFrom(opt_in.toString());
} else if (opt_in) {
@@ -227,7 +227,7 @@ shindig.uri = (function() {
// Setters
setSchema: function(schema) { schema_ = schema; return bundle; },
setAuthority: function(authority) { authority_ = authority; return bundle; },
- setPath: function(path) { path_ = (path[0] === "/" ? "" : "/") + path; return bundle; },
+ setPath: function(path) { path_ = (path[0] === '/' ? '' : '/') + path; return bundle; },
setQuery: function(query) { qparms_ = null; query_ = stripPrefix(query, '?'); return bundle; },
setFragment: function(fragment) { fparms_ = null; fragment_ = stripPrefix(fragment, '#'); return bundle; },
setQP: setQP,
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/shindig.xhrwrapper/xhrwrapper.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/shindig.xhrwrapper/xhrwrapper.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/shindig.xhrwrapper/xhrwrapper.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/shindig.xhrwrapper/xhrwrapper.js Thu Oct 7 15:54:09 2010
@@ -19,7 +19,7 @@
/**
* @fileoverview Emulate XMLHttpRequest using gadgets.io.makeRequest.
- *
+ *
* This is not a complete implementation of XMLHttpRequest:
* - synchronous send() is unsupported;
* - the callback function will not get full header information, as makeRequest
@@ -28,7 +28,7 @@
shindig.xhrwrapper = shindig.xhrwrapper || {};
-(function () {
+(function() {
// Save the browser's XMLHttpRequest and ActiveXObject constructors.
var RealXMLHttpRequest = window.XMLHttpRequest;
@@ -36,11 +36,11 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Creates a real XMLHttpRequest object.
- *
+ *
* This function is to be used by code that needs access to the browser's
* XMLHttpRequest functionality, such as the code that implements
* gadgets.io.makeRequest itself.
- *
+ *
* @return {Object|undefined} A XMLHttpRequest object, if one could
* be created.
*/
@@ -64,7 +64,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* @class XhrWrapper class.
- *
+ *
* @constructor
* @description Implements the XMLHttpRequest interface, using
* gadgets.io.makeRequest to make the actual network accesses.
@@ -88,7 +88,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Returns all response headers as a string.
- *
+ *
* @return {?string} The text of all response headers, or null if no response
* has been received.
*/
@@ -106,7 +106,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Returns the value of a particular response header.
- *
+ *
* @param {string} The name of the header to return.
* @return {?string} The value of the header, or null if no response has
* been received or the header doesn't exist in the response.
@@ -122,7 +122,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Initializes a request.
- *
+ *
* @param {string} method The HTTP method to use ('POST' or 'GET').
* @param {string} url The URL to which to send the request.
* @param {boolean=} opt_async Whether to perform the operation
@@ -161,7 +161,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Sends the request.
- *
+ *
* @param {string=} opt_data The data used to populate the body of a POST
* request.
*/
@@ -200,7 +200,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Sets the value of an HTTP request header.
- *
+ *
* @param {string} header The name of the header to set.
* @param {string} value The value for the header.
*/
@@ -211,7 +211,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Processes the results from makeRequest and calls onreadystatechange.
- *
+ *
* @param {Object} response The response from makeRequest.
* @private
*/
@@ -246,14 +246,14 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Points the request URL to the correct server.
- *
+ *
* If the URL is pointing to the gadget server, this function assumes the
* gadget's author wanted to point to the gadget contents location and
* changes it so that it points to the right place.
- *
+ *
* For example, if the gadget is rendered in https://shindig/gadgets/ifr
* and the gadget's contents are at http://foo.com/bar/baz.html:
- *
+ *
* - foo.xml gets turned into http://foo.com/bar/foo.xml
* - /foo/bar.xml gets turned into http://foo.com/foo/bar.xml
* - //foo.com/bar.xml gets turned into http://foo.com/bar.xml
@@ -277,18 +277,18 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* @class A class for processing URLs.
- *
+ *
* @constructor
* @description Pries apart the components of a URL, so it can be sliced
* and diced and combined with other URLs as needed.
*/
function Url(url) {
- this.schema = "";
- this.authority = "";
- this.path = "";
- this.filename = "";
- this.query = "";
- this.fragment = "";
+ this.schema = '';
+ this.authority = '';
+ this.path = '';
+ this.filename = '';
+ this.query = '';
+ this.fragment = '';
var parse = url;
var sharp = parse.indexOf('#');
@@ -337,7 +337,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Fully qualifies this URL if it is relative, using a given base URL.
- *
+ *
* @param {Url} base The base URL.
*/
Url.prototype.fullyQualify = function(base) {
@@ -354,11 +354,11 @@ shindig.xhrwrapper = shindig.xhrwrapper
/**
* Returns a readable representation of the URL.
- *
+ *
* @return {string} A readable URL.
*/
Url.prototype.toString = function() {
- var url = "";
+ var url = '';
if (this.schema) {
url += this.schema;
}
@@ -407,12 +407,12 @@ shindig.xhrwrapper = shindig.xhrwrapper
*
* This is bad because when this code tries to call gadgets.io.makeRequest,
* it will call the wrong function, or it might even be undefined.
- *
+ *
* Therefore, we save the original namespaces before the gadget has a chance
* to overwrite them, then switch between them as necessary.
- *
+ *
* This works like this:
- *
+ *
* switchOriginalNS_();
* try {
* functionThatNeedsTheOriginalNamespaces();
@@ -425,11 +425,11 @@ shindig.xhrwrapper = shindig.xhrwrapper
*/
var originalNS = {};
var gadgetNS = {};
- var namespaces = ['gadgets', 'opensocial', 'shindig'];
+ var namespaces = ['gadgets', 'opensocial', 'shindig'];
/**
* Copies the Shindig namespaces between two objects.
- *
+ *
* @param {Object} from Object to copy from, or null for the global object.
* @param {Object} to Object to copy to, or null for the global object.
* @private
@@ -465,7 +465,7 @@ shindig.xhrwrapper = shindig.xhrwrapper
// Save the original namespaces.
copyNS_(null, originalNS);
-
+
// Replace the browser's XMLHttpRequest and ActiveXObject constructors with
// xhrwrapper's.
if (window.XMLHttpRequest) {
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/skins/skins.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/skins/skins.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/skins/skins.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/skins/skins.js Thu Oct 7 15:54:09 2010
@@ -30,21 +30,21 @@ gadgets.skins = function() {
var skinProperties = {};
var requiredConfig = {
- "properties": gadgets.config.ExistsValidator
+ 'properties': gadgets.config.ExistsValidator
};
- gadgets.config.register("skins", requiredConfig, function(config) {
- skinProperties = config["skins"].properties;
- });
+ gadgets.config.register('skins', requiredConfig, function(config) {
+ skinProperties = config['skins'].properties;
+ });
return {
/**
* Override the default properties with a new set of properties.
*
- * @param {Object} properties The mapping of property names to values
+ * @param {Object} properties The mapping of property names to values.
*/
- init : function(properties) {
+ init: function(properties) {
skinProperties = properties;
},
@@ -53,13 +53,13 @@ gadgets.skins = function() {
*
* @param {string} propertyKey The key to get data for;
* keys are defined in <a href="gadgets.skins.Property.html"><code>
- * gadgets.skins.Property</code></a>
- * @return {string} The data
+ * gadgets.skins.Property.</code></a>
+ * @return {string} The data.
*
* @member gadgets.skins
*/
- getProperty : function(propertyKey) {
- return skinProperties[propertyKey] || "";
+ getProperty: function(propertyKey) {
+ return skinProperties[propertyKey] || '';
}
};
}();
@@ -72,7 +72,7 @@ gadgets.skins = function() {
* method.
* @name gadgets.skins.Property
*/
-gadgets.skins.Property = gadgets.util.makeEnum([
+gadgets.skins.Property = gadgets.util.makeEnum([
/**
* An image to use in the background of the gadget.
* @member gadgets.skins.Property
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/tabs/tabs.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/tabs/tabs.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/tabs/tabs.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/tabs/tabs.js Thu Oct 7 15:54:09 2010
@@ -119,18 +119,18 @@ gadgets.TabSet = function(opt_moduleId,
this.tabsContainer_ = null;
this.rtl_ = document.body.dir === 'rtl';
this.prefs_ = new gadgets.Prefs();
- this.selectedTabIndex_ = this.prefs_.getString("selectedTab");
+ this.selectedTabIndex_ = this.prefs_.getString('selectedTab');
this.mainContainer_ = this.createMainContainer_(opt_container);
this.tabTable_ = this.createTabTable_();
this.displayTabs(false);
// gadgets.TabSet.addCSS_([ ].join(''));
};
-gadgets.config.register("tabset", {}, function (configuration) {
- // Injects the default stylesheet for tabs
- gadgets.TabSet.addCSS_( configuration.tabs.css.join(''));
-});
-
+gadgets.config.register('tabset', {}, function(configuration) {
+ // Injects the default stylesheet for tabs
+ gadgets.TabSet.addCSS_(configuration.tabs.css.join(''));
+});
+
/**
* Adds a new tab based on the name-value pairs specified in opt_params.
@@ -151,7 +151,7 @@ gadgets.config.register("tabset", {}, fu
gadgets.TabSet.prototype.addTab = function(tabName, opt_params) {
if (typeof opt_params === 'string') {
opt_params = {contentContainer: document.getElementById(arguments[1]),
- callback: arguments[2]};
+ callback: arguments[2]};
}
var params = opt_params || {};
@@ -161,9 +161,9 @@ gadgets.TabSet.prototype.addTab = functi
tabIndex = params.index;
}
var tab = this.createTab_(tabName, {
- contentContainer: params.contentContainer,
- callback: params.callback,
- tooltip: params.tooltip
+ contentContainer: params.contentContainer,
+ callback: params.callback,
+ tooltip: params.tooltip
});
var tr = this.tabTable_.rows[0];
@@ -216,8 +216,8 @@ gadgets.TabSet.prototype.removeTab = fun
var maxIndex = this.tabs_.length - 1;
if (maxIndex > 0) {
this.selectTab_(tabIndex < maxIndex ?
- this.tabs_[tabIndex + 1] :
- this.tabs_[tabIndex - 1]);
+ this.tabs_[tabIndex + 1] :
+ this.tabs_[tabIndex - 1]);
}
}
var tr = this.tabTable_.rows[0];
@@ -338,15 +338,15 @@ gadgets.TabSet.prototype.createMainConta
document.body.insertBefore(container, document.body.firstChild);
}
- container.className = this.cascade_("tablib_main_container") + ' ' +
- container.className;
+ container.className = this.cascade_('tablib_main_container') + ' ' +
+ container.className;
return container;
};
/**
* Helper method that expands a class name into two class names.
- * @param {string} label CSS class
+ * @param {string} label CSS class.
* @return {string} Expanded class names.
* @private
*/
@@ -448,7 +448,7 @@ gadgets.TabSet.prototype.createTabTable_
var adjustNavigationFn = function() {
me.adjustNavigation_();
};
- gadgets.util.attachBrowserEvent(window, "resize", adjustNavigationFn, false);
+ gadgets.util.attachBrowserEvent(window, 'resize', adjustNavigationFn, false);
}
this.navTable_ = navTable;
@@ -467,7 +467,7 @@ gadgets.TabSet.prototype.adjustNavigatio
this.leftNavContainer_.style.display = 'none';
this.rightNavContainer_.style.display = 'none';
if (this.tabsContainer_.scrollWidth <= this.tabsContainer_.offsetWidth) {
- if(this.tabsContainer_.scrollLeft) {
+ if (this.tabsContainer_.scrollLeft) {
// to avoid JS error in IE
this.tabsContainer_.scrollLeft = 0;
}
@@ -510,7 +510,7 @@ gadgets.TabSet.prototype.smoothScroll_ =
/**
* Helper function that dynamically inserts CSS rules to the page.
- * @param {string} cssText CSS rules to inject
+ * @param {string} cssText CSS rules to inject.
* @private
*/
gadgets.TabSet.addCSS_ = function(cssText) {
@@ -614,7 +614,7 @@ gadgets.TabSet.prototype.saveSelectedTab
var currentTabIndex = this.selectedTab_.getIndex();
if (currentTabIndex >= 0) {
this.selectedTabIndex_ = currentTabIndex;
- this.prefs_.set("selectedTab", currentTabIndex);
+ this.prefs_.set('selectedTab', currentTabIndex);
}
} catch (e) {
// ignore. setprefs is optional for tablib.
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/tabs/taming.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/tabs/taming.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/tabs/taming.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/tabs/taming.js Thu Oct 7 15:54:09 2010
@@ -30,7 +30,7 @@ tamings___.push(function(imports) {
[gadgets.Tab, 'getIndex'],
[gadgets.Tab, 'getName'],
[gadgets.Tab, 'getNameContainer'],
-
+
[gadgets.TabSet, 'addTab'],
[gadgets.TabSet, 'alignTabs'],
[gadgets.TabSet, 'displayTabs'],
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/views/taming.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/views/taming.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/views/taming.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/views/taming.js Thu Oct 7 15:54:09 2010
@@ -24,7 +24,7 @@
var tamings___ = tamings___ || [];
tamings___.push(function(imports) {
caja___.whitelistCtors([
- [gadgets.views, 'View', Object]
+ [gadgets.views, 'View', Object]
]);
caja___.whitelistMeths([
[gadgets.views.View, 'bind'],
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/views/views.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/views/views.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/views/views.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/views/views.js Thu Oct 7 15:54:09 2010
@@ -61,10 +61,10 @@ gadgets.views = function() {
target = target.parentNode;
}
- if (target.nodeName.toLowerCase() === "a") {
+ if (target.nodeName.toLowerCase() === 'a') {
// We use getAttribute() instead of .href to avoid automatic relative path resolution.
- var href = target.getAttribute("href");
- if (href && href[0] !== "#" && href.indexOf("://") === -1) {
+ var href = target.getAttribute('href');
+ if (href && href[0] !== '#' && href.indexOf('://') === -1) {
gadgets.views.requestNavigateTo(currentView, href);
if (e.stopPropagation) {
e.stopPropagation();
@@ -93,7 +93,7 @@ gadgets.views = function() {
for (var s in conf) {
if (conf.hasOwnProperty(s)) {
// TODO: Fix this by moving view names / config into a sub property.
- if (s != "rewriteLinks") {
+ if (s != 'rewriteLinks') {
var obj = conf[s];
if (!obj) {
continue;
@@ -109,17 +109,17 @@ gadgets.views = function() {
var urlParams = gadgets.util.getUrlParameters();
// View parameters are passed as a single parameter.
- if (urlParams["view-params"]) {
- params = gadgets.json.parse(urlParams["view-params"]) || params;
+ if (urlParams['view-params']) {
+ params = gadgets.json.parse(urlParams['view-params']) || params;
}
- currentView = supportedViews[urlParams.view] || supportedViews["default"];
+ currentView = supportedViews[urlParams.view] || supportedViews['default'];
if (conf.rewriteLinks) {
- gadgets.util.attachBrowserEvent(document, "click", forceNavigate, false);
+ gadgets.util.attachBrowserEvent(document, 'click', forceNavigate, false);
}
}
- gadgets.config.register("views", null, init);
+ gadgets.config.register('views', null, init);
return {
@@ -134,7 +134,7 @@ gadgets.views = function() {
* @param {Object.<string, string>} environment A set of named variables.
* @return {string} A URL string with substituted variables.
*/
- bind : function(urlTemplate, environment) {
+ bind: function(urlTemplate, environment) {
if (typeof urlTemplate !== 'string') {
throw new Error('Invalid urlTemplate');
}
@@ -144,7 +144,7 @@ gadgets.views = function() {
}
var varRE = /^([a-zA-Z0-9][a-zA-Z0-9_\.\-]*)(=([a-zA-Z0-9\-\._~]|(%[0-9a-fA-F]{2}))*)?$/,
- expansionRE = new RegExp('\\{([^}]*)\\}','g'),
+ expansionRE = new RegExp('\\{([^}]*)\\}', 'g'),
opRE = /^-([a-zA-Z]+)\|([^|]*)\|(.+)$/,
result = [],
textStart = 0,
@@ -184,15 +184,15 @@ gadgets.views = function() {
}
function objectIsEmpty(v) {
- if ((typeof v === 'object') || (typeof v === 'function')) {
- for (var i in v) {
- if (v.hasOwnProperty(i)) {
- return false;
- }
- }
- return true;
- }
- return false;
+ if ((typeof v === 'object') || (typeof v === 'function')) {
+ for (var i in v) {
+ if (v.hasOwnProperty(i)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
}
while ((group = expansionRE.exec(urlTemplate))) {
@@ -209,52 +209,52 @@ gadgets.views = function() {
vars = match[3];
flag = 0;
switch (op) {
- case 'neg':
- flag = 1;
- case 'opt':
- if (matchVars(vars, {flag: flag}, function(j, v) {
- if (typeof v !== 'undefined' && !objectIsEmpty(v)) {
- j.flag = !j.flag;
- return 1;
+ case 'neg':
+ flag = 1;
+ case 'opt':
+ if (matchVars(vars, {flag: flag}, function(j, v) {
+ if (typeof v !== 'undefined' && !objectIsEmpty(v)) {
+ j.flag = !j.flag;
+ return 1;
+ }
+ return 0;
+ }).flag) {
+ result.push(arg);
+ }
+ break;
+ case 'join':
+ result.push(matchVars(vars, [], function(j, v, k) {
+ if (typeof v === 'string') {
+ j.push(k + '=' + v);
+ } else if (typeof v === 'object') {
+ for (var i in v) {
+ if (v.hasOwnProperty(i)) {
+ j.push(i + '=' + v[i]);
+ }
}
- return 0;
- }).flag) {
- result.push(arg);
- }
- break;
- case 'join':
- result.push(matchVars(vars, [], function(j, v, k) {
- if (typeof v === 'string') {
- j.push(k + '=' + v);
- } else if (typeof v === 'object') {
- for (var i in v) {
- if (v.hasOwnProperty(i)) {
- j.push(i + '=' + v[i]);
- }
- }
+ }
+ }).join(arg));
+ break;
+ case 'list':
+ matchVar(vars);
+ var value = getVar(match[1]);
+ if (typeof value === 'object' && typeof value.join === 'function') {
+ result.push(value.join(arg));
+ }
+ break;
+ case 'prefix':
+ flag = 1;
+ case 'suffix':
+ matchVar(vars);
+ value = getVar(match[1], match[2] && match[2].substr(1));
+ if (typeof value === 'string') {
+ result.push(flag ? arg + value : value + arg);
+ } else if (typeof value === 'object' && typeof value.join === 'function') {
+ result.push(flag ? arg + value.join(arg) : value.join(arg) + arg);
}
- }).join(arg));
- break;
- case 'list':
- matchVar(vars);
- var value = getVar(match[1]);
- if (typeof value === 'object' && typeof value.join === 'function') {
- result.push(value.join(arg));
- }
- break;
- case 'prefix':
- flag = 1;
- case 'suffix':
- matchVar(vars);
- value = getVar(match[1], match[2] && match[2].substr(1));
- if (typeof value === 'string') {
- result.push(flag ? arg + value : value + arg);
- } else if (typeof value === 'object' && typeof value.join === 'function') {
- result.push(flag ? arg + value.join(arg) : value.join(arg) + arg);
- }
- break;
- default:
- throw new Error('Invalid operator : ' + op);
+ break;
+ default:
+ throw new Error('Invalid operator : ' + op);
}
} else {
throw new Error('Invalid syntax : ' + group[0]);
@@ -272,28 +272,28 @@ gadgets.views = function() {
* supports parameters will pass the optional parameters along to the gadget
* in the new view.
*
- * @param {string | gadgets.views.View} view The view to navigate to
+ * @param {string | gadgets.views.View} view The view to navigate to.
* @param {Object.<string, string>=} opt_params Parameters to pass to the
- * gadget after it has been navigated to on the surface
+ * gadget after it has been navigated to on the surface.
* @param {string=} opt_ownerId The ID of the owner of the page to navigate to;
* defaults to the current owner.
*/
- requestNavigateTo : function(view, opt_params, opt_ownerId) {
- if (typeof view !== "string") {
+ requestNavigateTo: function(view, opt_params, opt_ownerId) {
+ if (typeof view !== 'string') {
view = view.getName();
}
// TODO If we want to implement a POPUP view we'll have to do it here,
// The parent frame's attempts to use window.open will fail since it's not
// directly initiated from the onclick handler
- gadgets.rpc.call(null, "requestNavigateTo", null, view, opt_params, opt_ownerId);
+ gadgets.rpc.call(null, 'requestNavigateTo', null, view, opt_params, opt_ownerId);
},
/**
* Returns the current view.
*
- * @return {gadgets.views.View} The current view
+ * @return {gadgets.views.View} The current view.
*/
- getCurrentView : function() {
+ getCurrentView: function() {
return currentView;
},
@@ -304,7 +304,7 @@ gadgets.views = function() {
* @return {Object.<gadgets.views.ViewType | string, gadgets.views.View>}
* All supported views, keyed by their name attribute.
*/
- getSupportedViews : function() {
+ getSupportedViews: function() {
return supportedViews;
},
@@ -313,9 +313,9 @@ gadgets.views = function() {
* include all url parameters, only the ones passed into
* gadgets.views.requestNavigateTo
*
- * @return {Object.<string, string>} The parameter map
+ * @return {Object.<string, string>} The parameter map.
*/
- getParams : function() {
+ getParams: function() {
return params;
}
};
@@ -331,7 +331,7 @@ gadgets.views = function() {
/**
* View Representation
* @constructor
- * @param {string} name - the name of the view
+ * @param {string} name - the name of the view.
* @param {boolean=} opt_isOnlyVisible - is this view devoted to this gadget.
*/
@@ -378,7 +378,7 @@ gadgets.views.View.prototype.isOnlyVisib
};
gadgets.views.ViewType = gadgets.util.makeEnum([
- "CANVAS", "HOME", "PREVIEW", "PROFILE",
+ 'CANVAS', 'HOME', 'PREVIEW', 'PROFILE',
// TODO Deprecate the following ViewTypes.
- "FULL_PAGE", "DASHBOARD", "POPUP"
+ 'FULL_PAGE', 'DASHBOARD', 'POPUP'
]);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/xmlutil/xmlutil.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/xmlutil/xmlutil.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/xmlutil/xmlutil.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/xmlutil/xmlutil.js Thu Oct 7 15:54:09 2010
@@ -23,6 +23,7 @@ opensocial.xmlutil = opensocial.xmlutil
/**
* Cached DOMParser objects on browsers that support it.
+ * @private
*/
opensocial.xmlutil.parser_ = null;
@@ -33,15 +34,15 @@ opensocial.xmlutil.parser_ = null;
* @return {Document} XML document.
*/
opensocial.xmlutil.parseXML = function(str) {
- if (typeof(DOMParser) != "undefined") {
+ if (typeof(DOMParser) != 'undefined') {
opensocial.xmlutil.parser_ = opensocial.xmlutil.parser_ || new DOMParser();
- var doc = opensocial.xmlutil.parser_.parseFromString(str, "text/xml");
+ var doc = opensocial.xmlutil.parser_.parseFromString(str, 'text/xml');
if (doc.firstChild && doc.firstChild.tagName == 'parsererror') {
throw Error(doc.firstChild.firstChild.nodeValue);
}
return doc;
- } else if (typeof(ActiveXObject) != "undefined") {
- var doc = new ActiveXObject("MSXML2.DomDocument");
+ } else if (typeof(ActiveXObject) != 'undefined') {
+ var doc = new ActiveXObject('MSXML2.DomDocument');
doc.validateOnParse = false;
doc.loadXML(str);
if (doc.parseError && doc.parseError.errorCode) {
@@ -49,16 +50,16 @@ opensocial.xmlutil.parseXML = function(s
}
return doc;
}
- throw Error("No XML parser found in this browser.");
+ throw Error('No XML parser found in this browser.');
};
/**
* Map of Namespace prefixes to their respective URLs.
- * @type Object.<string,string>
+ * @type {Object.<string,string>}
*/
opensocial.xmlutil.NSMAP = {
- "os": "http://opensocial.org/"
+ 'os': 'http://opensocial.org/'
};
@@ -74,36 +75,39 @@ opensocial.xmlutil.NSMAP = {
* @return {string} A string of xmlns delcarations required for this XML.
*/
opensocial.xmlutil.getRequiredNamespaces = function(xml, opt_container) {
- var namespaces = opt_container ?
+ var namespaces = opt_container ?
opensocial.xmlutil.getNamespaceDeclarations_(opt_container) : {};
for (var prefix in opensocial.xmlutil.NSMAP) {
- if (opensocial.xmlutil.NSMAP.hasOwnProperty(prefix)
- && !namespaces.hasOwnProperty(prefix)
- && xml.indexOf("<" + prefix + ":") >= 0
- && xml.indexOf("xmlns:" + prefix + ":") < 0) {
+ if (opensocial.xmlutil.NSMAP.hasOwnProperty(prefix)
+ && !namespaces.hasOwnProperty(prefix)
+ && xml.indexOf('<' + prefix + ':') >= 0
+ && xml.indexOf('xmlns:' + prefix + ':') < 0) {
namespaces[prefix] = opensocial.xmlutil.NSMAP[prefix];
}
}
- return opensocial.xmlutil.serializeNamespaces_(namespaces);
+ return opensocial.xmlutil.serializeNamespaces_(namespaces);
};
-
+/**
+ * @private
+ */
opensocial.xmlutil.serializeNamespaces_ = function(namespaces) {
var buffer = [];
for (var prefix in namespaces) {
if (namespaces.hasOwnProperty(prefix)) {
- buffer.push(" xmlns:", prefix, "=\"", namespaces[prefix], "\"");
+ buffer.push(' xmlns:', prefix, '=\"', namespaces[prefix], '\"');
}
}
- return buffer.join("");
+ return buffer.join('');
};
/**
* Returns a map of XML namespaces declared on an DOM Element.
- * @param {Element} el The Element to inspect
- * @return {Object.<string, string>} A Map of keyed by prefix of declared
- * namespaces.
+ * @param {Element} el The Element to inspect.
+ * @return {Object.<string, string>} A Map of keyed by prefix of declared
+ * namespaces.
+ * @private
*/
opensocial.xmlutil.getNamespaceDeclarations_ = function(el) {
var namespaces = {};
@@ -112,7 +116,7 @@ opensocial.xmlutil.getNamespaceDeclarati
if (name.substring(0, 6) != 'xmlns:') {
continue;
}
- namespaces[name.substring(6, name.length)] = el.getAttribute(name);
+ namespaces[name.substring(6, name.length)] = el.getAttribute(name);
}
return namespaces;
};
@@ -123,7 +127,7 @@ opensocial.xmlutil.getNamespaceDeclarati
*
* TODO: A better way to do this.
*/
-opensocial.xmlutil.ENTITIES = "<!ENTITY nbsp \" \">";
+opensocial.xmlutil.ENTITIES = '<!ENTITY nbsp \" \">';
/**
@@ -136,7 +140,7 @@ opensocial.xmlutil.ENTITIES = "<!ENTITY
*/
opensocial.xmlutil.prepareXML = function(xml, opt_container) {
var namespaces = opensocial.xmlutil.getRequiredNamespaces(xml, opt_container);
- return "<!DOCTYPE root [" + opensocial.xmlutil.ENTITIES +
- "]><root xml:space=\"preserve\"" +
- namespaces + ">" + xml + "</root>";
+ return '<!DOCTYPE root [' + opensocial.xmlutil.ENTITIES +
+ ']><root xml:space=\"preserve\"' +
+ namespaces + '>' + xml + '</root>';
};
Modified: shindig/branches/2.0.x/features/src/test/javascript/features/alltests.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/test/javascript/features/alltests.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/test/javascript/features/alltests.js (original)
+++ shindig/branches/2.0.x/features/src/test/javascript/features/alltests.js Thu Oct 7 15:54:09 2010
@@ -46,6 +46,7 @@ if (!this.JsUtil) {
eval(JsUtil.prototype.include(srcDir + '/xhrwrapper/xhrwrapper.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/opensocial.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/activity.js'));
+ eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/album.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/address.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/bodytype.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/collection.js'));
@@ -66,6 +67,8 @@ if (!this.JsUtil) {
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/responseitem.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-reference/url.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-base/jsonactivity.js'));
+ eval(JsUtil.prototype.include(srcDir + '/opensocial-base/jsonalbum.js'));
+ eval(JsUtil.prototype.include(srcDir + '/opensocial-base/jsonmediaitem.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-base/jsonperson.js'));
eval(JsUtil.prototype.include(srcDir + '/opensocial-jsonrpc/jsonrpccontainer.js'));
eval(JsUtil.prototype.include(srcDir + '/osapi/osapi.js'));
@@ -80,6 +83,8 @@ if (!this.JsUtil) {
eval(JsUtil.prototype.include(testSrcDir + "/core/prefstest.js"));
eval(JsUtil.prototype.include(testSrcDir + "/core.io/iotest.js"));
eval(JsUtil.prototype.include(testSrcDir + "/opensocial-base/jsonactivitytest.js"));
+ eval(JsUtil.prototype.include(testSrcDir + "/opensocial-base/jsonalbumtest.js"));
+ eval(JsUtil.prototype.include(testSrcDir + "/opensocial-base/jsonmediaitemtest.js"));
eval(JsUtil.prototype.include(testSrcDir + "/opensocial-reference/activitytest.js"));
eval(JsUtil.prototype.include(testSrcDir + "/opensocial-templates/compiler_test.js"));
eval(JsUtil.prototype.include(testSrcDir + "/opensocial-templates/container_test.js"));
Modified: shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonactivitytest.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonactivitytest.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonactivitytest.js (original)
+++ shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonactivitytest.js Thu Oct 7 15:54:09 2010
@@ -68,14 +68,4 @@ JsonActivityTest.prototype.testJsonActiv
this.assertEquals('black', mediaItems[0].getField(mediaItemFields.MIME_TYPE));
this.assertEquals('white', mediaItems[0].getField(mediaItemFields.URL));
this.assertEquals('orange', mediaItems[0].getField(mediaItemFields.TYPE));
-};
-
-JsonActivityTest.prototype.testJsonMediaItemConstructor = function() {
- var mediaItem = new JsonMediaItem({'mimeType' : 'black', 'url' : 'white',
- 'type' : 'orange'});
-
- var fields = opensocial.MediaItem.Field;
- this.assertEquals('black', mediaItem.getField(fields.MIME_TYPE));
- this.assertEquals('white', mediaItem.getField(fields.URL));
- this.assertEquals('orange', mediaItem.getField(fields.TYPE));
};
\ No newline at end of file
Added: shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonalbumtest.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonalbumtest.js?rev=1005506&view=auto
==============================================================================
--- shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonalbumtest.js (added)
+++ shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonalbumtest.js Thu Oct 7 15:54:09 2010
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+var gadgets = gadgets || {};
+
+function JsonAlbumTest(name) {
+ TestCase.call(this, name);
+};
+JsonAlbumTest.inherits(TestCase);
+
+JsonAlbumTest.prototype.setUp = function() {
+ // Prepare for mocks
+ this.oldGetField = opensocial.Container.getField;
+ opensocial.Container.getField = function(fields, key, opt_params) {
+ return fields[key];
+ };
+};
+
+JsonAlbumTest.prototype.tearDown = function() {
+ // Remove mocks
+ opensocial.Container.getField = this.oldGetField;
+};
+
+JsonAlbumTest.prototype.testJsonAlbumConstructor = function() {
+ var album = new JsonAlbum( {
+ 'id' : 1,
+ 'ownerId' : 2,
+ 'title' : 'test-title',
+ 'description' : 'test-description',
+ 'location' : {'locality' : 'test-locality', 'country' : 'test-country'},
+ 'mediaItemCount' : 3,
+ 'mediaMimeType' : [ 'jpg' ],
+ 'mediaType' : 'image',
+ 'thumbnailUrl' : 'test-thumbnailUrl'
+ });
+
+ var fields = opensocial.Album.Field;
+ this.assertEquals(1, album.getField(fields.ID));
+ this.assertEquals(2, album.getField(fields.OWNER_ID));
+ this.assertEquals(3, album.getField(fields.MEDIA_ITEM_COUNT));
+ this.assertEquals('test-title', album.getField(fields.TITLE));
+ this.assertEquals('test-description', album.getField(fields.DESCRIPTION));
+
+ var location = album.getField(fields.LOCATION);
+ this.assertTrue(location instanceof opensocial.Address);
+ this.assertEquals('test-locality', location.getField(opensocial.Address.Field.LOCALITY));
+ this.assertEquals('test-country', location.getField(opensocial.Address.Field.COUNTRY));
+
+ var mimeTypes = album.getField(fields.MEDIA_MIME_TYPE);
+ this.assertTrue(mimeTypes instanceof Array);
+ this.assertEquals('jpg', mimeTypes[0]);
+
+ this.assertEquals(opensocial.MediaItem.Type.IMAGE, album.getField(fields.MEDIA_TYPE));
+ this.assertEquals('test-thumbnailUrl', album.getField(fields.THUMBNAIL_URL));
+};
\ No newline at end of file
Added: shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonmediaitemtest.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonmediaitemtest.js?rev=1005506&view=auto
==============================================================================
--- shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonmediaitemtest.js (added)
+++ shindig/branches/2.0.x/features/src/test/javascript/features/opensocial-base/jsonmediaitemtest.js Thu Oct 7 15:54:09 2010
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations under the License.
+ */
+
+var gadgets = gadgets || {};
+
+function JsonMediaItemTest(name) {
+ TestCase.call(this, name);
+};
+JsonMediaItemTest.inherits(TestCase);
+
+JsonMediaItemTest.prototype.setUp = function() {
+ // Prepare for mocks
+ this.oldGetField = opensocial.Container.getField;
+ opensocial.Container.getField = function(fields, key, opt_params) {
+ return fields[key];
+ };
+};
+
+JsonMediaItemTest.prototype.tearDown = function() {
+ // Remove mocks
+ opensocial.Container.getField = this.oldGetField;
+};
+
+JsonMediaItemTest.prototype.testJsonMediaItemConstructor = function() {
+ var mediaItem = new JsonMediaItem({'mimeType' : 'black', 'url' : 'white',
+ 'type' : 'orange'});
+
+ var fields = opensocial.MediaItem.Field;
+ this.assertEquals('black', mediaItem.getField(fields.MIME_TYPE));
+ this.assertEquals('white', mediaItem.getField(fields.URL));
+ this.assertEquals('orange', mediaItem.getField(fields.TYPE));
+};
\ No newline at end of file
Modified: shindig/branches/2.0.x/java/common/pom.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/pom.xml?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/pom.xml (original)
+++ shindig/branches/2.0.x/java/common/pom.xml Thu Oct 7 15:54:09 2010
@@ -68,6 +68,12 @@
<excludes>
<exclude>org/apache/shindig/common/testing/*.java</exclude>
</excludes>
+ <systemProperties>
+ <property>
+ <name>java.awt.headless</name>
+ <value>true</value>
+ </property>
+ </systemProperties>
</configuration>
</plugin>
<plugin>
@@ -176,12 +182,6 @@
<artifactId>xml-apis</artifactId>
</dependency>
- <!-- test -->
- <dependency>
- <groupId>xerces</groupId>
- <artifactId>xmlParserAPIs</artifactId>
- <scope>test</scope>
- </dependency>
<!-- needed for ehcache's use of slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/cache/ehcache/EhCacheCacheProvider.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/cache/ehcache/EhCacheCacheProvider.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/cache/ehcache/EhCacheCacheProvider.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/cache/ehcache/EhCacheCacheProvider.java Thu Oct 7 15:54:09 2010
@@ -41,7 +41,7 @@ import java.util.logging.Logger;
/**
* Cache interface based on ehcache
- * @see http://www.ehcache.org
+ * @see <a href="http://www.ehcache.org">http://www.ehcache.org</a>
*/
public class EhCacheCacheProvider implements CacheProvider {
private static final Logger LOG = Logger.getLogger(EhCacheCacheProvider.class.getName());
Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/servlet/HttpUtil.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/servlet/HttpUtil.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/servlet/HttpUtil.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/common/servlet/HttpUtil.java Thu Oct 7 15:54:09 2010
@@ -160,7 +160,7 @@ public final class HttpUtil {
* Set the header for Cross-Site Resource Sharing.
* @param resp HttpServletResponse to modify
* @param validOrigins a space separated list of Origins as defined by the html5 spec
- * @see http://dev.w3.org/html5/spec/browsers.html#origin-0
+ * @see <a href="http://dev.w3.org/html5/spec/browsers.html#origin-0">html 5 spec, section 5.3</a>
*/
public static void setCORSheader(HttpServletResponse resp, Collection<String> validOrigins) {
if (validOrigins == null) {
Modified: shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanDelegator.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanDelegator.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanDelegator.java (original)
+++ shindig/branches/2.0.x/java/common/src/main/java/org/apache/shindig/protocol/conversion/BeanDelegator.java Thu Oct 7 15:54:09 2010
@@ -173,7 +173,7 @@ public class BeanDelegator {
/**
* Proxy the interface function to the source object
- * @throw UnsupportedOperationException if method is not supported by source
+ * @throws UnsupportedOperationException if method is not supported by source
*/
public Object invoke(Object proxy, Method method, Object[] args) {
Class<?> sourceClass = source.getClass();
Modified: shindig/branches/2.0.x/java/gadgets/pom.xml
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/pom.xml?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/pom.xml (original)
+++ shindig/branches/2.0.x/java/gadgets/pom.xml Thu Oct 7 15:54:09 2010
@@ -91,6 +91,7 @@
<targetPath>files</targetPath>
<includes>
<include>container/rpc_relay.html</include>
+ <include>container/cookiebaseduserprefstore.js</include>
</includes>
</resource>
</resources>
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/AbstractHttpCache.java Thu Oct 7 15:54:09 2010
@@ -149,7 +149,8 @@ public abstract class AbstractHttpCache
.setLegacyParam(8, getTokenName(request))
.setParam("rh", request.getParam(RESIZE_HEIGHT))
.setParam("rw", request.getParam(RESIZE_WIDTH))
- .setParam("rq", request.getParam(RESIZE_QUALITY));
+ .setParam("rq", request.getParam(RESIZE_QUALITY))
+ .setParam("rm", request.getRewriteMimeType());
return keyBuilder.build();
}
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/BasicHttpFetcher.java Thu Oct 7 15:54:09 2010
@@ -461,7 +461,7 @@ public class BasicHttpFetcher implements
HttpEntity entity = response.getEntity();
- if (maxObjSize > 0 && entity.getContentLength() > maxObjSize) {
+ if (maxObjSize > 0 && entity != null && entity.getContentLength() > maxObjSize) {
return HttpResponse.badrequest("Exceeded maximum number of bytes - " + maxObjSize);
}
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/http/HttpResponse.java Thu Oct 7 15:54:09 2010
@@ -338,7 +338,7 @@ public final class HttpResponse implemen
String retryAfter = this.getHeader("Retry-After");
if (retryAfter != null) {
if (StringUtils.isNumeric(retryAfter)) {
- return date + Integer.parseInt(retryAfter) * 1000L;
+ return date + Integer.valueOf(retryAfter) * 1000L;
} else {
Date expiresDate = DateUtil.parseRfc1123Date(retryAfter);
if (expiresDate != null)
@@ -442,7 +442,7 @@ public final class HttpResponse implemen
String[] parts = StringUtils.split(directive, '=');
if (parts.length == 2) {
try {
- return Long.parseLong(parts[1]) * 1000;
+ return Long.valueOf(parts[1]) * 1000;
} catch (NumberFormatException ignore) {
return -1;
}
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/oauth/OAuthRequest.java Thu Oct 7 15:54:09 2010
@@ -474,7 +474,7 @@ public class OAuthRequest {
}
params.add(new Parameter(OAuth.OAUTH_VERSION, OAuth.VERSION_1_0));
params.add(new Parameter(OAuth.OAUTH_TIMESTAMP,
- Long.toString(fetcherConfig.getClock().currentTimeMillis() / 1000)));
+ Long.toString(fetcherConfig.getClock().currentTimeMillis() / 1000L)));
// the oauth.net java code uses a clock to generate nonces, which causes nonce collisions
// under heavy load. A random nonce is more reliable.
params.add(new Parameter(OAuth.OAUTH_NONCE, String.valueOf(Math.abs(Crypto.RAND.nextLong()))));
@@ -770,7 +770,7 @@ public class OAuthRequest {
try {
int expireSecs = Integer.parseInt(OAuthUtil.getParameter(reply,
OAuthConstants.OAUTH_EXPIRES_IN));
- long expireMillis = fetcherConfig.getClock().currentTimeMillis() + expireSecs * 1000;
+ long expireMillis = fetcherConfig.getClock().currentTimeMillis() + expireSecs * 1000L;
accessorInfo.setTokenExpireMillis(expireMillis);
} catch (NumberFormatException e) {
// Hrm. Bogus server. We can safely ignore this, we'll just wait for the server to
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/parse/DefaultHtmlSerializer.java Thu Oct 7 15:54:09 2010
@@ -79,7 +79,7 @@ public class DefaultHtmlSerializer imple
HTMLElements.Element htmlElement =
HTMLElements.getElement(elem.getNodeName());
-
+
printStartElement(elem, output, xmlMode && htmlElement.isEmpty());
// Special HTML elements - <script> in particular - will typically
@@ -114,7 +114,7 @@ public class DefaultHtmlSerializer imple
if (scriptType != null) {
Element replacement = elem.getOwnerDocument().createElement("script");
replacement.setAttribute("type", scriptType);
-
+
// Retain the remaining attributes of the node.
NamedNodeMap attribs = elem.getAttributes();
for (int i = 0; i < attribs.getLength(); ++i) {
@@ -168,10 +168,7 @@ public class DefaultHtmlSerializer imple
if (attr.getNodeValue() != null) {
output.append("=\"");
if (attr.getNodeValue().length() != 0) {
- boolean isUrlAttribute =
- elem.getNamespaceURI() == null &&
- HtmlSerialization.URL_ATTRIBUTES.contains(attrName);
- printAttributeValue(attr.getNodeValue(), output, isUrlAttribute);
+ printAttributeValue(attr.getNodeValue(), output);
}
output.append('"');
}
@@ -179,13 +176,14 @@ public class DefaultHtmlSerializer imple
output.append(withXmlClose ? "/>" : ">");
}
- private static void printAttributeValue(String text, Appendable output, boolean isUrl) throws IOException {
+ private static void printAttributeValue(String text, Appendable output) throws IOException {
int length = text.length();
for (int j = 0; j < length; j++) {
char c = text.charAt(j);
+ // TODO: Complete all special chars (http://www.w3.org/TR/REC-xml/#charsets)
if (c == '"') {
output.append(""");
- } else if (c == '&' && !isUrl) {
+ } else if (c == '&') {
output.append("&");
} else {
output.append(c);
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/render/RenderingGadgetRewriter.java Thu Oct 7 15:54:09 2010
@@ -79,7 +79,7 @@ import com.google.inject.name.Named;
*/
public class RenderingGadgetRewriter implements GadgetRewriter {
private static final Logger LOG = Logger.getLogger(RenderingGadgetRewriter.class.getName());
-
+
private static final int INLINE_JS_BUFFER = 50;
protected static final String DEFAULT_CSS =
@@ -201,7 +201,7 @@ public class RenderingGadgetRewriter imp
onloadScript.appendChild(bodyTag.getOwnerDocument().createTextNode(
"gadgets.util.runOnLoadHandlers();"));
}
-
+
protected void injectGadgetBeacon(Gadget gadget, Node headTag, Node firstHeadChild)
throws GadgetException {
Element beaconNode = headTag.getOwnerDocument().createElement("script");
@@ -222,7 +222,7 @@ public class RenderingGadgetRewriter imp
Set<String> externForcedLibs = defaultExternLibs;
// gather the libraries we'll need to generate the extern libs
- String externParam = context.getParameter("libs");
+ String externParam = context.getParameter("libs");
if (StringUtils.isNotBlank(externParam)) {
externForcedLibs = Sets.newTreeSet(Arrays.asList(StringUtils.split(externParam, ':')));
}
@@ -230,14 +230,14 @@ public class RenderingGadgetRewriter imp
if (!externForcedLibs.isEmpty()) {
String jsUrl = jsUriManager.makeExternJsUri(gadget, externForcedLibs).toString();
Element libsTag = headTag.getOwnerDocument().createElement("script");
- libsTag.setAttribute("src", jsUrl.replace("&", "&"));
+ libsTag.setAttribute("src", jsUrl);
headTag.insertBefore(libsTag, firstHeadChild);
}
List<String> unsupported = Lists.newLinkedList();
List<FeatureResource> externForcedResources =
- featureRegistry.getFeatureResources(context, externForcedLibs, unsupported);
+ featureRegistry.getFeatureResources(context, externForcedLibs, unsupported);
if (!unsupported.isEmpty()) {
LOG.info("Unknown feature(s) in extern &libs=: " + unsupported.toString());
unsupported.clear();
@@ -259,10 +259,10 @@ public class RenderingGadgetRewriter imp
if (!requiredUnsupported.isEmpty()) {
throw new UnsupportedFeatureException(requiredUnsupported.toString());
}
- }
+ }
// Inline or externalize the gadgetFeatureKeys
- List<FeatureResource> inlineResources = Lists.newArrayList();
+ List<FeatureResource> inlineResources = Lists.newArrayList();
List<String> allRequested = Lists.newArrayList(gadgetFeatureKeys);
if (externalizeFeatures) {
@@ -272,7 +272,7 @@ public class RenderingGadgetRewriter imp
if (!externGadgetLibs.isEmpty()) {
String jsUrl = jsUriManager.makeExternJsUri(gadget, externGadgetLibs).toString();
Element libsTag = headTag.getOwnerDocument().createElement("script");
- libsTag.setAttribute("src", jsUrl.replace("&", "&"));
+ libsTag.setAttribute("src", jsUrl);
headTag.insertBefore(libsTag, firstHeadChild);
}
} else {
@@ -301,7 +301,7 @@ public class RenderingGadgetRewriter imp
String libraryConfig =
getLibraryConfig(gadget, featureRegistry.getFeatures(allRequested));
-
+
// Size has a small fudge factor added to it for delimiters and such.
StringBuilder inlineJs = new StringBuilder(size + libraryConfig.length() + INLINE_JS_BUFFER);
@@ -317,7 +317,7 @@ public class RenderingGadgetRewriter imp
inlineJs.setLength(0);
}
Element referenceTag = headTag.getOwnerDocument().createElement("script");
- referenceTag.setAttribute("src", theContent.replace("&", "&"));
+ referenceTag.setAttribute("src", theContent);
headTag.insertBefore(referenceTag, firstHeadChild);
} else {
inlineJs.append(theContent).append(";\n");
@@ -361,7 +361,7 @@ public class RenderingGadgetRewriter imp
if (conf != null) {
config.put(name, conf);
}
-
+
// See if this feature has configuration data
ConfigContributor contributor = configContributors.get(name);
if (contributor != null) {
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ConcatVisitor.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ConcatVisitor.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ConcatVisitor.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/ConcatVisitor.java Thu Oct 7 15:54:09 2010
@@ -186,7 +186,7 @@ public class ConcatVisitor implements Do
// with new (concat) URI, immediately ahead of the first elem.
Element firstElem = sourceBatch.get(0);
Element elemConcat = (Element)firstElem.cloneNode(true);
- elemConcat.setAttribute(type.getSrcAttrib(), concatUri.getUri().toString().replace("&", "&"));
+ elemConcat.setAttribute(type.getSrcAttrib(), concatUri.getUri().toString());
firstElem.getParentNode().insertBefore(elemConcat, firstElem);
// Now for all Elements, either A) remove them or B) replace each
@@ -247,9 +247,12 @@ public class ConcatVisitor implements Do
private Element getSibling(Element root, boolean isPrev) {
Node cur = root;
while ((cur = getNext(cur, isPrev)) != null) {
- if (cur.getNodeType() == Node.TEXT_NODE && StringUtils.isEmpty(cur.getTextContent())) {
+ // Text nodes are safe to skip, as they won't effect styles or scripts.
+ // It is also safe to skip comment nodes except for conditional comments.
+ if (cur.getNodeType() == Node.TEXT_NODE ||
+ (cur.getNodeType() == Node.COMMENT_NODE && !isConditionalComment(cur))) {
continue;
- }
+ }
break;
}
if (cur != null && cur.getNodeType() == Node.ELEMENT_NODE) {
@@ -302,4 +305,11 @@ public class ConcatVisitor implements Do
// styles.
return areLinkNodesCompatible && current.getAttribute("title").equals(next.getAttribute("title"));
}
+
+ /**
+ * Checks if a given comment node is coditional comment.
+ */
+ private boolean isConditionalComment(Node node) {
+ return node.getNodeValue().trim().startsWith("[if");
+ }
}
Modified: shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorContentRewriter.java
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorContentRewriter.java?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorContentRewriter.java (original)
+++ shindig/branches/2.0.x/java/gadgets/src/main/java/org/apache/shindig/gadgets/rewrite/StyleTagExtractorContentRewriter.java Thu Oct 7 15:54:09 2010
@@ -23,7 +23,6 @@ import com.google.inject.Inject;
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.gadgets.Gadget;
import org.apache.shindig.gadgets.rewrite.DomWalker.Visitor;
-import org.apache.shindig.gadgets.uri.ConcatUriManager;
import org.apache.shindig.gadgets.uri.ProxyUriManager;
import java.util.Arrays;