updates for label management
This commit is contained in:
parent
cba46c4f72
commit
9fae5d7c3e
10 changed files with 453 additions and 82 deletions
|
@ -1,6 +1,7 @@
|
|||
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
|
||||
<#include "manageLabelsForIndividualTerms.ftl" >
|
||||
<#-- Custom form for managing labels for individuals -->
|
||||
<#--This is used both for editing and for viewLabelsServlet-->
|
||||
<#import "manageLabelsForIndividualMacros.ftl" as m >
|
||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||
<#assign subjectUri = editConfiguration.subjectUri/>
|
||||
|
@ -66,7 +67,9 @@
|
|||
<input type="submit" value="${i18n().add_label}" id="showAddFormButton" name="showAddFormButton"> ${i18n().or}
|
||||
<a class="cancel" href="${cancelUrl}&url=/individual" title="${returnText}">${returnText}</a>
|
||||
</div>
|
||||
|
||||
<div id="showCancelOnly">
|
||||
<a class="cancel" href="${cancelUrl}&url=/individual" title="${returnText}">${returnText}</a>
|
||||
</div>
|
||||
<#include "manageLabelsForIndividualAddForm.ftl" >
|
||||
</#if>
|
||||
|
||||
|
|
|
@ -1,39 +1,41 @@
|
|||
<#-- $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 displayRemoveLink=true>
|
||||
<#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 />
|
||||
<#--Try label as label literal-->
|
||||
<#assign label = labelLiteral />
|
||||
<#assign labelLang = labelObject.languageName />
|
||||
<#assign languageCode = labelObject.languageCode />
|
||||
<#assign labelEditLink = labelObject.editLinkURL />
|
||||
<#if label?? && ( label?index_of("@") > -1 ) >
|
||||
<#assign labelStr = label?substring(0, label?index_of("@")) >
|
||||
<#assign tagOrTypeStr = label?substring(label?index_of("@")) >
|
||||
<#elseif label?? && ( label?index_of("^^") > -1 ) >
|
||||
<#assign labelStr = label?substring(0, label?index_of("^^")) >
|
||||
<#assign tagOrTypeStr = label?substring(label?index_of("^^")) >
|
||||
<#assign tagOrTypeStr = tagOrTypeStr?replace("^^http","^^<http") >
|
||||
<#assign tagOrTypeStr = tagOrTypeStr?replace("#string","#string>") >
|
||||
<#else>
|
||||
<#assign labelStr = label >
|
||||
<#assign tagOrTypeStr = "" >
|
||||
</#if>
|
||||
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
|
||||
|
||||
<#assign labelSeq = labelSeq + [labelStr]>
|
||||
</#list>
|
||||
<#if labelsSorted?keys?seq_contains(lang) >
|
||||
<#assign labelList = labelsSorted[lang] />
|
||||
<#--Reset for every language-->
|
||||
<#assign labelSeq = []/>
|
||||
|
||||
<#list labelList as labelObject>
|
||||
<#assign labelLiteral = labelObject.labelLiteral />
|
||||
<#assign labelStringValue = labelObject.labelStringValue />
|
||||
<#--Try label as label literal-->
|
||||
<#assign label = labelLiteral />
|
||||
<#assign labelLang = labelObject.languageName />
|
||||
<#assign languageCode = labelObject.languageCode />
|
||||
<#assign labelEditLink = labelObject.editLinkURL />
|
||||
<#if label?? && ( label?index_of("@") > -1 ) >
|
||||
<#assign labelStr = label?substring(0, label?index_of("@")) >
|
||||
<#assign tagOrTypeStr = label?substring(label?index_of("@")) >
|
||||
<#elseif label?? && ( label?index_of("^^") > -1 ) >
|
||||
<#assign labelStr = label?substring(0, label?index_of("^^")) >
|
||||
<#assign tagOrTypeStr = label?substring(label?index_of("^^")) >
|
||||
<#assign tagOrTypeStr = tagOrTypeStr?replace("^^http","^^<http") >
|
||||
<#assign tagOrTypeStr = tagOrTypeStr?replace("#string","#string>") >
|
||||
<#else>
|
||||
<#assign labelStr = label >
|
||||
<#assign tagOrTypeStr = "" >
|
||||
</#if>
|
||||
<@displayLabel labelSeq labelStr languageCode labelEditLink tagOrTypeStr editGenerator editable displayRemoveLink/>
|
||||
|
||||
<#assign labelSeq = labelSeq + [labelStr]>
|
||||
</#list>
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#--ignore 'untyped' and display everything-->
|
||||
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator displayRemoveLink=true>
|
||||
<#macro displayExistingTypedLabels langList labelsSorted editable editGenerator="" displayRemoveLink=true>
|
||||
|
||||
|
||||
<#list langList as lang>
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<#-- $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 -->
|
||||
<#--This is used both for editing and for viewLabelsServlet-->
|
||||
<#import "manageLabelsForIndividualMacros.ftl" as m >
|
||||
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
|
||||
<#assign labelStr = "" >
|
||||
<#assign languageTag = "" >
|
||||
<#assign labelSeq = [] >
|
||||
<#assign editable = "false"/>
|
||||
<#assign displayRemoveLink = "false"/>
|
||||
|
||||
<#if subjectName?? >
|
||||
<h2>${i18n().view_labels_for} ${editConfiguration.pageData.subjectName}</h2>
|
||||
<#else>
|
||||
<h2>${i18n().view_labels_capitalized}</h2>
|
||||
</#if>
|
||||
|
||||
|
||||
<section id="rdfsLabels" role="container">
|
||||
|
||||
<ul id="existingLabelsList" name="existingLabelsList">
|
||||
<#if editConfiguration.pageData.labelsSortedByLanguageName?has_content>
|
||||
<#--List of labelInformation objects as value where key = language name -->
|
||||
<#assign labelsSorted = editConfiguration.pageData.labelsSortedByLanguageName />
|
||||
<#--Keys would be the actual names of languages-->
|
||||
<#assign labelLanguages = labelsSorted?keys?sort />
|
||||
|
||||
<#--What we need here is printing out the labels by the language Name and not language code, starting with untyped first-->
|
||||
<@m.displayExistingLabelsForLanguage "untyped" labelsSorted editable ""/>
|
||||
<@m.displayExistingTypedLabels labelLanguages labelsSorted editable ""/>
|
||||
|
||||
</#if>
|
||||
</ul>
|
||||
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
|
||||
|
||||
${scripts.add('<script type="text/javascript" src="${urls.base}/js/utils.js"></script>',
|
||||
'<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>')}
|
||||
|
|
@ -233,18 +233,22 @@ name will be used as the label. -->
|
|||
<@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>
|
||||
<#assign labelLink = ""/>
|
||||
<#-- Manage labels now goes to generator -->
|
||||
<#assign individualUri = individual.uri!""/>
|
||||
<#assign individualUri = (individualUri?url)/>
|
||||
<#if editable>
|
||||
<#assign imageAlt = "${i18n().manage}" />
|
||||
<#assign linkTitle = "${i18n().manage_list_of_labels}">
|
||||
<#assign labelLink= "${urls.base}/editRequestDispatch?subjectUri=${individualUri}&editForm=edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageLabelsGenerator&predicateUri=${labelPropertyUri}">
|
||||
<#else>
|
||||
<#assign linkTitle = "${i18n().view_list_of_labels}">
|
||||
<#assign imageAlt = "${i18n().view}" />
|
||||
<#assign labelLink= "${urls.base}/viewLabels?subjectUri=${individualUri}">
|
||||
</#if>
|
||||
|
||||
<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="${labelLink}"
|
||||
title="${linkTitle}">
|
||||
<img class="add-individual" src="${urls.images}/individual/manage-icon.png" alt="${imageAlt}" /></a>
|
||||
</span>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue