You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by do...@apache.org on 2008/01/29 03:31:51 UTC
svn commit: r616143 [1/2] -
/incubator/shindig/trunk/features/opensocial-reference/
Author: doll
Date: Mon Jan 28 18:31:42 2008
New Revision: 616143
URL: http://svn.apache.org/viewvc?rev=616143&view=rev
Log:
Updated the shindig opensocial reference files to support 0.7
This is not reflected in the sample container yet, I'll get there tomorrow.
Added:
incubator/shindig/trunk/features/opensocial-reference/address.js
incubator/shindig/trunk/features/opensocial-reference/bodytype.js
incubator/shindig/trunk/features/opensocial-reference/email.js
incubator/shindig/trunk/features/opensocial-reference/enum.js
incubator/shindig/trunk/features/opensocial-reference/message.js
incubator/shindig/trunk/features/opensocial-reference/name.js
incubator/shindig/trunk/features/opensocial-reference/organization.js
incubator/shindig/trunk/features/opensocial-reference/phone.js
incubator/shindig/trunk/features/opensocial-reference/url.js
Removed:
incubator/shindig/trunk/features/opensocial-reference/surface.js
Modified:
incubator/shindig/trunk/features/opensocial-reference/activity.js
incubator/shindig/trunk/features/opensocial-reference/collection.js
incubator/shindig/trunk/features/opensocial-reference/container.js
incubator/shindig/trunk/features/opensocial-reference/datarequest.js
incubator/shindig/trunk/features/opensocial-reference/dataresponse.js
incubator/shindig/trunk/features/opensocial-reference/environment.js
incubator/shindig/trunk/features/opensocial-reference/opensocial.js
incubator/shindig/trunk/features/opensocial-reference/person.js
incubator/shindig/trunk/features/opensocial-reference/responseitem.js
Modified: incubator/shindig/trunk/features/opensocial-reference/activity.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/activity.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/activity.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/activity.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,14 +10,119 @@
* 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.
- *
- * @fileoverview Representation of an activity.
*/
-
/**
* @class
- * Base interface for all activity objects.
+ * Representation of an activity.
+ *
+ * <p>Activities are rendered with a title and an optional activity body.</p>
+ *
+ * <p>You may set the title and body directly as strings when calling
+ * opensocial.createActivity.</p>
+ *
+ * <p>However, it is usually beneficial to create activities using
+ * Activity Templates for the title and body. Activity Templates support:</p>
+ * <ul>
+ * <li>Internationalization</li>
+ * <li>Replacement variables in the message</li>
+ * <li>Activity Summaries, which are message variations used to summarize
+ * repeated activities that share something in common.</li>
+ * </ul>
+ *
+ * <p>Activity Templates are defined as messages in the gadget specification.
+ * To define messages, you create and reference message bundle XML files for
+ * each locale you support.</p>
+ *
+ * <p>Example module spec in gadget XML:
+ * <pre>
+ * <ModulePrefs title="ListenToThis">
+ * <Locale messages="http://www.listentostuff.com/messages.xml"/>
+ * <Locale lang="de" messages="http://www.listentostuff.com/messages-DE.xml"/>
+ * </ModulePrefs>
+ * </pre>
+ * </p>
+ *
+ * <p>Example message bundle:
+ * <pre>
+ * <messagebundle>
+ * <msg name="LISTEN_TO_THIS_SONG">
+ * ${Subject.DisplayName} told ${Owner.DisplayName} to
+ * listen to a song!
+ * </msg>
+ * </messagebundle>
+ * </pre>
+ * </p>
+ *
+ * <p>You can set custom key/value string pairs when posting an activity.
+ * These values will be used for variable substitution in the templates.</p>
+ * <p>Example JS call:
+ * <pre>
+ * var owner = ...;
+ * var viewer = ...;
+ * var activity = opensocial.newActivity('LISTEN_TO_THIS_SONG',
+ * {Song: 'Do That There - (Young Einstein hoo-hoo mix)',
+ * Artist: 'Lyrics Born', Subject: viewer, Owner: owner})
+ * </pre>
+ * </p>
+ *
+ * <p> Associated message:
+ * <pre>
+ * <msg name="LISTEN_TO_THIS_SONG">
+ * ${Subject.DisplayName} told ${Owner.DisplayName} to listen
+ * to ${Song} by ${Artist}
+ * </msg>
+ * </pre>
+ * </p>
+ *
+ * <p>People can also be set as values in key/value pairs when posting
+ * an activity. You can then reference the following fields on a person:</p>
+ * <ul>
+ * <li>${Person.DisplayName} The person's name</li>
+ * <li>${Person.Id} The user ID of the person</li>
+ * <li>${Person.ProfileUrl} The profile URL of the person</li>
+ * <li>${Person} This will show the display name, but containers may optionally
+ * provide special formatting, such as showing the name as a link</li>
+ * </ul>
+ *
+ * <p>Users will have many activities in their activity streams, and containers
+ * will not show every activity that is visible to a user. To help display
+ * large numbers of activities, containers will summarize a list of activities
+ * from a given source to a single entry.</p>
+ *
+ * <p>You can provide Activity Summaries to customize the text shown when
+ * multiple activities are summarized. If no customization is provided, a
+ * container may ignore your activities altogether or provide default text
+ * such as "Bob changed his status message + 20 other events like this."</p>
+ * <ul>
+ * <li>Activity Summaries will always summarize around a specific key in a
+ * key/value pair. This is so that the summary can say something concrete
+ * (this is clearer in the example below).</li>
+ * <li>Other variables will have synthetic "Count" variables created with
+ * the total number of items summarized.</li>
+ * <li>Message ID of the summary is the message ID of the main template + ":" +
+ * the data key</li>
+ * </ul>
+ *
+ * <p>Example summaries:
+ * <pre>
+ * <messagebundle>
+ * <msg name="LISTEN_TO_THIS_SONG:Artist">
+ * ${Subject.Count} of your friends have suggested listening to songs
+ * by ${Artist}!
+ * </msg>
+ * <msg name="LISTEN_TO_THIS_SONG:Song">
+ * ${Subject.Count} of your friends have suggested listening to ${Song}
+ * !</msg>
+ * <msg name="LISTEN_TO_THIS_SONG:Subject">
+ * ${Subject.DisplayName} has recommended ${Song.Count} songs to you.
+ * </msg>
+ * </messagebundle>
+ * </pre></p>
+ *
+ * <p>Activity Templates may only have the following HTML tags: <b>,
+ * <i>, <a>, <span>. The container also has the option
+ * to strip out these tags when rendering the activity.</p>
*
* <p>
* <b>See also:</b>
@@ -32,18 +137,15 @@
/**
* Base interface for all activity objects.
*
- * @param {opensocial.Activity.Template || String} title The title of an
- * activity; a template is recommended, but this field can also be a
- * string.
- * @param {Map.<opensocial.Activity.Field, Object>} opt_params Any other
- * fields that should be set on the activity object. All of the defined
- * Fields are supported.
+ * Private, see opensocial.createActivity() for usage.
+ *
+ * @param {Map.<opensocial.Activity.Field, Object>} params
+ * Parameters defining the activity.
* @private
* @constructor
*/
-opensocial.Activity = function(title, opt_params) {
- this.fields_ = opt_params || {};
- this.fields_[opensocial.Activity.Field.TITLE] = title;
+opensocial.Activity = function(params) {
+ this.fields_ = params;
};
@@ -52,6 +154,17 @@
* @class
* All of the fields that activities can have.
*
+ * <p>It is only required to set one of TITLE_ID or TITLE. In addition, if you
+ * are using any variables in your title or title template,
+ * you must set TEMPLATE_PARAMS.</p>
+ *
+ * <p>Other possible fields to set are: URL, MEDIA_ITEMS, BODY_ID, BODY,
+ * EXTERNAL_ID, PRIORITY, STREAM_TITLE, STREAM_URL, STREAM_SOURCE_URL,
+ * and STREAM_FAVICON_URL.</p>
+ *
+ * <p>Containers are only required to use TITLE_ID or TITLE, they may ignore
+ * additional parameters.</p>
+ *
* <p>
* <b>See also:</b>
* <a
@@ -62,31 +175,96 @@
*/
opensocial.Activity.Field = {
/**
- * A string ID
- * that can be permanently associated with this activity.
+ * <p>A string specifying the title template message ID in the gadget
+ * spec.</p>
+ *
+ * <p>The title is the primary text of an activity.</p>
+ *
+ * <p>Titles may only have the following HTML tags: <b> <i>,
+ * <a>, <span>.
+ * The container may ignore this formatting when rendering the activity.</p>
+ *
+ * @member opensocial.Activity.Field
+ */
+ TITLE_ID : 'titleId',
+
+ /**
+ * <p>A string specifying the primary text of an activity.</p>
+ *
+ * <p>Titles may only have the following HTML tags: <b> <i>,
+ * <a>, <span>.
+ * The container may ignore this formatting when rendering the activity.</p>
+ *
* @member opensocial.Activity.Field
*/
- ID : 'id',
+ TITLE : 'title',
/**
- * A string ID
- * associated with this activity that was generated by the
- * posting app externally.
+ * <p>A map of custom keys to values associated with this activity.
+ * These will be used for evaluation in templates.</p>
+ *
+ * <p>The data has type <code>Map<String, Object></code>. The
+ * object may be either a String or an opensocial.Person.</p>
+ *
+ * <p>When passing in a person with key PersonKey, can use the following
+ * replacement variables in the template:</p>
+ * <ul>
+ * <li>PersonKey.DisplayName - Display name for the person</li>
+ * <li>PersonKey.ProfileUrl. URL of the person's profile</li>
+ * <li>PersonKey.Id - The ID of the person</li>
+ * <li>PersonKey - Container may replace with DisplayName, but may also
+ * optionally link to the user.</li>
+ * </ul>
+ *
* @member opensocial.Activity.Field
*/
- EXTERNAL_ID : 'externalId',
+ TEMPLATE_PARAMS : 'templateParams',
/**
- * The string ID of the user who this activity is for.
+ * A string specifying the
+ * URL that represents this activity.
* @member opensocial.Activity.Field
*/
- USER_ID : 'userId',
+ URL : 'url',
/**
- * A string specifying the application that this activity is associated with.
+ * Any photos, videos, or images that should be associated
+ * with the activity. Higher priority ones are higher in the list.
+ * The data has type <code>Array<
+ * <a href="opensocial.Activity.MediaItem.html">MediaItem</a>></code>.
* @member opensocial.Activity.Field
*/
- APP_ID : 'appId',
+ MEDIA_ITEMS : 'mediaItems',
+
+ /**
+ * <p>A string specifying the body template message ID in the gadget spec.</p>
+ *
+ * <p>The body is an optional expanded version of an activity.</p>
+ *
+ * <p>Bodies may only have the following HTML tags: <b> <i>,
+ * <a>, <span>.
+ * The container may ignore this formatting when rendering the activity.</p>
+ *
+ * @member opensocial.Activity.Field
+ */
+ BODY_ID : 'bodyId',
+
+ /**
+ * <p>A string specifying an optional expanded version of an activity.</p>
+ *
+ * <p>Bodies may only have the following HTML tags: <b> <i>,
+ * <a>, <span>.
+ * The container may ignore this formatting when rendering the activity.</p>
+ *
+ * @member opensocial.Activity.Field
+ */
+ BODY : 'body',
+
+ /**
+ * An optional string ID generated by the posting application.
+ * @member opensocial.Activity.Field
+ */
+ EXTERNAL_ID : 'externalId',
/**
* A string specifing the title of the stream.
@@ -113,49 +291,40 @@
STREAM_FAVICON_URL : 'streamFaviconUrl',
/**
- * A string specifying the title of an activity;
- * the only field that is guaranteed
- * to display when rendering.
+ * A number between 0 and 1 representing the relative priority of
+ * this activity in relation to other activities from the same source
* @member opensocial.Activity.Field
*/
- TITLE : 'title',
+ PRIORITY : 'priority',
/**
- * A string specifying the full text of an activity.
+ * A string ID that is permanently associated with this activity.
+ * This value can not be set.
* @member opensocial.Activity.Field
*/
- BODY : 'body',
+ ID : 'id',
/**
- * A string specifying the
- * URL that represents this activity.
+ * The string ID of the user who this activity is for.
+ * This value can not be set.
* @member opensocial.Activity.Field
*/
- URL : 'url',
+ USER_ID : 'userId',
/**
- * Any photos, videos, or images that should be associated
- * with the activity. Higher priority ones are higher in the list.
- * The data has type <code>Array<
- * <a href="opensocial.Activity.MediaItem.html">MediaItem</a>></code>.
+ * A string specifying the application that this activity is associated with.
+ * This value can not be set.
* @member opensocial.Activity.Field
*/
- MEDIA_ITEMS : 'mediaItems',
+ APP_ID : 'appId',
/**
* A string specifying the time at which this activity took place
* in milliseconds since the epoch.
+ * This value can not be set.
* @member opensocial.Activity.Field
*/
- POSTED_TIME : 'postedTime',
-
- /**
- * A map of custom keys to values associated with this activity.
- * @private - not supported until templates exist
- * The data has type <code>Map<String, String></code>.
- * @member opensocial.Activity.Field
- */
- CUSTOM_VALUES : 'customValues'
+ POSTED_TIME : 'postedTime'
};
@@ -210,7 +379,7 @@
* A media item associated with an activity. Represents images, movies, and
* audio.
*
- * @param {String} mimetype The media's type
+ * @param {String} mimeType The media's type
* @param {String} url The media's location
* @param {Map.<opensocial.Activity.MediaItem.Field, Object>} opt_params
* Any other fields that should be set on the media item object.
Added: incubator/shindig/trunk/features/opensocial-reference/address.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/address.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/address.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/address.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2007 Google Inc.
+ *
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of an address.
+ */
+
+
+/**
+ * @class
+ * Base interface for all address objects.
+ *
+ * @name opensocial.Address
+ */
+
+
+/**
+ * Base interface for all address objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.Address = function(opt_params) {
+ this.fields_ = opt_params || {};
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that an address has. These are the supported keys for the
+ * <a href="opensocial.Address.html#getField">Address.getField()</a> method.
+ *
+ * @name opensocial.Address.Field
+ */
+opensocial.Address.Field = {
+ /**
+ * The address type or label. Examples: work, my favorite store, my house, etc
+ * Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ TYPE : 'type',
+
+ /**
+ * If the container does not have structured addresses in its data store,
+ * this field will return the unstructured address that the user entered. Use
+ * opensocial.getEnvironment().supportsField to see which fields are
+ * supported. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ UNSTRUCTURED_ADDRESS : 'unstructuredAddress',
+
+ /**
+ * The po box of the address if there is one. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ PO_BOX : 'poBox',
+
+ /**
+ * The street address. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ STREET_ADDRESS : 'streetAddress',
+
+ /**
+ * The extended street address. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ EXTENDED_ADDRESS : 'extendedAddress',
+
+ /**
+ * The region. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ REGION : 'region',
+
+ /**
+ * The locality. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ LOCALITY : 'locality',
+
+ /**
+ * The postal code. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ POSTAL_CODE : 'postalCode',
+
+ /**
+ * The country. Specified as a String.
+ *
+ * @member opensocial.Address.Field
+ */
+ COUNTRY : 'country',
+
+ /**
+ * The latitude. Specified as a Number.
+ *
+ * @member opensocial.Address.Field
+ */
+ LATITUDE : 'latitude',
+
+ /**
+ * The longitude. Specified as a Number.
+ *
+ * @member opensocial.Address.Field
+ */
+ LONGITUDE : 'longitude'
+};
+
+
+/**
+ * Gets data for this body type that is associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * keys are defined in <a href="opensocial.Address.Field.html"><code>
+ * Address.Field</code></a>
+ * @return {String} The data
+ */
+opensocial.Address.prototype.getField = function(key) {
+ return this.fields_[key];
+};
Added: incubator/shindig/trunk/features/opensocial-reference/bodytype.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/bodytype.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/bodytype.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/bodytype.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of a body type.
+ */
+
+
+/**
+ * @class
+ * Base interface for all body type objects.
+ *
+ * @name opensocial.BodyType
+ */
+
+
+/**
+ * Base interface for all body type objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.BodyType = function(opt_params) {
+ this.fields_ = opt_params || {};
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that a body type has. These are the supported keys for the
+ * <a href="opensocial.BodyType.html#getField">BodyType.getField()</a>
+ * method.
+ *
+ * @name opensocial.BodyType.Field
+ */
+opensocial.BodyType.Field = {
+ /**
+ * The build of the person's body, specified as a string.
+ * Not supported by all containers.
+ * @member opensocial.BodyType.Field
+ */
+ BUILD : 'build',
+
+ /**
+ * The height of the person in meters, specified as a number.
+ * Not supported by all containers.
+ * @member opensocial.BodyType.Field
+ */
+ HEIGHT : 'height',
+
+ /**
+ * The weight of the person in kilograms, specified as a number.
+ * Not supported by all containers.
+ * @member opensocial.BodyType.Field
+ */
+ WEIGHT : 'weight',
+
+ /**
+ * The eye color of the person, specified as a string.
+ * Not supported by all containers.
+ * @member opensocial.BodyType.Field
+ */
+ EYE_COLOR : 'eyeColor',
+
+ /**
+ * The hair color of the person, specified as a string.
+ * Not supported by all containers.
+ * @member opensocial.BodyType.Field
+ */
+ HAIR_COLOR : 'hairColor'
+};
+
+
+/**
+ * Gets data for this body type that is associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * keys are defined in <a href="opensocial.BodyType.Field.html"><code>
+ * BodyType.Field</code></a>
+ * @return {String} The data
+ */
+opensocial.BodyType.prototype.getField = function(key) {
+ return this.fields_[key];
+};
Modified: incubator/shindig/trunk/features/opensocial-reference/collection.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/collection.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/collection.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/collection.js Mon Jan 28 18:31:42 2008
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Collection of multiple objects with useful accessors.
*
* May also represent subset of a larger collection (i.e. page 1 of 10), and
Modified: incubator/shindig/trunk/features/opensocial-reference/container.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/container.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/container.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/container.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Interface for containers of people functionality.
*/
@@ -66,6 +68,60 @@
*/
opensocial.Container.prototype.getEnvironment = function() {};
+/**
+ * Requests the container to send a specific message to the specified users. If
+ * the container does not support this method the callback will be called with a
+ * opensocial.ResponseItem. The response item will have its error code set to
+ * NOT_IMPLEMENTED.
+ *
+ * @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.
+ * @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. This function will be passed one parameter, an
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, the
+ * message was sent. If there was an error, you can use the response item's
+ * getErrorCode method to determine how to proceed. The data on the response
+ * item will not be set.
+ *
+ * @member opensocial
+ * @private
+ */
+opensocial.Container.prototype.requestSendMessage = function(recipients,
+ message, opt_callback) {};
+
+
+/**
+ * Requests the container to share this gadget with the specified users. If the
+ * container does not support this method the callback will be called with a
+ * opensocial.ResponseItem. The response item will have its error code set to
+ * NOT_IMPLEMENTED.
+ *
+ * @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} 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} 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
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, the
+ * sharing request was sent. If there was an error, you can use the response
+ * item's getErrorCode method to determine how to proceed. The data on the
+ * response item will not be set.
+ *
+ * @member opensocial
+ * @private
+ */
+opensocial.Container.prototype.requestShareApp = function(recipients, reason,
+ opt_callback) {};
+
/**
* Request for the container to make the specified person not a friend.
@@ -115,36 +171,6 @@
/**
- * Attempts to navigate to this gadget on a different surface. If the container
- * supports parameters will pass the optional parameters along to the gadget on
- * the new surface.
- *
- * @param {opensocial.Surface} surface The surface to navigate to
- * @param {Map.<String, String>} opt_params Params to pass to the gadget after
- * it has been navigated to on the surface
- *
- * @private
- */
-opensocial.Container.prototype.requestNavigateTo = function(surface,
- opt_params) {};
-
-
-/**
- * Fetches content from the provided URL and feeds that content into the
- * callback function.
- * @param {String} url The URL where the content is located
- * @param {Function} callback The function to call with the data from the URL
- * once it is fetched
- * @param {Map.<opensocial.ContentRequestParameters, Object>} opt_params
- * Additional parameters to pass to the request
- *
- * @private
- */
-opensocial.Container.prototype.makeRequest = function(url, callback,
- opt_params) {};
-
-
-/**
* Calls the callback function with a dataResponse object containing the data
* asked for in the dataRequest object.
*
@@ -189,47 +215,6 @@
/**
- * Used to request global app data.
- * When processed, returns a Map<String, String> object.
- *
- * @param {Array.<String> | String} keys The keys you want data for. This
- * can be an array of key names, a single key name, or "*" to mean
- * "all keys".
- * @return {Object} a request object
- * @private
- */
-opensocial.Container.prototype.newFetchGlobalAppDataRequest = function(
- keys) {};
-
-
-/**
- * Used to request instance app data.
- * When processed, returns a Map<String, String> object.
- *
- * @param {Array.<String> | String} keys The keys you want data for. This
- * can be an array of key names, a single key name, or "*" to mean
- * "all keys".
- * @return {Object} a request object
- * @private
- */
-opensocial.Container.prototype.newFetchInstanceAppDataRequest = function(
- keys) {};
-
-
-/**
- * Used to request an update of an app instance field from the server.
- * When processed, does not return any data.
- *
- * @param {String} key The name of the key
- * @param {String} value The value
- * @return {Object} a request object
- * @private
- */
-opensocial.Container.prototype.newUpdateInstanceAppDataRequest = function(key,
- value) {};
-
-
-/**
* Used to request app data for the given people.
* When processed, returns a Map<person id, Map<String, String>>
* object.
@@ -341,6 +326,27 @@
/**
+ * Creates a media item associated with an activity.
+ * Represents images, movies, and audio.
+ * Used when creating activities on the server.
+ *
+ * @param {String} body The main text of the message.
+ * @param {Map.<opensocial.Message.Field, Object>} opt_params
+ * 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
+ *
+ * @return {opensocial.Message} The new
+ * <a href="opensocial.Message.html">message</a> object
+ * @member opensocial
+ */
+opensocial.Container.prototype.newMessage = function(body, opt_params) {
+ return new opensocial.Message(body, opt_params);
+};
+
+
+/**
* Creates a new response item with caja support if enabled.
* @return {opensocial.ResponseItem} the response item object
* @private
@@ -381,22 +387,9 @@
* @return {opensocial.Environment} the environment object
* @private
*/
-opensocial.Container.prototype.newEnvironment = function(domain, surface,
- supportedSurfaces, supportedFields, opt_params) {
- return new opensocial.Environment(domain, surface, supportedSurfaces,
- supportedFields, opt_params);
-};
-
-
-/**
- * Get a new surface object.
- *
- * @return {opensocial.Surface} the surface object
- * @private
- */
-opensocial.Container.prototype.newSurface = function(name,
- opt_isPrimaryContent) {
- return new opensocial.Surface(name, opt_isPrimaryContent);
+opensocial.Container.prototype.newEnvironment = function(domain,
+ supportedFields) {
+ return new opensocial.Environment(domain, supportedFields);
};
@@ -416,6 +409,7 @@
*/
var caja;
var ___;
+var html_sanitize;
/**
* Enable Caja support
@@ -429,6 +423,7 @@
___ = window["___"];
caja = window["caja"];
+ html_sanitize = window["html_sanitize"];
var outers = caja.copy(___.sharedOuters);
@@ -446,7 +441,6 @@
outers.document = function() {};
outers.document.getElementById = function(id) {
- // TODO(benl): namespace-ize id.
var element = document.getElementById("DOM-PREFIX-" + id);
if (element !== null) {
___.useSetHandler(element, 'innerHTML', function(html) {
@@ -472,14 +466,16 @@
// Adding all of the available opensocial calls as defined in the spec
outers.opensocial = opensocial;
+ ___.allowCall(outers.opensocial, 'requestSendMessage');
+ ___.allowCall(outers.opensocial, 'requestShareApp');
___.allowCall(outers.opensocial, 'requestCreateActivity');
___.allowCall(outers.opensocial, 'hasPermission');
___.allowCall(outers.opensocial, 'requestPermission');
- ___.allowCall(outers.opensocial, 'requestNavigateTo');
___.allowCall(outers.opensocial, 'getEnvironment');
___.allowCall(outers.opensocial, 'newDataRequest');
___.allowCall(outers.opensocial, 'newActivity');
___.allowCall(outers.opensocial, 'newActivityMediaItem');
+ ___.allowCall(outers.opensocial, 'newMessage');
___.allowCall(opensocial.Collection.prototype, 'getById');
___.allowCall(opensocial.Collection.prototype, 'size');
@@ -498,6 +494,14 @@
___.allowCall(opensocial.Person.prototype, 'isViewer');
___.allowCall(opensocial.Person.prototype, 'isOwner');
+ ___.allowCall(opensocial.Address.prototype, 'getField');
+ ___.allowCall(opensocial.BodyType.prototype, 'getField');
+ ___.allowCall(opensocial.Email.prototype, 'getField');
+ ___.allowCall(opensocial.Name.prototype, 'getField');
+ ___.allowCall(opensocial.Organization.prototype, 'getField');
+ ___.allowCall(opensocial.Phone.prototype, 'getField');
+ ___.allowCall(opensocial.Url.prototype, 'getField');
+
___.allowCall(opensocial.Activity.prototype, 'getId');
___.allowCall(opensocial.Activity.prototype, 'getField');
@@ -516,22 +520,18 @@
___.allowCall(opensocial.DataRequest.prototype, 'send');
___.allowCall(opensocial.DataRequest.prototype, 'newFetchPersonRequest');
___.allowCall(opensocial.DataRequest.prototype, 'newFetchPeopleRequest');
- ___.allowCall(opensocial.DataRequest.prototype, 'newFetchGlobalAppDataRequest');
- ___.allowCall(opensocial.DataRequest.prototype, 'newFetchInstanceAppDataRequest');
- ___.allowCall(opensocial.DataRequest.prototype, 'newUpdateInstanceAppDataRequest');
___.allowCall(opensocial.DataRequest.prototype, 'newFetchPersonAppDataRequest');
___.allowCall(opensocial.DataRequest.prototype, 'newUpdatePersonAppDataRequest');
___.allowCall(opensocial.DataRequest.prototype, 'newFetchActivitiesRequest');
___.allowCall(opensocial.Environment.prototype, 'getDomain');
- ___.allowCall(opensocial.Environment.prototype, 'getSurface');
- ___.allowCall(opensocial.Environment.prototype, 'getSupportedSurfaces');
- ___.allowCall(opensocial.Environment.prototype, 'getParams');
___.allowCall(opensocial.Environment.prototype, 'supportsField');
- ___.allowCall(opensocial.Environment.prototype, 'hasCapability');
- ___.allowCall(opensocial.Surface.prototype, 'getName');
- ___.allowCall(opensocial.Surface.prototype, 'isPrimaryContent');
+ ___.allowCall(opensocial.Enum.prototype, 'getKey');
+ ___.allowCall(opensocial.Enum.prototype, 'getDisplayValue');
+
+ ___.allowCall(opensocial.Message.prototype, 'getField');
+ ___.allowCall(opensocial.Message.prototype, 'setField');
var moduleHandler = ___.freeze({
getOuters: ___.simpleFunc(function() { return outers; }),
@@ -545,6 +545,7 @@
* Default taming is to return obj itself. Depending on
* other taming decisions, it may be more appropriate to
* return an interposed wrapper.
+ * @private
*/
function plugin_tamed(obj) { return obj; }
Modified: incubator/shindig/trunk/features/opensocial-reference/datarequest.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/datarequest.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/datarequest.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/datarequest.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Object used to request social information from the container.
* This includes data for friends, profiles, app data, and activities.
*
@@ -22,7 +24,7 @@
/**
* @class
* <p>
- * Creates an item to request social information from the container.
+ * Used to request social information from the container.
* This includes data for friends, profiles, app data, and activities.
* All apps that require access to people information
* should send a DataRequest.
@@ -372,52 +374,6 @@
/**
- * Creates an item to request global app data.
- * When processed, returns a Map<String, String> object.
- *
- * @param {Array.<String> | String} keys The keys you want data for; this
- * can be an array of key names, a single key name, or "*" to mean
- * "all keys"
- * @return {Object} A request object
- */
-opensocial.DataRequest.prototype.newFetchGlobalAppDataRequest = function(keys) {
- return opensocial.Container.get().newFetchGlobalAppDataRequest(
- this.asArray(keys));
-};
-
-
-/**
- * Creates an item to request instance app data.
- * When processed, returns a Map<String, String> object.
- *
- * @param {Array.<String> | String} keys The keys you want data for; this
- * can be an array of key names, a single key name, or "*" to mean
- * "all keys"
- * @return {Object} A request object
- */
-opensocial.DataRequest.prototype.newFetchInstanceAppDataRequest =
- function(keys) {
- return opensocial.Container.get().newFetchInstanceAppDataRequest(
- this.asArray(keys));
-};
-
-
-/**
- * Creates an item to request an update of an app instance field from the
- * server. When processed, does not return any data.
- *
- * @param {String} key The name of the key. This may only contain alphanumeric
- * (A-Za-z0-9) characters, underscore(_), dot(.) or dash(-).
- * @param {String} value The value
- * @return {Object} A request object
- */
-opensocial.DataRequest.prototype.newUpdateInstanceAppDataRequest = function(key,
- value) {
- return opensocial.Container.get().newUpdateInstanceAppDataRequest(key, value);
-};
-
-
-/**
* Creates an item to request app data for the given people.
* When processed, returns a Map<
* <a href="opensocial.DataRequest.PersonId.html">PersonId</a>,
@@ -464,6 +420,7 @@
* <a href="opensocial.DataRequest.html#newFetchActivitiesRequest">
* <code>DataRequest.newFetchActivitiesRequest()</code></a>.
* @name opensocial.DataRequest.ActivityRequestFields
+ * @private
*/
opensocial.DataRequest.ActivityRequestFields = {
/**
@@ -488,9 +445,8 @@
* a single ID within one of those groups.
* @param {Map.<opensocial.DataRequest.ActivityRequestFields, Object>}
* opt_params
- * Additional
- * <a href="opensocial.DataRequest.ActivityRequestFields.html">parameters</a>
- * to pass to the request
+ * Additional parameters
+ * to pass to the request; not currently used
* @return {Object} A request object
*/
opensocial.DataRequest.prototype.newFetchActivitiesRequest = function(idSpec,
Modified: incubator/shindig/trunk/features/opensocial-reference/dataresponse.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/dataresponse.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/dataresponse.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/dataresponse.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview DataResponse containing information about
* friends, contacts, profile, app data, and activities.
*
Added: incubator/shindig/trunk/features/opensocial-reference/email.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/email.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/email.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/email.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,75 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of an email.
+ */
+
+
+/**
+ * @class
+ * Base interface for all email objects.
+ *
+ * @name opensocial.Email
+ */
+
+
+/**
+ * Base interface for all email objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.Email = function(opt_params) {
+ this.fields_ = opt_params || {};
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that an email has. These are the supported keys for the
+ * <a href="opensocial.Email.html#getField">Email.getField()</a> method.
+ *
+ * @name opensocial.Email.Field
+ */
+opensocial.Email.Field = {
+ /**
+ * The email type or label, specified as a String.
+ * Examples: work, my favorite store, my house, etc.
+ *
+ * @member opensocial.Email.Field
+ */
+ TYPE : 'type',
+
+ /**
+ * The email address, specified as a String.
+ *
+ * @member opensocial.Email.Field
+ */
+ ADDRESS : 'address'
+};
+
+
+/**
+ * Gets data for this body type that is associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * keys are defined in <a href="opensocial.Email.Field.html"><code>
+ * Email.Field</code></a>
+ * @return {String} The data
+ */
+opensocial.Email.prototype.getField = function(key) {
+ return this.fields_[key];
+};
Added: incubator/shindig/trunk/features/opensocial-reference/enum.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/enum.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/enum.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/enum.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,171 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of an enum.
+ */
+
+
+/**
+ * @class
+ * Base interface for all enum objects.
+ * This class allows containers to use constants for fields that are usually
+ * have a common set of values.
+ * There are two main ways to use this class.
+ *
+ * <p>
+ * If your gadget just wants to display how much of a smoker someone is,
+ * it can simply use:
+ * </p>
+ *
+ * <pre>html = "This person smokes: " + person.getField('smoker').getValue();</pre>
+ *
+ * <p>
+ * This value field will be correctly set up by the container. This is a place
+ * where the container can even localize the value for the gadget so that it
+ * always shows the right thing.
+ * </p>
+ *
+ * <p>
+ * If your gadget wants to have some logic around the smoker
+ * field it can use:
+ * </p>
+ *
+ * <pre>if (person.getField('smoker').getKey() != "NO") { //gadget logic here }</pre>
+ *
+ * <p class="note">
+ * <b>Note:</b>
+ * The key may be null if the person's smoker field cannot be coerced
+ * into one of the standard enum types.
+ * The value, on the other hand, is never null.
+ * </p>
+ *
+ * @name opensocial.Enum
+ */
+
+
+/**
+ * Base interface for all enum objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.Enum = function(key, displayValue) {
+ this.key = key;
+ this.displayValue = displayValue;
+};
+
+
+/**
+ * Use this for logic within your gadget. If they key is null then the value
+ * does not fit in the defined enums.
+ *
+ * @return {String} The enum's key. This should be one of the defined enums
+ * below.
+ */
+opensocial.Enum.prototype.getKey = function() {
+ return this.key;
+};
+
+
+/**
+ * The value of this enum. This will be a user displayable string. If the
+ * container supports localization, the string will be localized.
+ *
+ * @return {String} The enum's value.
+ */
+opensocial.Enum.prototype.getDisplayValue = function() {
+ return this.displayValue;
+};
+
+
+/**
+ * @static
+ * @class
+ * The enum keys used by the smoker field.
+ * <p><b>See also:</b>
+ * <a href="opensocial.Person.Field.html">
+ * opensocial.Person.Field.Smoker</a>
+ * </p>
+ *
+ * @name opensocial.Enum.Smoker
+ */
+opensocial.Enum.Smoker = {
+ /** @member opensocial.Enum.Smoker */
+ NO : 'NO',
+ /** @member opensocial.Enum.Smoker */
+ YES : 'YES',
+ /** @member opensocial.Enum.Smoker */
+ SOCIALLY : 'SOCIALLY',
+ /** @member opensocial.Enum.Smoker */
+ OCCASIONALLY : 'OCCASIONALLY',
+ /** @member opensocial.Enum.Smoker */
+ REGULARLY : 'REGULARLY',
+ /** @member opensocial.Enum.Smoker */
+ HEAVILY : 'HEAVILY',
+ /** @member opensocial.Enum.Smoker */
+ QUITTING : 'QUITTING',
+ /** @member opensocial.Enum.Smoker */
+ QUIT : 'QUIT'
+};
+
+
+/**
+ * @static
+ * @class
+ * The enum keys used by the drinker field.
+ * <p><b>See also:</b>
+ * <a href="opensocial.Person.Field.html">
+ * opensocial.Person.Field.Drinker</a>
+ * </p>
+ *
+ * @name opensocial.Enum.Drinker
+ */
+opensocial.Enum.Drinker = {
+ /** @member opensocial.Enum.Drinker */
+ NO : 'NO',
+ /** @member opensocial.Enum.Drinker */
+ YES : 'YES',
+ /** @member opensocial.Enum.Drinker */
+ SOCIALLY : 'SOCIALLY',
+ /** @member opensocial.Enum.Drinker */
+ OCCASIONALLY : 'OCCASIONALLY',
+ /** @member opensocial.Enum.Drinker */
+ REGULARLY : 'REGULARLY',
+ /** @member opensocial.Enum.Drinker */
+ HEAVILY : 'HEAVILY',
+ /** @member opensocial.Enum.Drinker */
+ QUITTING : 'QUITTING',
+ /** @member opensocial.Enum.Drinker */
+ QUIT : 'QUIT'
+};
+
+
+/**
+ * @static
+ * @class
+ * The enum keys used by the gender field.
+ * <p><b>See also:</b>
+ * <a href="opensocial.Person.Field.html">
+ * opensocial.Person.Field.Gender</a>
+ * </p>
+ *
+ * @name opensocial.Enum.Gender
+ */
+opensocial.Enum.Gender = {
+ /** @member opensocial.Enum.Gender */
+ MALE : 'MALE',
+ /** @member opensocial.Enum.Gender */
+ FEMALE : 'FEMALE'
+};
Modified: incubator/shindig/trunk/features/opensocial-reference/environment.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/environment.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/environment.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/environment.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Representation of a environment.
*/
@@ -31,24 +33,15 @@
* Base interface for all environment objects.
*
* @param {String} domain The current domain
- * @param {opensocial.Surface} surface The current surface
- * @param {Array.<Surface>} supportedSurfaces
- * The surfaces supported by this container
* @param {Map.<String, Map.<String, Boolean>>} supportedFields
* The fields supported by this container
- * @param {Map.<String, String>} opt_params
- * The params this gadget has access to
*
* @private
* @constructor
*/
-opensocial.Environment = function(domain, surface, supportedSurfaces,
- supportedFields, opt_params) {
+opensocial.Environment = function(domain, supportedFields) {
this.domain = domain;
- this.surface = surface;
- this.supportedSurfaces = supportedSurfaces;
this.supportedFields = supportedFields;
- this.params = opt_params || {};
};
@@ -64,38 +57,6 @@
/**
- * Returns the current surface.
- *
- * @return {opensocial.Surface}
- * The current <a href="opensocial.Surface.html">surface</a>
- */
-opensocial.Environment.prototype.getSurface = function() {
- return this.surface;
-};
-
-
-/**
- * Returns an array of all the supported surfaces.
- *
- * @return {Array.<opensocial.Surface>}
- * All supported <a href="opensocial.Surface.html">surfaces</a>
- */
-opensocial.Environment.prototype.getSupportedSurfaces = function() {
- return this.supportedSurfaces;
-};
-
-
-/**
- * Returns the parameters passed into this gadget.
- *
- * @return {Map.<String, String>} The parameter map
- */
-opensocial.Environment.prototype.getParams = function() {
- return this.params;
-};
-
-
-/**
* @static
* @class
*
@@ -116,11 +77,55 @@
/**
* @member opensocial.Environment.ObjectType
*/
+ ADDRESS : 'address',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ BODY_TYPE : 'bodyType',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ EMAIL : 'email',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ NAME : 'name',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ ORGANIZATION : 'organization',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ PHONE : 'phone',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ URL : 'url',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
ACTIVITY : 'activity',
/**
* @member opensocial.Environment.ObjectType
*/
- ACTIVITY_MEDIA_ITEM : 'activityMediaItem'
+ ACTIVITY_MEDIA_ITEM : 'activityMediaItem',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ MESSAGE : 'message',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ MESSAGE_TYPE : 'messageType',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ SORT_ORDER : 'sortOrder',
+ /**
+ * @member opensocial.Environment.ObjectType
+ */
+ FILTER_TYPE : 'filterType'
};
@@ -138,26 +143,4 @@
fieldName) {
var supportedObjectFields = this.supportedFields[objectType] || [];
return !!supportedObjectFields[fieldName];
-};
-
-
-/**
- * Returns true if the specified function is supported in this container.
- *
- * @param {String} functionName The function name
- * @return {Boolean} True if this container supports the function
- */
-opensocial.Environment.prototype.hasCapability = function(functionName) {
- var splitNames = functionName.split(".");
- var parentObject = window;
-
- for (var i = 0; i < splitNames.length; i++) {
- var childObject = parentObject[splitNames[i]];
- if (!childObject) {
- return false;
- } else {
- parentObject = childObject;
- }
- }
- return true;
-};
+};
\ No newline at end of file
Added: incubator/shindig/trunk/features/opensocial-reference/message.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/message.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/message.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/message.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,145 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of a message.
+ */
+
+
+/**
+ * @class
+ * Base interface for all message objects.
+ *
+ * <p>
+ * <b>See also:</b>
+ * <a href="opensocial.html#newMessage">opensocial.newMessage()</a>,
+ * <a href="opensocial.html#requestSendMessage">
+ * opensocial.requestSendMessage()</a>
+ *
+ * @name opensocial.Message
+ */
+
+
+/**
+ * Base interface for all message objects.
+ *
+ * @param {String} body The main text of the message.
+ * @param {Map.<opensocial.Message.Field, Object>} opt_params Any other
+ * fields that should be set on the message object. All of the defined
+ * Fields are supported.
+ * @private
+ * @constructor
+ */
+opensocial.Message = function(body, opt_params) {
+ this.fields_ = opt_params || {};
+ this.fields_[opensocial.Message.Field.BODY] = body;
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that messages can have.
+ *
+ * <p>
+ * <b>See also:</b>
+ * <a
+ * href="opensocial.Message.html#getField">opensocial.Message.getField()</a>
+ * </p>
+ *
+ * @name opensocial.Message.Field
+ */
+opensocial.Message.Field = {
+ /**
+ * The title of the message, specified as an opensocial.Message.Type.
+ * @member opensocial.Message.Field
+ */
+ TYPE : 'type',
+
+ /**
+ * The title of the message. HTML attributes are allowed and are
+ * sanitized by the container.
+ * @member opensocial.Message.Field
+ */
+ TITLE : 'title',
+
+ /**
+ * The main text of the message. HTML attributes are allowed and are
+ * sanitized by the container.
+ * @member opensocial.Message.Field
+ */
+ BODY : 'body'
+};
+
+
+/**
+ * @static
+ * @class
+ * The types of messages that can be sent.
+ *
+ * @name opensocial.Message.Type
+ */
+opensocial.Message.Type = {
+ /**
+ * An email.
+ *
+ * @member opensocial.Message.Type
+ */
+ EMAIL : 'email',
+
+ /**
+ * A short private message.
+ *
+ * @member opensocial.Message.Type
+ */
+ NOTIFICATION : 'notification',
+
+ /**
+ * A message to a specific user that can be seen only by that user.
+ *
+ * @member opensocial.Message.Type
+ */
+ PRIVATE_MESSAGE : 'privateMessage',
+
+ /**
+ * A message to a specific user that can be seen by more than that user.
+ * @member opensocial.Message.Type
+ */
+ PUBLIC_MESSAGE : 'publicMessage'
+};
+
+
+/**
+ * Gets the message data that's associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * see the <a href="opensocial.Message.Field.html">Field</a> class
+ * for possible values
+ * @return {String} The data
+ * @member opensocial.Message
+ */
+opensocial.Message.prototype.getField = function(key) {
+ return this.fields_[key];
+};
+
+
+/**
+ * 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
+ */
+opensocial.Message.prototype.setField = function(key, data) {
+ return this.fields_[key] = data;
+};
Added: incubator/shindig/trunk/features/opensocial-reference/name.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/name.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/name.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/name.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,102 @@
+/*
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of an name.
+ */
+
+
+/**
+ * @class
+ * Base interface for all name objects.
+ *
+ * @name opensocial.Name
+ */
+
+
+/**
+ * Base interface for all name objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.Name = function(opt_params) {
+ this.fields_ = opt_params || {};
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that a name has. These are the supported keys for the
+ * <a href="opensocial.Name.html#getField">Name.getField()</a> method.
+ *
+ * @name opensocial.Name.Field
+ */
+opensocial.Name.Field = {
+ /**
+ * The family name. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ FAMILY_NAME : 'familyName',
+
+ /**
+ * The given name. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ GIVEN_NAME : 'givenName',
+
+ /**
+ * The additional name. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ ADDITIONAL_NAME : 'additionalName',
+
+ /**
+ * The honorific prefix. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ HONORIFIC_PREFIX : 'honorificPrefix',
+
+ /**
+ * The honorific suffix. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ HONORIFIC_SUFFIX : 'honorificSuffix',
+
+ /**
+ * The unstructured name. Specified as a String.
+ *
+ * @member opensocial.Name.Field
+ */
+ UNSTRUCTURED : 'unstructured'
+};
+
+
+/**
+ * Gets data for this name that is associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * keys are defined in <a href="opensocial.Name.Field.html"><code>
+ * Name.Field</code></a>
+ * @return {String} The data
+ */
+opensocial.Name.prototype.getField = function(key) {
+ return this.fields_[key];
+};
Modified: incubator/shindig/trunk/features/opensocial-reference/opensocial.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/opensocial.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/opensocial.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/opensocial.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Browser environment for interacting with people.
*/
@@ -33,6 +35,62 @@
/**
+ * Requests the container to send a specific message to the specified users. If
+ * the container does not support this method the callback will be called with a
+ * opensocial.ResponseItem. The response item will have its error code set to
+ * NOT_IMPLEMENTED.
+ *
+ * @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.
+ * @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. This function will be passed one parameter, an
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, the
+ * message was sent. If there was an error, you can use the response item's
+ * getErrorCode method to determine how to proceed. The data on the response
+ * item will not be set.
+ *
+ * @member opensocial
+ */
+opensocial.requestSendMessage = function(recipients, message, opt_callback) {
+ opensocial.Container.get().requestSendMessage(recipients, message,
+ opt_callback);
+};
+
+
+/**
+ * Requests the container to share this gadget with the specified users. If the
+ * container does not support this method the callback will be called with a
+ * opensocial.ResponseItem. The response item will have its error code set to
+ * NOT_IMPLEMENTED.
+ *
+ * @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} 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} 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
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, the
+ * sharing request was sent. If there was an error, you can use the response
+ * item's getErrorCode method to determine how to proceed. The data on the
+ * response item will not be set.
+ *
+ * @member opensocial
+ */
+opensocial.requestShareApp = function(recipients, reason, opt_callback) {
+ opensocial.Container.get().requestShareApp(recipients, reason, opt_callback);
+};
+
+
+/**
* Takes an activity and tries to create it,
* without waiting for the operation to complete.
* Optionally calls a function when the operation completes.
@@ -47,6 +105,10 @@
* the request is marked as HIGH priority then this call may open a user flow
* and navigate away from your gadget.
*
+ * If the container does not support this method the callback will be called
+ * with a opensocial.ResponseItem. The response item will have its error code
+ * set to NOT_IMPLEMENTED.
+ *
* @param {opensocial.Activity} activity The <a href="opensocial.Activity.html">
* activity</a> to create
* @param {opensocial.CreateActivityPriority} priority The
@@ -54,7 +116,12 @@
* request
* @param {Function} opt_callback The function to call once the request has been
* processed. This callback will either be called or the gadget will be
- * reloaded from scratch
+ * reloaded from scratch. This function will be passed one parameter, an
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, the
+ * activity was created. If there was an error, you can use the response
+ * item's getErrorCode method to determine how to proceed. The data on the
+ * response item will not be set.
*
* @member opensocial
*/
@@ -99,7 +166,8 @@
/**
* Returns true if the current gadget has access to the specified
- * permission.
+ * permission. If the gadget calls opensocial.requestPermission and permissions
+ * are granted then this function must return true on all subsequent calls.
*
* @param {opensocial.Permission} permission
* The <a href="opensocial.Permission.html">permission</a>
@@ -114,7 +182,10 @@
/**
- * Requests the user to grant access to the specified permissions.
+ * Requests the user to grant access to the specified permissions. If the
+ * container does not support this method the callback will be called with a
+ * opensocial.ResponseItem. The response item will have its error code set to
+ * NOT_IMPLEMENTED.
*
* @param {Array.<opensocial.Permission>} permissions
* The <a href="opensocial.Permission.html">permissions</a> to request
@@ -123,7 +194,13 @@
* permissions are needed
* @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
+ * reloaded from scratch. This function will be passed one parameter, an
+ * opensocial.ResponseItem. The error code will be set to reflect whether
+ * there were any problems with the request. If there was no error, all
+ * permissions were granted. If there was an error, you can use
+ * opensocial.hasPermission to check which permissions are still denied. The
+ * data on the response item will be set. It will be an array of the
+ * opensocial.Permissions that were granted.
*
* @member opensocial
*/
@@ -159,24 +236,6 @@
/**
- * Attempts to navigate to this gadget on a different surface. If the container
- * supports parameters will pass the optional parameters along to the gadget on
- * the new surface.
- *
- * @param {opensocial.Surface} surface The surface to navigate to
- * @param {Map.<String, String>} opt_params
- * Params to pass to the gadget after it
- * has been navigated to on the surface
- *
- * @member opensocial
- */
-/* TODO(doll): Do we want a real Surface object here? or just the name? */
-opensocial.requestNavigateTo = function(surface, opt_params) {
- return opensocial.Container.get().requestNavigateTo(surface, opt_params);
-};
-
-
-/**
* Gets the current environment for this gadget. You can use the environment to
* make queries such as what profile fields and surfaces are supported by this
* container, what parameters were passed to the current gadget, and so on.
@@ -192,153 +251,6 @@
/**
- * Fetches content from the provided URL and feeds that content into the
- * callback function.
- * @param {String} url The URL where the content is located
- * @param {Function} callback The function to call with the data from the URL
- * once it is fetched
- * @param {Map.<opensocial.ContentRequestParameters, Object>} opt_params
- * Additional
- * <a href="opensocial.ContentRequestParameters.html">parameters</a>
- * to pass to the request
- *
- * @member opensocial
- */
-opensocial.makeRequest = function(url, callback, opt_params) {
- opensocial.Container.get().makeRequest(url, callback, opt_params);
-};
-
-
-/**
- * TODO(doll): Rename authentication to authorization, also add headers param
- *
- * @static
- * @class
- * Used by the
- * <a href="opensocial.html#makeRequest">
- * <code>opensocial.makeRequest()</code></a> method.
- * @name opensocial.ContentRequestParameters
- */
-opensocial.ContentRequestParameters = {
- /**
- * The method to use when fetching content from the URL;
- * defaults to <code>MethodType.GET</a></code>.
- * Specified as a
- * <a href="opensocial.ContentRequestParameters.MethodType.html">MethodType</a>.
- *
- * @member opensocial.ContentRequestParameters
- */
- METHOD : 'method',
-
- /**
- * The type of content that lives at the URL;
- * defaults to <code>ContentType.HTML</code>.
- * Specified as a
- * <a href="opensocial.ContentRequestParameters.ContentType.html">
- * ContentType</a>.
- *
- * @member opensocial.ContentRequestParameters
- */
- CONTENT_TYPE : 'contentType',
-
- /**
- * The type of authentication to use when fetching the content;
- * defaults to <code>AuthenticationType.NONE</code>.
- * Specified as an
- * <a href="opensocial.ContentRequestParameters.AuthenticationType.html">
- * AuthenticationType</a>.
- *
- * @member opensocial.ContentRequestParameters
- */
- AUTHENTICATION : 'authentication',
-
- /**
- * If the content is a feed, the number of entries to fetch;
- * defaults to 3.
- * Specified as a <code>Number</code>.
- *
- * @member opensocial.ContentRequestParameters
- */
- NUM_ENTRIES : 'numEntries',
-
- /**
- * If the content is a feed, whether to fetch summaries for that feed;
- * defaults to false.
- * Specified as a <code>Boolean</code>.
- *
- * @member opensocial.ContentRequestParameters
- */
- GET_SUMMARIES : 'getSummaries'
-};
-
-
-/**
- * @static
- * @class
- * Used by
- * <a href="opensocial.ContentRequestParameters.html">
- * ContentRequestParameters</a>.
- * @name opensocial.ContentRequestParameters.MethodType
- */
-opensocial.ContentRequestParameters.MethodType = {
- /** @member opensocial.ContentRequestParameters.MethodType */
- GET : 'get',
-
- /** @member opensocial.ContentRequestParameters.MethodType */
- POST : 'post'
-};
-
-
-/**
- * @static
- * @class
- * Used by
- * <a href="opensocial.ContentRequestParameters.html">
- * ContentRequestParameters</a>.
- * @name opensocial.ContentRequestParameters.ContentType
- */
-opensocial.ContentRequestParameters.ContentType = {
- /**
- * Returns text.
- * @member opensocial.ContentRequestParameters.ContentType
- */
- HTML : 'html',
-
- /**
- * Returns a dom object.
- * @member opensocial.ContentRequestParameters.ContentType
- */
- XML : 'xml',
-
- /**
- * Returns a json object.
- * @member opensocial.ContentRequestParameters.ContentType
- */
- FEED : 'feed'
-};
-
-
-/**
- * @static
- * @class
- * Used by
- * <a href="opensocial.ContentRequestParameters.html">
- * ContentRequestParameters</a>.
- * @name opensocial.ContentRequestParameters.AuthenticationType
- */
-opensocial.ContentRequestParameters.AuthenticationType = {
- /** @member opensocial.ContentRequestParameters.AuthenticationType */
- NONE : 'none',
-
- /** @member opensocial.ContentRequestParameters.AuthenticationType */
- SIGNED : 'signed',
-
- /** @member opensocial.ContentRequestParameters.AuthenticationType */
- AUTHENTICATED : 'authenticated'
-};
-
-
-/**
* Creates a data request object to use for sending and fetching data from the
* server.
*
@@ -358,17 +270,29 @@
* <b>See also:</b>
* <a href="#requestCreateActivity">requestCreateActivity()</a>,
* </p>
- *
- * @param {String} title The title of an activity
- * @param {Map.<opensocial.Activity.Field, Object>} opt_params Any other
- * fields that should be set on the activity object; all of the defined
- * <a href="opensocial.Activity.Field.html">Field</a>s are supported
+ *
+ * <p>It is only required to set one of TITLE_ID or TITLE. In addition, if you
+ * are using any variables in your title or title template,
+ * you must set TEMPLATE_PARAMS.</p>
+ *
+ * <p>Other possible fields to set are: URL, MEDIA_ITEMS, BODY_ID, BODY,
+ * EXTERNAL_ID, PRIORITY, STREAM_TITLE, STREAM_URL, STREAM_SOURCE_URL,
+ * and STREAM_FAVICON_URL.</p>
+ *
+ * <p>Containers are only required to use TITLE_ID or TITLE, and may choose to
+ * ignore additional parameters.</p>
+ *
+ * <p>See <a href="opensocial.Activity.Field.html">Field</a>s are supported for
+ * more details.</p>
+ *
+ * @param {Map.<opensocial.Activity.Field, Object>} params
+ * Parameters defining the activity.
* @return {opensocial.Activity} The new
* <a href="opensocial.Activity.html">activity</a> object
* @member opensocial
*/
-opensocial.newActivity = function(title, opt_params) {
- return opensocial.Container.get().newActivity(title, opt_params);
+opensocial.newActivity = function(params) {
+ return opensocial.Container.get().newActivity(params);
};
@@ -397,8 +321,30 @@
};
+/**
+ * Creates a media item associated with an activity.
+ * Represents images, movies, and audio.
+ * Used when creating activities on the server.
+ *
+ * @param {String} body The main text of the message.
+ * @param {Map.<opensocial.Message.Field, Object>} opt_params
+ * 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
+ *
+ * @return {opensocial.Message} The new
+ * <a href="opensocial.Message.html">message</a> object
+ * @member opensocial
+ */
+opensocial.newMessage = function(body, opt_params) {
+ return opensocial.Container.get().newMessage(body, opt_params);
+};
+
+
// TODO(doll): Util function - pull up the gadgets inherits in shindig so that
// opensocial and gadgets use the same one
+/** @private */
Function.prototype.inherits = function(parentCtor) {
function tempCtor() {};
tempCtor.prototype = parentCtor.prototype;
Added: incubator/shindig/trunk/features/opensocial-reference/organization.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/organization.js?rev=616143&view=auto
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/organization.js (added)
+++ incubator/shindig/trunk/features/opensocial-reference/organization.js Mon Jan 28 18:31:42 2008
@@ -0,0 +1,139 @@
+/**
+ * Licensed 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.
+ */
+
+/**
+ * @fileoverview Representation of a organization.
+ */
+
+
+/**
+ * @class
+ * Base interface for all organization objects.
+ *
+ * @name opensocial.Organization
+ */
+
+
+/**
+ * Base interface for all organization objects.
+ *
+ * @private
+ * @constructor
+ */
+opensocial.Organization = function(opt_params) {
+ this.fields_ = opt_params || {};
+};
+
+
+/**
+ * @static
+ * @class
+ * All of the fields that a organization has. These are the supported keys for
+ * the <a href="opensocial.Organization.html#getField">
+ * Organization.getField()</a> method.
+ *
+ * @name opensocial.Organization.Field
+ */
+opensocial.Organization.Field = {
+ /**
+ * The name of the organization. For example, could be a school name or a job
+ * company. Specified as a string.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ NAME : 'name',
+
+ /**
+ * The title or role the person has in the organization, specified as a
+ * string. This could be graduate student, or software engineer.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ TITLE : 'title',
+
+ /**
+ * A description or notes about the person's work in the organization,
+ * specified as a string. This could be the courses taken by a student, or a
+ * more detailed description about a Organization role.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ DESCRIPTION : 'description',
+
+ /**
+ * The field the organization is in, specified as a string. This could be the
+ * degree pursued if the organization is a school.
+ * Not supported by all containers.
+ * @member opensocial.Organization.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',
+
+ /**
+ * The date the person started at the organization, specified as a Date.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ START_DATE : 'startDate',
+
+ /**
+ * The date the person stopped at the organization, specified as a Date.
+ * A null date indicates that the person is still involved with the
+ * organization.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ 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',
+
+ /**
+ * The address of the organization, specified as an opensocial.Address.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ ADDRESS : 'address',
+
+ /**
+ * A webpage related to the organization, specified as a string.
+ * Not supported by all containers.
+ * @member opensocial.Organization.Field
+ */
+ WEBPAGE : 'webpage'
+};
+
+
+/**
+ * Gets data for this body type that is associated with the specified key.
+ *
+ * @param {String} key The key to get data for;
+ * keys are defined in <a href="opensocial.Organization.Field.html"><code>
+ * Organization.Field</code></a>
+ * @return {String} The data
+ */
+opensocial.Organization.prototype.getField = function(key) {
+ return this.fields_[key];
+};
Modified: incubator/shindig/trunk/features/opensocial-reference/person.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-reference/person.js?rev=616143&r1=616142&r2=616143&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-reference/person.js (original)
+++ incubator/shindig/trunk/features/opensocial-reference/person.js Mon Jan 28 18:31:42 2008
@@ -1,4 +1,4 @@
-/**
+/*
* Licensed 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
@@ -10,7 +10,9 @@
* 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.
- *
+ */
+
+/**
* @fileoverview Representation of a person.
*/
@@ -44,7 +46,6 @@
*
* @name opensocial.Person.Field
*/
-/* TODO(doll): This is not the complete set of fields yet. */
opensocial.Person.Field = {
/**
* A string ID that can be permanently associated with this person.
@@ -53,36 +54,414 @@
ID : 'id',
/**
- * A string containing the person's name.
+ * A opensocial.Name object containing the person's name.
* @member opensocial.Person.Field
*/
NAME : 'name',
/**
- * Person's photo thumbnail URL, specified as a string.
+ * A String representing the person's nickname.
+ * @member opensocial.Person.Field
+ */
+ 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',
/**
- * Person's profile URL, specified as a string.
+ * Person's profile URL, specified as a String.
+ * This URL must be fully qualified. Relative URLs will not work in gadgets.
+ * Not supported by all containers.
* @member opensocial.Person.Field
*/
PROFILE_URL : 'profileUrl',
/**
- * Person's age, specified as a number. Not supported by all containers.
+ * Person's current location, specified as an
+ * <a href="opensocial.Address.html">Address</a>.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ CURRENT_LOCATION : 'currentLocation',
+
+ /**
+ * Addresses associated with the person, specified as an Array of
+ * <a href="opensocial.Address.html">Address</a>es.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ ADDRESSES : 'addresses',
+
+ /**
+ * Emails associated with the person, specified as an Array of
+ * <a href="opensocial.Email.html">Email</a>s.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ EMAILS : 'emails',
+
+ /**
+ * Phone numbers associated with the person, specified as an Array of
+ * <a href="opensocial.Phone.html">Phone</a>s.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ PHONE_NUMBERS : 'phoneNumbers',
+
+ /**
+ * A general statement about the person, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ ABOUT_ME : 'aboutMe',
+
+ /**
+ * Person's status, headline or shoutout, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ STATUS : 'status',
+
+ /**
+ * Person's profile song, specified as an opensocial.Url.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ PROFILE_SONG : 'profileSong',
+
+ /**
+ * Person's profile video, specified as an opensocial.Url.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ PROFILE_VIDEO : 'profileVideo',
+
+ /**
+ * Person's gender, specified as an opensocial.Enum with the enum's
+ * key referencing opensocial.Enum.Gender.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ GENDER : 'gender',
+
+ /**
+ * Person's sexual orientation, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ SEXUAL_ORIENTATION : 'sexualOrientation',
+
+ /**
+ * Person's relationship status, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ RELATIONSHIP_STATUS : 'relationshipStatus',
+
+ /**
+ * Person's age, specified as a number.
+ * Not supported by all containers.
* @member opensocial.Person.Field
*/
AGE : 'age',
- /**
- * Person's gender, specified as a string. Not supported by all containers.
+ /**
+ * Person's date of birth, specified as a Date object.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ DATE_OF_BIRTH : 'dateOfBirth',
+
+ /**
+ * Person's body characteristics, specified as an opensocial.BodyType.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ BODY_TYPE : 'bodyType',
+
+ /**
+ * Person's ethnicity, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ ETHNICITY : 'ethnicity',
+
+ /**
+ * Person's smoking status, specified as an opensocial.Enum with the enum's
+ * key referencing opensocial.Enum.Smoker.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ SMOKER : 'smoker',
+
+ /**
+ * Person's drinking status, specified as an opensocial.Enum with the enum's
+ * key referencing opensocial.Enum.Drinker.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ DRINKER : 'drinker',
+
+ /**
+ * Description of the person's children, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ CHILDREN : 'children',
+
+ /**
+ * Description of the person's pets, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ PETS : 'pets',
+
+ /**
+ * Description of the person's living arrangement, specified as a String.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ LIVING_ARRANGEMENT : 'livingArrangement',
+
+ /**
+ * Person's time zone, specified as the difference in minutes between
+ * Greenwich Mean Time (GMT) and the user's local time. See
+ * Date.getTimezoneOffset() in javascript for more details on this format.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ TIME_ZONE : 'timeZone',
+
+ /**
+ * List of the languages that the person speaks as ISO 639-1 codes,
+ * specified as an Array of Strings.
+ * Not supported by all containers.
+ * @member opensocial.Person.Field
+ */
+ LANGUAGES_SPOKEN : 'languagesSpoken',
+
+ /**
+ * Jobs the person has held, specified as an Array of
+ * <a href="opensocial.Organization.html">Organization</a>s.
+ * Not supported by all containers.
+ *
* @member opensocial.Person.Field
*/
- GENDER : 'gender'
+ JOBS : 'jobs',
- // TODO(doll): Add the rest of the profile fields here
+ /**
+ * Person's favorite jobs, or job interests and skills, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ JOB_INTERESTS : 'jobInterests',
+
+ /**
+ * Schools the person has attended, specified as an Array of
+ * <a href="opensocial.Organization.html">Organization</a>s.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ SCHOOLS : 'schools',
+
+ /**
+ * Person's interests, hobbies or passions, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ INTERESTS : 'interests',
+
+ /**
+ * URLs related to the person, their webpages, or feeds. Specified as an
+ * Array of opensocial.Url.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ URLS : 'urls',
+
+ /**
+ * Person's favorite music, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ MUSIC : 'music',
+
+ /**
+ * Person's favorite movies, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ MOVIES : 'movies',
+
+ /**
+ * Person's favorite TV shows, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ TV_SHOWS : 'tvShows',
+
+ /**
+ * Person's favorite books, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ BOOKS : 'books',
+
+ /**
+ * Person's favorite activities, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ ACTIVITIES : 'activities',
+
+ /**
+ * Person's favorite sports, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ SPORTS : 'sports',
+
+ /**
+ * Person's favorite heroes, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ HEROES : 'heroes',
+
+ /**
+ * Person's favorite quotes, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ QUOTES : 'quotes',
+
+ /**
+ * Person's favorite cars, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ CARS : 'cars',
+
+ /**
+ * Person's favorite food, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ FOOD : 'food',
+
+ /**
+ * Person's turn ons, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ TURN_ONS : 'turnOns',
+
+ /**
+ * Person's turn offs, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ TURN_OFFS : 'turnOffs',
+
+ /**
+ * Arbitrary tags about the person, specified as an Array of Strings.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ TAGS : 'tags',
+
+ /**
+ * Person's comments about romance, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ ROMANCE : 'romance',
+
+ /**
+ * What the person is scared of, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ SCARED_OF : 'scaredOf',
+
+ /**
+ * Describes when the person is happiest, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ HAPPIEST_WHEN : 'happiestWhen',
+
+ /**
+ * Person's thoughts on fashion, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ FASHION : 'fashion',
+
+ /**
+ * Person's thoughts on humor, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ HUMOR : 'humor',
+
+ /**
+ * Person's statement about who or what they are looking for, or what they are
+ * interested in meeting people for. Specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ LOOKING_FOR : 'lookingFor',
+
+ /**
+ * Person's relgion or religious views, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ RELIGION : 'religion',
+
+ /**
+ * Person's political views, specified as a String.
+ * Not supported by all containers.
+ *
+ * @member opensocial.Person.Field
+ */
+ POLITICAL_VIEWS : 'politicalViews'
};
Re: opensocial-reference/feature.xml out of sync? (was Re: svn commit: r616143 [1/2] - /incubator/shindig/trunk/features/opensocial-reference/)
Posted by Cassie <do...@google.com>.
Thanks for the review Jamey, you are correct, I'll fix this right away.
On Tue, Jan 29, 2008 at 9:18 AM, Jamey Wood <Ja...@sun.com> wrote:
> doll@apache.org wrote:
> > Author: doll
> > Date: Mon Jan 28 18:31:42 2008
> > New Revision: 616143
> >
> > URL: http://svn.apache.org/viewvc?rev=616143&view=rev
> > Log:
> > Updated the shindig opensocial reference files to support 0.7
> > This is not reflected in the sample container yet, I'll get there
> tomorrow.
> >
> >
> >
> > Added:
> > incubator/shindig/trunk/features/opensocial-reference/address.js
> > incubator/shindig/trunk/features/opensocial-reference/bodytype.js
> > incubator/shindig/trunk/features/opensocial-reference/email.js
> > incubator/shindig/trunk/features/opensocial-reference/enum.js
> > incubator/shindig/trunk/features/opensocial-reference/message.js
> > incubator/shindig/trunk/features/opensocial-reference/name.js
> >
> incubator/shindig/trunk/features/opensocial-reference/organization.js
> > incubator/shindig/trunk/features/opensocial-reference/phone.js
> > incubator/shindig/trunk/features/opensocial-reference/url.js
> > Removed:
> > incubator/shindig/trunk/features/opensocial-reference/surface.js
> >
>
> Don't these changes need to be reflected in
> opensocial-reference/feature.xml? (Something along the lines of the
> attached diff?)
>
> Otherwise, when I try to run the Java gadget server on GlassFish, I get
> an exception saying that it can't find surface.js:
>
> PWC1382: Allocate exception for servlet xml-to-html
> java.lang.RuntimeException: Could not find resource
> features/opensocial-reference/surface.js
> at
> org.apache.shindig.gadgets.JsLibrary.loadResource(JsLibrary.java:150)
> ...<snip>...
>
> Thanks,
> Jamey
>
> Index: feature.xml
> ===================================================================
> --- feature.xml (revision 616446)
> +++ feature.xml (working copy)
> @@ -28,6 +28,14 @@
> <script src="environment.js"/>
> <script src="person.js"/>
> <script src="responseitem.js"/>
> - <script src="surface.js"/>
> + <script src="address.js"/>
> + <script src="bodytype.js"/>
> + <script src="email.js"/>
> + <script src="enum.js"/>
> + <script src="message.js"/>
> + <script src="name.js"/>
> + <script src="organization.js"/>
> + <script src="phone.js"/>
> + <script src="url.js"/>
> </gadget>
> </feature>
>
>
opensocial-reference/feature.xml out of sync? (was Re: svn commit:
r616143 [1/2] - /incubator/shindig/trunk/features/opensocial-reference/)
Posted by Jamey Wood <Ja...@sun.com>.
doll@apache.org wrote:
> Author: doll
> Date: Mon Jan 28 18:31:42 2008
> New Revision: 616143
>
> URL: http://svn.apache.org/viewvc?rev=616143&view=rev
> Log:
> Updated the shindig opensocial reference files to support 0.7
> This is not reflected in the sample container yet, I'll get there tomorrow.
>
>
>
> Added:
> incubator/shindig/trunk/features/opensocial-reference/address.js
> incubator/shindig/trunk/features/opensocial-reference/bodytype.js
> incubator/shindig/trunk/features/opensocial-reference/email.js
> incubator/shindig/trunk/features/opensocial-reference/enum.js
> incubator/shindig/trunk/features/opensocial-reference/message.js
> incubator/shindig/trunk/features/opensocial-reference/name.js
> incubator/shindig/trunk/features/opensocial-reference/organization.js
> incubator/shindig/trunk/features/opensocial-reference/phone.js
> incubator/shindig/trunk/features/opensocial-reference/url.js
> Removed:
> incubator/shindig/trunk/features/opensocial-reference/surface.js
>
Don't these changes need to be reflected in
opensocial-reference/feature.xml? (Something along the lines of the
attached diff?)
Otherwise, when I try to run the Java gadget server on GlassFish, I get
an exception saying that it can't find surface.js:
PWC1382: Allocate exception for servlet xml-to-html
java.lang.RuntimeException: Could not find resource
features/opensocial-reference/surface.js
at
org.apache.shindig.gadgets.JsLibrary.loadResource(JsLibrary.java:150)
...<snip>...
Thanks,
Jamey