menu.jspf revision 625d7e774c3d2fc1478d7748b618a88fcf5783a9
<%--
CDDL HEADER START
The contents of this file are subject to the terms of the
Common Development and Distribution License (the "License").
You may not use this file except in compliance with the License.
See LICENSE.txt included in this distribution for the specific
language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each
file and include the License file at LICENSE.txt.
If applicable, add the following below this CDDL HEADER, with the
fields enclosed by brackets "[]" replaced with your own identifying
information: Portions Copyright [yyyy] [name of copyright owner]
CDDL HEADER END
Copyright 2007 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
--%><%@ page import="org.opensolaris.opengrok.configuration.Project,
org.opensolaris.opengrok.web.Util,java.util.Iterator"%>
<% if (hasProjects) { %>
<script type="text/javascript" src="jquery-1.4.min.js"></script>
<%-- TODO Bug 11749
<script type="text/javascript" src="jquery.autocomplete-1.1.pack.js"></script>
<script type="text/javascript">/* <![CDATA[ */
var projects = [
<%
for (Project p : env.getProjects()) {
%>"<%=Util.formQuoteEscape(p.getDescription())%>",<%
}
%>
];
$().ready(function() {
$("#project").autocomplete(projects, {
minChars: 0,
multiple: true,
multipleSeparator: ",",
//mustMatch: true,
matchContains: "word",
max: 200,
cacheLength:20,
//autoFill: false,
formatItem: function(row, i, max) {
if (row!=null)
return i + "/" + max + ": " + row[0];
else return "";
},
formatMatch: function(row, i, max) {
if (row!=null)
return row[0]
else return "";
},
formatResult: function(row) {
if (row!=null)
return row[0];
else return "";
},
width: "300px"
});
});
/* ]]> */
</script>
--%>
<script type="text/javascript">/* <![CDATA[ */
function selectAllProjects() {
$("#project *").attr("selected","selected");
}
function invertAllProjects() {
$("#project *").each( function(){
if ( $(this).attr("selected") ) { $(this).removeAttr("selected") }
else { $(this).attr("selected","true"); }
}
);
}
function goFirstProject() {
var selected=$.map($('#project :selected'), function(e) { return $(e).text(); });window.location='xref/'+selected[0];
}
/* ]]> */
</script>
<%}%>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top"><br /> &nbsp;</td>
<td align="left" valign="middle">
<br/><form action="search" id="sbox">
<table cellpadding="2" border="0" cellspacing="0">
<tr><td align="right"> Full&nbsp;Search </td><td><input class="q" name="q" size="45" style="width: 300px" value="<%=Util.formQuoteEscape(q)%>"/></td>
<% if (hasProjects) { %>
<td rowspan="5" style="border-left:gray;border-left-width:thin;border-left-color:gray">
<!--<td align="right" valign="top"> -->
<table border="0">
<tbody>
<tr>
<td>in project(s): <span style="padding-left:60px;font-size:small"><a href="#" onclick="javascript:selectAllProjects();return false;">select all</a>&nbsp;|&nbsp;<a href="#" onclick="javascript:invertAllProjects();return false;">invert selection</a></span></td>
</tr>
<tr><td>
<select class="q" style="width: 300px" id="project" onkeyup="javascript:if(event.keyCode=='13') { goFirstProject(); }" ondblclick="javascript:goFirstProject();" name="project" multiple="multiple" size="<%=Math.min(6, env.getProjects().size())%>">
<%
for (Project p : env.getProjects()) {
//TODO below "selected" has no effect if one refreshes the page with F5
%><option value="<%=Util.formQuoteEscape(p.getDescription())%>"<%
if (project != null) {
String projectPath = p.getDescription();
for (Iterator it = project.iterator(); it.hasNext();) {
if (it.next().equals(projectPath)) {
%> selected="selected"<%
}
}
}
%>><%=Util.formQuoteEscape(p.getDescription())%></option>
<%
}
%></select></td>
</tr>
</tbody>
</table></td><%
}%>
</tr>
<tr><td align="right"> Definition </td><td><input class="q" name="defs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(defs)%>"/></td></tr>
<tr><td align="right"> Symbol </td><td><input class="q" name="refs" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(refs)%>"/></td></tr>
<tr><td align="right"> File&nbsp;Path </td><td><input class="q" name="path" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(path)%>"/></td></tr>
<tr><td align="right"> History </td><td><input class="q" name="hist" size="25" style="width: 300px" value="<%=Util.formQuoteEscape(hist)%>"/></td></tr>
<%-- TODO Bug 11749
<% if (hasProjects) { %>
<tr><td align="right"> Project(s) </td><td>
<table cellspacing="0" cellpadding="0" border="0" class="combo_table" id="combotable">
<tbody><tr><td class="combo_td1">
<div class="combo_div4" style="background: transparent url(<%=httpHeaderContext%>/<%=laf%>/img/transparent_pixel.gif) repeat scroll 0% 0%;">
<input class="combo_input1 combo_input" id="project" name="project" size="25" value="<%=Util.formQuoteEscape(sproject.toString())%>"/>
</div></td><td valign="top" align="left" class="combo_td2" id="combotable_button">
<a onclick='javascript:$("#project").click();$("#project").click();'/>
<img style="display: none;" alt="" src="<%=httpHeaderContext%>/<%=laf%>/img/button2.png"/>
</td></tr></tbody></table>
</td></tr>
<%}%>
--%>
<tr><td colspan="2" align="center"> &nbsp; <input class="submit" type="submit" value="Search"/> |
<input class="submit" onclick="javascript:var sbox=document.getElementById('sbox'); sbox.q.value='';sbox.defs.value='';sbox.refs.value='';sbox.path.value='';sbox.hist.value='';sbox.project.value='';" type="button" value=" Clear "/>
| <a href="help.jsp">Help</a></td></tr>
</table>
</form>
</td>
<td valign="top" align="right"></td></tr>
</table>
<%-- TODO Bug 11749
<script type="text/javascript">/* <![CDATA[ */
var p=document.getElementById('project');
p.setAttribute("autocomplete", "off");
/* ]]> */
</script>
--%>