You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by ch...@apache.org on 2008/06/19 02:57:10 UTC
svn commit: r669346 - in /incubator/shindig/trunk:
features/opensocial-current/jsoncontainer.js
php/src/socialdata/samplecontainer/OpenSocialDataHandler.php
Author: chabotc
Date: Wed Jun 18 17:57:10 2008
New Revision: 669346
URL: http://svn.apache.org/viewvc?rev=669346&view=rev
Log:
SHINDIG-393 adds requestShareApp support
Modified:
incubator/shindig/trunk/features/opensocial-current/jsoncontainer.js
incubator/shindig/trunk/php/src/socialdata/samplecontainer/OpenSocialDataHandler.php
Modified: incubator/shindig/trunk/features/opensocial-current/jsoncontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-current/jsoncontainer.js?rev=669346&r1=669345&r2=669346&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-current/jsoncontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-current/jsoncontainer.js Wed Jun 18 17:57:10 2008
@@ -68,6 +68,18 @@
});
};
+JsonContainer.prototype.requestShareApp = function(recipients, reason,
+ opt_callback, opt_params) {
+ opt_callback = opt_callback || {};
+ opt_params = opt_params || {};
+ var id = new opensocial.IdSpec({'userId' : recipients});
+ var req = opensocial.newDataRequest();
+ req.add(this.newRequestShareAppRequest(id, reason), 'key');
+ req.send(function(response) {
+ opt_callback(response.get('key'));
+ });
+};
+
JsonContainer.prototype.createJson = function(requestObjects) {
var jsonObjects = [];
for (var i = 0; i < requestObjects.length; i++) {
@@ -217,6 +229,13 @@
'message' : message});
};
+JsonContainer.prototype.newRequestShareAppRequest = function(idSpec,
+ reason) {
+ return new RequestItem({'type' : 'SHARE_APP',
+ 'idSpec' : JsonContainer.translateIdSpec(idSpec),
+ 'reason' : reason});
+};
+
JsonContainer.translateIdSpec = function(newIdSpec) {
var oldIdSpec;
var userId = newIdSpec.getField('userId');
Modified: incubator/shindig/trunk/php/src/socialdata/samplecontainer/OpenSocialDataHandler.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/socialdata/samplecontainer/OpenSocialDataHandler.php?rev=669346&r1=669345&r2=669346&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/socialdata/samplecontainer/OpenSocialDataHandler.php (original)
+++ incubator/shindig/trunk/php/src/socialdata/samplecontainer/OpenSocialDataHandler.php Wed Jun 18 17:57:10 2008
@@ -22,7 +22,7 @@
* This will expand to be more sophisticated as time goes on.
*/
class OpenSocialDataHandler extends GadgetDataHandler {
- private $handles = array('FETCH_PEOPLE', 'FETCH_PERSON_APP_DATA', 'UPDATE_PERSON_APP_DATA', 'FETCH_ACTIVITIES', 'CREATE_ACTIVITY', 'SEND_MESSAGE');
+ private $handles = array('FETCH_PEOPLE', 'FETCH_PERSON_APP_DATA', 'UPDATE_PERSON_APP_DATA', 'FETCH_ACTIVITIES', 'CREATE_ACTIVITY', 'SEND_MESSAGE', 'SHARE_APP');
private $peopleHandler;
private $dataHandler;
private $activitiesHandler;
@@ -96,6 +96,17 @@
$message = $params["message"];
$response = $this->messagesHandler->sendMessage($peopleIds, $message, $request->getToken());
break;
+
+ case 'SHARE_APP' :
+ /*
+ * Here you have to implement the stuff to send the invites
+ * Also apply policies and filters in the $peopleIds
+ */
+ $response = new ResponseItem(NOT_IMPLEMENTED, "Share app not Implemented");
+ break;
+ default:
+ $response = new ResponseItem(BAD_REQUEST, "Invalid request type");
+ break;
}
} else {
$response = new ResponseItem(BAD_REQUEST, "Invalid people id's");