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/03/12 12:00:51 UTC

svn commit: r636278 - in /incubator/shindig/trunk: config/syndicator.js features/opensocial-0.7/batchrequest.js features/opensocial-0.7/feature.xml features/opensocial-0.7/jsoncontainer.js

Author: doll
Date: Wed Mar 12 04:00:36 2008
New Revision: 636278

URL: http://svn.apache.org/viewvc?rev=636278&view=rev
Log:
Changed opensocial-0.7 to use the syndicator for configing. 
Also made the path variable required in the batchrequest.

These removes all references to localhost:8080.


Modified:
    incubator/shindig/trunk/config/syndicator.js
    incubator/shindig/trunk/features/opensocial-0.7/batchrequest.js
    incubator/shindig/trunk/features/opensocial-0.7/feature.xml
    incubator/shindig/trunk/features/opensocial-0.7/jsoncontainer.js

Modified: incubator/shindig/trunk/config/syndicator.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/config/syndicator.js?rev=636278&r1=636277&r2=636278&view=diff
==============================================================================
--- incubator/shindig/trunk/config/syndicator.js (original)
+++ incubator/shindig/trunk/config/syndicator.js Wed Mar 12 04:00:36 2008
@@ -86,5 +86,17 @@
          "FONT_COLOR": "",
          "ANCHOR_COLOR": ""
     }
+  },
+  "opensocial-0.7" : {
+    // Path to fetch opensocial data from
+    // If relative, will be appended to the document.location.host
+    "path" : "/gadgets/socialdata",
+    "domain" : "shindig",
+    "enableCaja" : true,
+    "supportedFields" : {
+       "person" : ["id", "name", "thumbnailUrl", "profileUrl"],
+       "activity" : ["id", "title"]
+    }
   }
+
 }}

Modified: incubator/shindig/trunk/features/opensocial-0.7/batchrequest.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-0.7/batchrequest.js?rev=636278&r1=636277&r2=636278&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-0.7/batchrequest.js (original)
+++ incubator/shindig/trunk/features/opensocial-0.7/batchrequest.js Wed Mar 12 04:00:36 2008
@@ -26,11 +26,11 @@
  *   Will be called with the JSON data as the only parameter.
  * @constructor
  */
-BatchRequest = function(jsonText, opt_callback, opt_path, opt_params) {
+BatchRequest = function(path, jsonText, opt_callback, opt_params) {
   this.params_ = opt_params || {};
   this.params_['request'] = jsonText;
 
-  this.path_ = opt_path || 'http://localhost:8080/gadgets/socialdata';
+  this.path_ = path;
   this.callback_ = opt_callback;
 };
 

Modified: incubator/shindig/trunk/features/opensocial-0.7/feature.xml
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-0.7/feature.xml?rev=636278&r1=636277&r2=636278&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-0.7/feature.xml (original)
+++ incubator/shindig/trunk/features/opensocial-0.7/feature.xml Wed Mar 12 04:00:36 2008
@@ -26,20 +26,36 @@
     <script src="jsoncontainer.js"></script>
     <script src="batchrequest.js"></script>
     <script>
-      ShindigContainer = function() {
-        var supportedFields = {
-          'person' : ['id', 'name', 'thumbnailUrl', 'profileUrl'],
-          'activity' : ['id', 'title'] // TODO: Support acitvities
-        };
-
-        // TODO: Support relative paths
-        JsonContainer.call(this, "http://localhost:8080/gadgets/socialdata",
-          "shindig", supportedFields);
+      var requiredConfig = {
+        "path": gadgets.config.NonEmptyStringValidator,
+        "domain": gadgets.config.NonEmptyStringValidator,
+        "enableCaja": gadgets.config.BooleanValidator,
+        "supportedFields": gadgets.config.ExistsValidator
       };
-      ShindigContainer.inherits(JsonContainer);
 
-      opensocial.Container.setContainer(new ShindigContainer());
-      opensocial.Container.get().enableCaja();
+      gadgets.config.register("opensocial-0.7", requiredConfig,
+        function(config) {
+          var configParams = config["opensocial-0.7"];
+
+          ShindigContainer = function() {
+            var path = configParams.path;
+            if (path.indexOf("http") != 0) {
+              var parentUrl = document.location.protocol + "//"
+                  + document.location.host;
+              path = parentUrl + path;
+            }
+
+            JsonContainer.call(this, path,
+                configParams.domain, configParams.supportedFields);
+          };
+          ShindigContainer.inherits(JsonContainer);
+
+          opensocial.Container.setContainer(new ShindigContainer());
+
+          if (configParams.enableCaja) {
+            opensocial.Container.get().enableCaja();
+          }
+      });
     </script>
   </gadget>
 </feature>

Modified: incubator/shindig/trunk/features/opensocial-0.7/jsoncontainer.js
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/features/opensocial-0.7/jsoncontainer.js?rev=636278&r1=636277&r2=636278&view=diff
==============================================================================
--- incubator/shindig/trunk/features/opensocial-0.7/jsoncontainer.js (original)
+++ incubator/shindig/trunk/features/opensocial-0.7/jsoncontainer.js Wed Mar 12 04:00:36 2008
@@ -91,7 +91,7 @@
     callback(dataResponse);
   };
 
-  new BatchRequest(jsonText, sendResponse, this.baseUrl_).send();
+  new BatchRequest(this.baseUrl_, jsonText, sendResponse).send();
 };
 
 JsonContainer.prototype.newFetchPersonRequest = function(id, opt_params) {