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 2012/04/20 15:34:08 UTC

svn commit: r1328371 - in /rave/branches/bootstrap: ./ rave-demo-gadgets/src/main/webapp/ rave-portal-resources/src/main/webapp/WEB-INF/db/ rave-portal-resources/src/main/webapp/script/ rave-providers/rave-opensocial-provider/rave-opensocial-client/src...

Author: mfranklin
Date: Fri Apr 20 13:34:07 2012
New Revision: 1328371

URL: http://svn.apache.org/viewvc?rev=1328371&view=rev
Log:
merged in from trunk

Added:
    rave/branches/bootstrap/rave-demo-gadgets/src/main/webapp/open_views_demo.xml
      - copied unchanged from r1328330, rave/trunk/rave-demo-gadgets/src/main/webapp/open_views_demo.xml
Modified:
    rave/branches/bootstrap/   (props changed)
    rave/branches/bootstrap/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
    rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave.js
    rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_opensocial.js
    rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_wookie.js
    rave/branches/bootstrap/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java

Propchange: rave/branches/bootstrap/
------------------------------------------------------------------------------
  Merged /rave/trunk:r1326858-1328330

Modified: rave/branches/bootstrap/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql
URL: http://svn.apache.org/viewvc/rave/branches/bootstrap/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql?rev=1328371&r1=1328370&r2=1328371&view=diff
==============================================================================
--- rave/branches/bootstrap/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql (original)
+++ rave/branches/bootstrap/rave-portal-resources/src/main/webapp/WEB-INF/db/initial_data.sql Fri Apr 20 13:34:07 2012
@@ -292,6 +292,12 @@ insert into widget (entity_id, title, ur
 values(@youtube_widget_id, 'Youtube', 'http://localhost:8080/demogadgets/youtubesearch.xml', 'OpenSocial', 'A search module, which searches YouTube by tags like Politics News Life Music Family Photography Art Random Travel Personal Religion Movies Business Thoughts Media Humor Culture Poetry Christmas Writing Books Food Friends.', 'David Olsen', 'PUBLISHED', 'http://www.zytu.com/youtube/youtubesearchthumb.png', 'http://www.zytu.com/youtube/youtubesearchscreen.png', @user_id_1);
 UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @widget_seq;
 
+-- Open Views Gadget
+set @open_views_widget_id = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @widget_seq);
+insert into widget (entity_id, title, url, type, description, author, widget_status, owner_id)
+values(@open_views_widget_id, 'Open Views Demo', 'http://localhost:8080/demogadgets/open_views_demo.xml', 'OpenSocial', 'A demo gadget to show open views popups in action.', 'Erin Noe-Payne', 'PUBLISHED', @user_id_1);
+UPDATE RAVE_PORTAL_SEQUENCES SET seq_count = (seq_count + 1) WHERE seq_name = @widget_seq;
+
 -- View information
 set @gadgetview_widget_id = (SELECT seq_count FROM RAVE_PORTAL_SEQUENCES WHERE seq_name = @widget_seq);
 insert into widget (entity_id, title, url, type, widget_status, owner_id)

Modified: rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave.js
URL: http://svn.apache.org/viewvc/rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave.js?rev=1328371&r1=1328370&r2=1328371&view=diff
==============================================================================
--- rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave.js (original)
+++ rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave.js Fri Apr 20 13:34:07 2012
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-var rave = rave || (function() {
+var rave = rave || (function () {
     var providerMap = {};
     var widgetByIdMap = {};
     var context = "";
@@ -28,7 +28,7 @@ var rave = rave || (function() {
      *
      * NOTE: The UI implementation has dependencies on jQuery and jQuery UI
      */
-    var ui = (function() {
+    var ui = (function () {
         var TEXT_FIELD_TEMPLATE = "<tr>{prefLabelTemplate}<td><input type='text' id='{name}' name='{name}' value='{value}' class='{class}'></td></tr>";
         var CHECKBOX_TEMPLATE = "<tr>{prefLabelTemplate}<td><input type='checkbox' id='{name}' name='{name}' class='{class}' {checked}></td></tr>";
         var SELECT_FIELD_TEMPLATE = "<tr>{prefLabelTemplate}<td><select id='{name}' name='{name}' class='{class}'>{options}</select></td></tr>";
@@ -50,14 +50,96 @@ var rave = rave || (function() {
         var CLASS_REGEX = /{class}/g;
         var BUTTON_TEXT_REGEX = /{buttonText}/g;
 
+        var WIDGET_TOGGLE_DISPLAY_COLLAPSED_HTML = '<i class="icon-chevron-down"></i>';
+        var WIDGET_TOGGLE_DISPLAY_NORMAL_HTML = '<i class="icon-chevron-up"></i>';
+        
         var WIDGET_PREFS_LABEL_CLASS = "widget-prefs-label";
         var WIDGET_PREFS_LABEL_REQUIRED_CLASS = "widget-prefs-label-required";
         var WIDGET_PREFS_INPUT_CLASS = "widget-prefs-input";
         var WIDGET_PREFS_INPUT_REQUIRED_CLASS = "widget-prefs-input-required";
         var WIDGET_PREFS_INPUT_FAILED_VALIDATION = "widget-prefs-input-failed-validation";
 
-        var WIDGET_TOGGLE_DISPLAY_COLLAPSED_HTML = '<i class="icon-chevron-down"></i>';
-        var WIDGET_TOGGLE_DISPLAY_NORMAL_HTML = '<i class="icon-chevron-up"></i>';
+        var WIDGET_ICON_BASE_CLASS = "ui-icon";
+        var WIDGET_BTN_MINIMIZE_CLASS = "ui-icon-arrowthick-1-sw";
+        var WIDGET_TOGGLE_DISPLAY_COLLAPSED = "ui-icon-triangle-1-e";
+        var WIDGET_TOGGLE_DISPLAY_NORMAL = "ui-icon-triangle-1-s";
+        var POPUPS = {
+            sidebar:{
+                name:"sidebar",
+                selector:'.popup.slideout',
+                markup:'<div class="popup slideout"><div id="slideoutContent"></div></div>',
+                initialize:function (element) {
+                    element.data('popupType', this.name);
+                    element.show("slide", { direction:"right" }, 'fast');
+                },
+                cleanup:function (element) {
+                    element.hide("slide", { direction:"right" }, 'fast', function () {
+                        element.detach();
+                    });
+                },
+                singleton:true,
+                styleMap:{
+                    "box-sizing":"border-box",
+                    position:"fixed",
+                    top:"5%",
+                    right:0,
+                    display:"none",
+                    background:"#FFFFFF",
+                    border:"1px solid #111111",
+                    "border-right-width":"0px",
+                    width:"400px",
+                    "height":"90%",
+                    padding:"10px 10px 20px 30px",
+                    "overflow-y":"auto",
+                    "overflow-x":"visible",
+                    "z-index":5000
+                }
+            },
+            dialog:{
+                name:"dialog",
+                selector:'.popup.dialog',
+                markup:'<div class="popup dialog"></div>',
+                initialize:function (element) {
+                    element.data('popupType', this.name);
+                    var cfg = {
+                        stack:true,
+                        dialogClass:'raveDialog'
+                    }
+                    element.dialog(cfg);
+                },
+                cleanup:function (element) {
+                    element.dialog('destroy');
+                    element.detach();
+                },
+                singleton:false,
+                styleMap:{
+
+                }
+            },
+            modal_dialog:{
+                name:"modal_dialog",
+                selector:'.popup.modal_dialog',
+                markup:'<div class="popup modal_dialog"></div>',
+                initialize:function (element) {
+                    element.data('popupType', this.name);
+                    var cfg = {
+                        modal:true,
+                        dialogClass:'raveModal'
+                    }
+                    element.dialog(cfg);
+                },
+                cleanup:function (element) {
+                    element.dialog('destroy');
+                    element.detach();
+                },
+                singleton:true,
+                styleMap:{
+
+                },
+                float:false,
+                tab:false
+            }
+        }
 
         // variable to store whether or not the
         // client is a mobile device
@@ -80,10 +162,10 @@ var rave = rave || (function() {
         }
 
         var uiState = {
-            widget: null,
-            currentRegion: null,
-            targetRegion: null,
-            targetIndex: null
+            widget:null,
+            currentRegion:null,
+            targetRegion:null,
+            targetIndex:null
         };
 
         function setMobileState(mobileState) {
@@ -97,17 +179,17 @@ var rave = rave || (function() {
         function init() {
             // initialize the sortable regions
             getNonLockedRegions().sortable({
-                        connectWith: '.region', // defines which regions are dnd-able
-                        scroll: true, // whether to scroll the window if the user goes outside the areas
-                        opacity: 0.5, // the opacity of the object being dragged
-                        revert: true, // smooth snap animation
-                        cursor: 'move', // the cursor to show while dnd
-                        handle: '.widget-title-bar', // the draggable handle
-                        forcePlaceholderSize: true, // size the placeholder to the size of the widget
-                        tolerance: 'pointer', // change dnd drop zone on mouse-over
-                        start: dragStart, // event listener for drag start
-                        stop : dragStop, // event listener for drag stop
-                        over: dragOver // event listener for drag over
+                connectWith:'.region', // defines which regions are dnd-able
+                scroll:true, // whether to scroll the window if the user goes outside the areas
+                opacity:0.5, // the opacity of the object being dragged
+                revert:true, // smooth snap animation
+                cursor:'move', // the cursor to show while dnd
+                handle:'.widget-title-bar', // the draggable handle
+                forcePlaceholderSize:true, // size the placeholder to the size of the widget
+                tolerance:'pointer', // change dnd drop zone on mouse-over
+                start:dragStart, // event listener for drag start
+                stop:dragStop, // event listener for drag stop
+                over:dragOver // event listener for drag over
             });
             initWidgetUI();
         }
@@ -126,7 +208,7 @@ var rave = rave || (function() {
             //for every drag operation, create an overlay for each iframe
             //to prevent the iframe from intercepting mouse events
             //which kills drag performance
-            $(".widget").each(function(index, element) {
+            $(".widget").each(function (index, element) {
                 addOverlay($(element));
             });
         }
@@ -135,7 +217,7 @@ var rave = rave || (function() {
             var $regions = getNonLockedRegions();
 
             // reset padding to 0 after drag on all rows
-            if ($(".widgetRow").length){
+            if ($(".widgetRow").length) {
                 var rows = $regions.find(".widgetRow");
                 rows.each(resetRowsRegionsHeight);
             }
@@ -154,20 +236,20 @@ var rave = rave || (function() {
             clearState();
         }
 
-        function dragOver(event, ui){
+        function dragOver(event, ui) {
             adjustRowRegionsHeights();
         }
 
         // dynamically adjust heights of all regions
-        function adjustRowRegionsHeights(){
+        function adjustRowRegionsHeights() {
             // handle region areas for upper rows
-            if ($(".upperRow").length){
+            if ($(".upperRow").length) {
                 var rows = $(".regions").find(".upperRow");
                 rows.each(adjustUpperRowRegionsHeight);
             }
 
             // handle region areas for the bottom row
-            if ($(".bottomRow").length){
+            if ($(".bottomRow").length) {
                 var row = $(".regions").find(".bottomRow");
                 adjustBottomRowRegionsHeight(row)
             }
@@ -175,19 +257,19 @@ var rave = rave || (function() {
 
         // adjusts the padding-bottom value of all regions in bottom row to either fill the empty space or
         // act as an upper row
-        function adjustBottomRowRegionsHeight (row){
+        function adjustBottomRowRegionsHeight(row) {
             resetRowsRegionsHeight(row);
             var bodyHeight = $('body').outerHeight();
             var windowHeight = $(window).height();
             // Instances where no scroll bar currently exists
-            if (windowHeight >= bodyHeight){
+            if (windowHeight >= bodyHeight) {
                 var pageHeight = $("#pageContent").outerHeight();
                 var headerHeight = bodyHeight - pageHeight;
                 var upperRegionsMaxHeights = 0;
-                if ($(".upperRow").length){
+                if ($(".upperRow").length) {
                     var rows = $(".regions").find(".upperRow");
-                    for (var x = 0; x < rows.length; x++){
-                        var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x)) ;
+                    for (var x = 0; x < rows.length; x++) {
+                        var rowMaxHeight = getRowRegionsMaxHeight(rows.get(x));
                         upperRegionsMaxHeights = upperRegionsMaxHeights + rowMaxHeight;
                     }
                 }
@@ -208,7 +290,7 @@ var rave = rave || (function() {
 
         // adjusts the padding-bottom value of all regions in upper rows to match the value of the
         // tallest region in the row
-        function adjustUpperRowRegionsHeight (row){
+        function adjustUpperRowRegionsHeight(row) {
             // when called by each, first argument is a number instead of a row value
             var row = (typeof row === 'number') ? $(this) : row;
 
@@ -222,11 +304,11 @@ var rave = rave || (function() {
         }
 
         // Returns the height of the tallest region in row, minimum 100 px
-        function getRowRegionsMaxHeight (row){
+        function getRowRegionsMaxHeight(row) {
             var rowChildren = $(row).children();
             var maxHeight = 100;
-            for (var x = 0; x < rowChildren.length; x++){
-                if ($(rowChildren.get(x)).outerHeight() > maxHeight){
+            for (var x = 0; x < rowChildren.length; x++) {
+                if ($(rowChildren.get(x)).outerHeight() > maxHeight) {
                     maxHeight = $(rowChildren.get(x)).outerHeight();
                 }
             }
@@ -234,22 +316,22 @@ var rave = rave || (function() {
         }
 
         // Restores the padding-bottom value to the original for all regions in given row
-        function resetRowsRegionsHeight (row) {
+        function resetRowsRegionsHeight(row) {
             // when called by each, first argument is a number instead of a row value
             var row = (typeof row === 'number') ? $(this) : row;
 
             var rowChildren = $(row).children();
-            for (var x = 0; x < rowChildren.length; x++){
+            for (var x = 0; x < rowChildren.length; x++) {
                 // reset to 5, the initial value before dragging
                 $(rowChildren.get(x)).css("padding-bottom", 5);
             }
         }
 
         // Sets the padding-bottom value, so that the total height is the given value for all regions in given row
-        function setRowsRegionsHeight (row, maxHeight) {
+        function setRowsRegionsHeight(row, maxHeight) {
             var rowChildren = $(row).children();
-            for (var x = 0; x < rowChildren.length; x++){
-                if ($(rowChildren.get(x)).outerHeight() != maxHeight){
+            for (var x = 0; x < rowChildren.length; x++) {
+                if ($(rowChildren.get(x)).outerHeight() != maxHeight) {
                     var defaultPadding = parseInt($(rowChildren.get(x)).css("padding-bottom").replace("px", ""));
                     $(rowChildren.get(x)).css("padding-bottom", (defaultPadding + maxHeight - $(rowChildren.get(x)).outerHeight()));
                 }
@@ -267,19 +349,19 @@ var rave = rave || (function() {
          * Takes care of the UI part of the widget rendering. Depends heavily on the HTML structure
          */
         function initWidgetUI() {
-            $(".widget-wrapper").each(function(){
+            $(".widget-wrapper").each(function () {
                 var widgetId = extractObjectIdFromElementId($(this).attr("id"));
                 styleWidgetButtons(widgetId);
             });
         }
 
         function initMobileWidgetUI() {
-            $(".widget-wrapper").each(function(){
+            $(".widget-wrapper").each(function () {
                 var widgetId = extractObjectIdFromElementId($(this).attr("id"));
                 var widget = rave.getRegionWidgetById(widgetId);
 
                 // init the collapse/restore toggle for the title bar
-                $(this).find(".widget-title-bar-mobile").click({id: widgetId}, toggleCollapseAction);
+                $(this).find(".widget-title-bar-mobile").click({id:widgetId}, toggleCollapseAction);
             });
         }
 
@@ -295,7 +377,7 @@ var rave = rave || (function() {
             // display the widget in maximized view
             openFullScreenOverlay(regionWidgetId);
             var widget = rave.getRegionWidgetById(regionWidgetId);
-            if(typeof widget != "undefined" && isFunction(widget.maximize)) {
+            if (typeof widget != "undefined" && isFunction(widget.maximize)) {
                 widget.maximize();
             }
         }
@@ -303,7 +385,7 @@ var rave = rave || (function() {
         function minimizeAction(args) {
             var regionWidgetId = args.data.id;
             $(".dnd-overlay").remove();
-            getNonLockedRegions().sortable( "option", "disabled", false );
+            getNonLockedRegions().sortable("option", "disabled", false);
             // display the widget in normal view
             $("#widget-" + regionWidgetId + "-wrapper").removeClass("widget-wrapper-canvas").addClass("widget-wrapper");
             // hide the widget minimize button
@@ -315,7 +397,7 @@ var rave = rave || (function() {
             var widget = rave.getRegionWidgetById(regionWidgetId);
             // if the widget is collapsed execute the collapse function
             // otherwise execute the minimize function
-            if(typeof widget != "undefined"){
+            if (typeof widget != "undefined") {
                 if (widget.collapsed && isFunction(widget.collapse)) {
                     widget.collapse();
                 } else if (isFunction(widget.minimize)) {
@@ -324,13 +406,45 @@ var rave = rave || (function() {
             }
         }
 
+        function createPopup(popupType) {
+            var target = POPUPS[popupType.toLowerCase()];
+
+            if (!target) {
+                return rave.log('The popup view requested is not implemented by rave');
+            }
+
+            if (target.singleton && $(target.selector).length>0) {
+                return $(target.selector).get(0);
+            }
+
+            var popup = $(target.markup);
+            if (target.styleMap) popup.css(target.styleMap);
+            $("#pageContent").prepend(popup);
+
+            if ($.type(target.initialize) == 'function') target.initialize(popup);
+
+            return popup.get(0);
+        }
+
+        function destroyPopup(element) {
+            element = $(element);
+            var target = POPUPS[element.data('popupType')];
+
+            if (!target) {
+                rave.log('Rave has detected a destroy request for a popup whose type cannot be detected.');
+                return element.detach();
+            }
+
+            if ($.type(target.cleanup) == 'function') target.cleanup(element);
+        }
+
         function editCustomPrefsAction(args) {
             var regionWidgetId = args.data.id;
 
             // display the custom edit prefs for the widget in maximized view
             openFullScreenOverlay(regionWidgetId);
             var widget = rave.getRegionWidgetById(regionWidgetId);
-            if(typeof widget != "undefined" ) {
+            if (typeof widget != "undefined") {
                 widget.editCustomPrefs();
             }
         }
@@ -340,11 +454,11 @@ var rave = rave || (function() {
             var widget = getRegionWidgetById(regionWidgetId);
             // toggle the collapse state of the widget
             var newCollapsedValue = !widget.collapsed;
-            var functionArgs = {"regionWidgetId": regionWidgetId, "collapsed": newCollapsedValue};
+            var functionArgs = {"regionWidgetId":regionWidgetId, "collapsed":newCollapsedValue};
 
             // if this type of widget has a collapse or restore callback invoke it upon
             // successful persistence
-            if(typeof widget != "undefined") {
+            if (typeof widget != "undefined") {
                 // if this is a collapse action, and the widget has a collapse implementation function,
                 // attach it as a callback function
                 if (newCollapsedValue && isFunction(widget.collapse)) {
@@ -449,20 +563,20 @@ var rave = rave || (function() {
                 switch (userPref.dataType) {
                     case "STRING":
                         prefsFormMarkup.push(TEXT_FIELD_TEMPLATE.replace(PREF_LABEL_TEMPLATE_REGEX, prefLabelMarkup)
-                                .replace(CLASS_REGEX, prefInputClassMarkup)
-                                .replace(NAME_REGEX, userPref.name)
-                                .replace(VALUE_REGEX, typeof currentPrefValue != "undefined" ? currentPrefValue :
-                                userPref.defaultValue));
+                            .replace(CLASS_REGEX, prefInputClassMarkup)
+                            .replace(NAME_REGEX, userPref.name)
+                            .replace(VALUE_REGEX, typeof currentPrefValue != "undefined" ? currentPrefValue :
+                            userPref.defaultValue));
                         break;
                     case "BOOL":
                         var checked = typeof currentPrefValue != "undefined" ?
-                                currentPrefValue === 'true' || currentPrefValue === true :
-                                userPref.defaultValue === 'true' || userPref.defaultValue === true;
+                            currentPrefValue === 'true' || currentPrefValue === true :
+                            userPref.defaultValue === 'true' || userPref.defaultValue === true;
 
                         prefsFormMarkup.push(CHECKBOX_TEMPLATE.replace(PREF_LABEL_TEMPLATE_REGEX, prefLabelMarkup)
-                                .replace(CLASS_REGEX, prefInputClassMarkup)
-                                .replace(NAME_REGEX, userPref.name)
-                                .replace(CHECKED_REGEX, checked ? "checked" : ""));
+                            .replace(CLASS_REGEX, prefInputClassMarkup)
+                            .replace(NAME_REGEX, userPref.name)
+                            .replace(CHECKED_REGEX, checked ? "checked" : ""));
                         break;
                     case "ENUM":
                         var options = [];
@@ -470,29 +584,29 @@ var rave = rave || (function() {
                         for (var i = 0; i < userPref.orderedEnumValues.length; i++) {
                             var option = userPref.orderedEnumValues[i];
                             var selected = currentPrefValue == option.value || (typeof currentPrefValue == "undefined" &&
-                                    option.value == userPref.defaultValue);
+                                option.value == userPref.defaultValue);
                             options.push(SELECT_OPTION_TEMPLATE.replace(VALUE_REGEX, option.value)
-                                    .replace(DISPLAY_VALUE_REGEX, option.displayValue)
-                                    .replace(SELECTED_REGEX, selected ? "selected" : ""));
+                                .replace(DISPLAY_VALUE_REGEX, option.displayValue)
+                                .replace(SELECTED_REGEX, selected ? "selected" : ""));
                         }
 
                         prefsFormMarkup.push(SELECT_FIELD_TEMPLATE.replace(PREF_LABEL_TEMPLATE_REGEX, prefLabelMarkup)
-                                .replace(CLASS_REGEX, prefInputClassMarkup)
-                                .replace(NAME_REGEX, userPref.name)
-                                .replace(OPTIONS_REGEX, options.join("")));
+                            .replace(CLASS_REGEX, prefInputClassMarkup)
+                            .replace(NAME_REGEX, userPref.name)
+                            .replace(OPTIONS_REGEX, options.join("")));
                         break;
                     case "LIST":
                         var values = typeof currentPrefValue != "undefined" ? currentPrefValue : userPref.defaultValue;
                         values = values.replace(PIPE_REGEX, "\n");
                         prefsFormMarkup.push(TEXTAREA_TEMPLATE.replace(PREF_LABEL_TEMPLATE_REGEX, prefLabelMarkup)
-                                .replace(CLASS_REGEX, prefInputClassMarkup)
-                                .replace(NAME_REGEX, userPref.name)
-                                .replace(VALUE_REGEX, values));
+                            .replace(CLASS_REGEX, prefInputClassMarkup)
+                            .replace(NAME_REGEX, userPref.name)
+                            .replace(VALUE_REGEX, values));
                         break;
                     default:
                         prefsFormMarkup.push(HIDDEN_FIELD_TEMPLATE.replace(NAME_REGEX, userPref.name)
-                                .replace(VALUE_REGEX, typeof currentPrefValue != "undefined" ? currentPrefValue :
-                                userPref.defaultValue));
+                            .replace(VALUE_REGEX, typeof currentPrefValue != "undefined" ? currentPrefValue :
+                            userPref.defaultValue));
                 }
             }
 
@@ -503,9 +617,9 @@ var rave = rave || (function() {
 
             prefsFormMarkup.push("<tr><td colspan='2'>");
             prefsFormMarkup.push(PREFS_SAVE_BUTTON_TEMPLATE.replace(ELEMENT_ID_REGEX, WIDGET_PREFS_SAVE_BUTTON(regionWidget.regionWidgetId))
-                                                           .replace(BUTTON_TEXT_REGEX, rave.getClientMessage("common.save")));
+                .replace(BUTTON_TEXT_REGEX, rave.getClientMessage("common.save")));
             prefsFormMarkup.push(PREFS_CANCEL_BUTTON_TEMPLATE.replace(ELEMENT_ID_REGEX, WIDGET_PREFS_CANCEL_BUTTON(regionWidget.regionWidgetId))
-                                                             .replace(BUTTON_TEXT_REGEX, rave.getClientMessage("common.cancel")));
+                .replace(BUTTON_TEXT_REGEX, rave.getClientMessage("common.cancel")));
             prefsFormMarkup.push("</td></tr>");
             prefsFormMarkup.push("</table>");
 
@@ -513,9 +627,9 @@ var rave = rave || (function() {
             prefsElement.html(prefsFormMarkup.join(""));
 
             $("#" + WIDGET_PREFS_SAVE_BUTTON(regionWidget.regionWidgetId)).click({id:regionWidget.regionWidgetId},
-                    saveEditPrefsAction);
+                saveEditPrefsAction);
             $("#" + WIDGET_PREFS_CANCEL_BUTTON(regionWidget.regionWidgetId)).click({id:regionWidget.regionWidgetId},
-                    cancelEditPrefsAction);
+                cancelEditPrefsAction);
 
             prefsElement.show();
         }
@@ -529,7 +643,7 @@ var rave = rave || (function() {
             // note that validation of "required" prefs is only done for text and
             // textarea types, since those represent STRING and LIST inputs, and
             // are the only inputs that could potentially contain empty data
-            prefsElement.find("*").filter(":input").each(function(index, element) {
+            prefsElement.find("*").filter(":input").each(function (index, element) {
                 switch (element.type) {
                     case "text":
                         if (!validatePrefInput(element)) {
@@ -572,7 +686,7 @@ var rave = rave || (function() {
                 // focus on the first input that has validation errors
                 prefsElement.find("." + WIDGET_PREFS_INPUT_FAILED_VALIDATION).first().focus();
             } else {
-                if(isFunction(regionWidget.savePreferences)) {
+                if (isFunction(regionWidget.savePreferences)) {
                     regionWidget.savePreferences(updatedPrefs);
                 }
 
@@ -590,12 +704,12 @@ var rave = rave || (function() {
         function addOverlay(jqElm) {
             var overlay = $('<div></div>');
             var styleMap = {
-                position: "absolute",
-                height : jqElm.height(),
-                width : jqElm.width(),
-                'z-index': 10,
-                opacity : 0.7,
-                background : "#FFFFFF"
+                position:"absolute",
+                height:jqElm.height(),
+                width:jqElm.width(),
+                'z-index':10,
+                opacity:0.7,
+                background:"#FFFFFF"
             };
 
             // style it and give it the marker class
@@ -633,8 +747,8 @@ var rave = rave || (function() {
             var $toggleCollapseIcon = $("#widget-" + widgetId + "-collapse");
             $toggleCollapseIcon.html((widget.collapsed) ? WIDGET_TOGGLE_DISPLAY_COLLAPSED_HTML : WIDGET_TOGGLE_DISPLAY_NORMAL_HTML);
             $toggleCollapseIcon
-                .click({id: widgetId}, toggleCollapseAction)
-                .mousedown(function(event) {
+                .click({id:widgetId}, toggleCollapseAction)
+                .mousedown(function (event) {
                     // don't allow drag and drop when this item is clicked
                     event.stopPropagation();
                 });
@@ -667,20 +781,24 @@ var rave = rave || (function() {
         }
 
         function displayUsersOfWidget(widgetId) {
-            rave.api.rest.getUsersForWidget({widgetId: widgetId, successCallback: function(data){
+            rave.api.rest.getUsersForWidget({widgetId:widgetId, successCallback:function (data) {
                 var html = "<ul class='widget-users'>";
-                for (var i=0; i < data.length; i++) {
+                for (var i = 0; i < data.length; i++) {
                     var person = data[i];
                     var name = (person.displayName) ? person.displayName :
-                                                      ((person.preferredName) ? person.preferredName : person.givenName) + " " + person.familyName;
+                        ((person.preferredName) ? person.preferredName : person.givenName) + " " + person.familyName;
 
                     html += "<li class='widget-user'>" + name + "</li>";
                 }
-                html+="</ul>";
+                html += "</ul>";
 
                 $("<div class='dialog widget-users-dialog' title='" + $("#widget-" + widgetId + "-title").text().trim() + " " + rave.getClientMessage("widget.users.added_by") + "'>" + html + "</div>").dialog({
-                    modal: true,
-                    buttons: [{text: "Close", click: function(){$(this).dialog("close");}}]
+                    modal:true,
+                    buttons:[
+                        {text:"Close", click:function () {
+                            $(this).dialog("close");
+                        }}
+                    ]
                 });
             }});
         }
@@ -700,20 +818,22 @@ var rave = rave || (function() {
         }
 
         return {
-          init : init,
-          initMobile: initMobileWidgetUI,
-          toggleCollapseWidgetIcon: toggleCollapseWidgetIcon,
-          maximizeAction: maximizeAction,
-          minimizeAction: minimizeAction,
-          editPrefsAction: editPrefsAction,
-          editCustomPrefsAction: editCustomPrefsAction,
-          setMobileState: setMobileState,
-          getMobileState: getMobileState,
-          doWidgetUiCollapse: doWidgetUiCollapse,
-          toggleMobileWidget: toggleMobileWidget,
-          displayEmptyPageMessage: displayEmptyPageMessage,
-          displayUsersOfWidget: displayUsersOfWidget,
-          showInfoMessage: showInfoMessage
+            init:init,
+            initMobile:initMobileWidgetUI,
+            toggleCollapseWidgetIcon:toggleCollapseWidgetIcon,
+            maximizeAction:maximizeAction,
+            minimizeAction:minimizeAction,
+            createPopup:createPopup,
+            destroyPopup:destroyPopup,
+            editPrefsAction:editPrefsAction,
+            editCustomPrefsAction:editCustomPrefsAction,
+            setMobileState:setMobileState,
+            getMobileState:getMobileState,
+            doWidgetUiCollapse:doWidgetUiCollapse,
+            toggleMobileWidget:toggleMobileWidget,
+            displayEmptyPageMessage:displayEmptyPageMessage,
+            displayUsersOfWidget:displayUsersOfWidget,
+            showInfoMessage:showInfoMessage
         };
 
     })();
@@ -903,7 +1023,7 @@ var rave = rave || (function() {
      * @param message the message to log
      */
     function log(message) {
-        if(typeof console != "undefined" && console.log) {
+        if (typeof console != "undefined" && console.log) {
             console.log(message);
         }
     }
@@ -918,12 +1038,12 @@ var rave = rave || (function() {
          * @param regionId The regionId.
          * @param widget The widget.
          */
-        registerWidget : registerWidget,
+        registerWidget:registerWidget,
 
         /**
          * Initialize all of the registered providers
          */
-        initProviders : initializeProviders,
+        initProviders:initializeProviders,
 
         /**
          * Initializes the given set of widgets
@@ -933,17 +1053,17 @@ var rave = rave || (function() {
          *      type,
          *      regionWidgetId
          */
-        initWidgets : initializeWidgets,
+        initWidgets:initializeWidgets,
 
         /**
          * Initialize Rave's drag and drop facilities
          */
-        initUI : ui.init,
+        initUI:ui.init,
 
         /**
          * Initialize the mobile UI
          */
-        initMobileUI : ui.initMobile,
+        initMobileUI:ui.initMobile,
 
         /**
          * Parses the given string conforming to a rave object's DOM element ID and return
@@ -956,7 +1076,7 @@ var rave = rave || (function() {
          *
          * @param elementId the ID of the DOM element containing the widget
          */
-        getObjectIdFromDomId : extractObjectIdFromElementId,
+        getObjectIdFromDomId:extractObjectIdFromElementId,
 
         /**
          * Registers a new provider with Rave.  All providers MUST have init and initWidget functions as well as a
@@ -964,7 +1084,7 @@ var rave = rave || (function() {
          *
          * @param provider a valid Rave widget provider
          */
-        registerProvider : addProviderToList,
+        registerProvider:addProviderToList,
 
         /**
          * Renders an error in place of the widget
@@ -972,31 +1092,31 @@ var rave = rave || (function() {
          * @param id the RegionWidgetId of the widget to render in error mode
          * @param message The message to display to the user
          */
-        errorWidget: renderErrorWidget,
+        errorWidget:renderErrorWidget,
 
         /**
          * Sets the context path for the Rave web application
          *
          * @param contextPath the context path of the rave webapp
          */
-        setContext : updateContext,
+        setContext:updateContext,
 
         /**
          * Gets the current context
          */
-        getContext: getContext,
+        getContext:getContext,
 
         /**
          * Gets a regionwidget by region widget id
          */
-        getRegionWidgetById: getRegionWidgetById,
+        getRegionWidgetById:getRegionWidgetById,
 
         /**
          * View a page
          *
          * @param pageId the pageId to view, or if null, the user's default page
          */
-        viewPage: viewPage,
+        viewPage:viewPage,
 
         /**
          * View the widget detail page of a widget
@@ -1004,14 +1124,14 @@ var rave = rave || (function() {
          * @param widgetId to widgetId to view
          * @param referringPageId the entityId of the page the call is coming from
          */
-        viewWidgetDetail: viewWidgetDetail,
+        viewWidgetDetail:viewWidgetDetail,
 
         /**
          * Toggles the collapse/restore icon of the rendered widget
          *
          * @param widgetId the widgetId of the rendered widget to toggle
          */
-        toggleCollapseWidgetIcon: ui.toggleCollapseWidgetIcon,
+        toggleCollapseWidgetIcon:ui.toggleCollapseWidgetIcon,
 
         /***
          * Utility function to determine if a javascript object is a function or not
@@ -1019,21 +1139,36 @@ var rave = rave || (function() {
          * @param obj the object to check
          * @return true if obj is a function, false otherwise
          */
-        isFunction: isFunction,
+        isFunction:isFunction,
 
         /***
          * Maximize the widget view
          *
          * @param args the argument object
          */
-        maximizeWidget: ui.maximizeAction,
+        maximizeWidget:ui.maximizeAction,
 
         /***
          * Minimize the widget view (render in non full-screen mode)
          *
          * @param args the argument object
          */
-        minimizeWidget: ui.minimizeAction,
+        minimizeWidget:ui.minimizeAction,
+
+        /***
+         * Create a new popup in the rave container
+         *
+         * @param popupType the type of popup that will be created
+         * @return the new dom element created
+         */
+        createPopup:ui.createPopup,
+
+        /***
+         * Destroy a popup currently active in the rave container
+         *
+         * @param element the popup dom element
+         */
+        destroyPopup:ui.destroyPopup,
 
         /***
          * Display the inline edit prefs section for widget preferences inside
@@ -1042,20 +1177,20 @@ var rave = rave || (function() {
          * @param regionWidgetId the regionWidgetId of the widget
          *
          */
-        editPrefs: ui.editPrefsAction,
+        editPrefs:ui.editPrefsAction,
 
         /***
          * "Preferences" view
          *
          * @param args the argument object
          */
-        editCustomPrefs: ui.editCustomPrefsAction,
+        editCustomPrefs:ui.editCustomPrefsAction,
 
         /***
          * Get the mobile state - used by the UI to render mobile or normal content
          *
          */
-        isMobile: ui.getMobileState,
+        isMobile:ui.getMobileState,
 
         /***
          * Set the mobile state - used by the UI to render mobile or normal content
@@ -1063,54 +1198,54 @@ var rave = rave || (function() {
          * @param mobileState boolean to represent the mobile state
          *
          */
-        setMobile: ui.setMobileState,
+        setMobile:ui.setMobileState,
 
         /**
          * Performs the client side work of collapsing/restoring a widget
          * @param args
          */
-        doWidgetUiCollapse: ui.doWidgetUiCollapse,
+        doWidgetUiCollapse:ui.doWidgetUiCollapse,
 
         /**
          * Toggles a mobile widget collapse/restore
          * @param args
          */
-        toggleMobileWidget: ui.toggleMobileWidget,
+        toggleMobileWidget:ui.toggleMobileWidget,
 
         /**
          * Determines if a page is empty (has zero widgets)
          * @param widgetByIdMap the map of widgets on the page
          */
-        isPageEmpty: isPageEmpty,
+        isPageEmpty:isPageEmpty,
 
         /**
          * Removes a regionWidgetId from the internal widget map
          * @param regionWidgetId the region widget id to remove
          */
-        removeWidgetFromMap: removeWidgetFromMap,
+        removeWidgetFromMap:removeWidgetFromMap,
 
         /**
          * Displays the "empty page" message on the page
          */
-        displayEmptyPageMessage: ui.displayEmptyPageMessage,
+        displayEmptyPageMessage:ui.displayEmptyPageMessage,
 
         /**
          * Displays the users of a supplied widgetId in a dialog box
          */
-        displayUsersOfWidget: ui.displayUsersOfWidget,
+        displayUsersOfWidget:ui.displayUsersOfWidget,
 
         /**
          * Displays an info message at the top of the page.
          * @param message The message to display.
          */
-        showInfoMessage: ui.showInfoMessage,
+        showInfoMessage:ui.showInfoMessage,
 
         /**
          * Returns a language specific message based on the supplied key
          *
          * @param key the key of the message
          */
-        getClientMessage: getClientMessage,
+        getClientMessage:getClientMessage,
 
         /**
          * Adds a message to the internal client message map
@@ -1118,7 +1253,7 @@ var rave = rave || (function() {
          * @param key
          * @param message
          */
-        addClientMessage: addClientMessage,
+        addClientMessage:addClientMessage,
 
         /**
          * Gets the singleton Managed OpenAJAX 2.0 Hub
@@ -1135,6 +1270,6 @@ var rave = rave || (function() {
          *
          * @param message the message to log
          */
-        log: log
+        log:log
     }
 })();

Modified: rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_opensocial.js
URL: http://svn.apache.org/viewvc/rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_opensocial.js?rev=1328371&r1=1328370&r2=1328371&view=diff
==============================================================================
--- rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_opensocial.js (original)
+++ rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_opensocial.js Fri Apr 20 13:34:07 2012
@@ -8,7 +8,7 @@
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
- 
+
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,27 +17,34 @@
  * under the License.
  */
 var rave = rave || {};
-rave.opensocial = rave.opensocial || (function() {
+rave.opensocial = rave.opensocial || (function () {
     var WIDGET_TYPE = "OpenSocial";
     var OFFSET = 10;
     var MIN_HEIGHT = 250;
-    var VIEW_NAMES = { 
-        CANVAS : "canvas",
-        DEFAULT : "default",
-        HOME : "home",
-        PREFERENCES: "preferences"
-    }; 
+    var VIEW_NAMES = {
+        CANVAS:"canvas",
+        DEFAULT:"default",
+        HOME:"home",
+        PREFERENCES:"preferences"
+    };
+    var VIEW_TARGETS = {
+        TAB: 'tab',
+        DIALOG: 'dialog',
+        MODALDIALOG: 'modal_dialog',
+        SIDEBAR: 'sidebar'
+    }
 
     var container;
-    
+
     /**
      * Initialization
      */
     function initOpenSocial() {
         initContainer();
         registerRpcHooks();
+        implementViews();
         gadgets.pubsub2router.init({
-            hub: rave.getManagedHub()
+            hub:rave.getManagedHub()
         })
     }
 
@@ -76,6 +83,36 @@ rave.opensocial = rave.opensocial || (fu
         container.rpcRegister('set_pref', setPref);
     }
 
+    function implementViews() {
+
+        container.views = {
+            'createElementForGadget':function (metadata, rel, opt_view, opt_viewTarget, opt_coordinates, parentSite) {
+                if (opt_viewTarget) {
+                    return rave.createPopup(opt_viewTarget);
+                }
+            },
+
+
+            'createElementForEmbeddedExperience':function (rel, opt_gadgetInfo, opt_viewTarget, opt_coordinates, parentSite) {
+                if (opt_viewTarget) {
+                    return rave.createPopup(opt_viewTarget);
+                }
+            },
+
+            'createElementForUrl':function (rel, opt_viewTarget, opt_coordinates, parentSite) {
+                if (opt_viewTarget) {
+                    return rave.createPopup(opt_viewTarget);
+                }
+            },
+
+            'destroyElement':function (site) {
+                var element = site.el_;
+                container.closeGadget(site);
+                rave.destroyPopup(element);
+            }
+        };
+    }
+
     /**
      * Validates a gadget's metadata and renders it on the page
      *
@@ -105,7 +142,7 @@ rave.opensocial = rave.opensocial || (fu
             container.preloadCaches(preloadConfig);
             renderNewGadget(gadget);
         } else {
-            rave.errorWidget(gadget.regionWidgetId, rave.getClientMessage("opensocial.render_error") +  "<br /><br />" + validationResult.error);
+            rave.errorWidget(gadget.regionWidgetId, rave.getClientMessage("opensocial.render_error") + "<br /><br />" + validationResult.error);
         }
     }
 
@@ -116,27 +153,27 @@ rave.opensocial = rave.opensocial || (fu
     function renderNewGadget(gadget) {
         var widgetBodyElement = document.getElementById(["widget-", gadget.regionWidgetId, "-body"].join(""));
         gadget.site = container.newGadgetSite(widgetBodyElement);
-        gadget.maximize = function() { 
+        gadget.maximize = function () {
             // always display the gadget in canvas view even if it currently collapsed
-            renderGadgetView(rave.opensocial.VIEW_NAMES.CANVAS, this); 
+            renderGadgetView(rave.opensocial.VIEW_NAMES.CANVAS, this);
         };
-        gadget.minimize = function() { 
-            renderGadgetViewIfNotCollapsed(rave.opensocial.VIEW_NAMES.HOME, this);             
+        gadget.minimize = function () {
+            renderGadgetViewIfNotCollapsed(rave.opensocial.VIEW_NAMES.HOME, this);
         };
-        gadget.collapse = function() { 
+        gadget.collapse = function () {
             // hide the iframe of the gadget via css
-            $(getGadgetIframeByWidgetId(this.regionWidgetId)).hide();            
+            $(getGadgetIframeByWidgetId(this.regionWidgetId)).hide();
         };
-        gadget.restore = function() {
-             renderGadgetView(rave.opensocial.VIEW_NAMES.HOME, rave.getRegionWidgetById(this.regionWidgetId));
+        gadget.restore = function () {
+            renderGadgetView(rave.opensocial.VIEW_NAMES.HOME, rave.getRegionWidgetById(this.regionWidgetId));
         };
-        gadget.savePreferences = function(userPrefs) {
+        gadget.savePreferences = function (userPrefs) {
             this.userPrefs = userPrefs;
-            rave.api.rest.saveWidgetPreferences({regionWidgetId: this.regionWidgetId, userPrefs: userPrefs});
+            rave.api.rest.saveWidgetPreferences({regionWidgetId:this.regionWidgetId, userPrefs:userPrefs});
             // re-render the gadget in the same view if the gadget is not collapsed
-            renderGadgetViewIfNotCollapsed(rave.opensocial.getCurrentView(this.regionWidgetId), this);             
+            renderGadgetViewIfNotCollapsed(rave.opensocial.getCurrentView(this.regionWidgetId), this);
         };
-        gadget.editCustomPrefs = function() {
+        gadget.editCustomPrefs = function () {
             // display the gadget in custom edit prefs view
             renderGadgetView(rave.opensocial.VIEW_NAMES.PREFERENCES, this);
         };
@@ -144,24 +181,24 @@ rave.opensocial = rave.opensocial || (fu
         // if the gadget has prefences to edit, or has the Preferences view
         // enable the edit prefs menu item
         if (gadget.metadata.hasPrefsToEdit || gadget.metadata.views.preferences) {
-            if ( gadget.metadata.views.preferences != undefined ) {
+            if (gadget.metadata.views.preferences != undefined) {
                 rave.layout.enableEditPrefsMenuItem(gadget.regionWidgetId, true);
             }
             else {
                 rave.layout.enableEditPrefsMenuItem(gadget.regionWidgetId, false);
             }
         }
-        
+
         // if the gadget is not collapsed, render it
-        renderGadgetViewIfNotCollapsed(rave.opensocial.VIEW_NAMES.HOME, gadget);        
+        renderGadgetViewIfNotCollapsed(rave.opensocial.VIEW_NAMES.HOME, gadget);
     }
-    
+
     /**
-     * Utility function to render a gadget in the supplied view if the gadget's 
+     * Utility function to render a gadget in the supplied view if the gadget's
      * collapsed attribute is false
      * @param view the OpenSocial view to render
      * @param gadget the OpenSocial gadget to render
-     */ 
+     */
     function renderGadgetViewIfNotCollapsed(view, gadget) {
         if (!gadget.collapsed) {
             renderGadgetView(view, gadget);
@@ -185,23 +222,23 @@ rave.opensocial = rave.opensocial || (fu
     }
 
     function calculateSize(view, gadget) {
-    	var id = gadget.regionWidgetId;
+        var id = gadget.regionWidgetId;
         var elem = document.getElementById("widget-" + id + "-wrapper");
 
         // determine the height of the gadget's iframe
         var height = MIN_HEIGHT;
         if (view == rave.opensocial.VIEW_NAMES.CANVAS) {
-        	height = elem.clientHeight;
+            height = elem.clientHeight;
         } else if (gadget.metadata.modulePrefs && gadget.metadata.modulePrefs.height) {
-        	height = gadget.metadata.modulePrefs.height;
+            height = gadget.metadata.modulePrefs.height;
         }
-        return {width: "100%", height: height};
+        return {width:"100%", height:height};
     }
 
     /**
      * Returns the Common Container activeSiteHolder object for the given widgetId
      * @param widgetId the widgetId
-     */ 
+     */
     function getActiveSiteHolderByWidgetId(widgetId) {
         return rave.getRegionWidgetById(widgetId).site.getActiveSiteHolder();
     }
@@ -211,14 +248,14 @@ rave.opensocial = rave.opensocial || (fu
      */
     function getGadgetIframeByWidgetId(widgetId) {
         return getActiveSiteHolderByWidgetId(widgetId).getIframeElement();
-    }        
+    }
 
     /**
      * validates the metadata for the current gadget
      * @param metadata the metadata object to validate
      */
     function validateMetadata(metadata) {
-        if(typeof metadata.error != "undefined") {
+        if (typeof metadata.error != "undefined") {
             return {valid:false, error:metadata.error.message};
         }
 
@@ -239,7 +276,7 @@ rave.opensocial = rave.opensocial || (fu
         }
         return combined;
     }
-    
+
     /**
      * Gets the current view name of a gadget
      * @param regionWidgetId of the gadget
@@ -285,47 +322,47 @@ rave.opensocial = rave.opensocial || (fu
         }
 
     }
-     
+
     /**
      * Saves a userPref for the widget
-     * 
+     *
      * @param args RPC event args
      * @param editToken this is an old deprecated parameter but still needs to be in the signature for proper binding
      * @param prefName the userpref name
      * @param prefValue the userpref value
-     */ 
-    function setPref(args, editToken, prefName, prefValue) {        
+     */
+    function setPref(args, editToken, prefName, prefValue) {
         var widgetId = rave.getObjectIdFromDomId(args.gs.getActiveSiteHolder().getElement().id);
         var regionWidget = rave.getRegionWidgetById(widgetId);
         // update the memory prefs object
         regionWidget.userPrefs[prefName] = prefValue;
         // persist it to database
-        rave.api.rest.saveWidgetPreference({regionWidgetId: widgetId, userPref: {prefName: prefName, prefValue: prefValue}});        
+        rave.api.rest.saveWidgetPreference({regionWidgetId:widgetId, userPref:{prefName:prefName, prefValue:prefValue}});
     }
-      
+
     /**
      * Re-renders the gadget in the requested view
      *
      * @param args RPC event args
      * @param viewName the view name to render
      */
-    function requestNavigateTo(args, viewName) {       
+    function requestNavigateTo(args, viewName) {
         var widgetId = rave.getObjectIdFromDomId(args.gs.getActiveSiteHolder().getElement().id);
         var fnArgs = {};
         fnArgs.data = {}
         fnArgs.data.id = widgetId;
-        
-        switch(viewName) {
-            case VIEW_NAMES.CANVAS:  
+
+        switch (viewName) {
+            case VIEW_NAMES.CANVAS:
                 rave.maximizeWidget(fnArgs);
                 break;
-            case VIEW_NAMES.HOME:            
+            case VIEW_NAMES.HOME:
                 rave.minimizeWidget(fnArgs);
                 break;
             case VIEW_NAMES.PREFERENCES:
                 rave.editCustomPrefs(fnArgs);
                 break;
-        }       
+        }
     }
 
     /**
@@ -334,40 +371,43 @@ rave.opensocial = rave.opensocial || (fu
     function isArray(o) {
         return Object.prototype.toString.call(o) == "[object Array]";
     }
-    
+
+
     /**
      * Exposed public API calls
      */
     return {
-        TYPE : WIDGET_TYPE,
-        
-        VIEW_NAMES : VIEW_NAMES,
+        TYPE:WIDGET_TYPE,
+
+        VIEW_NAMES:VIEW_NAMES,
+
+        VIEW_TARGETS: VIEW_TARGETS,
         /**
          * Initializes the Rave OpenSocial machinery
          */
-        init : initOpenSocial,
+        init:initOpenSocial,
         /**
          * Gets a reference to the container singleton
          */
-        container: getContainer,
+        container:getContainer,
         /**
          * Instantiates and renders the given gadget
          * @param a gadget to render
          */
-        initWidget: validateAndRenderGadget,
+        initWidget:validateAndRenderGadget,
 
         /**
          * Resets the current OpenSocial container
          */
-        reset: resetContainer,
+        reset:resetContainer,
         /**
          * Gets the current view name of the given gadget
          * @param regionWidgetId of the gadget
          */
-        getCurrentView: getCurrentView
+        getCurrentView:getCurrentView
     };
 
 })();
 
 //Register the widget provider with Rave
-rave.registerProvider(rave.opensocial);
\ No newline at end of file
+rave.registerProvider(rave.opensocial);

Modified: rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_wookie.js
URL: http://svn.apache.org/viewvc/rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_wookie.js?rev=1328371&r1=1328370&r2=1328371&view=diff
==============================================================================
--- rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_wookie.js (original)
+++ rave/branches/bootstrap/rave-portal-resources/src/main/webapp/script/rave_wookie.js Fri Apr 20 13:34:07 2012
@@ -24,55 +24,79 @@ rave.wookie = rave.wookie || (function()
     // keep this value so we can show the widget in the maximize view even when its collapsed
     var userCollapsed;
     var container;
+    
+    
+    function onClientSecurityAlert(source, alertType) {  /* Handle client-side security alerts */  }
+    function onClientConnect(container) {        /* Called when client connects */   }
+    function onClientDisconnect(container) {     /* Called when client disconnects */ }
 
     function validateAndRenderWidget(widget){
     	userCollapsed = widget.collapsed;
         var widgetBodyElement = document.getElementById(["widget-", widget.regionWidgetId, "-body"].join(""));
+        
+        var height = MIN_HEIGHT;
+        if (widget.height) height = widget.height;
+        
+        //
+        // Create a global onload callback handler for making the widget
+        // visible after its container is ready
+        //
+        window["onWidget"+widget.regionWidgetId+"Load"] = function(){
+           window.document.getElementById(widget.regionWidgetId).style.visibility="visible";
+        };
 
-        var widgetIframe = document.createElement("iframe");
-
-        if (widget.height){
-          widgetIframe.setAttribute("height",widget.height);
-          widgetIframe.setAttribute("min-height",MIN_HEIGHT+"px");
-        } else {
-          widgetIframe.setAttribute("height",MIN_HEIGHT+"px");
-          widgetIframe.setAttribute("min-height",MIN_HEIGHT+"px");
+        //
+        // Create OpenAjax IFrame container
+        //
+        var ooacontainer = new OpenAjax.hub.IframeContainer(rave.getManagedHub() , ""+widget.regionWidgetId,
+        {
+          Container: {
+            onSecurityAlert: onClientSecurityAlert,
+            onConnect:       onClientConnect,
+            onDisconnect:    onClientDisconnect
+          },
+          IframeContainer: {
+            parent:      widgetBodyElement, 
+            iframeAttrs: { 
+                style: { width:"100%"},
+                vspace: 0,
+                hspace: 0,
+                marginheight: 0,
+                marginwidth: 0,
+                scroll: "no",
+                frameborder: 0,
+                height: height,
+                "min-height": ""+MIN_HEIGHT+"px"
+            },
+            uri: widget.widgetUrl,
+            onGadgetLoad: "onWidget"+widget.regionWidgetId+"Load"
+          }
         }
-        // Rendering the widgets width causes the w3c widget to appear outside of the
-        // container object in some browsers.  Setting to 100% seems to fix this. 
-        // (there is something similar in the rave_opensocial.js file)
-        widgetIframe.setAttribute("style","width: 100%");
-        widgetIframe.setAttribute("src",widget.widgetUrl);
-        widgetIframe.setAttribute("scroll","no");
-        widgetIframe.setAttribute("frameborder","0");
-        widgetIframe.setAttribute("vspace","0");
-        widgetIframe.setAttribute("hspace","0");
-        widgetIframe.setAttribute("marginheight","0");
-        widgetIframe.setAttribute("marginwidth","0");
-        widgetBodyElement.appendChild(widgetIframe);
+        );
+        
         // collapse/restore functions
         widget.collapse = function() {
-            $(widgetIframe).hide();
+            $(ooacontainer.getIframe).hide();
         };
         widget.restore = function() {
-            $(widgetIframe).show();
+            $(ooacontainer.getIframe).show();
         };
         widget.maximize = function() {
             // always display the widget in canvas view even if it currently collapsed
             if (widget.collapsed){
                 userCollapsed = true;
-                $(widgetIframe).show();
+                $(ooacontainer.getIframe).show();
             }
         };
         widget.minimize = function() {
             if (widget.collapsed){
                 userCollapsed = false;
-                $(widgetIframe).hide();
+                $(ooacontainer.getIframe).hide();
             }
         };
         // if in the collapsed state, hide the layer
         if (widget.collapsed){
-            $(widgetIframe).hide();
+            $(ooacontainer.getIframe).hide();
         }
     }
 

Modified: rave/branches/bootstrap/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java
URL: http://svn.apache.org/viewvc/rave/branches/bootstrap/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java?rev=1328371&r1=1328370&r2=1328371&view=diff
==============================================================================
--- rave/branches/bootstrap/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java (original)
+++ rave/branches/bootstrap/rave-providers/rave-opensocial-provider/rave-opensocial-client/src/main/java/org/apache/rave/provider/opensocial/config/OpenSocialEnvironment.java Fri Apr 20 13:34:07 2012
@@ -33,7 +33,7 @@ import javax.annotation.PostConstruct;
 @Component
 public class OpenSocialEnvironment {
 
-    private static final String SCRIPT_TEMPLATE = "<script src=\"%1$s://%2$s%3$s/js/container:pubsub-2.js?c=1&amp;container=default&amp;debug=1\"></script>";
+    private static final String SCRIPT_TEMPLATE = "<script src=\"%1$s://%2$s%3$s/js/container:pubsub-2:open-views.js?c=1&amp;container=default&amp;debug=1\"></script>";
 
     private ScriptManager scriptManager;