Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/clarin-dev' into clarin
Browse files Browse the repository at this point in the history
  • Loading branch information
kosarko committed Feb 20, 2020
2 parents 45f6578 + 53dce7b commit f007a67
Show file tree
Hide file tree
Showing 42 changed files with 3,511 additions and 2,388 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
jdk:
- oraclejdk8
- openjdk8
sudo: true
addons:
postgresql: '9.4'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

# clarin-dspace deployments

* LINDAT/CLARIN: https://lindat.mff.cuni.cz/repository/xmlui/
* LINDAT/CLARIAH-CZ: https://lindat.mff.cuni.cz/repository/xmlui/
* CLARINO: https://repo.clarino.uib.no/xmlui/
* CLARIN.SI: https://www.clarin.si/repository/xmlui/
* CLARIN-PL: https://clarin-pl.eu/dspace/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cz.cuni.mff.ufal;

import java.util.Hashtable;
import java.util.concurrent.atomic.AtomicInteger;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
Expand Down Expand Up @@ -44,25 +45,28 @@ public static String parse(NodeList nl) {

} while((n=n.getNextSibling())!=null);

int folderID = 0;
AtomicInteger folderID = new AtomicInteger(0);

StringBuilder result = new StringBuilder();
result.append("<ul class='treeview'>");
for(FileInfo in : root.sub.values()) {
printFileInfo(in, result, ++folderID);
printFileInfo(in, result, folderID);
}
result.append("</ul>");

return result.toString();
}

static void printFileInfo(FileInfo f, StringBuilder result, int folderID) {
static void printFileInfo(FileInfo f, StringBuilder result, AtomicInteger folderID) {
String currentFolderId = "folder_" + folderID.incrementAndGet();
if(f.isDirectory) {
result.append("<li>");
result.append("<span class='foldername'><a role='button' data-toggle='collapse' href='#folder_" + folderID + "'>").append(f.name).append("</a></span>");
result.append("<ul id='folder_" + folderID + "' class='in' style='height: auto;'>");
result.append(String.format(
"<span class='foldername'><a role='button' data-toggle='collapse' href='#%s'>%s</a></span>",
currentFolderId, f.name));
result.append(String.format("<ul id='%s' class='in' style='height: auto;'>", currentFolderId));
for(FileInfo in : f.sub.values()) {
printFileInfo(in, result, ++folderID);
printFileInfo(in, result, folderID);
}
result.append("</ul>");
result.append("</li>");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,8 @@ static int addBitstreamContent(Bitstream b) throws SQLException, AuthorizeExcept
b.addMetadata( schema, element, qualifier, Item.ANY, content );
//don't add more than 1000 files
if(++i >= 1000){
b.addMetadata(schema, element, qualifier, Item.ANY, String.format("%s|%d", "...", 0));
b.addMetadata(schema, element, qualifier, Item.ANY, String.format("%s|%d", "... too many " +
"files ...", 0));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ public static Tracker createOAITrackerInstance(){

public static Tracker createBitstreamTrackerInstance(Collection col){
int defaultSiteId = configurationService.getPropertyAsType("lr.lr.tracker.bitstream.site_id", 0);
boolean disabled = configurationService.getPropertyAsType("lr.lr.tracker.collection."

if(col == null){
//There might be no collection for example if we try downloading as editors during review; the item has
// not been installed in any collection yet.
return new PiwikBitstreamTracker(defaultSiteId);
}

boolean disabled = configurationService.getPropertyAsType("lr.lr.tracker.collection."
+ col.getHandle() + ".disabled", false);
if(disabled){
return noopTracker;
Expand Down
33 changes: 17 additions & 16 deletions dspace-api/src/main/java/org/dspace/app/util/MetadataExposure.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,27 +229,28 @@ else if (segment.length == 2)
hiddenElementSets.get(segment[0]).add(segment[1]);
}

if(value != null && !value.equals("") && !"true".equals(value)){
//select schema
Map<String, Map<String,String>> elements = hiddenConditions.get(segment[0]);
if(elements == null){
elements = new HashMap<String, Map<String,String>>();
hiddenConditions.put(segment[0], elements);
}
//select element
Map<String,String> qualifiers = elements.get(segment[1]);
if(qualifiers == null){
qualifiers = new HashMap<String,String>();
elements.put(segment[1], qualifiers);
}
qualifiers.put(qualifier, value);
}

// oops..
else
{
log.warn("Bad format in hidden metadata directive, field=\""+mdField+"\", config property="+key);
}

if(value != null && !value.equals("") && !"true".equals(value)){
//select schema
Map<String, Map<String,String>> elements = hiddenConditions.get(segment[0]);
if(elements == null){
elements = new HashMap<String, Map<String,String>>();
hiddenConditions.put(segment[0], elements);
}
//select element
Map<String,String> qualifiers = elements.get(segment[1]);
if(qualifiers == null){
qualifiers = new HashMap<String,String>();
elements.put(segment[1], qualifiers);
}
qualifiers.put(qualifier, value);
}

}
}
}
Expand Down
27 changes: 13 additions & 14 deletions dspace-api/src/main/java/org/dspace/eperson/EPerson.java
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ public static EPerson[] search(Context context, String query, int offset, int li
" LEFT JOIN metadatavalue fn on (resource_id=e.eperson_id AND fn.resource_type_id=? and fn.metadata_field_id=?) " +
" LEFT JOIN metadatavalue ln on (ln.resource_id=e.eperson_id AND ln.resource_type_id=? and ln.metadata_field_id=?) " +
" WHERE e.eperson_id = ? OR " +
"LOWER(fn.text_value) LIKE LOWER(?) OR LOWER(ln.text_value) LIKE LOWER(?) OR LOWER(email) LIKE LOWER(?) ORDER BY ");
"COALESCE(LOWER(fn.text_value),'') LIKE LOWER(?) OR " +
"COALESCE(LOWER(ln.text_value),'') LIKE LOWER(?) OR " +
"COALESCE(LOWER(email),'') LIKE LOWER(?) " +
"ORDER BY ");

queryBuf.append(order_by);

Expand Down Expand Up @@ -455,26 +458,22 @@ public static int searchResultCount(Context context, String query)
}

// Get all the epeople that match the query
TableRow row = DatabaseManager.querySingle(context,
"SELECT count(*) as epcount FROM eperson " +
"WHERE eperson_id = ? OR " +
"LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " +
"OR LOWER((select text_value from metadatavalue where resource_id=? and resource_type_id=? and metadata_field_id=?)) LIKE LOWER(?) " +
"OR LOWER(eperson.email) LIKE LOWER(?)",
TableRow row = DatabaseManager.querySingle(context,"select count(e.*) as epcount from eperson e " +
" LEFT JOIN metadatavalue fn on (resource_id=e.eperson_id AND fn.resource_type_id=? and fn.metadata_field_id=?) " +
" LEFT JOIN metadatavalue ln on (ln.resource_id=e.eperson_id AND ln.resource_type_id=? and ln.metadata_field_id=?) " +
" WHERE e.eperson_id = ? OR " +
"COALESCE(LOWER(fn.text_value),'') LIKE LOWER(?) OR " +
"COALESCE(LOWER(ln.text_value),'') LIKE LOWER(?) OR " +
"COALESCE(LOWER(email),'') LIKE LOWER(?)",
new Object[] {
int_param,

int_param,
Constants.EPERSON,
MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "firstname", null).getFieldID(),
dbquery,

int_param,
Constants.EPERSON,
MetadataField.findByElement(context, MetadataSchema.find(context, "eperson").getSchemaID(), "lastname", null).getFieldID(),
dbquery,

dbquery
int_param,
dbquery, dbquery, dbquery
});

// use getIntColumn for Oracle count data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ public String contextAction (Model model, HttpServletRequest request, HttpServle

if(configurationService.getBooleanProperty("lr", "lr.tracker.enabled", false)) {
// Track the OAI request for analytics platform
TrackerFactory.createOAITrackerInstance().trackPage(request, "LINDAT/CLARIN OAI-PMH Data Provider " +
TrackerFactory.createOAITrackerInstance().trackPage(request, "Repository OAI-PMH Data Provider " +
"Endpoint");
}

Expand Down
4 changes: 2 additions & 2 deletions dspace-oai/src/main/webapp/static/style.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<xsl:template match="/">
<html>
<head>
<title>LINDAT/CLARIN OAI-PMH Data Provider Endpoint</title>
<title>LINDAT/CLARIAH-CZ OAI-PMH Data Provider Endpoint</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script src="static/js/jquery.js" type="text/javascript"></script>
Expand All @@ -35,7 +35,7 @@
<div class="container">
<div class="navbar navbar-default" role="navigation">
<div class="navbar-header">
<a class="navbar-brand" href="#">LINDAT/CLARIN OAI-PMH Data Provider Endpoint</a>
<a class="navbar-brand" href="#">LINDAT/CLARIAH-CZ OAI-PMH Data Provider Endpoint</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav navbar-right">
Expand Down
16 changes: 1 addition & 15 deletions dspace-xmlui/src/main/webapp/exception2html.xslt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
xmlns:dim="http://www.dspace.org/xmlns/dspace/dim"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:mods="http://www.loc.gov/mods/v3"
xmlns:file="java.io.File"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:confman="org.dspace.core.ConfigurationManager"
xmlns="http://www.w3.org/1999/xhtml"
Expand Down Expand Up @@ -259,21 +258,8 @@
<script type="text/javascript" src="{$contextPath}/themes/UFAL/lib/js/jquery-ui.js">&#160;</script>
<script type="text/javascript" src="{$contextPath}/themes/UFAL/lib/js/jquery.i18n.js">&#160;</script>
<script type="text/javascript">
<xsl:variable name="currentLocale">
<xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='page'][@qualifier='currentLocale']"/>
</xsl:variable>
<xsl:attribute name="src">
<xsl:variable name="localizedContextPath" select="concat($theme-path,'/lib/js/messages/messages_',$currentLocale,'.js')" />
<xsl:variable name="localizedDiskPath" select="concat($theme-path-on-disk,'/lib/js/messages/messages_',$currentLocale,'.js')" />
<xsl:variable name="path" select="file:new($localizedDiskPath)"/>
<xsl:choose>
<xsl:when test="file:isFile($path)">
<xsl:value-of select="$localizedContextPath" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat($theme-path,'/lib/js/messages/messages.js')" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat($contextPath,$theme-path,'/lib/js/messages/messages.js')" />
</xsl:attribute>&#160;</script>

<script type="text/javascript" src="{concat($aaiURL, '/discojuice/discojuice-2.1.en.min.js')}">&#160;</script>
Expand Down
8 changes: 4 additions & 4 deletions dspace-xmlui/src/main/webapp/i18n/messages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
-->

<!-- General keys -->
<message key="xmlui.general.dspace_home">LINDAT/CLARIN Repository Home</message>
<message key="xmlui.general.dspace_home">LINDAT/CLARIAH-CZ Repository Home</message>
<message key="xmlui.general.search">Search</message>
<message key="xmlui.general.go">Go</message>
<message key="xmlui.general.go_home">Back to repository homepage</message>
Expand Down Expand Up @@ -74,7 +74,7 @@
<!--
This section is for feed syndication (RSS, atom, etc)
-->
<message key="xmlui.feed.general_description">The LINDAT/CLARIN digital repository system captures, stores, indexes, preserves, and distributes digital research material.</message>
<message key="xmlui.feed.general_description">The LINDAT/CLARIAH-CZ digital repository system captures, stores, indexes, preserves, and distributes digital research material.</message>
<message key="xmlui.feed.header">RSS Feeds</message>
<message key="xmlui.feed.logo_title">The Channel Image</message>
<message key="xmlui.feed.untitled">Untitled</message>
Expand Down Expand Up @@ -611,7 +611,7 @@
<!-- org.dspace.app.xmlui.eperson.WelcomeLogin.java -->
<message key="xmlui.EPerson.WelcomeLogin.title">Welcome message</message>
<message key="xmlui.EPerson.WelcomeLogin.trail">Welcome message</message>
<message key="xmlui.EPerson.WelcomeLogin.head1">Welcome to LINDAT/CLARIN Repository</message>
<message key="xmlui.EPerson.WelcomeLogin.head1">Welcome to LINDAT/CLARIAH-CZ Repository</message>
<message key="xmlui.EPerson.WelcomeLogin.head2">Privacy Statement</message>
<message key="xmlui.EPerson.WelcomeLogin.para1">The information released by your IdP (home organisation) is shown below.</message>
<message key="xmlui.EPerson.WelcomeLogin.warn1"><div class="bold text-error">We use only the required attributes as stated in <a href="http://lindat.mff.cuni.cz/privacypolicy.html" target="_blank" class="bold">http://lindat.mff.cuni.cz/privacypolicy.html</a>.<BR />However, we may log the attributes and keep them for a time period.</div></message>
Expand Down Expand Up @@ -2939,7 +2939,7 @@

<!-- ufal theme -->
<message key="UFAL.firstpage.title">Repository</message>
<message key="UFAL.firstpage.title.text">Welcome to LINDAT/CLARIN - Centre for Language Research Infrastructure in the Czech Republic</message>
<message key="UFAL.firstpage.title.text">Welcome to LINDAT/CLARIAH-CZ - Centre for Language Research Infrastructure in the Czech Republic</message>

<!-- UFAL/lib/xsl/aspect/artifactbrowser/item-list.xsl -->
<message key="xmlui.UFAL.artifactbrowser.item-contains-one-file">This item contains {0} file ({1}).</message>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f007a67

Please sign in to comment.