rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ja...@apache.org
Subject svn commit: r1305939 - /rave/trunk/rave-portal-resources/src/main/webapp/script/rave_opensocial.js
Date Tue, 27 Mar 2012 18:24:08 GMT
Author: jasha
Date: Tue Mar 27 18:24:07 2012
New Revision: 1305939

URL: http://svn.apache.org/viewvc?rev=1305939&view=rev
Log:
RAVE-526 Support height attribute of open social gadget definition. Patch provided by Dennis
van der Laan (University of Groningen).

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

Modified: rave/trunk/rave-portal-resources/src/main/webapp/script/rave_opensocial.js
URL: http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/script/rave_opensocial.js?rev=1305939&r1=1305938&r2=1305939&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/script/rave_opensocial.js (original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/script/rave_opensocial.js Tue Mar 27
18:24:07 2012
@@ -173,25 +173,27 @@ rave.opensocial = rave.opensocial || (fu
      */
     function renderGadgetView(view, gadget) {
         var renderParams = {};
-        var size = getSizeFromElement(gadget.regionWidgetId, view);
+        var size = calculateSize(view, gadget);
+
         renderParams[osapi.container.RenderParam.VIEW] = view;
-        // 
-        // If size.width is passed to the WIDTH param this causes odd behaviour
-        // in Firefox and Opera. By using "100%" instead the gadget fills the 
-        // wrapper width even after maximizing/minimizing or changes in the region 
-        // width caused by other widgets being moved or added
-        //
-        // renderParams[osapi.container.RenderParam.WIDTH] = size.width;
-        //
-        renderParams[osapi.container.RenderParam.WIDTH] = "100%";
+        renderParams[osapi.container.RenderParam.WIDTH] = size.width;
         renderParams[osapi.container.RenderParam.HEIGHT] = size.height;
         renderParams[osapi.container.RenderParam.USER_PREFS] = getCompleteUserPrefSet(gadget.userPrefs,
gadget.metadata.userPrefs);
         container.navigateGadget(gadget.site, gadget.widgetUrl, {}, renderParams);
     }
 
-    function getSizeFromElement(id, view) {
+    function calculateSize(view, gadget) {
+    	var id = gadget.regionWidgetId;
         var elem = document.getElementById("widget-" + id + "-wrapper");
-        return {width: elem.clientWidth - OFFSET, height: view == rave.opensocial.VIEW_NAMES.CANVAS
? elem.clientHeight : MIN_HEIGHT};
+
+        // determine the height of the gadget's iframe
+        var height = MIN_HEIGHT;
+        if (view == rave.opensocial.VIEW_NAMES.CANVAS) {
+        	height = elem.clientHeight;
+        } else if (gadget.metadata.modulePrefs && gadget.metadata.modulePrefs.height)
{
+        	height = gadget.metadata.modulePrefs.height;
+        }
+        return {width: "100%", height: height};
     }
 
     /**



Mime
View raw message