You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rave.apache.org by mf...@apache.org on 2012/06/04 18:39:04 UTC
svn commit: r1346029 [3/3] - in /rave/branches/model_interfaces: ./
rave-components/rave-core/src/main/java/org/apache/rave/portal/model/
rave-components/rave-core/src/main/java/org/apache/rave/portal/repository/impl/
rave-components/rave-core/src/main...
Modified: rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave.js
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave.js?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave.js (original)
+++ rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave.js Mon Jun 4 16:39:01 2012
@@ -23,6 +23,9 @@ var rave = rave || (function () {
var context = "";
var clientMessages = {};
var openAjaxHub;
+ // variable to store whether or not some
+ // UI actions should be propagated back to the server
+ var pageEditor = true;
/**
* Separate sub-namespace for isolating UI functions and state management
@@ -469,7 +472,7 @@ var rave = rave || (function () {
// don't persist the collapse / restore state if we are in
// mobile mode because we defaulted all widgets to collapsed
// when initially rendering the mobile view
- if (rave.isMobile()) {
+ if (rave.isMobile() || !rave.isPageEditor()) {
rave.doWidgetUiCollapse(functionArgs);
} else {
rave.api.rest.saveWidgetCollapsedState(functionArgs);
@@ -1036,6 +1039,16 @@ var rave = rave || (function () {
}
}
+ function initPageEditorStatus(status){
+ if(status != "undefined"){
+ this.pageEditor = status;
+ }
+ }
+
+ function isPageEditor(){
+ return this.pageEditor;
+ }
+
/**
* Public API
*/
@@ -1292,6 +1305,20 @@ var rave = rave || (function () {
/**
* Registers a new popup definition
*/
- registerPopup:ui.registerPopup
+ registerPopup:ui.registerPopup,
+
+ /**
+ * 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
}
})();
Modified: rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_api.js
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_api.js?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_api.js (original)
+++ rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_api.js Mon Jun 4 16:39:01 2012
@@ -489,7 +489,7 @@ rave.api = rave.api || (function() {
}
}).error(handleError);
}
-
+
function updateSharedPageStatus(args){
$.post(rave.getContext() + path + "page/" + args.pageId + "/sharestatus",
{"shareStatus": args.shareStatus},
@@ -505,6 +505,22 @@ rave.api = rave.api || (function() {
}).error(handleError);
}
+ function updatePageEditingStatus(args){
+ $.post(rave.getContext() + path + "page/" + args.pageId + "/editstatus",
+ {"userId": args.userId,
+ "isEditor": args.isEditor},
+ function(result) {
+ if (result.error) {
+ handleRpcError(result);
+ }
+ else {
+ if (typeof args.successCallback == 'function') {
+ args.successCallback(result);
+ }
+ }
+ }).error(handleError);
+ }
+
return {
moveWidget : moveWidgetOnPage,
addWidgetToPage : addWidgetToPage,
@@ -520,7 +536,8 @@ rave.api = rave.api || (function() {
searchUsers : searchUsers,
addMemberToPage : addMemberToPage,
removeMemberFromPage : removeMemberFromPage,
- updateSharedPageStatus : updateSharedPageStatus
+ updateSharedPageStatus : updateSharedPageStatus,
+ updatePageEditingStatus: updatePageEditingStatus
};
})();
Modified: rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_layout.js
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_layout.js?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_layout.js (original)
+++ rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_layout.js Mon Jun 4 16:39:01 2012
@@ -136,9 +136,12 @@ rave.layout = rave.layout || (function()
var username;
var userId;
var pageId;
- var existingSharers = new Array();
+ var existingSharers;
function setDefaults(username, userId, pageId, pageStatus){
+ if(this.existingSharers == "undefined" || this.existingSharers == null){
+ this.existingSharers = {};
+ }
this.username = username;
this.userId = userId;
this.pageId = pageId;
@@ -147,21 +150,35 @@ rave.layout = rave.layout || (function()
};
}
- function addExistingMember(member){
- existingSharers.push(member);
+ function addExistingMember(member, isEditor){
+ if(this.existingSharers == "undefined" || this.existingSharers == null){
+ this.existingSharers = {};
+ }
+ this.existingSharers[member] = isEditor;
}
function removeExistingMember(member){
- existingSharers.splice( $.inArray(member, existingSharers), 1 );
+ delete this.existingSharers[member];
}
function isUserAlreadyAdded(username){
- if($.inArray(username, existingSharers) == -1){
- return false;
+ for(member in this.existingSharers){
+ if(username == member){
+ return true;
+ }
}
- else{
- return true;
+ return false;
+ }
+
+ function isUserEditor(username){
+ for(member in this.existingSharers){
+ if(username == member){
+ if(this.existingSharers[member] == true){
+ return true;
+ }
+ }
}
+ return false;
}
function removeMemberFromPage(userId, username){
@@ -176,6 +193,7 @@ rave.layout = rave.layout || (function()
rave.api.rpc.removeMemberFromPage({pageId: this.pageId, userId: userId,
successCallback: function(result) {
rave.layout.searchHandler.removeExistingMember(username);
+ $('#pageEditorStatusHolder'+userId).empty();
$('#shareButtonHolder'+userId).empty();
$('#shareButtonHolder'+userId)
.append(
@@ -191,7 +209,7 @@ rave.layout = rave.layout || (function()
// reload as page has been removed
document.location.href='/';
}else{
- alert("(" + username + ") " + rave.getClientMessage("revoke.share"));
+ alert("(" + username + ") " + rave.getClientMessage("revoke.share"));
}
}
});
@@ -215,15 +233,68 @@ rave.layout = rave.layout || (function()
userId+", '" + username+"');")
.text(rave.getClientMessage("common.remove"))
)
- $('#shareButtonHolder'+userId).show();
+ $('#shareButtonHolder'+userId).show();
+ $('#pageEditorStatusHolder'+userId).empty();
+ $('#pageEditorStatusHolder'+userId)
+ .append(
+ $("<a/>")
+ .attr("href", "#")
+ .attr("id", userId)
+ .attr("onclick", "rave.layout.searchHandler.addEditingRightsToMember("+userId+", '"+username+"');")
+ .text(rave.getClientMessage("common.add"))
+ )
alert("(" + username + ") " + rave.getClientMessage("create.share"));
}
});
}
}
-
+
+ function removeEditingRightsFromMember(userId, username){
+ var answer = confirm(rave.getClientMessage("revoke.editing.user.confirm") + " ("+username+")");
+ if(answer){
+ $('#pageEditorStatusHolder'+userId).hide();
+ rave.api.rpc.updatePageEditingStatus({pageId: this.pageId, userId: userId, isEditor: false,
+ successCallback: function(result) {
+ rave.layout.searchHandler.existingSharers[username] = false;
+ $('#pageEditorStatusHolder'+userId).empty();
+ $('#pageEditorStatusHolder'+userId)
+ .append(
+ $("<a/>")
+ .attr("href", "#")
+ .attr("id", userId)
+ .attr("onclick", "rave.layout.searchHandler.addEditingRightsToMember("+userId+", '"+username+"');")
+ .text(rave.getClientMessage("common.add"))
+ )
+ $('#pageEditorStatusHolder'+userId).show();
+ }
+ });
+ }
+ }
+
+ function addEditingRightsToMember(userId, username){
+ var answer = confirm(rave.getClientMessage("grant.editing.user.confirm") + " ("+username+")");
+ if(answer){
+ $('#pageEditorStatusHolder'+userId).hide();
+ rave.api.rpc.updatePageEditingStatus({pageId: this.pageId, userId: userId, isEditor: true,
+ successCallback: function(result) {
+ rave.layout.searchHandler.existingSharers[username] = true;
+ $('#pageEditorStatusHolder'+userId).empty();
+ $('#pageEditorStatusHolder'+userId)
+ .append(
+ $("<a/>")
+ .attr("href", "#")
+ .attr("id", userId)
+ .attr("onclick", "rave.layout.searchHandler.removeEditingRightsFromMember("+userId+", '"+username+"');")
+ .text(rave.getClientMessage("common.remove"))
+ )
+ $('#pageEditorStatusHolder'+userId).show();
+ }
+ });
+ }
+ }
+
function acceptShare(){
- $('#confirmSharePageDialog').modal('hide');
+ $('#confirmSharePageDialog').modal('hide');
rave.api.rpc.updateSharedPageStatus({pageId: rave.layout.searchHandler.pageId, shareStatus: 'accepted',
successCallback: function(result) {
//notification here?
@@ -232,7 +303,7 @@ rave.layout = rave.layout || (function()
}
function declineShare(){
- $('#confirmSharePageDialog').modal('hide');
+ $('#confirmSharePageDialog').modal('hide');
rave.api.rpc.updateSharedPageStatus({pageId: rave.layout.searchHandler.pageId, shareStatus: 'refused',
successCallback: function(result) {
document.location.href='/';
@@ -241,7 +312,7 @@ rave.layout = rave.layout || (function()
}
function confirmPageShare(){
- $("#confirmSharePageDialog").modal('show');
+ $("#confirmSharePageDialog").modal('show');
}
function init() {
@@ -279,7 +350,7 @@ rave.layout = rave.layout || (function()
var $pagingDiv = $('#shareSearchListPaging');
$pagingDiv.empty();
if(userResults.result.pageSize < userResults.result.totalResults){
- $pagingDiv.append('<ul id="pagingul" class="paging" style="margin-left: 0;">');
+ $pagingDiv.append('<div class="pagination"><ul id="pagingul" >');
if(userResults.result.currentPage > 1){
offset = (userResults.result.currentPage - 2) * userResults.result.pageSize;
$('#pagingul').append('<li><a href="#" onclick="rave.api.rpc.getUsers({offset: ' +
@@ -288,7 +359,7 @@ rave.layout = rave.layout || (function()
}
for(var i=1;i<=userResults.result.numberOfPages;i++){
if(i == userResults.result.currentPage){
- $('#pagingul').append('<li><span class="currentPage">'+i+'</span></li>');
+ $('#pagingul').append('<li class="active"><a href="#">'+i+'</a></li>');
}else{
offset = (i - 1) * userResults.result.pageSize;
$('#pagingul').append('<li><a href="#" onclick="rave.api.rpc.getUsers({offset: ' +
@@ -302,6 +373,7 @@ rave.layout = rave.layout || (function()
offset + ', successCallback: function(result)' +
' {rave.layout.searchHandler.dealWithUserResults(result);}});">></a></li>');
}
+ $pagingDiv.append('</ul></div>')
}
}
@@ -349,6 +421,14 @@ rave.layout = rave.layout || (function()
.text(rave.getClientMessage("common.sharing"))
)
)
+ .append(
+ $("<td/>")
+ .addClass("booleancell")
+ .append(
+ $("<b/>")
+ .text(rave.getClientMessage("common.editing.auth"))
+ )
+ )
)
.append(
$("<tbody/>")
@@ -369,6 +449,10 @@ rave.layout = rave.layout || (function()
$("<td/>")
.attr("id", "shareButtonHolder" + this.entityId)
)
+ .append(
+ $("<td/>")
+ .attr("id", "pageEditorStatusHolder" + this.entityId)
+ )
)
if(this.username != rave.layout.searchHandler.username){
@@ -382,6 +466,26 @@ rave.layout = rave.layout || (function()
.attr("onclick", "rave.layout.searchHandler.removeMemberFromPage("+this.entityId+", '"+this.username+"');")
.text(rave.getClientMessage("common.remove"))
)
+ if(rave.layout.searchHandler.isUserEditor(this.username)){
+ $('#pageEditorStatusHolder'+this.entityId)
+ .append(
+ $("<a/>")
+ .attr("href", "#")
+ .attr("id", this.entityId)
+ .attr("onclick", "rave.layout.searchHandler.removeEditingRightsFromMember("+this.entityId+", '"+this.username+"');")
+ .text(rave.getClientMessage("common.remove"))
+ )
+ }
+ else{
+ $('#pageEditorStatusHolder'+this.entityId)
+ .append(
+ $("<a/>")
+ .attr("href", "#")
+ .attr("id", this.entityId)
+ .attr("onclick", "rave.layout.searchHandler.addEditingRightsToMember("+this.entityId+", '"+this.username+"');")
+ .text(rave.getClientMessage("common.add"))
+ )
+ }
}else{
$('#shareButtonHolder'+this.entityId)
.append(
@@ -390,7 +494,7 @@ rave.layout = rave.layout || (function()
.attr("id", this.entityId)
.attr("onclick", "rave.layout.searchHandler.addMemberToPage("+this.entityId+", '"+this.username+"');")
.text(rave.getClientMessage("common.add"))
- )
+ )
}
}
@@ -404,8 +508,11 @@ rave.layout = rave.layout || (function()
addExistingMember : addExistingMember,
removeExistingMember : removeExistingMember,
isUserAlreadyAdded : isUserAlreadyAdded,
+ isUserEditor : isUserEditor,
addMemberToPage : addMemberToPage,
removeMemberFromPage : removeMemberFromPage,
+ addEditingRightsToMember: addEditingRightsToMember,
+ removeEditingRightsFromMember : removeEditingRightsFromMember,
confirmPageShare : confirmPageShare,
acceptShare : acceptShare,
declineShare : declineShare
Modified: rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_opensocial.js
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_opensocial.js?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_opensocial.js (original)
+++ rave/branches/model_interfaces/rave-portal-resources/src/main/webapp/script/rave_opensocial.js Mon Jun 4 16:39:01 2012
@@ -168,7 +168,9 @@ rave.opensocial = rave.opensocial || (fu
};
gadget.savePreferences = function (userPrefs) {
this.userPrefs = userPrefs;
- rave.api.rest.saveWidgetPreferences({regionWidgetId:this.regionWidgetId, userPrefs:userPrefs});
+ if(rave.isPageEditor()){
+ rave.api.rest.saveWidgetPreferences({regionWidgetId:this.regionWidgetId, userPrefs:userPrefs});
+ }
// re-render the gadget in the same view if the gadget is not collapsed
renderGadgetViewIfNotCollapsed(rave.opensocial.getCurrentView(this.regionWidgetId), this);
};
@@ -326,7 +328,9 @@ rave.opensocial = rave.opensocial || (fu
// update the memory prefs object
regionWidget.userPrefs[prefName] = prefValue;
// persist it to database
- rave.api.rest.saveWidgetPreference({regionWidgetId:widgetId, userPref:{prefName:prefName, prefValue:prefValue}});
+ if(rave.isPageEditor()){
+ rave.api.rest.saveWidgetPreference({regionWidgetId:widgetId, userPref:{prefName:prefName, prefValue:prefValue}});
+ }
}
/**
Modified: rave/branches/model_interfaces/rave-portal/src/main/dist/LICENSE
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal/src/main/dist/LICENSE?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal/src/main/dist/LICENSE (original)
+++ rave/branches/model_interfaces/rave-portal/src/main/dist/LICENSE Mon Jun 4 16:39:01 2012
@@ -204,7 +204,7 @@
===============================================================================
-The Apache Rave (inclubating) distribution includes a number of subcomponents
+The Apache Rave distribution includes a number of subcomponents
with separate copyright notices and license terms. Your use of the
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
@@ -2018,33 +2018,15 @@ The following licenses relate to subcomp
not already included above.
===============================================================================
===============================================================================
-The following components come under Apache Software License 2.0
+The following components come under Apache License 2.0
===============================================================================
dwr-2.0.5
- Containing Project URL: http://directwebremoting.org/
-
- /*
- * Copyright 2005 Joe Walker
- *
- * Licensed 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.
- */
-
enyo.js
enyo.css
+OpenAjaxManagedHub-all.js
+google-collections-1.0-rc2.jar
-/* Enyo v2.0.0 | Copyright 2011-2012 Hewlett-Packard Development Company, L.P. | enyojs.com | enyojs.com/license */
-
===============================================================================
The following components are MIT Licensed
===============================================================================
@@ -2442,30 +2424,6 @@ s5
"As of version 1.1, the technology itself has been explicitly released into the
Public Domain, so there are no restrictions whatsoever on its use or reuse
(nor can there ever be)"
-
-===============================================================================
-The following components come under Apache Software License 2.0
-===============================================================================
-
-
-google-collections-1.0-rc2.jar
- Containing Project URL: http://code.google.com/p/google-collections/
-
-/*
- * Copyright (C) 2009 Google Inc.
- *
- * Licensed 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.
- */
===============================================================================
The following components are BSD Licensed
Modified: rave/branches/model_interfaces/rave-portal/src/main/dist/NOTICE
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-portal/src/main/dist/NOTICE?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-portal/src/main/dist/NOTICE (original)
+++ rave/branches/model_interfaces/rave-portal/src/main/dist/NOTICE Mon Jun 4 16:39:01 2012
@@ -7,6 +7,18 @@ The Apache Software Foundation (http://w
This product includes software (Bootstrap) developed at
Twitter (http://www.twitter.com/).
+This product includes software (Direct Web Remoting) which is released under the Apache License 2.0 and is
+Copyright 2005 Joe Walker (http://directwebremoting.org).
+
+This product includes software (Enyo 2.0.0) which is released under the Apache License 2.0 and is
+Copyright 2011-2012 Hewlett-Packard Development Company, L.P. (http://enyojs.com).
+
+This product includes software (OpenAjax Managed Hub) which is released under the Apache License 2.0 and is
+Copyright 2006 OpenAjax Alliance (http://www.openajax.org).
+
+This product includes software (Google Collections) which is released under the Apache License 2.0 and is
+Copyright (C) 2009 Google Inc. (http://code.google.com/p/google-collections/).
+
Java compilation software for JSP pages is provided by Eclipse, which is open source software. The original software and
related information is available at http://www.eclipse.org.
Modified: rave/branches/model_interfaces/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetService.java
URL: http://svn.apache.org/viewvc/rave/branches/model_interfaces/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetService.java?rev=1346029&r1=1346028&r2=1346029&view=diff
==============================================================================
--- rave/branches/model_interfaces/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetService.java (original)
+++ rave/branches/model_interfaces/rave-providers/rave-w3c-provider/src/main/java/org/apache/rave/provider/w3c/service/impl/WookieWidgetService.java Mon Jun 4 16:39:01 2012
@@ -63,26 +63,27 @@ public class WookieWidgetService impleme
*/
public Widget[] getWidgets() throws WookieConnectorException{
connectorService = getWookieConnectorService(wookieServerUrl, wookieApiKey, null);
- Collection<org.apache.wookie.connector.framework.Widget> widgets = connectorService.getAvailableWidgets().values();
- ArrayList<Widget> raveWidgets = new ArrayList<Widget>();
- for (org.apache.wookie.connector.framework.Widget wookieWidget: widgets){
- Widget widget = new Widget();
- widget.setUrl(wookieWidget.getIdentifier());
- widget.setDescription(wookieWidget.getDescription());
- widget.setTitle(wookieWidget.getTitle());
- widget.setThumbnailUrl(wookieWidget.getIcon().toString());
- raveWidgets.add(widget);
- }
- return raveWidgets.toArray(new Widget[raveWidgets.size()]);
+ Collection<org.apache.wookie.connector.framework.Widget> widgets = connectorService.getAvailableWidgets().values();
+ ArrayList<Widget> raveWidgets = new ArrayList<Widget>();
+ for (org.apache.wookie.connector.framework.Widget wookieWidget: widgets){
+ Widget widget = new Widget();
+ widget.setUrl(wookieWidget.getIdentifier());
+ widget.setDescription(wookieWidget.getDescription());
+ widget.setTitle(wookieWidget.getName());
+ widget.setThumbnailUrl(wookieWidget.getIcon().toString());
+ widget.setAuthor(wookieWidget.getAuthor());
+ raveWidgets.add(widget);
+ }
+ return raveWidgets.toArray(new Widget[raveWidgets.size()]);
}
public Widget getWidget(String url) throws WookieConnectorException{
- for (Widget widget: getWidgets()){
- if (widget.getUrl().equalsIgnoreCase(url)){
- return widget;
- }
- }
- return null;
+ for (Widget widget: getWidgets()){
+ if (widget.getUrl().equalsIgnoreCase(url)){
+ return widget;
+ }
+ }
+ return null;
}
/**