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 @@ - 4.0.0 - org.dspace - dspace-jspui - DataSpace JSP-UI - war - DataSpace JSP Theme for DSpace 5 + 4.0.0 + org.dspace.modules + jspui + DataSpace JSP-UI + war + DataSpace JSP Theme for DSpace 5 - - - org.dspace - dspace-parent - 5.5 - ./dspace-parent/dspace-5.5-src-release - + + org.dspace + modules + 5.5 + ./dspace-parent/dspace-5.5-src-release/dspace/modules + ${basedir}/dspace-parent/dspace-5.5-src-release + + + oracle-support + + + db.name + oracle + + + + + com.oracle + ojdbc6 + + + + + @@ -32,19 +46,26 @@ org.apache.maven.plugins maven-war-plugin - true - - WEB-INF/lib/*.jar - WEB-INF/lib/*.jar + false true - ${basedir}/src/main/webapp + + ${basedir}/src/main/webapp + WEB-INF/web.xml + + + + org.dspace + dspace-jspui + war + + @@ -52,45 +73,9 @@ - - com.mycila - license-maven-plugin - - - - **/META-INF/** - **/fmt.tld - **/robots.txt - **/readme* - **/scriptaculous/** - **/jquery* - **/bootstrap/** - **/fonts/** - **/resumable.js - - - - - - oracle-support - - - db.name - oracle - - - - - com.oracle - ojdbc6 - - - - - org.dspace @@ -100,20 +85,6 @@ org.dspace dspace-api-lang - - commons-validator - commons-validator - - - javax.servlet - servlet-api - provided - - - javax.servlet - jstl - 1.1.2 - taglibs standard @@ -126,25 +97,24 @@ provided - org.springframework - spring-webmvc - jar + org.dspace.modules + additions - com.google.code.gson - gson + org.dspace + dspace-jspui + war - commons-fileupload - commons-fileupload - 1.3.3 + org.dspace + dspace-jspui jar + classes + + + javax.servlet + servlet-api + provided - - org.mcavallo - opencloud - 0.3 - - diff --git a/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java b/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java index eeaa797..b1ba15b 100644 --- a/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java +++ b/src/main/java/org/dspace/app/webui/jsptag/ItemTag.java @@ -49,6 +49,8 @@ import org.dspace.core.I18nUtil; import org.dspace.core.PluginManager; import org.dspace.core.Utils; +import org.dspace.embargo.EmbargoManager; +import org.dspace.authorize.AuthorizeException; /** *

@@ -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 +}