Author: tyrell
Date: Thu Jan 17 04:33:23 2008
New Revision: 12407

Log:

Adding basic faulty services handling to the ui

Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/utils/RegistryUtils.java
   trunk/mashup/java/modules/www/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
  Thu Jan 17 04:33:23 2008
@@ -328,7 +328,9 @@
                         int action = logEntry.getAction();
                         if (action == LogEntry.UPDATE) {
                             String[] pathSegments = 
logEntry.getResourcePath().split("/");
-                            if 
((logEntry.getResourcePath().startsWith(MashupConstants.ALL_MASHUPS_PATH)) && 
(pathSegments.length > 3)) {
+                            if ((logEntry.getResourcePath().startsWith(
+                                    MashupConstants.ALL_MASHUPS_PATH)) &&
+                                    (pathSegments.length > 3)) {
                                 queryResult.setAction("updated");
                             } else continue;
                         } else if (action == LogEntry.COMMENT) {
@@ -561,7 +563,7 @@
     /**
      * Gets the profile for a given user and makes him/her primary.
      *
-     * @param realm  Registry realm.
+     * @param realm    Registry realm.
      * @param userName User to be made primary.
      */
     public static void makeUserPrimary(Realm realm, String userName) throws 
UserManagerException {
@@ -577,7 +579,7 @@
     /**
      * Gets the profile for a given user and returns if he ir she is the 
primary user.
      *
-     * @param realm Registry realm.
+     * @param realm    Registry realm.
      * @param userName User name to be checked for status.
      * @return true if user profile is enabled.
      */
@@ -589,4 +591,25 @@
         // Get 'primary' property.
         return userProps.containsKey(MashupConstants.PRIMARY);
     }
+
+    /**
+     * Checks a given mashup to find out whether the underlying service is a 
faulty service.
+     *
+     * @param registry Instance of the Registry where the mashup resource is 
stired
+     * @param path     Path of the mashup resource
+     * @return true if the service is faulty
+     */
+    public static boolean isFaultyMashup(Registry registry, String path) {
+
+        try {
+            if (registry.get(path).getProperty(MashupConstants.FAULTY_MASHUP) 
!= null) {
+                return true;
+            }else{
+                return false;
+            }
+        } catch (RegistryException e) {
+            e.printStackTrace();
+            return false;
+        }
+    }
 }

Modified: trunk/mashup/java/modules/www/search.jsp
==============================================================================
--- trunk/mashup/java/modules/www/search.jsp    (original)
+++ trunk/mashup/java/modules/www/search.jsp    Thu Jan 17 04:33:23 2008
@@ -14,23 +14,23 @@
  * limitations under the License.
 --%>
 <%@ page errorPage="error.jsp" %>
-<%@ page import="com.sun.syndication.feed.synd.SyndContent"%>
-<%@ page import="com.sun.syndication.feed.synd.SyndContentImpl"%>
-<%@ page import="com.sun.syndication.feed.synd.SyndEntry"%>
-<%@ page import="com.sun.syndication.feed.synd.SyndEntryImpl"%>
-<%@ page import="com.sun.syndication.feed.synd.SyndFeed"%>
-<%@ page import="com.sun.syndication.feed.synd.SyndFeedImpl"%>
-<%@ page import="com.sun.syndication.io.SyndFeedOutput"%>
-<%@ 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.identity.InfoCardHandler"%>
-<%@ page import="org.wso2.mashup.webapp.identity.RegistrationBean"%>
-<%@ page import="org.wso2.mashup.webapp.userprofile.User"%>
-<%@ page import="org.wso2.mashup.webapp.userprofile.UserQuery"%>
-<%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils"%>
-<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils"%>
-<%@ page import="org.wso2.registry.Comment"%>
+<%@ page import="com.sun.syndication.feed.synd.SyndContent" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndContentImpl" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndEntry" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndEntryImpl" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndFeed" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndFeedImpl" %>
+<%@ page import="com.sun.syndication.io.SyndFeedOutput" %>
+<%@ 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.identity.InfoCardHandler" %>
+<%@ page import="org.wso2.mashup.webapp.identity.RegistrationBean" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.User" %>
+<%@ page import="org.wso2.mashup.webapp.userprofile.UserQuery" %>
+<%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils" %>
+<%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
+<%@ page import="org.wso2.registry.Comment" %>
 <%@ page import="org.wso2.registry.LogEntry" %>
 <%@ page import="org.wso2.registry.Registry" %>
 <%@ page import="org.wso2.registry.RegistryConstants" %>
@@ -115,7 +115,7 @@
 
     String queryTitle = "";
     String queryPath = "";
-    String[] queryParams = new String[]{};
+    String[] queryParams = new String[] { };
     QueryResults results = null;
 
     if (query != null) {
@@ -132,7 +132,7 @@
             queryTitle = (currentUser.equals(searchScope) ? "My" :
                     RegistryUtils.getFullName(request, searchScope) + "'s") + 
" mashups";
             queryPath = MashupConstants.MY_MASHUPS_QUERY_PATH;
-            queryParams = new String[]{searchScope};
+            queryParams = new String[] { searchScope };
 
         } else if (query.equalsIgnoreCase("mashups") && 
searchScope.equals("")) {
 
@@ -141,8 +141,9 @@
             queryPath = MashupConstants.CUSTOM_QUERY_PATH;
 
             // todo: suboptimal query.  Better would be to leave out clauses 
that don't apply
-            String[] params = new String[]{MashupConstants.IMPOSSIBLE_VALUE,
-                    MashupConstants.IMPOSSIBLE_VALUE, 
MashupConstants.IMPOSSIBLE_VALUE}; // prevent matches by default
+            String[] params = new String[] { MashupConstants.IMPOSSIBLE_VALUE,
+                    MashupConstants.IMPOSSIBLE_VALUE,
+                    MashupConstants.IMPOSSIBLE_VALUE }; // prevent matches by 
default
 
             if (includeTags) {
                 queryTitle += "tagged '" + searchFor + "' ";
@@ -174,9 +175,9 @@
             queryPath = MashupConstants.MY_CUSTOM_QUERY_PATH;
 
             // todo: suboptimal query.  Better would be to leave out clauses 
that don't apply
-            String[] params = new String[]{MashupConstants.IMPOSSIBLE_VALUE,
+            String[] params = new String[] { MashupConstants.IMPOSSIBLE_VALUE,
                     MashupConstants.IMPOSSIBLE_VALUE, 
MashupConstants.IMPOSSIBLE_VALUE,
-                    searchScope};
+                    searchScope };
             if (includeTags) {
                 queryTitle += "tagged '" + searchFor + "' ";
                 params[2] = searchFor;
@@ -211,9 +212,10 @@
             // Set up the predefined query for "[My] Highest Rated Mashups"
             queryPath = MashupConstants.MY_TOP_MASHUPS_QUERY_PATH;
             queryTitle = (currentUser.equals(searchScope) ? "My" :
-                    RegistryUtils.getFullName(request, searchScope) + "'s") + 
" highest rated mashups";
+                    RegistryUtils.getFullName(request, searchScope) + "'s") +
+                    " highest rated mashups";
 
-            queryParams = new String[]{searchScope};
+            queryParams = new String[] { searchScope };
 
         } else if (query.equalsIgnoreCase("comments") && 
searchScope.equals("")) {
 
@@ -222,7 +224,7 @@
             queryTitle = "Comments";
 
             String resourcePath = null;
-            queryParams = new String[] {"%" + searchFor + "%"};
+            queryParams = new String[] { "%" + searchFor + "%" };
 
         } else if (query.equalsIgnoreCase("comments")) {
 
@@ -232,7 +234,7 @@
                     RegistryUtils.getFullName(request, searchScope) + "'s") + 
" comments";
 
             String resourcePath = null;
-            queryParams = new String[] {"%" + searchFor + "%", searchScope};
+            queryParams = new String[] { "%" + searchFor + "%", searchScope };
 
         } else if (query.equalsIgnoreCase("activity")) {
 
@@ -242,7 +244,7 @@
                 queryTitle = "Recent ";
             } else {
                 queryTitle = (currentUser.equals(searchScope) ? "My" :
-                    RegistryUtils.getFullName(request, searchScope) + "'s") + 
" recent ";
+                        RegistryUtils.getFullName(request, searchScope) + 
"'s") + " recent ";
             }
 
             if (!activity.equalsIgnoreCase("all")) {
@@ -251,7 +253,9 @@
             queryTitle += " activity (" + paramPeriod + " days)";
 
             String resourcePath = null;
-            queryParams = new String[] {resourcePath, activity, searchScope == 
null || searchScope.equals("") ? null : searchScope, paramPeriod};
+            queryParams = new String[] { resourcePath, activity,
+                    searchScope == null || searchScope.equals("") ? null : 
searchScope,
+                    paramPeriod };
 
         } else {
             // Error condition
@@ -263,7 +267,7 @@
         }
 
         results = RegistryUtils.doQuery(registry, queryTitle, queryPath, 
queryParams,
-                MashupConstants.MAX_RESULTS_COUNT);
+                                        MashupConstants.MAX_RESULTS_COUNT);
     }
 
     if (format != null) {
@@ -278,9 +282,9 @@
         if (query == null) {
             queryTitle = "Everyone's Mashups";
             queryPath = MashupConstants.ALL_MASHUPS_QUERY_PATH;
-            queryParams = new String[]{};
+            queryParams = new String[] { };
             results = RegistryUtils.doQuery(registry, queryTitle, queryPath, 
queryParams,
-                    MashupConstants.MAX_RESULTS_COUNT);
+                                            MashupConstants.MAX_RESULTS_COUNT);
 
         }
 
@@ -303,9 +307,9 @@
             file += '?' + request.getQueryString();
         }
         URL reconstructedURL = new URL(request.getScheme(),
-                request.getServerName(),
-                request.getServerPort(),
-                file);
+                                       request.getServerName(),
+                                       request.getServerPort(),
+                                       file);
         feed.setLink(reconstructedURL.toString());
 
         if (results != null) {
@@ -353,7 +357,7 @@
         // disables the custom query submit button if no search phrase or 
search locations have been selected.
         function checkSubmit() {
             if ($('includetags').checked || $('includetitles').checked ||
-                  $('includedescriptions').checked) {
+                $('includedescriptions').checked) {
                 $('submit-mashup').disabled = false;
             } else {
                 $('submit-mashup').disabled = true;
@@ -417,6 +421,13 @@
             }
             $(kind).show();
         }
+
+        function showFaultDetails(elementIdSuffix) {
+            var textArea = document.getElementById("txt_" + elementIdSuffix);
+            var contentDiv = document.getElementById(elementIdSuffix);
+            contentDiv.innerHTML =
+            "<pre>" + textArea.value + "</pre>";
+        }
     </script>
 </head>
 
@@ -431,290 +442,307 @@
 <div id="showAdvancedSearch" <% if (!showAdvanced) { %>style="display:none"<% 
} %>>
 
 <div id="advancedSearch">
-    <div id="searchControls">
-        <ul class="searchType">
-            <li class="tab-heading">Search</li>
-            <li id="mashups-tab" class="<%
+<div id="searchControls">
+    <ul class="searchType">
+        <li class="tab-heading">Search</li>
+        <li id="mashups-tab" class="<%
                 if (query == null || query.equalsIgnoreCase("mashups")) {
                     %>this-<%
-                } %>tab"><a href="#" 
onclick="showSearch('searchMashups')">Mashups</a></li><li 
id="mashups-tab-right" class="<%
+                } %>tab"><a href="#" 
onclick="showSearch('searchMashups')">Mashups</a></li>
+        <li id="mashups-tab-right" class="<%
                 if (query == null || query.equalsIgnoreCase("mashups")) {
                     %>this-<%
                 } %>tab-right"><img src="images/blank.gif" width="8"/></li>
-            <li id="comments-tab" class="<%
+        <li id="comments-tab" class="<%
                 if (query != null && query.equalsIgnoreCase("comments")) {
                     %>this-<%
-                } %>tab"><a href="#" 
onclick="showSearch('searchComments')">Comments</a></li><li 
id="comments-tab-right" class="<%
+                } %>tab"><a href="#" 
onclick="showSearch('searchComments')">Comments</a></li>
+        <li id="comments-tab-right" class="<%
                 if (query != null && query.equalsIgnoreCase("comments")) {
                     %>this-<%
                 } %>tab-right"><img src="images/blank.gif" width="8"/></li>
-            <li id="activity-tab" class="<%
+        <li id="activity-tab" class="<%
                 if (query != null && query.equalsIgnoreCase("activity")) {
                     %>this-<%
-                } %>tab"><a href="#" 
onclick="showSearch('searchActivity')">Recent Activity</a></li><li 
id="activity-tab-right" class="<%
+                } %>tab"><a href="#" 
onclick="showSearch('searchActivity')">Recent Activity</a></li>
+        <li id="activity-tab-right" class="<%
                 if (query != null && query.equalsIgnoreCase("activity")) {
                     %>this-<% }
                 %>tab-right"><img src="images/blank.gif" width="8"/></li>
-            <li id="toprated-tab" class="<%
+        <li id="toprated-tab" class="<%
                 if (query != null && query.equalsIgnoreCase("toprated")) {
                     %>this-<%
-                } %>tab"><a href="#" 
onclick="showSearch('searchSpecial')">Special Queries</a></li><li 
id="toprated-tab-right" class="<%
+                } %>tab"><a href="#" 
onclick="showSearch('searchSpecial')">Special Queries</a></li>
+        <li id="toprated-tab-right" class="<%
                 if (query != null && query.equalsIgnoreCase("toprated")) {
                     %>this-<% }
                 %>tab-right"><img src="images/blank.gif" width="8"/></li>
-        </ul>
-    </div>
-    <div id="searchForms">
-    <table>
-        <tr id="searchMashups"
-            <% if (query != null && !query.equalsIgnoreCase("mashups")) { 
%>style="display:none"<% } %>
+    </ul>
+</div>
+<div id="searchForms">
+<table>
+<tr id="searchMashups"
+    <% if (query != null && !query.equalsIgnoreCase("mashups")) { 
%>style="display:none"<% } %>
         >
-            <form id="search-mashups" action="search.jsp" method="get">
-            <td>
-                <input type="hidden" name="query" value="mashups"/>
-                <select id="scope-mashups" name="scope">
-                    <option value=""
-                            onclick="$('user-mashups').hide()"
-                            <% if (searchScope == null || 
searchScope.equals("")) { %>selected="selected"<% } %>
-                    >
-                        Everyone's mashups
-                    </option>
-                    <% if (RegistryUtils.isLoggedIn(registry)) { %>
-                    <option value="<%=currentUser%>"
-                            onclick="$('user-mashups').hide()"
+    <form id="search-mashups" action="search.jsp" method="get">
+        <td>
+            <input type="hidden" name="query" value="mashups"/>
+            <select id="scope-mashups" name="scope">
+                <option value=""
+                        onclick="$('user-mashups').hide()"
+                        <% if (searchScope == null || searchScope.equals("")) 
{ %>selected="selected"<% } %>
+                        >
+                    Everyone's mashups
+                </option>
+                <% if (RegistryUtils.isLoggedIn(registry)) { %>
+                <option value="<%=currentUser%>"
+                        onclick="$('user-mashups').hide()"
                         <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
-                    >
-                        My mashups
-                    </option>
-                    <% } %>
-                    <option id="user-mashups-option"
-                            value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
-                            onclick="$('user-mashups').show()"
-                            <% if (searchScope != null && 
!searchScope.equals("") && !searchScope.equals(currentUser)) { 
%>selected="selected"<% } %>
-                    >
-                        Mashups by...
-                        <input type="text" id="user-mashups"
-                               onkeyup="$('user-mashups-option').value = 
$('user-mashups').value"
-                               <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"<% }
-                               else { %>value="<%=searchScope%>"<% } %>
-                        />
-                    </option>
-
-                </select>
-            </td>
-            <td>
-                <input type="text" name="for" size="50"
-                       value="<%= searchFor == null ? "" : searchFor %>"
-                />
-
-                <div class="search-include">
-                    Include:
-                    <input type="checkbox" name="tags" <% if (includeTags) {%>
-                           checked="checked"<% } %> value="true"
-                           id="includetags" onChange="checkSubmit()"/>
-                    Tags&nbsp;&nbsp;
-                    <input type="checkbox" name="titles" <% if (includeTitles) 
{%>
-                           checked="checked"<% } %>
-                           value="true" id="includetitles" 
onChange="checkSubmit()"/>
-                    Titles&nbsp;&nbsp;
-                    <input type="checkbox" name="descriptions" <% if 
(includeDescriptions) {%>
-                           checked="checked"<% } %> value="true" 
id="includedescriptions"
-                           onChange="checkSubmit()"/>
-                    Descriptions
-                </div>
-            </td>
-            <td>
-                <input id="submit-mashup" type="submit" value="Search"/>
-                <script>checkSubmit()</script>
-
-            </td>
-            </form>
-        </tr>
+                        >
+                    My mashups
+                </option>
+                <% } %>
+                <option id="user-mashups-option"
+                        value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
+                        onclick="$('user-mashups').show()"
+                        <% if (searchScope != null && !searchScope.equals("") 
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    Mashups by...
+                    <input type="text" id="user-mashups"
+                           onkeyup="$('user-mashups-option').value = 
$('user-mashups').value"
+                           <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
+                           <%
+                           }
+                         else {
+                           %>value="<%=searchScope%>"<% } %>
+                            />
+                </option>
+
+            </select>
+        </td>
+        <td>
+            <input type="text" name="for" size="50"
+                   value="<%= searchFor == null ? "" : searchFor %>"
+                    />
+
+            <div class="search-include">
+                Include:
+                <input type="checkbox" name="tags" <% if (includeTags) {%>
+                       checked="checked"<% } %> value="true"
+                       id="includetags" onChange="checkSubmit()"/>
+                Tags&nbsp;&nbsp;
+                <input type="checkbox" name="titles" <% if (includeTitles) {%>
+                       checked="checked"<% } %>
+                       value="true" id="includetitles" 
onChange="checkSubmit()"/>
+                Titles&nbsp;&nbsp;
+                <input type="checkbox" name="descriptions" <% if 
(includeDescriptions) {%>
+                       checked="checked"<% } %> value="true" 
id="includedescriptions"
+                       onChange="checkSubmit()"/>
+                Descriptions
+            </div>
+        </td>
+        <td>
+            <input id="submit-mashup" type="submit" value="Search"/>
+            <script>checkSubmit()</script>
+
+        </td>
+    </form>
+</tr>
 
-        <tr id="searchComments"
-            <% if (query == null || !query.equalsIgnoreCase("comments")) { 
%>style="display:none"<% } %>
+<tr id="searchComments"
+    <% if (query == null || !query.equalsIgnoreCase("comments")) { 
%>style="display:none"<% } %>
         >
-            <form id="search-comments" action="search.jsp" method="get">
-            <td>
-                <input type="hidden" name="query" value="comments"/>
-                <select id="scope-comments" name="scope">
-                    <option value=""
-                            onclick="$('user-comments').hide()"
-                            <% if (searchScope == null || 
searchScope.equals("")) { %>selected="selected"<% } %>
-                    >
-                        Everyone's comments
-                    </option>
-                    <% if (RegistryUtils.isLoggedIn(registry)) { %>
-                    <option value="<%=currentUser%>"
-                            onclick="$('user-comments').hide()"
-                            <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
-                    >
-                        My comments
-                    </option>
-                    <% } %>
-                    <option id="user-comments-option"
-                            value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
-                            onclick="$('user-comments').show()"
-                            <% if (searchScope != null && 
!searchScope.equals("") && !searchScope.equals(currentUser)) { 
%>selected="selected"<% } %>
-                    >
-                        Comments by...
-                        <input type="text" id="user-comments"
-                               onkeyup="$('user-comments-option').value = 
$('user-comments').value"
-                               <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"<% }
-                               else { %>value="<%=searchScope%>"<% } %>
-                        />
-                    </option>
-
-                </select>
-            </td>
-            <td>
-                <input type="text" name="for" value="<%= searchFor == null ? 
"" : searchFor %>" size="50"/>
-
-            </td>
-            <td>
-                <input id="submit-comments" type="submit" value="Search"/>
-            </td>
-            </form>
-        </tr>
+    <form id="search-comments" action="search.jsp" method="get">
+        <td>
+            <input type="hidden" name="query" value="comments"/>
+            <select id="scope-comments" name="scope">
+                <option value=""
+                        onclick="$('user-comments').hide()"
+                        <% if (searchScope == null || searchScope.equals("")) 
{ %>selected="selected"<% } %>
+                        >
+                    Everyone's comments
+                </option>
+                <% if (RegistryUtils.isLoggedIn(registry)) { %>
+                <option value="<%=currentUser%>"
+                        onclick="$('user-comments').hide()"
+                        <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    My comments
+                </option>
+                <% } %>
+                <option id="user-comments-option"
+                        value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
+                        onclick="$('user-comments').show()"
+                        <% if (searchScope != null && !searchScope.equals("") 
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    Comments by...
+                    <input type="text" id="user-comments"
+                           onkeyup="$('user-comments-option').value = 
$('user-comments').value"
+                           <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
+                           <%
+                           }
+                         else {
+                           %>value="<%=searchScope%>"<% } %>
+                            />
+                </option>
+
+            </select>
+        </td>
+        <td>
+            <input type="text" name="for" value="<%= searchFor == null ? "" : 
searchFor %>"
+                   size="50"/>
+
+        </td>
+        <td>
+            <input id="submit-comments" type="submit" value="Search"/>
+        </td>
+    </form>
+</tr>
 
-        <tr id="searchActivity"
-            <% if (query == null || !query.equalsIgnoreCase("activity")) { 
%>style="display:none"<% } %>
+<tr id="searchActivity"
+    <% if (query == null || !query.equalsIgnoreCase("activity")) { 
%>style="display:none"<% } %>
         >
-            <form id="search-activity" action="search.jsp" method="get">
-            <td>
-                <input type="hidden" name="query" value="activity"/>
-                <select id="scope-activity" name="scope">
-                    <option value=""
-                            onclick="$('user-activity').hide()"
-                            <% if (searchScope == null || 
searchScope.equals("")) { %>selected="selected"<% } %>
-                    >
-                        Everyone's recent activity
-                    </option>
-                    <% if (RegistryUtils.isLoggedIn(registry)) { %>
-                    <option value="<%=currentUser%>"
-                            onclick="$('user-activity').hide()"
-                            <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
-                    >
-                        My recent activity
-                    </option>
-                    <% } %>
-                    <option id="user-activity-option"
-                            value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
-                            onclick="$('user-activity').show()"
-                            <% if (searchScope != null && 
!searchScope.equals("") && !searchScope.equals(currentUser)) { 
%>selected="selected"<% } %>
-                    >
-                        Recent activity by...
-                        <input type="text" id="user-activity"
-                               onkeyup="$('user-activity-option').value = 
$('user-activity').value"
-                               <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"<% }
-                               else { %>value="<%=searchScope%>"<% } %>
-                        />
-                    </option>
-
-                </select>
-            </td>
-            <td>
-                <input type="hidden" id="period" name='period'
-                       value="<%=period%>"
-                />
-                <select >
-                    <option value=""
-                            onclick="$('period').value = 7"
-                            <% if (period < 10) { %>selected="selected"<% } %>>
-                        Last 7 days
-                    </option>
-                    <option value=""
-                            onclick="$('period').value = 30"
-                            <% if (period >= 10 && period < 45) { 
%>selected="selected"<% } %>>
-                        Last 30 days
-                    </option>
-                    <option value=""
-                            onclick="$('period').value = 180"
-                            <% if (period >= 45) { %>selected="selected"<% } 
%>>
-                        Last 6 months
-                    </option>
-
-                </select>
-                <select id="activity" name="activity">
-                    <option value="all"
-                            <% if (activity.equals("all")) { 
%>selected="selected"<% } %>>
-                        Any activity
-                    </option>
-                    <option value="mashup"
-                            <% if (activity.equalsIgnoreCase("mashup")) { 
%>selected="selected"<% } %>>
-                        Uploading and editing
-                    </option>
-                    <option value="comment"
-                            <% if (activity.equalsIgnoreCase("comment")) { 
%>selected="selected"<% } %>>
-                        Commenting
-                    </option>
-                    <option value="tag"
-                            <% if (activity.equalsIgnoreCase("tag")) { 
%>selected="selected"<% } %>>
-                        Tagging
-                    </option>
-                    <option value="rating"
-                            <% if (activity.equalsIgnoreCase("rating")) { 
%>selected="selected"<% } %>>
-                        Rating
-                    </option>
-                </select>
-            </td>
-            <td>
-                <input id="submit-activity" type="submit" value="Search"/>
-            </td>
-            </form>
-        </tr>
+    <form id="search-activity" action="search.jsp" method="get">
+        <td>
+            <input type="hidden" name="query" value="activity"/>
+            <select id="scope-activity" name="scope">
+                <option value=""
+                        onclick="$('user-activity').hide()"
+                        <% if (searchScope == null || searchScope.equals("")) 
{ %>selected="selected"<% } %>
+                        >
+                    Everyone's recent activity
+                </option>
+                <% if (RegistryUtils.isLoggedIn(registry)) { %>
+                <option value="<%=currentUser%>"
+                        onclick="$('user-activity').hide()"
+                        <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    My recent activity
+                </option>
+                <% } %>
+                <option id="user-activity-option"
+                        value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
+                        onclick="$('user-activity').show()"
+                        <% if (searchScope != null && !searchScope.equals("") 
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    Recent activity by...
+                    <input type="text" id="user-activity"
+                           onkeyup="$('user-activity-option').value = 
$('user-activity').value"
+                           <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
+                           <%
+                           }
+                         else {
+                           %>value="<%=searchScope%>"<% } %>
+                            />
+                </option>
+
+            </select>
+        </td>
+        <td>
+            <input type="hidden" id="period" name='period'
+                   value="<%=period%>"
+                    />
+            <select>
+                <option value=""
+                        onclick="$('period').value = 7"
+                        <% if (period < 10) { %>selected="selected"<% } %>>
+                    Last 7 days
+                </option>
+                <option value=""
+                        onclick="$('period').value = 30"
+                        <% if (period >= 10 && period < 45) { 
%>selected="selected"<% } %>>
+                    Last 30 days
+                </option>
+                <option value=""
+                        onclick="$('period').value = 180"
+                        <% if (period >= 45) { %>selected="selected"<% } %>>
+                    Last 6 months
+                </option>
+
+            </select>
+            <select id="activity" name="activity">
+                <option value="all"
+                        <% if (activity.equals("all")) { 
%>selected="selected"<% } %>>
+                    Any activity
+                </option>
+                <option value="mashup"
+                        <% if (activity.equalsIgnoreCase("mashup")) { 
%>selected="selected"<% } %>>
+                    Uploading and editing
+                </option>
+                <option value="comment"
+                        <% if (activity.equalsIgnoreCase("comment")) { 
%>selected="selected"<% } %>>
+                    Commenting
+                </option>
+                <option value="tag"
+                        <% if (activity.equalsIgnoreCase("tag")) { 
%>selected="selected"<% } %>>
+                    Tagging
+                </option>
+                <option value="rating"
+                        <% if (activity.equalsIgnoreCase("rating")) { 
%>selected="selected"<% } %>>
+                    Rating
+                </option>
+            </select>
+        </td>
+        <td>
+            <input id="submit-activity" type="submit" value="Search"/>
+        </td>
+    </form>
+</tr>
 
-        <tr id="searchSpecial"
-            <% if (query == null || !query.equalsIgnoreCase("toprated")) { 
%>style="display:none"<% } %>
+<tr id="searchSpecial"
+    <% if (query == null || !query.equalsIgnoreCase("toprated")) { 
%>style="display:none"<% } %>
         >
