updates for label, new individual form, external vocab search

This commit is contained in:
hudajkhan 2013-10-02 14:56:58 -04:00
parent b5ea3f879d
commit 984e2f6f4c
9 changed files with 61 additions and 16 deletions

View file

@ -728,12 +728,12 @@
</servlet-mapping>
<servlet>
<servlet-name>ManageLabelsForIndividualController</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.ManageLabelsForIndividualController</servlet-class>
<servlet-name>ViewLabelsServlet</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.freemarker.ViewLabelsServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ManageLabelsForIndividualController</servlet-name>
<url-pattern>/manageLabels</url-pattern>
<servlet-name>ViewLabelsServlet</servlet-name>
<url-pattern>/viewLabels</url-pattern>
</servlet-mapping>
<servlet>

View file

@ -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 >
</#if>
<#--Number of available locales-->
<#if !localesCount??>
<#assign localesCount = 1>
</#if>
<#--Number of distinct languages represented, with no language tag counting as a language, across labels-->
<#if !languageCount??>
<#assign languageCount = 1>
</#if>
<#assign qrCodeIcon = "qr-code-icon.png">
<#assign visRequestingTemplate = "foaf-person-2column">
<section id="individual-intro" class="vcard person" role="region">

View file

@ -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 >
</#if>
<#--Number of available locales-->
<#if !localesCount??>
<#assign localesCount = 1>
</#if>
<#--Number of distinct languages represented, with no language tag counting as a language, across labels-->
<#if !languageCount??>
<#assign languageCount = 1>
</#if>
<#assign qrCodeIcon = "qr-code-icon.png">
<#assign individualImage>
<@p.image individual=individual

View file

@ -49,7 +49,7 @@
<div class="column conceptVocabSource">
<h4>Vocabulary Source</h4>
</div>
<div class="column">&nbsp;
<div class="column conceptRemoval">&nbsp;
</div>
</div>
</li>
@ -68,7 +68,7 @@
${existingConcept.vocabLabel}
</#if>
</div>
<div class="column">
<div class="column conceptRemoval">
<a href="${urls.base}/edit/primitiveRdfEdit" class="remove" title="${i18n().remove_capitalized}">${i18n().remove_capitalized}</a>
</div>
@ -102,7 +102,7 @@
<#assign checkedSource = false />
<h4 class="services">${i18n().external_vocabulary_services}</h4>
<#list sources?values?sort_by("label") as thisSource>
<input type="radio" name="source" value="${thisSource.url}" role="radio" <#if checkedSource = false><#assign checkedSource = true/>checked="checked"</#if>>
<input type="radio" name="source" value="${thisSource.schema}" role="radio" <#if checkedSource = false><#assign checkedSource = true/>checked="checked"</#if>>
<label class="inline" for="${thisSource.label}"> <a href="${thisSource.url}">${thisSource.label}</a> &nbsp;(${thisSource.description})</label>
<br />
</#list>
@ -128,7 +128,8 @@
<!-- Search results populated by JavaScript -->
</div>
<div id="showHideResults" name="showHideResults">
<a href="#" id="showHideLink">Results</a>
<a class="more-less" href="#show more content" id="showHideLink" title="${i18n().show_more_content}">
&nbsp;</a>
</div>
<div id="errors" name="errors"></div>
@ -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}'
};
</script>

View file

@ -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;
}

View file

@ -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 = "&nbsp;";
//definition = "&nbsp;";
definition = "No definition provided.";
}
return "<div class='column conceptDefinition'>" + definition + "</div>";
},
@ -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");
}

View file

@ -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);
}
},
}

View file

@ -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<String, List<LabelInformation>> labelsSortedByLanguage = null;
private List<Literal> existingLabelLiterals = null;

View file

@ -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);