forked from DSpace/DSpace
-
Notifications
You must be signed in to change notification settings - Fork 61
/
collection-home.jsp
421 lines (378 loc) · 15.6 KB
/
collection-home.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<%--
The contents of this file are subject to the license and copyright
detailed in the LICENSE and NOTICE files at the root of the source
tree and available online at
http://www.dspace.org/license/
--%>
<%--
- Collection home JSP
-
- Attributes required:
- collection - Collection to render home page for
- community - Community this collection is in
- last.submitted.titles - String[], titles of recent submissions
- last.submitted.urls - String[], corresponding URLs
- logged.in - Boolean, true if a user is logged in
- subscribed - Boolean, true if user is subscribed to this collection
- admin_button - Boolean, show admin 'edit' button
- editor_button - Boolean, show collection editor (edit submitters, item mapping) buttons
- show.items - Boolean, show item list
- browse.info - BrowseInfo, item list
--%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.dspace.org/dspace-tags.tld" prefix="dspace" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@page import="org.dspace.app.webui.servlet.MyDSpaceServlet"%>
<%@ page import="org.dspace.app.webui.components.RecentSubmissions" %>
<%@page import="org.dspace.discovery.IGlobalSearchResult"%>
<%@ page import="org.dspace.app.webui.servlet.admin.EditCommunitiesServlet" %>
<%@ page import="org.dspace.app.webui.util.UIUtil" %>
<%@ page import="org.dspace.browse.BrowseIndex" %>
<%@ page import="org.dspace.browse.BrowseInfo" %>
<%@ page import="org.dspace.browse.ItemCounter"%>
<%@ page import="org.dspace.content.*"%>
<%@ page import="org.dspace.core.ConfigurationManager"%>
<%@ page import="org.dspace.core.Context" %>
<%@ page import="org.dspace.core.Utils" %>
<%@ page import="org.dspace.eperson.Group" %>
<%@ page import="javax.servlet.jsp.jstl.fmt.LocaleSupport" %>
<%@ page import="java.net.URLEncoder" %>
<%
// Retrieve attributes
Collection collection = (Collection) request.getAttribute("collection");
Community community = (Community) request.getAttribute("community");
Group submitters = (Group) request.getAttribute("submitters");
RecentSubmissions rs = (RecentSubmissions) request.getAttribute("recently.submitted");
boolean loggedIn =
((Boolean) request.getAttribute("logged.in")).booleanValue();
boolean subscribed =
((Boolean) request.getAttribute("subscribed")).booleanValue();
Boolean admin_b = (Boolean)request.getAttribute("admin_button");
boolean admin_button = (admin_b == null ? false : admin_b.booleanValue());
Boolean editor_b = (Boolean)request.getAttribute("editor_button");
boolean editor_button = (editor_b == null ? false : editor_b.booleanValue());
Boolean submit_b = (Boolean)request.getAttribute("can_submit_button");
boolean submit_button = (submit_b == null ? false : submit_b.booleanValue());
// get the browse indices
BrowseIndex[] bis = BrowseIndex.getBrowseCollectionIndices();
// Put the metadata values into guaranteed non-null variables
String name = collection.getMetadata("name");
String intro = collection.getMetadata("introductory_text");
if (intro == null)
{
intro = "";
}
String copyright = collection.getMetadata("copyright_text");
if (copyright == null)
{
copyright = "";
}
String sidebar = collection.getMetadata("side_bar_text");
if(sidebar == null)
{
sidebar = "";
}
String communityName = community.getMetadata("name");
String communityLink = "/handle/" + community.getHandle();
Bitstream logo = collection.getLogo();
boolean feedEnabled = ConfigurationManager.getBooleanProperty("webui.feed.enable");
String feedData = "NONE";
if (feedEnabled)
{
feedData = "coll:" + ConfigurationManager.getProperty("webui.feed.formats");
}
ItemCounter ic = new ItemCounter(UIUtil.obtainContext(request));
Boolean showItems = (Boolean)request.getAttribute("show.items");
boolean show_items = showItems != null ? showItems.booleanValue() : false;
String formaction = request.getContextPath() + "/handle/" + collection.getHandle();
%>
<script type="text/javascript">
function sortBy(idx, ord)
{
jQuery("#ssort_by").val(idx);
jQuery("#sorder").val(ord);
jQuery("#sortform").submit();
}
</script>
<dspace:layout locbar="commLink" title="<%= name %>" feedData="<%= feedData %>">
<div class="well">
<div class="row"><div class="col-md-8"><h2><%= name %>
<%
if(ConfigurationManager.getBooleanProperty("webui.strengths.show"))
{
%>
: [<%= ic.getCount(collection) %>]
<%
}
%>
<small><fmt:message key="jsp.collection-home.heading1"/></small>
<a class="statisticsLink btn btn-info" href="<%= request.getContextPath() %>/cris/stats/collection.html?handle=<%= collection.getHandle() %>&type=selected"><fmt:message key="jsp.collection-home.display-statistics"/></a>
</h2></div>
<% if (logo != null) { %>
<div class="col-md-4">
<img class="img-responsive pull-right" alt="Logo" src="<%= request.getContextPath() %>/retrieve/<%= logo.getID() %>" />
</div>
<% } %>
</div>
<%
if (StringUtils.isNotBlank(intro)) { %>
<%= intro %>
<% } %>
</div>
<p class="copyrightText"><%= copyright %></p>
<%-- Browse --%>
<div class="panel panel-primary">
<div class="panel-heading">
<fmt:message key="jsp.general.browse"/>
</div>
<div class="panel-body">
<%-- Insert the dynamic list of browse options --%>
<%
for (int i = 0; i < bis.length; i++)
{
String key = "browse.menu." + bis[i].getName();
%>
<form method="get" class="btn-group" action="<%= request.getContextPath() %>/handle/<%= collection.getHandle() %>/browse">
<input type="hidden" name="type" value="<%= bis[i].getName() %>"/>
<%-- <input type="hidden" name="collection" value="<%= collection.getHandle() %>" /> --%>
<input type="submit" class="btn btn-default" name="submit_browse" value="<fmt:message key="<%= key %>"/>"/>
</form>
<%
}
%> </div>
</div>
<% if (submit_button)
{ %>
<form class="form-group" action="<%= request.getContextPath() %>/submit" method="post">
<input type="hidden" name="collection" value="<%= collection.getID() %>" />
<input class="btn btn-success col-md-12" type="submit" name="submit" value="<fmt:message key="jsp.collection-home.submit.button"/>" />
</form>
<% } %>
<form class="well" method="get" action="">
<% if (loggedIn && subscribed)
{ %>
<small><fmt:message key="jsp.collection-home.subscribed"/> <a href="<%= request.getContextPath() %>/subscribe"><fmt:message key="jsp.collection-home.info"/></a></small>
<input class="btn btn-sm btn-warning" type="submit" name="submit_unsubscribe" value="<fmt:message key="jsp.collection-home.unsub"/>" />
<% } else { %>
<small>
<fmt:message key="jsp.collection-home.subscribe.msg"/>
</small>
<input class="btn btn-sm btn-info" type="submit" name="submit_subscribe" value="<fmt:message key="jsp.collection-home.subscribe"/>" />
<% }
if(feedEnabled)
{ %>
<span class="pull-right">
<%
String[] fmts = feedData.substring(5).split(",");
String icon = null;
int width = 0;
for (int j = 0; j < fmts.length; j++)
{
if ("rss_1.0".equals(fmts[j]))
{
icon = "rss1.gif";
width = 80;
}
else if ("rss_2.0".equals(fmts[j]))
{
icon = "rss2.gif";
width = 80;
}
else
{
icon = "rss.gif";
width = 36;
}
%>
<a href="<%= request.getContextPath() %>/feed/<%= fmts[j] %>/<%= collection.getHandle() %>"><img src="<%= request.getContextPath() %>/image/<%= icon %>" alt="RSS Feed" width="<%= width %>" height="15" style="margin: 3px 0 3px" /></a>
<%
} %>
</span><%
}
%>
</form>
<div class="row">
<%@ include file="discovery/static-tagcloud-facet.jsp" %>
</div>
<% if (show_items)
{
BrowseInfo bi = (BrowseInfo) request.getAttribute("browse.info");
BrowseIndex bix = bi.getBrowseIndex();
String direction = (bi.isAscending() ? "ASC" : "DESC");
String sortBy = ((String)request.getParameter("sort_by"))==null?"-1":request.getParameter("sort_by");
// prepare the next and previous links
String linkBase = request.getContextPath() + "/handle/" + collection.getHandle();
String next = linkBase;
String prev = linkBase;
if (bi.hasNextPage())
{
next = next + "?offset=" + bi.getNextOffset();
}
if (bi.hasPrevPage())
{
prev = prev + "?offset=" + bi.getPrevOffset();
}
String bi_name_key = "browse.menu." + bi.getSortOption().getName();
String so_name_key = "browse.order." + (bi.isAscending() ? "asc" : "desc");
%>
<%-- give us the top report on what we are looking at --%>
<fmt:message var="bi_name" key="<%= bi_name_key %>"/>
<fmt:message var="so_name" key="<%= so_name_key %>"/>
<div class="browse_range">
<fmt:message key="jsp.collection-home.content.range">
<fmt:param value="${bi_name}"/>
<fmt:param value="${so_name}"/>
<fmt:param value="<%= Integer.toString(bi.getStart()) %>"/>
<fmt:param value="<%= Integer.toString(bi.getFinish()) %>"/>
<fmt:param value="<%= Integer.toString(bi.getTotal()) %>"/>
</fmt:message>
</div>
<%-- do the top previous and next page links --%>
<div class="prev-next-links">
<%
if (bi.hasPrevPage())
{
%>
<a href="<%= prev %>"><fmt:message key="browse.full.prev"/></a>
<%
}
if (bi.hasNextPage())
{
%>
<a href="<%= next %>"><fmt:message key="browse.full.next"/></a>
<%
}
%>
</div>
<%-- output the results using the browselist tag --%>
<%
if (bix.isMetadataIndex())
{
%>
<dspace:browselist browseInfo="<%= bi %>" emphcolumn="<%= bix.getMetadata() %>"/>
<%
}
else
{
%>
<dspace:browselist browseInfo="<%= bi %>" emphcolumn="<%= bix.getSortOption().getMetadata() %>"/>
<%
}
%>
<%-- give us the bottom report on what we are looking at --%>
<div class="browse_range">
<fmt:message key="jsp.collection-home.content.range">
<fmt:param value="${bi_name}"/>
<fmt:param value="${so_name}"/>
<fmt:param value="<%= Integer.toString(bi.getStart()) %>"/>
<fmt:param value="<%= Integer.toString(bi.getFinish()) %>"/>
<fmt:param value="<%= Integer.toString(bi.getTotal()) %>"/>
</fmt:message>
</div>
<%-- do the bottom previous and next page links --%>
<div class="prev-next-links">
<%
if (bi.hasPrevPage())
{
%>
<a href="<%= prev %>"><fmt:message key="browse.full.prev"/></a>
<%
}
if (bi.hasNextPage())
{
%>
<a href="<%= next %>"><fmt:message key="browse.full.next"/></a>
<%
}
%>
</div>
<form class="form-inline hidden" id="sortform" method="get" action="<%= formaction %>">
<%
if (bi.hasAuthority())
{
%><input type="hidden" name="authority" value="<%=bi.getAuthority() %>"/><%
}
else if (bi.hasValue())
{
%><input type="hidden" name="value" value="<%= bi.getValue() %>"/><%
}
%>
<input type="hidden" id="ssort_by" name="sort_by" value="" />
<input type="hidden" id="sorder" name="order" value="<%= direction %>" />
<input type="hidden" id="offset" name="offset" value="<%= request.getParameter("offset")==null?0:request.getParameter("offset") %>" />
</form>
<%
} // end of if (show_title)
%>
<dspace:sidebar>
<% if(admin_button || editor_button ) { %>
<div class="panel panel-warning">
<div class="panel-heading"><fmt:message key="jsp.admintools"/>
<span class="pull-right"><dspace:popup page="<%= LocaleSupport.getLocalizedMessage(pageContext, \"help.collection-admin\")%>"><fmt:message key="jsp.adminhelp"/></dspace:popup></span>
</div>
<div class="panel-body">
<% if( editor_button ) { %>
<form method="post" action="<%=request.getContextPath()%>/tools/edit-communities">
<input type="hidden" name="collection_id" value="<%= collection.getID() %>" />
<input type="hidden" name="community_id" value="<%= community.getID() %>" />
<input type="hidden" name="action" value="<%= EditCommunitiesServlet.START_EDIT_COLLECTION %>" />
<input class="btn btn-default col-md-12" type="submit" value="<fmt:message key="jsp.general.edit.button"/>" />
</form>
<% } %>
<% if( admin_button ) { %>
<form method="post" action="<%=request.getContextPath()%>/tools/itemmap">
<input type="hidden" name="cid" value="<%= collection.getID() %>" />
<input class="btn btn-default col-md-12" type="submit" value="<fmt:message key="jsp.collection-home.item.button"/>" />
</form>
<% if(submitters != null) { %>
<form method="get" action="<%=request.getContextPath()%>/tools/group-edit">
<input type="hidden" name="group_id" value="<%=submitters.getID()%>" />
<input class="btn btn-default col-md-12" type="submit" name="submit_edit" value="<fmt:message key="jsp.collection-home.editsub.button"/>" />
</form>
<% } %>
<% if( editor_button || admin_button) { %>
<form method="post" action="<%=request.getContextPath()%>/mydspace">
<input type="hidden" name="collection_id" value="<%= collection.getID() %>" />
<input type="hidden" name="step" value="<%= MyDSpaceServlet.REQUEST_EXPORT_ARCHIVE %>" />
<input class="btn btn-default col-md-12" type="submit" value="<fmt:message key="jsp.mydspace.request.export.collection"/>" />
</form>
<form method="post" action="<%=request.getContextPath()%>/mydspace">
<input type="hidden" name="collection_id" value="<%= collection.getID() %>" />
<input type="hidden" name="step" value="<%= MyDSpaceServlet.REQUEST_MIGRATE_ARCHIVE %>" />
<input class="btn btn-default col-md-12" type="submit" value="<fmt:message key="jsp.mydspace.request.export.migratecollection"/>" />
</form>
<form method="post" action="<%=request.getContextPath()%>/dspace-admin/metadataexport">
<input type="hidden" name="handle" value="<%= collection.getHandle() %>" />
<input class="btn btn-default col-md-12" type="submit" value="<fmt:message key="jsp.general.metadataexport.button"/>" />
</form>
</div>
</div>
<% } %>
<% } %>
<% } %>
<%
if (rs != null)
{
%>
<h3><fmt:message key="jsp.collection-home.recentsub"/></h3>
<%
for (IGlobalSearchResult obj : rs.getRecentSubmissions()) {
%>
<dspace:discovery-artifact style="global" artifact="<%= obj %>" view="<%= rs.getConfiguration() %>"/>
<%
}
%>
<p> </p>
<% } %>
<%= sidebar %>
<%
int discovery_panel_cols = 12;
int discovery_facet_cols = 12;
String processorSidebar = (String) request.getAttribute("processorSidebar");
if(processorSidebar!=null && processorSidebar.equals("sidebar")) {
%>
<%@ include file="discovery/static-sidebar-facet.jsp" %>
<% } %>
</dspace:sidebar>
</dspace:layout>