Author: cgeer
Date: Wed Aug 8 15:13:18 2012
New Revision: 1370802
URL: http://svn.apache.org/viewvc?rev=1370802&view=rev
Log:
RAVE-751 Added support for client side page viewer/owner attributes. Patch
submitted by Erin Noe-Payne.
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
URL:
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp?rev=1370802&r1=1370801&r2=1370802&view=diff
==============================================================================
---
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
(original)
+++
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/personProfile.jsp
Wed Aug 8 15:13:18 2012
@@ -185,6 +185,10 @@
rave.initUI();
rave.layout.init();
rave.personprofile.init();
+ rave.setPageOwner({
+ username: "${userProfile.username}",
+ id: "${userProfile.id}"
+ });
});
</script>
</portal:register-init-script>
Modified:
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
URL:
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag?rev=1370802&r1=1370801&r2=1370802&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
(original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/tags/rave_js.tag
Wed Aug 8 15:13:18 2012
@@ -18,11 +18,11 @@
--%>
<%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
-<portal:render-script location="${'BEFORE_LIB'}" />
-<rave:third_party_js />
-<portal:render-script location="${'AFTER_LIB'}" />
+<portal:render-script location="${'BEFORE_LIB'}"/>
+<rave:third_party_js/>
+<portal:render-script location="${'AFTER_LIB'}"/>
<%-- local rave scripts --%>
-<portal:render-script location="${'BEFORE_RAVE'}" />
+<portal:render-script location="${'BEFORE_RAVE'}"/>
<%-- 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="${not empty portalSettings and not empty
portalSettings['javaScriptDebugMode'] and
portalSettings['javaScriptDebugMode'].value == '0'}">
@@ -41,8 +41,14 @@
</c:otherwise>
</c:choose>
<script src="<spring:url
value="/app/messagebundle/rave_client_messages.js"/>"></script>
-<portal:render-script location="${'AFTER_RAVE'}" />
+<portal:render-script location="${'AFTER_RAVE'}"/>
<%-- common javascript to execute on all pages --%>
<script>
rave.setContext("<spring:url value="/app/" />");
+ <sec:authorize access="isAuthenticated()">
+ <sec:authentication property="principal.username" scope="request"
var="username"/>
+ <sec:authentication property="principal.id" scope="request" var="id"/>
+ rave.setPageViewer({username:"${username}",
+ id:"${id}"});
+ </sec:authorize>
</script>
Modified: rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js
URL:
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js?rev=1370802&r1=1370801&r2=1370802&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js
(original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave.js Wed
Aug 8 15:13:18 2012
@@ -26,6 +26,14 @@ var rave = rave || (function () {
// variable to store whether or not some
// UI actions should be propagated back to the server
var pageEditor = true;
+ var pageViewer = {
+ username: "Unknown",
+ id:-1
+ };
+ var pageOwner = {
+ username: "Unknown",
+ id:-1
+ };
var onWidgetsInitializedHandlers = [];
var onProvidersInitializedHandlers = [];
@@ -1074,6 +1082,22 @@ var rave = rave || (function () {
return context;
}
+ function setPageViewer(viewer) {
+ pageViewer = viewer;
+ }
+
+ function getPageViewer(){
+ return pageViewer;
+ }
+
+ function setPageOwner(owner){
+ pageOwner = owner;
+ }
+
+ function getPageOwner(){
+ return pageOwner;
+ }
+
function getRegionWidgetById(regionWidgetId) {
return widgetByIdMap[regionWidgetId];
}
@@ -1264,6 +1288,30 @@ var rave = rave || (function () {
getContext:getContext,
/**
+ * 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,
+
+ /**
* Gets a regionwidget by region widget id
*/
getRegionWidgetById:getRegionWidgetById,