mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-07 18:14:26 +00:00
Restoring the work of the following patches (note this includes the file restorations on the previous commit 1867):
- SF Patch #1659868 Improved database level debugging - SF Patch #1659901 Import community and collection structure - SF Patch #1659837 ItemIterator now deals with item ids also - SF Patch #1659796 Create administrator wtih command line options - SF Patch #1659841 Add option to clear context object cache (Stuart Lewis) - SF Patch #1641678 [dspace]/bin scripts for import and export - SF Patch #1642336 Restrict domains of self-registered users - SF Patch #1587225 Google and html sitemap generator (Dorothea Salo) - SF Patch #1557948 Link subjects and authors on item pages git-svn-id: http://scm.dspace.org/svn/repo/trunk@1868 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
@@ -48,6 +48,8 @@
|
||||
- SF Patch #1670110 for SF Bug #1670106 Onebox and textarea fail when visibility set to workflow
|
||||
- SF Patch #1628889 Improve file size descriptions in ItemTag
|
||||
- SF Patch #1587225 Google and html sitemap generator
|
||||
- SF Patch #1641678 [dspace]/bin scripts for import and export
|
||||
- SF Patch #1642336 Restrict domains of self-registered users
|
||||
|
||||
(Monika Mevenkamp)
|
||||
- SF Patch #1654469 stat scripts always return exit code 1
|
||||
@@ -62,6 +64,9 @@
|
||||
- SF Patch #1695702 Update SubmitServlet to use default.language instead of "en" for SF bug 1636792 default.language not applied to new submissions
|
||||
- SF Patch #1699903 for SF Bug #1695692 make-release-package still uses CVS commands
|
||||
|
||||
(Dorothea Salo)
|
||||
- SF Patch #1557948 Link subjects and authors on item pages
|
||||
|
||||
(Graham Triggs)
|
||||
- SF Patch #1688523 Bug fix - OAI harvest and Oracle
|
||||
- SF Patch #1660752 Workaround Numeric/Integer handling in Oracle
|
||||
|
@@ -222,6 +222,12 @@ handle.dir = ${dspace.dir}/handle-server
|
||||
plugin.sequence.org.dspace.eperson.AuthenticationMethod = \
|
||||
org.dspace.eperson.PasswordAuthentication
|
||||
|
||||
#### PasswordAuthentication options ####
|
||||
# Only emails ending in the following domains are allowed to self-register
|
||||
# Example - example.com domain : @example.com
|
||||
# Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
|
||||
# authentication.password.domain.valid = example.com
|
||||
|
||||
#### Example of configuring X.509 authentication
|
||||
#### (to use it, add org.dspace.eperson.X509Authentication to auth stack above)
|
||||
|
||||
|
@@ -1198,6 +1198,9 @@ jsp.tools.eperson-list.close.button = Close
|
||||
jsp.tools.eperson-list.heading = E-people {0}-{1} of {2}
|
||||
jsp.tools.eperson-list.info1 = Clicking on the 'Add' button next to an e-person will add that e-person to the list on the main form.
|
||||
jsp.tools.eperson-list.title = Select E-people
|
||||
jsp.tools.eperson-list.search.query = Query
|
||||
jsp.tools.eperson-list.search.submit = Search
|
||||
jsp.tools.eperson-list.search.return-browse = return to e-person full list
|
||||
jsp.tools.eperson-list.jump.one-back = < 1 Page
|
||||
jsp.tools.eperson-list.jump.five-back = < 5 Pages
|
||||
jsp.tools.eperson-list.jump.one-forward = 1 Page >
|
||||
|
@@ -539,36 +539,119 @@ from/until/setSpec/offset
|
||||
|
||||
<p>This means the harvest is 'from' <code>2003-01-01</code>, has no 'until' date, is for collection hdl:1721.1/1234, and 300 records have already been sent to the harvester. (Actually, if the original OAI-PMH request doesn't specify a 'from' or 'until, OAICat fills them out automatically to '0000-00-00T00:00:00Z' and '9999-12-31T23:59:59Z' respectively. This means DSpace resumption tokens will always have from and until dates in them.)</p>
|
||||
|
||||
|
||||
<!-- Struct Builder -->
|
||||
<h2><a name="structbuilder" id="structbuilder">Community and Collection Structure Importer</a></h2>
|
||||
|
||||
<p>
|
||||
This command-line tool gives you the ability to import a community and collection structure directly
|
||||
from a source XML file. It is executed as follows:
|
||||
</p>
|
||||
|
||||
<p><code>[dspace]/bin/structure-builder -f [source xml] -o [output xml file] -e [administrator email]</code></p>
|
||||
|
||||
<p>
|
||||
This will examine the contents of <code>[source xml]</code>, import the structure into DSpace while logged in as the
|
||||
supplied administrator, and then output the same structure to the output file, but including the handle for each
|
||||
imported community and collection as an attribute.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The source xml document needs to be in the following format:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<import_structure>
|
||||
<community>
|
||||
<name>Community Name</name>
|
||||
<description>Descriptive text</description>
|
||||
<intro>Introductory text</intro>
|
||||
<copyright>Special copyright notice</copyright>
|
||||
<sidebar>Sidebar text</sidebar>
|
||||
<community>
|
||||
<name>Sub Community Name</name>
|
||||
<community> ...[ad infinitum]... </community>
|
||||
</community>
|
||||
<collection>
|
||||
<name>Collection Name</name>
|
||||
<description>Descriptive text</description>
|
||||
<intro>Introductory text</intro>
|
||||
<copyright>Special copyright notice</copyright>
|
||||
<sidebar>Sidebar text</sidebar>
|
||||
<license>Special licence</license>
|
||||
<provenance>Provenance information</provenance>
|
||||
</collection>
|
||||
</community>
|
||||
</import_structure>
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The resulting output document will be as follows:
|
||||
</p>
|
||||
|
||||
<pre>
|
||||
<import_structure>
|
||||
<community identifier="123456789/1">
|
||||
<name>Community Name</name>
|
||||
<description>Descriptive text</description>
|
||||
<intro>Introductory text</intro>
|
||||
<copyright>Special copyright notice</copyright>
|
||||
<sidebar>Sidebar text</sidebar>
|
||||
<community identifier="123456789/2">
|
||||
<name>Sub Community Name</name>
|
||||
<community identifier="123456789/3"> ...[ad infinitum]... </community>
|
||||
</community>
|
||||
<collection identifier="123456789/4">
|
||||
<name>Collection Name</name>
|
||||
<description>Descriptive text</description>
|
||||
<intro>Introductory text</intro>
|
||||
<copyright>Special copyright notice</copyright>
|
||||
<sidebar>Sidebar text</sidebar>
|
||||
<license>Special licence</license>
|
||||
<provenance>Provenance information</provenance>
|
||||
</collection>
|
||||
</community>
|
||||
</import_structure>
|
||||
</pre>
|
||||
|
||||
<h3>Limitation</h3>
|
||||
|
||||
<ul>
|
||||
<li>Currently this does not export community and collection structures, although it should only be a small modification to make it do so</li>
|
||||
</ul>
|
||||
|
||||
<!-- end Struct Builder -->
|
||||
|
||||
<h2><a name="packager" id="packager">Package Importer and Exporter</a></h2>
|
||||
|
||||
<p>This command-line tool gives you access to the Packager plugins. It can <em>ingest</em> a package to create a new DSpace Item, or <em>disseminate</em> an Item as a package.</p>
|
||||
|
||||
<p>To see all the options, invoke it as: <pre><em>[dspace]</em>/bin/dsrun org.dspace.app.packager.Packager --help</pre> This mode also displays a list of the names of package ingesters and disseminators that are available.</p>
|
||||
<p>To see all the options, invoke it as: <pre><em>[dspace]</em>/bin/packager --help</pre> This mode also displays a list of the names of package ingesters and disseminators that are available.</p>
|
||||
|
||||
<h3>Ingesting</h3>
|
||||
|
||||
<p>To ingest a package from a file, give the command: <pre><em>[dspace]</em>/bin/dsrun org.dspace.app.packager.Packager -e <em>user</em> -c <em>handle</em> -t <em>packager</em> <em>path</em></pre>
|
||||
<p>To ingest a package from a file, give the command: <pre><em>[dspace]</em>/bin/packager -e <em>user</em> -c <em>handle</em> -t <em>packager</em> <em>path</em></pre>
|
||||
Where <em>user</em> is the e-mail address of the E-Person under whose authority this runs; <em>handle</em> is the Handle of the collection into which the Item is added, <em>packager</em> is the plugin name of the
|
||||
package ingester to use, and <em>path</em> is the path to the file to ingest (or <code>"-"</code> to read from the standard input).</p>
|
||||
|
||||
<p>Here is an example that loads a PDF file with internal metadata as a package:
|
||||
<pre>/dspace/bin/dsrun org.dspace.app.packager.Packager -e florey@mit.edu -c 1721.2/13 -t pdf thesis.pdf</pre>
|
||||
<pre>/dspace/bin/packager -e florey@mit.edu -c 1721.2/13 -t pdf thesis.pdf</pre>
|
||||
</p>
|
||||
|
||||
<p>This example takes the result of retrieving a URL and ingests it:
|
||||
<pre>wget -O - http://alum.mit.edu/jarandom/my-thesis.pdf | \
|
||||
/dspace/bin/dsrun org.dspace.app.packager.Packager -e florey@mit.edu -c 1721.2/13 -t pdf -</pre></p>
|
||||
/dspace/bin/packager -e florey@mit.edu -c 1721.2/13 -t pdf -</pre></p>
|
||||
|
||||
<h3>Disseminating</h3>
|
||||
|
||||
<p>To disseminate an Item as a package, give the command:
|
||||
<pre><em>[dspace]</em>/bin/dsrun org.dspace.app.packager.Packager -e <em>user</em> -d -i <em>handle</em> -t <em>packager</em> <em>path</em></pre> Where <em>user</em> is the e-mail address of the E-Person under whose
|
||||
<pre><em>[dspace]</em>/bin/packager -e <em>user</em> -d -i <em>handle</em> -t <em>packager</em> <em>path</em></pre> Where <em>user</em> is the e-mail address of the E-Person under whose
|
||||
authority this runs; <em>handle</em> is the Handle of the Item to disseminate;
|
||||
<em>packager</em> is the plugin name of the package disseminator to use; and <em>path</em> is the path to the file to
|
||||
create (or <code>"-"</code> to write to the standard output).
|
||||
|
||||
This example writes an Item out as a METS package in the file "454.zip":
|
||||
<pre>/dspace/bin/dsrun org.dspace.app.packager.Packager -e florey@mit.edu -d -i 1721.2/454 -t METS 454.zip</pre></p>
|
||||
<pre>/dspace/bin/packager -e florey@mit.edu -d -i 1721.2/454 -t METS 454.zip</pre></p>
|
||||
|
||||
<h3>METS packages</h3>
|
||||
|
||||
@@ -634,22 +717,22 @@ archive_directory/
|
||||
|
||||
<p>To add items to a collection with an EPerson as the submitter, type:</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemimport.ItemImport --add --eperson=joe@user.com --collection=collectionID --source=items_dir --mapfile=mapfile
|
||||
[dspace]/bin/import --add --eperson=joe@user.com --collection=collectionID --source=items_dir --mapfile=mapfile
|
||||
</pre>
|
||||
|
||||
<p>(or by using the short form)</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemimport.ItemImport -a -e joe@user.com -c collectionID -s items_dir -m mapfile
|
||||
[dspace]/bin/import -a -e joe@user.com -c collectionID -s items_dir -m mapfile
|
||||
</pre>
|
||||
|
||||
<p>which would then cycle through the archive directory's items, import them, and then generate a map file which stores the mapping of item directories to item handles. Save this map file! Using the map file you can then 'unimport' with the command:</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemimport.ItemImport --delete --mapfile=mapfile
|
||||
[dspace]/bin/import --delete --mapfile=mapfile
|
||||
</pre>
|
||||
|
||||
<p>The imported items listed in the map file would then be deleted. If you wish to replace previously imported items, you can give the command:</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemimport.ItemImport --replace --eperson=joe@user.com --collection=collectID --source=items_dir --mapfile=mapfile
|
||||
[dspace]/bin/import --replace --eperson=joe@user.com --collection=collectID --source=items_dir --mapfile=mapfile
|
||||
</pre>
|
||||
|
||||
<p>Replacing items uses the map file to replace the old items and still retain their handles.</p>
|
||||
@@ -662,12 +745,12 @@ archive_directory/
|
||||
|
||||
<p>The item exporter can export a single item or a collection of items, and creates a DSpace simple archive for each item to be exported. To export a collection's items you type:</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemexport.ItemExport --type=COLLECTION --id=collID --dest=dest_dir --number=seq_num
|
||||
[dspace]/bin/export --type=COLLECTION --id=collID --dest=dest_dir --number=seq_num
|
||||
</pre>
|
||||
|
||||
<p>The keyword <code>COLLECTION</code> means that you intend to export an entire collection. The ID can either be the database ID or the handle. The exporter will begin numbering the simple archives with the sequence number that you supply. To export a single item use the keyword <code>ITEM</code> and give the item ID as an argument:</p>
|
||||
<pre>
|
||||
[dspace]/bin/dsrun org.dspace.app.itemexport.ItemExport --type=ITEM --id=itemID --dest=dest_dir --number=seq_num
|
||||
[dspace]/bin/export --type=ITEM --id=itemID --dest=dest_dir --number=seq_num
|
||||
</pre>
|
||||
|
||||
<p>Each exported item will have an additional file in its directory, named 'handle'. This will contain the handle that was assigned to the item, and this file will be read by the importer so that items exported and then imported to another machine will retain the item's original handle.</p>
|
||||
|
@@ -543,6 +543,10 @@ metadata.dc.description.abstract = Abstract</pre>
|
||||
<li>
|
||||
<p>Users are not members of any special (dynamic) e-person groups</p>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<p>You can restrict the domains from which new users are able to regiser. To enable this feature, uncomment the following line from dspace.cfg: <code>authentication.password.domain.valid = example.com</code> Example options might be '<code>@example.com</code>' to restrict registration to users with addresses ending in @example.com, or '<code>@example.com, .ac.uk</code>' to restrict registration to users with addresses ending in @example.com or with addresses in the .ac.uk domain.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h3>LDAP Authentication</h3>
|
||||
|
@@ -135,6 +135,7 @@
|
||||
<UL>
|
||||
<LI><A HREF="application.html#webui">Web User Interface</A></LI>
|
||||
<LI><A HREF="application.html#oai">OAI-PMH Data Provider</A></LI>
|
||||
<li><a href="application.html#structbuilder">Community and Collection Structure Importer</a></li>
|
||||
<LI><A HREF="application.html#packager">Package Importer and Exporter</a></LI>
|
||||
<LI><A HREF="application.html#itemimporter">Item Importer and Exporter</A></LI>
|
||||
<LI><A HREF="application.html#transferitem">Transferring Items Between DSpace Instances</A></LI>
|
||||
|
@@ -45,9 +45,11 @@
|
||||
- Attributes:
|
||||
-
|
||||
- epeople - EPerson[] - all epeople to browse
|
||||
- sortby - Integer - field to sort by (constant from EPerson.java)
|
||||
- first - Integer - index of first eperson to display
|
||||
- sortby - Integer - field to sort by (constant from EPerson.java) (when show all)
|
||||
- first - Integer - index of first eperson to display (when show all)
|
||||
- multiple - if non-null, this is for selecting multiple epeople
|
||||
- search - String - query string for search eperson
|
||||
- offset - Integer - offset in a search result set
|
||||
--%>
|
||||
|
||||
<%@ page contentType="text/html;charset=UTF-8" %>
|
||||
@@ -67,25 +69,68 @@
|
||||
int sortBy = ((Integer)request.getAttribute("sortby" )).intValue();
|
||||
int first = ((Integer)request.getAttribute("first")).intValue();
|
||||
boolean multiple = (request.getAttribute("multiple") != null);
|
||||
String search = (String) request.getAttribute("search");
|
||||
if (search == null) search = "";
|
||||
int offset = ((Integer)request.getAttribute("offset")).intValue();
|
||||
|
||||
// Make sure we won't run over end of list
|
||||
int last = first + PAGESIZE;
|
||||
int last;
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
last = offset + PAGESIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
last = first + PAGESIZE;
|
||||
}
|
||||
if (last >= epeople.length) last = epeople.length - 1;
|
||||
|
||||
// Index of first eperson on last page
|
||||
int jumpEnd = ((epeople.length - 1) / PAGESIZE) * PAGESIZE;
|
||||
|
||||
// Now work out values for next/prev page buttons
|
||||
int jumpFiveBack = first - PAGESIZE * 5;
|
||||
int jumpFiveBack;
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
jumpFiveBack = offset - PAGESIZE * 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpFiveBack = first - PAGESIZE * 5;
|
||||
}
|
||||
if (jumpFiveBack < 0) jumpFiveBack = 0;
|
||||
|
||||
int jumpOneBack = first - PAGESIZE;
|
||||
int jumpOneBack;
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
jumpOneBack = offset - PAGESIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpOneBack = first - PAGESIZE;
|
||||
}
|
||||
if (jumpOneBack < 0) jumpOneBack = 0;
|
||||
|
||||
int jumpOneForward = first + PAGESIZE;
|
||||
if (jumpOneForward > epeople.length) jumpOneForward = first;
|
||||
int jumpOneForward;
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
jumpOneForward = offset + PAGESIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpOneForward = first + PAGESIZE;
|
||||
}
|
||||
if (jumpOneForward > epeople.length) jumpOneForward = jumpEnd;
|
||||
|
||||
int jumpFiveForward = first + PAGESIZE * 5;
|
||||
int jumpFiveForward;
|
||||
if (search != null && !search.trim().equals(""))
|
||||
{
|
||||
jumpFiveForward = offset + PAGESIZE * 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpFiveForward = first + PAGESIZE * 5;
|
||||
}
|
||||
if (jumpFiveForward > epeople.length) jumpFiveForward = jumpEnd;
|
||||
|
||||
// What's the link?
|
||||
@@ -93,8 +138,16 @@
|
||||
if (sortBy == EPerson.EMAIL) sortByParam = "email";
|
||||
if (sortBy == EPerson.ID) sortByParam = "id";
|
||||
|
||||
String jumpLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first=";
|
||||
String sortLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&first=" + first + "&sortby=";
|
||||
String jumpLink;
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
jumpLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first="+first+"&search="+search+"&offset=";
|
||||
}
|
||||
else
|
||||
{
|
||||
jumpLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first=";
|
||||
}
|
||||
String sortLink = request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&first=" + first + "&sortby=";
|
||||
%>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
@@ -129,10 +182,9 @@ function clearEPeople()
|
||||
</script>
|
||||
</head>
|
||||
<body class="pageContents">
|
||||
|
||||
<%-- <h3>E-people <%= first + 1 %>-<%= last + 1 %> of <%= epeople.length %></h3> --%>
|
||||
<h3><fmt:message key="jsp.tools.eperson-list.heading">
|
||||
<fmt:param><%= first + 1 %></fmt:param>
|
||||
<fmt:param><%= ((search != null && !search.equals(""))?offset:first) + 1 %></fmt:param>
|
||||
<fmt:param><%= last + 1 %></fmt:param>
|
||||
<fmt:param><%= epeople.length %></fmt:param>
|
||||
</fmt:message></h3>
|
||||
@@ -144,7 +196,23 @@ function clearEPeople()
|
||||
e-person to the list on the main form. </p> --%>
|
||||
<p class="submitFormHelp"><fmt:message key="jsp.tools.eperson-list.info1"/></p>
|
||||
<% } %>
|
||||
|
||||
<center>
|
||||
<form method="get">
|
||||
<input type="hidden" name="first" value="<%= first %>" />
|
||||
<input type="hidden" name="sortby" value="<%= sortBy %>" />
|
||||
<input type="hidden" name="multiple" value="<%= multiple %>" />
|
||||
<label for="search"><fmt:message key="jsp.tools.eperson-list.search.query" /></label><input type="text" name="search" value="<%= search %>"/>
|
||||
<input type="submit" value="<fmt:message key="jsp.tools.eperson-list.search.submit" />" />
|
||||
<%
|
||||
if (search != null && !search.equals(""))
|
||||
{ %>
|
||||
<br/>
|
||||
<a href="<%= request.getContextPath() + "/tools/eperson-list?multiple=" + multiple + "&sortby=" + sortByParam + "&first="+first %>"><fmt:message key="jsp.tools.eperson-list.search.return-browse" /></a>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</form>
|
||||
</center>
|
||||
<%-- Controls for jumping around list--%>
|
||||
<table width="99%">
|
||||
<tr>
|
||||
@@ -168,6 +236,18 @@ function clearEPeople()
|
||||
<form method="get" action=""> <%-- Will never actually be posted, it's just so buttons will appear --%>
|
||||
|
||||
<table class="miscTable" align="center" summary="Epeople list">
|
||||
<% if (search != null && !search.equals(""))
|
||||
{ %>
|
||||
<tr>
|
||||
<th class="oddRowOddCol"> </th>
|
||||
<th class="oddRowEvenCol"><fmt:message key="jsp.tools.eperson-list.th.id" /></th>
|
||||
<th class="oddRowOddCol"><fmt:message key="jsp.tools.eperson-list.th.email" /></th>
|
||||
<th class="oddRowEvenCol"><fmt:message key="jsp.tools.eperson-list.th.lastname" /></th>
|
||||
<th class="oddRowOddCol"><fmt:message key="jsp.tools.eperson-list.th.lastname" /></th>
|
||||
</tr>
|
||||
<% }
|
||||
else
|
||||
{ %>
|
||||
<tr>
|
||||
<th id="t1" class="oddRowOddCol"> </th>
|
||||
<th id="t2" class="oddRowEvenCol"><%
|
||||
@@ -205,7 +285,7 @@ function clearEPeople()
|
||||
<%-- <th class="oddRowOddCol">First Name</th> --%>
|
||||
<th id="t5" class="oddRowOddCol"><fmt:message key="jsp.tools.eperson-list.th.firstname"/></th>
|
||||
</tr>
|
||||
<%
|
||||
<% }
|
||||
String row = "even";
|
||||
|
||||
// If this is a dialogue to select a *single* e-person, we want
|
||||
@@ -215,7 +295,7 @@ function clearEPeople()
|
||||
String closeWindow = (multiple ? "" : "window.close();");
|
||||
|
||||
|
||||
for (int i = first; i <= last; i++)
|
||||
for (int i = (search != null && !search.equals(""))?offset:first; i <= last; i++)
|
||||
{
|
||||
EPerson e = epeople[i];
|
||||
// Make sure no quotes in full name will mess up our Javascript
|
||||
|
@@ -54,6 +54,7 @@ import org.dspace.core.Constants;
|
||||
import org.dspace.core.Utils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URLEncoder;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.Enumeration;
|
||||
@@ -280,6 +281,7 @@ public class ItemTag extends TagSupport
|
||||
private void render() throws IOException
|
||||
{
|
||||
JspWriter out = pageContext.getOut();
|
||||
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
|
||||
|
||||
String configLine = ConfigurationManager
|
||||
.getProperty("webui.itemdisplay." + style);
|
||||
@@ -303,6 +305,8 @@ public class ItemTag extends TagSupport
|
||||
String field = st.nextToken().trim();
|
||||
boolean isDate = false;
|
||||
boolean isLink = false;
|
||||
boolean isAuthor = isAuthor(field);
|
||||
boolean isSubject = isSubject(field);
|
||||
|
||||
// Find out if the field should rendered as a date or link
|
||||
|
||||
@@ -362,6 +366,18 @@ public class ItemTag extends TagSupport
|
||||
// Parse the date
|
||||
out.print(UIUtil.displayDate(dd, false, false));
|
||||
}
|
||||
else if (isAuthor)
|
||||
{
|
||||
out.print("<a href=\"" + request.getContextPath() + "/items-by-author?author="
|
||||
+ URLEncoder.encode(values[j].value, "UTF-8") + "\">" + values[j].value
|
||||
+ "</a>");
|
||||
}
|
||||
else if (isSubject)
|
||||
{
|
||||
out.print("<a href=\"" + request.getContextPath() + "/items-by-subject?subject="
|
||||
+ URLEncoder.encode(values[j].value, "UTF-8") + "\">" + values[j].value
|
||||
+ "</a>");
|
||||
}
|
||||
else
|
||||
{
|
||||
out.print(Utils.addEntities(values[j].value));
|
||||
@@ -878,4 +894,121 @@ public class ItemTag extends TagSupport
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given field name an Author field?
|
||||
*
|
||||
* If undefined in dspace.cfg (webui.browse.index.author) it defaults
|
||||
* to using any field containing 'creator'.
|
||||
*
|
||||
* @param field
|
||||
* @return Whether or not the given String is an author
|
||||
*/
|
||||
private boolean isAuthor(String field)
|
||||
{
|
||||
// Does the user want to link to authors?
|
||||
if (ConfigurationManager.getBooleanProperty("webui.authorlinks.enable", true) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//Check whether a given metadata field should be considered an author field.
|
||||
String authorField = ConfigurationManager.getProperty("webui.browse.index.author");
|
||||
if (authorField == null)
|
||||
{
|
||||
if (field.indexOf("contributor") > 0 || field.indexOf("creator") > 0)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(authorField, ",");
|
||||
String aField;
|
||||
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
aField = st.nextToken().trim();
|
||||
// does dspace.cfg allow all qualifiers for this element?
|
||||
if (aField.endsWith(".*"))
|
||||
{
|
||||
// does the field have a qualifier?
|
||||
int i = field.lastIndexOf(".");
|
||||
if (i != field.indexOf("."))
|
||||
{
|
||||
// lop off qualifier
|
||||
field = field.substring(0, i);
|
||||
}
|
||||
}
|
||||
// check field against dspace.cfg
|
||||
if (aField.indexOf(field) >= 0)
|
||||
return true;
|
||||
}
|
||||
//no match found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the given field name a Subject field?
|
||||
*
|
||||
* If undefined in dspace.cfg (webui.browse.index.subject) it defaults
|
||||
* to using any field containing 'subject'.
|
||||
*
|
||||
* @param field
|
||||
* @return Whether or not the given String is a subject
|
||||
*/
|
||||
private boolean isSubject(String field)
|
||||
{
|
||||
// Does the user want to link to subjects?
|
||||
if (ConfigurationManager.getBooleanProperty("webui.subjectlinks.enable", false) == false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check whether a given metadata field should be considered a subject field
|
||||
String subjectField = ConfigurationManager.getProperty("webui.browse.index.subject");
|
||||
|
||||
if (subjectField == null)
|
||||
{
|
||||
if (field.indexOf("subject") > 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
StringTokenizer st = new StringTokenizer(subjectField, ",");
|
||||
String sField;
|
||||
|
||||
while (st.hasMoreTokens())
|
||||
{
|
||||
sField = st.nextToken().trim();
|
||||
// does dspace.cfg allow all qualifiers for this element?
|
||||
if (sField.endsWith(".*"))
|
||||
{
|
||||
// does the field have a qualifier?
|
||||
int i = field.lastIndexOf(".");
|
||||
if (i != field.indexOf("."))
|
||||
{
|
||||
// lop off qualifier
|
||||
field = field.substring(0, i);
|
||||
}
|
||||
}
|
||||
|
||||
// check field against dspace.cfg
|
||||
if (sField.indexOf(field) >= 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//no match found
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -61,6 +61,13 @@ import org.dspace.eperson.EPerson;
|
||||
*/
|
||||
public class EPersonListServlet extends DSpaceServlet
|
||||
{
|
||||
protected void doDSPost(Context context, HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException,
|
||||
SQLException, AuthorizeException
|
||||
{
|
||||
doDSGet(context, request, response);
|
||||
}
|
||||
|
||||
protected void doDSGet(Context context, HttpServletRequest request,
|
||||
HttpServletResponse response) throws ServletException, IOException,
|
||||
SQLException, AuthorizeException
|
||||
@@ -88,19 +95,36 @@ public class EPersonListServlet extends DSpaceServlet
|
||||
|
||||
// What's the index of the first eperson to show? Default is 0
|
||||
int first = UIUtil.getIntParameter(request, "first");
|
||||
|
||||
int offset = UIUtil.getIntParameter(request, "offset");
|
||||
if (first == -1)
|
||||
{
|
||||
first = 0;
|
||||
}
|
||||
if (offset == -1)
|
||||
{
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
||||
EPerson[] epeople;
|
||||
String search = request.getParameter("search");
|
||||
if (search != null && !search.equals(""))
|
||||
{
|
||||
epeople = EPerson.search(context, search);
|
||||
request.setAttribute("offset", new Integer(offset));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Retrieve the e-people in the specified order
|
||||
EPerson[] epeople = EPerson.findAll(context, sortBy);
|
||||
epeople = EPerson.findAll(context, sortBy);
|
||||
request.setAttribute("offset", new Integer(0));
|
||||
}
|
||||
|
||||
// Set attributes for JSP
|
||||
request.setAttribute("sortby", new Integer(sortBy));
|
||||
request.setAttribute("first", new Integer(first));
|
||||
request.setAttribute("epeople", epeople);
|
||||
request.setAttribute("search", search);
|
||||
|
||||
if (multiple)
|
||||
{
|
||||
|
@@ -41,6 +41,9 @@ package org.dspace.content;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.storage.rdbms.TableRow;
|
||||
import org.dspace.storage.rdbms.TableRowIterator;
|
||||
@@ -51,7 +54,11 @@ import org.dspace.storage.rdbms.TableRowIterator;
|
||||
* load a set of items into memory all at once. For example, loading in an
|
||||
* entire community or site's worth of items wouldn't make sense.
|
||||
*
|
||||
* Note that this class is not a real Iterator, as it does not implement
|
||||
* the Iterator interface
|
||||
*
|
||||
* @author Robert Tansley
|
||||
* @author Richard Jones
|
||||
* @version $Revision$
|
||||
*/
|
||||
public class ItemIterator
|
||||
@@ -66,38 +73,179 @@ public class ItemIterator
|
||||
/** The table row iterator of Item rows */
|
||||
private TableRowIterator itemRows;
|
||||
|
||||
/** a real iterator which works over the item ids when present */
|
||||
private Iterator iditr;
|
||||
|
||||
/**
|
||||
* Construct an item iterator. This is not a public method, since this
|
||||
* iterator is only created by CM API methods.
|
||||
* Construct an item iterator using a set of TableRow objects from
|
||||
* the item table
|
||||
*
|
||||
* @param context
|
||||
* our context
|
||||
* @param rows
|
||||
* the rows that correspond to the Items to be iterated over
|
||||
*/
|
||||
ItemIterator(Context context, TableRowIterator rows)
|
||||
public ItemIterator(Context context, TableRowIterator rows)
|
||||
{
|
||||
ourContext = context;
|
||||
itemRows = rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an item iterator using an array list of item ids
|
||||
*
|
||||
* @param context
|
||||
* our context
|
||||
* @param iids
|
||||
* the array list to be iterated over
|
||||
*/
|
||||
public ItemIterator(Context context, ArrayList iids)
|
||||
{
|
||||
ourContext = context;
|
||||
iditr = iids.iterator();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find out if there are any more items to iterate over
|
||||
*
|
||||
* @return <code>true</code> if there are more items
|
||||
* @throws SQLException
|
||||
*/
|
||||
public boolean hasNext() throws SQLException
|
||||
{
|
||||
if (iditr != null)
|
||||
{
|
||||
return iditr.hasNext();
|
||||
}
|
||||
else if (itemRows != null)
|
||||
{
|
||||
return itemRows.hasNext();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the next item in the iterator. Returns <code>null</code> if there
|
||||
* are no more items.
|
||||
*
|
||||
* @return the next item, or <code>null</code>
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Item next() throws SQLException
|
||||
{
|
||||
if (iditr != null)
|
||||
{
|
||||
return nextByID();
|
||||
}
|
||||
else if (itemRows != null)
|
||||
{
|
||||
return nextByRow();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This private method knows how to get the next result out of the
|
||||
* item id iterator
|
||||
*
|
||||
* @return the next item instantiated from the id
|
||||
* @throws SQLException
|
||||
*/
|
||||
private Item nextByID()
|
||||
throws SQLException
|
||||
{
|
||||
if (iditr.hasNext())
|
||||
{
|
||||
// get the id
|
||||
int id = ((Integer) iditr.next()).intValue();
|
||||
|
||||
// Check cache
|
||||
Item fromCache = (Item) ourContext.fromCache(Item.class, id);
|
||||
|
||||
if (fromCache != null)
|
||||
{
|
||||
return fromCache;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Item.find(ourContext, id);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* return the id of the next item.
|
||||
*
|
||||
* @return the next id or -1 if none
|
||||
*/
|
||||
public int nextID()
|
||||
throws SQLException
|
||||
{
|
||||
if (iditr != null)
|
||||
{
|
||||
return nextByIDID();
|
||||
}
|
||||
else if (itemRows != null)
|
||||
{
|
||||
return nextByRowID();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorry about the name of this one! It returns the ID of the item
|
||||
* as opposed to the item itself when we are iterating over an ArrayList
|
||||
* of item ids
|
||||
*
|
||||
* @return the item id, or -1 if none
|
||||
*/
|
||||
private int nextByIDID()
|
||||
{
|
||||
if (iditr.hasNext())
|
||||
{
|
||||
// get the id
|
||||
int id = ((Integer) iditr.next()).intValue();
|
||||
|
||||
return id;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the item as opposed to the item itself when we are
|
||||
* iterating over the TableRow array.
|
||||
*
|
||||
* @return the item id, or -1 if none
|
||||
*/
|
||||
private int nextByRowID()
|
||||
throws SQLException
|
||||
{
|
||||
if (itemRows.hasNext())
|
||||
{
|
||||
TableRow row = itemRows.next();
|
||||
return row.getIntColumn("item_id");
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the next item instantiated from the supplied TableRow
|
||||
*
|
||||
* @return the item or null if none
|
||||
* @throws SQLException
|
||||
*/
|
||||
private Item nextByRow()
|
||||
throws SQLException
|
||||
{
|
||||
if (itemRows.hasNext())
|
||||
{
|
||||
|
@@ -48,6 +48,7 @@ import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.dspace.core.ConfigurationManager;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.LogManager;
|
||||
import org.dspace.eperson.EPerson;
|
||||
@@ -81,18 +82,46 @@ public class PasswordAuthentication
|
||||
private static Logger log = Logger.getLogger(PasswordAuthentication.class);
|
||||
|
||||
/**
|
||||
* Just return true since anyone can self-register by creating new
|
||||
* EPerson.
|
||||
* <p>NOTE: It may be desireable to have this consult a
|
||||
* configuration parameter first.
|
||||
* Look to see if this email address is allowed to register.
|
||||
* <p>
|
||||
* The configuration key authentication.password.domain.valid is examined
|
||||
* in dspace.cfg to see what doamins are valid.
|
||||
* <p>
|
||||
* Example - aber.ac.uk domains : @aber.ac.uk
|
||||
* Example - MIT domain and all .ac.uk domains: @mit.edu, .ac.uk
|
||||
*/
|
||||
public boolean canSelfRegister(Context context,
|
||||
HttpServletRequest request,
|
||||
String username)
|
||||
String email)
|
||||
throws SQLException
|
||||
{
|
||||
// Is there anything set in authentication.password.domain.valid?
|
||||
String domains = ConfigurationManager.getProperty("authentication.password.domain.valid");
|
||||
if ((domains == null) || (domains.trim().equals("")))
|
||||
{
|
||||
// No conditions set, so must be able to self register
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Itterate through all domains
|
||||
String[] options = domains.trim().split(",");
|
||||
String check;
|
||||
email = email.trim().toLowerCase();
|
||||
for (int i = 0; i < options.length; i++)
|
||||
{
|
||||
check = options[i].trim().toLowerCase();
|
||||
if (email.endsWith(check))
|
||||
{
|
||||
// A match, so we can register this user
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// No match
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Nothing extra to initialize.
|
||||
|
Reference in New Issue
Block a user