diff --git a/productMods/css/individual/individual-qr.css b/productMods/css/individual/individual-qr.css new file mode 100644 index 00000000..0cc45308 --- /dev/null +++ b/productMods/css/individual/individual-qr.css @@ -0,0 +1,23 @@ +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +.qrCode { + float: left; +} +img.qrCode { + margin-bottom: 2em; +} +.vcard { + clear: left; +} +h2 em { + font-style: normal; + font-size: .7em; +} +section h4 { + margin-top: 2em; + padding-bottom: 0; +} +section textarea { + width: 600px; + height: 120px; +} \ No newline at end of file diff --git a/productMods/images/individual/qr_icon.png b/productMods/images/individual/qr_icon.png new file mode 100644 index 00000000..79af01b0 Binary files /dev/null and b/productMods/images/individual/qr_icon.png differ diff --git a/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl b/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl index 12c75be1..dbab2238 100644 --- a/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl +++ b/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl @@ -2,37 +2,31 @@ <#-- Page providing options for disseminating QR codes --> -<#include "individual-qrCodeFoafPerson.ftl"> +<#include "individual-qrCodeGenerator.ftl"> <#assign qrCodeWidth = "150"> -

Export QR Code

-
-
- <#assign thumbUrl = individual.thumbUrl! "${urls.images}/placeholders/person.thumbnail.jpg" > - -
-
-

${individual.nameStatement.value}

-
-
-
+

Export QR Code (What is this?)

-
-

VCard

+<#assign thumbUrl = individual.thumbUrl! "${urls.images}/placeholders/person.thumbnail.jpg" > + + +

${individual.nameStatement.value}

+ +
+

VCard

<@qrCodeVCard qrCodeWidth="150" /> - <#t> -
+ -
-

Hyperlink

+
+

Hyperlink

<@qrCodeLink qrCodeWidth="150" /> - <#t> -
- - + +${stylesheets.add('')} \ No newline at end of file diff --git a/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl b/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl index 3c2b575d..82d48d4b 100644 --- a/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl +++ b/productMods/templates/freemarker/body/individual/individual--foaf-person.ftl @@ -4,8 +4,6 @@ <#include "individual-setup.ftl"> -<#include "individual-qrCodeFoafPerson.ftl"> -
@@ -34,6 +32,8 @@ <#if rdfUrl??>
  • RDF
  • + + <#include "individual-qrCodeFoafPerson.ftl"> @@ -41,16 +41,6 @@ <#-- Links --> <@p.vitroLinks propertyGroups namespaces editable "individual-urls-people" /> - - <#-- QR Codes --> - <#if hasValidVCard()> -
    - vCard QR What is this? - - <@qrCodeVCard qrCodeWidth="150" /> - -
    -
    diff --git a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl index a84023c3..467c52d4 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl @@ -1,123 +1,7 @@ <#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#-- QR code --> - -<#macro qrCodeVCard qrCodeWidth> - - <#local qrCodeUrl = getQrCodeUrlForVCard(qrCodeWidth)> - - <#if qrCodeUrl != ""> - - - - -<#macro qrCodeLink qrCodeWidth> - - <#local qrCodeUrl = getQrCodeUrlForLink(qrCodeWidth)> - - <#if qrCodeUrl != ""> - - - - - - -<#function getQrCodeUrlForVCard qrCodeWidth> - - <#local qrData = individual.qrData > - - <#local core = "http://vivoweb.org/ontology/core#"> - <#local foaf = "http://xmlns.com/foaf/0.1/"> - <#local rdfs = "http://www.w3.org/2000/01/rdf-schema#"> - - <#local firstName = qrData.firstName! > - <#local lastName = qrData.lastName! > - <#local org = "" > - <#local title = qrData.preferredTitle! > - <#local phoneNumber = qrData.phoneNumber! > - <#local email = qrData.email! > - <#local url = qrData.externalUrl! > - <#local photo = individual.thumbUrl! > - <#local rev = "" > - - <#local qrCodeUrl = ""> - <#if firstName != "" && lastName != ""> - <#local vCard><#t> - BEGIN:VCARD<#lt> - VERSION:3.0<#lt> - N:${lastName};${firstName}<#lt> - FN:${firstName} ${lastName}<#lt> - <#if org != ""> ORG:${org}<#lt> - <#if title != "">TITLE:${title}<#lt> - <#if phoneNumber != "">TEL;TYPE=WORK,VOICE:${phoneNumber}<#lt> - <#if email != "">EMAIL;TYPE=PREF,INTERNET:${email}<#lt> - <#if url != "">URL:${url}<#lt> - <#if photo != "">PHOTO;VALUE=URL;TYPE=JPG:${photo}<#lt> - <#if rev != "">REV:${rev}<#lt> - END:VCARD<#t> - <#t> - - <#local vCard = (removeBlankLines(vCard))?url> - - <#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" > - - - <#return qrCodeUrl> - - - - -<#function getQrCodeUrlForLink qrCodeWidth> - - <#local qrData = individual.qrData > - - <#local url = qrData.externalUrl! > - - <#local qrCodeUrl = ""> - <#if url != ""> - <#local qrCodeContent = url?url> - <#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${qrCodeContent}&choe=UTF-8" > - - - <#return qrCodeUrl> - - - - -<#function removeBlankLines input> - - <#local test = "\n\n"> - <#local replacement = "\n"> - - <#local output = input> - - <#local maxLoop = 50> - <#list 1..maxLoop as i> - <#if output?contains(test)> - <#local output = output?replace(test, replacement)> - <#else> - <#break> - - - - <#return output> - - -<#function hasValidVCard> - - <#local qrData = individual.qrData > - - <#local firstName = qrData.firstName! > - <#local lastName = qrData.lastName! > - - <#local validVCard = false> - <#if firstName != "" && lastName != ""> - <#local validVCard = true> - - - <#return validVCard> - - - - +<#include "individual-qrCodeGenerator.ftl"> +<#if hasValidVCard()> +
  • qr icon
  • + \ No newline at end of file diff --git a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeGenerator.ftl b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeGenerator.ftl new file mode 100644 index 00000000..21e72246 --- /dev/null +++ b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeGenerator.ftl @@ -0,0 +1,119 @@ +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> + +<#-- QR code --> + +<#macro qrCodeVCard qrCodeWidth> + + <#local qrCodeUrl = getQrCodeUrlForVCard(qrCodeWidth)> + + <#if qrCodeUrl != ""> + + + + +<#macro qrCodeLink qrCodeWidth> + + <#local qrCodeUrl = getQrCodeUrlForLink(qrCodeWidth)> + + <#if qrCodeUrl != ""> + + + + + + +<#function getQrCodeUrlForVCard qrCodeWidth> + + <#local qrData = individual.qrData > + + <#local core = "http://vivoweb.org/ontology/core#"> + <#local foaf = "http://xmlns.com/foaf/0.1/"> + <#local rdfs = "http://www.w3.org/2000/01/rdf-schema#"> + + <#local firstName = qrData.firstName! > + <#local lastName = qrData.lastName! > + <#local org = "" > + <#local title = qrData.preferredTitle! > + <#local phoneNumber = qrData.phoneNumber! > + <#local email = qrData.email! > + <#local url = qrData.externalUrl! > + <#local photo = individual.thumbUrl! > + <#local rev = "" > + + <#local qrCodeUrl = ""> + <#if firstName != "" && lastName != ""> + <#local vCard><#t> + BEGIN:VCARD<#lt> + VERSION:3.0<#lt> + N:${lastName};${firstName}<#lt> + FN:${firstName} ${lastName}<#lt> + <#if org != ""> ORG:${org}<#lt> + <#if title != "">TITLE:${title}<#lt> + <#if phoneNumber != "">TEL;TYPE=WORK,VOICE:${phoneNumber}<#lt> + <#if email != "">EMAIL;TYPE=PREF,INTERNET:${email}<#lt> + <#if url != "">URL:${url}<#lt> + <#if photo != "">PHOTO;VALUE=URL;TYPE=JPG:${photo}<#lt> + <#if rev != "">REV:${rev}<#lt> + END:VCARD<#t> + <#t> + + <#local vCard = (removeBlankLines(vCard))?url> + + <#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" > + + + <#return qrCodeUrl> + + + + +<#function getQrCodeUrlForLink qrCodeWidth> + + <#local qrData = individual.qrData > + + <#local url = qrData.externalUrl! > + + <#local qrCodeUrl = ""> + <#if url != ""> + <#local qrCodeContent = url?url> + <#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${qrCodeContent}&choe=UTF-8" > + + + <#return qrCodeUrl> + + + + +<#function removeBlankLines input> + + <#local test = "\n\n"> + <#local replacement = "\n"> + + <#local output = input> + + <#local maxLoop = 50> + <#list 1..maxLoop as i> + <#if output?contains(test)> + <#local output = output?replace(test, replacement)> + <#else> + <#break> + + + + <#return output> + + +<#function hasValidVCard> + + <#local qrData = individual.qrData > + + <#local firstName = qrData.firstName! > + <#local lastName = qrData.lastName! > + + <#local validVCard = false> + <#if firstName != "" && lastName != ""> + <#local validVCard = true> + + + <#return validVCard> + \ No newline at end of file