Author: erinnp
Date: Mon Jun 24 15:16:19 2013
New Revision: 1496087

URL: http://svn.apache.org/r1496087
Log:
refactoring of page.jsp

Added:
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_state_manager.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
      - copied, changed from r1495530, 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
Removed:
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_context.js
Modified:
    rave/branches/require/rave-portal-resources/pom.xml
    rave/branches/require/rave-portal-resources/src/main/resources/wro.xml
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
    
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/app.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_admin.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_backbone.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_display.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_event_bindings.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_forms.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_layout.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_models.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_person_profile.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_store.js
    
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_ui.js

Modified: rave/branches/require/rave-portal-resources/pom.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/pom.xml?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/pom.xml (original)
+++ rave/branches/require/rave-portal-resources/pom.xml Mon Jun 24 15:16:19 2013
@@ -120,7 +120,7 @@
                             
<jsSrcDir>${project.basedir}/src/main/webapp/static/script/core</jsSrcDir>
                             <debug>true</debug>
                             <sourceIncludes>
-                                <include>rave_core.js</include>
+                                <include>rave_widget_manager.js</include>
                                 <include>rave_api.js</include>
                                 <include>rave_widget.js</include>
                                 <include>rave_opensocial.js</include>

Modified: rave/branches/require/rave-portal-resources/src/main/resources/wro.xml
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/resources/wro.xml?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/resources/wro.xml 
(original)
+++ rave/branches/require/rave-portal-resources/src/main/resources/wro.xml Mon 
Jun 24 15:16:19 2013
@@ -20,7 +20,7 @@ under the License.
 <groups xmlns="http://www.isdc.ro/wro";>
     <!-- defines a wro4j group called rave-all.min which represents all of our 
javascript files -->
     <group name="rave.core.min">
-        <js>/static/script/core/rave_core.js</js>
+        <js>/static/script/core/rave_widget_manager.js</js>
         <js>/static/script/core/rave_ajax.js</js>
         <js>/static/script/core/rave_api.js</js>
         <js>/static/script/core/rave_widget.js</js>

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
 Mon Jun 24 15:16:19 2013
@@ -21,7 +21,6 @@
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
 <fmt:setBundle basename="messages"/>
 <jsp:useBean id="pages" type="java.util.List<org.apache.rave.model.Page>" 
scope="request"/>
-<jsp:useBean id="pageUser" type="org.apache.rave.model.PageUser" 
scope="request"/>
 <jsp:useBean id="pageLayouts" type="java.util.List" scope="request"/>
 
 <%--@elvariable id="page" type="org.apache.rave.model.Page"--%>
@@ -433,29 +432,26 @@
 
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
-        <%--require(["rave", "core/rave_widget", "portal/rave_portal", 
"portal/rave_layout", "portal/rave_models", "portal/rave_event_bindings", 
"jquery"], function (rave, raveRegionWidget, ravePortal, raveLayout, 
raveModels, raveEventBindings, $) {--%>
-            <%--rave.init();--%>
-            <%--rave.RegionWidget.defaultView = 'home';--%>
-
-            <%--$(function () {--%>
-                <%--ravePortal.initPageEditorStatus(<c:out 
value="${pageUser.editor}"/>);--%>
-                
<%--raveLayout.init(${applicationProperties['portal.export.ui.enable']});--%>
-                <%--rave.renderWidgets('home');--%>
-
-                <%--raveEventBindings.bindEvents('page.jsp');--%>
-            <%--});--%>
-
-            <%--raveModels.currentPage.set({id: ${page.id}, ownerId: 
${page.ownerId}, viewerId: <sec:authentication property="principal.id" />}, 
{silent: true})--%>
-        <%--});--%>
+        require(["rave"], function (rave) {
+            rave.setDefaultView('home');
+            rave.setPage({id: ${page.id}, ownerId: ${page.ownerId}, viewerId: 
<sec:authentication property="principal.id" />});
+            rave.getViewer.editor=<c:out value="${pageUser.editor}"/>;
+            
rave.setExportEnabled(${applicationProperties['portal.export.ui.enable']});
+
+            require(["ui", 'jquery'], function (ui, $) {
+                ui.models.currentPage.set({id: ${page.id}, ownerId: 
${page.ownerId}, viewerId: <sec:authentication property="principal.id" />}, 
{silent: true})
+
+                <c:forEach var="members" items="${page.members}">
+                <portal:person id="${members.userId}" var="member"/>
+                ui.models.currentPage.addInitData('${member.id}', 
${members.editor})
+                </c:forEach>
+                $(function () {
+                    ui.bindEvents('page.jsp');
+                    rave.renderWidgets('home');
+                });
+            });
+        });
 
     </script>
-    <c:forEach var="members" items="${page.members}">
-        <portal:person id="${members.userId}" var="member"/>
-        <script>
-            <%--require(["portal/rave_models", "jquery"], function 
(raveModels, $) {--%>
-                <%--raveModels.currentPage.addInitData('${member.id}', 
${members.editor})--%>
-            <%--})--%>
-        </script>
-    </c:forEach>
-</portal:register-init-script>
-F
\ No newline at end of file
+
+</portal:register-init-script>
\ No newline at end of file

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
 Mon Jun 24 15:16:19 2013
@@ -38,22 +38,19 @@
 <portal:render-script location="${'AFTER_RAVE'}"/>
 <%-- common javascript to execute on all pages --%>
 <script>
-    <%--require(["rave", "portal/rave_portal"], function (rave, ravePortal) 
{--%>
-        <%--&lt;%&ndash; set the web application context &ndash;%&gt;--%>
-        <%--rave.api.setContext("<spring:url value="/app/" />");--%>
-        <%--&lt;%&ndash; set the javascript debug mode so js code has access 
to it &ndash;%&gt;--%>
-        <%--ravePortal.setJavaScriptDebugMode(<c:out 
value="${jsDebugMode}"/>);--%>
-        <%--&lt;%&ndash; set the default widget height so js code has access 
to it &ndash;%&gt;--%>
-        <%--rave.RegionWidget.defaultHeight = <c:out 
value="${portalSettings['defaultWidgetHeight'].value}"/>;--%>
-        <%--&lt;%&ndash; set the current page viewer &ndash;%&gt;--%>
-        <%--<sec:authorize access="isAuthenticated()">--%>
-            <%--<sec:authentication property="principal.username" 
scope="request" var="username"/>--%>
-            <%--<sec:authentication property="principal.id" scope="request" 
var="id"/>--%>
-            <%--ravePortal.setPageViewer({username: "${username}", id: 
"${id}"});--%>
-        <%--</sec:authorize>--%>
-    <%--})--%>
+    require(["rave"], function (rave) {
+        <%-- set the web application context --%>
+        rave.setContext("<spring:url value="/app/" />");
+        <%-- set the default widget height so js code has access to it --%>
+        rave.setDefaultHeight(<c:out 
value="${portalSettings['defaultWidgetHeight'].value}"/>);
+        <%-- set the current page viewer --%>
+        <sec:authorize access="isAuthenticated()">
+        <sec:authentication property="principal.username" scope="request" 
var="username"/>
+        <sec:authentication property="principal.id" scope="request" var="id"/>
+        rave.setViewer({username: "${username}", id: "${id}"});
+        </sec:authorize>
 
-    require(['rave'], function(rave) {
-        rave.init();
-    });
+        <%-- set the javascript debug mode so js code has access to it --%>
+        <%--ui.setJavaScriptDebugMode(<c:out value="${jsDebugMode}"/>);--%>
+    })
 </script>

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/app.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/app.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/app.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/app.js
 Mon Jun 24 15:16:19 2013
@@ -18,12 +18,11 @@
  */
 
 requirejs.config({
-    baseUrl: 'static/script',
+    baseUrl: '/portal/static/script',
     "paths":{
         
"backbone":"//cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.10/backbone-min",
         "bootstrap": 
'//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.0.3/bootstrap.min',
         "clientMessages": "/portal/app/messagebundle/rave_client_messages",
-        "event_bindings": "./portal",
         
"handlebars":"//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.2/handlebars.min",
         "jquery": "//ajax.aspnetcdn.com/ajax/jquery/jquery-1.7.2.min",
         "jqueryUi":"//ajax.aspnetcdn.com/ajax/jquery.ui/1.8.17/jquery-ui.min",
@@ -31,8 +30,8 @@ requirejs.config({
         
"jqueryHashChange":'//cdnjs.cloudflare.com/ajax/libs/jquery-hashchange/v1.3/jquery.ba-hashchange.min',
         "jqueryTouchPouch": 
'//cdnjs.cloudflare.com/ajax/libs/jqueryui-touch-punch/0.2.2/jquery.ui.touch-punch.min',
         
"osapi":"/gadgets/js/container:pubsub-2:open-views.js?c=1&container=default&debug=1",
-        "portal": "./portal",
-        "rave": "./core/main",
+        "rave": "core/main",
+        "ui": "portal/main",
         "underscore": 
"//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min"
     },
     shim: {

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/main.js
 Mon Jun 24 15:16:19 2013
@@ -17,13 +17,18 @@
  * under the License.
  */
 
-define(['underscore', 'core/rave_core', 'core/rave_api', 'core/rave_widget', 
'core/rave_log', 'core/rave_view_manager'],
-    function (_, rave, api, RegionWidget, log, viewManager) {
+define(['underscore', 'core/rave_widget_manager', 'core/rave_api',
+    'core/rave_widget', 'core/rave_log', 'core/rave_view_manager', 
'core/rave_state_manager'],
+    function (_, widgetManager, api, RegionWidget, log, viewManager, 
stateManager) {
+
+        var rave = {};
 
         rave.api = api;
         rave.RegionWidget = RegionWidget;
         rave.log = log;
         _.extend(rave, viewManager);
+        _.extend(rave, widgetManager);
+        _.extend(rave, stateManager);
 
         return rave;
     }

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_api.js
 Mon Jun 24 15:16:19 2013
@@ -18,9 +18,9 @@
  */
 
 //TODO: jquery dependency should not be here.
-define(['underscore', 'jquery', 'core/rave_ajax'], function(_, $, ajax){
+define(['underscore', 'jquery', 'core/rave_ajax', 'core/rave_state_manager'], 
function(_, $, ajax, stateManager){
     //stores virtual host context of application execution
-    var context = "";
+    var context = stateManager.getContext();
 
     function handleError(jqXhr, status, error) {
         alert(error);
@@ -1007,14 +1007,10 @@ define(['underscore', 'jquery', 'core/ra
 
     })();
 
-    var setContext = function (ctx) {
-        context = ctx;
-    }
 
     return {
         rest: restApi,
         rpc: rpcApi,
-        handler: handlerApi,
-        setContext: setContext
+        handler: handlerApi
     };
 })
\ No newline at end of file

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_opensocial.js
 Mon Jun 24 15:16:19 2013
@@ -18,217 +18,218 @@
  */
 
 //TODO: Remove dependency on rave_ui when moving to angular
-define(['underscore', 'core/rave_view_manager', 'core/rave_api', 
'core/rave_openajax_hub', 'core/rave_log', 'osapi'],
-    function(_, viewManager, api, managedHub, log){
-    var exports = {};
-
-    var container;
-
-    var containerConfig = {};
-    containerConfig[osapi.container.ServiceConfig.API_PATH] = "/rpc";
-    //TODO: Handle moving out javaScriptDebugMode
-    //containerConfig[osapi.container.ContainerConfig.RENDER_DEBUG] = 
ravePortal.getJavaScriptDebugMode();
-    container = new osapi.container.Container(containerConfig);
-
-    gadgets.pubsub2router.init({
-        hub:managedHub
-    });
-
-    rpcRegister();
-    implementViews();
-
-
-    function rpcRegister() {
-        container.rpcRegister('requestNavigateTo', requestNavigateTo);
-        container.rpcRegister('set_pref', setPref);
-        container.rpcRegister('set_title', setTitle);
-        container.rpcRegister('hideWidget', hideWidget);
-        container.rpcRegister('showWidget', showWidget);
-    }
-
-    function requestNavigateTo(args, viewName, opt_params, opt_ownerId) {
-        var widget = args.gs._widget,
-            viewSurface = viewName.split('.')[0],
-            renderInto = viewManager.getView(viewSurface) ? viewSurface : 
widget._el;
-
-        widget.render(renderInto, {view: viewName, view_params: opt_params, 
ownerId: opt_ownerId});
-    }
-
-    function setPref(args, editToken, prefName, prefValue) {
-        var widget = args.gs._widget;
-        widget.savePreference(prefName, prefValue);
-    }
-
-    /*
-     TODO: these rely on a gadget's view implementing a method
-     */
-    function setTitle(args) {
-        var widget = args.gs._widget;
-        if (widget._view && widget._view.setTitle) {
-            var title = _.isArray(args.a) ? args.a[0] : args.a;
-            widget._view.setTitle(title);
-        }
-    }
-
-    function hideWidget(args, viewName, opt_params, opt_ownerId) {
-        var widget = args.gs._widget;
-        if (widget._view && widget._view.collapse) {
-            widget._view.collapse();
-        }
-    }
-
-    function showWidget(args, viewName, opt_params, opt_ownerId) {
-        var widget = args.gs._widget;
-        if (widget._view && widget._view.expand) {
-            widget._view.expand();
-        }
-    }
-
-    function implementViews() {
-        container.views.createElementForGadget = function (metadata, rel, 
opt_view, opt_viewTarget, opt_coordinates, parentSite, opt_callback) {
-            if (opt_viewTarget) {
-                var prefs = (metadata && metadata.views && 
metadata.views[opt_view])
-                var view = viewManager.renderView(opt_viewTarget, prefs);
-                var el = view.getWidgetSite();
-                el.setAttribute('data-rave-view', view._uid);
-                return el;
-            }
-        };
-
-        container.views.createElementForEmbeddedExperience = function (rel, 
opt_gadgetInfo, opt_viewTarget, opt_coordinates, parentSite, opt_callback) {
-            var widgetUrl = opt_gadgetInfo.url;
-
-            api.rest.getSecurityToken({
-                "url": widgetUrl,
-                //TODO: need to remove reference to rave.ui once we understand 
need for current pageid
-                //violates core dependency
-                "pageid": raveUi.getCurrentPageId(),
-                "successCallback": renderEE
-            });
+define(['underscore', 'core/rave_view_manager', 'core/rave_api', 
'core/rave_openajax_hub', 'core/rave_log', 'core/rave_state_manager', 'osapi'],
+    function (_, viewManager, api, managedHub, log, stateManager) {
+        var exports = {};
+
+        var container;
+
+        var containerConfig = {};
+        containerConfig[osapi.container.ServiceConfig.API_PATH] = "/rpc";
+        //TODO: Handle moving out javaScriptDebugMode
+        //containerConfig[osapi.container.ContainerConfig.RENDER_DEBUG] = 
ravePortal.getJavaScriptDebugMode();
+        container = new osapi.container.Container(containerConfig);
+
+        gadgets.pubsub2router.init({
+            hub: managedHub
+        });
+
+        rpcRegister();
+        implementViews();
+
+
+        function rpcRegister() {
+            container.rpcRegister('requestNavigateTo', requestNavigateTo);
+            container.rpcRegister('set_pref', setPref);
+            container.rpcRegister('set_title', setTitle);
+            container.rpcRegister('hideWidget', hideWidget);
+            container.rpcRegister('showWidget', showWidget);
+        }
 
-            function renderEE(data) {
-                if (data.error) {
-                    return log(data.error.message)
+        function implementViews() {
+            container.views.createElementForGadget = function (metadata, rel, 
opt_view, opt_viewTarget, opt_coordinates, parentSite, opt_callback) {
+                if (opt_viewTarget) {
+                    var prefs = (metadata && metadata.views && 
metadata.views[opt_view])
+                    var view = viewManager.renderView(opt_viewTarget, prefs);
+                    var el = view.getWidgetSite();
+                    el.setAttribute('data-rave-view', view._uid);
+                    return el;
                 }
-                var gadget = {
-                        "widgetUrl": widgetUrl,
-                        "securityToken": data.securityToken,
-                        "metadata": opt_gadgetInfo
-                    },
-                //TODO: hardcoded default height and width
-                    height = gadget.metadata.modulePrefs.height || 200,
-                    width = gadget.metadata.modulePrefs.width || 320;
+            };
+
+            container.views.createElementForEmbeddedExperience = function 
(rel, opt_gadgetInfo, opt_viewTarget, opt_coordinates, parentSite, 
opt_callback) {
+                var widgetUrl = opt_gadgetInfo.url;
 
-                preloadMetadata(gadget);
+                api.rest.getSecurityToken({
+                    "url": widgetUrl,
+                    //TODO: need to remove reference to rave.ui once we 
understand need for current pageid
+                    //violates core dependency
+                    "pageid": stateManager.getPage().id,
+                    "successCallback": renderEE
+                });
+
+                function renderEE(data) {
+                    if (data.error) {
+                        return log(data.error.message)
+                    }
+                    var gadget = {
+                            "widgetUrl": widgetUrl,
+                            "securityToken": data.securityToken,
+                            "metadata": opt_gadgetInfo
+                        },
+                    //TODO: hardcoded default height and width
+                        height = gadget.metadata.modulePrefs.height || 
stateManager.getDefaultHeight(),
+                        width = gadget.metadata.modulePrefs.width || 
stateManager.getDefaultWidth();
+
+                    preloadMetadata(gadget);
+
+                    if (opt_viewTarget) {
+                        var view = viewManager.renderView(opt_viewTarget, 
{"preferredHeight": height, preferredWidth: width});
+                        var el = view.getWidgetSite();
+                        el.setAttribute('data-rave-view', view._uid);
+                        opt_callback(el);
+                    }
+                }
+            };
 
+            container.views.createElementForUrl = function (rel, 
opt_viewTarget, opt_coordinates, parentSite, opt_callback) {
                 if (opt_viewTarget) {
-                    var view = viewManager.renderView(opt_viewTarget, 
{"preferredHeight": height, preferredWidth: width});
+                    var view = viewManager.renderView(opt_viewTarget);
                     var el = view.getWidgetSite();
                     el.setAttribute('data-rave-view', view._uid);
                     opt_callback(el);
                 }
+            };
+
+            container.views.destroyElement = function (site) {
+                var el = site.el_;
+                container.closeGadget(site);
+                var _uid = el.getAttribute('data-rave-view');
+                viewManager.destroyView(_uid);
+            };
+        }
+
+        function requestNavigateTo(args, viewName, opt_params, opt_ownerId) {
+            var widget = args.gs._widget,
+                viewSurface = viewName.split('.')[0],
+                renderInto = viewManager.getView(viewSurface) ? viewSurface : 
widget._el;
+
+            widget.render(renderInto, {view: viewName, view_params: 
opt_params, ownerId: opt_ownerId});
+        }
+
+        function setPref(args, editToken, prefName, prefValue) {
+            var widget = args.gs._widget;
+            widget.savePreference(prefName, prefValue);
+        }
+
+        /*
+         TODO: these rely on a gadget's view implementing a method
+         */
+        function setTitle(args) {
+            var widget = args.gs._widget;
+            if (widget._view && widget._view.setTitle) {
+                var title = _.isArray(args.a) ? args.a[0] : args.a;
+                widget._view.setTitle(title);
             }
-        };
+        }
 
-        container.views.createElementForUrl = function (rel, opt_viewTarget, 
opt_coordinates, parentSite, opt_callback) {
-            if (opt_viewTarget) {
-                var view = viewManager.renderView(opt_viewTarget);
-                var el = view.getWidgetSite();
-                el.setAttribute('data-rave-view', view._uid);
-                opt_callback(el);
-            }
-        };
-
-        container.views.destroyElement = function (site) {
-            var el = site.el_;
-            container.closeGadget(site);
-            var _uid = el.getAttribute('data-rave-view');
-            viewManager.destroyView(_uid);
-        };
-    }
-
-    exports.initWidget = function (widget) {
-        widget.error = getMetadataErrors(widget.metadata);
-        if (!widget.error) {
-            preloadMetadata(widget);
-        }
-    }
-
-    /*
-     Opts -
-     full spectrum of allowed render options!
-     */
-    exports.renderWidget = function (widget, el, opts) {
-        if(widget.error) {
-            widget.renderError(el, widget.error.message);
-            return;
-        }
-        opts = opts || {};
-        var site = container.newGadgetSite(el);
-        site._widget = widget;
-        widget._site = site;
-
-        var renderParams = {};
-        renderParams[osapi.container.RenderParam.VIEW] = opts.view || 
widget.constructor.defaultView;
-        renderParams[osapi.container.RenderParam.ALLOW_DEFAULT_VIEW ] = 
opts.allowDefaultView;
-        renderParams[osapi.container.RenderParam.DEBUG ] = opts.debug;
-        renderParams[osapi.container.RenderParam.HEIGHT ] = opts.height || 
widget.constructor.defaultHeight;
-        renderParams[osapi.container.RenderParam.NO_CACHE ] = opts.noCache;
-        renderParams[osapi.container.RenderParam.TEST_MODE] = opts.testMode;
-        renderParams[osapi.container.RenderParam.WIDTH ] = opts.width || 
widget.constructor.defaultWidth;
-        renderParams[osapi.container.RenderParam.USER_PREFS] = 
getCompleteUserPrefSet(widget.userPrefs, widget.metadata.userPrefs);
-        container.navigateGadget(site, widget.widgetUrl, opts.view_params, 
renderParams, opts.callback);
-    }
-
-    /**
-     * Combines the default user pref list from the metadata with those set by 
the user
-     * @param setPrefs preferences already set by the user
-     * @param metadataPrefs list of all available metadata objects
-     */
-    function getCompleteUserPrefSet(setPrefs, metadataPrefs) {
-        var combined = {};
-        _.each(metadataPrefs, function (metaPref) {
-            var userPref = setPrefs[metaPref.name];
-            combined[metaPref.name] = _.isUndefined(userPref) ? 
metaPref.defaultValue : userPref;
-        });
-        return combined;
-    }
+        function hideWidget(args, viewName, opt_params, opt_ownerId) {
+            var widget = args.gs._widget;
+            if (widget._view && widget._view.collapse) {
+                widget._view.collapse();
+            }
+        }
+
+        function showWidget(args, viewName, opt_params, opt_ownerId) {
+            var widget = args.gs._widget;
+            if (widget._view && widget._view.expand) {
+                widget._view.expand();
+            }
+        }
+
+
+        exports.initWidget = function (widget) {
+            widget.error = getMetadataErrors(widget.metadata);
+            if (!widget.error) {
+                preloadMetadata(widget);
+            }
+        }
+
+        /*
+         Opts -
+         full spectrum of allowed render options!
+         */
+        exports.renderWidget = function (widget, el, opts) {
+            if (widget.error) {
+                widget.renderError(el, widget.error.message);
+                return;
+            }
+            opts = opts || {};
+            var site = container.newGadgetSite(el);
+            site._widget = widget;
+            widget._site = site;
+
+            var renderParams = {};
+            renderParams[osapi.container.RenderParam.VIEW] = opts.view || 
stateManager.getDefaultView();
+            renderParams[osapi.container.RenderParam.ALLOW_DEFAULT_VIEW ] = 
opts.allowDefaultView;
+            renderParams[osapi.container.RenderParam.DEBUG ] = opts.debug;
+            renderParams[osapi.container.RenderParam.HEIGHT ] = opts.height || 
stateManager.getDefaultHeight();
+            renderParams[osapi.container.RenderParam.NO_CACHE ] = opts.noCache;
+            renderParams[osapi.container.RenderParam.TEST_MODE] = 
opts.testMode;
+            renderParams[osapi.container.RenderParam.WIDTH ] = opts.width || 
stateManager.getDefaultWidth();
+            renderParams[osapi.container.RenderParam.USER_PREFS] = 
getCompleteUserPrefSet(widget.userPrefs, widget.metadata.userPrefs);
+            container.navigateGadget(site, widget.widgetUrl, opts.view_params, 
renderParams, opts.callback);
+        }
+
+        /**
+         * Combines the default user pref list from the metadata with those 
set by the user
+         * @param setPrefs preferences already set by the user
+         * @param metadataPrefs list of all available metadata objects
+         */
+        function getCompleteUserPrefSet(setPrefs, metadataPrefs) {
+            var combined = {};
+            _.each(metadataPrefs, function (metaPref) {
+                var userPref = setPrefs[metaPref.name];
+                combined[metaPref.name] = _.isUndefined(userPref) ? 
metaPref.defaultValue : userPref;
+            });
+            return combined;
+        }
 
-    function preloadMetadata(gadget) {
-        //Put our gadget metadata into the form that the common container is 
expecting
-        var commonContainerMetadataWrapper = {};
-        commonContainerMetadataWrapper[gadget.widgetUrl] = gadget.metadata;
-
-        //Put our gadget security token data into the form that the common 
container is expecting
-        var commonContainerTokenData = {};
-        commonContainerTokenData[osapi.container.TokenResponse.TOKEN] = 
gadget.securityToken;
-        
commonContainerTokenData[osapi.container.MetadataResponse.RESPONSE_TIME_MS] = 
new Date().getTime();
-        var commonContainerTokenWrapper = {};
-        commonContainerTokenWrapper[gadget.widgetUrl] = 
commonContainerTokenData;
-
-        //Setup the preloadConfig data with all our preload data
-        var preloadConfig = {};
-        preloadConfig[osapi.container.ContainerConfig.PRELOAD_METADATAS] = 
commonContainerMetadataWrapper;
-        preloadConfig[osapi.container.ContainerConfig.PRELOAD_TOKENS] = 
commonContainerTokenWrapper;
-        preloadConfig[osapi.container.ContainerConfig.PRELOAD_REF_TIME] = null;
-
-        //Preload our data into the common container
-        container.preloadCaches(preloadConfig);
-    }
-
-    function getMetadataErrors(metadata) {
-        return metadata.error;
-    }
-
-    exports.closeWidget = function (widget) {
-        if (widget._site) {
-            container.closeGadget(widget._site);
-        }
-    }
-
-    exports.getContainer = function() {
-        return container;
-    }
+        function preloadMetadata(gadget) {
+            //Put our gadget metadata into the form that the common container 
is expecting
+            var commonContainerMetadataWrapper = {};
+            commonContainerMetadataWrapper[gadget.widgetUrl] = gadget.metadata;
+
+            //Put our gadget security token data into the form that the common 
container is expecting
+            var commonContainerTokenData = {};
+            commonContainerTokenData[osapi.container.TokenResponse.TOKEN] = 
gadget.securityToken;
+            
commonContainerTokenData[osapi.container.MetadataResponse.RESPONSE_TIME_MS] = 
new Date().getTime();
+            var commonContainerTokenWrapper = {};
+            commonContainerTokenWrapper[gadget.widgetUrl] = 
commonContainerTokenData;
+
+            //Setup the preloadConfig data with all our preload data
+            var preloadConfig = {};
+            preloadConfig[osapi.container.ContainerConfig.PRELOAD_METADATAS] = 
commonContainerMetadataWrapper;
+            preloadConfig[osapi.container.ContainerConfig.PRELOAD_TOKENS] = 
commonContainerTokenWrapper;
+            preloadConfig[osapi.container.ContainerConfig.PRELOAD_REF_TIME] = 
null;
+
+            //Preload our data into the common container
+            container.preloadCaches(preloadConfig);
+        }
+
+        function getMetadataErrors(metadata) {
+            return metadata.error;
+        }
+
+        exports.closeWidget = function (widget) {
+            if (widget._site) {
+                container.closeGadget(widget._site);
+            }
+        }
+
+        exports.getContainer = function () {
+            return container;
+        }
 
-    return exports;
-})
\ No newline at end of file
+        return exports;
+    })
\ No newline at end of file

Added: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_state_manager.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_state_manager.js?rev=1496087&view=auto
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_state_manager.js
 (added)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_state_manager.js
 Mon Jun 24 15:16:19 2013
@@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * 'License'); you may not use this file except in compliance
+ * 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
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+define([], function () {
+
+    var page,
+        viewer,
+        owner,
+        context,
+        exportEnabled,
+        defaultHeight = 200,
+        defaultWidth = 320,
+        defaultView = 'default';
+
+    var exports = {};
+
+    exports.setPage = function(p){
+        page = p;
+    }
+
+    exports.getPage = function(){
+        return page;
+    }
+
+    exports.setViewer = function(v){
+        viewer = v;
+    }
+
+    exports.getViewer = function(){
+        return viewer;
+    }
+
+    exports.setOwner = function(o){
+        owner = o;
+    }
+
+    exports.getOwner = function(){
+        return owner;
+    }
+
+    exports.setContext = function(ctx){
+        context = ctx;
+    }
+
+    exports.getContext = function(){
+        return context;
+    }
+
+    exports.setExportEnabled = function(e){
+        exportEnabled = e;
+    }
+
+    exports.getExportEnabled = function(){
+        return exportEnabled;
+    }
+
+    exports.setDefaultHeight = function(height){
+        defaultHeight = height;
+    }
+
+    exports.getDefaultHeight = function(){
+        return defaultHeight;
+    }
+
+    exports.setDefaultWidth = function(width){
+        defaultWidth = width;
+    }
+
+    exports.getDefaultWidth = function(){
+        return defaultWidth;
+    }    
+
+    exports.setDefaultView = function(view){
+        defaultView = view;
+    }
+
+    exports.getDefaultView = function(){
+        return defaultView;
+    }
+
+    return exports;
+
+});

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget.js
 Mon Jun 24 15:16:19 2013
@@ -41,10 +41,6 @@ define(['underscore', 'core/rave_api', '
         this._provider.initWidget(this);
     }
 
-    Widget.defaultView = 'default';
-    Widget.defaultWidth = 320;
-    Widget.defaultHeight = 200;
-
     Widget.extend = function (mixin) {
         _.extend(this.prototype, mixin);
     }

Copied: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
 (from r1495530, 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js)
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js?p2=rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js&p1=rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js&r1=1495530&r2=1496087&rev=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_core.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_widget_manager.js
 Mon Jun 24 15:16:19 2013
@@ -17,14 +17,9 @@
  * under the License.
  */
 
-define(['underscore', 'core/rave_widget'], function(_, regionWidget){
-    var INITIALIZED = false,
+define(['underscore', 'core/rave_widget'], function (_, regionWidget) {
     //hash of widgets by regionWidgetId
-        regionWidgets = {},
-    //event handlers to fire on rave init
-        initHandlers = [],
-    //oajaxhub to support pubsub. only initialized if needed
-        openAjaxHub;
+    var regionWidgets = {};
 
     var rave = {};
 
@@ -37,10 +32,7 @@ define(['underscore', 'core/rave_widget'
             //TODO: until api can be updated, attach regionid as an attribute 
on the widget so that we can filter on this
             definition.regionId = regionId;
         }
-        regionWidgets[definition.regionWidgetId] = definition;
-        if (INITIALIZED) {
-            regionWidgets[definition.regionWidgetId] = new 
regionWidget(definition)
-        }
+        regionWidgets[definition.regionWidgetId] = new regionWidget(definition)
         return regionWidgets[definition.regionWidgetId];
     }
 
@@ -52,7 +44,7 @@ define(['underscore', 'core/rave_widget'
     }
 
     //convenience method to render all registered widgets
-    rave.renderWidgets = function(el, opts) {
+    rave.renderWidgets = function (el, opts) {
         _.invoke(rave.getWidgets(), 'render', el, opts);
     }
 
@@ -63,42 +55,14 @@ define(['underscore', 'core/rave_widget'
 
     rave.getWidgets = function (filter) {
         var widgets = _.toArray(regionWidgets);
-        if(filter) {
+        if (filter) {
             widgets = _.where(widgets, filter);
         }
         return widgets;
     }
 
+    //TODO: I killed registerInitHandlers! Tell people.
 
-
-    rave.registerOnInitHandler = function (handler) {
-        if (!(_.isFunction(handler))) {
-            throw new Error('Init event handler must be a function');
-        }
-        if (INITIALIZED) {
-            return handler();
-        }
-        initHandlers.push(handler);
-    }
-
-    rave.init = function () {
-        INITIALIZED = true;
-        _.each(regionWidgets, function (definition) {
-            regionWidgets[definition.regionWidgetId] = new 
regionWidget(definition)
-        });
-        _.each(initHandlers, function (fn) {
-            fn();
-        });
-    }
-
-    //reset internal data - used for testing cleanup
-    rave.reset = function () {
-        INITIALIZED = false;
-        providers = {};
-        regionWidgets = {};
-        initHandlers = [];
-        openAjaxHub;
-    }
-
+    //TODO: reset isn't going to work well with individual modules holding 
private data
     return rave;
 })

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_wookie.js
 Mon Jun 24 15:16:19 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['core/rave_openajax_hub'], function(managedHub){
+define(['core/rave_openajax_hub', 'core/rave_state_manager'], 
function(managedHub, stateManager){
         var exports = {}
 
         exports.initWidget = function(widget){}
@@ -38,8 +38,8 @@ define(['core/rave_openajax_hub'], funct
                         parent:      el,
                         iframeAttrs: {
                             //TODO: hardcoding numbers, should come from 
regionWidget?
-                            height: widget.height || 
widget.constructor.defaultHeight,
-                            width:  widget.width || 
widget.constructor.defaultWidth,
+                            height: widget.height || 
stateManager.getDefaultHeight(),
+                            width:  widget.width || 
stateManager.getDefaultWidth(),
                             frameborder: 0
                         },
                         uri: widget.widgetUrl,

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
 Mon Jun 24 15:16:19 2013
@@ -1,7 +1,30 @@
-/**
- * Created with IntelliJ IDEA.
- * User: erinnp
- * Date: 6/21/13
- * Time: 1:04 PM
- * To change this template use File | Settings | File Templates.
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * 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
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
  */
+
+define(['underscore', 'portal/rave_portal', 'portal/rave_event_bindings', 
'portal/rave_models', 'portal/rave_ui',
+    'portal/rave_layout', 'portal/rave_forms', 'portal/rave_store', 
'portal/rave_admin', 'portal/rave_person_profile'],
+    function (_, portal, eventBindings, models) {
+
+        _.extend(portal, eventBindings);
+        portal.models = models;
+
+        return portal
+
+    }
+);
\ No newline at end of file

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_admin.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_admin.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_admin.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_admin.js
 Mon Jun 24 15:16:19 2013
@@ -17,11 +17,11 @@
  * under the License.
  */
 
-define(["jquery"], function($){
-    var adminUi = (function() {
+define(["jquery"], function ($) {
+    var adminUi = (function () {
 
         function datatableClick() {
-            $('.datatable tr').bind('click', function() {
+            $('.datatable tr').bind('click', function () {
                 var link = $(this).attr('data-detaillink');
                 if (link != undefined && link != '') {
                     window.location = link;
@@ -30,9 +30,9 @@ define(["jquery"], function($){
         }
 
         //Resize bootstrap modal & adjust margins to size of image.
-        function resizeImageModal(){
+        function resizeImageModal() {
             $('#thumbnailModal, #screenshotModal').on('shown', function () {
-                if(!$(this).hasClass("sized")){
+                if (!$(this).hasClass("sized")) {
                     var imageWidth = $(this).find("img").width(),
                         imageHeight = $(this).find("img").height(),
                         footerHeight = 
$(this).find(".modal-footer").outerHeight(),
@@ -41,24 +41,15 @@ define(["jquery"], function($){
 
                     $(this).css({
                         width: imageWidth + "px",
-                        'margin-top': "-" + Math.round(totalHeight/2) + "px",
-                        'margin-left': "-" + Math.round(imageWidth/2) + "px"
+                        'margin-top': "-" + Math.round(totalHeight / 2) + "px",
+                        'margin-left': "-" + Math.round(imageWidth / 2) + "px"
                     }).addClass("sized");
                 }
             });
         }
 
-        function init() {
-            datatableClick();
-            resizeImageModal();
-        }
+        datatableClick();
+        resizeImageModal();
 
-        return {
-            init:init
-        }
     })();
-
-    return {
-        initAdminUi : adminUi.init
-    }
 })
\ No newline at end of file

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_backbone.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_backbone.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_backbone.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_backbone.js
 Mon Jun 24 15:16:19 2013
@@ -21,7 +21,7 @@ define(["underscore", "backbone"], funct
     /*
      Extend backbone's standard model and collection with some
      */
-    Model = Backbone.Model.extend({
+    var Model = Backbone.Model.extend({
         get: function(attr){
             //tweak model get so that array / object members are passed by 
value instead of reference
             //needed for managing deep objects
@@ -38,7 +38,7 @@ define(["underscore", "backbone"], funct
         }
     });
 
-    Collection = Backbone.Collection.extend({
+    var Collection = Backbone.Collection.extend({
         toViewModel: function () {
             return this.map(function (model) {
                 return model.toViewModel();
@@ -53,7 +53,7 @@ define(["underscore", "backbone"], funct
      time. By default on any change to the models the view will be 
re-rendered. Also provides an implementation of
      render that probably will not need to be overrridden.
      */
-    View = Backbone.View.extend({
+    var View = Backbone.View.extend({
         initialize: function () {
             var self = this;
             _.bindAll(this);

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_display.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_display.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_display.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_display.js
 Mon Jun 24 15:16:19 2013
@@ -17,9 +17,9 @@
  * under the License.
  */
 
-define(["core/rave_api"], function(api){
+define(["rave"], function (rave) {
     function displayUsersOfWidget(widgetId) {
-        api.rest.getUsersForWidget({widgetId: widgetId, successCallback: 
function (data) {
+        rave.api.rest.getUsersForWidget({widgetId: widgetId, successCallback: 
function (data) {
 
             //format data for display
             _.each(data, function (person) {

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_event_bindings.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_event_bindings.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_event_bindings.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_event_bindings.js
 Mon Jun 24 15:16:19 2013
@@ -17,8 +17,9 @@
  * under the License.
  */
 
-define(["jquery", 'core/rave_api', 'portal/rave_store', 'portal/rave_models', 
'portal/rave_layout', 'portal/rave_display', 'portal/rave_portal'],
-    function($, raveApi, raveStore, raveModels, raveLayout, raveDisplay, 
ravePortal){
+define(["jquery", 'rave', 'portal/rave_store', 'portal/rave_models', 
'portal/rave_layout', 'portal/rave_display',
+    'portal/rave_portal'],
+    function($, rave, raveStore, raveModels, raveLayout, raveDisplay, 
ravePortal){
 
         var pageNameToFunctionMap = {
             "addWidget.jsp": addWidgetEventBindings,
@@ -109,7 +110,7 @@ define(["jquery", 'core/rave_api', 'port
         function storeEventBindings(){
             $("#storeItems").on("click", "button.widgetAddButton", 
function(event){
                 var element = $(this);
-                raveApi.rpc.addWidgetToPage({widgetId: 
element.data('widget-id'),
+                rave.api.rpc.addWidgetToPage({widgetId: 
element.data('widget-id'),
                     pageId: element.data('referring-page-id'), buttonId: 
element.attr('id'),
                     successCallback: addWidgetToPageCallback
                 });
@@ -126,7 +127,7 @@ define(["jquery", 'core/rave_api', 'port
                 var element = $(this);
                 var widgetId = element.data('widget-id');
                 var pageId = element.data('page-id');
-                raveApi.addWidgetToPage({widgetId: widgetId, pageId: pageId, 
redirectAfterAdd: true, successCallback: addWidgetToPageCallback})
+                rave.api.addWidgetToPage({widgetId: widgetId, pageId: pageId, 
redirectAfterAdd: true, successCallback: addWidgetToPageCallback})
             })
 
             $('#displayUsersOfWidgetLink').click(function(){
@@ -143,7 +144,7 @@ define(["jquery", 'core/rave_api', 'port
 
         function widgetDetailEventBindings(){
             $('#fetchMetadataButton').click(function(){
-                raveApi.rpc.getWidgetMetadata({
+                rave.api.rpc.getWidgetMetadata({
                     url: $('#url').get(0).value,
                     providerType: $('input:radio[name=type]:checked').val(),
                     successCallback: function(result) {
@@ -191,9 +192,6 @@ define(["jquery", 'core/rave_api', 'port
             
$(addWidgetButton).removeClass("btn-primary").addClass("btn-success").html(addedText);
         }
 
-
-
-
         return {
             bindEvents: function(pageName){
                 var bindEventsForPage = pageNameToFunctionMap[pageName];

Modified: 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_forms.js
URL: 
http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_forms.js?rev=1496087&r1=1496086&r2=1496087&view=diff
==============================================================================
--- 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_forms.js
 (original)
+++ 
rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_forms.js
 Mon Jun 24 15:16:19 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(["jquery", "./rave_portal"], function($, ravePortal){
+define(["jquery", "portal/rave_portal", "jqueryValidate"], function($, 
ravePortal){
     function validateNewAccountForm() {
         $("#newAccountForm").validate({
             rules: {


Reply via email to