Author: jonathan
Date: Tue Jan 22 13:39:11 2008
New Revision: 12708

Log:

MASHUP-566: added check that the user is still signed in.

Modified:
   trunk/mashup/java/modules/www/mashup.jsp

Modified: trunk/mashup/java/modules/www/mashup.jsp
==============================================================================
--- trunk/mashup/java/modules/www/mashup.jsp    (original)
+++ trunk/mashup/java/modules/www/mashup.jsp    Tue Jan 22 13:39:11 2008
@@ -273,23 +273,22 @@
     </td>
     <td>
         <div class="mashup_description">
-            <!-- todo: ajax description editing -->
-                <span id="editDescription">
-                    <span id="editDescription_value"><%=description%></span>
+            <span id="editDescription">
+                <span id="editDescription_value"><%=description%></span>
 <% if (currentUser.equals(author)) { %>
-                    <span class="edit-link">[<a href="#" 
onclick="makeEditable('editDescription')">edit</a>]</span>
+                <span class="edit-link">[<a href="#" 
onclick="makeEditable('editDescription')">edit</a>]</span>
 <% } %>
-                </span>
-                <span id="editDescription_input" style="display:none">
-                    <textarea id="editDescription_input_text"><%=description%>
-                    </textarea>
-                    <span class="edit-link">[<a href="#"
-                                                
onclick="cancelEditable('editDescription')">cancel</a>]</span>
-                    <span class="edit-link">[<a href="#"
-                                                
onclick="saveEditable('editDescription', 'description', 
'<%=mashup%>')">save</a>]</span>
-                    <br/>
-                    <span class="mashup_label">(accepts some html 
markup)</span>
-                </span>
+            </span>
+            <span id="editDescription_input" style="display:none">
+                <textarea id="editDescription_input_text"><%=description%>
+                </textarea>
+                <span class="edit-link">[<a href="#"
+                                            
onclick="cancelEditable('editDescription')">cancel</a>]</span>
+                <span class="edit-link">[<a href="#"
+                                            
onclick="saveEditable('editDescription', 'description', 
'<%=mashup%>')">save</a>]</span>
+                <br/>
+                <span class="mashup_label">(accepts some html markup)</span>
+            </span>
         </div>
     </td>
 </tr>
@@ -446,27 +445,26 @@
             </tr>
 
             <%
-                if ((request.getParameter("commentText") != null) &&
-                        (request.getParameter("commentText") != "")) {
-                    registry.addComment(resource.getPath(),
-                                        new 
Comment(request.getParameter("commentText")));
+                String commentText = request.getParameter("commentText");
+                if (commentText != null && commentText != "" &&
+                        RegistryUtils.isLoggedIn(registry)) {
+                    registry.addComment(resource.getPath(), new 
Comment(commentText));
                 }
 
-                Comment[] c = registry.getComments(resource.getPath());
+                Comment[] comments = registry.getComments(resource.getPath());
 
-                for (int i = 0; i < c.length; i++) {
+                for (int i = 0; i < comments.length; i++) {
+                    Comment c = comments[i];
             %>
 
             <tr>
                 <td>
-                    <nobr><%=QueryParamUtils.friendlyDate(c[i].getTime())%>
-                    </nobr>
+                    <nobr><%=QueryParamUtils.friendlyDate(c.getTime())%></nobr>
                 </td>
-                <td><a href="user.jsp?name=<%=c[i].getUser()%>"><%=  
RegistryUtils
-                        .getFullName(request, c[i].getUser()) %>&nbsp;(<%=c[i]
-                        .getUser()%>)
+                <td><a href="user.jsp?name=<%=c.getUser()%>"><%=  RegistryUtils
+                        .getFullName(request, c.getUser()) 
%>&nbsp;(<%=c.getUser()%>)
                 </a></td>
-                <td><%= c[i].getText() %>
+                <td><%= c.getText() %>
                 </td>
                 <!-- todo: add delete comment controls (when appropriate)
                     todo: fix commented timezone -->

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to