Newer
Older
TalkjaSolr / web / WEB-INF / jsp / _pagination.jsp
@haya4 haya4 on 22 Apr 2022 1 KB restore
  1. <%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
  2. <div id="page">
  3. <%
  4. String p_head = "|&lt;&lt;先頭ページへ";
  5. String p_prev = "&lt;前へ";
  6. String p_next = "次へ&gt;";
  7. String p_tail = "末尾ページへ&gt;&gt;|";
  8.  
  9. int wsiz = 10;
  10. int w1 = 5;
  11. int w2 = 5;
  12.  
  13. int pcnt = (int)(found / rows + ( ( found % rows ) == 0 ? 0 : 1 ));
  14. int cpag = (int)(start / rows + 1);
  15. int wbgn = cpag - w1;
  16. int wend = cpag + w2;
  17. if( wbgn < 1 ){
  18. wbgn = 1;
  19. wend = wbgn + wsiz;
  20. if( wend > pcnt + 1 ){
  21. wend = pcnt + 1;
  22. }
  23. }
  24. if( wend > pcnt + 1 ){
  25. wend = pcnt + 1;
  26. wbgn = wend - wsiz;
  27. if( wbgn < 1 ){
  28. wbgn = 1;
  29. }
  30. }
  31. %>
  32. <% if( pcnt > 1 ){ %>
  33. <strong>Page</strong>
  34. <% if( cpag > 1 ){ %>
  35. <a href="./index.html<%=SearchUtil.getLinkStr(query,fq, null, 0)%>"><%=p_head%></a>&nbsp;&nbsp;&nbsp;
  36. <a href="./index.html<%=SearchUtil.getLinkStr(query,fq, null, ((cpag-2)*rows))%>"><%=p_prev%></a>&nbsp;&nbsp;&nbsp;
  37. <% } %>
  38. &nbsp;
  39. <% for(int i=wbgn;i<wend;i++){ %>
  40. <% if(cpag == i){ %>
  41. <%=i %>&nbsp;&nbsp;&nbsp;
  42. <% }else{ %>
  43. <a href="./index.html<%=SearchUtil.getLinkStr(query,fq, null, ((i-1)*rows))%>"><%=i %></a>&nbsp;&nbsp;&nbsp;
  44. <% } %>
  45. <% } %>
  46. &nbsp;
  47. <% if( cpag < pcnt ){ %>
  48. <a href="./index.html<%=SearchUtil.getLinkStr(query,fq, null, (cpag*rows))%>"><%=p_next%></a>&nbsp;&nbsp;&nbsp;
  49. <a href="./index.html<%=SearchUtil.getLinkStr(query,fq, null, ((pcnt-1)*rows))%>"><%=p_tail%></a>&nbsp;&nbsp;&nbsp;
  50. <% } %>
  51. <% } %>
  52. </div>
  53.