home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2003 July
/
CMCD0703.ISO
/
Software
/
Freeware
/
Programare
/
bugzero
/
jsp
/
_issuelist.jspf
< prev
next >
Wrap
Text File
|
2003-06-09
|
5KB
|
145 lines
<% if (issueList.length == 0) {
if ("queryresult.jsp".equals(parent)) { %>
<dd><b><%=MessageCode.get("jsp.no_query_result")%></b>
<% } else if ("home.jsp".equals(parent)) { %>
<dd><b><%=MessageCode.get("jsp.no_active_issue")%></b>
<% }
return;
} %>
<%
if (startIndex > issueList.length || startIndex < 0)
startIndex = 0;
int endIndex = startIndex + showNumbers;
if (endIndex > issueList.length)
endIndex = issueList.length;
%>
<%
String projectId = person.getProject();
Project conf = Project.getInstance(projectId);
String sortField = (String)session.getAttribute("sort_field");
String exportType = null;
DateTime dateTime = (DateTime)session.getAttribute("datetime");
%>
<form name="sort_form">
<table cellspacing=2 cellpadding=2 width=100% border=0>
<tr>
<td><b>
<% if ("queryresult.jsp".equals(parent)) {
exportType = "2";
%>
<%=label.get("query_result", projectId)%>
<% } else if ("home.jsp".equals(parent)) {
exportType = "1";
%>
<%=label.get("my_favorites", projectId)%>
<%} %>
</b> (<%=dateTime.localTime()%>)
</td><td align=right>
<font color="#000000"><b><%=label.get("sort_order_label")%></b></font>
<select name="sort"
style="font-size:14px;font-face:arial;"
onChange="location.href='<%=contextPath%>/servlet/sorting?parent=<%=parent%>&sort_field='+sort.options[sort.selectedIndex].value;">
<%=ListMaker.makeOptionList(label, projectId, conf.sortFields(), sortField) %>
</select>
<a href="<%=contextPath%>/servlet/export/issueList.csv?type=<%=exportType%>" title="Export to CSV"><img src="img/excel.gif" border=0></a>
</td>
</tr></table>
<table cellspacing=1 cellpadding=3 width=100% border=0>
<tr bgcolor="#b3c3db">
<td><%=label.get("issue_id", projectId)%></td>
<% for (int c=0; c<showColumns.length; c++) { %>
<td><%=label.get(showColumns[c], projectId)%></td>
<% } %>
</tr>
<% for (int i=startIndex; i<endIndex; i++) {
int id = issueList[i].getId();
%>
<tr bgcolor="#efefef">
<td><a href="edit.jsp?issueId=<%=id%>"><%=id%></a></td>
<% for (int c=0; c<showColumns.length; c++) {
String field_name = showColumns[c];
String field_value = null;
if ("last_modified".equals(field_name)) {
field_value = dateTime.localTime(issueList[i].getLastModified());
} else if ("arrived_date".equals(field_name)) {
field_value = dateTime.localTime(issueList[i].getArrivedDate());
} else if ("closed_date".equals(field_name)) {
long t = issueList[i].getClosedDate();
if (t == 0) {
field_value = "N/A";
} else {
field_value = dateTime.localTime(t);
}
} else if ("issue_description".equals(field_name)
|| "issue_response".equals(field_name) ) {
field_value = HtmlParser.toHtml(issueList[i].get(field_name));
} else {
field_value = HtmlParser.escapeTag(issueList[i].get(field_name));
}
%>
<td><%=field_value%></td>
<% } %>
</tr>
<% } %>
</table>
<table cellspacing=0 cellpadding=2 width=100% border=0>
<tr bgcolor="b3c3db"><td>
<font color="#000000">
<%=label.get("total")%> <%=issueList.length%> | <%=startIndex+1%>-<%=endIndex%> <%=label.get("displayed")%>
</font>
</td><td align=right>
<% int showPages = 10; %>
<% if (startIndex>0) {
int prev = startIndex-showNumbers;
if (prev < 0) prev = 0;
%>
<a href="<%=parent%>?startIndex=<%=prev%>">
<font color="#000000"><%=label.get("previous")%></font></a>
<% } %>
<%
int currentPage = startIndex/showNumbers;
if ( (startIndex-showNumbers*currentPage) > 1) currentPage++;
currentPage++;
int totalPages = currentPage + (issueList.length - startIndex - 1)/showNumbers;
int startPage = currentPage - showPages/2;
if ( startPage> (totalPages - showPages + 1) ) {
startPage = totalPages - showPages + 1;
}
if (startPage < 1) {
startPage = 1;
}
int endPage = startPage + showPages - 1;
if (endPage > totalPages) {
endPage = totalPages;
}
if (totalPages > 1) {
for (int i=startPage; i<=endPage; i++) {
int pageIndex = startIndex + showNumbers*(i - currentPage);
if (pageIndex < 0) {
pageIndex = 0;
} else if (pageIndex > issueList.length) {
pageIndex = issueList.length;
}
%>
<% if (i != currentPage) { %>
<a href="<%=parent%>?startIndex=<%=pageIndex%>">
<font color="#000000"><%=i%></font></a>
<% } else {%>
<font color="#000000"><%=i%></font>
<% } %>
<%} }%>
<% if (endIndex<issueList.length) {
int next = issueList.length - endIndex;
if (next > showNumbers) next = showNumbers;
%>
<a href="<%=parent%>?startIndex=<%=endIndex%>">
<font color="#000000"><%=label.get("next")%></font></a>
<% } %>
</td></tr>
</table>
</form>