Author: psharples
Date: Wed Sep  5 12:40:30 2012
New Revision: 1381160

URL: http://svn.apache.org/viewvc?rev=1381160&view=rev
Log:
Fixes for both RAVE-710 and RAVE-711. (based on the work by Daniel Gornstein).  
A shared page was rendering (although greyed out) before the user had accepted 
the share.  (causing some issues)

Modified:
    rave/trunk/rave-portal-resources/src/main/resources/messages.properties
    rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
    rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
    
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js

Modified: 
rave/trunk/rave-portal-resources/src/main/resources/messages.properties
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/resources/messages.properties?rev=1381160&r1=1381159&r2=1381160&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/resources/messages.properties 
(original)
+++ rave/trunk/rave-portal-resources/src/main/resources/messages.properties Wed 
Sep  5 12:40:30 2012
@@ -348,8 +348,7 @@ widget.menu.movethiswidget=Move this wid
 widget.menu.movetopage=Move to Page
 widget.menu.title=Widget Actions
 
-sharing.dialog.confirm.title=New page share found
-sharing.dialog.confirm.message={0} has shared this page with you. Do you wish 
to accept and add this page to your collection?
+sharing.page.confirm.message={0} has shared this page with you. Do you wish to 
accept and add this page to your collection?
 sharing.page.tab.icon.tip.from=This page has been shared with you by {0}
 sharing.page.tab.icon.tip.to=You have shared this page with other users
 
@@ -395,6 +394,8 @@ _rave_client.revoke.share.current.user=Y
 _rave_client.revoke.share.current.user.confirm=Are you sure you wish to remove 
this shared page?
 _rave_client.grant.editing.user.confirm=Are you sure you wish to give editing 
rights to the following user?
 _rave_client.revoke.editing.user.confirm=Are you sure you wish to remove 
editing rights from the following user?
+_rave_client.accept.share.confirm=Are you sure you wish to accept this page 
invitation?
+_rave_client.decline.share.confirm=Are you sure you wish to decline this page 
invitation?
 _rave_client.remove.friend.confirm=Are you sure you wish to remove {0} from 
your friends list?
 _rave_client.remove.friend.request.confirm=Are you sure you wish to cancel the 
friend request you sent to {0}?
 _rave_client.no.results.found=No results found

Modified: 
rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties?rev=1381160&r1=1381159&r2=1381160&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties 
(original)
+++ rave/trunk/rave-portal-resources/src/main/resources/messages_nl.properties 
Wed Sep  5 12:40:30 2012
@@ -352,8 +352,7 @@ widget.menu.movethiswidget=Verplaats dez
 widget.menu.movetopage=Verplaats naar Pagina
 widget.menu.title=Widget acties
 
-sharing.dialog.confirm.title=Nieuwe gedeelde pagina gevonden
-sharing.dialog.confirm.message={0} heeft een pagina met jou gedeeld. Wil je 
deze gedeelde pagina toevoegen?
+sharing.page.confirm.message={0} heeft een pagina met jou gedeeld. Wil je deze 
gedeelde pagina toevoegen?
 sharing.page.tab.icon.tip.from=Deze pagina is met jou gedeeld door {0}.
 sharing.page.tab.icon.tip.to=U hebt deze pagina met andere gebruikers gedeeld
 
@@ -397,6 +396,8 @@ _rave_client.revoke.share.current.user=D
 _rave_client.revoke.share.current.user.confirm=Wilt u deze gedeelde pagina 
verwijderen?
 _rave_client.grant.editing.user.confirm=Wilt u deze gebruiker rechten geven om 
de pagina bewerken?
 _rave_client.revoke.editing.user.confirm=Wilt u deze gebruiker de rechten 
afnemen om de pagina te bewerken?
+_rave_client.accept.share.confirm=Weet u zeker dat u wenst te accepteren deze 
pagina uitnodiging?
+_rave_client.decline.share.confirm=Weet u zeker dat u wenst te weigeren deze 
pagina uitnodiging?
 _rave_client.no.results.found=Geen resultaten gevonden
 _rave_client.get.metadata=Haal metadata op
 page.general.relation.status=Burgerlijke staat\:

Modified: 
rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp?rev=1381160&r1=1381159&r2=1381160&view=diff
==============================================================================
--- rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp 
(original)
+++ rave/trunk/rave-portal-resources/src/main/webapp/WEB-INF/jsp/views/page.jsp 
Wed Sep  5 12:40:30 2012
@@ -130,22 +130,47 @@
 
     <div class="row-fluid">
         <div id="emptyPageMessageWrapper" class="emptyPageMessageWrapper 
hidden">
-            <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>
-        <div class="regions">
-            <%-- insert the region layout template --%>
-            <tiles:insertTemplate template="${layout}"/>
+            <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>
-        <div class="clear-float">&nbsp;</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">
+                            <fmt:message key="sharing.page.confirm.message">
+                                <fmt:param value="${page.owner.username}"/>
+                            </fmt:message>
+                        </div>
+                    </div>
+                    <div>&nbsp;</div>
+                    <div>
+                        <a href="#" 
onclick="rave.layout.searchHandler.acceptShare()"><fmt:message 
key="_rave_client.common.accept"/></a>
+                    </div>
+                    <div>
+                        <a href="#" 
onclick="rave.layout.searchHandler.declineShare();"><fmt:message 
key="_rave_client.common.decline"/></a>
+                    </div>
+                    <div class="clear-float">&nbsp;</div>
+                </div>
+            </c:otherwise>
+        </c:choose>
     </div>
 
 
@@ -278,33 +303,15 @@
         </div>
     </div>
 
-    <div id="confirmSharePageDialog" class="modal hide" data-backdrop="static">
-        <div class="modal-header">
-            <a href="#" class="close" data-dismiss="modal">&times;</a>
-            <h3><fmt:message key="sharing.dialog.confirm.title"/></h3>
-        </div>
-        <div class="modal-body">
-            <div id="confirmSharePageDialogLegend">
-                <fmt:message key="sharing.dialog.confirm.message">
-                    <fmt:param value="${page.owner.username}"/>
-                </fmt:message>
-            </div>
-        </div>
-        <div class="modal-footer">
-            <a href="#" class="btn btn-primary" 
onclick="rave.layout.searchHandler.acceptShare()"><fmt:message 
key="_rave_client.common.accept"/></a>
-            <a href="#" class="btn" 
onclick="rave.layout.searchHandler.declineShare();"><fmt:message 
key="_rave_client.common.decline"/></a>
-            <a href="#" class="btn" 
onclick="$('#confirmSharePageDialog').modal('hide');"><fmt:message 
key="_rave_client.common.cancel"/></a>
-        </div>
-    </div>
 <portal:register-init-script location="${'AFTER_RAVE'}">
     <script>
         $(function() {
             rave.initPageEditorStatus(<c:out value="${pageUser.editor}"/>);
             rave.initProviders();
+            rave.layout.searchHandler.setDefaults("<c:out 
value="${principleUsername}"/>","<sec:authentication property="principal.id" 
/>","<c:out value="${page.id}"/>", "${pageUser.pageStatus}");
             rave.initWidgets();
             rave.initUI();
             rave.layout.init();
-            rave.layout.searchHandler.setDefaults("<c:out 
value="${principleUsername}"/>","<sec:authentication property="principal.id" 
/>","<c:out value="${page.id}"/>", "${pageUser.pageStatus}");
             rave.runOnPageInitializedHandlers();
         });
     </script>

Modified: 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js
URL: 
http://svn.apache.org/viewvc/rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js?rev=1381160&r1=1381159&r2=1381160&view=diff
==============================================================================
--- 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js 
(original)
+++ 
rave/trunk/rave-portal-resources/src/main/webapp/static/script/rave_layout.js 
Wed Sep  5 12:40:30 2012
@@ -154,9 +154,6 @@ rave.layout = rave.layout || (function()
             this.username = username;
             this.userId = userId;
             this.pageId = pageId;
-            if(pageStatus == "PENDING"){
-                confirmPageShare();
-            };
         }
 
         function addExistingMember(member, isEditor){
@@ -303,29 +300,30 @@ rave.layout = rave.layout || (function()
         }
 
         function acceptShare(){
-            $('#confirmSharePageDialog').modal('hide');
-            rave.api.rpc.updateSharedPageStatus({pageId: 
rave.layout.searchHandler.pageId, shareStatus: 'accepted',
-                successCallback: function(result) {
-                    //notification here?
-                }
-            });
+            var answer;
+            answer = confirm(rave.getClientMessage("accept.share.confirm"));
+            if(answer){
+                rave.api.rpc.updateSharedPageStatus({pageId: 
rave.layout.searchHandler.pageId, shareStatus: 'accepted',
+                    successCallback: function(result) {
+                        rave.viewPage(rave.layout.searchHandler.pageId);
+                    }
+                });
+            }
         }
 
         function declineShare(){
-            $('#confirmSharePageDialog').modal('hide');
-            rave.api.rpc.updateSharedPageStatus({pageId: 
rave.layout.searchHandler.pageId, shareStatus: 'refused',
-                successCallback: function(result) {
-                    
rave.api.rpc.removeMemberFromPage({pageId:rave.layout.searchHandler.pageId, 
userId:rave.layout.searchHandler.userId,
-                        successCallback:function (result) {
-                            document.location.href='/';
-                        }});
-
-                }
-            });
-        }
-
-        function confirmPageShare(){
-            $("#confirmSharePageDialog").modal('show');
+            var answer;
+            answer = confirm(rave.getClientMessage("decline.share.confirm"));
+            if(answer){
+                rave.api.rpc.updateSharedPageStatus({pageId: 
rave.layout.searchHandler.pageId, shareStatus: 'refused',
+                    successCallback: function(result) {
+                        
rave.api.rpc.removeMemberFromPage({pageId:rave.layout.searchHandler.pageId, 
userId:rave.layout.searchHandler.userId,
+                            successCallback:function (result) {
+                                document.location.href='/';
+                            }});
+                    }
+                })
+            }
         }
 
         function init() {
@@ -526,7 +524,6 @@ rave.layout = rave.layout || (function()
             removeMemberFromPage : removeMemberFromPage,
             addEditingRightsToMember: addEditingRightsToMember,
             removeEditingRightsFromMember : removeEditingRightsFromMember,
-            confirmPageShare : confirmPageShare,
             acceptShare : acceptShare,
             declineShare : declineShare,
             updateParamsInString : updateParamsInString


Reply via email to