diff --git a/.circleci/config.yml b/.circleci/config.yml
index 0df60ab..6736a44 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -29,7 +29,7 @@ jobs:
- ~/dataspace-jspui/target
key: circleci-dataspace-jspui-{{ checksum "pom.xml" }}
- run: mvn validate
- - run: mvn dependency:go-offline
+ - run: mvn package
workflows:
maven_test:
diff --git a/pom.xml b/pom.xml
index 91ee5b2..fb8d66d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,27 +1,41 @@
@@ -282,11 +284,19 @@ public int doStartTag() throws JspException if (style.equals("full")) { - renderFull(); + try { + renderFull(); + } catch (AuthorizeException e) { + + } } else { - render(); + try { + render(); + } catch (AuthorizeException e) { + + } } } catch (SQLException sqle) @@ -379,7 +389,7 @@ public void release() /** * Render an item in the given style */ - private void render() throws IOException, SQLException, DCInputsReaderException + private void render() throws IOException, SQLException, AuthorizeException, DCInputsReaderException { JspWriter out = pageContext.getOut(); HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); @@ -388,8 +398,11 @@ private void render() throws IOException, SQLException, DCInputsReaderException String configLine = styleSelection.getConfigurationForStyle(style); Bundle[] bundles = item.getBundles("ORIGINAL"); + + DCDate embargoTerms = EmbargoManager.getEmbargoTermsAsDate(context, item); String tableClasses = "table itemDisplayTable"; - if (bundles.length >= 1 && bundles[0].isEmbargoed()) { + + if (bundles.length >= 1 && embargoTerms != null) { tableClasses = tableClasses + " embargoed"; } if (configLine == null) @@ -480,10 +493,10 @@ else if (eq.length > 2) String label = null; if (!this.style.isEmpty() && !this.style.equals("default")) { - label = I18nUtil.getMessageOrNil("metadata." + this.style + "." + field, context.getCurrentLocale()); + label = I18nUtil.getMessage("metadata." + this.style + "." + field, context.getCurrentLocale()); } if (null == label) { - label = I18nUtil.getMessageOrNil("metadata." + field, context.getCurrentLocale()); + label = I18nUtil.getMessage("metadata." + field, context.getCurrentLocale()); } if (null == label) { label = field; @@ -653,7 +666,7 @@ else if (browseIndex != null) /** * Render full item record */ - private void renderFull() throws IOException, SQLException + private void renderFull() throws IOException, SQLException, AuthorizeException { JspWriter out = pageContext.getOut(); HttpServletRequest request = (HttpServletRequest)pageContext.getRequest(); @@ -767,7 +780,7 @@ private void listCollections() throws IOException /** * List bitstreams in the item */ - private void listBitstreams() throws IOException + private void listBitstreams() throws IOException, AuthorizeException { JspWriter out = pageContext.getOut(); HttpServletRequest request = (HttpServletRequest) pageContext @@ -783,6 +796,9 @@ private void listBitstreams() throws IOException { Bundle[] bundles = item.getBundles("ORIGINAL"); + Context context = UIUtil.obtainContext(request); + DCDate embargoTerms = EmbargoManager.getEmbargoTermsAsDate(context, item); + boolean filesExist = false; for (Bundle bnd : bundles) @@ -802,11 +818,11 @@ private void listBitstreams() throws IOException "org.dspace.app.webui.jsptag.ItemTag.files.no") + ""); } - else if (bundles[0].isEmbargoed()) + else if (embargoTerms != null) { // If the first ORIGINAL bundle is embargoed, then // display a simple notice. -- Mark Ratliff - String email = ConfigurationManager.getProperty(item, "request.item.recipient"); + String email = ConfigurationManager.getProperty(item.getHandle(), "request.item.recipient"); String liftfield = ConfigurationManager.getProperty("embargo.field.lift"); String value = item.getMetadata(liftfield); if (value == null) { value = "unknown"; } @@ -928,8 +944,6 @@ else if (bundles[0].isEmbargoed()) } else { - Context context = UIUtil - .obtainContext(request); boolean showRequestCopy = false; if ("all".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) || ("logged".equalsIgnoreCase(ConfigurationManager.getProperty("request.item.type")) && @@ -1076,7 +1090,7 @@ private void getThumbSettings() } private String requestCopyLink() throws SQLException { - return ConfigurationManager.getProperty(item, "request.copy.link"); + return ConfigurationManager.getProperty(item.getHandle(), "request.copy.link"); } diff --git a/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java b/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java index ebcaf17..cd91a46 100644 --- a/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java +++ b/src/main/java/org/dspace/app/webui/servlet/RequestItemServlet.java @@ -206,7 +206,7 @@ private void processForm (Context context, .getRequestItemAuthor(context, item); DSpaceObject obj = HandleManager.resolveToObject(context, handle); - String recipientEmail = ConfigurationManager.getProperty(obj, "request.item.recipient"); + String recipientEmail = ConfigurationManager.getProperty(handle, "request.item.recipient"); String recipientEmailName = "Request Item Recipent"; email.addArgument(reqname); diff --git a/src/main/java/org/dspace/app/webui/util/ViewAgreement.java b/src/main/java/org/dspace/app/webui/util/ViewAgreement.java index 0def458..00ad950 100644 --- a/src/main/java/org/dspace/app/webui/util/ViewAgreement.java +++ b/src/main/java/org/dspace/app/webui/util/ViewAgreement.java @@ -77,7 +77,21 @@ public static String getText(HttpSession session, Item item) { } else { String filename = viewAgreements.agreements.get(obj).agreementFile; if (filename != null) { - String realFilename = I18nUtil.getAgreementFilename(Locale.getDefault(), filename); + + // This was ported from I18nUtil + Locale locale = Locale.getDefault(); + String realFilename = filename + "_" + locale.getLanguage(); + + if (!("".equals(locale.getCountry()))) + { + realFilename = filename + "_" + locale.getLanguage() + "_" + locale.getCountry(); + + if (!("".equals(locale.getVariant()))) + { + realFilename = filename + "_" + locale.getLanguage() + "_" + locale.getCountry() + "_" + locale.getVariant(); + } + } + try { FileInputStream fisTargetFile = new FileInputStream(new File(realFilename)); theAgreementText = IOUtils.toString(fisTargetFile, "UTF-8"); @@ -219,4 +233,4 @@ public String toString() { (lastTimeAgreed == null ? "never" : lastTimeAgreed), agreementFile); } -} \ No newline at end of file +}