From 984e2f6f4c39b64ac8268f59ef6e3f2db94e16f9 Mon Sep 17 00:00:00 2001 From: hudajkhan Date: Wed, 2 Oct 2013 14:56:58 -0400 Subject: [PATCH] updates for label, new individual form, external vocab search --- productMods/WEB-INF/web.xml | 8 +++---- .../individual--foaf-person-2column.ftl | 6 ++++++ .../individual--foaf-person-quickview.ftl | 6 ++++++ .../edit/forms/addAssociatedConcept.ftl | 14 ++++++++----- .../freemarker/edit/forms/css/addConcept.css | 21 +++++++++++++++++++ .../freemarker/edit/forms/js/addConcept.js | 11 ++++++---- .../edit/forms/js/newIndividualFormUtils.js | 7 ++++++- .../ManageLabelsForPersonGenerator.java | 2 +- .../webapp/servlet/ConceptSearchServlet.java | 2 +- 9 files changed, 61 insertions(+), 16 deletions(-) diff --git a/productMods/WEB-INF/web.xml b/productMods/WEB-INF/web.xml index 0b2850e1..8fc98681 100644 --- a/productMods/WEB-INF/web.xml +++ b/productMods/WEB-INF/web.xml @@ -728,12 +728,12 @@ - ManageLabelsForIndividualController - edu.cornell.mannlib.vitro.webapp.controller.freemarker.ManageLabelsForIndividualController + ViewLabelsServlet + edu.cornell.mannlib.vitro.webapp.controller.freemarker.ViewLabelsServlet - ManageLabelsForIndividualController - /manageLabels + ViewLabelsServlet + /viewLabels diff --git a/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl b/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl index 4b3887df..76fa5053 100644 --- a/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl +++ b/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl @@ -7,12 +7,18 @@ <#-- <#include "individual-setup.ftl"> --> <#import "individual-qrCodeGenerator.ftl" as qr> <#import "lib-vivo-properties.ftl" as vp> +<#--Number of labels present--> <#if !labelCount??> <#assign labelCount = 0 > +<#--Number of available locales--> <#if !localesCount??> <#assign localesCount = 1> +<#--Number of distinct languages represented, with no language tag counting as a language, across labels--> +<#if !languageCount??> + <#assign languageCount = 1> + <#assign qrCodeIcon = "qr-code-icon.png"> <#assign visRequestingTemplate = "foaf-person-2column">
diff --git a/productMods/templates/freemarker/body/individual/individual--foaf-person-quickview.ftl b/productMods/templates/freemarker/body/individual/individual--foaf-person-quickview.ftl index f957f097..202a2097 100644 --- a/productMods/templates/freemarker/body/individual/individual--foaf-person-quickview.ftl +++ b/productMods/templates/freemarker/body/individual/individual--foaf-person-quickview.ftl @@ -9,12 +9,18 @@ <#import "individual-qrCodeGenerator.ftl" as qr> <#import "lib-vivo-properties.ftl" as vp> +<#--Number of labels present--> <#if !labelCount??> <#assign labelCount = 0 > +<#--Number of available locales--> <#if !localesCount??> <#assign localesCount = 1> +<#--Number of distinct languages represented, with no language tag counting as a language, across labels--> +<#if !languageCount??> + <#assign languageCount = 1> + <#assign qrCodeIcon = "qr-code-icon.png"> <#assign individualImage> <@p.image individual=individual diff --git a/productMods/templates/freemarker/edit/forms/addAssociatedConcept.ftl b/productMods/templates/freemarker/edit/forms/addAssociatedConcept.ftl index 316683c6..eda9ba17 100644 --- a/productMods/templates/freemarker/edit/forms/addAssociatedConcept.ftl +++ b/productMods/templates/freemarker/edit/forms/addAssociatedConcept.ftl @@ -49,7 +49,7 @@

Vocabulary Source

-
  +
 
@@ -68,7 +68,7 @@ ${existingConcept.vocabLabel} -
+ @@ -102,7 +102,7 @@ <#assign checkedSource = false />

${i18n().external_vocabulary_services}

<#list sources?values?sort_by("label") as thisSource> - <#assign checkedSource = true/>checked="checked"> + <#assign checkedSource = true/>checked="checked">
@@ -128,7 +128,8 @@
@@ -170,7 +171,10 @@ var i18nStrings = { selectVocSource: '${i18n().select_vocabulary_source_to_search}', confirmTermDelete: '${i18n().confirm_term_deletion}', errorTernNotRemoved: '${i18n().error_term_not_deleted}', - vocabSpecificLabels: vocabSpecificDisplay + vocabSpecificLabels: vocabSpecificDisplay, + displayMoreEllipsis: '${i18n().display_more_ellipsis}', + displayLess: '${i18n().display_less}', + showMoreContent: '${i18n().show_more_content}' }; diff --git a/productMods/templates/freemarker/edit/forms/css/addConcept.css b/productMods/templates/freemarker/edit/forms/css/addConcept.css index 225b86bf..93e257fc 100644 --- a/productMods/templates/freemarker/edit/forms/css/addConcept.css +++ b/productMods/templates/freemarker/edit/forms/css/addConcept.css @@ -27,6 +27,10 @@ width:400px; } +.conceptRemoval { + width:50px; +} + /* For adding an empty element under the best match column*/ .emptyColumn { width:67px; @@ -73,4 +77,21 @@ form#addConceptForm span#createOwnOne{ .conceptHeadings .row { border-bottom: 1px solid #5F6464; +} + +/*For showing and hiding more results, copied from individual.css*/ +a.more-less { + margin-left: 1.5em; + padding: .3em .8em; + font-size: .8em; + text-decoration: none; + color: #666; + background: #eee; + -moz-border-radius: 5px; + -webkit-border-radius: 5px; + border-radius: 5px; +} +a:hover.more-less { + color: #fff; + background: #888; } \ No newline at end of file diff --git a/productMods/templates/freemarker/edit/forms/js/addConcept.js b/productMods/templates/freemarker/edit/forms/js/addConcept.js index 606a981b..42b918b8 100644 --- a/productMods/templates/freemarker/edit/forms/js/addConcept.js +++ b/productMods/templates/freemarker/edit/forms/js/addConcept.js @@ -153,12 +153,12 @@ var addConceptForm = { if($(link).hasClass("showmore")) { //if clicking and already says show more then need to show the rest of the results $("li.concepts").show(); //show everything - $(link).html("Show fewer results"); + $(link).html(addConceptForm.displayLess); $(link).removeClass("showmore"); } else { //if clicking and does not say show more than need to show less $("li.concepts").slice(addConceptForm.numberOfMaxInitialSearchResults).hide(); - $(link).html("Show more results"); + $(link).html(addConceptForm.displayMoreEllipsis); $(link).addClass("showmore"); } }, @@ -181,6 +181,8 @@ var addConceptForm = { var dataServiceUrl = addConceptForm.dataServiceUrl + "?searchTerm=" + encodeURIComponent(searchValue) + "&source=" + encodeURIComponent(vocabSourceValue); //Show the loading icon until the results appear addConceptForm.loadingIndicator.removeClass("hidden"); + //remove the old search results if there are any + $("#selectedConcept").empty(); //Hide and reset the show more button addConceptForm.resetShowHideMultipleSearchResults(); //This should return an object including the concept list or any errors if there are any @@ -371,7 +373,8 @@ var addConceptForm = { //The definition in some cases may be an empty string, so to prevent the div //from not appearing, we are replacing with if(definition == null || definition.length == 0) { - definition = " "; + //definition = " "; + definition = "No definition provided."; } return "
" + definition + "
"; }, @@ -390,7 +393,7 @@ var addConceptForm = { $("li.concepts").slice(addConceptForm.numberOfMaxInitialSearchResults).hide(); //Hide the link for showing/hiding search results addConceptForm.showHideSearchResults.show(); - addConceptForm.showHideSearchResults.find("a#showHideLink").html("Show more results"); + addConceptForm.showHideSearchResults.find("a#showHideLink").html(addConceptForm.displayMoreEllipsis); addConceptForm.showHideSearchResults.find("a#showHideLink").addClass("showmore"); } diff --git a/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js b/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js index d1cbbf33..2319a8a5 100644 --- a/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js +++ b/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js @@ -13,6 +13,7 @@ var newIndividualFormUtils = { // The external auth ID field and messages this.fName = $('#firstName'); this.lName = $('#lastName'); + this.mName = $('#middleName'); this.rdfsLabel = $('#label'); }, @@ -27,7 +28,11 @@ var newIndividualFormUtils = { buildRDFSLabel: function() { if ( this.fName.length > 0 ) { - this.rdfsLabel.val(this.lName.val() + ", " + this.fName.val()); + var label = this.lName.val() + ", " + this.fName.val(); + if(this.mName.length > 0) { + label += " " + this.mName.val(); + } + this.rdfsLabel.val(label); } }, } diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java index f524f555..fcdba8be 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java @@ -67,7 +67,7 @@ import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.DataProper */ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerator implements EditConfigurationGenerator { public static Log log = LogFactory.getLog(ManageLabelsForIndividualGenerator.class); - private static String template = "manageLabelsForPerson.ftl"; + private static String template = "manageLabelsForIndividual.ftl"; private HashMap> labelsSortedByLanguage = null; private List existingLabelLiterals = null; diff --git a/src/edu/cornell/mannlib/vitro/webapp/servlet/ConceptSearchServlet.java b/src/edu/cornell/mannlib/vitro/webapp/servlet/ConceptSearchServlet.java index 9d47efb2..04a0aca0 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/servlet/ConceptSearchServlet.java +++ b/src/edu/cornell/mannlib/vitro/webapp/servlet/ConceptSearchServlet.java @@ -54,7 +54,7 @@ public class ConceptSearchServlet extends VitroHttpServlet { catch (Exception ex) { SemanticServicesError semanticServicesError = new SemanticServicesError( "Exception encountered ", ex.getMessage(), "fatal"); - log.error("An error occurred retrieving search results"); + log.error("An error occurred retrieving search results", ex); conceptInfo.setSemanticServicesError(semanticServicesError); } conceptInfo.setConceptList(results);