-            <form id="search-special" action="search.jsp" method="get">
-            <td>
-                <select name="query">
-                    <option value="toprated">Top Rated Mashups</option>
-                </select>
-            </td>
-            <td>
-                <select id="scope-special" name="scope">
-                    <option value=""
-                            onclick="$('user-special').hide()"
-                            <% if (searchScope == null || 
searchScope.equalsIgnoreCase("")) { %>selected="selected"<% } %>
-                    >
-                        by anyone
-                    </option>
-                    <% if (RegistryUtils.isLoggedIn(registry)) { %>
-                    <option value="<%=currentUser%>"
-                            onclick="$('user-special').hide()"
-                            <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
-                    >
-                        by me
-                    </option>
-                    <% } %>
-                    <option id="user-special-option"
-                            value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
-                            onclick="$('user-special').show()"
-                            <% if (searchScope != null && 
!searchScope.equals("") && !searchScope.equals(currentUser)) { 
%>selected="selected"<% } %>
-                    >
-                        by user ...<br/>
-                        <input type="text" id="user-special"
-                               onkeyup="$('user-special-option').value = 
$('user-special').value"
-                               <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"<% }
-                               else { %>value="<%=searchScope%>"<% } %>
-                        />
-                    </option>
-
-                </select>
-            </td>
-            <td>
-                <input id="submit-special" type="submit" value="Search"/>
-            </td>
-            </form>
-        </tr>
-
-        </table>
-    </div>
-    <div class="advanced-search-link">
-        <a href="search.jsp">start a new search...</a>
-    </div>
+    <form id="search-special" action="search.jsp" method="get">
+        <td>
+            <select name="query">
+                <option value="toprated">Top Rated Mashups</option>
+            </select>
+        </td>
+        <td>
+            <select id="scope-special" name="scope">
+                <option value=""
+                        onclick="$('user-special').hide()"
+                        <% if (searchScope == null || 
searchScope.equalsIgnoreCase("")) { %>selected="selected"<% } %>
+                        >
+                    by anyone
+                </option>
+                <% if (RegistryUtils.isLoggedIn(registry)) { %>
+                <option value="<%=currentUser%>"
+                        onclick="$('user-special').hide()"
+                        <% if (searchScope != null && 
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    by me
+                </option>
+                <% } %>
+                <option id="user-special-option"
+                        value="<% if (searchScope != null) 
{%><%=searchScope%><% } %>"
+                        onclick="$('user-special').show()"
+                        <% if (searchScope != null && !searchScope.equals("") 
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+                        >
+                    by user ...<br/>
+                    <input type="text" id="user-special"
+                           onkeyup="$('user-special-option').value = 
$('user-special').value"
+                           <% if (searchScope == null || 
searchScope.equals("") || searchScope.equals(currentUser)) { 
%>style="display:none"
+                           <%
+                           }
+                         else {
+                           %>value="<%=searchScope%>"<% } %>
+                            />
+                </option>
+
+            </select>
+        </td>
+        <td>
+            <input id="submit-special" type="submit" value="Search"/>
+        </td>
+    </form>
+</tr>
+
+</table>
+</div>
+<div class="advanced-search-link">
+    <a href="search.jsp">start a new search...</a>
+</div>
 
 </div>
 
@@ -736,7 +764,8 @@
     UserQuery[] queries = user.getQueries();
     for (int i = 0; i < queries.length; i++) {
         UserQuery q = queries[i];
-        if 
(pathString.equalsIgnoreCase(QueryParamUtils.paramsFromQuery(q.getQueryPath(), 
q.getQueryParameters()))) {
+        if (pathString.equalsIgnoreCase(
+                QueryParamUtils.paramsFromQuery(q.getQueryPath(), 
q.getQueryParameters()))) {
             isNewQuery = false;
             break;
         }
@@ -746,118 +775,148 @@
 %>
 <div class="heading"><%= queryTitle%>
     <span class="edit-link"><a
-            href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
queryParams)%>&format=rss" target="_blank"><img title="RSS feed" 
src="images/rss.png"/></a></span>
+            href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
queryParams)%>&format=rss"
+            target="_blank"><img title="RSS feed" 
src="images/rss.png"/></a></span>
     <span class="edit-link"><a
-            href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
queryParams)%>&format=atom" target="_blank"><img title="Atom feed" 
src="images/atom.png"/></a></span>
+            href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
queryParams)%>&format=atom"
+            target="_blank"><img title="Atom feed" 
src="images/atom.png"/></a></span>
 </div>
 <table border="0" cellpadding="3" cellspacing="0" class="data">
-    <tbody>
+<tbody>
 <% if (results.getResultsType().equals("activity")) { %>
-                    <td class="headers" width="12%" colspan="2">Date</td>
-                    <td class="headers">Activity</td>
+<td class="headers" width="12%" colspan="2">Date</td>
+<td class="headers">Activity</td>
 <% } else if (results.getResultsType().equals("comment")) { %>
-                    <td width="12%" class="headers">Date</td>
-                    <td width="12%" class="headers">By</td>
-                    <td width="12%" class="headers">On</td>
-                    <td class="headers">Comment</td>
+<td width="12%" class="headers">Date</td>
+<td width="12%" class="headers">By</td>
+<td width="12%" class="headers">On</td>
+<td class="headers">Comment</td>
 <% } else { %>
-                    <td width="12%" class="headers">Name</td>
-                    <td width="12%" class="headers">Author</td>
-                    <td class="headers">Description</td>
+<td width="12%" class="headers">Name</td>
+<td width="12%" class="headers">Author</td>
+<td class="headers">Description</td>
 <% } %>
