You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2011/07/15 23:08:05 UTC

svn commit: r1147319 - in /incubator/rave/trunk/rave-portal/src/main/webapp/script: rave.js rave_opensocial.js

Author: mfranklin
Date: Fri Jul 15 21:08:05 2011
New Revision: 1147319

URL: http://svn.apache.org/viewvc?rev=1147319&view=rev
Log:
Udated OS gadget rendering to support selecting view (Supports RAVE-53)

Modified:
    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
    incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_opensocial.js

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js?rev=1147319&r1=1147318&r2=1147319&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave.js Fri Jul 15 21:08:05 2011
@@ -20,6 +20,7 @@ var rave = rave || (function() {
     var WIDGET_PROVIDER_ERROR = "This widget type is currently unsupported.  Check with your administrator and be sure the correct provider is registered.";
 
     var providerMap = {};
+    var widgetByIdMap = {};
     var context = "";
 
     /**
@@ -174,7 +175,9 @@ var rave = rave || (function() {
     function initializeWidgets(widgets) {
         //Initialize the widgets for supported providers
         for(var i=0; i<widgets.length; i++) {
-            initializeWidget(widgets[i]);
+            var widget = widgets[i];
+            initializeWidget(widget);
+            widgetByIdMap[widget.regionWidgetId] = widget;
         }
     }
 

Modified: incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_opensocial.js
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_opensocial.js?rev=1147319&r1=1147318&r2=1147319&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_opensocial.js (original)
+++ incubator/rave/trunk/rave-portal/src/main/webapp/script/rave_opensocial.js Fri Jul 15 21:08:05 2011
@@ -21,6 +21,7 @@ rave.opensocial = rave.opensocial || (fu
     var WIDGET_TYPE = "OpenSocial";
 
     var container;
+    var siteMap = {};
 
     /**
      * Initialization
@@ -78,16 +79,10 @@ rave.opensocial = rave.opensocial || (fu
         if (validationResult.valid) {
             //TODO: Submit a patch to Shindig common container to expose the backing service or add a method to push cached items  into the container config
             container.service_.addGadgetMetadatas(gadgetMetadata[0].result, null);
-
-            var renderParams = {};
-            renderParams[osapi.container.RenderParam.VIEW] = "home";
-            renderParams[osapi.container.RenderParam.WIDTH] = 250;
-            renderParams[osapi.container.RenderParam.HEIGHT] = 250;
-            renderParams[osapi.container.RenderParam.USER_PREFS] = getCompleteUserPrefSet(gadget.userPrefs, gadgetMetadata[0].result[gadget.widgetUrl].userPrefs);
             var widgetBodyElement = document.getElementById(["widget-", gadget.regionWidgetId, "-body"].join(""));
             var gadgetSite = container.newGadgetSite(widgetBodyElement);
-            container.navigateGadget(gadgetSite, gadget.widgetUrl, {}, renderParams);
-
+            siteMap[gadget.regionWidgetId] = gadgetSite;
+            renderGadgetView("home", gadget, gadgetMetadata, gadgetSite);
         } else {
             rave.errorWidget(gadget.regionWidgetId, "Unable to render OpenSocial Gadget: <br /><br />" + validationResult.error);
         }
@@ -95,6 +90,54 @@ rave.opensocial = rave.opensocial || (fu
     }
 
     /**
+     * Renders the gadget in canvas view
+     * @param gadget the Rave widget object
+     */
+    function renderCanvas(gadget) {
+
+    }
+
+    /**
+     * Renders the gadget in home view
+     * @param gadget the Rave widget object
+     */
+    function renderHome(gadget) {
+
+    }
+
+    /**
+     * Renders an existing gadget in a new view
+     * @param view the view to render the gadget in
+     * @param gadget the Rave widget object
+     */
+    function renderExistingGadgetInView(view, gadget) {
+        var site = siteMap[gadget.regionWidgetId];
+        if(site == null) {
+            rave.errorWidget(gadget.regionWidgetId, "OpenSocial gadget no longer exists in the container!");
+        }
+        else {
+           //var metadata = container.get
+        }
+    }
+
+    /**
+     * Renders a gadget in the given view;
+     * @param view the view to render
+     * @param gadget the Rave widget object
+     * @param gadgetMetadata the Shindig gadget metadata object
+     * @param gadgetSite the Shindig gadget site object
+     *
+     */
+    function renderGadgetView(view, gadget, gadgetMetadata, gadgetSite) {
+        var renderParams = {};
+        renderParams[osapi.container.RenderParam.VIEW] = view;
+        renderParams[osapi.container.RenderParam.WIDTH] = 250;
+        renderParams[osapi.container.RenderParam.HEIGHT] = 250;
+        renderParams[osapi.container.RenderParam.USER_PREFS] = getCompleteUserPrefSet(gadget.userPrefs, gadgetMetadata[0].result[gadget.widgetUrl].userPrefs);
+        container.navigateGadget(gadgetSite, gadget.widgetUrl, {}, renderParams);
+    }
+
+    /**
      * validates the metadata for the current gadget
      * @param metadatas the list of metadata objects to validate
      */