%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
<%@ page isThreadSafe = "false" %>
<%@ page import="java.util.*,java.lang.String.*" %>
<%
String editFormStr = (String)request.getAttribute("editform");
String editFormHeadStr = editFormStr.substring(0,editFormStr.length()-4)+".head.jsp";
%>
<%
String headerStr = (String)request.getAttribute("header");
if ( headerStr == null || (!headerStr.equalsIgnoreCase("noheader")) ) { %>
<% } %>
<%
int rows = 0;
String minEditRoleStr = (String)request.getAttribute("min_edit_role");
String firstValue = "null";
Integer columnCount = (Integer)request.getAttribute("columncount");
rows = columnCount.intValue();
String clickSortStr = (String)request.getAttribute("clicksort");
if ( rows > 0 && results.size() > rows ) { // avoid divide by zero error in next statement
String suppressStr = null;
int columns = results.size() / rows;
if ( ( suppressStr = (String)request.getAttribute("suppressquery")) == null ) { // only inserted into request if true %>
<%= columns - 1 %> results were retrieved in <%= rows %> rows for query "<%=request.getAttribute("querystring")%>".
<% }
if ( clickSortStr != null && clickSortStr.equals("true")) {
if ( columns > 2 ) { %>
Click on the row header to sort columns by that row.
<% }
} %>
<% String[] resultsArray = new String[results.size()]; // see Core Java Vol. 1 p.216
results.toArray( resultsArray );
firstValue = resultsArray[ rows ];
request.setAttribute("firstvalue",firstValue);
//secondValue= resultsArray[ rows + 1 ];
String classString = "";
boolean[] postQHeaderCols = new boolean[ columns ];
for ( int eachcol=0; eachcol < columns; eachcol++ ) {
postQHeaderCols[ eachcol ] = false;
}
for ( int thisrow = 0; thisrow < rows; thisrow++ ) {
//int currentPostQCol = 0;
boolean dropRow = false;
for ( int thiscol = 0; thiscol < columns; thiscol++ ) {
String thisResult= resultsArray[ (rows * thiscol) + thisrow ];
if ( thisResult.equals("+")) { /* occurs all in first row, so postQHeaderCols should be correctly initialized */
classString = "postheaderright";
postQHeaderCols[ thiscol ] = true;
//++currentPostQCol;
thisResult=" ";
} else if ( thisResult.indexOf("@@")== 0) {
classString="postheadercenter";
thisResult ="query values"; //leave as follows for diagnostics: thisResult.substring(2);
thisResult = thisResult.substring(2);
} else {
if ( postQHeaderCols[ thiscol ] == true )
classString = "postheaderright";
else if ( thiscol == 1 && thisrow < 2 )
classString = "rowbold";
else
classString = "row";
if ( thisResult.equals(""))
thisResult=" ";
}
if ( thiscol == 0 ) { // 1st column of new row
if ( thisrow > 0 ) { // first must close prior row %>
<% if (thisResult.equals("XX")) {
dropRow = true;
} %>
<% } else { %>
<%
} else {
System.out.println("No results reported when " + rows + " rows and a result array size of " + results.size()); %>
No results retrieved for query "<%=request.getAttribute("querystring")%>".
<% Iterator errorIter = results.iterator();
while ( errorIter.hasNext()) {
String errorResult = (String)errorIter.next(); %>
Error returned: <%= errorResult%>
<% }
} %>