Author: rbaxter85
Date: Sat Jan  7 18:25:47 2012
New Revision: 1228695

URL: http://svn.apache.org/viewvc?rev=1228695&view=rev
Log:
SHINDIG-1679
Revert SHINDIG-1669

Modified:
    
shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml
    shindig/trunk/features/src/main/javascript/features/container.util/util.js
    shindig/trunk/features/src/main/javascript/features/container/container.js
    
shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
    
shindig/trunk/features/src/test/javascript/features/container.url/container_url_test.js

Modified: 
shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml
URL: 
http://svn.apache.org/viewvc/shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml?rev=1228695&r1=1228694&r2=1228695&view=diff
==============================================================================
--- 
shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml
 (original)
+++ 
shindig/trunk/content/samplecontainer/examples/embeddedexperiences/PhotoList.xml
 Sat Jan  7 18:25:47 2012
@@ -99,7 +99,7 @@
             var coordinates = $('#photo' + index).offset();
             coordinates.left = coordinates.left + $('#photo' + index).width();
 
-            var navigateCallback = function(site, result){currentSite = site; 
console.log("Nagivate callback");};
+            var navigateCallback = function(site, metadata){currentSite = 
site; console.log("Nagivate callback");};
             var returnCallback = function(returnValue){console.log("Return 
Value: " + returnValue);};
             gadgets.views.openEmbeddedExperience(returnCallback, 
navigateCallback, eeDataModel, {
               'viewTarget' : index == 0 ? 'preview' : 'FLOAT',

Modified: 
shindig/trunk/features/src/main/javascript/features/container.util/util.js
URL: 
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container.util/util.js?rev=1228695&r1=1228694&r2=1228695&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/container.util/util.js 
(original)
+++ shindig/trunk/features/src/main/javascript/features/container.util/util.js 
Sat Jan  7 18:25:47 2012
@@ -87,18 +87,6 @@ osapi.container.util.newMetadataRequest 
   };
 };
 
-/**
- * Creates a new head request to be made to the given URL.
- * @param {String} url The URL to make the head request to.
- * @return {osapi.Request} The request object.
- */
-osapi.container.util.newHeadRequest = function(url) {
-  return osapi.http.head({
-    "href": url,
-    "refreshInterval": 0
-    });
-}
-
 
 /**
  * Construct a JSON request to get gadget token.

Modified: 
shindig/trunk/features/src/main/javascript/features/container/container.js
URL: 
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/container/container.js?rev=1228695&r1=1228694&r2=1228695&view=diff
==============================================================================
--- shindig/trunk/features/src/main/javascript/features/container/container.js 
(original)
+++ shindig/trunk/features/src/main/javascript/features/container/container.js 
Sat Jan  7 18:25:47 2012
@@ -919,34 +919,16 @@ osapi.container.Container.prototype.newU
 
 
 /**
- * Navigates to a URL.  If an optional callback parameter is supplied the
- * container will first make a HEAD request to the URL and return the result to
- * the callback.  If the callback is undefined than the container will try to
- * render the URL in a site with out making any additional requests to the 
server.
- * There are several consiquences of supply a callback,
- * but the two most important ones are that there will be extra load on the 
server and
- * that if the URL requires authentication the HEAD request will fail causing 
the URL
- * not to render.  As a result you should only supply a callback if you really 
need
- * to know whether the URL is accessible or not.
+ * Navigates to a URL.
  * @param {osapi.container.UrlSite} site the URL site to render the URL in.
  * @param {string} url the URL to render.
- * @param {Object} renderParams params to augment the rendering. Valid 
rendering parameters 
+ * @param {Object} renderParams params to augment the rendering. Valid 
rendering parameters
  * include osapi.container.RenderParam.CLASS, 
osapi.container.RenderParam.HEIGHT,
  * and osapi.container.RenderParam.WIDTH.
- * @param {function{Object}=} opt_callback optional callback called with the 
result of making a
- * head request to the URL.
+ * @return {osapi.container.UrlSite} the site you passed in.
  *
  */
-osapi.container.Container.prototype.navigateUrl = function(site, url, 
renderParams,
-        opt_callback) {
-  if(opt_callback) {
-    osapi.container.util.newHeadRequest(url).execute(function(response) {
-      if(!response.error && (response.status >= 200 && response.status < 300)) 
{
-        site.render(url, renderParams);
-      }
-      opt_callback(response);
-    });
-  } else {
-    site.render(url, renderParams);
-  }
+osapi.container.Container.prototype.navigateUrl = function(site, url, 
renderParams) {
+  site.render(url, renderParams);
+  return site;
 };

Modified: 
shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
URL: 
http://svn.apache.org/viewvc/shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js?rev=1228695&r1=1228694&r2=1228695&view=diff
==============================================================================
--- 
shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
 (original)
+++ 
shindig/trunk/features/src/main/javascript/features/embeddedexperiences/embedded_experiences_container.js
 Sat Jan  7 18:25:47 2012
@@ -77,17 +77,10 @@
       var urlRenderParams =
         renderParams[osapi.container.ee.RenderParam.URL_RENDER_PARAMS] || {};
       var site = context.newUrlSite(element);
-      context.navigateUrl(site, dataModel.url, urlRenderParams, 
function(response) {
-        if (opt_callback) {
-          if(response.status >= 400) {
-            //Format the response in a way that is similar to if we were 
navigating
-            //to a gadget, at least for error handling.  Makes things slightly 
easier
-            //for callers.
-            response.error = {"code": response.status};
-          }
-          opt_callback(site, response);
-        }
-      });
+      var toReturn = context.navigateUrl(site, dataModel.url, urlRenderParams);
+      if (opt_callback) {
+        opt_callback(toReturn, null);
+      }
     };
 
     /**

Modified: 
shindig/trunk/features/src/test/javascript/features/container.url/container_url_test.js
URL: 
http://svn.apache.org/viewvc/shindig/trunk/features/src/test/javascript/features/container.url/container_url_test.js?rev=1228695&r1=1228694&r2=1228695&view=diff
==============================================================================
--- 
shindig/trunk/features/src/test/javascript/features/container.url/container_url_test.js
 (original)
+++ 
shindig/trunk/features/src/test/javascript/features/container.url/container_url_test.js
 Sat Jan  7 18:25:47 2012
@@ -33,7 +33,6 @@ UrlContainerTest.prototype.setUp = funct
   window.__CONTAINER_URI = shindig.uri('http://container.com');
   this.shindigContainerGadgetSite = osapi.container.GadgetSite;
   this.shindigContainerUrlSite = osapi.container.UrlSite;
-  this.shindigHttp = osapi.http;
   this.gadgetsRpc = gadgets.rpc;
 };
 
@@ -42,7 +41,6 @@ UrlContainerTest.prototype.tearDown = fu
   window.__CONTAINER_URI = this.containerUri;
   osapi.container.GadgetSite = this.shindigContainerGadgetSite;
   osapi.container.UrlSite = this.shindigContainerUrlSite;
-  osapi.http = this.shindigHttp;
   gadgets.rpc = this.gadgetsRpc;
 };
 
@@ -56,7 +54,6 @@ UrlContainerTest.prototype.testNewUrlSit
 
 UrlContainerTest.prototype.testNavigateUrl = function() {
   this.setupGadgetsRpcRegister();
-  this.setupOsapiHttp();
   var container = new osapi.container.Container({
     'allowDefaultView' : true,
     'renderCajole' : true,
@@ -88,16 +85,4 @@ UrlContainerTest.prototype.setupUrlSite 
       }
     };
   };
-};
-
-UrlContainerTest.prototype.setupOsapiHttp = function() {
-  osapi.http = {
-    "head" : function(params) {
-      return {
-        "execute" : function(callback) {
-          callback({"status" : 200});
-        }
-      };
-    }
-  };
 };
\ No newline at end of file


Reply via email to