Author: prasad
Date: Mon Dec  3 02:52:04 2007
New Revision: 10424

Log:

Added activity search.

Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
   trunk/mashup/java/modules/www/org/default.jsp
   trunk/mashup/java/modules/www/org/search.jsp

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
  (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
  Mon Dec  3 02:52:04 2007
@@ -19,10 +19,7 @@
 import org.wso2.mashup.utils.QueryResult;
 import org.wso2.mashup.utils.QueryResults;
 import org.wso2.mashup.webapp.userprofile.User;
-import org.wso2.registry.Registry;
-import org.wso2.registry.RegistryConstants;
-import org.wso2.registry.RegistryException;
-import org.wso2.registry.Resource;
+import org.wso2.registry.*;
 import org.wso2.registry.jdbc.JDBCRegistry;
 import org.wso2.registry.secure.RegistryUserManager;
 import org.wso2.registry.secure.SecureRegistry;
@@ -97,6 +94,7 @@
 
     /**
      * Retrieves the first and last name of the currently logged in user, 
concatenated.
+     *
      * @param request Current servlet request
      * @return User's full name.
      * @throws RegistryException
@@ -141,8 +139,8 @@
 
     public static String customize(String s, String username, String 
currentUser) {
         s.replaceAll("{user}", username);
-        s.replaceAll("{user's}", username.equals(currentUser) ?  "my"  : 
username);
-        s.replaceAll("{User's}", username.equals(currentUser) ?  "My"  : 
username);
+        s.replaceAll("{user's}", username.equals(currentUser) ? "my" : 
username);
+        s.replaceAll("{User's}", username.equals(currentUser) ? "My" : 
username);
         return s;
     }
 
@@ -175,40 +173,120 @@
             throws RegistryException {
 
         String currentUser = getCurrentUser(registry);
-
         QueryResults qResults = new QueryResults();
         qResults.setQueryName(queryHeading);
 
-        Resource resultsCollection = registry.executeQuery(queryPath, params);
-        String[] resultPaths = (String[]) resultsCollection.getContent();
-        qResults.setResultCount(resultPaths.length);
-
-        for (int j = 0; j < resultPaths.length && j < maxResults; j++) {
-            Resource resultArtifact = registry.get(resultPaths[j]);
-            String[] values = resultPaths[j].split("\\/");
-            String mashupName = values[values.length - 1];
-
-            QueryResult queryResult = new QueryResult();
-            queryResult.setName(mashupName);
-            queryResult.setAuthor(resultArtifact.getAuthorUserName());
-
-            if 
(RegistryConstants.COMMENT_MEDIA_TYPE.equals(resultArtifact.getMediaType())) {
-                qResults.setResultsType("comment");
-                queryResult.setResultType("comment");
-                
queryResult.setPath(resultArtifact.getProperty("resourcePath"));
-                String commentText = (String) resultArtifact.getContent();
-                queryResult.setContentString(commentText);
-
-            } else {
-                qResults.setResultsType("resource");
-                queryResult.setResultType("resource");
-                queryResult.setPath(resultArtifact.getPath());
-                queryResult.setDescription(resultArtifact.getDescription());
-                
queryResult.setRating(registry.getRating(resultArtifact.getPath(), 
currentUser));
-                
queryResult.setAverageRating(registry.getAverageRating(resultArtifact.getPath()));
+        if (!queryPath.equals("/log")) {
+            Resource resultsCollection = registry.executeQuery(queryPath, 
params);
+            String[] resultPaths = (String[]) resultsCollection.getContent();
+            qResults.setResultCount(resultPaths.length);
+
+
+            for (int j = 0; j < resultPaths.length && j < maxResults; j++) {
+                Resource resultArtifact = registry.get(resultPaths[j]);
+                String[] values = resultPaths[j].split("\\/");
+                String mashupName = values[values.length - 1];
+
+                QueryResult queryResult = new QueryResult();
+                queryResult.setName(mashupName);
+                queryResult.setAuthor(resultArtifact.getAuthorUserName());
+
+                if 
(RegistryConstants.COMMENT_MEDIA_TYPE.equals(resultArtifact.getMediaType())) {
+                    qResults.setResultsType("comment");
+                    queryResult.setResultType("comment");
+                    
queryResult.setPath(resultArtifact.getProperty("resourcePath"));
+                    String commentText = (String) resultArtifact.getContent();
+                    queryResult.setContentString(commentText);
+
+                } else {
+                    qResults.setResultsType("resource");
+                    queryResult.setResultType("resource");
+                    queryResult.setPath(resultArtifact.getPath());
+                    
queryResult.setDescription(resultArtifact.getDescription());
+                    
queryResult.setRating(registry.getRating(resultArtifact.getPath(), 
currentUser));
+                    
queryResult.setAverageRating(registry.getAverageRating(resultArtifact.getPath()));
+                }
+
+                qResults.addResult(queryResult);
+            }
+
+        } else {
+
+            if (params[0] != null && params[0].equals("null")) {
+                params[0] = null;
+            }
+            if (params[1] != null && params[1].equals("null")) {
+                params[1] = null;
+            }
+            if (params[2] != null && params[2].equals("null")) {
+                params[2] = null;
+            }
+            if (params[3] != null && params[3].equals("null")) {
+                params[3] = null;
+            }
+            if (params[4] != null && params[4].equals("null")) {
+                params[4] = null;
+            }
+
+            int filterValue = -1;
+            if (params[1] != null && params[1].equals("-1")) {
+                // filterValue = LogEntry.UPDATE;
+                filterValue = -1;
+
+            } else if (params[1] != null && params[1].equals("2")) {
+                filterValue = LogEntry.COMMENT;
+
+            } else if (params[1] != null && params[1].equals("3")) {
+                filterValue = LogEntry.TAG;
+
+            } else if (params[1] != null && params[1].equals("4")) {
+                filterValue = LogEntry.RATING;
+
             }
+            //   System.out.println(Arrays.toString(params));
+            LogEntry[] logs = registry.getLogs(params[0], filterValue, 
params[2], null, null);
+
+            for (int i = 0; i < logs.length; i++) {
+                QueryResult queryResult = new QueryResult();
+                queryResult.setName("ActivityLog");
+                queryResult.setPath("/log");
+
+                String entry = "";
+                LogEntry logEntry = logs[i];
+
+                if 
(!logEntry.getUserName().equals(RegistryConstants.ANONYMOUS_USER)) {
+                    if (logEntry.getAction() == LogEntry.UPDATE) {
+                        /*      entry = logEntry.getUserName() + " has updated 
the resource '" +
+                           logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
+                           ".";
+                        */
+                        continue;
+                    } else if (logEntry.getAction() == LogEntry.COMMENT) {
+                        entry = logEntry.getUserName() + " has commented on 
resource '" +
+                                logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
+                                " with the following comment.<br/>" + 
logEntry.getActionData();
+
+
+                    } else if (logEntry.getAction() == LogEntry.TAG) {
+                        entry = logEntry.getUserName() + " has tagged the 
resource '" +
+                                logEntry.getResourcePath() + "' with tag '" + 
logEntry.getActionData() +
+                                "' on " + logEntry.getDate().toString() + ".";
+
+
+                    } else if (logEntry.getAction() == LogEntry.RATING) {
+                        entry = logEntry.getUserName() + " has rated the 
resource '" +
+                                logEntry.getResourcePath() + "' with rating " +
+                                logEntry.getActionData() + " on " + 
logEntry.getDate().toString() + ".";
+
+
+                    }
+                    queryResult.setContentString(entry);
+                    qResults.addResult(queryResult);
+                    qResults.setResultsType("activitylog");
 
-            qResults.addResult(queryResult);
+                }
+
+            }
         }
 
         return qResults;

Modified: trunk/mashup/java/modules/www/org/default.jsp
==============================================================================
--- trunk/mashup/java/modules/www/org/default.jsp       (original)
+++ trunk/mashup/java/modules/www/org/default.jsp       Mon Dec  3 02:52:04 2007
@@ -129,15 +129,15 @@
 <tr>
 <td valign="top">
 <div id="queries">
-    <%
-        int nextId = 0;
-        QueryResults results;
-        UserQuery[] queries = userProfile.getQueries();
-        for (int i = 0; i < queries.length; i++) {
-
-            String path = queries[i].getQueryPath();
-            String[] params = queries[i].getQueryParameters();
-            String title = queries[i].getTitle();
+<%
+    int nextId = 0;
+    QueryResults results;
+    UserQuery[] queries = userProfile.getQueries();
+    for (int i = 0; i < queries.length; i++) {
+
+        String path = queries[i].getQueryPath();
+        String[] params = queries[i].getQueryParameters();
+        String title = queries[i].getTitle();
 
             results = RegistryUtils.doQuery(registry, title, path, params, 
MashupConstants.SHOW_RESULTS_COUNT);
     %>
@@ -149,6 +149,8 @@
             <span class="edit-link" title="Atom feed">[<a
                     href="search.jsp?<%=QueryParamUtils.paramsFromQuery(path, 
params)%>&format=atom" target="_blank">Atom</a>]</span>
         </div>
+<% if (!path.equals("/log")) { %>
+
         <table width="100%" border="0" cellpadding="3" cellspacing="0" 
class="data">
             <tbody>
                 <tr>
@@ -172,18 +174,69 @@
                         </div>
                     </td>
                 </tr>
-                <%
-                    Iterator iter = results.getResults().iterator();
-                    while (iter.hasNext()) {
-                        QueryResult result = (QueryResult) iter.next();
-                        String id = "id" + nextId;
-                %>
-                <tr class="results">
-                    <td width="1" nowrap>
-                        <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
-                        </a>
+
+<%
+} else {
+
+%>
+<table width="100%" border="0" cellpadding="3" cellspacing="0" class="data">
+
+    <tr>
+
+        <td colspan="2" class="headers">
+            <table width="100%" border="0" cellspacing="0" cellpadding="0">
+                <tr>
+                    <td>Activity</td>
+                    <td width="95">
+                        <div class="query-controls">
+                            <% if (RegistryUtils.isLoggedIn(registry)) { %>
+                            <span id="query<%=nextId%>up" class="edit-link" 
title="move up"
+                                  <% if (i == 0) { %>style="display:none"<% } 
%>>[<a href="#"
+                                                                               
      onclick="moveQuery('query<%=nextId%>', 
'<%=path%>','<%=QueryParamUtils.paramsToString(params)%>', 'up')">^</a>]</span>
+                            <span id="query<%=nextId%>down" class="edit-link" 
title="move down"
+                                  <% if (i == queries.length - 1) { 
%>style="display:none"<% } %>>[<a
+                                    href="#"
+                                    onclick="moveQuery('query<%=nextId%>', 
'<%=path%>','<%=QueryParamUtils.paramsToString(params)%>', 
'down')">v</a>]</span>
+                            <span class="edit-link" title="delete">[<a href="#"
+                                                                       
onclick="deleteQuery('query<%=nextId%>', 
'<%=path%>','<%=QueryParamUtils.paramsToString(params)%>')">x</a>]</span>
+                            <% } %>
+                        </div>
                     </td>
-                    <td nowrap>
+                </tr>
+            </table>
+        </td>
+
+    </tr>
+    <%
+
+      }
+
+    %>
+
+    <%
+
+     Iterator iter = results.getResults().iterator();
+     while (iter.hasNext()) {
+         QueryResult result = (QueryResult) iter.next();
+         String id = "id" + nextId;
+
+ if (results.getResultsType().equals("activitylog")) {
+    %>
+
+    <tr class="results">
+        <td width="10" valign="top"><img src="images/ra.gif"/></td>
+        <td valign="top" width="100%" colspan="2">
+            <%= result.getContentString() %>
+        </td>
+    </tr>
+
+    <% } else { %>
+    <tr class="results">
+        <td width="1" nowrap>
+            <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
+            </a>
+        </td>
+        <td nowrap>
                         <a 
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
                                                                                
        result.getAuthor())%>
                         </a>
@@ -221,13 +274,17 @@
                         </div>
                     </td>
                 </tr>
-                <% nextId++;
-                }
-                    if (results.getResultCount() > 
MashupConstants.SHOW_RESULTS_COUNT) { %>
-                <tr>
-                    <td colspan="3"></td>
+    <%
 
-                    <td>
+}
+nextId++;
+}
+if (results.getResultCount() > MashupConstants.SHOW_RESULTS_COUNT) {
+    %>
+    <tr>
+        <td colspan="3"></td>
+
+        <td>
                         <div class="more"><a 
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(path, params)%>">more...</a>
                         </div>
                     </td>
@@ -237,9 +294,9 @@
         </table>
         <br/>
     </div>
-    <%
-        }
-    %>
+
+<% }
+%>
 </div>
 
 
@@ -252,46 +309,48 @@
 
     </tr>
     <%
-        List activity = new ArrayList();
-        String entry = "";
-        org.wso2.registry.LogEntry[] logs =
-                registry.getLogs(MashupConstants.ALL_MASHUPS_PATH + "/", -1, 
null, null, null);
+
+
+        org.wso2.registry.LogEntry[] logs = 
registry.getLogs(MashupConstants.ALL_MASHUPS_PATH + "/", -1, null, null, null);
         for (int i = 0; i < logs.length; i++) {
+            String entry = "";
             LogEntry logEntry = logs[i];
             if 
(!logEntry.getUserName().equals(RegistryConstants.ANONYMOUS_USER)) { %>
-    <tr>
+
+    <%
+        if (logEntry.getAction() == LogEntry.UPDATE) {
+            /*       entry = logEntry.getUserName() + " has updated the 
resource '" +
+               logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
+               ".";
+       activity.add(entry);     */
+            continue;
+
+        } else if (logEntry.getAction() == LogEntry.COMMENT) {
+            entry = logEntry.getUserName() + " has commented on resource '" +
+                    logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
+                    " with the following comment.<br/>" + 
logEntry.getActionData();
+
+
+        } else if (logEntry.getAction() == LogEntry.TAG) {
+            entry = logEntry.getUserName() + " has tagged the resource '" +
+                    logEntry.getResourcePath() + "' with tag '" + 
logEntry.getActionData() +
+                    "' on " + logEntry.getDate().toString() + ".";
+
+
+        } else if (logEntry.getAction() == LogEntry.RATING) {
+            entry = logEntry.getUserName() + " has rated the resource '" +
+                    logEntry.getResourcePath() + "' with rating " +
+                    logEntry.getActionData() + " on " + 
logEntry.getDate().toString() + ".";
+
+        }%>
+
+    <tr class="results">
         <td width="10" valign="top"><img src="images/ra.gif"/></td>
         <td valign="top">
-            <%
-                if (logEntry.getAction() == LogEntry.UPDATE) {
-                    entry = logEntry.getUserName() + " has updated the 
resource '" +
-                            logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
-                            ".";
-                    activity.add(entry);
-
-                } else if (logEntry.getAction() == LogEntry.COMMENT) {
-                    entry = logEntry.getUserName() + " has commented on 
resource '" +
-                            logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
-                            " with the following comment.<br/>" + 
logEntry.getActionData();
-                    activity.add(entry);
-
-                } else if (logEntry.getAction() == LogEntry.TAG) {
-                    entry = logEntry.getUserName() + " has tagged the resource 
'" +
-                            logEntry.getResourcePath() + "' with tag '" + 
logEntry.getActionData() +
-                            "' on " + logEntry.getDate().toString() + ".";
-                    activity.add(entry);
-
-                } else if (logEntry.getAction() == LogEntry.RATING) {
-                    entry = logEntry.getUserName() + " has rated the resource 
'" +
-                            logEntry.getResourcePath() + "' with rating " +
-                            logEntry.getActionData() + " on " + 
logEntry.getDate().toString() + ".";
-                    activity.add(entry);
-                }%>
-
             <%=entry %>
-            <br/><br/>
         </td>
     </tr>
+
     <% }
     } %>
 

Modified: trunk/mashup/java/modules/www/org/search.jsp
==============================================================================
--- trunk/mashup/java/modules/www/org/search.jsp        (original)
+++ trunk/mashup/java/modules/www/org/search.jsp        Mon Dec  3 02:52:04 2007
@@ -50,6 +50,7 @@
 <%@ page import="java.util.Iterator" %>
 <%@ page import="java.util.List" %>
 <%@ page import="java.util.Map" %>
+
 <%
 
     Registry registry = RegistryUtils.getRegistry(request);
@@ -71,6 +72,11 @@
     String searchFor = request.getParameter("for");
     String searchScope = request.getParameter("scope");
 
+    //Activity search parameter
+    String paramActivityScope = request.getParameter("activityScope");
+    String paramFilter = request.getParameter("filter");
+    String paramPeriod = request.getParameter("period");
+
     // If there isn't a search scope, this query is either a custom one or a 
blank search page
     if (searchScope == null) {
         // Provide meaningful defaults
@@ -99,6 +105,11 @@
         query = "custom";
     }
 
+    String activitySearch = request.getParameter("searchActivity");
+    if (activitySearch != null && activitySearch.equalsIgnoreCase("true")) {
+        query = "activitylog";
+    }
+
     // Controls param defines whether the search form is collapsed or not, 
allowing the search page
     //  to be used to display arbitrary lists, not just for "search" results.  
E.g. a search initiated
     //  by a URL instead of a search form probably won't want to show the 
search form prominently.
@@ -199,6 +210,28 @@
 
             queryPath = MashupConstants.MY_CUSTOM_QUERY_PATH;
             queryParams = params;
+
+        } else if (query.equalsIgnoreCase("activitylog")) {
+            // Run with a dummy query path to search activity log
+            String resourcePath = null;
+            String fromDate = null;
+            String toDate = null;
+            queryPath = "/log";
+           if(paramActivityScope== null || paramActivityScope.equals("null")){ 
queryTitle ="All ";}else{queryTitle = getFullName(request, searchScope)+"'s "; }
+           queryTitle += "activity for last " + paramPeriod + " on ";
+            if(paramFilter.equals("-1")){
+                queryTitle += "any";
+            }else if(paramFilter.equals("2")){
+                queryTitle += "comments";
+            } else if(paramFilter.equals("3")){
+                queryTitle += "taggings";
+            }else if(paramFilter.equals("4")){
+               queryTitle += "rating";
+            }
+
+            queryParams = new String[]{resourcePath, paramFilter, 
paramActivityScope, fromDate, toDate};
+
+
         } else {
             // Error condition
             // todo: report error instead of just giving all results.
@@ -456,12 +489,6 @@
     // ------  Recent Activity search form -----------------
 
 
-    String activityScope = request.getParameter("activityScope");
-    String userName = request.getParameter("userName");
-    String fromDate = request.getParameter("fromDate");
-    String toDate = request.getParameter("toDate");
-    String filter = request.getParameter("filter");
-
 %>
 <form id="Search2" name="formActivitySearch" action="search.jsp" method="get">
     <input type="hidden" name="searchActivity" value="true"/>
@@ -471,37 +498,37 @@
             <td>Show
                 <select name="activityScope">
                     <option value="null"
-                            <% if (activityScope != null && 
activityScope.equals("null")) { %>selected="selected"<% } %>>
+                            <% if (paramActivityScope == null || 
paramActivityScope.equals("null")) { %>selected="selected"<% } %>>
                         All activity
                     </option>
                     <% if (RegistryUtils.isLoggedIn(registry)) { %>
                     <option value="<%=currentUser%>"
-                            <% if (activityScope != null && 
activityScope.equals(currentUser)) { %>selected="selected"<% } %> >
+                            <% if (paramActivityScope != null && 
paramActivityScope.equals(currentUser)) { %>selected="selected"<% } %> >
                         My activity
                     </option>
                     <% } %>
                 </select>
                 for last
                 <select name="timePeriod" id="timePeriod">
-                    <option value="30day">30 days</option>
-                    <option value="6month">6 month</option>
+                    <option value="30 days" <% if (paramPeriod == null || 
paramPeriod.equals("30 days")) { %>selected="selected"<% } %>>30 days</option>
+                    <option value="6 months" <% if (paramPeriod != null && 
paramPeriod.equals("6 months")) { %>selected="selected"<% } %>>6 months</option>
                 </select>
                 on
                 <select name="filter" id="RecentActivity_filter">
-                    <option value="1"
-                            <% if (filter != null && filter.equals("1")) { 
%>selected="selected"<% } %>>
+                    <option value="-1"
+                            <% if (paramFilter == null || 
paramFilter.equals("-1")) { %>selected="selected"<% } %>>
                         Any
                     </option>
-                    <option value="3"
-                            <% if (filter != null && filter.equals("3")) { 
%>selected="selected"<% } %>>
+                    <option value="2"
+                            <% if (paramFilter != null && 
paramFilter.equals("2")) { %>selected="selected"<% } %>>
                         Comments
                     </option>
-                    <option value="4"
-                            <% if (filter != null && filter.equals("4")) { 
%>selected="selected"<% } %>>
+                    <option value="3"
+                            <% if (paramFilter != null && 
paramFilter.equals("3")) { %>selected="selected"<% } %>>
                         Taggings
                     </option>
-                    <option value="5"
-                            <% if (filter != null && filter.equals("5")) { 
%>selected="selected"<% } %>>
+                    <option value="4"
+                            <% if (paramFilter != null && 
paramFilter.equals("4")) { %>selected="selected"<% } %>>
                         Ratings
                     </option>
                 </select></td>
@@ -543,6 +570,28 @@
     <span class="edit-link" title="Atom feed">[<a
           href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
queryParams)%>&format=atom" target="_blank">Atom</a>]</span>
 </div>
+<%
+
+
+
+  if(results.getResultsType().equals("activitylog")){
+
+    // System.out.println("--> "+results.getResultsType());
+
+
+
+%>
+
+<table width="100%" border="0" cellpadding="3" cellspacing="0" class="data">
+
+<tr>
+
+    <td width="100%" colspan="2" class="headers">Activity</td>
+
+</tr>
+<%
+} else {
+%>
 <table width="100%" border="0" cellpadding="3" cellspacing="0" class="data">
     <tbody>
         <tr>
@@ -552,7 +601,7 @@
             <td width="95" class="headers">Rating</td>
         </tr>
 
-
+        <% } %>
         <%
             Iterator iter = results.getResults().iterator();
             int nextId = 0;
@@ -560,8 +609,18 @@
                 QueryResult result = (QueryResult) iter.next();
                 String id = "id" + nextId;
                 String path = result.getPath();
-        %>
 
+                if (results.getResultsType().equals("activitylog")) { %>
+
+        <tr>
+            <td width="10" valign="top"><img src="images/ra.gif"/></td>
+            <td valign="top" width="100%">
+                <%= result.getContentString() %>
+                <br/><br/>
+            </td>
+        </tr>
+
+        <% } else { %>
         <tr class="results">
             <td width="1" nowrap>
                 <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
@@ -606,7 +665,9 @@
                 </div>
             </td>
         </tr>
-        <% nextId++;
+        <% }
+
+            nextId++;
         } %>
 
     </tbody>
