individual-qrCodeFoafPerson.ftl: add hasValidVCard function, remove tabs
individual--foaf-person.ftl: use hasValidVCard function in commented-out QR code section
This commit is contained in:
parent
1c3df021cf
commit
41aa28ed03
2 changed files with 92 additions and 73 deletions
|
@ -71,12 +71,14 @@
|
|||
<@p.vitroLinks propertyGroups namespaces editable "individual-urls-people" />
|
||||
|
||||
<#--
|
||||
<div style="border:1px solid #cccccc">
|
||||
<span style="padding-left:5px">vCard QR <a style="font-size:smaller" href="${individual.qrData.aboutQrCodesUrl}">What is this?</a></span>
|
||||
<a title="Export QR codes" href="${individual.qrData.exportQrCodeUrl}">
|
||||
<@qrCodeVCard qrCodeWidth="150" />
|
||||
</a>
|
||||
</div>
|
||||
<#if hasValidVCard()>
|
||||
<div style="border:1px solid #cccccc">
|
||||
<span style="padding-left:5px">vCard QR <a style="font-size:smaller" href="${individual.qrData.aboutQrCodesUrl}">What is this?</a></span>
|
||||
<a title="Export QR codes" href="${individual.qrData.exportQrCodeUrl}">
|
||||
<@qrCodeVCard qrCodeWidth="150" />
|
||||
</a>
|
||||
</div>
|
||||
</#if>
|
||||
-->
|
||||
</section>
|
||||
|
||||
|
|
|
@ -4,103 +4,120 @@
|
|||
|
||||
<#macro qrCodeVCard qrCodeWidth>
|
||||
|
||||
<#local qrCodeUrl = getQrCodeUrlForVCard(qrCodeWidth)>
|
||||
|
||||
<#if qrCodeUrl != "">
|
||||
<img src="${qrCodeUrl}" />
|
||||
</#if>
|
||||
<#local qrCodeUrl = getQrCodeUrlForVCard(qrCodeWidth)>
|
||||
|
||||
<#if qrCodeUrl != "">
|
||||
<img src="${qrCodeUrl}" />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#macro qrCodeLink qrCodeWidth>
|
||||
|
||||
<#local qrCodeUrl = getQrCodeUrlForLink(qrCodeWidth)>
|
||||
|
||||
<#if qrCodeUrl != "">
|
||||
<img src="${qrCodeUrl}" />
|
||||
</#if>
|
||||
<#local qrCodeUrl = getQrCodeUrlForLink(qrCodeWidth)>
|
||||
|
||||
<#if qrCodeUrl != "">
|
||||
<img src="${qrCodeUrl}" />
|
||||
</#if>
|
||||
</#macro>
|
||||
|
||||
|
||||
|
||||
<#function getQrCodeUrlForVCard qrCodeWidth>
|
||||
|
||||
<#local qrData = individual.qrData >
|
||||
<#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 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 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}</#if><#lt>
|
||||
<#if title != "">TITLE:${title}</#if><#lt>
|
||||
<#if phoneNumber != "">TEL;TYPE=WORK,VOICE:${phoneNumber}</#if><#lt>
|
||||
<#if email != "">EMAIL;TYPE=PREF,INTERNET:${email}</#if><#lt>
|
||||
<#if url != "">URL:${url}</#if><#lt>
|
||||
<#if photo != "">PHOTO;VALUE=URL;TYPE=JPG:${photo}</#if><#lt>
|
||||
<#if rev != "">REV:${rev}</#if><#lt>
|
||||
END:VCARD<#t>
|
||||
</#local><#t>
|
||||
|
||||
<#local vCard = (removeBlankLines(vCard))?url>
|
||||
<#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}</#if><#lt>
|
||||
<#if title != "">TITLE:${title}</#if><#lt>
|
||||
<#if phoneNumber != "">TEL;TYPE=WORK,VOICE:${phoneNumber}</#if><#lt>
|
||||
<#if email != "">EMAIL;TYPE=PREF,INTERNET:${email}</#if><#lt>
|
||||
<#if url != "">URL:${url}</#if><#lt>
|
||||
<#if photo != "">PHOTO;VALUE=URL;TYPE=JPG:${photo}</#if><#lt>
|
||||
<#if rev != "">REV:${rev}</#if><#lt>
|
||||
END:VCARD<#t>
|
||||
</#local><#t>
|
||||
|
||||
<#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" >
|
||||
</#if>
|
||||
|
||||
<#return qrCodeUrl>
|
||||
<#local vCard = (removeBlankLines(vCard))?url>
|
||||
|
||||
<#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" >
|
||||
</#if>
|
||||
|
||||
<#return qrCodeUrl>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
<#function getQrCodeUrlForLink qrCodeWidth>
|
||||
|
||||
<#local qrData = individual.qrData >
|
||||
<#local qrData = individual.qrData >
|
||||
|
||||
<#local url = qrData.externalUrl! >
|
||||
<#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" >
|
||||
</#if>
|
||||
|
||||
<#return qrCodeUrl>
|
||||
<#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" >
|
||||
</#if>
|
||||
|
||||
<#return qrCodeUrl>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
<#function removeBlankLines input>
|
||||
|
||||
<#local test = "\n\n">
|
||||
<#local replacement = "\n">
|
||||
<#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>
|
||||
</#if>
|
||||
</#list>
|
||||
<#local output = input>
|
||||
|
||||
<#return output>
|
||||
<#local maxLoop = 50>
|
||||
<#list 1..maxLoop as i>
|
||||
<#if output?contains(test)>
|
||||
<#local output = output?replace(test, replacement)>
|
||||
<#else>
|
||||
<#break>
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
<#return output>
|
||||
</#function>
|
||||
|
||||
<#function hasValidVCard>
|
||||
|
||||
<#local qrData = individual.qrData >
|
||||
|
||||
<#local firstName = qrData.firstName! >
|
||||
<#local lastName = qrData.lastName! >
|
||||
|
||||
<#local validVCard = false>
|
||||
<#if firstName != "" && lastName != "">
|
||||
<#local validVCard = true>
|
||||
</#if>
|
||||
|
||||
<#return validVCard>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue