mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-17 15:03:18 +00:00
Update js function to jquery.1.10.x, added logo external bib service image, added mapconverter and configuration
This commit is contained in:
@@ -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<String, String> regexConfig = new HashMap<String, String>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1699,3 +1699,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
|
Reference in New Issue
Block a user