You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by Paul Lindner <pl...@hi5.com> on 2008/01/31 19:21:25 UTC

hi5 shindig implementation notes

Hi,

We have a minimal Shindig based backend running for the hi5 sandbox.
Very beta right now.  

  http://lindner.sandbox.hi5.com/friend/apps/entry/www.inuus.com/os/unittest.xml

Here's some notes (and patches!)

First, we had problems with gadgets.views disappearing.  Turns out
that core.js was getting included after views.js.

Here's the first part of our opensocial-0.7/feature.xml:

<feature>
  <name>opensocial-0.7</name>
  <dependency>opensocial-reference</dependency>
  <dependency>views</dependency>
  <gadget>
    <script src="hi5container.js"></script>
    <script src="hi5profile.js"></script>
    .....

In any case changing core.js with this patch fixed this:

===================================================================
--- features/core/core.js       (revision 617148)
+++ features/core/core.js       (working copy)
@@ -1 +1 @@
-var gadgets = {};
+var gadgets = gadgets || {};


----------------------------------------------------------------------

Another set of modficiations I made centered on
javascript/container/gadgets.js.  I needed to have a way to pass in a
standard set of hash values, plus nocache, country, and language.
These params seem like they should be part of the base object, so
here's a proposed patch:

===================================================================
--- javascript/container/gadgets.js     (revision 617148)
+++ javascript/container/gadgets.js     (working copy)
@@ -275,7 +275,7 @@
 };

 /**
- * Gets the HTML element that is the chrome of a gadget into which the cotnent
+ * Gets the HTML element that is the chrome of a gadget into which the content
  * of the gadget can be rendered.
  * @param {Object} gadget Gadget instance
  * @return {Object} HTML element that is the chrome for the given gadget
@@ -347,7 +347,7 @@
 // Gadget

 /**
- * Creates a new instance of gadget.  Optoinal parameters are set as instance
+ * Creates a new instance of gadget.  Optional parameters are set as instance
  * variables.
  * @constructor
  * @param {Object} params Parameters to set on gadget.  Common parameters:
@@ -355,10 +355,10 @@
  *    "private": Whether gadget spec is accessible only privately, which means
  *        browser can load it but not gadget server
  *    "spec": Gadget Specification in XML
+ *    "hashData": data to be passed on the # of the iframe URL
  */
 gadgets.Gadget = function(params) {
   this.userPrefs_ = {};
-
   if (params) {
     for (var name in params) {
       this[name] = params[name];
@@ -497,9 +497,11 @@

 gadgets.IfrGadget.prototype.getIframeUrl = function() {
   return this.serverBase_ + 'ifr?url=' +
-      encodeURIComponent(this.specUrl) + '&synd=' + this.SYND + '&mid=' +
+      encodeURIComponent(this.specUrl) + '&nocache=' + this.nocache_ + '&synd=' + this.SYND + '&mid=' +
       this.id + '&parent=' + encodeURIComponent(gadgets.container.parentUrl_) +
-      '&ogc=' + document.location.host + this.getUserPrefsParams();
+      '&ogc=' + document.location.host + this.getUserPrefsParams() +
+      '&country=' + this.country_ + '&lang=' + this.language_ +
+      '#' + this.hashData;
 };
 
 gadgets.IfrGadget.prototype.getUserPrefsParams = function() {
@@ -536,7 +538,7 @@
     var script = document.createElement('script');
     script.src = 'http://gmodules.com/ig/gadgetsettings?url=' + this.specUrl +
-        '&mid=' + this.id + '&output=js' + this.getUserPrefsParams();
+        '&mid=' + this.id + '&output=js' + this.getUserPrefsParams() + '#' + this.hashData;
     document.body.appendChild(script);
   }
 };
@@ -600,6 +602,9 @@
 gadgets.Container = function() {
   this.gadgets_ = {};
   this.parentUrl_ = '';
+  this.country_  = 'US';
+  this.language_  = 'en';
+  this.nocache_ = 1;
 };
 
 gadgets.Container.inherits(gadgets.Extensible);
@@ -626,6 +631,18 @@ 
   this.parentUrl_ = url;
 };
 
+gadgets.Container.prototype.setCountry = function(country) {
+  this.country_ = country;
+};
+
+gadgets.Container.prototype.setNoCache = function(nocache) {
+  this.nocache_ = nocache;
+}
+
+gadgets.Container.prototype.setLanguage = function(language) {
+  this.language_ = language;
+};
+
 gadgets.Container.prototype.getGadgetKey_ = function(instanceId) {
   return 'gadget_' + instanceId;
 };





-- 
Paul Lindner
hi5 Architect
plindner@hi5.com

Re: hi5 shindig implementation notes

Posted by Kevin Brown <et...@google.com>.
On Jan 31, 2008 10:21 AM, Paul Lindner <pl...@hi5.com> wrote:

> Hi,
>
> We have a minimal Shindig based backend running for the hi5 sandbox.
> Very beta right now.
>
>
> http://lindner.sandbox.hi5.com/friend/apps/entry/www.inuus.com/os/unittest.xml
>
> Here's some notes (and patches!)
>
> First, we had problems with gadgets.views disappearing.  Turns out
> that core.js was getting included after views.js.
>
> Here's the first part of our opensocial-0.7/feature.xml:
>
> <feature>
>  <name>opensocial-0.7</name>
>  <dependency>opensocial-reference</dependency>
>  <dependency>views</dependency>
>  <gadget>
>    <script src="hi5container.js"></script>
>    <script src="hi5profile.js"></script>
>    .....
>
> In any case changing core.js with this patch fixed this:
>
> ===================================================================
> --- features/core/core.js       (revision 617148)
> +++ features/core/core.js       (working copy)
> @@ -1 +1 @@
> -var gadgets = {};
> +var gadgets = gadgets || {};
>

Were you using an old snapshot of the Java code? core.js should *always* be
the first script pulled in from the dependency chain. There was a bug that
was causing this to not happen in certain cases, but it was addressed
several weeks ago. If core.js isn't coming up first in some instances, that
bug needs to be addressed, because it could affect other things (such as
gadgets.util or gadgets.Prefs not being loaded before other features that
depend on them).