Author: channa
Date: Tue Mar 25 01:56:13 2008
New Revision: 15070
Log:
MASHUP-708. Auto suggest extended to all user name fields in search
page.
Modified:
trunk/mashup/java/modules/www/search.jsp
Modified: trunk/mashup/java/modules/www/search.jsp
==============================================================================
--- trunk/mashup/java/modules/www/search.jsp (original)
+++ trunk/mashup/java/modules/www/search.jsp Tue Mar 25 01:56:13 2008
@@ -121,7 +121,7 @@
boolean isFeed = (format != null) &&
(format.toString().equalsIgnoreCase("rss") ||
format.toString().equalsIgnoreCase("atom"));
-
+
String queryTitle = "";
String queryPath = "";
String[] queryParams = new String[] { };
@@ -415,6 +415,7 @@
<script language="javascript" src="js/services.js"
type="text/javascript"></script>
<script type="text/javascript">
userLoggedOn = <%=RegistryUtils.isLoggedIn(registry) %>;
+ var autoSuggestField;
// disables the custom query submit button if no search phrase or
search locations have been selected.
function checkSubmit() {
@@ -484,8 +485,9 @@
$(kind).show();
}
- function getUserNames(userName) {
- var namePrefix = document.getElementById("user-mashups").value;
+ function getUserNames(targetField) {
+ autoSuggestField = targetField;
+ var namePrefix = document.getElementById(targetField).value;
if (namePrefix.length > 0) {
wso2.mashup.services.getUserNames(namePrefix,
getUserNamesCallback);
@@ -504,7 +506,7 @@
this.req.responseXML.getElementsByTagName("return")[0];
}
- var nameList = document.getElementById("nameList");
+ var nameList = document.getElementById(autoSuggestField +
"-nameList");
nameList.innerHTML = "";
var node = xmlBodyContent;
@@ -516,8 +518,8 @@
}
function assignSelected(userName) {
- document.getElementById("user-mashups").value = userName;
- document.getElementById("user-mashups-option").value = userName;
+ document.getElementById(autoSuggestField).value = userName;
+ document.getElementById(autoSuggestField + "-option").value =
userName;
}
</script>
</head>
@@ -607,11 +609,11 @@
<td valign="top">
<input type="text" id="user-mashups" autocomplete="off"
onkeyup="$('user-mashups-option').value =
$('user-mashups').value"
- onkeyDown="getUserNames(this)"
+ onkeyDown="getUserNames('user-mashups')"
<% if (searchScope == null ||
searchScope.equals("") || searchScope.equals(currentUser)) {
%>style="display:none"
<% } else { %>value="<%=searchScope%>"<% } %>
/>
- <div align="left" id="nameList"
class="autosuggest"></div>
+ <div align="left" id="user-mashups-nameList"
class="autosuggest"></div>
</td>
</tr>
</table>
@@ -651,37 +653,49 @@
>
<form id="search-comments" action="search.jsp" method="get">
<td>
- <input type="hidden" name="query" value="comments"/>
- <select id="scope-comments" name="scope" onchange="if
($('user-comments-option').selected) $('user-comments').show(); else
$('user-comments').hide();">
- <option value=""
- <% if (searchScope == null || searchScope.equals(""))
{ %>selected="selected"<% } %>
- >
- Everyone's comments
- </option>
- <% if (RegistryUtils.isLoggedIn(registry)) { %>
- <option value="<%=currentUser%>"
- <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- My comments
- </option>
- <% } %>
- <option id="user-comments-option"
- value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
- <% if (searchScope != null && !searchScope.equals("")
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- Comments by...
- </option>
- </select>
- <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%>"<% } %>
- />
+ <table style="margin-top:-3px;">
+ <tr>
+ <td valign="top">
+ <input type="hidden" name="query" value="comments"/>
+ <select id="scope-comments" name="scope"
+ onchange="if
($('user-comments-option').selected) $('user-comments').show(); else
$('user-comments').hide();">
+ <option value=""
+ <% if (searchScope == null ||
searchScope.equals("")) { %>selected="selected"<% } %>
+ >
+ Everyone's comments
+ </option>
+ <% if (RegistryUtils.isLoggedIn(registry)) { %>
+ <option value="<%=currentUser%>"
+ <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+ >
+ My comments
+ </option>
+ <% } %>
+ <option id="user-comments-option"
+ value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
+ <% if (searchScope != null &&
!searchScope.equals("") && !searchScope.equals(currentUser)) {
%>selected="selected"<% } %>
+ >
+ Comments by...
+ </option>
+ </select>
+ </td>
+ <td valign="top">
+ <input type="text" id="user-comments"
autocomplete="off"
+ onkeyup="$('user-comments-option').value =
$('user-comments').value"
+ onkeyDown="getUserNames('user-comments')"
+ <% if (searchScope == null ||
searchScope.equals("") || searchScope.equals(currentUser)) {
%>style="display:none"
+ <% } else { %>value="<%=searchScope%>"<% } %>
+ />
+
+ <div align="left" id="user-comments-nameList"
class="autosuggest"></div>
+ </td>
+ </tr>
+ </table>
</td>
<td>
<input id="searchComments_for" type="text" name="for" size="50"
value="<%= searchFor == null ? "(all comments)" : searchFor
%>"
- onfocus="prepareInput(event)"
onblur="restoreInput(event,'(all comments)')" class="emptyfield" />
+ onfocus="prepareInput(event)"
onblur="restoreInput(event,'(all comments)')" class="emptyfield"/>
<script type="text/javascript">initInput('searchComments_for',
'(all comments)');</script>
</td>
<td>
@@ -695,32 +709,44 @@
>
<form id="search-activity" action="search.jsp" method="get">
<td>
- <input type="hidden" name="query" value="activity"/>
- <select id="scope-activity" name="scope" onchange="if
($('user-activity-option').selected) $('user-activity').show(); else
$('user-activity').hide();">
- <option value=""
- <% if (searchScope == null || searchScope.equals(""))
{ %>selected="selected"<% } %>
- >
- Everyone's recent activity
- </option>
- <% if (RegistryUtils.isLoggedIn(registry)) { %>
- <option value="<%=currentUser%>"
- <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- My recent activity
- </option>
- <% } %>
- <option id="user-activity-option"
- value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
- <% if (searchScope != null && !searchScope.equals("")
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- Recent activity by...
- </option>
- </select>
- <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%>"<% } %>
- />
+ <table style="margin-top:-3px;">
+ <tr>
+ <td valign="top">
+ <input type="hidden" name="query" value="activity"/>
+ <select id="scope-activity" name="scope"
+ onchange="if
($('user-activity-option').selected) $('user-activity').show(); else
$('user-activity').hide();">
+ <option value=""
+ <% if (searchScope == null ||
searchScope.equals("")) { %>selected="selected"<% } %>
+ >
+ Everyone's recent activity
+ </option>
+ <% if (RegistryUtils.isLoggedIn(registry)) { %>
+ <option value="<%=currentUser%>"
+ <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+ >
+ My recent activity
+ </option>
+ <% } %>
+ <option id="user-activity-option"
+ value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
+ <% if (searchScope != null &&
!searchScope.equals("") && !searchScope.equals(currentUser)) {
%>selected="selected"<% } %>
+ >
+ Recent activity by...
+ </option>
+ </select>
+ </td>
+ <td valign="top">
+ <input type="text" id="user-activity"
autocomplete="off"
+ onkeyup="$('user-activity-option').value =
$('user-activity').value"
+ onkeyDown="getUserNames('user-activity')"
+ <% if (searchScope == null ||
searchScope.equals("") || searchScope.equals(currentUser)) {
%>style="display:none"
+ <% } else { %>value="<%=searchScope%>"<% } %>
+ />
+
+ <div align="left" id="user-activity-nameList"
class="autosuggest"></div>
+ </td>
+ </tr>
+ </table>
</td>
<td>
<select id="period" name="period">
@@ -773,31 +799,43 @@
</select>
</td>
<td>
- <select id="scope-special" name="scope" onchange="if
($('user-special-option').selected) $('user-special').show(); else
$('user-special').hide();">
- <option value=""
- <% if (searchScope == null ||
searchScope.equalsIgnoreCase("")) { %>selected="selected"<% } %>
- >
- by anyone
- </option>
- <% if (RegistryUtils.isLoggedIn(registry)) { %>
- <option value="<%=currentUser%>"
- <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- by me
- </option>
- <% } %>
- <option id="user-special-option"
- value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
- <% if (searchScope != null && !searchScope.equals("")
&& !searchScope.equals(currentUser)) { %>selected="selected"<% } %>
- >
- by user ...<br/>
- </option>
- </select>
- <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%>"<% } %>
- />
+ <table style="margin-top:-3px;">
+ <tr>
+ <td valign="top">
+ <select id="scope-special" name="scope"
+ onchange="if
($('user-special-option').selected) $('user-special').show(); else
$('user-special').hide();">
+ <option value=""
+ <% if (searchScope == null ||
searchScope.equalsIgnoreCase("")) { %>selected="selected"<% } %>
+ >
+ by anyone
+ </option>
+ <% if (RegistryUtils.isLoggedIn(registry)) { %>
+ <option value="<%=currentUser%>"
+ <% if (searchScope != null &&
searchScope.equals(currentUser)) { %>selected="selected"<% } %>
+ >
+ by me
+ </option>
+ <% } %>
+ <option id="user-special-option"
+ value="<% if (searchScope != null)
{%><%=searchScope%><% } %>"
+ <% if (searchScope != null &&
!searchScope.equals("") && !searchScope.equals(currentUser)) {
%>selected="selected"<% } %>
+ >
+ by user ...<br/>
+ </option>
+ </select>
+ </td>
+ <td valign="top">
+ <input type="text" id="user-special" autocomplete="off"
+ onkeyup="$('user-special-option').value =
$('user-special').value"
+ onkeyDown="getUserNames('user-special')"
+ <% if (searchScope == null ||
searchScope.equals("") || searchScope.equals(currentUser)) {
%>style="display:none"
+ <% } else { %>value="<%=searchScope%>"<% } %>
+ />
+
+ <div align="left" id="user-special-nameList"
class="autosuggest"></div>
+ </td>
+ </tr>
+ </table>
</td>
<td>
<input id="submit-special" type="submit" value="Search"/>
@@ -950,7 +988,7 @@
if (mashupName.contains(";")) {
mashupName = mashupName.substring(0, mashupName.indexOf(";"));
}
-
+
%>
<tr class="results">
<td width="12%" valign="top">
_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev