Merge branch 'develop' of https://github.com/vivo-project/Vitro into develop
This commit is contained in:
commit
bdaa8393ae
5 changed files with 70 additions and 4 deletions
|
@ -18,6 +18,7 @@ import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
@ -39,6 +40,10 @@ public class ConfigurationPropertiesSmokeTests implements
|
||||||
private static final String PROPERTY_DB_DRIVER_CLASS_NAME = "VitroConnection.DataSource.driver";
|
private static final String PROPERTY_DB_DRIVER_CLASS_NAME = "VitroConnection.DataSource.driver";
|
||||||
private static final String PROPERTY_DB_TYPE = "VitroConnection.DataSource.dbtype";
|
private static final String PROPERTY_DB_TYPE = "VitroConnection.DataSource.dbtype";
|
||||||
private static final String PROPERTY_DEFAULT_NAMESPACE = "Vitro.defaultNamespace";
|
private static final String PROPERTY_DEFAULT_NAMESPACE = "Vitro.defaultNamespace";
|
||||||
|
private static final String PROPERTY_LANGUAGE_BUILD = "languages.addToBuild";
|
||||||
|
private static final String PROPERTY_LANGUAGE_SELECTABLE = "languages.selectableLocales";
|
||||||
|
private static final String PROPERTY_LANGUAGE_FORCE = "languages.forceLocale";
|
||||||
|
private static final String PROPERTY_LANGUAGE_FILTER = "RDFService.languageFilter";
|
||||||
|
|
||||||
private static final String DEFAULT_DB_DRIVER_CLASS = "com.mysql.jdbc.Driver";
|
private static final String DEFAULT_DB_DRIVER_CLASS = "com.mysql.jdbc.Driver";
|
||||||
|
|
||||||
|
@ -51,6 +56,7 @@ public class ConfigurationPropertiesSmokeTests implements
|
||||||
checkHomeDirectory(ctx, props, ss);
|
checkHomeDirectory(ctx, props, ss);
|
||||||
checkDatabaseConnection(ctx, props, ss);
|
checkDatabaseConnection(ctx, props, ss);
|
||||||
checkDefaultNamespace(ctx, props, ss);
|
checkDefaultNamespace(ctx, props, ss);
|
||||||
|
checkLanguages(props, ss);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -283,6 +289,56 @@ public class ConfigurationPropertiesSmokeTests implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Warn if we set up the languages incorrectly:
|
||||||
|
*
|
||||||
|
* Must build with a language in order to select languages. Can't select
|
||||||
|
* languages and force language. Shouldn't build with language unless
|
||||||
|
* language filtering is enabled.
|
||||||
|
*/
|
||||||
|
private void checkLanguages(ConfigurationProperties props, StartupStatus ss) {
|
||||||
|
String buildString = props.getProperty(PROPERTY_LANGUAGE_BUILD);
|
||||||
|
boolean buildWithLanguages = StringUtils.isNotEmpty(buildString);
|
||||||
|
|
||||||
|
String selectString = props.getProperty(PROPERTY_LANGUAGE_SELECTABLE);
|
||||||
|
boolean selectableLanguages = StringUtils.isNotEmpty(selectString);
|
||||||
|
|
||||||
|
String forceString = props.getProperty(PROPERTY_LANGUAGE_FORCE);
|
||||||
|
boolean forceLanguage = StringUtils.isNotEmpty(forceString);
|
||||||
|
|
||||||
|
String filterString = props.getProperty(PROPERTY_LANGUAGE_FILTER,
|
||||||
|
"true");
|
||||||
|
boolean languageFilter = Boolean.valueOf(filterString);
|
||||||
|
|
||||||
|
if (selectableLanguages && !buildWithLanguages) {
|
||||||
|
ss.warning(this, String.format("Problem with Language setup - "
|
||||||
|
+ "runtime.properties specifies a "
|
||||||
|
+ "list of selectable languages (%s = %s), but "
|
||||||
|
+ "build.properties did not include any languages with %s",
|
||||||
|
PROPERTY_LANGUAGE_SELECTABLE, selectString,
|
||||||
|
PROPERTY_LANGUAGE_BUILD));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectableLanguages && forceLanguage) {
|
||||||
|
ss.warning(this, String.format("Problem with Language setup - "
|
||||||
|
+ "runtime.properties specifies a "
|
||||||
|
+ "forced locale (%s = %s), and also a list of selectable "
|
||||||
|
+ "languages (%s = %s). These options are incompatible.",
|
||||||
|
PROPERTY_LANGUAGE_FORCE, forceString,
|
||||||
|
PROPERTY_LANGUAGE_SELECTABLE, selectString));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buildWithLanguages && !languageFilter) {
|
||||||
|
ss.warning(this, String.format("Problem with Language setup - "
|
||||||
|
+ "build.properties includes one or more additional "
|
||||||
|
+ "languages (%s = %s), but runtime.properties has "
|
||||||
|
+ "disabled language filtering (%s = %s). This will "
|
||||||
|
+ "likely result in a mix of languages in the "
|
||||||
|
+ "application.", PROPERTY_LANGUAGE_BUILD, buildString,
|
||||||
|
PROPERTY_LANGUAGE_FILTER, filterString));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void contextDestroyed(ServletContextEvent sce) {
|
public void contextDestroyed(ServletContextEvent sce) {
|
||||||
// nothing to do at shutdown
|
// nothing to do at shutdown
|
||||||
|
|
|
@ -37,6 +37,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.DataGetter;
|
||||||
* code = [the code for the Locale, e.g. "en_US"]
|
* code = [the code for the Locale, e.g. "en_US"]
|
||||||
* label = [the alt text for the Locale, e.g. "Spanish (Spain)"]
|
* label = [the alt text for the Locale, e.g. "Spanish (Spain)"]
|
||||||
* imageUrl = [the URL of the image that represents the Locale]
|
* imageUrl = [the URL of the image that represents the Locale]
|
||||||
|
* selected = [true, if this locale is currently selected]
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
|
|
|
@ -129,6 +129,10 @@ public abstract class PropertyTemplateModel extends BaseTemplateModel {
|
||||||
return rangeUri;
|
return rangeUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDomainUri() {
|
||||||
|
return domainUri;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAddUrl() {
|
public String getAddUrl() {
|
||||||
//log.info("addUrl=" + addUrl);
|
//log.info("addUrl=" + addUrl);
|
||||||
return (addUrl != null) ? addUrl : "";
|
return (addUrl != null) ? addUrl : "";
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<article class="property" role="article">
|
<article class="property" role="article">
|
||||||
<#-- Property display name -->
|
<#-- Property display name -->
|
||||||
<#if rangeClass == "Authorship" && editable >
|
<#if rangeClass == "Authorship" && editable && property.domainUri?contains("Person")>
|
||||||
<h3 id="${property.localName}-${rangeClass}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
<h3 id="${property.localName}-${rangeClass}">${property.name} <@p.addLink property editable /> <@p.verboseDisplay property />
|
||||||
<a id="managePubLink" class="manageLinks" href="${urls.base}/managePublications?subjectUri=${subjectUri[1]!}" title="${i18n().manage_publications_link}" <#if verbose>style="padding-top:10px"</#if> >
|
<a id="managePubLink" class="manageLinks" href="${urls.base}/managePublications?subjectUri=${subjectUri[1]!}" title="${i18n().manage_publications_link}" <#if verbose>style="padding-top:10px"</#if> >
|
||||||
${i18n().manage_publications_link}
|
${i18n().manage_publications_link}
|
||||||
|
|
|
@ -128,16 +128,21 @@ name will be used as the label. -->
|
||||||
<#else>
|
<#else>
|
||||||
<#local rangeUri = "" />
|
<#local rangeUri = "" />
|
||||||
</#if>
|
</#if>
|
||||||
|
<#if property.domainUri?? >
|
||||||
|
<#local domainUri = property.domainUri />
|
||||||
|
<#else>
|
||||||
|
<#local domainUri = "" />
|
||||||
|
</#if>
|
||||||
<#if editable>
|
<#if editable>
|
||||||
<#local url = property.addUrl>
|
<#local url = property.addUrl>
|
||||||
<#if url?has_content>
|
<#if url?has_content>
|
||||||
<@showAddLink property.localName label url rangeUri/>
|
<@showAddLink property.localName label url rangeUri domainUri/>
|
||||||
</#if>
|
</#if>
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#macro showAddLink propertyLocalName label url rangeUri>
|
<#macro showAddLink propertyLocalName label url rangeUri domainUri="">
|
||||||
<#if rangeUri?contains("Authorship") || rangeUri?contains("URL") || rangeUri?contains("Editorship") || label == "hasResearchArea">
|
<#if (rangeUri?contains("Authorship") && domainUri?contains("IAO_0000030")) || (rangeUri?contains("Editorship") && domainUri?contains("IAO_0000030"))|| rangeUri?contains("URL") || label == "hasResearchArea">
|
||||||
<a class="add-${propertyLocalName}" href="${url}" title="${i18n().manage_list_of} ${label?lower_case}">
|
<a class="add-${propertyLocalName}" href="${url}" title="${i18n().manage_list_of} ${label?lower_case}">
|
||||||
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${i18n().manage}" /></a>
|
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${i18n().manage}" /></a>
|
||||||
<#else>
|
<#else>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue