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 + } + } + + + + 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 + } + } + + + + 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 - } - } - - - - + + + + + + + + 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 + } + } + + + + 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 + } + } + + + + 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 + } + } + + + + 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 } } + 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 @@ @@ -65,8 +65,8 @@ <#list email.statements as statement>
  • style="padding-left:10px;"> - - <@p.editingLinks "${email.localName}" statement editable /> + + <@p.editingLinks "${email.localName}" "${email.name}" statement editable />
  • 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 > <#-- Primary Email --> -<@emailLinks "${core}primaryEmail" primaryEmail /> +<@emailLinks "primaryEmail" primaryEmail /> <#-- Additional Emails --> -<@emailLinks "${core}email" addlEmail /> +<@emailLinks "email" addlEmail /> <#-- Phone --> @@ -24,8 +24,8 @@ @@ -33,7 +33,7 @@ <#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 @@ 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 /> - 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} + + + \ 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!} + + + \ 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 statement.street2?has_content> - <#if !statement.street1?has_content> - - <#else> -
    ${statement.street2}
    - - - - <#if statement.street3?has_content> - <#if !statement.street1?has_content && !statement.street2?has_content> - - <#else> -
    ${statement.street3}
    - - + <#if statement.street?has_content> +

    + ${statement.street} +

    + - <#-- 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 cityStateZip><@s.join [ cityState!, statement.postalCode!], " " /> - <#if cityStateZip?has_content> -
    ${cityStateZip}
    - - <#else> - <#if statement.city?has_content>
    ${statement.city!}
    - <#if statement.state?has_content>
    ${statement.state}
    - <#if statement.postalCode?has_content>
    ${statement.postalCode}
    - - - <#if statement.country?has_content> -
    ${statement.country}
    - -
    - - <#-- 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 cityStateZip><@s.join [ cityState!, statement.postalCode!], " " /> + <#if cityStateZip?has_content> +

    ${cityStateZip}

    +

    ${statement.country!}

    + + <#else> + <#if statement.locality?has_content> +

    + ${statement.locality} +

    + + <#if statement.region?has_content> +

    + ${statement.region} +

    + + <#if statement.postalCode?has_content> +

    + ${statement.postalCode} +

    + + <#if statement.country?has_content> +

    + ${statement.country} +

    + - - \ No newline at end of file + + \ 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} + + + \ 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> 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> 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 @@ - - + + <#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"> + + +<#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 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=""/> + + +<#assign requiredHint = " *" /> + +

    ${titleVerb} ${i18n().full_name_for} ${editConfiguration.subjectName}

    + +<#--Display error messages if any--> +<#if submissionErrors?has_content> + + + +<@lvf.unsupportedBrowser urls.base /> + +
    + +
    + +

    + + +

    + +

    + + +

    + +

    + + +

    + + + +

    + ${i18n().or} + ${i18n().cancel_link} +

    + +

    * ${i18n().required_fields}

    + +
    + +
    + +${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 @@