diff --git a/dspace-api/src/main/java/org/dspace/content/crosswalk/MapConverter.java b/dspace-api/src/main/java/org/dspace/content/crosswalk/MapConverter.java new file mode 100644 index 0000000000..b5ad149c41 --- /dev/null +++ b/dspace-api/src/main/java/org/dspace/content/crosswalk/MapConverter.java @@ -0,0 +1,118 @@ +package org.dspace.content.crosswalk; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + +import org.apache.commons.lang.StringUtils; +import org.dspace.core.ConfigurationManager; +import org.dspace.core.SelfNamedPlugin; + +public class MapConverter extends SelfNamedPlugin implements IConverter +{ + /** Location of config file */ + private final String configFilePath = ConfigurationManager + .getProperty("dspace.dir") + + File.separator + + "config" + + File.separator + + "crosswalks" + + File.separator; + + public final String REGEX_PREFIX = "regex."; + + private Properties mapConfig; + private Map regexConfig = new HashMap(); + + private synchronized void init() + { + if (mapConfig != null) + return; + FileInputStream fis = null; + try + { + fis = new FileInputStream(configFilePath + "mapConverter-" + + getPluginInstanceName() + ".properties"); + mapConfig = new Properties(); + mapConfig.load(fis); + fis.close(); + for (Object key : mapConfig.keySet()) + { + String keyS = (String)key; + if (keyS.startsWith(REGEX_PREFIX)) + { + String regex = keyS.substring(REGEX_PREFIX.length()); + String regReplace = mapConfig.getProperty(keyS); + if (regReplace == null) + { + regReplace = ""; + } + else if (regReplace.equalsIgnoreCase("@ident@")) + { + regReplace = "$0"; + } + regexConfig.put(regex,regReplace); + } + } + } + catch (Exception e) + { + throw new IllegalArgumentException( + "Impossibile leggere la configurazione per il converter " + + getPluginInstanceName(), e); + } + finally + { + if (fis != null) + { + try + { + fis.close(); + } + catch (IOException ioe) + { + // ... + } + } + } + + } + + public String makeConversion(String value) + { + if (value == null) return null; + init(); + String tmp = ""; + if (mapConfig.containsKey(value)) + { + tmp = mapConfig.getProperty(value, mapConfig + .getProperty("mapConverter.default")); + } + else + { + tmp = mapConfig.getProperty("mapConverter.default"); + for (String regex : regexConfig.keySet()) + { + if (value != null && value.matches(regex)) + { + tmp = value.replaceAll(regex, regexConfig.get(regex)); + } + } + } + + if ("@@ident@@".equals(tmp)) + { + return value; + } + else if (StringUtils.isNotBlank(tmp)) + { + return tmp; + } + else + return null; + } + +} diff --git a/dspace-api/src/main/java/org/dspace/content/crosswalk/RemoveLastDotConverter.java b/dspace-api/src/main/java/org/dspace/content/crosswalk/RemoveLastDotConverter.java new file mode 100644 index 0000000000..a30ec4d85f --- /dev/null +++ b/dspace-api/src/main/java/org/dspace/content/crosswalk/RemoveLastDotConverter.java @@ -0,0 +1,18 @@ +package org.dspace.content.crosswalk; + +import org.apache.commons.lang.StringUtils; + +public class RemoveLastDotConverter implements IConverter +{ + public String makeConversion(String value) + { + if (StringUtils.isNotBlank(value) && value.endsWith(".")) + { + return value.substring(0, value.length() - 1); + } + else + { + return value; + } + } +} diff --git a/dspace-api/src/main/resources/Messages.properties b/dspace-api/src/main/resources/Messages.properties index c0bbb4fa10..438133a2ab 100644 --- a/dspace-api/src/main/resources/Messages.properties +++ b/dspace-api/src/main/resources/Messages.properties @@ -1719,3 +1719,4 @@ jsp.submit.start-lookup-submission.select.collection.defaultoption = Select... jsp.submit.start-lookup-submission.noresult = No results available! jsp.submit.start-lookup-submission.js.errormessage = Sorry, an error is occurred. Try again. If this message will show again please, contact administrators and continue to insert the submission manually. Thank you. +jsp.submit.start-lookup-submission.js.detailsbuttonmessage = See details \ No newline at end of file diff --git a/dspace-jspui/src/main/java/org/dspace/app/webui/submit/step/JSPStartSubmissionLookupStep.java b/dspace-jspui/src/main/java/org/dspace/app/webui/submit/step/JSPStartSubmissionLookupStep.java index 1fcf7e82c4..df8ac7585d 100644 --- a/dspace-jspui/src/main/java/org/dspace/app/webui/submit/step/JSPStartSubmissionLookupStep.java +++ b/dspace-jspui/src/main/java/org/dspace/app/webui/submit/step/JSPStartSubmissionLookupStep.java @@ -121,7 +121,7 @@ public class JSPStartSubmissionLookupStep extends JSPStep * With no parameters, this servlet prepares for display of the Select * Collection JSP. */ - int collectionID = UIUtil.getIntParameter(request, "collection"); + int collectionID = UIUtil.getIntParameter(request, "collectionid"); Collection col = null; if (collectionID != -1) diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv-error.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv-error.jpg new file mode 100644 index 0000000000..48b2e4085d Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv-error.jpg differ diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv.jpg new file mode 100644 index 0000000000..995a276d3e Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-arxiv.jpg differ diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref-error.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref-error.jpg new file mode 100644 index 0000000000..9ed1077663 Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref-error.jpg differ diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref.jpg new file mode 100644 index 0000000000..9025c4c65e Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-crossref.jpg differ diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed-error.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed-error.jpg new file mode 100644 index 0000000000..c7c92179a7 Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed-error.jpg differ diff --git a/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed.jpg b/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed.jpg new file mode 100644 index 0000000000..27ceb98a4a Binary files /dev/null and b/dspace-jspui/src/main/webapp/image/submission-lookup-small-pubmed.jpg differ diff --git a/dspace-jspui/src/main/webapp/static/js/submission-lookup.js b/dspace-jspui/src/main/webapp/static/js/submission-lookup.js index e30986aeb1..b16d1ca393 100644 --- a/dspace-jspui/src/main/webapp/static/js/submission-lookup.js +++ b/dspace-jspui/src/main/webapp/static/js/submission-lookup.js @@ -106,7 +106,7 @@ submissionLookupShowResult = function(info){ j('#result-list').html(" "); for (var i=0;i').append('Vedi il dettaglio'); + var bt = j('