updates for multiple language labels and concept semantic types
This commit is contained in:
parent
b8e114c4e8
commit
fc9ac52786
11 changed files with 72 additions and 152 deletions
|
@ -7,6 +7,8 @@ import java.lang.Integer;
|
||||||
import java.lang.String;
|
import java.lang.String;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -31,6 +33,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.i18n.selection.SelectedLocale;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ExecuteDataRetrieval;
|
import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.ExecuteDataRetrieval;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper;
|
import edu.cornell.mannlib.vitro.webapp.web.beanswrappers.ReadOnlyBeansWrapper;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.IndividualTemplateModel;
|
||||||
|
@ -108,6 +111,8 @@ class IndividualResponseBuilder {
|
||||||
*/
|
*/
|
||||||
// body.put("individual", wrap(itm, BeansWrapper.EXPOSE_SAFE));
|
// body.put("individual", wrap(itm, BeansWrapper.EXPOSE_SAFE));
|
||||||
body.put("labelCount", getLabelCount(itm.getUri(), vreq));
|
body.put("labelCount", getLabelCount(itm.getUri(), vreq));
|
||||||
|
//We also need to know the number of available locales
|
||||||
|
body.put("localesCount", SelectedLocale.getSelectableLocales(vreq).size());
|
||||||
body.put("profileType", getProfileType(itm.getUri(), vreq));
|
body.put("profileType", getProfileType(itm.getUri(), vreq));
|
||||||
body.put("individual", wrap(itm, new ReadOnlyBeansWrapper()));
|
body.put("individual", wrap(itm, new ReadOnlyBeansWrapper()));
|
||||||
|
|
||||||
|
|
|
@ -258,6 +258,7 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen
|
||||||
HashMap<String, String> localeCodeToNameMap = this.getFullCodeToLanguageNameMap(locales);
|
HashMap<String, String> localeCodeToNameMap = this.getFullCodeToLanguageNameMap(locales);
|
||||||
//the labels already added by the user
|
//the labels already added by the user
|
||||||
ArrayList<Literal> existingLabels = this.getExistingLabels(config.getSubjectUri(), vreq);
|
ArrayList<Literal> existingLabels = this.getExistingLabels(config.getSubjectUri(), vreq);
|
||||||
|
int numberExistingLabels = existingLabels.size();
|
||||||
//existing labels keyed by language name and each of the list of labels is sorted by language name
|
//existing labels keyed by language name and each of the list of labels is sorted by language name
|
||||||
HashMap<String, List<LabelInformation>> existingLabelsByLanguageName = this.getLabelsSortedByLanguageName(existingLabels, localeCodeToNameMap, config, vreq);
|
HashMap<String, List<LabelInformation>> existingLabelsByLanguageName = this.getLabelsSortedByLanguageName(existingLabels, localeCodeToNameMap, config, vreq);
|
||||||
//Get available locales for the drop down for adding a new label, also sorted by language name
|
//Get available locales for the drop down for adding a new label, also sorted by language name
|
||||||
|
@ -270,6 +271,7 @@ public class ManageLabelsForIndividualGenerator extends BaseEditConfigurationGen
|
||||||
//Save labels sorted by language name, untyped have "untyped" as the language name value
|
//Save labels sorted by language name, untyped have "untyped" as the language name value
|
||||||
config.addFormSpecificData("labelsSortedByLanguageName", existingLabelsByLanguageName);
|
config.addFormSpecificData("labelsSortedByLanguageName", existingLabelsByLanguageName);
|
||||||
config.addFormSpecificData("selectLocale",availableLocalesForAdd);
|
config.addFormSpecificData("selectLocale",availableLocalesForAdd);
|
||||||
|
config.addFormSpecificData("displayRemoveLink", (numberExistingLabels > 1));
|
||||||
|
|
||||||
|
|
||||||
//How do we edit? Will need to see
|
//How do we edit? Will need to see
|
||||||
|
|
|
@ -1,125 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
|
||||||
import com.hp.hpl.jena.query.Query;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
|
||||||
import com.hp.hpl.jena.query.Syntax;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResIterator;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.DatasetWrapper;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.DatasetWrapperFactory;
|
|
||||||
|
|
||||||
//We are representing semantic types from the UMLS Semantic Network as OWL Classes
|
|
||||||
//and this preprocessor will add the appropriate class information to the TBox
|
|
||||||
|
|
||||||
public class ConceptSemanticTypesPreprocessor implements ModelChangePreprocessor {
|
|
||||||
|
|
||||||
private static String VIVOCore = "http://vivoweb.org/ontology/core#";
|
|
||||||
private static String SKOSConceptType = "http://www.w3.org/2004/02/skos/core#Concept";
|
|
||||||
private Log log = LogFactory.getLog(ConceptSemanticTypesPreprocessor.class);
|
|
||||||
|
|
||||||
private OntModel toUpdateModel = null;
|
|
||||||
|
|
||||||
//Custom constructor
|
|
||||||
public ConceptSemanticTypesPreprocessor(OntModel updateModel) {
|
|
||||||
this.toUpdateModel = updateModel;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void preprocess(Model retractionsModel, Model additionsModel,
|
|
||||||
HttpServletRequest request) {
|
|
||||||
//Run a construct query against the additions model
|
|
||||||
String prefixes = "PREFIX rdfs:<" + RDFS.getURI() + "> " +
|
|
||||||
"PREFIX owl:<http://www.w3.org/2002/07/owl#> " +
|
|
||||||
"PREFIX rdf:<" + RDF.getURI() + ">" +
|
|
||||||
"PREFIX skos:<http://www.w3.org/2004/02/skos/core#>";
|
|
||||||
String constructQuery = prefixes + " CONSTRUCT { " +
|
|
||||||
"?semanticType rdf:type owl:Class. " +
|
|
||||||
"?semanticType rdfs:subClassOf skos:Concept . " +
|
|
||||||
"?semanticType rdfs:label ?label. " +
|
|
||||||
"} WHERE { " +
|
|
||||||
"?concept rdf:type ?semanticType. " +
|
|
||||||
"?semanticType rdfs:label ?label . " +
|
|
||||||
"?semanticType rdfs:subClassOf skos:Concept . " +
|
|
||||||
"}";
|
|
||||||
|
|
||||||
//Execute construct query
|
|
||||||
Model constructedModel = ModelFactory.createDefaultModel();
|
|
||||||
|
|
||||||
|
|
||||||
log.debug("CONSTRUCT query string " + constructQuery);
|
|
||||||
|
|
||||||
Query query = null;
|
|
||||||
try {
|
|
||||||
query = QueryFactory.create(constructQuery, Syntax.syntaxARQ);
|
|
||||||
} catch(Throwable th){
|
|
||||||
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
|
||||||
"string. " + th.getMessage());
|
|
||||||
log.error(constructQuery);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
additionsModel.getLock().enterCriticalSection(Lock.READ);
|
|
||||||
QueryExecution qe = null;
|
|
||||||
try {
|
|
||||||
qe = QueryExecutionFactory.create(
|
|
||||||
query, additionsModel);
|
|
||||||
qe.execConstruct(constructedModel);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error getting constructed model for query string " + constructQuery);
|
|
||||||
} finally {
|
|
||||||
if (qe != null) {
|
|
||||||
qe.close();
|
|
||||||
}
|
|
||||||
additionsModel.getLock().leaveCriticalSection();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Add constructed model to the designated update model
|
|
||||||
toUpdateModel.enterCriticalSection(Lock.WRITE);
|
|
||||||
try {
|
|
||||||
toUpdateModel.add(constructedModel);
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error adding statements to update model for " + constructQuery);
|
|
||||||
} finally {
|
|
||||||
toUpdateModel.leaveCriticalSection();
|
|
||||||
}
|
|
||||||
|
|
||||||
//Take this constructed model and remove from the additions model
|
|
||||||
additionsModel.enterCriticalSection(Lock.WRITE);
|
|
||||||
try {
|
|
||||||
additionsModel.remove(constructedModel.listStatements().toList());
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error removing statements from additions model for " + constructQuery);
|
|
||||||
} finally {
|
|
||||||
additionsModel.leaveCriticalSection();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -676,6 +676,8 @@ no_image = no image
|
||||||
placeholder_image = placeholder image
|
placeholder_image = placeholder image
|
||||||
manage_labels = manage labels
|
manage_labels = manage labels
|
||||||
manage_list_of_labels = manage list of labels
|
manage_list_of_labels = manage list of labels
|
||||||
|
view_list_of_labels = view list of labels
|
||||||
|
view = view
|
||||||
add_label = Add Label
|
add_label = Add Label
|
||||||
add_label_for_language = Language
|
add_label_for_language = Language
|
||||||
unsupported_ie_version = This form is not supported in versions of Internet Explorer below version 8. Please upgrade your browser, or switch to another browser, such as FireFox.
|
unsupported_ie_version = This form is not supported in versions of Internet Explorer below version 8. Please upgrade your browser, or switch to another browser, such as FireFox.
|
||||||
|
@ -705,9 +707,10 @@ delete_entry_capitalized = Delete this entry?
|
||||||
add_new_of_type = Add a new item of this type
|
add_new_of_type = Add a new item of this type
|
||||||
create_new_entry = Please create a new entry.
|
create_new_entry = Please create a new entry.
|
||||||
no_appropriate_entry = If you don't find the appropriate entry on the selection list above
|
no_appropriate_entry = If you don't find the appropriate entry on the selection list above
|
||||||
|
return_to_individual = Return to Individual Page
|
||||||
remove_menu_item = Remove menu item
|
remove_menu_item = Remove menu item
|
||||||
confirm_menu_item_delete = Are you sure you want to remove
|
confirm_menu_item_delete = Are you sure you want to remove
|
||||||
|
remove_capitalized = Remove
|
||||||
|
|
||||||
pretty_url = Pretty URL
|
pretty_url = Pretty URL
|
||||||
start_with_leading_slash = Must begin with a leading forward slash: / (e.g., /people)
|
start_with_leading_slash = Must begin with a leading forward slash: / (e.g., /people)
|
||||||
|
|
BIN
webapp/web/images/individual/manage-icon.png
Normal file
BIN
webapp/web/images/individual/manage-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 442 B |
|
@ -182,13 +182,21 @@ var manageLabels = {
|
||||||
//See if there are any other remove link
|
//See if there are any other remove link
|
||||||
if(languageName != "untyped") {
|
if(languageName != "untyped") {
|
||||||
//find if there are any other remove links for the same language
|
//find if there are any other remove links for the same language
|
||||||
|
var allRemoveLinks = manageLabels.existingLabelsList.find("a.remove");
|
||||||
var removeLinks = manageLabels.existingLabelsList.find("a.remove[languageName='" + languageName + "']");
|
var removeLinks = manageLabels.existingLabelsList.find("a.remove[languageName='" + languageName + "']");
|
||||||
if(removeLinks.length == 0) {
|
if(removeLinks.length == 0) {
|
||||||
//if there aren't any other labels for this language, also remove the heading
|
//if there aren't any other labels for this language, also remove the heading
|
||||||
manageLabels.existingLabelsList.find("h3[languageName='" + languageName + "']").remove();
|
manageLabels.existingLabelsList.find("h3[languageName='" + languageName + "']").remove();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//Check to see if there is only one label left on the page, if so remove or hide the remove link
|
||||||
|
if(allRemoveLinks.length == 1) {
|
||||||
|
allRemoveLinks.remove();
|
||||||
|
//These will be removed instead of hidden because currently add will reload the page
|
||||||
|
//whereas remove executes an ajax query and the page isn't reloaded
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
//Determine if there are new locales that can be added to the options once a delete has occurred
|
//Determine if there are new locales that can be added to the options once a delete has occurred
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
<#if !labelCount??>
|
<#if !labelCount??>
|
||||||
<#assign labelCount = 0 >
|
<#assign labelCount = 0 >
|
||||||
</#if>
|
</#if>
|
||||||
|
<#if !localesCount??>
|
||||||
|
<#assign localesCount = 1>
|
||||||
|
</#if>
|
||||||
|
|
||||||
<#-- Default individual profile page template -->
|
<#-- Default individual profile page template -->
|
||||||
<#--@dumpAll /-->
|
<#--@dumpAll /-->
|
||||||
|
@ -32,7 +35,7 @@
|
||||||
<#else>
|
<#else>
|
||||||
<h1 class="fn">
|
<h1 class="fn">
|
||||||
<#-- Label -->
|
<#-- Label -->
|
||||||
<@p.label individual editable labelCount />
|
<@p.label individual editable labelCount localesCount/>
|
||||||
|
|
||||||
<#-- Most-specific types -->
|
<#-- Most-specific types -->
|
||||||
<@p.mostSpecificTypes individual />
|
<@p.mostSpecificTypes individual />
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
<#include "manageLabelsForIndividualTerms.ftl" >
|
||||||
<#-- Custom form for managing labels for individuals -->
|
<#-- Custom form for managing labels for individuals -->
|
||||||
<#import "manageLabelsForIndividualMacros.ftl" as m >
|
<#import "manageLabelsForIndividualMacros.ftl" as m >
|
||||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||||
|
@ -13,6 +13,10 @@
|
||||||
<#if editConfiguration.pageData.editable?has_content>
|
<#if editConfiguration.pageData.editable?has_content>
|
||||||
<#assign editable = editConfiguration.pageData.editable />
|
<#assign editable = editConfiguration.pageData.editable />
|
||||||
</#if>
|
</#if>
|
||||||
|
<#assign displayRemoveLink = true/>
|
||||||
|
<#if editConfiguration.pageData.displayRemoveLink?has_content>
|
||||||
|
<#assign displayRemoveLink = editConfiguration.pageData.displayRemoveLink/>
|
||||||
|
</#if>
|
||||||
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
|
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
|
||||||
<#assign submissionErrors = editSubmission.validationErrors/>
|
<#assign submissionErrors = editSubmission.validationErrors/>
|
||||||
<#assign submissionErrorsExist = "true" />
|
<#assign submissionErrorsExist = "true" />
|
||||||
|
@ -60,7 +64,7 @@
|
||||||
<#include "manageLabelsForIndividualSubmissionErrors.ftl">
|
<#include "manageLabelsForIndividualSubmissionErrors.ftl">
|
||||||
<div id="showAddForm">
|
<div id="showAddForm">
|
||||||
<input type="submit" value="${i18n().add_label}" id="showAddFormButton" name="showAddFormButton"> ${i18n().or}
|
<input type="submit" value="${i18n().add_label}" id="showAddFormButton" name="showAddFormButton"> ${i18n().or}
|
||||||
<a class="cancel" href="${cancelUrl}&url=/individual" title="${i18n().return_to_profile}">${i18n().return_to_profile}</a>
|
<a class="cancel" href="${cancelUrl}&url=/individual" title="${returnText}">${returnText}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<#include "manageLabelsForIndividualAddForm.ftl" >
|
<#include "manageLabelsForIndividualAddForm.ftl" >
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
<#--LabelsSorted is a hash keyed by language name where the value is a list of LabelInformation class objects-->
|
<#--LabelsSorted is a hash keyed by language name where the value is a list of LabelInformation class objects-->
|
||||||
<#macro displayExistingLabelsForLanguage lang labelsSorted editable editGenerator>
|
<#macro displayExistingLabelsForLanguage lang labelsSorted editable editGenerator displayRemoveLink=true>
|
||||||
<#--get label information for this language-->
|
<#--get label information for this language-->
|
||||||
<#assign labelList = labelsSorted[lang] />
|
<#assign labelList = labelsSorted[lang] />
|
||||||
<#--Reset for every language-->
|
<#--Reset for every language-->
|
||||||
<#assign labelSeq = []/>
|
<#assign labelSeq = []/>
|
||||||
|
|
||||||
<#list labelList as labelObject>
|
<#list labelList as labelObject>
|
||||||
<#assign labelLiteral = labelObject.labelLiteral />
|
<#assign labelLiteral = labelObject.labelLiteral />
|
||||||
<#assign labelStringValue = labelObject.labelStringValue />
|
<#assign labelStringValue = labelObject.labelStringValue />
|
||||||
|
@ -25,19 +26,16 @@
|
||||||
<#assign labelStr = label >
|
<#assign labelStr = label >
|
||||||
<#assign tagOrTypeStr = "" >
|
<#assign tagOrTypeStr = "" >
|
||||||
</#if>
|
</#if>
|
||||||
<li>${labelStr} <#if labelSeq?seq_contains(labelStr)> (duplicate value) </#if>
|
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
|
||||||
<#if editable && labelEditLink?has_content> <a href="${labelEditLink}&${editGenerator}">Edit</a>
|
|
||||||
<a href="${urls.base}/edit/primitiveRdfEdit" languageName="${labelLang}" languageCode="${languageCode}"
|
|
||||||
labelValue="${labelStr}" tagOrType="${tagOrTypeStr!}" class="remove" title="${i18n().remove_capitalized}">${i18n().remove_capitalized}</a>
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<#assign labelSeq = labelSeq + [labelStr]>
|
<#assign labelSeq = labelSeq + [labelStr]>
|
||||||
</#list>
|
</#list>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#--ignore 'untyped' and display everything-->
|
<#--ignore 'untyped' and display everything-->
|
||||||
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator>
|
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator displayRemoveLink=true>
|
||||||
|
|
||||||
|
|
||||||
<#list langList as lang>
|
<#list langList as lang>
|
||||||
<#if lang != "untyped">
|
<#if lang != "untyped">
|
||||||
<h3 languageName="${lang}">${lang}</h3>
|
<h3 languageName="${lang}">${lang}</h3>
|
||||||
|
@ -65,15 +63,21 @@
|
||||||
<#assign labelStr = label >
|
<#assign labelStr = label >
|
||||||
<#assign tagOrTypeStr = "" >
|
<#assign tagOrTypeStr = "" >
|
||||||
</#if>
|
</#if>
|
||||||
<li>${labelStr} <#if labelSeq?seq_contains(labelStr)> (duplicate value) </#if>
|
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
|
||||||
<#if editable && labelEditLink?has_content> <a href="${labelEditLink}&${editGenerator}">Edit</a>
|
|
||||||
<a href="${urls.base}/edit/primitiveRdfEdit" languageName="${labelLang}" languageCode="${languageCode}"
|
|
||||||
labelValue="${labelStr}" tagOrType="${tagOrTypeStr!}" class="remove" title="${i18n().remove_capitalized}">${i18n().remove_capitalized}</a>
|
|
||||||
</#if>
|
|
||||||
|
|
||||||
</li>
|
|
||||||
<#assign labelSeq = labelSeq + [labelStr]>
|
<#assign labelSeq = labelSeq + [labelStr]>
|
||||||
</#list>
|
</#list>
|
||||||
</#if>
|
</#if>
|
||||||
</#list>
|
</#list>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
<#macro displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink>
|
||||||
|
<li>${labelStr} <#if labelSeq?seq_contains(labelStr)> (duplicate value) </#if>
|
||||||
|
<#if editable> <#if labelEditLink?has_content> <a href="${labelEditLink}&${editGenerator}">Edit</a></#if>
|
||||||
|
<#if displayRemoveLink = true>
|
||||||
|
<a href="${urls.base}/edit/primitiveRdfEdit" languageName="${labelLang}" languageCode="${languageCode}"
|
||||||
|
labelValue="${labelStr}" tagOrType="${tagOrTypeStr!}" class="remove" title="${i18n().remove_capitalized}">${i18n().remove_capitalized}</a>
|
||||||
|
</#if>
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
</li>
|
||||||
|
</#macro>
|
|
@ -0,0 +1,4 @@
|
||||||
|
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||||
|
|
||||||
|
<#--Some values for labels etc. may be different between vitro and other systems -->
|
||||||
|
<#assign returnText = "${i18n().return_to_individual}" />
|
|
@ -208,22 +208,34 @@ name will be used as the label. -->
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#-- Label -->
|
<#-- Label -->
|
||||||
<#macro label individual editable labelCount>
|
<#macro label individual editable labelCount localesCount=1>
|
||||||
<#assign labelPropertyUri = ("http://www.w3.org/2000/01/rdf-schema#label"?url) />
|
<#assign labelPropertyUri = ("http://www.w3.org/2000/01/rdf-schema#label"?url) />
|
||||||
<#-- Will need to deal with multiple languages as well-->
|
<#assign useEditLink = false />
|
||||||
|
<#--edit link used if in edit mode and only one label and one language-->
|
||||||
|
<#if labelCount = 1 && editable && localeCount = 1 >
|
||||||
|
<#assign useEditLink = true/>
|
||||||
|
</#if>
|
||||||
<#local label = individual.nameStatement>
|
<#local label = individual.nameStatement>
|
||||||
${label.value}
|
${label.value}
|
||||||
<#if (labelCount > 1) && editable >
|
<#if useEditLink>
|
||||||
|
<@editingLinks "label" label editable />
|
||||||
|
<#elseif editable || (labelCount > 1)>
|
||||||
|
<#--We display the link even when the user is not logged in case of multiple labels-->
|
||||||
|
<#if editable>
|
||||||
|
<#assign imageAlt = "${i18n().manage}" />
|
||||||
|
<#assign linkTitle = "${i18n().manage_list_of_labels}">
|
||||||
|
<#else>
|
||||||
|
<#assign linkTitle = "${i18n().view_list_of_labels}">
|
||||||
|
<#assign imageAlt = "${i18n().view}" />
|
||||||
|
</#if>
|
||||||
<#-- Manage labels now goes to generator -->
|
<#-- Manage labels now goes to generator -->
|
||||||
<#assign individualUri = individual.uri!""/>
|
<#assign individualUri = individual.uri!""/>
|
||||||
<#assign individualUri = (individualUri?url)/>
|
<#assign individualUri = (individualUri?url)/>
|
||||||
<span class="inline">
|
<span class="inline">
|
||||||
<a class="add-label" href="${urls.base}/editRequestDispatch?subjectUri=${individualUri}&editForm=edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageLabelsForIndividualGenerator&predicateUri=${labelPropertyUri}"
|
<a class="add-label" href="${urls.base}/editRequestDispatch?subjectUri=${individualUri}&editForm=edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageLabelsForIndividualGenerator&predicateUri=${labelPropertyUri}"
|
||||||
title="${i18n().manage_list_of_labels}">
|
title="${linkTitle}">
|
||||||
<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="${imageAlt}" /></a>
|
||||||
</span>
|
</span>
|
||||||
<#else>
|
|
||||||
<@editingLinks "label" label editable />
|
|
||||||
</#if>
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue