You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by er...@apache.org on 2013/06/21 20:17:56 UTC

svn commit: r1495530 - in /rave/branches/require: rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/ rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/ rave-portal-resources/src/main/webapp/WEB-INF/tags/ rave-portal-res...

Author: erinnp
Date: Fri Jun 21 18:17:56 2013
New Revision: 1495530

URL: http://svn.apache.org/r1495530
Log:
finished rave core dependency tree

Added:
    rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js
Modified:
    rave/branches/require/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/MessageBundleController.java
    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/WEB-INF/tags/region_widget.tag
    rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/third_party_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_core.js
    rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.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_providers.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/rave_portal.js

Modified: rave/branches/require/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/MessageBundleController.java
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/MessageBundleController.java?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/MessageBundleController.java (original)
+++ rave/branches/require/rave-components/rave-web/src/main/java/org/apache/rave/portal/web/controller/MessageBundleController.java Fri Jun 21 18:17:56 2013
@@ -41,7 +41,7 @@ import java.util.ResourceBundle;
  */
 @Controller
 @RequestMapping("/messagebundle/*")
-public class MessageBundleController  {
+public class MessageBundleController {
     private static final String CLIENT_MESSAGE_IDENTIFIER = "_rave_client.";
     private static final String CLIENT_MESSAGES_BUNDLE_NAME = "messages";
     private static final String JAVASCRIPT_CONTENT_TYPE = "text/javascript";
@@ -66,7 +66,7 @@ public class MessageBundleController  {
      * in the Rave javascript namespace.  It uses the Locale specified by the client's browser to determine
      * which message bundle language to use.
      *
-     * @param request  The incoming HttpServletRequest
+     * @param request The incoming HttpServletRequest
      * @return the JavaScript content to load from the client
      */
     @ResponseBody
@@ -91,16 +91,22 @@ public class MessageBundleController  {
 
     private String convertClientMessagesMapToJavaScriptOutput(Map<String, String> clientMessagesMap) {
         StringBuilder sb = new StringBuilder();
-        final String add_client_message = "ravePortal.addClientMessage(\"";
-        final String key_value_separator = "\",\"";
-        final String message_suffix = "\");";
+        int i = 0;
+        final String add_client_message = "\"";
+        final String key_value_separator = "\":\"";
+        final String message_suffix = "\"";
+        final String message_newline = ",";
         for (Map.Entry<String, String> mapEntry : clientMessagesMap.entrySet()) {
+            i++;
             sb.append(add_client_message).append(mapEntry.getKey()).append(key_value_separator);
             sb.append(mapEntry.getValue()).append(message_suffix);
+            if (i<clientMessagesMap.size()) {
+                sb.append(message_newline);
+            }
         }
-        return "require(['portal/rave_portal'], function(ravePortal){" + sb.toString() + "})";
+        return "define([], function(){ return {" + sb.toString() + "}; })";
     }
-    
+
     private String getClientMessagesJSForLocale(Locale locale) {
         String javascriptOutput = getClientMessagesJSFromCache(locale);
         if (javascriptOutput == null) {
@@ -108,20 +114,20 @@ public class MessageBundleController  {
         }
         return javascriptOutput;
     }
-    
+
     private String getClientMessagesJSFromCache(Locale locale) {
         return clientMessagesCache.get(locale);
     }
-    
+
     private String getClientMessagesJSFromBundle(Locale locale) {
         String javascriptOutput = convertClientMessagesMapToJavaScriptOutput(
                 convertResourceBundleToClientMessagesMap(
-                    ResourceBundle.getBundle(CLIENT_MESSAGES_BUNDLE_NAME, locale)));
+                        ResourceBundle.getBundle(CLIENT_MESSAGES_BUNDLE_NAME, locale)));
 
         cacheClientMessages(locale, javascriptOutput);
         return javascriptOutput;
     }
-    
+
     private void cacheClientMessages(Locale locale, String javascriptOutput) {
         clientMessagesCache.put(locale, javascriptOutput);
     }

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -71,31 +71,42 @@
                         <c:otherwise>false</c:otherwise>
                     </c:choose>
                 </c:set>
-                <portal:person id="${userPage.ownerId}" var="userPageOwner" />
+                <portal:person id="${userPage.ownerId}" var="userPageOwner"/>
                 <fmt:message key="sharing.page.tab.icon.tip.from" var="iconShareToolTipFrom">
                     <fmt:param value="${userPageOwner.username}"/>
                 </fmt:message>
                 <fmt:message key="sharing.page.tab.icon.tip.to" var="iconShareToolTipTo"/>
                 <c:choose>
                     <c:when test="${isCurrentPage}">
-                        <li id="tab-${userPage.id}" class="active dropdown" >
+                        <li id="tab-${userPage.id}" class="active dropdown">
                             <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                 <c:if test="${isSharedToMe}">
-                                    <b id="pageMenuSharedIcon" class="ui-icon ui-icon-person" title="<c:out value="${iconShareToolTipFrom}"/>"></b>
+                                    <b id="pageMenuSharedIcon" class="ui-icon ui-icon-person"
+                                       title="<c:out value="${iconShareToolTipFrom}"/>"></b>
                                 </c:if>
                                 <c:if test="${isSharedByMe}">
-                                    <b id="pageMenuSharedIcon" class="ui-icon ui-icon-folder-open" title="<c:out value="${iconShareToolTipTo}"/>"></b>
+                                    <b id="pageMenuSharedIcon" class="ui-icon ui-icon-folder-open"
+                                       title="<c:out value="${iconShareToolTipTo}"/>"></b>
                                 </c:if>
                                 <c:out value="${userPage.name}"/>
                                 <b class="caret"></b>
                             </a>
-                            <ul class="dropdown-menu" >
-                                <li id="pageMenuEdit" class="<c:if test="${isSharedToMe}">menu-item-disabled</c:if>"><a href="#"><fmt:message key="page.general.editpage"/></a></li>
-                                <li id="pageMenuDelete" class="<c:if test='${hasOnlyOnePage or isSharedToMe}'>menu-item-disabled</c:if>"><a href="#"><fmt:message key="page.general.deletepage"/></a></li>
-                                <li id="pageMenuMove" class="<c:if test='${hasOnlyOnePage}'>menu-item-disabled</c:if>"><a href="#"><fmt:message key="page.general.movepage"/></a></li>
-                                <li id="pageMenuExport" class="hidden"><a href="#"><fmt:message key="page.general.exportpage"/></a></li>
-                                <li id="pageMenuShare" class="<c:if test="${isSharedToMe}">menu-item-disabled</c:if>"><a href="#sharePageDialog" data-toggle="modal"><fmt:message key="page.general.sharepage"/></a></li>
-                                <li id="pageMenuRevokeShare" class="<c:if test="${isSharedToMe == false}">menu-item-disabled</c:if>"><a href="#"><fmt:message key="page.general.removeshare"/></a></li>
+                            <ul class="dropdown-menu">
+                                <li id="pageMenuEdit" class="<c:if test="${isSharedToMe}">menu-item-disabled</c:if>"><a
+                                        href="#"><fmt:message key="page.general.editpage"/></a></li>
+                                <li id="pageMenuDelete"
+                                    class="<c:if test='${hasOnlyOnePage or isSharedToMe}'>menu-item-disabled</c:if>"><a
+                                        href="#"><fmt:message key="page.general.deletepage"/></a></li>
+                                <li id="pageMenuMove" class="<c:if test='${hasOnlyOnePage}'>menu-item-disabled</c:if>">
+                                    <a href="#"><fmt:message key="page.general.movepage"/></a></li>
+                                <li id="pageMenuExport" class="hidden"><a href="#"><fmt:message
+                                        key="page.general.exportpage"/></a></li>
+                                <li id="pageMenuShare" class="<c:if test="${isSharedToMe}">menu-item-disabled</c:if>"><a
+                                        href="#sharePageDialog" data-toggle="modal"><fmt:message
+                                        key="page.general.sharepage"/></a></li>
+                                <li id="pageMenuRevokeShare"
+                                    class="<c:if test="${isSharedToMe == false}">menu-item-disabled</c:if>"><a href="#"><fmt:message
+                                        key="page.general.removeshare"/></a></li>
                             </ul>
                         </li>
                     </c:when>
@@ -103,19 +114,24 @@
                         <li id="tab-${userPage.id}">
                             <c:choose>
                                 <c:when test="${isSharedToMe}">
-                                    <a href="<spring:url value="/app/page/view/${userPage.id}"/>" class="rave-ui-tab-shared-to-me">
-                                        <b id="pageMenuSharedIcon" class="ui-icon ui-icon-person" title="<c:out value="${iconShareToolTipFrom}"/>"></b>
+                                    <a href="<spring:url value="/app/page/view/${userPage.id}"/>"
+                                       class="rave-ui-tab-shared-to-me">
+                                        <b id="pageMenuSharedIcon" class="ui-icon ui-icon-person"
+                                           title="<c:out value="${iconShareToolTipFrom}"/>"></b>
                                         <c:out value="${userPage.name}"/>
                                     </a>
                                 </c:when>
                                 <c:when test="${isSharedByMe}">
-                                    <a href="<spring:url value="/app/page/view/${userPage.id}" />" class="rave-ui-tab-shared-by-me">
-                                        <b id="pageMenuSharedIcon" class="ui-icon ui-icon-folder-open" title="<c:out value="${iconShareToolTipTo}"/>"></b>
+                                    <a href="<spring:url value="/app/page/view/${userPage.id}" />"
+                                       class="rave-ui-tab-shared-by-me">
+                                        <b id="pageMenuSharedIcon" class="ui-icon ui-icon-folder-open"
+                                           title="<c:out value="${iconShareToolTipTo}"/>"></b>
                                         <c:out value="${userPage.name}"/>
                                     </a>
                                 </c:when>
                                 <c:otherwise>
-                                    <a href="<spring:url value="/app/page/view/${userPage.id}" />"><c:out value="${userPage.name}"/></a>
+                                    <a href="<spring:url value="/app/page/view/${userPage.id}" />"><c:out
+                                            value="${userPage.name}"/></a>
                                 </c:otherwise>
                             </c:choose>
                         </li>
@@ -133,57 +149,58 @@
 </div>
 
 <div class="row-fluid">
-<div class=" tab-content">
-    <div id="emptyPageMessageWrapper" class="emptyPageMessageWrapper hidden">
-        <c:if test="${pageUser.pageStatus != 'PENDING'}">
-            <div class="emptyPageMessage">
-                <c:choose>
-                    <c:when test="${pageUser.editor == true}">
-                        <a href="<spring:url value="/app/store?referringPageId=${page.id}" />"><fmt:message key="page.general.empty"/></a>
-                    </c:when>
-                    <c:otherwise>
-                        <fmt:message key="page.general.non.editing.empty"/>
-                    </c:otherwise>
-                </c:choose>
-            </div>
-        </c:if>
-    </div>
-    <c:choose>
-        <c:when test="${pageUser.pageStatus != 'PENDING'}">
-            <div class="regions">
-                    <%-- insert the region layout template --%>
-                <tiles:insertTemplate template="${layout}"/>
-            </div>
-            <div class="clear-float">&nbsp;</div>
-        </c:when>
-        <c:otherwise>
-            <div class="emptyPageMessage">
-                <div>
-                    <div id="confirmSharePageLegend">
-                        <c:choose>
-                            <c:when test="${page.ownerId == principalId}">
-                                <fmt:message key="cloned.page.confirm.message"/>
-                            </c:when>
-                            <c:otherwise>
-                                <portal:person id="${page.ownerId}" var="owner" />
-                                <fmt:message key="sharing.page.confirm.message">
-                                    <fmt:param value="${owner.username}"/>
-                                </fmt:message>
-                            </c:otherwise>
-                        </c:choose>
-                    </div>
-                </div>
-                <div>&nbsp;</div>
-                <div>
-                    <a href="#" id="acceptShareLink"><fmt:message key="_rave_client.common.accept"/></a>
+    <div class=" tab-content">
+        <div id="emptyPageMessageWrapper" class="emptyPageMessageWrapper hidden">
+            <c:if test="${pageUser.pageStatus != 'PENDING'}">
+                <div class="emptyPageMessage">
+                    <c:choose>
+                        <c:when test="${pageUser.editor == true}">
+                            <a href="<spring:url value="/app/store?referringPageId=${page.id}" />"><fmt:message
+                                    key="page.general.empty"/></a>
+                        </c:when>
+                        <c:otherwise>
+                            <fmt:message key="page.general.non.editing.empty"/>
+                        </c:otherwise>
+                    </c:choose>
                 </div>
-                <div>
-                    <a href="#" id="declineShareLink"><fmt:message key="_rave_client.common.decline"/></a>
+            </c:if>
+        </div>
+        <c:choose>
+            <c:when test="${pageUser.pageStatus != 'PENDING'}">
+                <div class="regions">
+                        <%-- insert the region layout template --%>
+                    <tiles:insertTemplate template="${layout}"/>
                 </div>
                 <div class="clear-float">&nbsp;</div>
-            </div>
-        </c:otherwise>
-    </c:choose>
+            </c:when>
+            <c:otherwise>
+                <div class="emptyPageMessage">
+                    <div>
+                        <div id="confirmSharePageLegend">
+                            <c:choose>
+                                <c:when test="${page.ownerId == principalId}">
+                                    <fmt:message key="cloned.page.confirm.message"/>
+                                </c:when>
+                                <c:otherwise>
+                                    <portal:person id="${page.ownerId}" var="owner"/>
+                                    <fmt:message key="sharing.page.confirm.message">
+                                        <fmt:param value="${owner.username}"/>
+                                    </fmt:message>
+                                </c:otherwise>
+                            </c:choose>
+                        </div>
+                    </div>
+                    <div>&nbsp;</div>
+                    <div>
+                        <a href="#" id="acceptShareLink"><fmt:message key="_rave_client.common.accept"/></a>
+                    </div>
+                    <div>
+                        <a href="#" id="declineShareLink"><fmt:message key="_rave_client.common.decline"/></a>
+                    </div>
+                    <div class="clear-float">&nbsp;</div>
+                </div>
+            </c:otherwise>
+        </c:choose>
     </div>
 </div>
 
@@ -205,18 +222,24 @@
                             <label id="pageFormErrorsTabbed1" class="control-label"></label>
                         </div>
                         <div class="control-group">
-                            <label class="control-label" for="tab_titleTabbed1"><fmt:message key="page.general.addpage.title"/></label>
+                            <label class="control-label" for="tab_titleTabbed1"><fmt:message
+                                    key="page.general.addpage.title"/></label>
+
                             <div class="controls">
-                                <input id="tab_titleTabbed1" name="tab_titleTabbed1" class="input-xlarge focused required" type="text" value="" />
+                                <input id="tab_titleTabbed1" name="tab_titleTabbed1"
+                                       class="input-xlarge focused required" type="text" value=""/>
                             </div>
                         </div>
                         <div class="control-group">
-                            <label class="control-label" for="pageLayoutTabbed"><fmt:message key="page.general.addpage.selectlayout"/></label>
+                            <label class="control-label" for="pageLayoutTabbed"><fmt:message
+                                    key="page.general.addpage.selectlayout"/></label>
+
                             <div class="controls">
                                 <select name="pageLayoutTabbed" id="pageLayoutTabbed">
                                     <c:forEach var="pageLayoutTabbed" items="${pageLayouts}">
                                         <option value="${pageLayoutTabbed.code}" id="${pageLayoutTabbed.code}_id">
-                                            <fmt:message key="page.general.addpage.layout.${pageLayoutTabbed.code}"/></option>
+                                            <fmt:message
+                                                    key="page.general.addpage.layout.${pageLayoutTabbed.code}"/></option>
                                     </c:forEach>
                                 </select>
                             </div>
@@ -227,26 +250,34 @@
         </div>
 
         <div id="tabs-2">
-            <div  class="modal-body">
+            <div class="modal-body">
                 <form method="post" id="pageFormImport" class="form-horizontal" enctype="multipart/form-data">
                     <fieldset>
                         <div class="control-group error">
                             <label id="pageFormErrorsTabbed2" class="control-label"></label>
                         </div>
                         <div class="control-group">
-                            <label class="control-label" for="tab_titleTabbed2"><fmt:message key="page.general.addpage.title"/></label>
+                            <label class="control-label" for="tab_titleTabbed2"><fmt:message
+                                    key="page.general.addpage.title"/></label>
+
                             <div class="controls">
-                                <input id="tab_titleTabbed2" name="pageName" class="input-xlarge focused required" type="text" value="" />
+                                <input id="tab_titleTabbed2" name="pageName" class="input-xlarge focused required"
+                                       type="text" value=""/>
                             </div>
                         </div>
                         <div class="control-group">
                             <label class="control-label" for="omdlFile">Browse for File</label>
+
                             <div class="controls">
-                                <input id="omdlFile" name="omdlFile" class="input-xlarge focused required" type="file" value="" />
+                                <input id="omdlFile" name="omdlFile" class="input-xlarge focused required" type="file"
+                                       value=""/>
                             </div>
                         </div>
                         <div class="control-group">
-                            <div class="controls"><iframe id="file_upload_frame" name="file_upload_frame" src="" style="width:0;height:0;border:0px solid black;"></iframe></div>
+                            <div class="controls">
+                                <iframe id="file_upload_frame" name="file_upload_frame" src=""
+                                        style="width:0;height:0;border:0px solid black;"></iframe>
+                            </div>
                         </div>
                     </fieldset>
                 </form>
@@ -262,6 +293,7 @@
 <div id="pageMenuDialog" class="modal hide" data-backdrop="static">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
+
         <h3 id="pageMenuDialogHeader"><fmt:message key="page.general.addnewpage"/></h3>
     </div>
     <div class="modal-body">
@@ -273,12 +305,16 @@
                 </div>
                 <div class="control-group">
                     <label class="control-label" for="tab_title"><fmt:message key="page.general.addpage.title"/></label>
+
                     <div class="controls">
-                        <input id="tab_title" name="tab_title" class="input-xlarge focused required" type="text" value="" />
+                        <input id="tab_title" name="tab_title" class="input-xlarge focused required" type="text"
+                               value=""/>
                     </div>
                 </div>
                 <div class="control-group" id="pageLayoutGroup">
-                    <label class="control-label" for="pageLayout"><fmt:message key="page.general.addpage.selectlayout"/></label>
+                    <label class="control-label" for="pageLayout"><fmt:message
+                            key="page.general.addpage.selectlayout"/></label>
+
                     <div class="controls">
                         <select name="pageLayout" id="pageLayout">
                             <c:forEach var="pageLayout" items="${pageLayouts}">
@@ -300,6 +336,7 @@
 <div id="movePageDialog" class="modal hide" data-backdrop="static">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
+
         <h3><fmt:message key="page.general.movethispage"/></h3>
     </div>
     <div class="modal-body">
@@ -327,7 +364,8 @@
         </form>
     </div>
     <div class="modal-footer">
-        <a href="#" class="btn" data-dismiss="modal" data-target="#movePageDialog"><fmt:message key="_rave_client.common.cancel"/></a>
+        <a href="#" class="btn" data-dismiss="modal" data-target="#movePageDialog"><fmt:message
+                key="_rave_client.common.cancel"/></a>
         <a href="#" class="btn btn-primary" id="movePageButton"><fmt:message key="page.general.movepage"/></a>
     </div>
 </div>
@@ -336,6 +374,7 @@
 <div id="moveWidgetModal" class="modal hide" data-backdrop="static">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
+
         <h3><fmt:message key="widget.menu.movethiswidget"/></h3>
     </div>
     <div class="modal-body">
@@ -360,22 +399,26 @@
         </form>
     </div>
     <div class="modal-footer">
-        <a href="#" class="btn" data-dismiss="modal" data-target="#moveWidgetModal"><fmt:message key="_rave_client.common.cancel"/></a>
-        <a href="#" class="btn btn-primary" id="moveWidgetToPageButton"><fmt:message key="_rave_client.common.move"/></a>
+        <a href="#" class="btn" data-dismiss="modal" data-target="#moveWidgetModal"><fmt:message
+                key="_rave_client.common.cancel"/></a>
+        <a href="#" class="btn btn-primary" id="moveWidgetToPageButton"><fmt:message
+                key="_rave_client.common.move"/></a>
     </div>
 </div>
 
 <div id="sharePageDialog" class="modal hide" data-backdrop="static">
     <div class="modal-header">
         <a href="#" class="close" data-dismiss="modal">&times;</a>
+
         <h3><fmt:message key="page.general.search.title"/></h3>
     </div>
     <div class="modal-body">
-        <div id="sharePageDialogContent" >
+        <div id="sharePageDialogContent">
             <div id="shareContent">
                 <div id="searchControls"><input id="searchTerm" name="searchTerm" type="text"/>
                     <input id="shareSearchButton" value="<fmt:message key="page.store.search.button"/>" type="submit"/>
-                    <input id="clearSearchButton" value="<fmt:message key="admin.clearsearch"/>" type="submit" class="hide"/>
+                    <input id="clearSearchButton" value="<fmt:message key="admin.clearsearch"/>" type="submit"
+                           class="hide"/>
                 </div>
                 <div id="shareSearchListHeader"></div>
                 <div id="shareSearchListPaging"></div>
@@ -389,26 +432,30 @@
 </div>
 
 <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})
-    });
-
-</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>
+    <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})--%>
+        <%--});--%>
+
+    </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
+F
\ 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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -24,47 +24,36 @@
 <%-- local rave scripts --%>
 <portal:render-script location="${'BEFORE_RAVE'}"/>
 <%-- get the javaScriptDebugMode portal preference value --%>
-<c:set var="jsDebugMode"><portal:render-js-debug-mode /></c:set>
+<c:set var="jsDebugMode"><portal:render-js-debug-mode/></c:set>
 <%-- check to see if the javaScriptDebugMode is on, if so render the individual JS files, otherwise render the minified single file --%>
 <c:choose>
     <c:when test="${jsDebugMode == '1'}">
-<%--        <script src="<spring:url value="/static/script/core/rave_core.js"/>"></script>
-        <script src="<spring:url value="/static/script/core/rave_ajax.js"/>"></script>
-        <script src="<spring:url value="/static/script/core/rave_api.js"/>"></script>
-        <script src="<spring:url value="/static/script/core/rave_widget.js"/>"></script>
-        <script src="<spring:url value="/static/script/core/rave_opensocial.js"/>"></script>
-        <script src="<spring:url value="/static/script/core/rave_wookie.js"/>"></script>--%>
-<%--        <script src="<spring:url value="/static/script/portal/rave_portal.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_backbone.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_models.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_layout.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_ui.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_forms.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_person_profile.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_store.js"/>"></script>
-        <script src="<spring:url value="/static/script/portal/rave_admin.js"/>"></script>--%>
+        <!--TODO: figure out js debug mode -->
     </c:when>
     <c:otherwise>
-<%--        <script src="<spring:url value="/static/script/rave.core.min.js"/>"></script>--%>
-<%--        <script src="<spring:url value="/static/script/rave.portal.min.js"/>"></script>--%>
+
     </c:otherwise>
 </c:choose>
-<script src="<spring:url value="/app/messagebundle/rave_client_messages.js"/>"></script>
+<script src="<spring:url value="/static/script/app.js"/>"></script>
 <portal:render-script location="${'AFTER_RAVE'}"/>
 <%-- common javascript to execute on all pages --%>
 <script>
-    require(["core/rave_api", "portal/rave_portal", "core/rave_widget"], function(raveApi, ravePortal, raveRegionWidget){
-        <%-- set the web application context --%>
-        raveApi.setContext("<spring:url value="/app/" />");
-        <%-- set the javascript debug mode so js code has access to it --%>
-        ravePortal.setJavaScriptDebugMode(<c:out value="${jsDebugMode}"/>);
-        <%-- set the default widget height so js code has access to it --%>
-        raveRegionWidget.defaultHeight = <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"/>
-        ravePortal.setPageViewer({username:"${username}", id:"${id}"});
-        </sec:authorize>
-    })
+    <%--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) {
+        rave.init();
+    });
 </script>

Modified: rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/region_widget.tag Fri Jun 21 18:17:56 2013
@@ -121,7 +121,7 @@ Template for rendering a RegionWidget in
     </div>
 </div>
 <script>
-    require(["portal/rave_event_bindings", "jquery"], function(raveEventBindings, $){
-        $(function(){raveEventBindings.bindEvents('region_widget.tag');})
-    })
+//    require(["portal/rave_event_bindings", "jquery"], function(raveEventBindings, $){
+//        $(function(){raveEventBindings.bindEvents('region_widget.tag');})
+//    })
 </script>
\ No newline at end of file

Modified: rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/third_party_js.tag
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/third_party_js.tag?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/third_party_js.tag (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/WEB-INF/tags/third_party_js.tag Fri Jun 21 18:17:56 2013
@@ -23,7 +23,7 @@
 --%>
 <%-- json script --%>
 <script src="//cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js"></script>
-<%-- require.js --%>
-<script data-main="/portal/static/script/app" src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.js"></script>
 <%-- google code css3 mediaqueries script --%>
 <!--[if lt IE 9]><script src="//css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script><![endif]-->
+<%-- require.js --%>
+<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.5/require.js"></script>
\ No newline at end of file

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -18,10 +18,11 @@
  */
 
 requirejs.config({
+    baseUrl: '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',
-        "rave": "./core/main",
+        "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",
@@ -31,6 +32,7 @@ requirejs.config({
         "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",
         "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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['underscore', './rave_core', './rave_api', './rave_widget', './rave_log', './rave_view_manager'],
+define(['underscore', 'core/rave_core', 'core/rave_api', 'core/rave_widget', 'core/rave_log', 'core/rave_view_manager'],
     function (_, rave, api, RegionWidget, log, viewManager) {
 
         rave.api = api;

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -18,7 +18,7 @@
  */
 
 //TODO: jquery dependency should not be here.
-define(['underscore', 'jquery', './rave_ajax'], function(_, $, ajax){
+define(['underscore', 'jquery', 'core/rave_ajax'], function(_, $, ajax){
     //stores virtual host context of application execution
     var context = "";
 

Modified: 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_core.js?rev=1495530&r1=1495529&r2=1495530&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_core.js Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define([ 'underscore', './rave_widget'], function(_, regionWidget){
+define(['underscore', 'core/rave_widget'], function(_, regionWidget){
     var INITIALIZED = false,
     //hash of widgets by regionWidgetId
         regionWidgets = {},

Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_openajax_hub.js Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['underscore', './rave_log', 'osapi'], function(_, log){
+define(['underscore', 'core/rave_log', 'osapi'], function(_, log){
     var openAjaxHub;
 
     if (!openAjaxHub) {

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -18,8 +18,8 @@
  */
 
 //TODO: Remove dependency on rave_ui when moving to angular
-define(['underscore', './rave_view_manager', './rave_widget', './rave_api', 'portal/rave_ui', './rave_openajax_hub', './rave_log', 'osapi'],
-    function(_, viewManager, regionWidget, api, raveUi, managedHub, log){
+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;
@@ -115,8 +115,9 @@ define(['underscore', './rave_view_manag
                         "securityToken": data.securityToken,
                         "metadata": opt_gadgetInfo
                     },
-                    height = gadget.metadata.modulePrefs.height || regionWidget.defaultHeight,
-                    width = gadget.metadata.modulePrefs.width || regionWidget.defaultWidth;
+                //TODO: hardcoded default height and width
+                    height = gadget.metadata.modulePrefs.height || 200,
+                    width = gadget.metadata.modulePrefs.width || 320;
 
                 preloadMetadata(gadget);
 
@@ -168,13 +169,13 @@ define(['underscore', './rave_view_manag
         widget._site = site;
 
         var renderParams = {};
-        renderParams[osapi.container.RenderParam.VIEW] = opts.view || regionWidget.defaultView;
+        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 || regionWidget.defaultHeight;
+        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 || regionWidget.defaultWidth;
+        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);
     }

Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/core/rave_providers.js Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['./rave_wookie', './rave_opensocial'], function(wookie, os){
+define(['core/rave_wookie', 'core/rave_opensocial'], function(wookie, os){
     return{
         w3c:wookie,
         opensocial:os

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['underscore', './rave_api', './rave_providers'], function(_, api, providers){
+define(['underscore', 'core/rave_api', 'core/rave_providers'], function(_, api, providers){
 
     function getProvider(name) {
         return providers[name.toLowerCase()];

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=1495530&r1=1495529&r2=1495530&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 Fri Jun 21 18:17:56 2013
@@ -17,7 +17,7 @@
  * under the License.
  */
 
-define(['./rave_widget', './rave_openajax_hub'], function(regionWidget, managedHub){
+define(['core/rave_openajax_hub'], function(managedHub){
         var exports = {}
 
         exports.initWidget = function(widget){}
@@ -36,11 +36,10 @@ define(['./rave_widget', './rave_openaja
                     },
                     IframeContainer: {
                         parent:      el,
-                        //TODO: I dropped a bunch of the attrs here - seems like it should all be css
-                        //unless it is being defined by the gadget spec
                         iframeAttrs: {
-                            height: widget.height || regionWidget.defaultHeight,
-                            width:  widget.width || regionWidget.defaultWidth,
+                            //TODO: hardcoding numbers, should come from regionWidget?
+                            height: widget.height || widget.constructor.defaultHeight,
+                            width:  widget.width || widget.constructor.defaultWidth,
                             frameborder: 0
                         },
                         uri: widget.widgetUrl,

Added: 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=1495530&view=auto
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js (added)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/main.js Fri Jun 21 18:17:56 2013
@@ -0,0 +1,7 @@
+/**
+ * Created with IntelliJ IDEA.
+ * User: erinnp
+ * Date: 6/21/13
+ * Time: 1:04 PM
+ * To change this template use File | Settings | File Templates.
+ */

Modified: rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js
URL: http://svn.apache.org/viewvc/rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js?rev=1495530&r1=1495529&r2=1495530&view=diff
==============================================================================
--- rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js (original)
+++ rave/branches/require/rave-portal-resources/src/main/webapp/static/script/portal/rave_portal.js Fri Jun 21 18:17:56 2013
@@ -16,289 +16,288 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+define(["jquery", "underscore", "core/rave_api", "./rave_templates", "clientMessages"],
+    function ($, _, api, raveTemplates, clientMessages) {
+        var context = "";
+
+        var pageEditor = true;
+        var pageViewer = {
+            username: "Unknown",
+            id: -1
+        };
+        var pageOwner = {
+            username: "Unknown",
+            id: -1
+        };
+        // JS debug mode is off by default
+        var javaScriptDebugMode = 0;
+        //Assigning a default value of 250 if unable to get value from the DB
+        var defaultWidgetHeight = 250;
+        var onWidgetsInitializedHandlers = [];
+        var onProvidersInitializedHandlers = [];
+        var onUIInitializedHandlers = [];
+        var onPageInitializedHandlers = [];
 
-define(["jquery", "underscore", "core/rave_api", "./rave_templates"], function($, _, api, raveTemplates){
-    var clientMessages = {};
-    var context="";
-
-    var pageEditor = true;
-    var pageViewer = {
-        username: "Unknown",
-        id: -1
-    };
-    var pageOwner = {
-        username: "Unknown",
-        id: -1
-    };
-    // JS debug mode is off by default
-    var javaScriptDebugMode = 0;
-    //Assigning a default value of 250 if unable to get value from the DB
-    var defaultWidgetHeight = 250;
-    var onWidgetsInitializedHandlers = [];
-    var onProvidersInitializedHandlers = [];
-    var onUIInitializedHandlers = [];
-    var onPageInitializedHandlers = [];
-
-    function getClientMessage(key) {
-        return clientMessages[key];
-    }
-
-    function addClientMessage(key, message) {
-        return clientMessages[key] = message;
-    }
-
-    function renderErrorWidget(id, message) {
-        $("#widget-" + id + "-body").html(message);
-    }
-
-
-    function setJavaScriptDebugMode(debugMode) {
-        javaScriptDebugMode = debugMode;
-    }
-
-    function getJavaScriptDebugMode() {
-        return javaScriptDebugMode;
-    }
-
-    function setPageViewer(viewer) {
-        pageViewer = viewer;
-    }
-
-    function getPageViewer() {
-        return pageViewer;
-    }
-
-    function setPageOwner(owner) {
-        pageOwner = owner;
-    }
-
-    function getPageOwner() {
-        return pageOwner;
-    }
-
-    function viewPage(pageId) {
-        var fragment = (pageId != null) ? ("/" + pageId) : "";
-        window.location.href = getContext() + "page/view" + fragment;
-    }
-
-    function viewWidgetDetail(widgetId, referringPageId, jumpToId) {
-        if (jumpToId) {
-            jumpToId = '#' + jumpToId;
-        }
-        else {
-            jumpToId = '';
-        }
-        window.location.href = getContext() + "store/widget/" + widgetId + "?referringPageId=" + referringPageId + jumpToId;
-    }
-
-    /**
-     * Determines if a page is empty (has zero widgets)
-     */
-    function isPageEmpty() {
-        return $.isEmptyObject(widgetByIdMap);
-    }
-
-    /**
-     * Removes a regionWidgetId from the internal widget map
-     * @param regionWidgetId the region widget id to remove
-     */
-    function removeWidgetFromMap(regionWidgetId) {
-        delete widgetByIdMap[regionWidgetId];
-    }
-
-    function initPageEditorStatus(status) {
-        if (status != "undefined") {
-            pageEditor = status;
-        }
-    }
-
-    function isPageEditor() {
-        return pageEditor;
-    }
-
-    function registerOnWidgetsInitizalizedHandler(callback) {
-        if (onWidgetsInitializedHandlers !== null) {
-            onWidgetsInitializedHandlers.push(callback);
-        } else {
-            callback();
-        }
-    };
-
-    function registerOnProvidersInitizalizedHandler(callback) {
-        if (onProvidersInitializedHandlers !== null) {
-            onProvidersInitializedHandlers.push(callback);
-        } else {
-            callback();
-        }
-    };
-
-    function registerOnUIInitizalizedHandler(callback) {
-        if (onUIInitializedHandlers !== null) {
-            onUIInitializedHandlers.push(callback);
-        } else {
-            callback();
-        }
-    };
-
-    function registerOnPageInitizalizedHandler(callback) {
-        if (onPageInitializedHandlers !== null) {
-            onPageInitializedHandlers.push(callback);
-        } else {
-            callback();
-        }
-    };
-
-
-    /**
-     * Internal method should only be called from the page.jsp
-     */
-    function runOnPageInitializedHandlers() {
-        if (onPageInitializedHandlers !== null && onPageInitializedHandlers.length > 0) {
-            for (var i = 0, j = onPageInitializedHandlers.length; i < j; ++i) {
-                try {
-                    onPageInitializedHandlers[i]();
-                } catch (ex) {
-                    gadgets.warn("Could not fire onPageInitializedHandler " + ex.message);
-                }
-            }
+        function getClientMessage(key) {
+            return clientMessages[key];
         }
-        onPageInitializedHandlers = null;  // No need to hold these references anymore.
-    }
 
-    function extractObjectIdFromElementId(elementId) {
-        var tokens = elementId.split("-");
-        return tokens.length > 2 && tokens[0] == "widget" || tokens[0] == "region" ? tokens[1] : null;
-    }
-
-    function showInfoMessage(message) {
-
-        var markup = raveTemplates.templates['info-message']({
-            message: message
-        });
-
-        $(markup).hide()
-            .prependTo("body")
-            //TODO: add a class for flash box and attach these styles
-            .css({ position: 'fixed', top: 0, left: 0, width: 'auto', 'max-width': '60%', 'font-size': '1.25em', padding: '.6em 1em', 'z-index': 9999, 'border-radius': '0 0 4px 0'})
-            .fadeIn('fast').delay(8000)
-            .fadeOut(function () {
-                $(this).remove();
-            });
-    }
+        function addClientMessage(key, message) {
+            return clientMessages[key] = message;
+        }
 
+        function renderErrorWidget(id, message) {
+            $("#widget-" + id + "-body").html(message);
+        }
 
-    /**
-     * Public API
-     */
-    return {
 
-        showInfoMessage: showInfoMessage,
+        function setJavaScriptDebugMode(debugMode) {
+            javaScriptDebugMode = debugMode;
+        }
 
-        getObjectIdFromDomId: extractObjectIdFromElementId,
-        /**
-         * Renders an error in place of the widget
-         *
-         * @param id the RegionWidgetId of the widget to render in error mode
-         * @param message The message to display to the user
-         */
-        errorWidget: renderErrorWidget,
+        function getJavaScriptDebugMode() {
+            return javaScriptDebugMode;
+        }
 
-        /**
-         * Gets the value of the JavaScriptDebugMode flag
-         * 0 = off
-         * 1 = on
-         */
-        getJavaScriptDebugMode: getJavaScriptDebugMode,
+        function setPageViewer(viewer) {
+            pageViewer = viewer;
+        }
 
-        /**
-         * Sets the value of the JavaScriptDebugMode flag
-         * 0 = off
-         * 1 = on
-         */
-        setJavaScriptDebugMode: setJavaScriptDebugMode,
+        function getPageViewer() {
+            return pageViewer;
+        }
 
-        /**
-         * Sets the authenticated page viewer for the Rave web application
-         *
-         * @param viewer an object representing the authenticated user viewing the page {username:"bob", id:"1"}
-         */
-        setPageViewer: setPageViewer,
+        function setPageOwner(owner) {
+            pageOwner = owner;
+        }
 
-        /**
-         * Gets the current viewer
-         */
-        getPageViewer: getPageViewer,
+        function getPageOwner() {
+            return pageOwner;
+        }
 
-        /**
-         * Sets the owner of the current page
-         *
-         * @param owner an object representing the owner of the page
-         */
-        setPageOwner: setPageOwner,
+        function viewPage(pageId) {
+            var fragment = (pageId != null) ? ("/" + pageId) : "";
+            window.location.href = getContext() + "page/view" + fragment;
+        }
 
-        /**
-         * Gets the page owner
-         */
-        getPageOwner: getPageOwner,
+        function viewWidgetDetail(widgetId, referringPageId, jumpToId) {
+            if (jumpToId) {
+                jumpToId = '#' + jumpToId;
+            }
+            else {
+                jumpToId = '';
+            }
+            window.location.href = getContext() + "store/widget/" + widgetId + "?referringPageId=" + referringPageId + jumpToId;
+        }
 
         /**
-         * View a page
-         *
-         * @param pageId the pageId to view, or if null, the user's default page
+         * Determines if a page is empty (has zero widgets)
          */
-        viewPage: viewPage,
+        function isPageEmpty() {
+            return $.isEmptyObject(widgetByIdMap);
+        }
 
         /**
-         * View the widget detail page of a widget
-         *
-         * @param widgetId to widgetId to view
-         * @param referringPageId the id of the page the call is coming from
+         * Removes a regionWidgetId from the internal widget map
+         * @param regionWidgetId the region widget id to remove
          */
-        viewWidgetDetail: viewWidgetDetail,
+        function removeWidgetFromMap(regionWidgetId) {
+            delete widgetByIdMap[regionWidgetId];
+        }
 
-        /**
-         * Determines if a page is empty (has zero widgets)
-         * @param widgetByIdMap the map of widgets on the page
-         */
-        isPageEmpty: isPageEmpty,
+        function initPageEditorStatus(status) {
+            if (status != "undefined") {
+                pageEditor = status;
+            }
+        }
 
+        function isPageEditor() {
+            return pageEditor;
+        }
 
-        /**
-         * Returns a language specific message based on the supplied key
-         *
-         * @param key the key of the message
-         */
-        getClientMessage: getClientMessage,
+        function registerOnWidgetsInitizalizedHandler(callback) {
+            if (onWidgetsInitializedHandlers !== null) {
+                onWidgetsInitializedHandlers.push(callback);
+            } else {
+                callback();
+            }
+        };
 
-        /**
-         * Adds a message to the internal client message map
-         *
-         * @param key
-         * @param message
-         */
-        addClientMessage: addClientMessage,
+        function registerOnProvidersInitizalizedHandler(callback) {
+            if (onProvidersInitializedHandlers !== null) {
+                onProvidersInitializedHandlers.push(callback);
+            } else {
+                callback();
+            }
+        };
+
+        function registerOnUIInitizalizedHandler(callback) {
+            if (onUIInitializedHandlers !== null) {
+                onUIInitializedHandlers.push(callback);
+            } else {
+                callback();
+            }
+        };
+
+        function registerOnPageInitizalizedHandler(callback) {
+            if (onPageInitializedHandlers !== null) {
+                onPageInitializedHandlers.push(callback);
+            } else {
+                callback();
+            }
+        };
 
-        /**
-         * Set if user of a page has editing permission
-         * Used to stop sending UI events back to the server, rather
-         * than actually implementing any permission rules
-         * (which are set on the server)
-         */
-        initPageEditorStatus: initPageEditorStatus,
 
         /**
-         * Returns a boolean indicating if the user
-         * should be treated as an page editor or not
+         * Internal method should only be called from the page.jsp
          */
-        isPageEditor: isPageEditor,
+        function runOnPageInitializedHandlers() {
+            if (onPageInitializedHandlers !== null && onPageInitializedHandlers.length > 0) {
+                for (var i = 0, j = onPageInitializedHandlers.length; i < j; ++i) {
+                    try {
+                        onPageInitializedHandlers[i]();
+                    } catch (ex) {
+                        gadgets.warn("Could not fire onPageInitializedHandler " + ex.message);
+                    }
+                }
+            }
+            onPageInitializedHandlers = null;  // No need to hold these references anymore.
+        }
+
+        function extractObjectIdFromElementId(elementId) {
+            var tokens = elementId.split("-");
+            return tokens.length > 2 && tokens[0] == "widget" || tokens[0] == "region" ? tokens[1] : null;
+        }
+
+        function showInfoMessage(message) {
+
+            var markup = raveTemplates.templates['info-message']({
+                message: message
+            });
+
+            $(markup).hide()
+                .prependTo("body")
+                //TODO: add a class for flash box and attach these styles
+                .css({ position: 'fixed', top: 0, left: 0, width: 'auto', 'max-width': '60%', 'font-size': '1.25em', padding: '.6em 1em', 'z-index': 9999, 'border-radius': '0 0 4px 0'})
+                .fadeIn('fast').delay(8000)
+                .fadeOut(function () {
+                    $(this).remove();
+                });
+        }
+
 
         /**
-         * Registration methods for initialization events
+         * Public API
          */
-        registerOnWidgetsInitizalizedHandler: registerOnWidgetsInitizalizedHandler,
-        registerOnProvidersInitizalizedHandler: registerOnProvidersInitizalizedHandler,
-        registerOnUIInitizalizedHandler: registerOnUIInitizalizedHandler,
-        registerOnPageInitizalizedHandler: registerOnPageInitizalizedHandler,
-        runOnPageInitializedHandlers: runOnPageInitializedHandlers
-    }
-})
+        return {
+
+            showInfoMessage: showInfoMessage,
+
+            getObjectIdFromDomId: extractObjectIdFromElementId,
+            /**
+             * Renders an error in place of the widget
+             *
+             * @param id the RegionWidgetId of the widget to render in error mode
+             * @param message The message to display to the user
+             */
+            errorWidget: renderErrorWidget,
+
+            /**
+             * Gets the value of the JavaScriptDebugMode flag
+             * 0 = off
+             * 1 = on
+             */
+            getJavaScriptDebugMode: getJavaScriptDebugMode,
+
+            /**
+             * Sets the value of the JavaScriptDebugMode flag
+             * 0 = off
+             * 1 = on
+             */
+            setJavaScriptDebugMode: setJavaScriptDebugMode,
+
+            /**
+             * Sets the authenticated page viewer for the Rave web application
+             *
+             * @param viewer an object representing the authenticated user viewing the page {username:"bob", id:"1"}
+             */
+            setPageViewer: setPageViewer,
+
+            /**
+             * Gets the current viewer
+             */
+            getPageViewer: getPageViewer,
+
+            /**
+             * Sets the owner of the current page
+             *
+             * @param owner an object representing the owner of the page
+             */
+            setPageOwner: setPageOwner,
+
+            /**
+             * Gets the page owner
+             */
+            getPageOwner: getPageOwner,
+
+            /**
+             * View a page
+             *
+             * @param pageId the pageId to view, or if null, the user's default page
+             */
+            viewPage: viewPage,
+
+            /**
+             * View the widget detail page of a widget
+             *
+             * @param widgetId to widgetId to view
+             * @param referringPageId the id of the page the call is coming from
+             */
+            viewWidgetDetail: viewWidgetDetail,
+
+            /**
+             * Determines if a page is empty (has zero widgets)
+             * @param widgetByIdMap the map of widgets on the page
+             */
+            isPageEmpty: isPageEmpty,
+
+
+            /**
+             * Returns a language specific message based on the supplied key
+             *
+             * @param key the key of the message
+             */
+            getClientMessage: getClientMessage,
+
+            /**
+             * Adds a message to the internal client message map
+             *
+             * @param key
+             * @param message
+             */
+            addClientMessage: addClientMessage,
+
+            /**
+             * Set if user of a page has editing permission
+             * Used to stop sending UI events back to the server, rather
+             * than actually implementing any permission rules
+             * (which are set on the server)
+             */
+            initPageEditorStatus: initPageEditorStatus,
+
+            /**
+             * Returns a boolean indicating if the user
+             * should be treated as an page editor or not
+             */
+            isPageEditor: isPageEditor,
+
+            /**
+             * Registration methods for initialization events
+             */
+            registerOnWidgetsInitizalizedHandler: registerOnWidgetsInitizalizedHandler,
+            registerOnProvidersInitizalizedHandler: registerOnProvidersInitizalizedHandler,
+            registerOnUIInitizalizedHandler: registerOnUIInitizalizedHandler,
+            registerOnPageInitizalizedHandler: registerOnPageInitizalizedHandler,
+            runOnPageInitializedHandlers: runOnPageInitializedHandlers
+        }
+    })