@@ -634,130 +695,6 @@
 </tr>
 </table>
 
-<%
-    // ------  Recent Activity search results -----------------
-
-
-    String activitySearch = request.getParameter("searchActivity");
-
-    if (activitySearch != null && activitySearch.equalsIgnoreCase("true")) {
-
-        /*     if (resourcePath != null && resourcePath.equals("")) {
-                resourcePath = null;
-            }
-        */
-        if (userName != null && userName.equals("")) {
-            userName = null;
-        }
-
-        if (fromDate != null && fromDate.equals("")) {
-            fromDate = null;
-        }
-
-        if (toDate != null && toDate.equals("")) {
-            toDate = null;
-        }
-
-        if (filter == null) {
-            filter = "1";
-        }
-
-        int filterValue = -1;
-        if (filter.equals("2")) {
-            filterValue = LogEntry.UPDATE;
-
-        } else if (filter.equals("3")) {
-            filterValue = LogEntry.COMMENT;
-
-        } else if (filter.equals("4")) {
-            filterValue = LogEntry.TAG;
-
-        } else if (filter.equals("5")) {
-            filterValue = LogEntry.RATING;
-
-        }
-
-        if (activityScope.equals("null")) {
-            activityScope = null;
-        }
-        //    SecureRegistry secureRegistry = (SecureRegistry) getRegistry();
-        LogEntry[] logs = registry.getLogs(null, filterValue, activityScope, 
null, null);
-%>
-<div class="heading">Recent activity</div>
-<table width="100%" border="0" cellpadding="3" cellspacing="0" class="data">
-
-    <tr>
-
-        <td width="100%" colspan="2" class="headers">Activity</td>
-
-    </tr>
-
-    <%
-        for (int i = 0; i < logs.length; i++) {
-            String entry = "";
-            LogEntry logEntry = logs[i];
-            if 
(!logEntry.getUserName().equals(RegistryConstants.ANONYMOUS_USER)) {
-                if (logEntry.getAction() == LogEntry.UPDATE) {
-                    entry = logEntry.getUserName() + " has updated the 
resource '" +
-                            logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
-                            ".";
-
-
-                } else if (logEntry.getAction() == LogEntry.COMMENT) {
-                    entry = logEntry.getUserName() + " has commented on 
resource '" +
-                            logEntry.getResourcePath() + "' on " + 
logEntry.getDate().toString() +
-                            " with the following comment.<br/>" + 
logEntry.getActionData();
-
-
-                } else if (logEntry.getAction() == LogEntry.TAG) {
-                    entry = logEntry.getUserName() + " has tagged the resource 
'" +
-                            logEntry.getResourcePath() + "' with tag '" + 
logEntry.getActionData() +
-                            "' on " + logEntry.getDate().toString() + ".";
-
-
-                } else if (logEntry.getAction() == LogEntry.RATING) {
-                    entry = logEntry.getUserName() + " has rated the resource 
'" +
-                            logEntry.getResourcePath() + "' with rating " +
-                            logEntry.getActionData() + " on " + 
logEntry.getDate().toString() + ".";
-
-
-                }
-
-
-    %>
-
-    <tr>
-        <td width="10" valign="top"><img src="images/ra.gif"/></td>
-        <td valign="top" width="100%">
-            <%= entry %>
-            <br/><br/>
-        </td>
-    </tr>
-    <%
-            }
-        }
-    %>
-</table>
-<br/>
-
-<% if (RegistryUtils.isLoggedIn(registry)) { %>
-<input id="addToHomePage2" type="button" value="Show this query on my home 
page"
-       onClick="saveQuery()"/>
-<br/>
-<% } else { %>
-<div>Sign in to add this query to your home page.</div>
-<% } %>
-
-<br/>
-
-<%
-    }
-
-    // ------  Recent Activity search results end -----------------
-
-%>
-
-
 </div>
 
 <%@ include file="footer.jsp" %>

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

Reply via email to