diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSparqlUpdatePreprocessor.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSemanticTypesPreprocessor.java
similarity index 78%
rename from webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSparqlUpdatePreprocessor.java
rename to webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSemanticTypesPreprocessor.java
index 04b2d3cad..b95733b4f 100644
--- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSparqlUpdatePreprocessor.java
+++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/preprocessors/ConceptSemanticTypesPreprocessor.java
@@ -34,36 +34,35 @@ 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 ConceptSparqlUpdatePreprocessor implements ModelChangePreprocessor {
+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(ConceptSparqlUpdatePreprocessor.class);
+ private Log log = LogFactory.getLog(ConceptSemanticTypesPreprocessor.class);
private OntModel toUpdateModel = null;
- private DatasetWrapperFactory dwf = null;
//Custom constructor
- public ConceptSparqlUpdatePreprocessor(OntModel updateModel, DatasetWrapperFactory inputDwf) {
+ public ConceptSemanticTypesPreprocessor(OntModel updateModel) {
this.toUpdateModel = updateModel;
- this.dwf = inputDwf;
}
@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: " +
- "PREFIX RDF:<" + RDF.getURI() + ">";
+ String prefixes = "PREFIX rdfs:<" + RDFS.getURI() + "> " +
+ "PREFIX owl: " +
+ "PREFIX rdf:<" + RDF.getURI() + ">" +
+ "PREFIX skos:";
String constructQuery = prefixes + " CONSTRUCT { " +
- "?semanticType rdf:type OWL:Class. { " +
- "?semanticType rdfs:subClassOf SKOS:Concept . { " +
- "?semanticType rdfs:label ?label. { " +
+ "?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 .{ " +
+ "?concept rdf:type ?semanticType. " +
+ "?semanticType rdfs:label ?label . " +
+ "?semanticType rdfs:subClassOf skos:Concept . " +
"}";
//Execute construct query
@@ -84,13 +83,11 @@ public class ConceptSparqlUpdatePreprocessor implements ModelChangePreprocessor
- DatasetWrapper w = dwf.getDatasetWrapper();
- Dataset dataset = w.getDataset();
- dataset.getLock().enterCriticalSection(Lock.READ);
+ additionsModel.getLock().enterCriticalSection(Lock.READ);
QueryExecution qe = null;
try {
qe = QueryExecutionFactory.create(
- query, dataset);
+ query, additionsModel);
qe.execConstruct(constructedModel);
} catch (Exception e) {
log.error("Error getting constructed model for query string " + constructQuery);
@@ -98,8 +95,7 @@ public class ConceptSparqlUpdatePreprocessor implements ModelChangePreprocessor
if (qe != null) {
qe.close();
}
- dataset.getLock().leaveCriticalSection();
- w.close();
+ additionsModel.getLock().leaveCriticalSection();
}
//Add constructed model to the designated update model
diff --git a/webapp/web/i18n/all.properties b/webapp/web/i18n/all.properties
index 7980d00a9..b235c903c 100644
--- a/webapp/web/i18n/all.properties
+++ b/webapp/web/i18n/all.properties
@@ -675,6 +675,7 @@ photo = Photo
no_image = no image
placeholder_image = placeholder image
manage_labels = manage labels
+manage_list_of_labels = manage list of labels
add_label = Add Label
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.
@@ -858,6 +859,6 @@ subproperty = subproperty
manage_labels_for = Manage Labels for
manage_labels_capitalized = Manage Labels
-manage_labels_intro = Multiple labels exist for this profile but there should only be one. Select the label you want displayed on the profile page, and the others will be deleted.
+manage_labels_intro = In the case where multiple labels exist in the same language, please use the remove link to delete the labels you do not want displayed on the profile page for a given language.
processing_icon = processing
selection_in_process = Your selection is being processed.
diff --git a/webapp/web/js/individual/manageLabelsForIndividual.js b/webapp/web/js/individual/manageLabelsForIndividual.js
index 7eb54c92e..7e1c8128c 100644
--- a/webapp/web/js/individual/manageLabelsForIndividual.js
+++ b/webapp/web/js/individual/manageLabelsForIndividual.js
@@ -32,20 +32,31 @@ var manageLabels = {
// Initial page setup. Called only at page load.
initPage: function() {
- //disable submit until user selects a language
- this.submit.attr('disabled', 'disabled');
- this.submit.addClass('disabledSubmit');
+
+ var disableSubmit = true;
if(this.submissionErrorsExist == "false") {
//hide the form to add label
this.addLabelForm.hide();
- //the cancel in add label can be unbound until the form is visible
- //this.addLabelCancel.unbind("click");
+ //If the number of available locales is zero, then hide the ability to show the form as well
+ if(this.numberAvailableLocales == 0) {
+ manageLabels.showFormButtonWrapper.hide();
+ }
+
} else {
//Display the form
this.onShowAddForm();
+ //Also make sure the save button is enabled in case there is a value selected for the drop down
+ if(this.labelLanguage.val() != "") {
+ disableSubmit = false;
+ }
}
+ if(disableSubmit) {
+ //disable submit until user selects a language
+ this.submit.attr('disabled', 'disabled');
+ this.submit.addClass('disabledSubmit');
+ }
this.bindEventListeners();
@@ -88,25 +99,15 @@ var manageLabels = {
});
- this.addLabelForm.find("a.cancel").click(function(){
+ this.addLabelForm.find("a.cancel").click(function(event){
+ event.preventDefault();
//clear the add form
manageLabels.clearAddForm();
//hide the add form
manageLabels.onHideAddForm();
-
+ return false;
});
- //TODO: Add method to check that language is selected on submission
-
- /*
- $('input#submit').click( function() {
- manageLabels.processLabel(manageLabels.selectedRadio);
- $('span.or').hide();
- $('a.cancel').hide();
- $('span#indicator').removeClass('hidden');
- $('input.submit').addClass('disabledSubmit');
- $('input.submit').attr('disabled', 'disabled');
- });*/
},
clearAddForm:function() {
@@ -179,12 +180,12 @@ var manageLabels = {
var languageName = $(selectedLink).attr("languageName");
$(selectedLink).parent().remove();
//See if there are any other remove link
- if(languageCode != "untyped") {
+ if(languageName != "untyped") {
//find if there are any other remove links for the same language
var removeLinks = manageLabels.existingLabelsList.find("a.remove[languageName='" + languageName + "']");
if(removeLinks.length == 0) {
//if there aren't any other labels for this language, also remove the heading
- manageLabels.existingLabelsList.find("h3[languageName='" + langaugeName + "']").remove();
+ manageLabels.existingLabelsList.find("h3[languageName='" + languageName + "']").remove();
}
}
@@ -223,6 +224,11 @@ var manageLabels = {
var compB = b["label"];
return compA < compB ? -1 : 1;
});
+ //Re-show the add button and the form if they were hidden before
+ if(availableLocalesList.length > 0 && manageLabels.showFormButtonWrapper.is(":hidden")) {
+ manageLabels.showFormButtonWrapper.show();
+ }
+
//Now replace dropdown with this new list
manageLabels.generateLocalesDropdown(availableLocalesList);
diff --git a/webapp/web/templates/freemarker/body/individual/manageLabelsForIndividual.ftl b/webapp/web/templates/freemarker/body/individual/manageLabelsForIndividual.ftl
index 6c5492faa..dea117f5c 100644
--- a/webapp/web/templates/freemarker/body/individual/manageLabelsForIndividual.ftl
+++ b/webapp/web/templates/freemarker/body/individual/manageLabelsForIndividual.ftl
@@ -17,7 +17,10 @@
<#assign submissionErrors = editSubmission.validationErrors/>
<#assign submissionErrorsExist = "true" />
#if>
-
+<#assign availableLocalesNumber = 0/>
+<#if editConfiguration.pageData.selectLocale?has_content>
+ <#assign availableLocalesNumber = editConfiguration.pageData.selectLocale?size />
+#if>
<#if editConfiguration.pageData.subjectName?? >
${i18n().manage_labels_for} ${editConfiguration.pageData.subjectName}
<#else>
@@ -64,7 +67,7 @@
#if>
-
+