updates for multiple language labels and concept semantic types

This commit is contained in:
hudajkhan 2013-09-05 15:44:54 -04:00
parent b8e114c4e8
commit fc9ac52786
11 changed files with 72 additions and 152 deletions

View file

@ -2,6 +2,9 @@
<#if !labelCount??>
<#assign labelCount = 0 >
</#if>
<#if !localesCount??>
<#assign localesCount = 1>
</#if>
<#-- Default individual profile page template -->
<#--@dumpAll /-->
@ -32,7 +35,7 @@
<#else>
<h1 class="fn">
<#-- Label -->
<@p.label individual editable labelCount />
<@p.label individual editable labelCount localesCount/>
<#-- Most-specific types -->
<@p.mostSpecificTypes individual />

View file

@ -1,5 +1,5 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#include "manageLabelsForIndividualTerms.ftl" >
<#-- Custom form for managing labels for individuals -->
<#import "manageLabelsForIndividualMacros.ftl" as m >
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
@ -13,6 +13,10 @@
<#if editConfiguration.pageData.editable?has_content>
<#assign editable = editConfiguration.pageData.editable />
</#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>
<#assign submissionErrors = editSubmission.validationErrors/>
<#assign submissionErrorsExist = "true" />
@ -60,7 +64,7 @@
<#include "manageLabelsForIndividualSubmissionErrors.ftl">
<div id="showAddForm">
<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>
<#include "manageLabelsForIndividualAddForm.ftl" >

View file

@ -1,10 +1,11 @@
<#-- $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-->
<#macro displayExistingLabelsForLanguage lang labelsSorted editable editGenerator>
<#macro displayExistingLabelsForLanguage lang labelsSorted editable editGenerator displayRemoveLink=true>
<#--get label information for this language-->
<#assign labelList = labelsSorted[lang] />
<#--Reset for every language-->
<#assign labelSeq = []/>
<#list labelList as labelObject>
<#assign labelLiteral = labelObject.labelLiteral />
<#assign labelStringValue = labelObject.labelStringValue />
@ -25,19 +26,16 @@
<#assign labelStr = label >
<#assign tagOrTypeStr = "" >
</#if>
<li>${labelStr} <#if labelSeq?seq_contains(labelStr)> (duplicate value) </#if>
<#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>
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
</li>
<#assign labelSeq = labelSeq + [labelStr]>
<#assign labelSeq = labelSeq + [labelStr]>
</#list>
</#macro>
<#--ignore 'untyped' and display everything-->
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator>
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator displayRemoveLink=true>
<#list langList as lang>
<#if lang != "untyped">
<h3 languageName="${lang}">${lang}</h3>
@ -65,15 +63,21 @@
<#assign labelStr = label >
<#assign tagOrTypeStr = "" >
</#if>
<li>${labelStr} <#if labelSeq?seq_contains(labelStr)> (duplicate value) </#if>
<#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>
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
<#assign labelSeq = labelSeq + [labelStr]>
</#list>
</#if>
</#list>
</#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>

View file

@ -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}" />

View file

@ -208,22 +208,34 @@ name will be used as the label. -->
</#macro>
<#-- 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) />
<#-- 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>
${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 -->
<#assign individualUri = individual.uri!""/>
<#assign individualUri = (individualUri?url)/>
<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}"
title="${i18n().manage_list_of_labels}">
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${i18n().manage}" /></a>
title="${linkTitle}">
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${imageAlt}" /></a>
</span>
<#else>
<@editingLinks "label" label editable />
</#if>
</#macro>