Guest User

Untitled

a guest
Jan 9th, 2015
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.64 KB | None | 0 0
  1.  
  2.  
  3. <%--
  4.  
  5. The contents of this file are subject to the license and copyright
  6. detailed in the LICENSE and NOTICE files at the root of the source
  7. tree and available online at
  8.  
  9. https://github.com/CILEA/dspace-cris/wiki/License
  10.  
  11. --%>
  12. <%@page import="org.apache.commons.lang.StringUtils"%>
  13. <%@page import="java.util.List"%>
  14. <%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
  15. <%@ page import="java.net.URLEncoder" %>
  16. <%@ page import="org.dspace.sort.SortOption" %>
  17. <%@ page import="java.util.Enumeration" %>
  18. <%@ page import="java.util.Set" %>
  19. <%@ page import="java.util.Map" %>
  20. <%@page import="org.dspace.eperson.EPerson"%>
  21. <%@ page import="org.dspace.content.Item" %>
  22. <%@page import="org.dspace.app.webui.cris.dto.ComponentInfoDTO"%>
  23. <%@page import="it.cilea.osd.jdyna.web.Box"%>
  24.  
  25. <%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
  26. <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
  27. <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  28. <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
  29. <%@ taglib uri="jdynatags" prefix="dyna"%>
  30. <c:set var="root"><%=request.getContextPath()%></c:set>
  31. <c:set var="info" value="${componentinfomap}" scope="page" />
  32. <%
  33.  
  34. Box holder = (Box)request.getAttribute("holder");
  35. ComponentInfoDTO info = ((Map<String, ComponentInfoDTO>)(request.getAttribute("componentinfomap"))).get(holder.getShortName());
  36. List<String[]> subLinks = (List<String[]>) request
  37. .getAttribute("activeTypes"+info.getRelationName());
  38.  
  39. if (info.getItems().length > 0) {
  40. %>
  41. <c:set var="info" value="<%= info %>" scope="request" />
  42. <div class="panel-group" id="${holder.shortName}">
  43. <div class="panel panel-default">
  44. <div class="panel-heading">
  45. <h4 class="panel-title">
  46. <a data-toggle="collapse" data-parent="#${holder.shortName}" href="#collapseOne${holder.shortName}">
  47. ${holder.title} <fmt:message
  48. key="jsp.layout.dspace.detail.fieldset-legend.component.boxtitle.${info[holder.shortName].type}"/>
  49. </a>
  50. <% if(subLinks!=null && subLinks.size()>1) {%>
  51. <div class="btn-group">
  52. <button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown">
  53. <fmt:message key="jsp.components.button.seealso"/> <span class="fa fa-caret-down"></span>
  54. </button>
  55. <ul class="dropdown-menu dropdown-menu-right" role="menu">
  56. <% for (String[] sub : subLinks ) { %>
  57. <%-- modificat --%><li><a href="<%=request.getAttribute("javax.servlet.forward.request_uri")%>?open=<%= sub[0] %>"><%= sub[1] %></a></li>
  58. <% } %>
  59. </ul>
  60. </div>
  61. <% } %>
  62. </h4>
  63. </div>
  64. <div id="collapseOne${holder.shortName}" class="panel-collapse collapse in">
  65. <div class="panel-body">
  66. <p>
  67.  
  68.  
  69. <!-- prepare pagination controls -->
  70. <%!
  71. //funció per a que les url contiguin be el context i no es perdin portant a altres llocs
  72. public String addTabContext(String url,HttpServletRequest request){
  73. int pos = url.indexOf("?open");
  74. if(pos > -1){
  75. String bagBegin = url.substring(0,pos);
  76. String bagEnd = url.substring(pos);
  77. return bagBegin + request.getAttribute("javax.servlet.forward.request_uri") + bagEnd;
  78. }
  79. else return url;
  80. }
  81. %>
  82. <%
  83. // create the URLs accessing the previous and next search result pages
  84. StringBuilder sb = new StringBuilder();
  85. sb.append("<div align=\"center\">");
  86. sb.append("Result pages:");
  87.  
  88. String prevURL = info.buildPrevURL();
  89. String nextURL = addTabContext(info.buildNextURL(),request); //modificat
  90.  
  91.  
  92. if (info.getPagefirst() != info.getPagecurrent()) {
  93. sb.append(" <a class=\"pagination\" href=\"");
  94. sb.append(prevURL);
  95. sb.append("\">previous</a>");
  96. };
  97.  
  98. for( int q = info.getPagefirst(); q <= info.getPagelast(); q++ )
  99. {
  100. String myLink = info.buildMyLink(q);
  101. sb.append(" " + addTabContext(myLink,request)); //modificat
  102. } // for
  103.  
  104. if (info.getPagetotal() > info.getPagecurrent()) {
  105. sb.append(" <a class=\"pagination\" href=\"");
  106. sb.append(nextURL);
  107. sb.append("\">next</a>");
  108. }
  109.  
  110. sb.append("</div>");
  111.  
  112. %>
  113.  
  114.  
  115. <div align="center" class="browse_range">
  116.  
  117. <p align="center"><fmt:message key="jsp.search.results.results">
  118. <fmt:param><%=info.getStart()+1%></fmt:param>
  119. <fmt:param><%=info.getStart()+info.getItems().length%></fmt:param>
  120. <fmt:param><%=info.getTotal()%></fmt:param>
  121. <fmt:param><%=(float)info.getSearchTime() / 1000%></fmt:param>
  122. </fmt:message></p>
  123.  
  124. </div>
  125. <%
  126. if (info.getPagetotal() > 1)
  127. {
  128. %>
  129. <%= sb %>
  130. <%
  131. }
  132. %>
  133.  
  134. <form id="sortform<%= info.getType() %>" action="#<%= info.getType() %>" method="get">
  135. <input id="sort_by<%= info.getType() %>" type="hidden" name="sort_by<%= info.getType() %>" value=""/>
  136. <input id="order<%= info.getType() %>" type="hidden" name="order<%= info.getType() %>" value="<%= info.getOrder() %>" />
  137. <input type="hidden" name="open" value="<%= info.getType() %>" />
  138. </form>
  139.  
  140. <dspace:itemlist items="<%= (Item[])info.getItems() %>" sortOption="<%= info.getSo() %>" authorLimit="<%= info.getEtAl() %>" order="<%= info.getOrder() %>"/>
  141.  
  142. <script type="text/javascript"><!--
  143. function sortBy(sort_by, order) {
  144. j('#sort_by<%= info.getType() %>').val(sort_by);
  145. j('#order<%= info.getType() %>').val(order);
  146. j('#sortform<%= info.getType() %>').submit();
  147. }
  148. --></script>
  149.  
  150. <%-- show pagination controls at bottom --%>
  151. <%
  152. if (info.getPagetotal() > 1)
  153. {
  154. %>
  155. <%= sb %>
  156. <%
  157. }
  158. %>
  159.  
  160.  
  161. </p>
  162. </div>
  163. </div>
  164. </div>
  165. </div>
  166.  
  167. <% } %>
Advertisement
Add Comment
Please, Sign In to add comment