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 [38/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/opensocial-reference/messagecollection.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/messagecollection.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/messagecollection.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/messagecollection.js Thu Oct 7 15:54:09 2010
@@ -67,34 +67,34 @@ opensocial.MessageCollection.Field = {
ID: 'id',
/**
- * The title of the message collection.
+ * The title of the message collection.
* @member opensocial.MessageCollection.Field
*/
- TITLE : 'title',
+ TITLE: 'title',
/**
* The total number of messages in this collection.
* @member opensocial.MessageCollection.Field
*/
- TOTAL : 'total',
+ TOTAL: 'total',
/**
* The total number of unread messages in this collection
* @member opensocial.MessageCollection.Field
*/
- UNREAD : 'unread',
+ UNREAD: 'unread',
/**
* The updated timestamp for this collection
* @member opensocial.MessageCollection.Field
*/
- UPDATED : 'updated',
+ UPDATED: 'updated',
/**
* Urls associated with this collection
* @member opensocial.MessageCollection.Field
*/
- URLS : 'urls'
+ URLS: 'urls'
};
@@ -103,12 +103,12 @@ opensocial.MessageCollection.Field = {
*
* @param {string} key The key to get data for;
* see the <a href="opensocial.MessageCollection.Field.html">Field</a> class
- * for possible values
+ * for possible values.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
* @member opensocial.MessageCollection
*/
opensocial.MessageCollection.prototype.getField = function(key, opt_params) {
@@ -119,8 +119,8 @@ opensocial.MessageCollection.prototype.g
/**
* Sets data for this message associated with the given key.
*
- * @param {string} key The key to set data for
- * @param {string} data The data to set
+ * @param {string} key The key to set data for.
+ * @param {string} data The data to set.
*/
opensocial.MessageCollection.prototype.setField = function(key, data) {
return this.fields_[key] = data;
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/name.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/name.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/name.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/name.js Thu Oct 7 15:54:09 2010
@@ -57,42 +57,42 @@ opensocial.Name.Field = {
*
* @member opensocial.Name.Field
*/
- FAMILY_NAME : 'familyName',
+ FAMILY_NAME: 'familyName',
/**
* The given name. Specified as a String.
*
* @member opensocial.Name.Field
*/
- GIVEN_NAME : 'givenName',
+ GIVEN_NAME: 'givenName',
/**
* The additional name. Specified as a String.
*
* @member opensocial.Name.Field
*/
- ADDITIONAL_NAME : 'additionalName',
+ ADDITIONAL_NAME: 'additionalName',
/**
* The honorific prefix. Specified as a String.
*
* @member opensocial.Name.Field
*/
- HONORIFIC_PREFIX : 'honorificPrefix',
+ HONORIFIC_PREFIX: 'honorificPrefix',
/**
* The honorific suffix. Specified as a String.
*
* @member opensocial.Name.Field
*/
- HONORIFIC_SUFFIX : 'honorificSuffix',
+ HONORIFIC_SUFFIX: 'honorificSuffix',
/**
* The unstructured name. Specified as a String.
*
* @member opensocial.Name.Field
*/
- UNSTRUCTURED : 'unstructured'
+ UNSTRUCTURED: 'unstructured'
};
@@ -101,12 +101,12 @@ opensocial.Name.Field = {
*
* @param {string} key The key to get data for;
* keys are defined in <a href="opensocial.Name.Field.html"><code>
- * Name.Field</code></a>
+ * Name.Field</code></a>.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Name.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/navigationparameters.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/navigationparameters.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/navigationparameters.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/navigationparameters.js Thu Oct 7 15:54:09 2010
@@ -80,14 +80,14 @@ opensocial.NavigationParameters.Field =
*
* @member opensocial.NavigationParameters.Field
*/
- VIEW : 'view',
+ VIEW: 'view',
/**
* A string representing the owner id.
*
* @member opensocial.NavigationParameters.Field
*/
- OWNER : 'owner',
+ OWNER: 'owner',
/**
* An optional list of parameters passed to the gadget once the new view,
@@ -96,7 +96,7 @@ opensocial.NavigationParameters.Field =
*
* @member opensocial.NavigationParameters.Field
*/
- PARAMETERS : 'parameters'
+ PARAMETERS: 'parameters'
};
@@ -105,12 +105,12 @@ opensocial.NavigationParameters.Field =
*
* @param {string} key The key to get data for;
* see the <a href="opensocial.NavigationParameters.Field.html">Field</a>
- * class for possible values
+ * class for possible values.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
* @member opensocial.NavigationParameters
*/
opensocial.NavigationParameters.prototype.getField = function(key, opt_params) {
@@ -121,8 +121,8 @@ opensocial.NavigationParameters.prototyp
/**
* Sets data for this NavigationParameters associated with the given key.
*
- * @param {string} key The key to set data for
- * @param {Object} data The data to set
+ * @param {string} key The key to set data for.
+ * @param {Object} data The data to set.
*/
opensocial.NavigationParameters.prototype.setField = function(key, data) {
return (this.fields_[key] = data);
@@ -141,8 +141,8 @@ opensocial.NavigationParameters.prototyp
*/
opensocial.NavigationParameters.DestinationType = {
/** @member opensocial.NavigationParameters.DestinationType */
- VIEWER_DESTINATION : "viewerDestination",
+ VIEWER_DESTINATION: 'viewerDestination',
/** @member opensocial.NavigationParameters.DestinationType */
- RECIPIENT_DESTINATION : "recipientDestination"
+ RECIPIENT_DESTINATION: 'recipientDestination'
};
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/opensocial.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/opensocial.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/opensocial.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/opensocial.js Thu Oct 7 15:54:09 2010
@@ -60,17 +60,17 @@ var opensocial = opensocial || {};
*
* @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
+ * OWNER_FRIENDS, or a single ID within one of those groups.
* @param {opensocial.Message} message The message to send to the specified
- * users
+ * users.
* @param {function(opensocial.ResponseItem)=} 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
+ * reloaded 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
* <a href="opensocial.NavigationParameters.DestinationType.html">
- * NavigationParameters.DestinationType</a>
+ * NavigationParameters.DestinationType.</a>
*
* @member opensocial
*/
@@ -102,18 +102,18 @@ opensocial.requestSendMessage = function
*
* @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
+ * OWNER_FRIENDS, or a single ID within one of those groups.
* @param {opensocial.Message} reason The reason the user wants the gadget to
* share itself. This reason can be used by the container when prompting the
* user for permission to share the app. It may also be ignored.
* @param {function(opensocial.ResponseItem)=} 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
+ * reloaded 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
* <a href="opensocial.NavigationParameters.DestinationType.html">
- * NavigationParameters.DestinationType</a>
+ * NavigationParameters.DestinationType.</a>
*
* @member opensocial
*/
@@ -156,10 +156,10 @@ opensocial.requestShareApp = function(re
* </p>
*
* @param {opensocial.Activity} activity The <a href="opensocial.Activity.html">
- * activity</a> to create
+ * activity</a> to create.
* @param {opensocial.CreateActivityPriority} priority The
* <a href="opensocial.CreateActivityPriority.html">priority</a> for this
- * request
+ * request.
* @param {function(opensocial.ResponseItem)=} opt_callback The function to call once the request has been
* processed.
*
@@ -171,14 +171,14 @@ opensocial.requestCreateActivity = funct
window.setTimeout(function() {
opt_callback(new opensocial.ResponseItem(null, null,
opensocial.ResponseItem.Error.BAD_REQUEST,
- "You must pass in an activity with a title or title id."));
+ 'You must pass in an activity with a title or title id.'));
}, 0);
}
return;
}
- opensocial.Container.get().requestCreateActivity(activity, priority,
- opt_callback);
+ opensocial.Container.get().requestCreateActivity(activity, priority,
+ opt_callback);
};
@@ -202,7 +202,7 @@ opensocial.CreateActivityPriority = {
*
* @member opensocial.CreateActivityPriority
*/
- HIGH : 'HIGH',
+ HIGH: 'HIGH',
/**
* If the activity is of low importance, it will not be created if the
@@ -212,7 +212,7 @@ opensocial.CreateActivityPriority = {
*
* @member opensocial.CreateActivityPriority
*/
- LOW : 'LOW'
+ LOW: 'LOW'
};
@@ -222,9 +222,9 @@ opensocial.CreateActivityPriority = {
* are granted then this function must return true on all subsequent calls.
*
* @param {opensocial.Permission} permission
- * The <a href="opensocial.Permission.html">permission</a>
+ * The <a href="opensocial.Permission.html">permission.</a>
* @return {boolean}
- * True if the gadget has access for the permission; false if it doesn't
+ * True if the gadget has access for the permission; false if it doesn't.
*
* @member opensocial
*/
@@ -241,9 +241,9 @@ opensocial.hasPermission = function(perm
*
* @param {Array.<opensocial.Permission>} permissions
* The <a href="opensocial.Permission.html">permissions</a> to request
- * from the viewer
+ * from the viewer.
* @param {string} reason Displayed to the user as the reason why these
- * permissions are needed
+ * permissions are needed.
* @param {function(opensocial.ResponseItem)=} 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. This function will be passed one parameter, an
@@ -283,7 +283,7 @@ opensocial.Permission = {
*
* @member opensocial.Permission
*/
- VIEWER : 'viewer'
+ VIEWER: 'viewer'
};
@@ -293,7 +293,7 @@ opensocial.Permission = {
* container, what parameters were passed to the current gadget, and so on.
*
* @return {opensocial.Environment}
- * The current <a href="opensocial.Environment.html">environment</a>
+ * The current <a href="opensocial.Environment.html">environment.</a>
*
* @member opensocial
*/
@@ -307,7 +307,7 @@ opensocial.getEnvironment = function() {
* server.
*
* @return {opensocial.DataRequest} The
- * <a href="opensocial.DataRequest.html">request</a> object
+ * <a href="opensocial.DataRequest.html">request</a> object.
* @member opensocial
*/
opensocial.newDataRequest = function() {
@@ -340,7 +340,7 @@ opensocial.newDataRequest = function() {
* @param {Object.<opensocial.Activity.Field, Object>} params
* Parameters defining the activity.
* @return {opensocial.Activity} The new
- * <a href="opensocial.Activity.html">activity</a> object
+ * <a href="opensocial.Activity.html">activity</a> object.
* @member opensocial
*/
opensocial.newActivity = function(params) {
@@ -356,10 +356,10 @@ opensocial.newActivity = function(params
* Any other fields that should be set on the album object;
* all of the defined
* <a href="opensocial.Album.Field.html">Field</a>s
- * are supported
+ * are supported.
*
* @return {opensocial.Album} The new
- * <a href="opensocial.Album.html">album</a> object
+ * <a href="opensocial.Album.html">album</a> object.
* @member opensocial
*/
opensocial.newAlbum = function(opt_params) {
@@ -374,16 +374,16 @@ opensocial.newAlbum = function(opt_param
*
* @param {string} mimeType
* <a href="opensocial.MediaItem.Type.html">MIME type</a> of the
- * media
- * @param {string} url Where the media can be found
+ * media.
+ * @param {string} url Where the media can be found.
* @param {Object.<opensocial.MediaItem.Field, Object>=} opt_params
* Any other fields that should be set on the media item object;
* all of the defined
* <a href="opensocial.MediaItem.Field.html">Field</a>s
- * are supported
+ * are supported.
*
* @return {opensocial.MediaItem} The new
- * <a href="opensocial.MediaItem.html">media item</a> object
+ * <a href="opensocial.MediaItem.html">media item</a> object.
* @member opensocial
*/
opensocial.newMediaItem = function(mimeType, url, opt_params) {
@@ -401,10 +401,10 @@ opensocial.newMediaItem = function(mimeT
* Any other fields that should be set on the message object;
* all of the defined
* <a href="opensocial.Message.Field.html">Field</a>s
- * are supported
+ * are supported.
*
* @return {opensocial.Message} The new
- * <a href="opensocial.Message.html">message</a> object
+ * <a href="opensocial.Message.html">message</a> object.
* @member opensocial
*/
opensocial.newMessage = function(body, opt_params) {
@@ -424,13 +424,13 @@ opensocial.EscapeType = {
* When used will HTML-escape the data.
* @member opensocial.EscapeType
*/
- HTML_ESCAPE : 'htmlEscape',
+ HTML_ESCAPE: 'htmlEscape',
/**
* When used will not escape the data.
*
* @member opensocial.EscapeType
*/
- NONE : 'none'
+ NONE: 'none'
};
@@ -440,7 +440,7 @@ opensocial.EscapeType = {
* @param {Object.<opensocial.IdSpec.Field, Object>} params
* Parameters defining the id spec.
* @return {opensocial.IdSpec} The new
- * <a href="opensocial.IdSpec.html">IdSpec</a> object
+ * <a href="opensocial.IdSpec.html">IdSpec</a> object.
* @member opensocial
*/
opensocial.newIdSpec = function(params) {
@@ -457,10 +457,10 @@ opensocial.newIdSpec = function(params)
*
*
* @param {Object.<opensocial.NavigationParameters.Field, Object>} params
- * Parameters defining the navigation
+ * Parameters defining the navigation.
* @return {opensocial.NavigationParameters} The new
* <a href="opensocial.NavigationParameters.html">NavigationParameters</a>
- * object
+ * object.
* @member opensocial
*/
opensocial.newNavigationParameters = function(params) {
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/organization.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/organization.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/organization.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/organization.js Thu Oct 7 15:54:09 2010
@@ -59,7 +59,7 @@ opensocial.Organization.Field = {
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- NAME : 'name',
+ NAME: 'name',
/**
* The title or role the person has in the organization, specified as a
@@ -67,7 +67,7 @@ opensocial.Organization.Field = {
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- TITLE : 'title',
+ TITLE: 'title',
/**
* A description or notes about the person's work in the organization,
@@ -76,7 +76,7 @@ opensocial.Organization.Field = {
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- DESCRIPTION : 'description',
+ DESCRIPTION: 'description',
/**
* The field the organization is in, specified as a string. This could be the
@@ -84,21 +84,21 @@ opensocial.Organization.Field = {
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- FIELD : 'field',
+ FIELD: 'field',
/**
* The subfield the Organization is in, specified as a string.
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- SUB_FIELD : 'subField',
+ SUB_FIELD: 'subField',
/**
* The date the person started at the organization, specified as a Date.
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- START_DATE : 'startDate',
+ START_DATE: 'startDate',
/**
* The date the person stopped at the organization, specified as a Date.
@@ -107,29 +107,29 @@ opensocial.Organization.Field = {
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- END_DATE : 'endDate',
+ END_DATE: 'endDate',
- /**
+ /**
* The salary the person receieves from the organization, specified as a
* string.
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- SALARY : 'salary',
+ SALARY: 'salary',
- /**
+ /**
* The address of the organization, specified as an opensocial.Address.
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- ADDRESS : 'address',
+ ADDRESS: 'address',
- /**
+ /**
* A webpage related to the organization, specified as a string.
* Not supported by all containers.
* @member opensocial.Organization.Field
*/
- WEBPAGE : 'webpage'
+ WEBPAGE: 'webpage'
};
@@ -138,12 +138,12 @@ opensocial.Organization.Field = {
*
* @param {string} key The key to get data for;
* keys are defined in <a href="opensocial.Organization.Field.html"><code>
- * Organization.Field</code></a>
+ * Organization.Field</code></a>.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
- * to pass to the request
- * @return {string} The data
+ * to pass to the request.
+ * @return {string} The data.
*/
opensocial.Organization.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/person.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/person.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/person.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/person.js Thu Oct 7 15:54:09 2010
@@ -58,26 +58,26 @@ opensocial.Person.Field = {
* A string ID that can be permanently associated with this person.
* @member opensocial.Person.Field
*/
- ID : 'id',
+ ID: 'id',
/**
* A opensocial.Name object containing the person's name.
* @member opensocial.Person.Field
*/
- NAME : 'name',
+ NAME: 'name',
/**
* A String representing the person's nickname.
* @member opensocial.Person.Field
*/
- NICKNAME : 'nickname',
+ NICKNAME: 'nickname',
/**
* Person's photo thumbnail URL, specified as a string.
* This URL must be fully qualified. Relative URLs will not work in gadgets.
* @member opensocial.Person.Field
*/
- THUMBNAIL_URL : 'thumbnailUrl',
+ THUMBNAIL_URL: 'thumbnailUrl',
/**
* Person's profile URL, specified as a string.
@@ -85,7 +85,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PROFILE_URL : 'profileUrl',
+ PROFILE_URL: 'profileUrl',
/**
* Person's current location, specified as an
@@ -93,7 +93,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- CURRENT_LOCATION : 'currentLocation',
+ CURRENT_LOCATION: 'currentLocation',
/**
* Addresses associated with the person, specified as an Array of
@@ -101,7 +101,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- ADDRESSES : 'addresses',
+ ADDRESSES: 'addresses',
/**
* Emails associated with the person, specified as an Array of
@@ -109,7 +109,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- EMAILS : 'emails',
+ EMAILS: 'emails',
/**
* Phone numbers associated with the person, specified as an Array of
@@ -117,7 +117,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PHONE_NUMBERS : 'phoneNumbers',
+ PHONE_NUMBERS: 'phoneNumbers',
/**
* A general statement about the person, specified as a string.
@@ -125,7 +125,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ABOUT_ME : 'aboutMe',
+ ABOUT_ME: 'aboutMe',
/**
* Person's status, headline or shoutout, specified as a string.
@@ -133,7 +133,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- STATUS : 'status',
+ STATUS: 'status',
/**
* Person's profile song, specified as an opensocial.Url.
@@ -141,7 +141,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- PROFILE_SONG : 'profileSong',
+ PROFILE_SONG: 'profileSong',
/**
* Person's profile video, specified as an opensocial.Url.
@@ -149,7 +149,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- PROFILE_VIDEO : 'profileVideo',
+ PROFILE_VIDEO: 'profileVideo',
/**
* Person's gender, specified as an opensocial.Enum with the enum's
@@ -158,49 +158,49 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- GENDER : 'gender',
+ GENDER: 'gender',
/**
* Person's sexual orientation, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- SEXUAL_ORIENTATION : 'sexualOrientation',
+ SEXUAL_ORIENTATION: 'sexualOrientation',
/**
* Person's relationship status, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- RELATIONSHIP_STATUS : 'relationshipStatus',
+ RELATIONSHIP_STATUS: 'relationshipStatus',
/**
* Person's age, specified as a number.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- AGE : 'age',
+ AGE: 'age',
/**
* Person's date of birth, specified as a Date object.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- DATE_OF_BIRTH : 'dateOfBirth',
+ DATE_OF_BIRTH: 'dateOfBirth',
/**
* Person's body characteristics, specified as an opensocial.BodyType.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- BODY_TYPE : 'bodyType',
+ BODY_TYPE: 'bodyType',
/**
* Person's ethnicity, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- ETHNICITY : 'ethnicity',
+ ETHNICITY: 'ethnicity',
/**
* Person's smoking status, specified as an opensocial.Enum with the enum's
@@ -209,7 +209,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SMOKER : 'smoker',
+ SMOKER: 'smoker',
/**
* Person's drinking status, specified as an opensocial.Enum with the enum's
@@ -218,28 +218,28 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- DRINKER : 'drinker',
+ DRINKER: 'drinker',
/**
* Description of the person's children, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- CHILDREN : 'children',
+ CHILDREN: 'children',
/**
* Description of the person's pets, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- PETS : 'pets',
+ PETS: 'pets',
/**
* Description of the person's living arrangement, specified as a string.
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- LIVING_ARRANGEMENT : 'livingArrangement',
+ LIVING_ARRANGEMENT: 'livingArrangement',
/**
* Person's time zone, specified as the difference in minutes between
@@ -248,7 +248,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- TIME_ZONE : 'timeZone',
+ TIME_ZONE: 'timeZone',
/**
* List of the languages that the person speaks as ISO 639-1 codes,
@@ -256,7 +256,7 @@ opensocial.Person.Field = {
* Container support for this field is OPTIONAL.
* @member opensocial.Person.Field
*/
- LANGUAGES_SPOKEN : 'languagesSpoken',
+ LANGUAGES_SPOKEN: 'languagesSpoken',
/**
* Jobs the person has held, specified as an Array of
@@ -265,7 +265,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- JOBS : 'jobs',
+ JOBS: 'jobs',
/**
* Person's favorite jobs, or job interests and skills, specified as a string.
@@ -273,7 +273,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- JOB_INTERESTS : 'jobInterests',
+ JOB_INTERESTS: 'jobInterests',
/**
* Schools the person has attended, specified as an Array of
@@ -282,7 +282,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SCHOOLS : 'schools',
+ SCHOOLS: 'schools',
/**
* Person's interests, hobbies or passions, specified as an Array of strings.
@@ -290,7 +290,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- INTERESTS : 'interests',
+ INTERESTS: 'interests',
/**
* URLs related to the person, their webpages, or feeds. Specified as an
@@ -299,7 +299,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- URLS : 'urls',
+ URLS: 'urls',
/**
* Person's favorite music, specified as an Array of strings.
@@ -307,7 +307,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- MUSIC : 'music',
+ MUSIC: 'music',
/**
* Person's favorite movies, specified as an Array of strings.
@@ -315,7 +315,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- MOVIES : 'movies',
+ MOVIES: 'movies',
/**
* Person's favorite TV shows, specified as an Array of strings.
@@ -323,7 +323,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TV_SHOWS : 'tvShows',
+ TV_SHOWS: 'tvShows',
/**
* Person's favorite books, specified as an Array of strings.
@@ -331,7 +331,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- BOOKS : 'books',
+ BOOKS: 'books',
/**
* Person's favorite activities, specified as an Array of strings.
@@ -339,7 +339,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ACTIVITIES : 'activities',
+ ACTIVITIES: 'activities',
/**
* Person's favorite sports, specified as an Array of strings.
@@ -347,7 +347,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SPORTS : 'sports',
+ SPORTS: 'sports',
/**
* Person's favorite heroes, specified as an Array of strings.
@@ -355,7 +355,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HEROES : 'heroes',
+ HEROES: 'heroes',
/**
* Person's favorite quotes, specified as an Array of strings.
@@ -363,7 +363,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- QUOTES : 'quotes',
+ QUOTES: 'quotes',
/**
* Person's favorite cars, specified as an Array of strings.
@@ -371,7 +371,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- CARS : 'cars',
+ CARS: 'cars',
/**
* Person's favorite food, specified as an Array of strings.
@@ -379,7 +379,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- FOOD : 'food',
+ FOOD: 'food',
/**
* Person's turn ons, specified as an Array of strings.
@@ -387,7 +387,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TURN_ONS : 'turnOns',
+ TURN_ONS: 'turnOns',
/**
* Person's turn offs, specified as an Array of strings.
@@ -395,7 +395,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TURN_OFFS : 'turnOffs',
+ TURN_OFFS: 'turnOffs',
/**
* Arbitrary tags about the person, specified as an Array of strings.
@@ -403,7 +403,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- TAGS : 'tags',
+ TAGS: 'tags',
/**
* Person's comments about romance, specified as a string.
@@ -411,7 +411,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- ROMANCE : 'romance',
+ ROMANCE: 'romance',
/**
* What the person is scared of, specified as a string.
@@ -419,7 +419,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- SCARED_OF : 'scaredOf',
+ SCARED_OF: 'scaredOf',
/**
* Describes when the person is happiest, specified as a string.
@@ -427,7 +427,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HAPPIEST_WHEN : 'happiestWhen',
+ HAPPIEST_WHEN: 'happiestWhen',
/**
* Person's thoughts on fashion, specified as a string.
@@ -435,7 +435,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- FASHION : 'fashion',
+ FASHION: 'fashion',
/**
* Person's thoughts on humor, specified as a string.
@@ -443,7 +443,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HUMOR : 'humor',
+ HUMOR: 'humor',
/**
* Person's statement about who or what they are looking for, or what they are
@@ -453,7 +453,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- LOOKING_FOR : 'lookingFor',
+ LOOKING_FOR: 'lookingFor',
/**
* Person's relgion or religious views, specified as a string.
@@ -461,7 +461,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- RELIGION : 'religion',
+ RELIGION: 'religion',
/**
* Person's political views, specified as a string.
@@ -469,7 +469,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- POLITICAL_VIEWS : 'politicalViews',
+ POLITICAL_VIEWS: 'politicalViews',
/**
* A boolean indicating whether the person has used the current app.
@@ -477,7 +477,7 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- HAS_APP : 'hasApp',
+ HAS_APP: 'hasApp',
/**
* Person's current network status. Specified as an Enum with the enum's
@@ -486,14 +486,14 @@ opensocial.Person.Field = {
*
* @member opensocial.Person.Field
*/
- NETWORK_PRESENCE : 'networkPresence'
+ NETWORK_PRESENCE: 'networkPresence'
};
/**
* Gets an ID that can be permanently associated with this person.
*
- * @return {string} The ID
+ * @return {string} The ID.
*/
opensocial.Person.prototype.getId = function() {
return this.getField(opensocial.Person.Field.ID);
@@ -501,17 +501,17 @@ opensocial.Person.prototype.getId = func
var ORDERED_NAME_FIELDS_ = [
- opensocial.Name.Field.HONORIFIC_PREFIX,
- opensocial.Name.Field.GIVEN_NAME,
- opensocial.Name.Field.FAMILY_NAME,
- opensocial.Name.Field.HONORIFIC_SUFFIX,
- opensocial.Name.Field.ADDITIONAL_NAME];
+ opensocial.Name.Field.HONORIFIC_PREFIX,
+ opensocial.Name.Field.GIVEN_NAME,
+ opensocial.Name.Field.FAMILY_NAME,
+ opensocial.Name.Field.HONORIFIC_SUFFIX,
+ opensocial.Name.Field.ADDITIONAL_NAME];
/**
* Gets a text display name for this person; guaranteed to return
* a useful string.
*
- * @return {string} The display name
+ * @return {string} The display name.
*/
opensocial.Person.prototype.getDisplayName = function() {
var name = this.getField(opensocial.Person.Field.NAME);
@@ -530,7 +530,7 @@ opensocial.Person.prototype.getDisplayNa
fullName += nameValue + ' ';
}
}
- return fullName.replace(/^\s+|\s+$/g, '') ;
+ return fullName.replace(/^\s+|\s+$/g, '');
}
// Finally, try the nickname field
@@ -543,12 +543,12 @@ opensocial.Person.prototype.getDisplayNa
*
* @param {string} key The key to get data for;
* keys are defined in <a href="opensocial.Person.Field.html"><code>
- * Person.Field</code></a>
+ * Person.Field</code></a>.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>=}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Person.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
@@ -570,7 +570,7 @@ opensocial.Person.prototype.getAppData =
* Returns true if this person object represents the currently logged in user.
*
* @return {boolean} True if this is the currently logged in user;
- * otherwise, false
+ * otherwise, false.
*/
opensocial.Person.prototype.isViewer = function() {
return !!this.isViewer_;
@@ -581,7 +581,7 @@ opensocial.Person.prototype.isViewer = f
* Returns true if this person object represents the owner of the current page.
*
* @return {boolean} True if this is the owner of the page;
- * otherwise, false
+ * otherwise, false.
*/
opensocial.Person.prototype.isOwner = function() {
return !!this.isOwner_;
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/phone.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/phone.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/phone.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/phone.js Thu Oct 7 15:54:09 2010
@@ -60,14 +60,14 @@ opensocial.Phone.Field = {
*
* @member opensocial.Phone.Field
*/
- TYPE : 'type',
+ TYPE: 'type',
/**
* The phone number, specified as a String.
*
* @member opensocial.Phone.Field
*/
- NUMBER : 'number'
+ NUMBER: 'number'
};
@@ -76,12 +76,12 @@ opensocial.Phone.Field = {
*
* @param {string} key The key to get data for;
* keys are defined in <a href="opensocial.Phone.Field.html"><code>
- * Phone.Field</code></a>
+ * Phone.Field</code></a>.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Phone.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/responseitem.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/responseitem.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/responseitem.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/responseitem.js Thu Oct 7 15:54:09 2010
@@ -53,7 +53,7 @@ opensocial.ResponseItem = function(origi
/**
* Returns true if there was an error in fetching this data from the server.
*
- * @return {boolean} True if there was an error; otherwise, false
+ * @return {boolean} True if there was an error; otherwise, false.
*/
opensocial.ResponseItem.prototype.hadError = function() {
return !!this.errorCode_;
@@ -74,7 +74,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- NOT_IMPLEMENTED : 'notImplemented',
+ NOT_IMPLEMENTED: 'notImplemented',
/**
* The gadget does not have access to the requested data.
@@ -84,21 +84,21 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- UNAUTHORIZED : 'unauthorized',
+ UNAUTHORIZED: 'unauthorized',
/**
* The gadget can never have access to the requested data.
*
* @member opensocial.ResponseItem.Error
*/
- FORBIDDEN : 'forbidden',
+ FORBIDDEN: 'forbidden',
- /**
+ /**
* The request was invalid. Example: 'max' was -1.
*
* @member opensocial.ResponseItem.Error
*/
- BAD_REQUEST : 'badRequest',
+ BAD_REQUEST: 'badRequest',
/**
* The request encountered an unexpected condition that
@@ -106,7 +106,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- INTERNAL_ERROR : 'internalError',
+ INTERNAL_ERROR: 'internalError',
/**
* The gadget exceeded a quota on the request. Example quotas include a
@@ -115,7 +115,7 @@ opensocial.ResponseItem.Error = {
*
* @member opensocial.ResponseItem.Error
*/
- LIMIT_EXCEEDED : 'limitExceeded'
+ LIMIT_EXCEEDED: 'limitExceeded'
};
@@ -125,7 +125,7 @@ opensocial.ResponseItem.Error = {
* or one of the values defined by
* <a href="opensocial.ResponseItem.Error.html"><code>Error</code></a>.
*
- * @return {string} The error code, or null if no error occurred
+ * @return {string} The error code, or null if no error occurred.
*/
opensocial.ResponseItem.prototype.getErrorCode = function() {
return this.errorCode_;
@@ -136,7 +136,7 @@ opensocial.ResponseItem.prototype.getErr
* If the request had an error, returns the error message.
*
* @return {string} A human-readable description of the error that occurred;
- * can be null, even if an error occurred
+ * can be null, even if an error occurred.
*/
opensocial.ResponseItem.prototype.getErrorMessage = function() {
return this.errorMessage_;
@@ -147,7 +147,7 @@ opensocial.ResponseItem.prototype.getErr
* Returns the original data request.
*
* @return {opensocial.DataRequest} The data request used to fetch this data
- * response
+ * response.
*/
opensocial.ResponseItem.prototype.getOriginalDataRequest = function() {
return this.originalDataRequest_;
@@ -158,7 +158,7 @@ opensocial.ResponseItem.prototype.getOri
* Gets the response data.
*
* @return {Object} The requested value calculated by the server; the type of
- * this value is defined by the type of request that was made
+ * this value is defined by the type of request that was made.
*/
opensocial.ResponseItem.prototype.getData = function() {
return this.data_;
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/taming.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/taming.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/taming.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/taming.js Thu Oct 7 15:54:09 2010
@@ -67,28 +67,28 @@ tamings___.push(function(imports) {
___.grantInnocentMethod(JsonPerson.prototype, 'getAppData');
caja___.whitelistCtors([
- [window, 'JsonRpcRequestItem', Object],
- [opensocial, 'Activity', Object],
- [opensocial, 'Address', Object],
- [opensocial, 'Album', Object],
- [opensocial, 'BodyType', Object],
- [opensocial, 'Container', Object],
- [opensocial, 'Collection', Object],
- [opensocial, 'DataRequest', Object],
- [opensocial, 'DataResponse', Object],
- [opensocial, 'Email', Object],
- [opensocial, 'Enum', Object],
- [opensocial, 'Environment', Object],
- [opensocial, 'IdSpec', Object],
- [opensocial, 'MediaItem', Object],
- [opensocial, 'Message', Object],
- [opensocial, 'Name', Object],
- [opensocial, 'NavigationParameters', Object],
- [opensocial, 'Organization', Object],
- [opensocial, 'Person', Object],
- [opensocial, 'Phone', Object],
- [opensocial, 'ResponseItem', Object],
- [opensocial, 'Url', Object]
+ [window, 'JsonRpcRequestItem', Object],
+ [opensocial, 'Activity', Object],
+ [opensocial, 'Address', Object],
+ [opensocial, 'Album', Object],
+ [opensocial, 'BodyType', Object],
+ [opensocial, 'Container', Object],
+ [opensocial, 'Collection', Object],
+ [opensocial, 'DataRequest', Object],
+ [opensocial, 'DataResponse', Object],
+ [opensocial, 'Email', Object],
+ [opensocial, 'Enum', Object],
+ [opensocial, 'Environment', Object],
+ [opensocial, 'IdSpec', Object],
+ [opensocial, 'MediaItem', Object],
+ [opensocial, 'Message', Object],
+ [opensocial, 'Name', Object],
+ [opensocial, 'NavigationParameters', Object],
+ [opensocial, 'Organization', Object],
+ [opensocial, 'Person', Object],
+ [opensocial, 'Phone', Object],
+ [opensocial, 'ResponseItem', Object],
+ [opensocial, 'Url', Object]
]);
caja___.whitelistMeths([
[opensocial.Activity, 'getField'],
@@ -96,6 +96,7 @@ tamings___.push(function(imports) {
[opensocial.Activity, 'setField'],
[opensocial.Address, 'getField'],
[opensocial.Album, 'getField'],
+ [opensocial.Album, 'setField'],
[opensocial.BodyType, 'getField'],
[opensocial.Container, 'getEnvironment'],
[opensocial.Container, 'requestSendMessage'],
@@ -116,11 +117,13 @@ tamings___.push(function(imports) {
[opensocial.Container, 'newUpdateMediaItemRequest'],
[opensocial.Container, 'newFetchActivitiesRequest'],
[opensocial.Container, 'newFetchAlbumsRequest'],
+ [opensocial.Container, 'newFetchMediaItemsRequest'],
[opensocial.Container, 'newFetchMessageCollectionsRequest'],
[opensocial.Container, 'newFetchMessagesRequest'],
[opensocial.Container, 'newCollection'],
[opensocial.Container, 'newPerson'],
[opensocial.Container, 'newActivity'],
+ [opensocial.Container, 'newAlbum'],
[opensocial.Container, 'newMediaItem'],
[opensocial.Container, 'newMessage'],
[opensocial.Container, 'newIdSpec'],
@@ -142,6 +145,7 @@ tamings___.push(function(imports) {
[opensocial.DataRequest, 'newDeleteAlbumRequest'],
[opensocial.DataRequest, 'newFetchActivitiesRequest'],
[opensocial.DataRequest, 'newFetchAlbumsRequest'],
+ [opensocial.DataRequest, 'newFetchMediaItemsRequest'],
[opensocial.DataRequest, 'newFetchPeopleRequest'],
[opensocial.DataRequest, 'newFetchPersonAppDataRequest'],
[opensocial.DataRequest, 'newUpdateAlbumRequest'],
@@ -188,6 +192,7 @@ tamings___.push(function(imports) {
[opensocial, 'getEnvironment'],
[opensocial, 'hasPermission'],
[opensocial, 'newActivity'],
+ [opensocial, 'newAlbum'],
[opensocial, 'newDataRequest'],
[opensocial, 'newIdSpec'],
[opensocial, 'newMediaItem'],
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/url.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/url.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/url.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-reference/url.js Thu Oct 7 15:54:09 2010
@@ -58,21 +58,21 @@ opensocial.Url.Field = {
*
* @member opensocial.Url.Field
*/
- TYPE : 'type',
+ TYPE: 'type',
/**
* The text of the link. Specified as a String.
*
* @member opensocial.Url.Field
*/
- LINK_TEXT : 'linkText',
+ LINK_TEXT: 'linkText',
/**
* The address the url points to. Specified as a String.
*
* @member opensocial.Url.Field
*/
- ADDRESS : 'address'
+ ADDRESS: 'address'
};
@@ -81,12 +81,12 @@ opensocial.Url.Field = {
*
* @param {string} key The key to get data for;
* keys are defined in <a href="opensocial.Url.Field.html"><code>
- * Url.Field</code></a>
+ * Url.Field</code></a>.
* @param {Object.<opensocial.DataRequest.DataRequestFields, Object>}
* opt_params Additional
* <a href="opensocial.DataRequest.DataRequestFields.html">params</a>
* to pass to the request.
- * @return {string} The data
+ * @return {string} The data.
*/
opensocial.Url.prototype.getField = function(key, opt_params) {
return opensocial.Container.getField(this.fields_, key, opt_params);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/base.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/base.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/base.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/base.js Thu Oct 7 15:54:09 2010
@@ -62,43 +62,44 @@ window['log'] = os.log;
* Logs a warning to the console.
*/
os.warn = function(msg) {
- os.log("WARNING: " + msg);
+ os.log('WARNING: ' + msg);
};
/**
- * Is the object an array?
+ * Is the object an array?
*/
os.isArray = function(obj) {
- return typeof(obj) == "object" &&
- typeof(obj.length) == "number" &&
- typeof(obj.push) == "function";
+ return typeof(obj) == 'object' &&
+ typeof(obj.length) == 'number' &&
+ typeof(obj.push) == 'function';
};
/**
* Constants
* TODO(davidbyttow): Pull these out of os and make them global (optimization)
*/
-os.ATT_customtag = "customtag";
+os.ATT_customtag = 'customtag';
-os.VAR_my = "$my";
-os.VAR_cur = "$cur";
-os.VAR_node = "$node";
-os.VAR_msg = "Msg";
-os.VAR_parentnode = "$parentnode";
-os.VAR_uniqueId = "$uniqueId";
-os.VAR_identifierresolver = "$_ir";
-os.VAR_emptyArray = "$_ea";
-os.VAR_callbacks = "$callbacks_";
+os.VAR_my = '$my';
+os.VAR_cur = '$cur';
+os.VAR_node = '$node';
+os.VAR_msg = 'Msg';
+os.VAR_parentnode = '$parentnode';
+os.VAR_uniqueId = '$uniqueId';
+os.VAR_identifierresolver = '$_ir';
+os.VAR_emptyArray = '$_ea';
+os.VAR_callbacks = '$callbacks_';
/**
* Reusable empty array instance
- * IE6 PERF: To avoid creating empty arrays when they are needed.
+ * IE6 PERF: To avoid creating empty arrays when they are needed.
*/
os.EMPTY_ARRAY = [];
/**
* Regular expressions
* TODO(levik): Move all regular expressions here.
+ * @private
*/
os.regExps_ = {
ONLY_WHITESPACE: /^[ \t\n]*$/,
@@ -110,11 +111,11 @@ os.regExps_ = {
* @param {Element|TextNode|string} node DOM node containing the template data, or the
* string source.
* @param {string=} opt_id An optional ID for the new template.
- * @return {os.Template} A compiled Template object
+ * @return {os.Template} A compiled Template object.
*/
os.compileTemplate = function(node, opt_id) {
// Allow polymorphic behavior.
- if (typeof(node) == "string") {
+ if (typeof(node) == 'string') {
return os.compileTemplateString(node, opt_id);
}
@@ -134,8 +135,8 @@ os.compileTemplate = function(node, opt_
* Compile a template without requiring a DOM node.
* @param {string} src XML data to be compiled.
* @param {string=} opt_id An optional ID for the new template.
- * @param {Element=} opt_container An optional container DOM Element
- * to look for namespaces
+ * @param {Element=} opt_container An optional container DOM Element
+ * to look for namespaces.
* @return {opensocial.template.Template} A compiled Template object.
*/
os.compileTemplateString = function(src, opt_id, opt_container) {
@@ -146,7 +147,8 @@ os.compileTemplateString = function(src,
/**
* Render one compiled node with a context.
- * @return {Element} a DOM element containing the result of template processing
+ * @return {Element} a DOM element containing the result of template processing.
+ * @private
*/
os.renderTemplateNode_ = function(compiledNode, context) {
var template = domCloneElement(compiledNode);
@@ -181,11 +183,12 @@ os.createTemplateCustomTag = function(te
};
/**
- * Creates a map of the named children of a node. Lower-cased element names
- * (including transformed custom tags) are used as keys.
+ * Creates a map of the named children of a node. Lower-cased element names
+ * (including transformed custom tags) are used as keys.
* Where multiple elements share a name, the map value will be an array.
- * @param {Element} node The node whose children are to be mapped
+ * @param {Element} node The node whose children are to be mapped.
* @return {Object} A Map of Element names to Elements.
+ * @private
*/
os.computeChildMap_ = function(node) {
var map = {};
@@ -194,9 +197,9 @@ os.computeChildMap_ = function(node) {
if (!child.tagName) {
continue;
}
- var name = child.getAttribute(os.ATT_customtag);
+ var name = child.getAttribute(os.ATT_customtag);
if (name) {
- var parts = name.split(":");
+ var parts = name.split(':');
parts.length == 2 ? name = parts[1] : name = parts[0];
} else {
name = child.tagName;
@@ -232,18 +235,19 @@ os.createNodeAccessor_ = function(node)
/**
* A singleton instance of the current gadget Prefs - only instantiated if
* we are in a gadget container.
- * @type gadgets.Prefs
+ * @type {gadgets.Prefs}
+ * @private
*/
os.gadgetPrefs_ = null;
if (window['gadgets'] && window['gadgets']['Prefs']) {
os.gadgetPrefs_ = new window['gadgets']['Prefs']();
-};
+}
/**
* A convenience function to get a localized message by key from the shared
* gadgets.Prefs object.
- * @param {string} key The message key to get
- * @return {string|null} The localized message for a given key, or null if not
+ * @param {string} key The message key to get.
+ * @return {?string} The localized message for a given key, or null if not
* found, or not in the gadgets environment.
*/
os.getPrefMessage = function(key) {
@@ -266,7 +270,8 @@ os.customAttributes_ = {};
* a DOM node, the specified functor will be called.
* @param {string} attrName The name of the custom attribute.
* @param {function(string)} functor A function with signature
- * function({Element}, {string}, {Object}, {JSEvalContext})
+ * function({Element}, {string}, {Object}, {JSEvalContext}).
+ * @private
*/
os.registerAttribute_ = function(attrName, functor) {
os.customAttributes_[attrName] = functor;
@@ -294,37 +299,37 @@ os.doAttribute = function(node, attrName
os.doTag = function(node, ns, tag, data, context) {
var tagFunction = os.getCustomTag(ns, tag);
if (!tagFunction) {
- os.warn("Custom tag <" + ns + ":" + tag + "> not defined.");
+ os.warn('Custom tag <' + ns + ':' + tag + '> not defined.');
return;
}
var ctx = null;
// Process tag's inner content before processing the tag.
- for (var child = node.firstChild; child; child = child.nextSibling) {
+ for (var child = node.firstChild; child; child = child.nextSibling) {
if (child.nodeType == DOM_ELEMENT_NODE) {
- if (ctx == null) {
+ if (ctx == null) {
var selectInner = node[PROP_jstcache] ? node[PROP_jstcache][ATT_innerselect] : null;
if (selectInner) {
var data = context.jsexec(selectInner, node);
ctx = context.clone(data, 0, 0);
} else {
- ctx = context;
+ ctx = context;
}
}
jstProcess(ctx, child);
os.markNodeToSkip(child);
}
- }
-
+ }
+
ctx = context.clone({}, 0, 0);
var result = tagFunction.call(null, node, data, ctx);
- if (!result && typeof(result) != "string") {
- throw Error("Custom tag <" + ns + ":" + tag + "> failed to return anything.");
+ if (!result && typeof(result) != 'string') {
+ throw Error('Custom tag <' + ns + ':' + tag + '> failed to return anything.');
}
- if (typeof(result) == "string") {
- node.innerHTML = result ? result : "";
+ if (typeof(result) == 'string') {
+ node.innerHTML = result ? result : '';
} else if (os.isArray(result)) {
os.removeChildren(node);
for (var i = 0; i < result.length; i++) {
@@ -365,6 +370,7 @@ os.doTag = function(node, ns, tag, data,
/**
* Checks the current context, and if it's an element node, sets it to be used
* for future <os:renderAll/> operations.
+ * @private
*/
os.setContextNode_ = function(data, context) {
if (data.nodeType == DOM_ELEMENT_NODE) {
@@ -378,7 +384,7 @@ os.setContextNode_ = function(data, cont
* different context.
*/
os.markNodeToSkip = function(node) {
- node.setAttribute(ATT_skip, "true");
+ node.setAttribute(ATT_skip, 'true');
// Remove the attributes processed when jsskip is true
node.removeAttribute(ATT_select);
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/compiler.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/compiler.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/compiler.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/compiler.js Thu Oct 7 15:54:09 2010
@@ -96,15 +96,15 @@ os.operatorMap = {
};
/**
- * Shared regular expression to split a string into lexical parts. Quoted
- * strings are treated as tokens, so are identifiers and any characters between
+ * Shared regular expression to split a string into lexical parts. Quoted
+ * strings are treated as tokens, so are identifiers and any characters between
* them.
* In "foo + bar = 'baz - bing'", the tokens are
* ["foo", " + ", "bar", " = ", "'baz - bing'"]
*/
-os.regExps_.SPLIT_INTO_TOKENS =
- /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\w+|[^"'\w]+/g;
-
+os.regExps_.SPLIT_INTO_TOKENS =
+ /"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|\w+|[^"'\w]+/g;
+
/**
* Parses operator markup into JS code. See operator map above.
*
@@ -112,11 +112,12 @@ os.regExps_.SPLIT_INTO_TOKENS =
* use "<" or ">".
*
* @param {string} src The string snippet to parse.
+ * @private
*/
os.remapOperators_ = function(src) {
- return src.replace(os.regExps_.SPLIT_INTO_TOKENS,
- function (token) {
- return os.operatorMap.hasOwnProperty(token) ?
+ return src.replace(os.regExps_.SPLIT_INTO_TOKENS,
+ function(token) {
+ return os.operatorMap.hasOwnProperty(token) ?
os.operatorMap[token] : token;
});
};
@@ -125,6 +126,7 @@ os.remapOperators_ = function(src) {
* Remap variable references in the expression.
* @param {string} expr The expression to transform.
* @return {string} Transformed exression.
+ * @private
*/
os.transformVariables_ = function(expr) {
expr = os.replaceTopLevelVars_(expr);
@@ -134,6 +136,7 @@ os.transformVariables_ = function(expr)
/**
* Map of variables to transform
+ * @private
*/
os.variableMap_ = {
'my': os.VAR_my,
@@ -142,13 +145,14 @@ os.variableMap_ = {
'Cur': VAR_this,
'$cur': VAR_this,
'Top': VAR_top,
- 'Context': VAR_loop
+ 'Context': VAR_loop
};
/**
* Replace the top level variables
- * @param {string} text The expression
- * @return {string} Expression with replacements
+ * @param {string} text The expression.
+ * @return {string} Expression with replacements.
+ * @private
*/
os.replaceTopLevelVars_ = function(text) {
@@ -161,12 +165,12 @@ os.replaceTopLevelVars_ = function(text)
}
return text.replace(regex,
- function (whole, left, right) {
- if (os.variableMap_.hasOwnProperty(right)) {
- return left + os.variableMap_[right];
- } else {
- return whole;
- }
+ function(whole, left, right) {
+ if (os.variableMap_.hasOwnProperty(right)) {
+ return left + os.variableMap_[right];
+ } else {
+ return whole;
+ }
});
};
@@ -177,6 +181,7 @@ os.replaceTopLevelVars_ = function(text)
* for example one that looks up foo -> getFoo() -> get("foo").
*
* TODO: This should not be in compiler.
+ * @private
*/
os.identifierResolver_ = function(data, name) {
return data.hasOwnProperty(name) ? data[name] : ('get' in data ? data.get(name) : null);
@@ -199,8 +204,8 @@ os.setIdentifierResolver = function(reso
*
* TODO: This should not be in compiler.
*
- * @param {JsEvalContext|Object} context Context to get property from
- * @param {string} name Name of the property
+ * @param {JsEvalContext|Object} context Context to get property from.
+ * @param {string} name Name of the property.
* @return {Object|string}
*/
os.getFromContext = function(context, name, opt_default) {
@@ -213,20 +218,20 @@ os.getFromContext = function(context, na
// Is the context payload a DOM node?
if (context.data_.nodeType == DOM_ELEMENT_NODE) {
ret = os.getValueFromNode_(context.data_, name);
- if (ret == null) {
+ if (ret == null) {
// Set to undefined
ret = void(0);
}
} else {
ret = os.identifierResolver_(context.data_, name);
}
- if (typeof(ret) == "undefined") {
+ if (typeof(ret) == 'undefined') {
ret = os.identifierResolver_(context.vars_, name);
}
- if (typeof(ret) == "undefined" && context.vars_[os.VAR_my]) {
+ if (typeof(ret) == 'undefined' && context.vars_[os.VAR_my]) {
ret = os.getValueFromNode_(context.vars_[os.VAR_my], name);
}
- if (typeof(ret) == "undefined" && context.vars_[VAR_top]) {
+ if (typeof(ret) == 'undefined' && context.vars_[VAR_top]) {
ret = context.vars_[VAR_top][name];
}
} else if (context.nodeType == DOM_ELEMENT_NODE) {
@@ -235,17 +240,17 @@ os.getFromContext = function(context, na
} else {
ret = os.identifierResolver_(context, name);
}
- if (typeof(ret) == "undefined" || ret == null) {
- if (typeof(opt_default) != "undefined") {
+ if (typeof(ret) == 'undefined' || ret == null) {
+ if (typeof(opt_default) != 'undefined') {
ret = opt_default;
} else {
- ret = "";
+ ret = '';
}
- } else if (opt_default && os.isArray(opt_default) && !os.isArray(ret) &&
+ } else if (opt_default && os.isArray(opt_default) && !os.isArray(ret) &&
ret.list && os.isArray(ret.list)) {
// If we were trying to get an array, but got a JSON object with an
// array property "list", return that instead.
- ret = ret.list;
+ ret = ret.list;
}
return ret;
};
@@ -255,6 +260,7 @@ os.getFromContext = function(context, na
* @param {string} expr The expression snippet to parse.
* @param {string=} opt_default An optional default value reference (such as the
* literal string 'null').
+ * @private
*/
os.transformExpression_ = function(expr, opt_default) {
expr = os.remapOperators_(expr);
@@ -269,6 +275,7 @@ os.transformExpression_ = function(expr,
* A Map of special attribute names to change while copying attributes during
* compilation. The key is OST-spec attribute, while the value is JST attribute
* used to implement that feature.
+ * @private
*/
os.attributeMap_ = {
'if': ATT_display,
@@ -278,11 +285,12 @@ os.attributeMap_ = {
/**
* Appends a JSTemplate attribute value while maintaining previous values.
+ * @private
*/
os.appendJSTAttribute_ = function(node, attrName, value) {
var previousValue = node.getAttribute(attrName);
if (previousValue) {
- value = previousValue + ";" + value;
+ value = previousValue + ';' + value;
}
node.setAttribute(attrName, value);
};
@@ -299,6 +307,7 @@ os.appendJSTAttribute_ = function(node,
* TODO(levik): On IE, some properties/attributes might be case sensitive when
* set through script (such as "colSpan") - since they're not case sensitive
* when defined in HTML, we need to support this type of use.
+ * @private
*/
os.copyAttributes_ = function(from, to, opt_customTag) {
@@ -320,9 +329,9 @@ os.copyAttributes_ = function(from, to,
"', $this, $context)");
} else if (name == 'repeat') {
os.appendJSTAttribute_(to, ATT_eval,
- "os.setContextNode_($this, $context)");
+ 'os.setContextNode_($this, $context)');
}
- var outName = os.attributeMap_.hasOwnProperty(name) ?
+ var outName = os.attributeMap_.hasOwnProperty(name) ?
os.attributeMap_[name] : name;
var substitution =
(os.attributeMap_[name]) ?
@@ -349,7 +358,7 @@ os.copyAttributes_ = function(from, to,
outName = '.' + outName;
substitution = 'new Function(' + substitution + ')';
} else if (outName == 'selected' && to.tagName == 'OPTION') {
- // For the @selected attribute of an option, set the property
+ // For the @selected attribute of an option, set the property
// instead to allow false values to not mark the option selected.
outName = '.selected';
}
@@ -364,13 +373,13 @@ os.copyAttributes_ = function(from, to,
if (os.attributeMap_.hasOwnProperty(name)) {
// If the attribute value looks like "${expr}", just use the "expr".
if (value.length > 3 &&
- value.substring(0, 2) == '${' &&
- value.charAt(value.length - 1) == '}') {
+ value.substring(0, 2) == '${' &&
+ value.charAt(value.length - 1) == '}') {
value = value.substring(2, value.length - 1);
}
// In special attributes, default value is empty array for repeats,
// null for others
- value = os.transformExpression_(value,
+ value = os.transformExpression_(value,
name == 'repeat' ? os.VAR_emptyArray : 'null');
} else if (outName == 'class') {
// In IE, we must set className instead of class.
@@ -405,6 +414,7 @@ os.copyAttributes_ = function(from, to,
* are converted into markup recognizable by JSTemplate.
*
* TODO: process text nodes and attributes with ${} notation here
+ * @private
*/
os.compileNode_ = function(node) {
if (node.nodeType == DOM_TEXT_NODE) {
@@ -412,37 +422,37 @@ os.compileNode_ = function(node) {
return os.breakTextNode_(textNode);
} else if (node.nodeType == DOM_ELEMENT_NODE) {
var output;
- if (node.tagName.indexOf(":") > 0) {
- if (node.tagName == "os:Repeat") {
+ if (node.tagName.indexOf(':') > 0) {
+ if (node.tagName == 'os:Repeat') {
output = document.createElement(os.computeContainerTag_(node));
- output.setAttribute(ATT_select, os.parseAttribute_(node.getAttribute("expression")));
- var varAttr = node.getAttribute("var");
+ output.setAttribute(ATT_select, os.parseAttribute_(node.getAttribute('expression')));
+ var varAttr = node.getAttribute('var');
if (varAttr) {
os.appendJSTAttribute_(output, ATT_vars, varAttr + ': $this');
}
- var contextAttr = node.getAttribute("context");
+ var contextAttr = node.getAttribute('context');
if (contextAttr) {
os.appendJSTAttribute_(output, ATT_vars, contextAttr + ': ' + VAR_loop);
}
- os.appendJSTAttribute_(output, ATT_eval, "os.setContextNode_($this, $context)");
- } else if (node.tagName == "os:If") {
+ os.appendJSTAttribute_(output, ATT_eval, 'os.setContextNode_($this, $context)');
+ } else if (node.tagName == 'os:If') {
output = document.createElement(os.computeContainerTag_(node));
- output.setAttribute(ATT_display, os.parseAttribute_(node.getAttribute("condition")));
+ output.setAttribute(ATT_display, os.parseAttribute_(node.getAttribute('condition')));
} else {
- output = document.createElement("span");
+ output = document.createElement('span');
output.setAttribute(os.ATT_customtag, node.tagName);
- var custom = node.tagName.split(":");
- os.appendJSTAttribute_(output, ATT_eval, "os.doTag(this, \""
- + custom[0] + "\", \"" + custom[1] + "\", $this, $context)");
- var context = node.getAttribute("cur") || "{}";
+ var custom = node.tagName.split(':');
+ os.appendJSTAttribute_(output, ATT_eval, 'os.doTag(this, \"'
+ + custom[0] + '\", \"' + custom[1] + '\", $this, $context)');
+ var context = node.getAttribute('cur') || '{}';
output.setAttribute(ATT_innerselect, context);
// For os:Render, create a parent node reference.
// TODO: remove legacy support
- if (node.tagName == "os:render" || node.tagName == "os:Render" ||
- node.tagName == "os:renderAll" || node.tagName == "os:RenderAll") {
- os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ":" +
+ if (node.tagName == 'os:render' || node.tagName == 'os:Render' ||
+ node.tagName == 'os:renderAll' || node.tagName == 'os:RenderAll') {
+ os.appendJSTAttribute_(output, ATT_values, os.VAR_parentnode + ':' +
os.VAR_node);
}
@@ -485,14 +495,15 @@ os.compileNode_ = function(node) {
};
/**
- * Calculates the type of element best suited to encapsulating contents of a
- * <os:Repeat> or <os:If> tags. Inspects the element's children to see if one
+ * Calculates the type of element best suited to encapsulating contents of a
+ * <os:Repeat> or <os:If> tags. Inspects the element's children to see if one
* of the special cases should be used.
* "optgroup" for <option>s
* "tbody" for <tr>s
* "span" otherwise
- * @param {Element} element The repeater/conditional element
+ * @param {Element} element The repeater/conditional element.
* @return {stirng} Name of the node ot represent this repeater.
+ * @private
*/
os.computeContainerTag_ = function(element) {
var child = element.firstChild;
@@ -502,15 +513,15 @@ os.computeContainerTag_ = function(eleme
}
if (child) {
var tag = child.tagName.toLowerCase();
- if (tag == "option") {
- return "optgroup";
+ if (tag == 'option') {
+ return 'optgroup';
}
- if (tag == "tr") {
- return "tbody";
+ if (tag == 'tr') {
+ return 'tbody';
}
}
}
- return "span";
+ return 'span';
};
/**
@@ -518,11 +529,12 @@ os.computeContainerTag_ = function(eleme
*
* TODO(levik): A better way to do this.
*/
-os.ENTITIES = "<!ENTITY nbsp \" \">";
+os.ENTITIES = '<!ENTITY nbsp \" \">';
/**
* Creates an HTML node that's a shallow copy of an XML node
* (includes attributes).
+ * @private
*/
os.xmlToHtml_ = function(xmlNode) {
var htmlNode = document.createElement(xmlNode.tagName);
@@ -540,7 +552,7 @@ os.fireCallbacks = function(context) {
if (callback.onAttach) {
callback.onAttach();
// TODO(levik): Remove no-context handlers?
- } else if (typeof(callback) == "function") {
+ } else if (typeof(callback) == 'function') {
callback.apply({});
}
}
@@ -561,13 +573,16 @@ os.fireCallbacks = function(context) {
*
* @return {boolean} true if node only had text data and needs no further
* processing, false otherwise.
+ * @private
*/
os.processTextContent_ = function(fromNode, toNode) {
if (fromNode.childNodes.length == 1 &&
!toNode.getAttribute(os.ATT_customtag) &&
fromNode.firstChild.nodeType == DOM_TEXT_NODE) {
var substitution = os.parseAttribute_(fromNode.firstChild.data);
- if (substitution) {
+ if (toNode.nodeName == "SCRIPT") {
+ toNode.text = os.trimWhitespaceForIE_(fromNode.firstChild.data, true, true);
+ } if (substitution) {
toNode.setAttribute(ATT_content, substitution);
} else {
toNode.appendChild(document.createTextNode(
@@ -596,6 +611,7 @@ os.pushTextNode = function(array, text)
* @param {boolean=} opt_trimEnd Trim the end of the string.
* @return {string} The string with extra spaces removed on IE, original
* string on other browsers.
+ * @private
*/
os.trimWhitespaceForIE_ = function(string, opt_trimStart, opt_trimEnd) {
if (os.isIe) {
@@ -619,6 +635,7 @@ os.trimWhitespaceForIE_ = function(strin
*
* @return {Array.<Node>} An array of textNodes and Span Elements if variable
* substitutions were found, or an empty array if none were.
+ * @private
*/
os.breakTextNode_ = function(textNode) {
var substRex = os.regExps_.VARIABLE_SUBSTITUTION;
@@ -633,7 +650,7 @@ os.breakTextNode_ = function(textNode) {
if (!token) {
token = VAR_this;
}
- var tokenSpan = document.createElement("span");
+ var tokenSpan = document.createElement('span');
tokenSpan.setAttribute(ATT_content, os.transformExpression_(token));
nodes.push(tokenSpan);
match = text.match(substRex);
@@ -647,16 +664,17 @@ os.breakTextNode_ = function(textNode) {
};
/**
- * Transforms a literal string for inclusion into a variable evaluation
+ * Transforms a literal string for inclusion into a variable evaluation
* (a JS string):
* - Escapes single quotes.
* - Replaces newlines with spaces.
* - Substitutes variable references for literal semicolons.
* - Addes single quotes around the string.
+ * @private
*/
os.transformLiteral_ = function(string) {
return "'" + string.replace(/'/g, "\\'").
- replace(/\n/g, " ").replace(/;/g, "'+os.SEMICOLON+'") + "'";
+ replace(/\n/g, ' ').replace(/;/g, "'+os.SEMICOLON+'") + "'";
};
/**
@@ -664,7 +682,8 @@ os.transformLiteral_ = function(string)
* "Hello, " + user + "!".
*
* @param {string} value Attribute value to parse
- * TODO: Rename to parseExpression()
+ * TODO: Rename to parseExpression().
+ * @private
*/
os.parseAttribute_ = function(value) {
if (!value.length) {
@@ -686,7 +705,7 @@ os.parseAttribute_ = function(value) {
if (!expr) {
expr = VAR_this;
}
- parts.push('(' +
+ parts.push('(' +
os.transformExpression_(expr) + ')');
text = match[3];
match = text.match(substRex);
@@ -699,41 +718,42 @@ os.parseAttribute_ = function(value) {
};
/**
- * Returns a named value of a given node. First looks for a property, then
+ * Returns a named value of a given node. First looks for a property, then
* attribute, then a child node (or nodes). If multiple child nodes are found,
- * they will be returned in an array. If we find a single Node that is an
+ * they will be returned in an array. If we find a single Node that is an
* Element, it's children will be returned in an array.
- * @param {Element} node The DOM node to inspect
+ * @param {Element} node The DOM node to inspect.
* @param {string} name The name of the property/attribute/child node(s) to get.
- * The special value "*" means return all child Nodes
+ * The special value "*" means return all child Nodes.
* @return {string|Element|Object|Array.<Element>} The value as a String,
* Object, Element or array of Elements.
+ * @private
*/
os.getValueFromNode_ = function(node, name) {
- if (name == "*") {
+ if (name == '*') {
var children = [];
for (var child = node.firstChild; child; child = child.nextSibling) {
children.push(child);
}
return children;
}
-
+
// Since namespaces are not supported, strip off prefix.
if (name.indexOf(':') >= 0) {
name = name.substring(name.indexOf(':') + 1);
}
-
+
var ret = node[name];
- if (typeof(ret) == "undefined" || ret == null) {
+ if (typeof(ret) == 'undefined' || ret == null) {
ret = node.getAttribute(name);
}
-
- if (typeof(ret) != "undefined" && ret != null) {
+
+ if (typeof(ret) != 'undefined' && ret != null) {
// Process special cases where ret would be wrongly evaluated as "true"
- if (ret == "false") {
+ if (ret == 'false') {
ret = false;
- } else if (ret == "0") {
+ } else if (ret == '0') {
ret = 0;
}
return ret;
@@ -756,6 +776,7 @@ os.getValueFromNode_ = function(node, na
/**
* A map of identifiers that should not be wrapped
* (such as JS built-ins and special method names).
+ * @private
*/
os.identifiersNotToWrap_ = {};
os.identifiersNotToWrap_['true'] = true;
@@ -773,7 +794,7 @@ os.identifiersNotToWrap_[VAR_loop] = tru
* @param {string} ch Character to check.
* @return {boolean} This character can start an identifier.
*/
-os.canStartIdentifier= function(ch) {
+os.canStartIdentifier = function(ch) {
return (ch >= 'a' && ch <= 'z') ||
(ch >= 'A' && ch <= 'Z') ||
ch == '_' || ch == '$';
@@ -781,7 +802,7 @@ os.canStartIdentifier= function(ch) {
/**
* Checks if a character can be contained in a legal identifier name.
- * (A legal identifier in Templates can contain any character a legal
+ * (A legal identifier in Templates can contain any character a legal
* JS identifier can plus the colon - to support ${My.os:Foo})
* @param {string} ch Character to check.
* @return {string} This is a valid identifier character.
@@ -811,9 +832,10 @@ os.canBeInToken = function(ch) {
* @param {string=} opt_context A string expression to use for context.
* @param {string=} opt_default An optional default value reference (such as the
* literal string 'null').
+ * @private
*/
os.wrapSingleIdentifier = function(iden, opt_context, opt_default) {
- if (os.identifiersNotToWrap_.hasOwnProperty(iden) &&
+ if (os.identifiersNotToWrap_.hasOwnProperty(iden) &&
(!opt_context || opt_context == VAR_context)) {
return iden;
}
@@ -837,7 +859,7 @@ os.wrapIdentifiersInToken = function(tok
// such cases should be optimized.
if (token.substring(0, os.VAR_msg.length + 1) == (os.VAR_msg + '.') &&
os.gadgetPrefs_) {
- var key = token.split(".")[1];
+ var key = token.split('.')[1];
var msg = os.getPrefMessage(key) || '';
return os.parseAttribute_(msg) || os.transformLiteral_(msg);
}
@@ -858,7 +880,7 @@ os.wrapIdentifiersInToken = function(tok
} else {
buffer.length = 0;
buffer.push(os.wrapSingleIdentifier(parts[0], output));
- for (var j = 1; j < parts.length; j+= 3) {
+ for (var j = 1; j < parts.length; j += 3) {
buffer.push(parts[j]);
if (parts[j + 1]) {
buffer.push(os.wrapIdentifiersInExpression(parts[j + 1]));
@@ -868,7 +890,7 @@ os.wrapIdentifiersInToken = function(tok
output = buffer.join('');
}
}
- return output;
+ return output;
};
/**
@@ -1052,7 +1074,7 @@ os.breakUpParens = function(identifier)
}
} else {
if ((parenstart == '(' && ch == ')') ||
- (parenstart == '[' && ch == ']')) {
+ (parenstart == '[' && ch == ']')) {
parenlevel--;
if (parenlevel == 0) {
parts.push(buffer.join(''));
Modified: shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/container.js
URL: http://svn.apache.org/viewvc/shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/container.js?rev=1005506&r1=1005505&r2=1005506&view=diff
==============================================================================
--- shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/container.js (original)
+++ shindig/branches/2.0.x/features/src/main/javascript/features/opensocial-templates/container.js Thu Oct 7 15:54:09 2010
@@ -60,22 +60,25 @@ os.Container.domLoaded_ = false;
/**
* @type {number} The number of libraries needed to load.
+ * @private
*/
os.Container.requiredLibraries_ = 0;
/**
* @type {boolean} Determines whether all templates are automatically processed.
+ * @private
*/
os.Container.autoProcess_ = true;
/**
* @type {boolean} Has the document been processed already?
+ * @private
*/
os.Container.processed_ = false;
os.Container.disableAutoProcessing = function() {
if (os.Container.processed_) {
- throw Error("Document already processed.");
+ throw Error('Document already processed.');
}
os.Container.autoProcess_ = false;
};
@@ -95,7 +98,7 @@ os.Container.registerDomLoadListener_ =
var gadgets = window['gadgets'];
if (gadgets && gadgets.util) {
gadgets.util.registerOnLoadHandler(os.Container.onDomLoad_);
- } else if (typeof(navigator) != 'undefined' && navigator.product &&
+ } else if (typeof(navigator) != 'undefined' && navigator.product &&
navigator.product == 'Gecko') {
window.addEventListener('DOMContentLoaded', os.Container.onDomLoad_, false);
} if (window.addEventListener) {
@@ -122,7 +125,7 @@ os.Container.onDomLoad_ = function() {
if (os.Container.domLoaded_) {
return;
}
- for (var i = 0; i < os.Container.domLoadCallbacks_.length; i ++) {
+ for (var i = 0; i < os.Container.domLoadCallbacks_.length; i++) {
try {
os.Container.domLoadCallbacks_[i]();
} catch (e) {
@@ -198,7 +201,7 @@ os.Container.compileInlineTemplates = fu
/**
* @return {JsEvalContext} the default rendering context to use - this will
- * contain all available data.
+ * contain all available data.
*/
os.Container.getDefaultContext = function() {
if ((window['gadgets'] && gadgets.util.hasFeature('opensocial-data')) ||
@@ -248,7 +251,7 @@ os.Container.renderInlineTemplates = fun
// This template will render when the specified data is available.
var keys = requiredData.split(/[\, ]+/);
var callback = os.Container.createRenderClosure(template, el);
- if ("true" == node.getAttribute("autoUpdate")) {
+ if ('true' == node.getAttribute('autoUpdate')) {
if (rendered) {
opensocial.data.getDataContext().registerDeferredListener_(keys, callback);
} else {
@@ -274,31 +277,31 @@ os.Container.renderInlineTemplates = fun
* @param {Object=} opt_data Optional data to be used as to create a context.
* @param {Object=} opt_context Optional pre-constructed rendering context.
* @return {Function} The constructed closure.
-* TODO(davidbyttow): Move this into util.js
+* TODO(davidbyttow): Move this into util.js.
*/
os.Container.createRenderClosure = function(template, element, opt_data,
opt_context) {
- var closure = function() {
- var context = opt_context;
- var data = opt_data;
- if (!context) {
- if (data) {
- context = os.createContext(data);
- } else {
- context = os.Container.getDefaultContext();
- data = context.data_;
- }
- }
- template.renderInto(element, data, context);
- };
- return closure;
+ var closure = function() {
+ var context = opt_context;
+ var data = opt_data;
+ if (!context) {
+ if (data) {
+ context = os.createContext(data);
+ } else {
+ context = os.Container.getDefaultContext();
+ data = context.data_;
+ }
+ }
+ template.renderInto(element, data, context);
+ };
+ return closure;
};
/**
* Creates a closure that will hide a DOM element.
* @param {Element} element The DOM element to inject the template into.
* @return {Function} The constructed closure.
- * TODO(davidbyttow): Move this into util.js
+ * TODO(davidbyttow): Move this into util.js.
*/
os.Container.createHideElementClosure = function(element) {
var closure = function() {
@@ -362,27 +365,27 @@ os.Container.processGadget = function()
if (!window['gadgets']) {
return;
}
-
+
// Honor the "disableAutoProcessing" feature param.
- var params = gadgets.util.getFeatureParameters("opensocial-templates");
+ var params = gadgets.util.getFeatureParameters('opensocial-templates');
if (!params) {
return;
}
- if (params.disableAutoProcessing &&
- params.disableAutoProcessing.toLowerCase != "false") {
+ if (params.disableAutoProcessing &&
+ params.disableAutoProcessing.toLowerCase != 'false') {
os.Container.autoProcess_ = false;
}
-
+
// Honor the "requireLibrary" feature param(s).
if (params.requireLibrary) {
- if (typeof params.requireLibrary == "string") {
+ if (typeof params.requireLibrary == 'string') {
os.Container.addRequiredLibrary(params.requireLibrary);
} else {
for (var i = 0; i < params.requireLibrary.length; i++) {
os.Container.addRequiredLibrary(params.requireLibrary[i]);
}
}
- }
+ }
};
//Process the gadget when the page loads.
@@ -391,14 +394,15 @@ os.Container.executeOnDomLoad(os.Contain
/**
* A flag to determine if auto processing is waiting for libraries to load.
* @type {boolean}
+ * @private
*/
os.Container.processWaitingForLibraries_ = false;
/**
* Utility method which will automatically register all templates
* and render all that are inline.
- * @param {Object=} opt_data Optional JSON object to render templates against
- * @param {Document=} opt_doc Optional document to use instead of window.document
+ * @param {Object=} opt_data Optional JSON object to render templates against.
+ * @param {Document=} opt_doc Optional document to use instead of window.document.
*/
os.Container.processDocument = function(opt_data, opt_doc) {
if (os.Container.requiredLibraries_ > 0) {
@@ -423,21 +427,22 @@ os.Container.executeOnDomLoad(function()
/**
* A handler called when one of the required libraries loads.
+ * @private
*/
os.Container.onLibraryLoad_ = function() {
if (os.Container.requiredLibraries_ > 0) {
os.Container.requiredLibraries_--;
- if (os.Container.requiredLibraries_ == 0 &&
+ if (os.Container.requiredLibraries_ == 0 &&
os.Container.processWaitingForLibraries_) {
os.Container.processDocument();
}
- }
+ }
};
/**
* Adds a required library - the processing will be deferred until all
* required libraries have loaded.
- * @param {string} libUrl The URL of the library needed to process this page
+ * @param {string} libUrl The URL of the library needed to process this page.
*/
os.Container.addRequiredLibrary = function(libUrl) {
os.Container.requiredLibraries_++;
@@ -502,7 +507,7 @@ os.Container.registerTagElement_ = funct
if (!nsObj) {
// Auto Create a namespace for lazy registration.
nsObj = os.createNamespace(tagParts[0], null);
- }
+ }
nsObj[tagParts[1]] = os.createTemplateCustomTag(template);
}
}