-                    <td width="80" class="headers"></td>
+<td width="80" class="headers"></td>
 <%
-            Iterator iter = results.getResults().iterator();
-            int nextId = 0;
+    Iterator iter = results.getResults().iterator();
+    int nextId = 0;
 
-            if (!iter.hasNext()) { %>
+    if (!iter.hasNext()) { %>
 <tr class="noresults">
     <td valign="top" colspan="5">
         No results found.
     </td>
 </tr>
-<%          }
+<% }
 
-            while (iter.hasNext()) {
-                QueryResult result = (QueryResult) iter.next();
-                String id = "id" + nextId;
-                String path = result.getPath();
+    while (iter.hasNext()) {
+        QueryResult result = (QueryResult) iter.next();
+        String id = "id" + nextId;
+        String path = result.getPath();
 
-                if (results.getResultsType().equals("activity")) {
-                    String action = result.getAction();
+        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 valign="top">
-                <img src="images/ra.gif"/>
-            </td>
-            <td valign="top" width="100%" colspan="2">
-                <% 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("commented")) { %>on<% } %>
-                <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%></a>
-                <% 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>
+<tr class="results">
+    <td width="12%" valign="top">
+        <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%>
+        </nobr>
+    </td>
+    <td valign="top">
+        <img src="images/ra.gif"/>
+    </td>
+    <td valign="top" width="100%" colspan="2">
+        <% 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("commented")) { %>on<% } %>
+        <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%>
+        </a>
+        <% 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>
 
-    <%
-                } else if (results.getResultsType().equals("comment")) {
-    %>
-        <tr class="results">
-            <td width="12%" valign="top">
-                
<nobr><%=QueryParamUtils.friendlyDate(result.getDate())%></nobr>
-            </td>
-            <td nowrap>
-                 <a class="updatableName"
-                    
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
-                         result.getAuthor())%></a> (<%=result.getAuthor()%>)
-             </td>
-            <td nowrap>
-                <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%></a>
-            </td>
-            <td class="desc" colspan="2">
-                 <%=result.getContentString() %>
-             </td>
-         </tr>
-     <%
-                } else {
-     %>
-        <tr class="results">
-            <td width="12%" nowrap>
-                <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%></a>
-            </td>
-            <td nowrap>
-                <a class="updatableName"
-                   
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
-                        result.getAuthor())%></a> (<%=result.getAuthor()%>)
-            </td>
-            <td class="desc">
-                <%=result.getDescription() %>
-            </td>
-            <td nowrap>
-                <%@ include file="rating.jsp" %>
-            </td>
-        </tr>
-        <% }
+<%
+} else if (results.getResultsType().equals("comment")) {
+%>
+<tr class="results">
+    <td width="12%" valign="top">
+        <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%>
+        </nobr>
+    </td>
+    <td nowrap>
+        <a class="updatableName"
+           
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
+                                                                               
      result.getAuthor())%>
+        </a> (<%=result.getAuthor()%>)
+    </td>
+    <td nowrap>
+        <a href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
+        </a>
+    </td>
+    <td class="desc" colspan="2">
+        <%=result.getContentString() %>
+    </td>
+</tr>
+<%
+} else {
+%>
+<tr class="results">
+    <td width="12%" nowrap>
+        <a href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
+        </a>
+    </td>
+    <td nowrap>
+        <a class="updatableName"
+           
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
+                                                                               
      result.getAuthor())%>
+        </a> (<%=result.getAuthor()%>)
+    </td>
+    <td class="desc">
+        <div id="<%=result.getAuthor() + "_" + result.getName()%>">
+            <%
+                if (RegistryUtils.isFaultyMashup(registry, result.getPath())) {
+            %>
+            This mashup is faulty <a href="#"
+                                     
onclick="showFaultDetails('<%=result.getAuthor() + "_" + 
result.getName()%>');">details</a>
+            <textarea id="txt_<%=result.getAuthor() + "_" + result.getName()%>"
+                      style="height: 50px; width: 100%; display: 
none;"><%=result.getDescription()%>
+            </textarea>
+            <%
+            } else {
+            %>
+            <%=result.getDescription() %>
+            <%
+                }
+            %>
+        </div>
+    </td>
+    <td nowrap>
+        <%@ include file="rating.jsp" %>
+    </td>
+</tr>
+<% }
 
-            nextId++;
-        } %>
+    nextId++;
+} %>
 
-    </tbody>
+</tbody>
 </table>
 <br/>
 

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

Reply via email to