VIVO-112: ISF changes relating to vcard classes

This commit is contained in:
tworrall 2013-09-18 11:33:31 -04:00
parent 80ff85385e
commit c5d0bc21e8
39 changed files with 1611 additions and 831 deletions

View file

@ -486,16 +486,14 @@ academic_studies_or_other = Otros estudios académicos o de formación
edit_mailing_address = Editar Dirección postal
create_mailing_address = Cree Dirección postal
mailing_address_for = dirección postal
select_a_country = Por favor, seleccione un país.
enter_address1_value = Por favor, introduzca un valor en el campo Dirección Línea 1.
enter_a_city = Por favor, introduzca un valor en el campo Ciudad.
enter_a_country = Por favor, introduzca un valor en el campo País.
enter_street_address = Por favor, introduzca un valor en el campo Dirección.
enter_a_locality = Por favor, introduzca un valor en el campo Ciudad/Localidad.
enter_postal_code = Por favor, introduzca un valor en el campo Código Postal.
country = País
street_Address1 = Dirección 1
street_Address2 = Dirección 2
street_Address3 = Dirección 3
city = Ciudad
state = Estado
street_address = Dirección
city_locality = Ciudad/Localidad
region = Estado/Provincia/Región
postal_code = Código Postal
posn_entry_for = entrada de la posición de
@ -816,3 +814,16 @@ selected_presentation = Presentación Seleccionado
event_capitalized = Evento
collection_capitalized = Colección
item_capitalized = Artículo
telephone_number_for = número de teléfono para
telephone_number = Número de Teléfono
enter_telephone_number = Por favor, introduzca un valor en el campo Número de teléfono.
email_address = Dirección de Correo Electrónico
email_address_for = dirección de correo electrónico para
enter_email_address = Por favor, introduzca un valor en el campo Dirección de Correo Electrónico.
full_name = Full Name
full_name_for = full name for
enter_first_name = Por favor, introduzca un valor en el campo Primer Nombre.
enter_last_name = Por favor, introduzca un valor en el campo Apellido.
first_name = Primer Nombre
middle_name = Segundo Nombre
last_name = Apellido

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT DISTINCT ?vcard ?email
?emailAddress
WHERE {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email
OPTIONAL { ?email vcard:email ?emailAddress }
MINUS {?email a vcard:Work}
}
</query-select>
<query-construct>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email ?emailProperty ?emailValue
} WHERE {
{
?subject ?property ?vcard
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email ?emailProperty ?emailValue
}
}
</query-construct>
<template>propStatement-emailAddress.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT DISTINCT ?vcard ?fullName
?firstName
?middleName
?lastName
WHERE {
?subject ?property ?vcard .
?vcard vcard:hasName ?fullName
OPTIONAL { ?fullName vcard:givenName ?firstName }
OPTIONAL { ?fullName vcard:middleName ?middleName }
OPTIONAL { ?fullName vcard:familyName ?lastName }
}
</query-select>
<query-construct>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?vcard .
?vcard vcard:hasName ?fullName .
?fullName ?fullNameProperty ?fullNameValue
} WHERE {
{
?subject ?property ?vcard
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasName ?fullName
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasName ?fullName .
?fullName ?fullNameProperty ?fullNameValue
}
}
</query-construct>
<template>propStatement-fullName.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -5,67 +5,47 @@
<list-view-config>
<query-select>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vitro: &lt;http://vitro.mannlib.cornell.edu/ns/vitro/0.7#&gt;
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
PREFIX vivo: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT DISTINCT ?subclass
?address
?localName
?label
?street1
?street2
?street3
?city
?state
SELECT DISTINCT ?vcard ?address
?street
?locality
?region
?postalCode
?country
WHERE {
?subject ?property ?address
LET ( ?localName := afn:localname(?address) )
OPTIONAL { ?address rdfs:label ?label }
OPTIONAL { ?address vivo:address1 ?street1 }
OPTIONAL { ?address vivo:address2 ?street2 }
OPTIONAL { ?address vivo:address3 ?street3 }
OPTIONAL { ?address vivo:addressCity ?city }
OPTIONAL { ?address vivo:addressState ?state }
OPTIONAL { ?address vivo:addressPostalCode ?postalCode }
OPTIONAL { ?address vivo:addressCountry ?country }
?subject ?property ?vcard .
?vcard vcard:hasAddress ?address
OPTIONAL { ?address vcard:streetAddress ?street }
OPTIONAL { ?address vcard:locality ?locality }
OPTIONAL { ?address vcard:region ?region }
OPTIONAL { ?address vcard:postalCode ?postalCode }
OPTIONAL { ?address vcard:country ?country }
OPTIONAL { ?address vitro:mostSpecificType ?subclass .
?subclass rdfs:subClassOf vivo:Address
}
} ORDER BY ?country ?label
} ORDER BY ?country ?region ?street
</query-select>
<query-construct>
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vivo: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subclass rdfs:subClassOf vivo:Address
} WHERE {
?subclass rdfs:subClassOf vivo:Address
}
</query-construct>
<query-construct>
PREFIX vivo: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
CONSTRUCT {
?subject ?property ?address .
?subject ?property ?vcard .
?vcard vcard:hasAddress ?address .
?address ?addressProperty ?addressValue
} WHERE {
{
?subject ?property ?address
?subject ?property ?vcard
} UNION {
?subject ?property ?address .
?subject ?property ?vcard .
?vcard vcard:hasAddress ?address
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasAddress ?address .
?address ?addressProperty ?addressValue
}
}
</query-construct>
<template>propStatement-mailingAddress.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT DISTINCT ?vcard ?email
?emailAddress
WHERE {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email a vcard:Work
OPTIONAL { ?email vcard:email ?emailAddress }
}
</query-select>
<query-construct>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email a vcard:Work .
?email ?emailProperty ?emailValue
} WHERE {
{
?subject ?property ?vcard
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email a vcard:Work
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasEmail ?email .
?email a vcard:Work .
?email ?emailProperty ?emailValue
}
}
</query-construct>
<template>propStatement-emailAddress.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<!-- See guidelines in vitro/doc/list_view_configuration_guidelines.txt -->
<list-view-config>
<query-select>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT DISTINCT ?vcard ?phone
?number
WHERE {
?subject ?property ?vcard .
?vcard vcard:hasTelephone ?phone
OPTIONAL { ?phone vcard:telephone ?number }
}
</query-select>
<query-construct>
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?vcard .
?vcard vcard:hasTelephone ?phone .
?phone ?phoneProperty ?phoneValue
} WHERE {
{
?subject ?property ?vcard
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasTelephone ?phone
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasTelephone ?phone .
?phone ?phoneProperty ?phoneValue
}
}
</query-construct>
<template>propStatement-telephoneNumber.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -9,35 +9,55 @@
<query-select>
PREFIX afn: &lt;http://jena.hpl.hp.com/ARQ/function#&gt;
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
SELECT ?link
SELECT ?vcard ?link
(afn:localname(?link) AS ?linkName)
?anchor
?label
?url
?rank WHERE {
?subject ?property ?link
OPTIONAL { ?link core:linkAnchorText ?anchor }
OPTIONAL { ?link core:linkURI ?url }
?subject ?property ?vcard .
?vcard vcard:hasURL ?link
OPTIONAL { ?link rdfs:label ?label }
OPTIONAL { ?link vcard:url ?url }
OPTIONAL { ?link core:rank ?rank }
<critical-data-required>
FILTER ( bound(?url) )
</critical-data-required>
} ORDER BY ?rank ?anchor
} ORDER BY ?rank ?label
</query-select>
<query-construct>
PREFIX core: &lt;http://vivoweb.org/ontology/core#&gt;
PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#&gt;
PREFIX vcard: &lt;http://www.w3.org/2006/vcard/ns#&gt;
CONSTRUCT {
?subject ?property ?link .
?link ?linkProp ?linkObj
?subject ?property ?vcard .
?vcard vcard:hasURL ?link .
?link vcard:url ?url .
?link core:rank ?rank .
?link rdfs:label ?label
} WHERE {
{
?subject ?property ?link
?subject ?property ?vcard .
?vcard vcard:hasURL ?link
} UNION {
?subject ?property ?link .
?link ?linkProp ?linkObj
?subject ?property ?vcard .
?vcard vcard:hasURL ?link .
?link vcard:url ?url
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasURL ?link .
?link core:rank ?rank
} UNION {
?subject ?property ?vcard .
?vcard vcard:hasURL ?link .
?link rdfs:label ?label
}
}
</query-construct>
<template>propStatement-webpage.ftl</template>
<postprocessor>edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor</postprocessor>
</list-view-config>

View file

@ -1,9 +1,9 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Contact info on individual profile page -->
<#assign phone = propertyGroups.pullProperty("${core}phoneNumber")!>
<#assign pEmail = propertyGroups.pullProperty("${core}primaryEmail")!>
<#assign email = propertyGroups.pullProperty("${core}email")!>
<#assign phone = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Telephone")!>
<#assign pEmail = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Work")!>
<#assign email = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Email")!>
<#if editable || ( phone?has_content || pEmail?has_content || email?has_content ) >
<h2 id="contactHeading" class="mainPropGroup">${i18n().contact_capitalized}</h2>
@ -39,8 +39,8 @@
<ul id="phone-list" role="list">
<#list phone.statements as statement>
<li role="listitem" <#if editable>style="padding-left:10px;"</#if>>
${statement.value}
<@p.editingLinks "${phone.localName}" statement editable />
${statement.number!}
<@p.editingLinks "${phone.localName}" "${phone.name}" statement editable />
</li>
</#list>
</ul>
@ -65,8 +65,8 @@
<#list email.statements as statement>
<li role="listitem" <#if editable>style="padding-left:10px;"</#if>>
<a class="email" href="mailto:${statement.value}" title="${i18n().email}">${statement.value}</a>
<@p.editingLinks "${email.localName}" statement editable />
<a class="email" href="mailto:${statement.emailAddress!}" title="${i18n().email}">${statement.emailAddress!}</a>
<@p.editingLinks "${email.localName}" "${email.name}" statement editable />
</li>
</#list>
</ul>

View file

@ -2,19 +2,19 @@
<#-- Contact info on individual profile page -->
<#assign phone = propertyGroups.pullProperty("${core}phoneNumber")!>
<#assign primaryEmail = propertyGroups.pullProperty("${core}primaryEmail")!>
<#assign addlEmail = propertyGroups.pullProperty("${core}email")!>
<#assign phone = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Telephone")!>
<#assign primaryEmail = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Work")!>
<#assign addlEmail = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#Email")!>
<#if phone?has_content || primaryEmail?has_content || addlEmail?has_content >
<ul style="font-size:1em;padding-bottom:4px"><li><strong>${i18n().contact_info}</strong></li></ul>
</#if>
<#-- Primary Email -->
<@emailLinks "${core}primaryEmail" primaryEmail />
<@emailLinks "primaryEmail" primaryEmail />
<#-- Additional Emails -->
<@emailLinks "${core}email" addlEmail />
<@emailLinks "email" addlEmail />
<#-- Phone -->
@ -24,8 +24,8 @@
<ul id="individual-phone" role="list" <#if editable>style="list-style:none;margin-left:0;"</#if>>
<#list phone.statements as statement>
<li role="listitem">
${statement.value}
<@p.editingLinks "${phone.localName}" statement editable />
${statement.number!}
<@p.editingLinks "${phone.localName}" "${phone.name}" statement editable />
</li>
</#list>
</ul>
@ -33,7 +33,7 @@
</#if>
<#macro emailLinks property email>
<#if property == "${core}primaryEmail">
<#if property == "primaryEmail">
<#local listId = "primary-email">
<#local label = "${i18n().primary_email_capitalized}">
<#else>
@ -46,8 +46,8 @@
<ul id="${listId}" class="individual-emails" role="list" <#if editable>style="list-style:none;margin-left:0;"</#if>>
<#list email.statements as statement>
<li role="listitem">
<a class="email" href="mailto:${statement.value}" title="${i18n().email}">${statement.value}</a>
<@p.editingLinks "${email.localName}" statement editable />
<a class="email" href="mailto:${statement.emailAddress!}" title="${i18n().email}">${statement.emailAddress!}</a>
<@p.editingLinks "${email.localName}" "${email.name}" statement editable />
</li>
</#list>
</ul>

View file

@ -1,14 +1,7 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- This snippet will be included in lib-vivo-properties.ftl, so users will be able to have a
different view when extending wilma theme
<#assign webpage = propertyGroups.pullProperty("${core}webpage")!>
<@p.objectPropertyListing webpage editable />
-->
<#assign webpage = propertyGroups.pullProperty("${core}webpage")!>
<#assign webpage = propertyGroups.pullProperty("http://purl.obolibrary.org/obo/ARG_2000028","http://www.w3.org/2006/vcard/ns#URL")!>
<#if webpage?has_content> <#-- true when the property is in the list, even if not populated (when editing) -->
<#if !editable && individual.person() >
<ul style="font-size:0.9em;padding-bottom:4px"><li><strong>${i18n().websites}</strong></li></ul>
@ -19,4 +12,3 @@
<@p.objectProperty webpage editable />
</ul>
</#if>

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
This template must be self-contained and not rely on other variables set for the individual page, because it
is also used to generate the property statement during a deletion.
-->
<@showAdditionalEmail statement />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement -->
<#macro showAdditionalEmail statement>
<#if statement.emailAddress?has_content>
${statement.emailAddress}
</#if>
</#macro>

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
This template must be self-contained and not rely on other variables set for the individual page, because it
is also used to generate the property statement during a deletion.
-->
<@showFullName statement />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement -->
<#macro showFullName statement>
<#if statement.fullName?has_content>
${statement.firstName!}&nbsp;${statement.middleName!}&nbsp;${statement.lastName!}
</#if>
</#macro>

View file

@ -12,61 +12,40 @@
next statement -->
<#macro showAddress statement>
<#if ( statement.street1?has_content || statement.street2?has_content || statement.street3?has_content || statement.city?has_content ||
statement.state?has_content ||statement.postalCode?has_content || statement.country?has_content )>
<#-- until the custom form is ready, provide a link to the address profile for editing -->
<div class="adr">
<#if statement.street1?has_content>
<div class="address-street1"><a href="${profileUrl(statement.uri("address"))}" title="${i18n().address_street_one}">${statement.street1}</a></div>
<#if statement.street?has_content>
<p class="address-line">
${statement.street}
</p>
</#if>
<#if statement.street2?has_content>
<#if !statement.street1?has_content>
<div class="address-street2"><a href="${profileUrl(statement.uri("address"))}" title="${i18n().address_street_two}">${statement.street2}</a></div>
<#else>
<div class="address-street2">${statement.street2}</div>
</#if>
</#if>
<#if statement.street3?has_content>
<#if !statement.street1?has_content && !statement.street2?has_content>
<div class="address-street3"><a href="${profileUrl(statement.uri("address"))}" title="${i18n().address_street_three}">${statement.street3}</a></div>
<#else>
<div class="address-street3">${statement.street3}</div>
</#if>
</#if>
<#-- If the subclass is vivo:US Postal Address, or if the country is
the US, display the city, state, and postal code on a single line. -->
<#if ( statement.subclass?? && statement.subclass?contains("USPostalAddress") ) ||
( statement.country?? && ( statement.country?contains("United States") ||
statement.country == "US" ||
statement.country == "USA" ) )>
<#local cityState><@s.join [statement.city!, statement.state!], ", " /></#local>
<#if ( statement.country?has_content && (statement.country == "US" || statement.country?contains("United States") || statement.country?contains("U.S.") || statement.country?contains("U.S.A.") || statement.country?contains("USA")))>
<#local cityState><@s.join [statement.locality!, statement.region!], ", " /></#local>
<#local cityStateZip><@s.join [ cityState!, statement.postalCode!], "&nbsp;" /></#local>
<#if cityStateZip?has_content>
<div class="extended-address">${cityStateZip}</div>
<p class="address-line">${cityStateZip}</p>
<p class="address-line">${statement.country!}</p>
</#if>
<#else>
<#if statement.city?has_content><div class="locality">${statement.city!}</div></#if>
<#if statement.state?has_content><div class="region">${statement.state}</div></#if>
<#if statement.postalCode?has_content><div class="postal-code">${statement.postalCode}</div></#if>
<#if statement.locality?has_content>
<p class="address-line">
${statement.locality}
</p>
</#if>
<#if statement.region?has_content>
<p class="address-line">
${statement.region}
</p>
</#if>
<#if statement.postalCode?has_content>
<p class="address-line">
${statement.postalCode}
</p>
</#if>
<#if statement.country?has_content>
<div class="country-name">${statement.country}</div>
<p class="address-line">
${statement.country}
</p>
</#if>
</div>
<#-- Pre-1.4 addresses may only have an rdfs:label, since users using the default
object property form sometimes entered the entire address as the label. Display that when
there's no address data. -->
<#elseif statement.editable>
<#-- This can be removed when the custom form is available. Until then, provide a link to the
address profile so the data can be edited. -->
<a href="${profileUrl(statement.uri("address"))}" title="${i18n().address_label}">${statement.label!statement.localName}</a>
<#else>
${statement.label!}
</#if>
</#macro>

View file

@ -0,0 +1,17 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#--
This template must be self-contained and not rely on other variables set for the individual page, because it
is also used to generate the property statement during a deletion.
-->
<@showTelephone statement />
<#-- Use a macro to keep variable assignments local; otherwise the values carry over to the
next statement -->
<#macro showTelephone statement>
<#if statement.number?has_content>
${statement.number}
</#if>
</#macro>

View file

@ -26,7 +26,7 @@
<#macro showWebpage statement count identifier>
<#local linkText>
<#if statement.anchor?has_content>${statement.anchor}<#t>
<#if statement.label?has_content>${statement.label}<#t>
<#elseif statement.url?has_content>${statement.url}<#t>
</#if>
</#local>

View file

@ -7,7 +7,7 @@
-->
<#assign linkText>
<#if statement.anchor?has_content>${statement.anchor}<#t>
<#if statement.label?has_content>${statement.label}<#t>
<#elseif statement.url?has_content>${statement.url}<#t>
</#if>
</#assign>

View file

@ -13,7 +13,7 @@
<#--Retrieve variables needed-->
<#assign url = lvf.getFormFieldValue(editSubmission, editConfiguration, "url")/>
<#assign urlTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "urlType")/>
<#assign anchor = lvf.getFormFieldValue(editSubmission, editConfiguration, "anchor") />
<#assign label = lvf.getFormFieldValue(editSubmission, editConfiguration, "label") />
<#assign newRank = editConfiguration.pageData.newRank!"" />
<#if url?has_content>
@ -66,8 +66,8 @@
<label for="url">URL ${requiredHint}</label>
<input size="70" type="text" id="url" name="url" value="${url}" role="input" />
<label for="anchor">${i18n().webpage_name}</label>
<input size="70" type="text" id="anchor" name="anchor" value="${anchor}" role="input" />
<label for="label">${i18n().webpage_name}</label>
<input size="70" type="text" id="label" name="label" value="${label}" role="input" />
<#if editMode="add">
<input type="hidden" name="rank" value="${newRank}" />

View file

@ -0,0 +1,102 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this is in request.subject.name -->
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
<#import "lib-vivo-form.ftl" as lvf>
<#--Retrieve certain edit configuration information-->
<#if editConfiguration.objectUri?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed-->
<#assign firstNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "firstName") />
<#assign middleNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "middleName") />
<#assign lastNameValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "lastName") />
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
</#if>
<#if editMode == "edit">
<#assign titleVerb="${i18n().edit_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().full_name}">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="${i18n().create_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().full_name}">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<h2>${titleVerb}&nbsp;${i18n().full_name_for} ${editConfiguration.subjectName}</h2>
<#--Display error messages if any-->
<#if submissionErrors?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="${i18n().error_alert_icon}" />
<p>
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "firstName")>
${i18n().enter_first_name}<br />
</#if>
<#if lvf.submissionErrorExists(editSubmission, "lastName")>
${i18n().enter_last_name}<br />
</#if>
</p>
</section>
</#if>
<@lvf.unsupportedBrowser urls.base />
<section id="addFullNameToPerson" role="region">
<form id="addFullNameToPerson" class="customForm noIE67" action="${submitUrl}" role="add/edit name">
<p>
<label for="firstName">${i18n().first_name} ${requiredHint}</label>
<input size="25" type="text" id="firstName" name="firstName" value="${firstNameValue}" />
</p>
<p>
<label for="middleName">${i18n().middle_name}</label>
<input size="25" type="text" id="middleName" name="middleName" value="${middleNameValue}" />
</p>
<p>
<label for="lastName">${i18n().last_name} ${requiredHint}</label>
<input size="25" type="text" id="lastName" name="lastName" value="${lastNameValue}" />
</p>
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit">
<input type="submit" id="submit" value="${submitButtonText}"/><span class="or"> ${i18n().or} </span>
<a class="cancel" href="${cancelUrl}" title="${i18n().cancel_title}">${i18n().cancel_link}</a>
</p>
<p id="requiredLegend" class="requiredHint">* ${i18n().required_fields}</p>
</form>
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}

View file

@ -1,147 +0,0 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var mailingAddressUtils = {
onLoad: function(mode,country) {
this.initObjectReferences();
this.bindEventListeners();
this.sortCountrySelector(mode,country);
$.extend(this, i18nStrings);
if ( mode == "add" && !this.errorSection.attr('id') ) {
this.containerDiv.hide();
this.submitButton.hide();
}
else {
this.processCountryRelatedFields();
}
},
initObjectReferences: function() {
this.form = $('#personHasMailingAddress');
// The external auth ID field and messages
this.countrySelector = $('#country');
this.countrySelectorOptions = $('#country option');
this.address1Field = $('#addrLineOne');
this.cityField = $('#city');
this.stateField = $('#state');
this.stateSelector= $('#stateSelect');
this.stateLabel = $('#stateLabel');
this.postalCodeField = $('#postalCode');
this.postalCodeLabel = $('#postalCodeLabel');
this.subjectField = $('#subjectName');
this.rdfsLabel = $('#addrLabel');
this.addrTypeField = $('#addressType');
this.submitButton = $('#submit');
this.containerDiv = $('#addressDetails');
this.orSpan = $('span.or');
this.errorSection = $('section#error-alert');
},
bindEventListeners: function() {
this.idCache = {};
this.countrySelector.change(function() {
mailingAddressUtils.processCountryRelatedFields();
mailingAddressUtils.showHiddenElements();
});
this.form.submit(function() {
mailingAddressUtils.buildAddressLabel();
});
this.stateSelector.change(function() {
mailingAddressUtils.setStateValue();
});
},
addressClassIsNonUS: function() {
var country = this.countrySelector.val();
if ( country.search( 'United States' ) == -1 ) {
return true;
}
else {
return false;
}
},
buildAddressLabel: function() {
if ( mailingAddressUtils.addressClassIsNonUS() ) {
this.rdfsLabel.val(this.address1Field.val() + " " + this.cityField.val() + " " + this.countrySelector.val());
}
else {
this.rdfsLabel.val(this.address1Field.val() + " " + this.cityField.val() + " " + this.stateField.val());
}
},
processCountryRelatedFields: function() {
if ( mailingAddressUtils.addressClassIsNonUS() ) {
this.stateLabel.text(mailingAddressUtils.provinceOrRegion);
this.postalCodeField.attr('size', '40');
this.stateSelector.hide();
this.stateField.show();
this.addrTypeField.val("http://vivoweb.org/ontology/core#Address");
}
else {
this.stateLabel.text(mailingAddressUtils.stateString);
this.postalCodeField.attr('size', '8');
this.stateField.hide();
this.stateSelector.show();
this.addrTypeField.val("http://vivoweb.org/ontology/core#USPostalAddress");
}
},
showHiddenElements: function() {
this.containerDiv.show();
this.submitButton.show();
this.orSpan.show();
},
setStateValue: function() {
this.stateField.val(this.stateSelector.val());
},
// in the ftl we remove the "the" that precedes some countries, so we need to
// re-sort them alphabetically
sortCountrySelector: function(mode,country) {
// Get options from select box
var the_options = this.countrySelectorOptions;
// sort alphabetically
the_options.sort(function(a,b) {
if (a.text > b.text) return 1;
else if (a.text < b.text) return -1;
else return 0
})
//replace with sorted the_options;
this.countrySelector.append( the_options );
// if it's add mode, add the "select one" option have it be selected;
// if it's edit mode, add the "Select one" option but have the correct country selected.
// if it's repair mode, add the "Select one" option but only select it if there's no country
if ( this.errorSection.is(':visible') ) {
this.countrySelector.prepend($("<option></option>")
.attr("value","")
.text(mailingAddressUtils.selectOne));
this.countrySelector.val(country);
}
else if ( mode == "add" ) {
this.countrySelector.prepend($("<option selected></option>")
.attr("value","")
.text(mailingAddressUtils.selectOne));
}
else if ( mode == "edit" || country.length > 1 ) {
this.countrySelector.prepend($("<option></option>")
.attr("value","")
.text(mailingAddressUtils.selectOne));
this.countrySelector.val(country);
}
else if ( country.length == 0 ) {
this.countrySelector.prepend($("<option selected></option>")
.attr("value","")
.text(mailingAddressUtils.selectOne));
this.countrySelector.val(country);
}
}
}

View file

@ -0,0 +1,37 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
var newIndividualFormUtils = {
onLoad: function(mode,country) {
this.initObjectReferences();
this.bindEventListeners();
},
initObjectReferences: function() {
this.form = $('#newIndividual');
// The external auth ID field and messages
this.fName = $('#firstName');
this.lName = $('#lastName');
this.rdfsLabel = $('#label');
},
bindEventListeners: function() {
this.idCache = {};
this.form.submit(function() {
newIndividualFormUtils.buildRDFSLabel();
});
},
buildRDFSLabel: function() {
if ( this.fName.length > 0 ) {
this.rdfsLabel.val(this.lName.val() + ", " + this.fName.val());
}
},
}
$(document).ready(function() {
newIndividualFormUtils.onLoad();
});

View file

@ -29,8 +29,8 @@
<ul id="webpageList" ${ulClass} role="list">
<#list editConfiguration.pageData.webpages as webpage>
<li class="webpage" role="listitem">
<#if webpage.anchor??>
<#assign anchor=webpage.anchor >
<#if webpage.label??>
<#assign anchor=webpage.label >
<#else>
<#assign anchor=webpage.url >
</#if>
@ -39,7 +39,7 @@
<a href="${webpage.url}" title="${i18n().webpage_url}">${anchor}</a>
</span>
<span class="editingLinks">
<a href="${baseEditWebpageUrl}&objectUri=${webpage.link?url}&predicateUri=${predicateUri}" class="edit" title="${i18n().edit_webpage_link}">${i18n().edit_capitalized}</a> |
<a href="${baseEditWebpageUrl}&objectUri=${webpage.vcard}&predicateUri=${predicateUri}&linkUri=${webpage.link}" class="edit" title="${i18n().edit_webpage_link}">${i18n().edit_capitalized}</a> |
<a href="${urls.base}${deleteWebpageUrl}" class="remove" title="${i18n().delete_webpage_link}">${i18n().delete_button}</a>
</span>
</li>

View file

@ -56,6 +56,8 @@
<label for="lastName">${i18n().last_name} ${requiredHint}</label>
<input size="30" type="text" id="lastName" name="lastName" value="${lastNameValue}" />
</p>
<input type="hidden" id="label" name="label" value="${labelValue}" />
<#else>
<p>
<label for="name">${i18n().name_capitalized} ${requiredHint}</label>
@ -75,3 +77,4 @@
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/newIndividualFormUtils.js"></script>')}

View file

@ -0,0 +1,86 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this is in request.subject.name -->
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
<#import "lib-vivo-form.ftl" as lvf>
<#--Retrieve certain edit configuration information-->
<#if editConfiguration.objectUri?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed-->
<#assign emailAddressValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "emailAddress") />
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
</#if>
<#if editMode == "edit">
<#assign titleVerb="${i18n().edit_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().email_address}">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="${i18n().create_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().email_address}">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<h2>${titleVerb}&nbsp;${i18n().email_address_for} ${editConfiguration.subjectName}</h2>
<#--Display error messages if any-->
<#if submissionErrors?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="${i18n().error_alert_icon}" />
<p>
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "emailAddress")>
${i18n().enter_email_address}<br />
</#if>
</p>
</section>
</#if>
<@lvf.unsupportedBrowser urls.base />
<section id="personHasAdditionalEmail" role="region">
<form id="personHasAdditionalEmail" class="customForm noIE67" action="${submitUrl}" role="add/edit phone">
<p>
<label for="additionalEmail">${i18n().email_address} ${requiredHint}</label>
<input size="35" type="text" id="emailAddress" name="emailAddress" value="${emailAddressValue}" />
</p>
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit">
<input type="submit" id="submit" value="${submitButtonText}"/><span class="or"> ${i18n().or} </span>
<a class="cancel" href="${cancelUrl}" title="${i18n().cancel_title}">${i18n().cancel_link}</a>
</p>
<p id="requiredLegend" class="requiredHint">* ${i18n().required_fields}</p>
</form>
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}

View file

@ -16,13 +16,9 @@
<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed-->
<#assign addrLabelValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "addrLabel") />
<#assign addressTypeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "addressType") />
<#assign addrLineOneValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "addrLineOne") />
<#assign addrLineTwoValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "addrLineTwo") />
<#assign addrLineThreeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "addrLineThree") />
<#assign cityValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "city") />
<#assign stateValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "state") />
<#assign streetAddressValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "streetAddress") />
<#assign localityValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "locality") />
<#assign regionValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "region") />
<#assign postalCodeValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "postalCode") />
<#assign countryValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "country") />
@ -52,13 +48,13 @@
<p>
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "country")>
${i18n().select_a_country}<br />
${i18n().enter_a_country}<br />
</#if>
<#if lvf.submissionErrorExists(editSubmission, "addrLineOne")>
${i18n().enter_address1_value}<br />
<#if lvf.submissionErrorExists(editSubmission, "streetAddress")>
${i18n().enter_street_address}<br />
</#if>
<#if lvf.submissionErrorExists(editSubmission, "city")>
${i18n().enter_a_city}<br />
<#if lvf.submissionErrorExists(editSubmission, "locality")>
${i18n().enter_a_locality}<br />
</#if>
<#if lvf.submissionErrorExists(editSubmission, "postalCode")>
${i18n().enter_postal_code}
@ -74,110 +70,31 @@
<form id="personHasMailingAddress" class="customForm noIE67" action="${submitUrl}" role="add/edit educational training">
<p>
<label for="country" style="margin-bottom:-4px">${i18n().country} ${requiredHint}</label>
<#assign countryOpts = editConfiguration.pageData.country />
<select id="country" name="country" >
<#list countryOpts?keys as key>
<#assign countryName = countryOpts[key]?uncap_first?replace("the ", "")?cap_first >
<option value="${countryName}" <#if countryName == countryValue>selected</#if>>
${countryName}
</option>
</#list>
</select>
</p>
<input type="hidden" id="countryEditMode" name="countryEditMode" value="${countryValue}" />
<div id="addressDetails" >
<p>
<label for="addrLineOne">${i18n().street_Address1} ${requiredHint}</label>
<input size="50" type="text" id="addrLineOne" name="addrLineOne" value="${addrLineOneValue}" />
<label for="streetAddress">${i18n().street_address} ${requiredHint}</label>
<input size="50" type="text" id="streetAddress" name="streetAddress" value="${streetAddressValue}" />
</p>
<p>
<label for="addrLineTwo">${i18n().street_Address2}</label>
<input size="50" type="text" id="addrLineTwo" name="addrLineTwo" value="${addrLineTwoValue}" />
<label for="locality">${i18n().city_locality} ${requiredHint}</label>
<input size="40" type="text" id="city" name="locality" value="${localityValue}" />
</p>
<p>
<label for="addrLineThree">${i18n().street_Address3}</label>
<input size="50" type="text" id="addrLineThree" name="addrLineThree" value="${addrLineThreeValue}" />
</p>
<p>
<label for="city">${i18n().city} ${requiredHint}</label>
<input size="40" type="text" id="city" name="city" value="${cityValue}" />
</p>
<p>
<label for="state" id="stateLabel">${i18n().state}</label>
<input size="40" type="text" id="state" name="state" value="${stateValue}" />
<select id="stateSelect" name="stateSelect">
<option value="" <#if editMode == "add">selected</#if> >${i18n().select_one}</option>
<option value="Alabama" <#if stateValue == "Alabama" || stateValue == "AL" >selected</#if> >Alabama</option>
<option value="Alaska" <#if stateValue == "Alaska" || stateValue == "AK" >selected</#if> >Alaska</option>
<option value="Arizona" <#if stateValue == "Arizona " || stateValue == "AZ" >selected</#if>>Arizona</option>
<option value="Arkansas" <#if stateValue == "Arkansas " || stateValue == "AR" >selected</#if>>Arkansas</option>
<option value="California" <#if stateValue == "California " || stateValue == "CA" >selected</#if>>California</option>
<option value="Colorado" <#if stateValue == "Colorado " || stateValue == "CO" >selected</#if>>Colorado</option>
<option value="Connecticut" <#if stateValue == "Connecticut " || stateValue == "CT" >selected</#if>>Connecticut</option>
<option value="Delaware" <#if stateValue == "Delaware " || stateValue == "DE" >selected</#if>>Delaware</option>
<option value="Florida" <#if stateValue == "Florida " || stateValue == "FA" >selected</#if>>Florida</option>
<option value="Georgia" <#if stateValue == "Georgia " || stateValue == "GA" >selected</#if>>Georgia</option>
<option value="Hawaii" <#if stateValue == "Hawaii" || stateValue == "HI" >selected</#if>>Hawaii</option>
<option value="Idaho" <#if stateValue == "Idaho " || stateValue == "ID" >selected</#if>>Idaho</option>
<option value="Illinois" <#if stateValue == "Illinois " || stateValue == "IL" >selected</#if>>Illinois</option>
<option value="Indiana" <#if stateValue == "Indiana " || stateValue == "IN" >selected</#if>>Indiana</option>
<option value="Iowa" <#if stateValue == "Iowa " || stateValue == "IA" >selected</#if>>Iowa</option>
<option value="Kansas" <#if stateValue == "Kansas" || stateValue == "KS" >selected</#if>> Kansas</option>
<option value="Kentucky" <#if stateValue == "Kentucky" || stateValue == "KY" >selected</#if>>Kentucky</option>
<option value="Louisiana" <#if stateValue == "Louisiana" || stateValue == "LA" >selected</#if>>Louisiana</option>
<option value="Maine" <#if stateValue == "Maine" || stateValue == "ME" >selected</#if>>Maine</option>
<option value="Maryland" <#if stateValue == "Maryland" || stateValue == "MD" >selected</#if>>Maryland</option>
<option value="Massachusetts" <#if stateValue == "Massachusetts" || stateValue == "MA" >selected</#if>>Massachusetts</option>
<option value="Michigan" <#if stateValue == "Michigan" || stateValue == "MI" >selected</#if>>Michigan</option>
<option value="Minnesota" <#if stateValue == "Minnesota" || stateValue == "MN" >selected</#if>>Minnesota</option>
<option value="Mississippi" <#if stateValue == "Mississippi" || stateValue == "MS" >selected</#if>>Mississippi</option>
<option value="Missouri" <#if stateValue == "Missouri" || stateValue == "MO" >selected</#if>>Missouri</option>
<option value="Montana" <#if stateValue == "Montana" || stateValue == "MT" >selected</#if>>Montana</option>
<option value="Nebraska" <#if stateValue == "Nebraska" || stateValue == "NE" >selected</#if>>Nebraska</option>
<option value="Nevada" <#if stateValue == "Nevada" || stateValue == "NV" >selected</#if>>Nevada</option>
<option value="New Hampshire" <#if stateValue == "New Hampshire" || stateValue == "NH" >selected</#if>>New Hampshire</option>
<option value="New Jersey" <#if stateValue == "New Jersey" || stateValue == "NJ" >selected</#if>>New Jersey</option>
<option value="New Mexico" <#if stateValue == "New Mexico" || stateValue == "NM" >selected</#if>>New Mexico</option>
<option value="New York" <#if stateValue == "New York" || stateValue == "NY" >selected</#if>>New York</option>
<option value="North Carolina<" <#if stateValue == "North Carolina" || stateValue == "NC" >selected</#if>>North Carolina</option>
<option value="North Dakota" <#if stateValue == "North Dakota" || stateValue == "ND" >selected</#if>>North Dakota</option>
<option value="Ohio" <#if stateValue == "Ohio" || stateValue == "OH" >selected</#if>>Ohio</option>
<option value="Oklahoma" <#if stateValue == "Oklahoma" || stateValue == "OK" >selected</#if>>Oklahoma</option>
<option value="Oregon" <#if stateValue == "Oregon" || stateValue == "OR" >selected</#if>>Oregon</option>
<option value="Pennsylvania" <#if stateValue == "Pennsylvania" || stateValue == "PA" >selected</#if>>Pennsylvania</option>
<option value="Rhode Island" <#if stateValue == "Rhode Island" || stateValue == "RI" >selected</#if>>Rhode Island</option>
<option value="South Carolina" <#if stateValue == "South Carolina" || stateValue == "SC" >selected</#if>>South Carolina</option>
<option value="South Dakota" <#if stateValue == "South Dakota" || stateValue == "SD" >selected</#if>>South Dakota</option>
<option value="Tennessee" <#if stateValue == "Tennessee" || stateValue == "TN" >selected</#if>>Tennessee</option>
<option value="Texas" <#if stateValue == "Texas" || stateValue == "TX" >selected</#if>>Texas</option>
<option value="Utah" <#if stateValue == "Utah" || stateValue == "UT" >selected</#if>>Utah</option>
<option value="Vermont" <#if stateValue == "Vermont" || stateValue == "VT" >selected</#if>>Vermont</option>
<option value="Virginia" <#if stateValue == "Virginia" || stateValue == "VA" >selected</#if>>Virginia</option>
<option value="Washington" <#if stateValue == "Washington" || stateValue == "WA" >selected</#if>>Washington</option>
<option value="West Virginia" <#if stateValue == "West Virginia" || stateValue == "WV" >selected</#if>>West Virginia</option>
<option value="Wisconsin" <#if stateValue == "Wisconsin" || stateValue == "WI" >selected</#if>>Wisconsin</option>
<option value="Wyoming" <#if stateValue == "Wyoming" || stateValue == "WY" >selected</#if>>Wyoming</option>
</select>
<label for="region" id="stateLabel">${i18n().region}</label>
<input size="40" type="text" id="state" name="region" value="${regionValue}" />
</p>
<p>
<label for="postalCode" id="postalCodeLabel">${i18n().postal_code} ${requiredHint}</label>
<input size="8" type="text" id="postalCode" name="postalCode" value="${postalCodeValue}" />
<input size="20" type="text" id="postalCode" name="postalCode" value="${postalCodeValue}" />
</p>
</div>
<p>
<label for="country" style="margin-bottom:-4px">${i18n().country} ${requiredHint}</label>
<input size="20" type="text" id="countryEditMode" name="country" value="${countryValue}" />
</p>
<input type="hidden" id="addrLabel" name="addrLabel" value="${addrLabelValue}" />
<input type="hidden" id="addressType" name="addressType" value="${addressTypeValue}" />
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit">
@ -191,22 +108,6 @@
</section>
<script type="text/javascript">
var i18nStrings = {
provinceOrRegion: '${i18n().province_or_region}',
stateString: '${i18n().state}',
selectOne: '${i18n().select_one}'
};
</script>
<script type="text/javascript">
$(document).ready(function(){
mailingAddressUtils.onLoad("${editMode}","${countryValue}");
});
</script>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}
@ -214,7 +115,6 @@ ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarke
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/mailingAddressUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}

View file

@ -0,0 +1,86 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- this is in request.subject.name -->
<#-- leaving this edit/add mode code in for reference in case we decide we need it -->
<#import "lib-vivo-form.ftl" as lvf>
<#--Retrieve certain edit configuration information-->
<#if editConfiguration.objectUri?has_content>
<#assign editMode = "edit">
<#else>
<#assign editMode = "add">
</#if>
<#assign htmlForElements = editConfiguration.pageData.htmlForElements />
<#--Retrieve variables needed-->
<#assign telephoneNumberValue = lvf.getFormFieldValue(editSubmission, editConfiguration, "telephoneNumber") />
<#--If edit submission exists, then retrieve validation errors if they exist-->
<#if editSubmission?has_content && editSubmission.submissionExists = true && editSubmission.validationErrors?has_content>
<#assign submissionErrors = editSubmission.validationErrors/>
</#if>
<#if editMode == "edit">
<#assign titleVerb="${i18n().edit_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().telephone_number}">
<#assign disabledVal="disabled">
<#else>
<#assign titleVerb="${i18n().create_capitalized}">
<#assign submitButtonText="${titleVerb}" + " ${i18n().telephone_number}">
<#assign disabledVal=""/>
</#if>
<#assign requiredHint = "<span class='requiredHint'> *</span>" />
<h2>${titleVerb}&nbsp;${i18n().mailing_address_for} ${editConfiguration.subjectName}</h2>
<#--Display error messages if any-->
<#if submissionErrors?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="${i18n().error_alert_icon}" />
<p>
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "telephoneNumber")>
${i18n().enter_telephone_number}<br />
</#if>
</p>
</section>
</#if>
<@lvf.unsupportedBrowser urls.base />
<section id="personHasTelephoneNumber" role="region">
<form id="personHasTelephoneNumber" class="customForm noIE67" action="${submitUrl}" role="add/edit phone">
<p>
<label for="telephoneNumber">${i18n().telephone_number} ${requiredHint}</label>
<input size="25" type="text" id="telephoneNumber" name="telephoneNumber" value="${telephoneNumberValue}" />
</p>
<input type="hidden" id="editKey" name="editKey" value="${editKey}"/>
<p class="submit">
<input type="submit" id="submit" value="${submitButtonText}"/><span class="or"> ${i18n().or} </span>
<a class="cancel" href="${cancelUrl}" title="${i18n().cancel_title}">${i18n().cancel_link}</a>
</p>
<p id="requiredLegend" class="requiredHint">* ${i18n().required_fields}</p>
</form>
</section>
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/js/jquery-ui/css/smoothness/jquery-ui-1.8.9.custom.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customForm.css" />')}
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/templates/freemarker/edit/forms/css/customFormWithAutocomplete.css" />')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/jquery-ui-1.8.9.custom.min.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/extensions/String.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>',
'<script type="text/javascript" src="${urls.base}/js/jquery_plugins/jquery.bgiframe.pack.js"></script>')}

View file

@ -347,15 +347,90 @@ local:informationResourceInAuthorshipConfig a :ObjectPropertyDisplayConfig ;
### vcard properties ###
local:mailingAddressContext a :ConfigContext ;
:hasConfiguration local:mailingAddressConfig ;
:configContextFor <http://vivoweb.org/ontology/core#relatedBy> ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Address> .
local:mailingAddressConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-personHasMailingAddress.xml"^^xsd:string ;
:listViewConfigFile "listViewConfig-mailingAddress.xml"^^xsd:string ;
:displayName "mailing address" ;
vitro:displayRankAnnot 80;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasMailingAddressGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:telephoneContext a :ConfigContext ;
:hasConfiguration local:telephoneConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Telephone> .
local:telephoneConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-telephoneNumber.xml"^^xsd:string ;
:displayName "phone" ;
vitro:displayRankAnnot 60;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasTelephoneNumberGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:additionalEmailContext a :ConfigContext ;
:hasConfiguration local:additionalEmailConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Email> .
local:additionalEmailConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-additionalEmail.xml"^^xsd:string ;
:displayName "additional emails" ;
vitro:displayRankAnnot 30;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasEmailGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:primaryEmailContext a :ConfigContext ;
:hasConfiguration local:primaryEmailConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Work> .
local:primaryEmailConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-primaryEmail.xml"^^xsd:string ;
:displayName "primary email" ;
vitro:displayRankAnnot 20;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.PersonHasEmailGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:webpageContext a :ConfigContext ;
:hasConfiguration local:webpageConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#URL> .
local:webpageConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-webpage.xml"^^xsd:string ;
:displayName "webpage" ;
vitro:displayRankAnnot 40;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.ManageWebpagesForIndividualGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .
local:fullNameContext a :ConfigContext ;
:hasConfiguration local:fullNameConfig ;
:configContextFor <http://purl.obolibrary.org/obo/ARG_2000028> ;
:qualifiedByDomain <http://xmlns.com/foaf/0.1/Person> ;
:qualifiedBy <http://www.w3.org/2006/vcard/ns#Name> .
local:fullNameConfig a :ObjectPropertyDisplayConfig ;
:listViewConfigFile "listViewConfig-fullName.xml"^^xsd:string ;
:displayName "full name" ;
vitro:displayRankAnnot 10;
vitro:hiddenFromDisplayBelowRoleLevelAnnot role:public ;
vitro:prohibitedFromUpdateBelowRoleLevelAnnot role:public ;
vitro:customEntryFormAnnot "edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddFullNameToPersonGenerator"^^<http://www.w3.org/2001/XMLSchema#string> ;
:propertyGroup <http://vivoweb.org/ontology#vitroPropertyGroupaddress> .

View file

@ -11,6 +11,9 @@ import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.vocabulary.RDFS;
import com.hp.hpl.jena.vocabulary.XSD;
@ -33,6 +36,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.
* It is intended to always be an add, and never an update.
*/
public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator implements EditConfigurationGenerator {
public static Log log = LogFactory.getLog(AddAuthorsToInformationResourceGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
@ -58,6 +62,8 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
editConfiguration.addNewResource("authorshipUri", DEFAULT_NS_TOKEN);
editConfiguration.addNewResource("newPerson", DEFAULT_NS_TOKEN);
editConfiguration.addNewResource("newOrg", DEFAULT_NS_TOKEN);
editConfiguration.addNewResource("vcardPerson", DEFAULT_NS_TOKEN);
editConfiguration.addNewResource("vcardName", DEFAULT_NS_TOKEN);
//In scope
setUrisAndLiteralsInScope(editConfiguration, vreq);
@ -128,17 +134,35 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
private String getN3NewPersonFirstName() {
return getN3PrefixString() +
"?newPerson foaf:firstName ?firstName .";
"@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newPerson <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardPerson . \n" +
"?vcardPerson <http://purl.obolibrary.org/obo/ARG_2000029> ?newPerson . \n" +
"?vcardPerson a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:givenName ?firstName .";
}
private String getN3NewPersonMiddleName() {
return getN3PrefixString() +
"?newPerson core:middleName ?middleName .";
"@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newPerson <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardPerson . \n" +
"?vcardPerson <http://purl.obolibrary.org/obo/ARG_2000029> ?newPerson . \n" +
"?vcardPerson a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:middleName ?middleName .";
}
private String getN3NewPersonLastName() {
return getN3PrefixString() +
"?newPerson foaf:lastName ?lastName .";
"@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newPerson <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardPerson . \n" +
"?vcardPerson <http://purl.obolibrary.org/obo/ARG_2000029> ?newPerson . \n" +
"?vcardPerson a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardPerson vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:familyName ?lastName .";
}
private String getN3NewPerson() {
@ -177,6 +201,8 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
HashMap<String, String> newResources = new HashMap<String, String>();
newResources.put("authorshipUri", DEFAULT_NS_TOKEN);
newResources.put("newPerson", DEFAULT_NS_TOKEN);
newResources.put("vcardPerson", DEFAULT_NS_TOKEN);
newResources.put("vcardName", DEFAULT_NS_TOKEN);
newResources.put("newOrg", DEFAULT_NS_TOKEN);
return newResources;
}
@ -245,7 +271,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setValidators(list("datatype:" + XSD.xstring.toString())).
setRangeDatatypeUri(XSD.xstring.toString())
);
}
@ -255,7 +280,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setValidators(list("datatype:" + XSD.xstring.toString())).
setRangeDatatypeUri(XSD.xstring.toString())
);
}
@ -265,20 +289,14 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setValidators(list("datatype:" + XSD.xstring.toString())).
setRangeDatatypeUri(XSD.xstring.toString())
);
}
private void setLastNameField(EditConfigurationVTwo editConfiguration) {
editConfiguration.addField(new FieldVTwo().
setName("lastName").
setValidators(list("datatype:" + XSD.xstring.toString())).
setRangeDatatypeUri(XSD.xstring.toString())
);
}
private void setRankField(EditConfigurationVTwo editConfiguration) {
@ -287,7 +305,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setValidators(list("nonempty")).
setRangeDatatypeUri(XSD.xint.toString())
);
}
@ -296,7 +313,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setName("personUri")
//.setObjectClassUri(personClass)
);
}
private void setOrgUriField(EditConfigurationVTwo editConfiguration) {
@ -304,16 +320,16 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
setName("orgUri")
//.setObjectClassUri(personClass)
);
}
private void setOrgNameField(EditConfigurationVTwo editConfiguration) {
editConfiguration.addField(new FieldVTwo().
setName("orgName").
setValidators(list("datatype:" + XSD.xstring.toString())).
setRangeDatatypeUri(XSD.xstring.toString())
);
}
//Form specific data
public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
HashMap<String, Object> formSpecificData = new HashMap<String, Object>();
@ -329,11 +345,49 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
List<Individual> authorships = infoResource.getRelatedIndividuals(
EditConfigurationUtils.getPredicateUri(vreq));
//TODO: Check if sorted correctly
log.debug("authorships = " + authorships);
sortAuthorshipIndividuals(authorships);
return getAuthorshipInfo(authorships);
}
/*
private static String AUTHORSHIPS_QUERY = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#> \n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "PREFIX foaf: <http://xmlns.com/foaf/0.1/> \n"
+ "SELECT ?authorshipURI (afn:localname(?authorshipURI) AS ?authorshipName) ?authorURI ?authorName \n"
+ "WHERE { \n"
+ "?subject core:relatedBy ?authorshipURI . \n"
+ "?authorshipURI core:relates ?authorURI . \n"
+ "?authorURI a foaf:Person . \n"
+ "?authorURI rdfs:label ?authorName \n"
+ "}";
private List<Map<String, String>> getExistingAuthorships(String subjectUri, VitroRequest vreq) {
String queryStr = QueryUtils.subUriForQueryVar(this.getAuthorshipsQuery(), "subject", subjectUri);
log.debug("Query string is: " + queryStr);
List<Map<String, String>> authorshipss = new ArrayList<Map<String, String>>();
try {
ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
while (results.hasNext()) {
QuerySolution soln = results.nextSolution();
RDFNode node = soln.get("link");
if (node.isURIResource()) {
webpages.add(QueryUtils.querySolutionToStringValueMap(soln));
}
}
} catch (Exception e) {
log.error(e, e);
}
log.debug("webpages = " + webpages);
return webpages;
}
*/
private List<AuthorshipInfo> getAuthorshipInfo(
List<Individual> authorships) {
List<AuthorshipInfo> info = new ArrayList<AuthorshipInfo>();
@ -368,9 +422,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
return maxRank;
}
private void sortAuthorshipIndividuals(List<Individual> authorships) {
DataPropertyComparator comp = new DataPropertyComparator(authorRankPredicate);
Collections.sort(authorships, comp);
@ -416,4 +467,8 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
static final String DEFAULT_NS_TOKEN=null; //null forces the default NS
// protected String getAuthorshipsQuery() {
// return AUTHORSHIPS_QUERY;
// }
}

View file

@ -39,7 +39,7 @@ Class:
core:URLLink - the link to be added to the individual
Data properties of core:URLLink:
core:linkURI
core:linkUrlPredicate
core:linkAnchorText
core:rank
@ -68,27 +68,32 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
initBasics(config, vreq);
initPropertyParameters(vreq, session, config);
initObjectPropForm(config, vreq);
String linkUri = getLinkUri(vreq);
config.setVarNameForSubject("subject");
config.setVarNameForObject("link");
config.setVarNameForObject("vcard");
config.addNewResource("vcard", DEFAULT_NS_FOR_NEW_RESOURCE);
config.addNewResource("link", DEFAULT_NS_FOR_NEW_RESOURCE);
config.setN3Required(list( this.getN3ForWebpage(), N3_FOR_URLTYPE ));
config.setN3Optional(list( N3_FOR_ANCHOR, N3_FOR_RANK));
config.addUrisInScope("webpageProperty", list( this.getWebpageProperty()));
config.addUrisInScope("inverseProperty", list( this.getWebpageOfProperty()));
config.addUrisInScope("linkClass", list( this.getURLLinkClass()));
config.addUrisInScope("linkURI", list( core + "linkURI" ));
config.addUrisInScope("linkAnchorPredicate", list( core + "linkAnchorText" ));
config.addUrisInScope("webpageProperty", list( "http://purl.obolibrary.org/obo/ARG_2000028" ));
config.addUrisInScope("inverseProperty", list( "http://purl.obolibrary.org/obo/ARG_2000029" ));
config.addUrisInScope("linkUrlPredicate", list( "http://www.w3.org/2006/vcard/ns#url" ));
config.addUrisInScope("linkLabelPredicate", list( "http://www.w3.org/2000/01/rdf-schema#label" ));
config.addUrisInScope("rankPredicate", list( core + "rank"));
config.addSparqlForAdditionalUrisInScope("vcard", individualVcardQuery);
if ( config.isUpdate() ) {
config.addUrisInScope("link", list( linkUri ));
}
config.setUrisOnForm("urlType");
config.setLiteralsOnForm(list("url","anchor","rank"));
config.setLiteralsOnForm(list("url","label","rank"));
config.addSparqlForExistingLiteral("url", URL_QUERY);
config.addSparqlForExistingLiteral("anchor", ANCHOR_QUERY);
config.addSparqlForExistingLiteral("label", ANCHOR_QUERY);
config.addSparqlForExistingLiteral("rank", MAX_RANK_QUERY);
config.addSparqlForExistingUris("urlType", URLTYPE_QUERY);
@ -101,10 +106,10 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
setName("urlType").
setValidators( list("nonempty") ).
setOptions(
new ChildVClassesWithParent(this.getURLLinkClass())));
new ChildVClassesWithParent("http://www.w3.org/2006/vcard/ns#URL")));
config.addField(new FieldVTwo().
setName("anchor"));
setName("label"));
config.addField(new FieldVTwo().
setName("rank").
@ -133,16 +138,17 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
/* ********* N3 Assertions *********** */
static String N3_FOR_WEBPAGE =
"?subject ?webpageProperty ?link . \n"+
"?link ?inverseProperty ?subject . \n"+
"?link a ?linkClass . \n" +
"?link ?linkURI ?url .";
"?subject ?webpageProperty ?vcard . \n"+
"?vcard ?inverseProperty ?subject . \n"+
"?vcard <http://www.w3.org/2006/vcard/ns#hasURL> ?link ."+
"?link a <http://www.w3.org/2006/vcard/ns#URL> . \n" +
"?link ?linkUrlPredicate ?url .";
static String N3_FOR_URLTYPE =
"?link a ?urlType .";
static String N3_FOR_ANCHOR =
"?link ?linkAnchorPredicate ?anchor .";
"?link ?linkLabelPredicate ?label .";
static String N3_FOR_RANK =
"?link ?rankPredicate ?rank .";
@ -150,28 +156,35 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
/* *********** SPARQL queries for existing values ************** */
static String URL_QUERY =
"SELECT ?urlExisting WHERE { ?link ?linkURI ?urlExisting }";
"SELECT ?urlExisting WHERE { ?link ?linkUrlPredicate ?urlExisting }";
static String URLTYPE_QUERY =
"PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" +
"SELECT ?linkClassExisting WHERE { ?link vitro:mostSpecificType ?linkClassExisting }";
static String ANCHOR_QUERY =
"SELECT ?anchorExisting WHERE { ?link ?linkAnchorPredicate ?anchorExisting }";
"SELECT ?labelExisting WHERE { ?link ?linkLabelPredicate ?labelExisting }";
static String RANK_QUERY =
"SELECT ?rankExisting WHERE { ?link ?rankPredicate ?rankExisting }";
static String core = "http://vivoweb.org/ontology/core#";
static String individualVcardQuery =
"SELECT ?existingVcard WHERE { \n" +
"?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?existingVcard . \n" +
"}";
/* Note on ordering by rank in sparql: if there is a non-integer value on a link, that will be returned,
* since it's ranked highest. Preventing that would require getting all the ranks and sorting in Java,
* throwing out non-int values.
*/
private static String MAX_RANK_QUERY = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n"
+ "SELECT DISTINCT ?rank WHERE { \n"
+ " ?subject core:webpage ?link . \n"
+ " ?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?vcard . \n"
+ " ?vcard vcard:hasURL ?link . \n"
+ " ?link core:rank ?rank .\n"
+ "} ORDER BY DESC(?rank) LIMIT 1";
@ -209,23 +222,10 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
return formTemplate;
}
protected String getWebpageProperty() {
return core + "webpage";
}
protected String getWebpageOfProperty() {
return core + "webpageOf";
}
protected String getMaxRankQueryStr() {
return MAX_RANK_QUERY;
}
protected String getURLLinkClass() {
return core + "URLLink";
}
protected String getN3ForWebpage() {
return N3_FOR_WEBPAGE;
}
@ -240,5 +240,9 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
"&editForm=" + UrlBuilder.urlEncode(generatorName);
}
private String getLinkUri(VitroRequest vreq) {
String linkUri = vreq.getParameter("linkUri");
return linkUri;
}
}

View file

@ -0,0 +1,130 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
public class AddFullNameToPersonGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator {
private Log log = LogFactory.getLog(AddFullNameToPersonGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
HttpSession session) throws Exception {
EditConfigurationVTwo conf = new EditConfigurationVTwo();
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
initObjectPropForm(conf, vreq);
String fullNameUri = getFullNameUri(vreq);
conf.setTemplate("addFullNameToPerson.ftl");
conf.setVarNameForSubject("person");
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("individualVcard");
conf.setN3Required( Arrays.asList( n3ForNewName ) );
conf.setN3Optional( Arrays.asList( firstNameAssertion, middleNameAssertion, lastNameAssertion ) );
conf.addNewResource("fullName", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.setLiteralsOnForm(Arrays.asList("firstName", "middleName", "lastName" ));
conf.addSparqlForExistingLiteral("firstName", firstNameQuery);
conf.addSparqlForExistingLiteral("middleName", middleNameQuery);
conf.addSparqlForExistingLiteral("lastName", lastNameQuery);
conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
if ( conf.isUpdate() ) {
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
urisInScope.put("fullName", Arrays.asList(new String[]{fullNameUri}));
conf.addUrisInScope(urisInScope);
}
conf.addField( new FieldVTwo().
setName("firstName")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ));
conf.addField( new FieldVTwo().
setName("middleName")
.setRangeDatatypeUri( XSD.xstring.toString()) );
conf.addField( new FieldVTwo().
setName("lastName")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ));
conf.addValidator(new AntiXssValidation());
prepare(vreq, conf);
return conf;
}
/* N3 assertions */
final static String n3ForNewName =
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasName> ?fullName . \n" +
"?fullName a <http://www.w3.org/2006/vcard/ns#Name> . " ;
final static String firstNameAssertion =
"?fullName <http://www.w3.org/2006/vcard/ns#givenName> ?firstName .";
final static String middleNameAssertion =
"?fullName <http://www.w3.org/2006/vcard/ns#middleName> ?middleName .";
final static String lastNameAssertion =
"?fullName <http://www.w3.org/2006/vcard/ns#familyName> ?lastName .";
/* Queries for editing an existing entry */
final static String individualVcardQuery =
"SELECT ?existingIndividualVcard WHERE { \n" +
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?existingIndividualVcard . \n" +
"}";
final static String firstNameQuery =
"SELECT ?existingFirstName WHERE {\n"+
"?fullName <http://www.w3.org/2006/vcard/ns#givenName> ?existingFirstName . }";
final static String middleNameQuery =
"SELECT ?existingMiddleName WHERE {\n"+
"?fullName <http://www.w3.org/2006/vcard/ns#middleName> ?existingMiddleName . }";
final static String lastNameQuery =
"SELECT ?existingLastName WHERE {\n"+
"?fullName <http://www.w3.org/2006/vcard/ns#familyName> ?existingLastName . }";
private String getFullNameUri(VitroRequest vreq) {
String fullNameUri = vreq.getParameter("fullNameUri");
return fullNameUri;
}
}

View file

@ -451,13 +451,23 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
}
private String getN3FirstNameAssertion() {
return "@prefix foaf: <" + foaf + "> . \n" +
"?newEditor foaf:firstName ?firstName .";
return "@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newEditor <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardEditor . \n" +
"?vcardEditor <http://purl.obolibrary.org/obo/ARG_2000029> ?newEditor . \n" +
"?vcardEditor a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardEditor vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:givenName ?firstName .";
}
private String getN3LastNameAssertion() {
return "@prefix foaf: <" + foaf + "> . \n" +
"?newEditor foaf:lastName ?lastName .";
return "@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newEditor <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardEditor . \n" +
"?vcardEditor <http://purl.obolibrary.org/obo/ARG_2000029> ?newEditor . \n" +
"?vcardEditor a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardEditor vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:familyName ?lastName .";
}
private String getN3ForLocaleAssertion() {
@ -515,6 +525,8 @@ public class AddPublicationToPersonGenerator extends VivoBaseGenerator implement
newResources.put("newConference", DEFAULT_NS_TOKEN);
newResources.put("newEvent", DEFAULT_NS_TOKEN);
newResources.put("newEditor", DEFAULT_NS_TOKEN);
newResources.put("vcardEditor", DEFAULT_NS_TOKEN);
newResources.put("vcardName", DEFAULT_NS_TOKEN);
newResources.put("newPublisher", DEFAULT_NS_TOKEN);
newResources.put("dateTimeNode", DEFAULT_NS_TOKEN);
return newResources;

View file

@ -83,10 +83,14 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
private static String WEBPAGE_QUERY = ""
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
+ "SELECT DISTINCT ?link ?url ?anchor ?rank WHERE { \n"
+ " ?subject core:webpage ?link . \n"
+ " OPTIONAL { ?link core:linkURI ?url } \n"
+ " OPTIONAL { ?link core:linkAnchorText ?anchor } \n"
+ "PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n"
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
+ "SELECT DISTINCT ?vcard ?link ?url ?label ?rank WHERE { \n"
+ " ?subject <http://purl.obolibrary.org/obo/ARG_2000028> ?vcard . \n"
+ " ?vcard vcard:hasURL ?link . \n"
+ " ?link a vcard:URL \n"
+ " OPTIONAL { ?link vcard:url ?url } \n"
+ " OPTIONAL { ?link rdfs:label ?label } \n"
+ " OPTIONAL { ?link core:rank ?rank } \n"
+ "} ORDER BY ?rank";
@ -108,7 +112,7 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
} catch (Exception e) {
log.error(e, e);
}
log.debug("webpages = " + webpages);
return webpages;
}

View file

@ -42,11 +42,20 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
//Optional because user may have selected either person or individual of another kind
//Person uses first name and last name whereas individual of other class would use label
config.setN3Optional(list(
N3_PREFIX + "?newInd foaf:firstName ?firstName ; foaf:lastName ?lastName .",
N3_PREFIX + "@prefix vcard:<http://www.w3.org/2006/vcard/ns#> .\n"
+ " ?newInd <http://purl.obolibrary.org/obo/ARG_2000028> ?newVcardInd . \n"
+ " ?newVcardInd <http://purl.obolibrary.org/obo/ARG_2000029> ?newInd . \n"
+ " ?newVcardInd a <http://www.w3.org/2006/vcard/ns#Individual> . \n"
+ " ?newVcardInd vcard:hasName ?newVcardName . \n"
+ " ?newVcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n"
+ " ?newVcardName vcard:givenName ?firstName . \n"
+ " ?newVcardName vcard:familyName ?lastName .",
N3_PREFIX + " ?newInd <" + RDFS.label.getURI() + "> ?label ."
));
config.addNewResource("newInd", vreq.getWebappDaoFactory().getDefaultNamespace());
config.addNewResource("newVcardInd", vreq.getWebappDaoFactory().getDefaultNamespace());
config.addNewResource("newVcardName", vreq.getWebappDaoFactory().getDefaultNamespace());
config.setUrisOnform(list ());
config.setLiteralsOnForm( list( "label", "firstName", "lastName" ));
@ -73,7 +82,9 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
config.addValidator(new AntiXssValidation());
//This combines the first and last name into the rdfs:label
config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor());
// currently being done via javascript in the template. May use this again
// when/if updated to IFS ontology. tlw72
// config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor());
String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq);
config.setFormUrl(formUrl);

View file

@ -71,6 +71,8 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
conf.addNewResource("advisingRelationship", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("newAdvisee", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("vcardAdvisee", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("vcardName", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("advisorRole", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("adviseeRole", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("newSubjArea", DEFAULT_NS_FOR_NEW_RESOURCE);
@ -229,12 +231,22 @@ public class PersonHasAdvisingRelationshipGenerator extends VivoBaseGenerator im
"?adviseeRole <http://vivoweb.org/ontology/core#relatedBy> ?advisingRelationship . ";
final static String firstNameAssertion =
"@prefix foaf: <" + foaf + "> . \n" +
"?newAdvisee foaf:firstName ?firstName .";
"@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newAdvisee <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardAdvisee . \n" +
"?vcardAdvisee <http://purl.obolibrary.org/obo/ARG_2000029> ?newAdvisee . \n" +
"?vcardAdvisee a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardAdvisee vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:givenName ?firstName .";
final static String lastNameAssertion =
"@prefix foaf: <" + foaf + "> . \n" +
"?newAdvisee foaf:lastName ?lastName .";
"@prefix vcard: <http://www.w3.org/2006/vcard/ns#> . \n" +
"?newAdvisee <http://purl.obolibrary.org/obo/ARG_2000028> ?vcardAdvisee . \n" +
"?vcardAdvisee <http://purl.obolibrary.org/obo/ARG_2000029> ?newAdvisee . \n" +
"?vcardAdvisee a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?vcardAdvisee vcard:hasName ?vcardName . \n" +
"?vcardName a <http://www.w3.org/2006/vcard/ns#Name> . \n" +
"?vcardName vcard:familyName ?lastName .";
final static String degreeAssertion =
"?advisingRelationship <http://vivoweb.org/ontology/core#relates> ?degree . \n" +

View file

@ -0,0 +1,125 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
public class PersonHasEmailGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator {
private Log log = LogFactory.getLog(PersonHasEmailGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
HttpSession session) throws Exception {
EditConfigurationVTwo conf = new EditConfigurationVTwo();
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
initObjectPropForm(conf, vreq);
String emailUri = getEmailUri(vreq);
String rangeUri = getRangeUri(vreq);
conf.setTemplate("personHasEmailAddress.ftl");
conf.setVarNameForSubject("person");
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("individualVcard");
if ( rangeUri.equals("http://www.w3.org/2006/vcard/ns#Work") ) {
conf.setN3Required( Arrays.asList( n3ForNewPrimaryEmail ) );
}
else {
conf.setN3Required( Arrays.asList( n3ForNewEmail ) );
}
conf.setN3Optional( Arrays.asList( emailAddressAssertion ) );
conf.addNewResource("email", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.setLiteralsOnForm(Arrays.asList("emailAddress" ));
conf.addSparqlForExistingLiteral("emailAddress", emailAddressQuery);
conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
if ( conf.isUpdate() ) {
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
urisInScope.put("email", Arrays.asList(new String[]{emailUri}));
conf.addUrisInScope(urisInScope);
}
conf.addField( new FieldVTwo().
setName("emailAddress")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ));
conf.addValidator(new AntiXssValidation());
prepare(vreq, conf);
return conf;
}
/* N3 assertions */
final static String n3ForNewEmail =
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasEmail> ?email . \n" +
"?email a <http://www.w3.org/2006/vcard/ns#Email> . " ;
final static String n3ForNewPrimaryEmail =
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasEmail> ?email . \n" +
"?email a <http://www.w3.org/2006/vcard/ns#Email> . \n" +
"?email a <http://www.w3.org/2006/vcard/ns#Work> ." ;
final static String emailAddressAssertion =
"?email <http://www.w3.org/2006/vcard/ns#email> ?emailAddress .";
/* Queries for editing an existing entry */
final static String individualVcardQuery =
"SELECT ?existingIndividualVcard WHERE { \n" +
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?existingIndividualVcard . \n" +
"}";
final static String emailAddressQuery =
"SELECT ?existingEmailAddress WHERE {\n"+
"?email <http://www.w3.org/2006/vcard/ns#email> ?existingEmailAddress . }";
private String getRangeUri(VitroRequest vreq) {
String rangeUri = vreq.getParameter("rangeUri");
return rangeUri;
}
private String getEmailUri(VitroRequest vreq) {
String emailUri = vreq.getParameter("emailUri");
return emailUri;
}
}

View file

@ -2,14 +2,23 @@
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
@ -18,19 +27,7 @@ import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.
public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator {
final static String addressClass = vivoCore + "Address";
final static String countryPred = vivoCore + "addressCountry";
final static String countryClass = vivoCore + "Country";
final static String addrLine1Pred =vivoCore+"address1" ;
final static String addrLine2Pred =vivoCore+"address2" ;
final static String addrLine3Pred =vivoCore+"address3" ;
final static String cityPred =vivoCore+"addressCity" ;
final static String statePred =vivoCore+"addressState" ;
final static String postalCodePred =vivoCore+"addressPostalCode" ;
final static String mailingAddressPred =vivoCore+"mailingAddress" ;
public PersonHasMailingAddressGenerator() {}
private Log log = LogFactory.getLog(PersonHasMailingAddressGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
@ -41,58 +38,50 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
initObjectPropForm(conf, vreq);
String addressUri = vreq.getParameter("addressUri");
conf.setTemplate("personHasMailingAddress.ftl");
conf.setVarNameForSubject("person");
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("address");
conf.setVarNameForObject("individualVcard");
conf.setN3Required( Arrays.asList( n3ForNewAddress,
addrLabelAssertion,
addressTypeAssertion ) );
conf.setN3Optional( Arrays.asList( addrLineOneAssertion, addrLineTwoAssertion, addrLineThreeAssertion, cityAssertion, stateAssertion, countryAssertion, postalCodeAssertion ) );
conf.setN3Required( Arrays.asList( n3ForNewAddress ) );
conf.setN3Optional( Arrays.asList( streetAddressAssertion,
localityAssertion,
regionAssertion,
countryAssertion,
postalCodeAssertion ) );
conf.addNewResource("address", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE);
//uris in scope: none
//literals in scope: none
conf.setLiteralsOnForm(Arrays.asList("streetAddress", "locality", "postalCode", "country", "region" ));
conf.setUrisOnform(Arrays.asList("addressType"));
conf.setLiteralsOnForm(Arrays.asList("addrLineOne", "addrLineTwo", "addrLineThree", "city", "postalCode", "addrLabel","country", "state" ));
conf.addSparqlForExistingLiteral("addrLabel", addrLabelQuery);
conf.addSparqlForExistingLiteral("addrLineOne", addrLineOneQuery);
conf.addSparqlForExistingLiteral("addrLineTwo", addrLineTwoQuery);
conf.addSparqlForExistingLiteral("addrLineThree", addrLineThreeQuery);
conf.addSparqlForExistingLiteral("city", cityQuery);
conf.addSparqlForExistingLiteral("streetAddress", streetAddressQuery);
conf.addSparqlForExistingLiteral("locality", localityQuery);
conf.addSparqlForExistingLiteral("postalCode", postalCodeQuery);
conf.addSparqlForExistingLiteral("state", stateQuery);
conf.addSparqlForExistingLiteral("region", regionQuery);
conf.addSparqlForExistingLiteral("country", countryQuery);
conf.addSparqlForExistingUris("addressType", addressTypeQuery);
if ( conf.isUpdate() ) {
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
urisInScope.put("address", Arrays.asList(new String[]{addressUri}));
conf.addUrisInScope(urisInScope);
}
else {
conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
}
conf.addField( new FieldVTwo().
setName("country").
setValidators( list("nonempty") ).
setOptions(
new IndividualsViaVClassOptions(
countryClass)));
conf.addField( new FieldVTwo().
setName("addrLineOne")
setName("streetAddress")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ));
conf.addField( new FieldVTwo().
setName("addrLineTwo")
setName("country")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) ));
conf.addField( new FieldVTwo().
setName("addrLineThree")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) ));
setValidators( list("nonempty") ));
conf.addField( new FieldVTwo().
setName("postalCode")
@ -100,25 +89,15 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
setValidators( list("nonempty") ));
conf.addField( new FieldVTwo().
setName("city")
setName("locality")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ) );
conf.addField( new FieldVTwo().
setName("state")
setName("region")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) ) );
conf.addField( new FieldVTwo().
setName("addrLabel")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("datatype:" + XSD.xstring.toString()) ) );
conf.addField( new FieldVTwo().
setName("addressType").
setOptions(new ChildVClassesOptions(
addressClass)) );
conf.addValidator(new AntiXssValidation());
prepare(vreq, conf);
@ -128,77 +107,53 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
/* N3 assertions */
final static String n3ForNewAddress =
"@prefix vivo: <" + vivoCore + "> . \n\n" +
"?person vivo:mailingAddress ?address . \n" +
"?address a vivo:Address . \n" +
"?address vivo:mailingAddressFor ?person . \n" ;
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasAddress> ?address . \n" +
"?address a <http://www.w3.org/2006/vcard/ns#Address> . " ;
final static String addrLineOneAssertion =
"?address <"+ addrLine1Pred +"> ?addrLineOne .";
final static String streetAddressAssertion =
"?address <http://www.w3.org/2006/vcard/ns#streetAddress> ?streetAddress .";
final static String addrLineTwoAssertion =
"?address <"+ addrLine2Pred +"> ?addrLineTwo .";
final static String addrLineThreeAssertion =
"?address <"+ addrLine3Pred +"> ?addrLineThree .";
final static String cityAssertion =
"?address <"+ cityPred +"> ?city .";
final static String localityAssertion =
"?address <http://www.w3.org/2006/vcard/ns#locality> ?locality .";
final static String postalCodeAssertion =
"?address <"+ postalCodePred +"> ?postalCode .";
"?address <http://www.w3.org/2006/vcard/ns#postalCode> ?postalCode .";
final static String stateAssertion =
"?address <"+ statePred +"> ?state .";
final static String regionAssertion =
"?address <http://www.w3.org/2006/vcard/ns#region> ?region .";
final static String countryAssertion =
"?address <" + countryPred + "> ?country .";
final static String addrLabelAssertion =
"?address <" + label + "> ?addrLabel .";
final static String addressTypeAssertion =
"?address a ?addressType .";
"?address <http://www.w3.org/2006/vcard/ns#country> ?country .";
/* Queries for editing an existing entry */
final static String addrLabelQuery =
"SELECT ?existingAddrLabel WHERE { \n" +
" ?address <" + label + "> ?existingAddrLabel . \n" +
final static String individualVcardQuery =
"SELECT ?individualVcard WHERE { \n" +
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"}";
final static String addrLineOneQuery =
"SELECT ?existingaddrLineOne WHERE {\n"+
"?address <"+ addrLine1Pred +"> ?existingaddrLineOne . }";
final static String streetAddressQuery =
"SELECT ?existingStreetAddress WHERE {\n"+
"?address <http://www.w3.org/2006/vcard/ns#streetAddress> ?existingStreetAddress . }";
final static String addrLineTwoQuery =
"SELECT ?existingaddrLineTwo WHERE {\n"+
"?address <"+ addrLine2Pred +"> ?existingaddrLineTwo . }";
final static String localityQuery =
"SELECT ?existingLocality WHERE {\n"+
"?address <http://www.w3.org/2006/vcard/ns#locality> ?existingLocality . }";
final static String addrLineThreeQuery =
"SELECT ?existingaddrLineThree WHERE {\n"+
"?address <"+ addrLine3Pred +"> ?existingaddrLineThree . }";
final static String cityQuery =
"SELECT ?existingCity WHERE {\n"+
"?address <"+ cityPred +"> ?existingCity . }";
final static String stateQuery =
"SELECT ?existingState WHERE {\n"+
"?address <"+ statePred +"> ?existingState . }";
final static String regionQuery =
"SELECT ?existingRegion WHERE {\n"+
"?address <http://www.w3.org/2006/vcard/ns#region> ?existingRegion . }";
final static String postalCodeQuery =
"SELECT ?existingPostalCode WHERE {\n"+
"?address <"+ postalCodePred +"> ?existingPostalCode . }";
"?address <http://www.w3.org/2006/vcard/ns#postalCode> ?existingPostalCode . }";
final static String countryQuery =
"SELECT ?existingCountry WHERE {\n"+
"?address <"+ countryPred +"> ?existingCountry . }";
final static String addressTypeQuery =
"PREFIX vitro: <" + VitroVocabulary.vitroURI + "> \n" +
"SELECT ?existingAddressType WHERE { \n" +
"?address vitro:mostSpecificType ?existingAddressType . }";
"?address <http://www.w3.org/2006/vcard/ns#country> ?existingCountry . }";
}

View file

@ -203,6 +203,7 @@ public class PersonHasPositionHistoryGenerator extends VivoBaseGenerator impleme
"?endNode <" + dateTimeValue + "> ?endField-value . \n" +
"?endNode <" + dateTimePrecision + "> ?endField-precision . \n";
// Queries for existing values
final static String orgLabelQuery =
"SELECT ?existingOrgLabel WHERE { \n" +
" ?position <" + positionInOrgPred + "> ?existingOrg . \n" +
@ -232,7 +233,8 @@ public class PersonHasPositionHistoryGenerator extends VivoBaseGenerator impleme
final static String existingOrgQuery =
"SELECT ?existingOrg WHERE { \n" +
" ?position <" + positionInOrgPred + "> ?existingOrg . }";
" ?position <" + positionInOrgPred + "> ?existingOrg . \n" +
" ?existingOrg a <" + orgClass + "> }";
final static String orgTypeQuery =
"PREFIX rdfs: <" + rdfs + "> \n" +

View file

@ -0,0 +1,105 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpSession;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.vocabulary.XSD;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaVClassOptions;
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
public class PersonHasTelephoneNumberGenerator extends VivoBaseGenerator implements
EditConfigurationGenerator {
private Log log = LogFactory.getLog(PersonHasTelephoneNumberGenerator.class);
@Override
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
HttpSession session) throws Exception {
EditConfigurationVTwo conf = new EditConfigurationVTwo();
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
initObjectPropForm(conf, vreq);
String phoneUri = getPhoneUri(vreq);
conf.setTemplate("personHasTelephoneNumber.ftl");
conf.setVarNameForSubject("person");
conf.setVarNameForPredicate("predicate");
conf.setVarNameForObject("individualVcard");
conf.setN3Required( Arrays.asList( n3ForNewPhone ) );
conf.setN3Optional( Arrays.asList( telephoneNumberAssertion ) );
conf.addNewResource("phone", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.addNewResource("individualVcard", DEFAULT_NS_FOR_NEW_RESOURCE);
conf.setLiteralsOnForm(Arrays.asList("telephoneNumber" ));
conf.addSparqlForExistingLiteral("telephoneNumber", telephoneNumberQuery);
conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
if ( conf.isUpdate() ) {
HashMap<String, List<String>> urisInScope = new HashMap<String, List<String>>();
urisInScope.put("phone", Arrays.asList(new String[]{phoneUri}));
conf.addUrisInScope(urisInScope);
}
conf.addField( new FieldVTwo().
setName("telephoneNumber")
.setRangeDatatypeUri( XSD.xstring.toString() ).
setValidators( list("nonempty") ));
conf.addValidator(new AntiXssValidation());
prepare(vreq, conf);
return conf;
}
/* N3 assertions */
final static String n3ForNewPhone =
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?individualVcard . \n" +
"?individualVcard a <http://www.w3.org/2006/vcard/ns#Individual> . \n" +
"?individualVcard <http://purl.obolibrary.org/obo/ARG_2000029> ?person . \n" +
"?individualVcard <http://www.w3.org/2006/vcard/ns#hasTelephone> ?phone . \n" +
"?phone a <http://www.w3.org/2006/vcard/ns#Telephone> . " ;
final static String telephoneNumberAssertion =
"?phone <http://www.w3.org/2006/vcard/ns#telephone> ?telephoneNumber .";
/* Queries for editing an existing entry */
final static String individualVcardQuery =
"SELECT ?existingIndividualVcard WHERE { \n" +
"?person <http://purl.obolibrary.org/obo/ARG_2000028> ?existingIndividualVcard . \n" +
"}";
final static String telephoneNumberQuery =
"SELECT ?existingTelephoneNumber WHERE {\n"+
"?phone <http://www.w3.org/2006/vcard/ns#telephone> ?existingTelephoneNumber . }";
private String getPhoneUri(VitroRequest vreq) {
String phoneUri = vreq.getParameter("phoneUri");
return phoneUri;
}
}

View file

@ -1694,6 +1694,9 @@ input[type="submit"] {
.checkboxSpacer {
margin-left:150px;
}
p.address-line {
margin-bottom: 0.3em;
}
/* EDITING DISPLAY------> */
.edit-individual {
border-left: 1px dotted #B2D15A;

View file

@ -500,16 +500,14 @@ academic_studies_or_other = Academic Studies or Other Training
edit_mailing_address = Edit Mailing Address
create_mailing_address = Create Mailing Address
mailing_address_for = mailing address for
select_a_country = Please select a country.
enter_address1_value = Please enter a value in the Address Line 1 field.
enter_a_city = Please enter a value in the City field.
enter_a_country = Please enter a value in the Country field.
enter_street_address = Please enter a value in the Street Address field.
enter_a_locality = Please enter a value in the City/Locality field.
enter_postal_code = Please enter a value in the Postal Code field.
country = Country
street_Address1 = Street Address 1
street_Address2 = Street Address 2
street_Address3 = Street Address 3
city = City
state = State
street_address = Street Address
city_locality = City/Locality
region = State/Province/Region
postal_code = Postal Code
posn_entry_for = position entry for
@ -831,3 +829,16 @@ selected_presentation = Selected Presentation
event_capitalized = Event
collection_capitalized = Collection
item_capitalized = Item
telephone_number_for = telephone number for
telephone_number = Telephone Number
enter_telephone_number = Please enter a value in the Telephone Number field.
email_address = Email Address
email_address_for = email address for
enter_email_address = Please enter a value in the Email Address field.
full_name = Full Name
full_name_for = full name for
enter_first_name = Please enter a value in the First Name field.
enter_last_name = Please enter a value in the Last Name field.
first_name = First Name
middle_name = Middle Name
last_name = Last Name