From c5d0bc21e897c6d8640ca83bc1d13d26139a7d16 Mon Sep 17 00:00:00 2001
From: tworrall
Date: Wed, 18 Sep 2013 11:33:31 -0400
Subject: [PATCH] VIVO-112: ISF changes relating to vcard classes
---
.../themes/wilma/i18n/all_es.properties | 29 +-
.../config/listViewConfig-additionalEmail.xml | 42 ++
.../config/listViewConfig-fullName.xml | 46 +++
.../config/listViewConfig-mailingAddress.xml | 122 +++---
.../config/listViewConfig-primaryEmail.xml | 46 +++
.../config/listViewConfig-telephoneNumber.xml | 42 ++
productMods/config/listViewConfig-webpage.xml | 42 +-
.../individual-contactInfo-2column.ftl | 14 +-
.../individual/individual-contactInfo.ftl | 20 +-
.../individual/individual-webpage.ftl | 10 +-
.../individual/propStatement-emailAddress.ftl | 17 +
.../individual/propStatement-fullName.ftl | 17 +
.../propStatement-mailingAddress.ftl | 91 ++---
.../propStatement-telephoneNumber.ftl | 17 +
.../propStatement-webpage-quickview.ftl | 2 +-
.../individual/propStatement-webpage.ftl | 2 +-
.../edit/forms/addEditWebpageForm.ftl | 6 +-
.../edit/forms/addFullNameToPerson.ftl | 102 +++++
.../edit/forms/js/mailingAddressUtils.js | 147 -------
.../edit/forms/js/newIndividualFormUtils.js | 37 ++
.../forms/manageWebpagesForIndividual.ftl | 6 +-
.../edit/forms/newIndividualForm.ftl | 3 +
.../edit/forms/personHasEmailAddress.ftl | 86 +++++
.../edit/forms/personHasMailingAddress.ftl | 174 ++-------
.../edit/forms/personHasTelephoneNumber.ftl | 86 +++++
rdf/display/everytime/PropertyConfig.n3 | 79 +++-
...AuthorsToInformationResourceGenerator.java | 93 ++++-
.../AddEditWebpageFormGenerator.java | 70 ++--
.../AddFullNameToPersonGenerator.java | 130 +++++++
.../AddPublicationToPersonGenerator.java | 20 +-
.../ManageWebpagesForIndividualGenerator.java | 14 +-
.../NewIndividualFormGenerator.java | 365 +++++++++---------
...ersonHasAdvisingRelationshipGenerator.java | 20 +-
.../generators/PersonHasEmailGenerator.java | 125 ++++++
.../PersonHasMailingAddressGenerator.java | 179 ++++-----
.../PersonHasPositionHistoryGenerator.java | 4 +-
.../PersonHasTelephoneNumberGenerator.java | 105 +++++
themes/wilma/css/wilma.css | 3 +
themes/wilma/i18n/all.properties | 29 +-
39 files changed, 1611 insertions(+), 831 deletions(-)
create mode 100644 productMods/config/listViewConfig-additionalEmail.xml
create mode 100644 productMods/config/listViewConfig-fullName.xml
create mode 100644 productMods/config/listViewConfig-primaryEmail.xml
create mode 100644 productMods/config/listViewConfig-telephoneNumber.xml
create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-emailAddress.ftl
create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl
create mode 100644 productMods/templates/freemarker/body/partials/individual/propStatement-telephoneNumber.ftl
create mode 100644 productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl
delete mode 100644 productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js
create mode 100644 productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js
create mode 100644 productMods/templates/freemarker/edit/forms/personHasEmailAddress.ftl
create mode 100644 productMods/templates/freemarker/edit/forms/personHasTelephoneNumber.ftl
create mode 100644 src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java
create mode 100644 src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEmailGenerator.java
create mode 100644 src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasTelephoneNumberGenerator.java
diff --git a/languages/example/themes/wilma/i18n/all_es.properties b/languages/example/themes/wilma/i18n/all_es.properties
index e4bffa47..24ae36e4 100644
--- a/languages/example/themes/wilma/i18n/all_es.properties
+++ b/languages/example/themes/wilma/i18n/all_es.properties
@@ -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
@@ -815,4 +813,17 @@ local_research = Investigación Local
selected_presentation = Presentación Seleccionado
event_capitalized = Evento
collection_capitalized = Colección
-item_capitalized = Artículo
\ No newline at end of file
+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
\ No newline at end of file
diff --git a/productMods/config/listViewConfig-additionalEmail.xml b/productMods/config/listViewConfig-additionalEmail.xml
new file mode 100644
index 00000000..50dc4188
--- /dev/null
+++ b/productMods/config/listViewConfig-additionalEmail.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+
+ SELECT DISTINCT ?vcard ?email
+ ?emailAddress
+ WHERE {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasEmail ?email
+ OPTIONAL { ?email vcard:email ?emailAddress }
+ MINUS {?email a vcard:Work}
+ }
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+ 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
+ }
+ }
+
+
+ propStatement-emailAddress.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
+
diff --git a/productMods/config/listViewConfig-fullName.xml b/productMods/config/listViewConfig-fullName.xml
new file mode 100644
index 00000000..c986c87c
--- /dev/null
+++ b/productMods/config/listViewConfig-fullName.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+
+ 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 }
+
+ }
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+ 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
+ }
+ }
+
+
+ propStatement-fullName.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
+
diff --git a/productMods/config/listViewConfig-mailingAddress.xml b/productMods/config/listViewConfig-mailingAddress.xml
index 75049f33..a16c9a6b 100644
--- a/productMods/config/listViewConfig-mailingAddress.xml
+++ b/productMods/config/listViewConfig-mailingAddress.xml
@@ -1,71 +1,51 @@
-
-
-
-
-
-
-
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
- PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
- PREFIX vivo: <http://vivoweb.org/ontology/core#>
-
- SELECT DISTINCT ?subclass
- ?address
- ?localName
- ?label
- ?street1
- ?street2
- ?street3
- ?city
- ?state
- ?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 }
-
- OPTIONAL { ?address vitro:mostSpecificType ?subclass .
- ?subclass rdfs:subClassOf vivo:Address
- }
-
- } ORDER BY ?country ?label
-
-
-
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- PREFIX vivo: <http://vivoweb.org/ontology/core#>
- CONSTRUCT {
- ?subclass rdfs:subClassOf vivo:Address
- } WHERE {
- ?subclass rdfs:subClassOf vivo:Address
- }
-
-
-
- PREFIX vivo: <http://vivoweb.org/ontology/core#>
- PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
- CONSTRUCT {
- ?subject ?property ?address .
- ?address ?addressProperty ?addressValue
- } WHERE {
- {
- ?subject ?property ?address
- } UNION {
- ?subject ?property ?address .
- ?address ?addressProperty ?addressValue
- }
- }
-
-
- propStatement-mailingAddress.ftl
-
+
+
+
+
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+
+ SELECT DISTINCT ?vcard ?address
+ ?street
+ ?locality
+ ?region
+ ?postalCode
+ ?country
+
+ WHERE {
+ ?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 }
+
+ } ORDER BY ?country ?region ?street
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+ CONSTRUCT {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasAddress ?address .
+ ?address ?addressProperty ?addressValue
+ } WHERE {
+ {
+ ?subject ?property ?vcard
+ } UNION {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasAddress ?address
+ } UNION {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasAddress ?address .
+ ?address ?addressProperty ?addressValue
+ }
+ }
+
+
+ propStatement-mailingAddress.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
+
diff --git a/productMods/config/listViewConfig-primaryEmail.xml b/productMods/config/listViewConfig-primaryEmail.xml
new file mode 100644
index 00000000..7f749dd4
--- /dev/null
+++ b/productMods/config/listViewConfig-primaryEmail.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+
+ SELECT DISTINCT ?vcard ?email
+ ?emailAddress
+ WHERE {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasEmail ?email .
+ ?email a vcard:Work
+ OPTIONAL { ?email vcard:email ?emailAddress }
+
+ }
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+ 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
+ }
+ }
+
+
+ propStatement-emailAddress.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
+
diff --git a/productMods/config/listViewConfig-telephoneNumber.xml b/productMods/config/listViewConfig-telephoneNumber.xml
new file mode 100644
index 00000000..6ab383cb
--- /dev/null
+++ b/productMods/config/listViewConfig-telephoneNumber.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+
+ SELECT DISTINCT ?vcard ?phone
+ ?number
+ WHERE {
+ ?subject ?property ?vcard .
+ ?vcard vcard:hasTelephone ?phone
+ OPTIONAL { ?phone vcard:telephone ?number }
+
+ }
+
+
+
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
+ 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
+ }
+ }
+
+
+ propStatement-telephoneNumber.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
+
diff --git a/productMods/config/listViewConfig-webpage.xml b/productMods/config/listViewConfig-webpage.xml
index e1c26599..58ddf13c 100644
--- a/productMods/config/listViewConfig-webpage.xml
+++ b/productMods/config/listViewConfig-webpage.xml
@@ -9,35 +9,55 @@
PREFIX afn: <http://jena.hpl.hp.com/ARQ/function#>
PREFIX core: <http://vivoweb.org/ontology/core#>
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
- 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 }
FILTER ( bound(?url) )
- } ORDER BY ?rank ?anchor
+ } ORDER BY ?rank ?label
+ PREFIX core: <http://vivoweb.org/ontology/core#>
+ PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
+ PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
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
}
}
propStatement-webpage.ftl
+ edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.MaintainDuplicatesObjectPropertyDataPostProcessor
diff --git a/productMods/templates/freemarker/body/partials/individual/individual-contactInfo-2column.ftl b/productMods/templates/freemarker/body/partials/individual/individual-contactInfo-2column.ftl
index a221398a..5a02ac66 100644
--- a/productMods/templates/freemarker/body/partials/individual/individual-contactInfo-2column.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/individual-contactInfo-2column.ftl
@@ -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 ) >
${i18n().contact_capitalized}
@@ -39,8 +39,8 @@
<#list phone.statements as statement>
style="padding-left:10px;"#if>>
- ${statement.value}
- <@p.editingLinks "${phone.localName}" statement editable />
+ ${statement.number!}
+ <@p.editingLinks "${phone.localName}" "${phone.name}" statement editable />
#list>
@@ -65,8 +65,8 @@
<#list email.statements as statement>
style="padding-left:10px;"#if>>
- ${statement.value}
- <@p.editingLinks "${email.localName}" statement editable />
+ ${statement.emailAddress!}
+ <@p.editingLinks "${email.localName}" "${email.name}" statement editable />
#list>
diff --git a/productMods/templates/freemarker/body/partials/individual/individual-contactInfo.ftl b/productMods/templates/freemarker/body/partials/individual/individual-contactInfo.ftl
index 05003ce9..065a9aa6 100644
--- a/productMods/templates/freemarker/body/partials/individual/individual-contactInfo.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/individual-contactInfo.ftl
@@ -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 >
#if>
<#-- Primary Email -->
-<@emailLinks "${core}primaryEmail" primaryEmail />
+<@emailLinks "primaryEmail" primaryEmail />
<#-- Additional Emails -->
-<@emailLinks "${core}email" addlEmail />
+<@emailLinks "email" addlEmail />
<#-- Phone -->
@@ -24,8 +24,8 @@
style="list-style:none;margin-left:0;"#if>>
<#list phone.statements as statement>
- ${statement.value}
- <@p.editingLinks "${phone.localName}" statement editable />
+ ${statement.number!}
+ <@p.editingLinks "${phone.localName}" "${phone.name}" statement editable />
#list>
@@ -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 @@
style="list-style:none;margin-left:0;"#if>>
<#list email.statements as statement>
- ${statement.value}
- <@p.editingLinks "${email.localName}" statement editable />
+ ${statement.emailAddress!}
+ <@p.editingLinks "${email.localName}" "${email.name}" statement editable />
#list>
diff --git a/productMods/templates/freemarker/body/partials/individual/individual-webpage.ftl b/productMods/templates/freemarker/body/partials/individual/individual-webpage.ftl
index d0a0b826..e6bbac81 100644
--- a/productMods/templates/freemarker/body/partials/individual/individual-webpage.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/individual-webpage.ftl
@@ -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() >
@@ -19,4 +12,3 @@
<@p.objectProperty webpage editable />
#if>
-
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-emailAddress.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-emailAddress.ftl
new file mode 100644
index 00000000..05799c7e
--- /dev/null
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-emailAddress.ftl
@@ -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>
\ No newline at end of file
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl
new file mode 100644
index 00000000..8352bf1a
--- /dev/null
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-fullName.ftl
@@ -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!} ${statement.middleName!} ${statement.lastName!}
+ #if>
+
+#macro>
\ No newline at end of file
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl
index cb001c38..f5a45eec 100644
--- a/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-mailingAddress.ftl
@@ -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 -->
-
- <#if statement.street1?has_content>
-
- #if>
-
- <#if statement.street2?has_content>
- <#if !statement.street1?has_content>
-
- <#else>
-
${statement.street2}
- #if>
- #if>
-
- <#if statement.street3?has_content>
- <#if !statement.street1?has_content && !statement.street2?has_content>
-
- <#else>
-
${statement.street3}
- #if>
- #if>
+ <#if statement.street?has_content>
+
+ ${statement.street}
+
+ #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>
- <#local cityStateZip><@s.join [ cityState!, statement.postalCode!], " " />#local>
- <#if cityStateZip?has_content>
-
${cityStateZip}
- #if>
- <#else>
- <#if statement.city?has_content>
${statement.city!}
#if>
- <#if statement.state?has_content>
${statement.state}
#if>
- <#if statement.postalCode?has_content>
${statement.postalCode}
#if>
- #if>
-
- <#if statement.country?has_content>
-
${statement.country}
- #if>
-
-
- <#-- 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. -->
- ${statement.label!statement.localName}
- <#else>
- ${statement.label!}
+ <#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!], " " />#local>
+ <#if cityStateZip?has_content>
+ ${cityStateZip}
+ ${statement.country!}
+ #if>
+ <#else>
+ <#if statement.locality?has_content>
+
+ ${statement.locality}
+
+ #if>
+ <#if statement.region?has_content>
+
+ ${statement.region}
+
+ #if>
+ <#if statement.postalCode?has_content>
+
+ ${statement.postalCode}
+
+ #if>
+ <#if statement.country?has_content>
+
+ ${statement.country}
+
+ #if>
#if>
-
- #macro>
\ No newline at end of file
+
+#macro>
\ No newline at end of file
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-telephoneNumber.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-telephoneNumber.ftl
new file mode 100644
index 00000000..2e97990b
--- /dev/null
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-telephoneNumber.ftl
@@ -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>
\ No newline at end of file
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-webpage-quickview.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-webpage-quickview.ftl
index 725603c6..0fc71494 100644
--- a/productMods/templates/freemarker/body/partials/individual/propStatement-webpage-quickview.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-webpage-quickview.ftl
@@ -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>
diff --git a/productMods/templates/freemarker/body/partials/individual/propStatement-webpage.ftl b/productMods/templates/freemarker/body/partials/individual/propStatement-webpage.ftl
index 55084052..2c2fde31 100644
--- a/productMods/templates/freemarker/body/partials/individual/propStatement-webpage.ftl
+++ b/productMods/templates/freemarker/body/partials/individual/propStatement-webpage.ftl
@@ -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>
diff --git a/productMods/templates/freemarker/edit/forms/addEditWebpageForm.ftl b/productMods/templates/freemarker/edit/forms/addEditWebpageForm.ftl
index a19b9e21..bf818392 100644
--- a/productMods/templates/freemarker/edit/forms/addEditWebpageForm.ftl
+++ b/productMods/templates/freemarker/edit/forms/addEditWebpageForm.ftl
@@ -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 @@
URL ${requiredHint}
- ${i18n().webpage_name}
-
+ ${i18n().webpage_name}
+
<#if editMode="add">
diff --git a/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl b/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl
new file mode 100644
index 00000000..5f448533
--- /dev/null
+++ b/productMods/templates/freemarker/edit/forms/addFullNameToPerson.ftl
@@ -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 = " * " />
+
+${titleVerb} ${i18n().full_name_for} ${editConfiguration.subjectName}
+
+<#--Display error messages if any-->
+<#if submissionErrors?has_content>
+
+
+
+ <#--Checking if any required fields are empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "firstName")>
+ ${i18n().enter_first_name}
+ #if>
+ <#if lvf.submissionErrorExists(editSubmission, "lastName")>
+ ${i18n().enter_last_name}
+ #if>
+
+
+#if>
+
+<@lvf.unsupportedBrowser urls.base />
+
+
+
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+
+${scripts.add('',
+ '',
+ '',
+ '')}
+
+
diff --git a/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js b/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js
deleted file mode 100644
index 037ab0f9..00000000
--- a/productMods/templates/freemarker/edit/forms/js/mailingAddressUtils.js
+++ /dev/null
@@ -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($(" ")
- .attr("value","")
- .text(mailingAddressUtils.selectOne));
- this.countrySelector.val(country);
- }
- else if ( mode == "add" ) {
- this.countrySelector.prepend($(" ")
- .attr("value","")
- .text(mailingAddressUtils.selectOne));
- }
- else if ( mode == "edit" || country.length > 1 ) {
- this.countrySelector.prepend($(" ")
- .attr("value","")
- .text(mailingAddressUtils.selectOne));
- this.countrySelector.val(country);
- }
- else if ( country.length == 0 ) {
- this.countrySelector.prepend($(" ")
- .attr("value","")
- .text(mailingAddressUtils.selectOne));
- this.countrySelector.val(country);
- }
- }
-}
\ No newline at end of file
diff --git a/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js b/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js
new file mode 100644
index 00000000..d1cbbf33
--- /dev/null
+++ b/productMods/templates/freemarker/edit/forms/js/newIndividualFormUtils.js
@@ -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();
+});
diff --git a/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl b/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl
index d480933e..c4f0b1d0 100644
--- a/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl
+++ b/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl
@@ -29,8 +29,8 @@
+
+
<#else>
${i18n().name_capitalized} ${requiredHint}
@@ -75,3 +77,4 @@
${stylesheets.add(' ')}
+${scripts.add('')}
\ No newline at end of file
diff --git a/productMods/templates/freemarker/edit/forms/personHasEmailAddress.ftl b/productMods/templates/freemarker/edit/forms/personHasEmailAddress.ftl
new file mode 100644
index 00000000..8d498191
--- /dev/null
+++ b/productMods/templates/freemarker/edit/forms/personHasEmailAddress.ftl
@@ -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 = " * " />
+
+
${titleVerb} ${i18n().email_address_for} ${editConfiguration.subjectName}
+
+<#--Display error messages if any-->
+<#if submissionErrors?has_content>
+
+
+
+ <#--Checking if any required fields are empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "emailAddress")>
+ ${i18n().enter_email_address}
+ #if>
+
+
+#if>
+
+<@lvf.unsupportedBrowser urls.base />
+
+
+
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+
+${scripts.add('',
+ '',
+ '',
+ '')}
+
+
diff --git a/productMods/templates/freemarker/edit/forms/personHasMailingAddress.ftl b/productMods/templates/freemarker/edit/forms/personHasMailingAddress.ftl
index 029872a5..99236069 100644
--- a/productMods/templates/freemarker/edit/forms/personHasMailingAddress.ftl
+++ b/productMods/templates/freemarker/edit/forms/personHasMailingAddress.ftl
@@ -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 @@
<#--Checking if any required fields are empty-->
<#if lvf.submissionErrorExists(editSubmission, "country")>
- ${i18n().select_a_country}
+ ${i18n().enter_a_country}
#if>
- <#if lvf.submissionErrorExists(editSubmission, "addrLineOne")>
- ${i18n().enter_address1_value}
+ <#if lvf.submissionErrorExists(editSubmission, "streetAddress")>
+ ${i18n().enter_street_address}
#if>
- <#if lvf.submissionErrorExists(editSubmission, "city")>
- ${i18n().enter_a_city}
+ <#if lvf.submissionErrorExists(editSubmission, "locality")>
+ ${i18n().enter_a_locality}
#if>
<#if lvf.submissionErrorExists(editSubmission, "postalCode")>
${i18n().enter_postal_code}
@@ -74,138 +70,43 @@
+
-
-
-
-
-
-
${stylesheets.add(' ')}
${stylesheets.add(' ')}
@@ -214,7 +115,6 @@ ${stylesheets.add(' ',
'',
'',
- '',
'')}
diff --git a/productMods/templates/freemarker/edit/forms/personHasTelephoneNumber.ftl b/productMods/templates/freemarker/edit/forms/personHasTelephoneNumber.ftl
new file mode 100644
index 00000000..c3493c29
--- /dev/null
+++ b/productMods/templates/freemarker/edit/forms/personHasTelephoneNumber.ftl
@@ -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 = " * " />
+
+${titleVerb} ${i18n().mailing_address_for} ${editConfiguration.subjectName}
+
+<#--Display error messages if any-->
+<#if submissionErrors?has_content>
+
+
+
+ <#--Checking if any required fields are empty-->
+ <#if lvf.submissionErrorExists(editSubmission, "telephoneNumber")>
+ ${i18n().enter_telephone_number}
+ #if>
+
+
+#if>
+
+<@lvf.unsupportedBrowser urls.base />
+
+
+
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+${stylesheets.add(' ')}
+
+${scripts.add('',
+ '',
+ '',
+ '')}
+
+
diff --git a/rdf/display/everytime/PropertyConfig.n3 b/rdf/display/everytime/PropertyConfig.n3
index 477e5c07..1dc439da 100644
--- a/rdf/display/everytime/PropertyConfig.n3
+++ b/rdf/display/everytime/PropertyConfig.n3
@@ -347,15 +347,90 @@ local:informationResourceInAuthorshipConfig a :ObjectPropertyDisplayConfig ;
### vcard properties ###
local:mailingAddressContext a :ConfigContext ;
:hasConfiguration local:mailingAddressConfig ;
- :configContextFor ;
+ :configContextFor ;
:qualifiedByDomain ;
:qualifiedBy .
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"^^ ;
:propertyGroup .
+
+local:telephoneContext a :ConfigContext ;
+ :hasConfiguration local:telephoneConfig ;
+ :configContextFor ;
+ :qualifiedByDomain ;
+ :qualifiedBy .
+
+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"^^ ;
+ :propertyGroup .
+
+local:additionalEmailContext a :ConfigContext ;
+ :hasConfiguration local:additionalEmailConfig ;
+ :configContextFor ;
+ :qualifiedByDomain ;
+ :qualifiedBy .
+
+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"^^ ;
+ :propertyGroup .
+
+local:primaryEmailContext a :ConfigContext ;
+ :hasConfiguration local:primaryEmailConfig ;
+ :configContextFor ;
+ :qualifiedByDomain ;
+ :qualifiedBy .
+
+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"^^ ;
+ :propertyGroup .
+
+local:webpageContext a :ConfigContext ;
+ :hasConfiguration local:webpageConfig ;
+ :configContextFor ;
+ :qualifiedByDomain ;
+ :qualifiedBy .
+
+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"^^ ;
+ :propertyGroup .
+
+local:fullNameContext a :ConfigContext ;
+ :hasConfiguration local:fullNameConfig ;
+ :configContextFor ;
+ :qualifiedByDomain ;
+ :qualifiedBy .
+
+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"^^ ;
+ :propertyGroup .
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
index 0d0b191f..be5d8f05 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddAuthorsToInformationResourceGenerator.java
@@ -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: . \n" +
+ "?newPerson ?vcardPerson . \n" +
+ "?vcardPerson ?newPerson . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:givenName ?firstName .";
}
private String getN3NewPersonMiddleName() {
return getN3PrefixString() +
- "?newPerson core:middleName ?middleName .";
+ "@prefix vcard: . \n" +
+ "?newPerson ?vcardPerson . \n" +
+ "?vcardPerson ?newPerson . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:middleName ?middleName .";
}
private String getN3NewPersonLastName() {
return getN3PrefixString() +
- "?newPerson foaf:lastName ?lastName .";
+ "@prefix vcard: . \n" +
+ "?newPerson ?vcardPerson . \n" +
+ "?vcardPerson ?newPerson . \n" +
+ "?vcardPerson a . \n" +
+ "?vcardPerson vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:familyName ?lastName .";
}
private String getN3NewPerson() {
@@ -177,6 +201,8 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
HashMap newResources = new HashMap();
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 formSpecificData = new HashMap();
@@ -329,11 +345,49 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
List 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: \n"
+ + "PREFIX afn: \n"
+ + "PREFIX rdfs: \n"
+ + "PREFIX foaf: \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> getExistingAuthorships(String subjectUri, VitroRequest vreq) {
+
+ String queryStr = QueryUtils.subUriForQueryVar(this.getAuthorshipsQuery(), "subject", subjectUri);
+ log.debug("Query string is: " + queryStr);
+ List> authorshipss = new ArrayList>();
+ 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 getAuthorshipInfo(
List authorships) {
List info = new ArrayList();
@@ -368,9 +422,6 @@ public class AddAuthorsToInformationResourceGenerator extends VivoBaseGenerator
return maxRank;
}
-
-
-
private void sortAuthorshipIndividuals(List 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;
+// }
+
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java
index b63fcc7d..c2b0b9a1 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java
@@ -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 ?link ."+
+ "?link a . \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 ?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: \n"
+ + "PREFIX vcard: \n"
+ "SELECT DISTINCT ?rank WHERE { \n"
- + " ?subject core:webpage ?link . \n"
+ + " ?subject ?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;
+ }
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java
new file mode 100644
index 00000000..172d49ac
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddFullNameToPersonGenerator.java
@@ -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> urisInScope = new HashMap>();
+ 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 ?individualVcard . \n" +
+ "?individualVcard a . \n" +
+ "?individualVcard ?person . \n" +
+ "?individualVcard ?fullName . \n" +
+ "?fullName a . " ;
+
+ final static String firstNameAssertion =
+ "?fullName ?firstName .";
+
+ final static String middleNameAssertion =
+ "?fullName ?middleName .";
+
+ final static String lastNameAssertion =
+ "?fullName ?lastName .";
+
+ /* Queries for editing an existing entry */
+
+ final static String individualVcardQuery =
+ "SELECT ?existingIndividualVcard WHERE { \n" +
+ "?person ?existingIndividualVcard . \n" +
+ "}";
+
+ final static String firstNameQuery =
+ "SELECT ?existingFirstName WHERE {\n"+
+ "?fullName ?existingFirstName . }";
+
+ final static String middleNameQuery =
+ "SELECT ?existingMiddleName WHERE {\n"+
+ "?fullName ?existingMiddleName . }";
+
+ final static String lastNameQuery =
+ "SELECT ?existingLastName WHERE {\n"+
+ "?fullName ?existingLastName . }";
+
+ private String getFullNameUri(VitroRequest vreq) {
+ String fullNameUri = vreq.getParameter("fullNameUri");
+
+ return fullNameUri;
+ }
+}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPublicationToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPublicationToPersonGenerator.java
index ba44e6e3..f30cc908 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPublicationToPersonGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddPublicationToPersonGenerator.java
@@ -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: . \n" +
+ "?newEditor ?vcardEditor . \n" +
+ "?vcardEditor ?newEditor . \n" +
+ "?vcardEditor a . \n" +
+ "?vcardEditor vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:givenName ?firstName .";
}
private String getN3LastNameAssertion() {
- return "@prefix foaf: <" + foaf + "> . \n" +
- "?newEditor foaf:lastName ?lastName .";
+ return "@prefix vcard: . \n" +
+ "?newEditor ?vcardEditor . \n" +
+ "?vcardEditor ?newEditor . \n" +
+ "?vcardEditor a . \n" +
+ "?vcardEditor vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \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;
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageWebpagesForIndividualGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageWebpagesForIndividualGenerator.java
index 1a82911c..90effba9 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageWebpagesForIndividualGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageWebpagesForIndividualGenerator.java
@@ -83,10 +83,14 @@ public class ManageWebpagesForIndividualGenerator extends BaseEditConfigurationG
private static String WEBPAGE_QUERY = ""
+ "PREFIX 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: \n"
+ + "PREFIX rdfs: \n"
+ + "SELECT DISTINCT ?vcard ?link ?url ?label ?rank WHERE { \n"
+ + " ?subject ?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;
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java
index 60d4f156..0fd76116 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/NewIndividualFormGenerator.java
@@ -1,177 +1,188 @@
-/* $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.HashMap;
-import java.util.List;
-
-import javax.servlet.http.HttpSession;
-
-import com.hp.hpl.jena.rdf.model.Literal;
-import com.hp.hpl.jena.vocabulary.RDFS;
-import com.hp.hpl.jena.vocabulary.XSD;
-
-import edu.cornell.mannlib.vitro.webapp.beans.VClass;
-import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
-import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
-import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
-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.FieldVTwo;
-import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.FoafNameToRdfsLabelPreprocessor;
-import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
-
-/**
- * Generates the edit configuration for a default property form.
- * ModelChangePreprocessor creates the rdfs:label statement.
- */
-public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator implements EditConfigurationGenerator {
-
- @Override
- public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
-
- EditConfigurationVTwo config = new EditConfigurationVTwo();
-
- config.setTemplate( "newIndividualForm.ftl" );
-
- config.setN3Required( list(
- "?newInd <" + VitroVocabulary.RDF_TYPE + "> <" + getTypeOfNew(vreq) + "> ."
- ));
- //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 + "?newInd <" + RDFS.label.getURI() + "> ?label ."
- ));
-
- config.addNewResource("newInd", vreq.getWebappDaoFactory().getDefaultNamespace());
-
- config.setUrisOnform(list ());
- config.setLiteralsOnForm( list( "label", "firstName", "lastName" ));
- setUrisAndLiteralsInScope(config);
- //No SPARQL queries for existing since this is only used to create new, never for edit
-
- config.addField(new FieldVTwo().
- setName("firstName").
- setRangeDatatypeUri(XSD.xstring.getURI()).
- setValidators(getFirstNameValidators(vreq)));
-
- config.addField(new FieldVTwo().
- setName("lastName").
- setRangeDatatypeUri(XSD.xstring.getURI()).
- setValidators(getLastNameValidators(vreq)));
-
- config.addField(new FieldVTwo().
- setName("label").
- setRangeDatatypeUri(XSD.xstring.getURI()).
- setValidators(getLabelValidators(vreq)));
-
- addFormSpecificData(config, vreq);
-
- config.addValidator(new AntiXssValidation());
-
- //This combines the first and last name into the rdfs:label
- config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor());
-
- String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq);
- config.setFormUrl(formUrl);
-
- //Note, the spaces are important - they were added by ProcessRdfFormController earlier
- //as a means of ensuring the substitution worked correctly - as the regex expects spaces
- config.setEntityToReturnTo(" ?newInd ");
- prepare(vreq, config);
- return config;
- }
-
- //first and last name have validators if is person is true
- private List getFirstNameValidators(VitroRequest vreq) {
- List validators = new ArrayList();
- if(isPersonType(vreq)) {
- validators.add("nonempty");
- }
- return validators;
- }
-
- private List getLastNameValidators(VitroRequest vreq) {
- List validators = new ArrayList();
- if(isPersonType(vreq)) {
- validators.add("nonempty");
- }
- return validators;
- }
-
- //validate label if person is not true
- private List getLabelValidators(VitroRequest vreq) {
- List validators = new ArrayList();
- if(!isPersonType(vreq)) {
- validators.add("nonempty");
- }
- return validators;
- }
-
- //Get parameter from HTTP request for type of new individual
- private String getTypeOfNew(VitroRequest vreq) {
- String typeUri = vreq.getParameter("typeOfNew");
- if( typeUri == null || typeUri.trim().isEmpty() )
- return getFOAFPersonClassURI();
- else
- return typeUri;
- }
-
- //Form specific data
- public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
- HashMap formSpecificData = new HashMap();
- formSpecificData.put("typeName", getTypeName(vreq));
- //Put in whether or not person type
- if(isPersonType(vreq)) {
- //Doing this b/c unsure how freemarker will handle boolean value from JAVA
- formSpecificData.put("isPersonType", "true");
- } else {
- formSpecificData.put("isPersonType", "false");
-
- }
- editConfiguration.setFormSpecificData(formSpecificData);
- }
-
- private String getTypeName(VitroRequest vreq) {
- String typeOfNew = getTypeOfNew(vreq);
- VClass type = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(typeOfNew);
- return type.getName();
- }
-
- public String getFOAFPersonClassURI() {
- return "http://xmlns.com/foaf/0.1/Person";
- }
-
- public boolean isPersonType(VitroRequest vreq) {
- WebappDaoFactory wdf = vreq.getWebappDaoFactory();
- Boolean isPersonType = Boolean.FALSE;
- String foafPersonType = getFOAFPersonClassURI();
- List superTypes = wdf.getVClassDao().getAllSuperClassURIs(getTypeOfNew(vreq));
- if( superTypes != null ){
- for( String typeUri : superTypes){
- if( foafPersonType.equals(typeUri)) {
- isPersonType = Boolean.TRUE;
- break;
- }
- }
- }
- return isPersonType;
- }
- private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration) {
- HashMap> urisInScope = new HashMap>();
- //note that at this point the subject, predicate, and object var parameters have already been processed
- urisInScope.put(editConfiguration.getVarNameForSubject(),
- Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
- urisInScope.put(editConfiguration.getVarNameForPredicate(),
- Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
- editConfiguration.setUrisInScope(urisInScope);
- //Uris in scope include subject, predicate, and object var
-
- editConfiguration.setLiteralsInScope(new HashMap>());
- }
-
- private String N3_PREFIX = "@prefix foaf: .\n";
-}
+/* $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.HashMap;
+import java.util.List;
+
+import javax.servlet.http.HttpSession;
+
+import com.hp.hpl.jena.rdf.model.Literal;
+import com.hp.hpl.jena.vocabulary.RDFS;
+import com.hp.hpl.jena.vocabulary.XSD;
+
+import edu.cornell.mannlib.vitro.webapp.beans.VClass;
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
+import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
+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.FieldVTwo;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.FoafNameToRdfsLabelPreprocessor;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation;
+
+/**
+ * Generates the edit configuration for a default property form.
+ * ModelChangePreprocessor creates the rdfs:label statement.
+ */
+public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator implements EditConfigurationGenerator {
+
+ @Override
+ public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) {
+
+ EditConfigurationVTwo config = new EditConfigurationVTwo();
+
+ config.setTemplate( "newIndividualForm.ftl" );
+
+ config.setN3Required( list(
+ "?newInd <" + VitroVocabulary.RDF_TYPE + "> <" + getTypeOfNew(vreq) + "> ."
+ ));
+ //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 + "@prefix vcard: .\n"
+ + " ?newInd ?newVcardInd . \n"
+ + " ?newVcardInd ?newInd . \n"
+ + " ?newVcardInd a . \n"
+ + " ?newVcardInd vcard:hasName ?newVcardName . \n"
+ + " ?newVcardName a . \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" ));
+ setUrisAndLiteralsInScope(config);
+ //No SPARQL queries for existing since this is only used to create new, never for edit
+
+ config.addField(new FieldVTwo().
+ setName("firstName").
+ setRangeDatatypeUri(XSD.xstring.getURI()).
+ setValidators(getFirstNameValidators(vreq)));
+
+ config.addField(new FieldVTwo().
+ setName("lastName").
+ setRangeDatatypeUri(XSD.xstring.getURI()).
+ setValidators(getLastNameValidators(vreq)));
+
+ config.addField(new FieldVTwo().
+ setName("label").
+ setRangeDatatypeUri(XSD.xstring.getURI()).
+ setValidators(getLabelValidators(vreq)));
+
+ addFormSpecificData(config, vreq);
+
+ config.addValidator(new AntiXssValidation());
+
+ //This combines the first and last name into the rdfs:label
+ // 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);
+
+ //Note, the spaces are important - they were added by ProcessRdfFormController earlier
+ //as a means of ensuring the substitution worked correctly - as the regex expects spaces
+ config.setEntityToReturnTo(" ?newInd ");
+ prepare(vreq, config);
+ return config;
+ }
+
+ //first and last name have validators if is person is true
+ private List getFirstNameValidators(VitroRequest vreq) {
+ List validators = new ArrayList();
+ if(isPersonType(vreq)) {
+ validators.add("nonempty");
+ }
+ return validators;
+ }
+
+ private List getLastNameValidators(VitroRequest vreq) {
+ List validators = new ArrayList();
+ if(isPersonType(vreq)) {
+ validators.add("nonempty");
+ }
+ return validators;
+ }
+
+ //validate label if person is not true
+ private List getLabelValidators(VitroRequest vreq) {
+ List validators = new ArrayList();
+ if(!isPersonType(vreq)) {
+ validators.add("nonempty");
+ }
+ return validators;
+ }
+
+ //Get parameter from HTTP request for type of new individual
+ private String getTypeOfNew(VitroRequest vreq) {
+ String typeUri = vreq.getParameter("typeOfNew");
+ if( typeUri == null || typeUri.trim().isEmpty() )
+ return getFOAFPersonClassURI();
+ else
+ return typeUri;
+ }
+
+ //Form specific data
+ public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) {
+ HashMap formSpecificData = new HashMap();
+ formSpecificData.put("typeName", getTypeName(vreq));
+ //Put in whether or not person type
+ if(isPersonType(vreq)) {
+ //Doing this b/c unsure how freemarker will handle boolean value from JAVA
+ formSpecificData.put("isPersonType", "true");
+ } else {
+ formSpecificData.put("isPersonType", "false");
+
+ }
+ editConfiguration.setFormSpecificData(formSpecificData);
+ }
+
+ private String getTypeName(VitroRequest vreq) {
+ String typeOfNew = getTypeOfNew(vreq);
+ VClass type = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(typeOfNew);
+ return type.getName();
+ }
+
+ public String getFOAFPersonClassURI() {
+ return "http://xmlns.com/foaf/0.1/Person";
+ }
+
+ public boolean isPersonType(VitroRequest vreq) {
+ WebappDaoFactory wdf = vreq.getWebappDaoFactory();
+ Boolean isPersonType = Boolean.FALSE;
+ String foafPersonType = getFOAFPersonClassURI();
+ List superTypes = wdf.getVClassDao().getAllSuperClassURIs(getTypeOfNew(vreq));
+ if( superTypes != null ){
+ for( String typeUri : superTypes){
+ if( foafPersonType.equals(typeUri)) {
+ isPersonType = Boolean.TRUE;
+ break;
+ }
+ }
+ }
+ return isPersonType;
+ }
+ private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration) {
+ HashMap> urisInScope = new HashMap>();
+ //note that at this point the subject, predicate, and object var parameters have already been processed
+ urisInScope.put(editConfiguration.getVarNameForSubject(),
+ Arrays.asList(new String[]{editConfiguration.getSubjectUri()}));
+ urisInScope.put(editConfiguration.getVarNameForPredicate(),
+ Arrays.asList(new String[]{editConfiguration.getPredicateUri()}));
+ editConfiguration.setUrisInScope(urisInScope);
+ //Uris in scope include subject, predicate, and object var
+
+ editConfiguration.setLiteralsInScope(new HashMap>());
+ }
+
+ private String N3_PREFIX = "@prefix foaf: .\n";
+}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java
index cd5b0092..fe137c04 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasAdvisingRelationshipGenerator.java
@@ -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 ?advisingRelationship . ";
final static String firstNameAssertion =
- "@prefix foaf: <" + foaf + "> . \n" +
- "?newAdvisee foaf:firstName ?firstName .";
+ "@prefix vcard: . \n" +
+ "?newAdvisee ?vcardAdvisee . \n" +
+ "?vcardAdvisee ?newAdvisee . \n" +
+ "?vcardAdvisee a . \n" +
+ "?vcardAdvisee vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:givenName ?firstName .";
final static String lastNameAssertion =
- "@prefix foaf: <" + foaf + "> . \n" +
- "?newAdvisee foaf:lastName ?lastName .";
+ "@prefix vcard: . \n" +
+ "?newAdvisee ?vcardAdvisee . \n" +
+ "?vcardAdvisee ?newAdvisee . \n" +
+ "?vcardAdvisee a . \n" +
+ "?vcardAdvisee vcard:hasName ?vcardName . \n" +
+ "?vcardName a . \n" +
+ "?vcardName vcard:familyName ?lastName .";
final static String degreeAssertion =
"?advisingRelationship ?degree . \n" +
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEmailGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEmailGenerator.java
new file mode 100644
index 00000000..28de70a8
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasEmailGenerator.java
@@ -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> urisInScope = new HashMap>();
+ 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 ?individualVcard . \n" +
+ "?individualVcard a . \n" +
+ "?individualVcard ?person . \n" +
+ "?individualVcard ?email . \n" +
+ "?email a . " ;
+
+ final static String n3ForNewPrimaryEmail =
+ "?person ?individualVcard . \n" +
+ "?individualVcard a . \n" +
+ "?individualVcard ?person . \n" +
+ "?individualVcard ?email . \n" +
+ "?email a . \n" +
+ "?email a ." ;
+
+ final static String emailAddressAssertion =
+ "?email ?emailAddress .";
+
+ /* Queries for editing an existing entry */
+
+ final static String individualVcardQuery =
+ "SELECT ?existingIndividualVcard WHERE { \n" +
+ "?person ?existingIndividualVcard . \n" +
+ "}";
+
+ final static String emailAddressQuery =
+ "SELECT ?existingEmailAddress WHERE {\n"+
+ "?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;
+ }
+}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasMailingAddressGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasMailingAddressGenerator.java
index 1e54a758..bde067ee 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasMailingAddressGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasMailingAddressGenerator.java
@@ -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,20 +27,8 @@ 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,
HttpSession session) throws Exception {
@@ -40,59 +37,51 @@ public class PersonHasMailingAddressGenerator extends VivoBaseGenerator implemen
initBasics(conf, vreq);
initPropertyParameters(vreq, session, conf);
- initObjectPropForm(conf, vreq);
+ 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);
+
+ conf.setLiteralsOnForm(Arrays.asList("streetAddress", "locality", "postalCode", "country", "region" ));
- //uris in scope: none
- //literals in scope: none
-
- 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("country", countryQuery);
+ conf.addSparqlForExistingLiteral("region", regionQuery);
+ conf.addSparqlForExistingLiteral("country", countryQuery);
- conf.addSparqlForExistingUris("addressType", addressTypeQuery);
-
- conf.addField( new FieldVTwo().
- setName("country").
- setValidators( list("nonempty") ).
- setOptions(
- new IndividualsViaVClassOptions(
- countryClass)));
+ if ( conf.isUpdate() ) {
+ HashMap> urisInScope = new HashMap>();
+ urisInScope.put("address", Arrays.asList(new String[]{addressUri}));
+ conf.addUrisInScope(urisInScope);
+ }
+ else {
+ conf.addSparqlForAdditionalUrisInScope("individualVcard", individualVcardQuery);
+ }
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 ?individualVcard . \n" +
+ "?individualVcard a . \n" +
+ "?individualVcard ?person . \n" +
+ "?individualVcard ?address . \n" +
+ "?address a . " ;
- final static String addrLineOneAssertion =
- "?address <"+ addrLine1Pred +"> ?addrLineOne .";
+ final static String streetAddressAssertion =
+ "?address ?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 ?locality .";
final static String postalCodeAssertion =
- "?address <"+ postalCodePred +"> ?postalCode .";
+ "?address ?postalCode .";
- final static String stateAssertion =
- "?address <"+ statePred +"> ?state .";
+ final static String regionAssertion =
+ "?address ?region .";
final static String countryAssertion =
- "?address <" + countryPred + "> ?country .";
-
- final static String addrLabelAssertion =
- "?address <" + label + "> ?addrLabel .";
-
- final static String addressTypeAssertion =
- "?address a ?addressType .";
+ "?address ?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 ?individualVcard . \n" +
"}";
- final static String addrLineOneQuery =
- "SELECT ?existingaddrLineOne WHERE {\n"+
- "?address <"+ addrLine1Pred +"> ?existingaddrLineOne . }";
+ final static String streetAddressQuery =
+ "SELECT ?existingStreetAddress WHERE {\n"+
+ "?address ?existingStreetAddress . }";
- final static String addrLineTwoQuery =
- "SELECT ?existingaddrLineTwo WHERE {\n"+
- "?address <"+ addrLine2Pred +"> ?existingaddrLineTwo . }";
+ final static String localityQuery =
+ "SELECT ?existingLocality WHERE {\n"+
+ "?address ?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 ?existingRegion . }";
final static String postalCodeQuery =
"SELECT ?existingPostalCode WHERE {\n"+
- "?address <"+ postalCodePred +"> ?existingPostalCode . }";
+ "?address ?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 ?existingCountry . }";
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasPositionHistoryGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasPositionHistoryGenerator.java
index 9053c48e..f22463cd 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasPositionHistoryGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasPositionHistoryGenerator.java
@@ -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" +
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasTelephoneNumberGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasTelephoneNumberGenerator.java
new file mode 100644
index 00000000..bdfb65ba
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/PersonHasTelephoneNumberGenerator.java
@@ -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> urisInScope = new HashMap>();
+ 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 ?individualVcard . \n" +
+ "?individualVcard a . \n" +
+ "?individualVcard ?person . \n" +
+ "?individualVcard ?phone . \n" +
+ "?phone a . " ;
+
+ final static String telephoneNumberAssertion =
+ "?phone ?telephoneNumber .";
+
+ /* Queries for editing an existing entry */
+
+ final static String individualVcardQuery =
+ "SELECT ?existingIndividualVcard WHERE { \n" +
+ "?person ?existingIndividualVcard . \n" +
+ "}";
+
+ final static String telephoneNumberQuery =
+ "SELECT ?existingTelephoneNumber WHERE {\n"+
+ "?phone ?existingTelephoneNumber . }";
+
+ private String getPhoneUri(VitroRequest vreq) {
+ String phoneUri = vreq.getParameter("phoneUri");
+
+ return phoneUri;
+ }
+}
diff --git a/themes/wilma/css/wilma.css b/themes/wilma/css/wilma.css
index b7143d30..e8395b0f 100644
--- a/themes/wilma/css/wilma.css
+++ b/themes/wilma/css/wilma.css
@@ -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;
diff --git a/themes/wilma/i18n/all.properties b/themes/wilma/i18n/all.properties
index a0f2585f..aa78e21c 100644
--- a/themes/wilma/i18n/all.properties
+++ b/themes/wilma/i18n/all.properties
@@ -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
@@ -830,4 +828,17 @@ local_research = Local Research
selected_presentation = Selected Presentation
event_capitalized = Event
collection_capitalized = Collection
-item_capitalized = Item
\ No newline at end of file
+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