Author: channa
Date: Sat Mar 29 23:53:58 2008
New Revision: 15327
Log:
Adding 'Recent activity on this mashup' section (MASHUP-726). Search.jsp
to be enhanced to provide activity details for a specifiec mashup.
Added:
trunk/mashup/java/modules/www/activity.jsp
Modified:
trunk/mashup/java/modules/www/mashup.jsp
Added: trunk/mashup/java/modules/www/activity.jsp
==============================================================================
--- (empty file)
+++ trunk/mashup/java/modules/www/activity.jsp Sat Mar 29 23:53:58 2008
@@ -0,0 +1,109 @@
+<%@ page import="org.wso2.mashup.MashupConstants" %>
+<%@ page import="org.wso2.mashup.utils.QueryResult" %>
+<%@ page import="org.wso2.mashup.utils.QueryResults" %>
+<%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils" %>
+<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
+<%@ page import="org.wso2.registry.*" %>
+<%@ page import="java.util.*" %>
+
+<%
+ QueryResults results;
+ String mashupPath = request.getParameter("mashup_path");
+ String title = request.getParameter("title");
+ String queryPath = MashupConstants.ACTIVITY_QUERY_PATH;
+ String[] params = {mashupPath, "all", "null", "7"};
+ Registry registry = RegistryUtils.getRegistry(request);
+ results = RegistryUtils
+ .doQuery(registry, title, queryPath, params,
MashupConstants.SHOW_RESULTS_COUNT);
+
+%>
+<div id="query1" class="querypane">
+ <table width="95%" border="0" cellpadding="3" cellspacing="0" class="data">
+ <tbody>
+ <tr>
+ <% if (results.getResultsType().equals("activity")) { %>
+ <td class="headers" width="12%" colspan="2">When</td>
+ <td class="headers" width="73%" colspan="2">Activity</td>
+ <% } %>
+ </tr>
+
+ <%
+ Iterator iter = results.getResults().iterator();
+ boolean hasResults = iter.hasNext();
+ if (!hasResults) { %>
+ <tr class="noresults">
+ <td valign="top" colspan="4">
+ No results found.
+ </td>
+ <td>
+ <a
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath,
params)%>">refine query...</a>
+ </td>
+ </tr>
+ <% } else {
+
+ while (iter.hasNext()) {
+ QueryResult result = (QueryResult) iter.next();
+ String path = result.getPath();
+
+ if (results.getResultsType().equals("activity")) {
+ String action = result.getAction();
+
+ %>
+
+ <tr class="results">
+ <td width="12%" valign="top">
+ <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%>
+ </nobr>
+ </td>
+ <td width="1" valign="top">
+ <% if (action.equals("deleted")) { %>
+ <img src="images/activity-delete.gif"/>
+ <% } else if (action.equals("rated")) { %>
+ <img src="images/activity-rate.gif"/>
+ <% } else if (action.equals("commented") ||
action.equals("tagged")) { %>
+ <img src="images/activity-comment.gif"/>
+ <% } else { %>
+ <img src="images/activity-edit.gif"/>
+ <% } %>
+ </td>
+ <td valign="top" colspan="3">
+ <% if
(result.getAuthor().equals(RegistryUtils.getCurrentUser(registry))) { %>
+ <a href="user.jsp?name=<%=result.getAuthor()%>">You</a>
+ <% } else { %>
+ <a
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils
+ .getFullName(request, result.getAuthor())%>
+ </a> (<%=result.getAuthor()%>)
+ <% } %>
+ <%= action %>
+ <%
+ if (action.equals("rated")) { %>
+ <%=result.getContentString() %> stars
+ <% } else if (action.equals("tagged")) { %>
+ with <a
+
href="search.jsp?query=mashups&for=<%=result.getContentString()%>&tags=true"><%=result
+ .getContentString()%>
+ </a>
+ <% } else if (action.equals("commented")) { %>
+ <span class="inline-comment">"<%=result.getContentString()
%>"</span>
+ <% } %>
+ </td>
+ </tr>
+
+ <%
+ }
+ }
+ }
+ if (hasResults) { %>
+ <tr>
+ <td colspan="5">
+ <div class="more"><a
+
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath,
params)%>&controls=false">
+ <% if (results.getResultCount() >
MashupConstants.SHOW_RESULTS_COUNT) { %>more
+ results...<% } else { %>show query...<% } %></a></div>
+ </td>
+ </tr>
+ <% } %>
+ </tbody>
+ </table>
+ <br/>
+</div>
\ No newline at end of file
Modified: trunk/mashup/java/modules/www/mashup.jsp
==============================================================================
--- trunk/mashup/java/modules/www/mashup.jsp (original)
+++ trunk/mashup/java/modules/www/mashup.jsp Sat Mar 29 23:53:58 2008
@@ -558,6 +558,17 @@
</td>
</tr>
+<tr>
+ <td>
+ <div class="heading">Actions</div>
+ <div id="activitylist" class="detail-section">
+ <jsp:include page="activity.jsp">
+ <jsp:param name="mashup_path" value="<%=path%>"/>
+ <jsp:param name="title" value="Actions"/>
+ </jsp:include>
+</div>
+ </td>
+</tr>
</table>
</div>
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev