individual-qrCodeFoafPerson.ftl: URL encoding, remove blank lines, formatting
This commit is contained in:
parent
cf9626d47c
commit
bbbf604a17
1 changed files with 47 additions and 21 deletions
|
@ -27,30 +27,56 @@ END:VCARD
|
||||||
|
|
||||||
<#local firstName = (allProperties.getProperty("${foaf}firstName").firstValue)! >
|
<#local firstName = (allProperties.getProperty("${foaf}firstName").firstValue)! >
|
||||||
<#local lastName = (allProperties.getProperty("${foaf}lastName").firstValue)! >
|
<#local lastName = (allProperties.getProperty("${foaf}lastName").firstValue)! >
|
||||||
<#local org = "temp" >
|
<#local org = "" >
|
||||||
<#local title = "temp" >
|
<#local title = (allProperties.getProperty("${core}preferredTitle").firstValue)! >
|
||||||
<#local phoneNumber = (allProperties.getProperty("${core}phoneNumber").firstValue)! >
|
<#local phoneNumber = (allProperties.getProperty("${core}phoneNumber").firstValue)! >
|
||||||
<#local email = (allProperties.getProperty("${core}email").firstValue)! >
|
<#local email = (allProperties.getProperty("${core}email").firstValue)! >
|
||||||
<#local url = "temp" >
|
<#local url = urls.currentPage! >
|
||||||
<#local photo = "temp" >
|
<#local photo = individual.thumbUrl! >
|
||||||
<#local rev = "temp" >
|
<#local rev = "temp" >
|
||||||
|
|
||||||
<#assign vCard><#t>
|
<#if firstName != "" && lastName != "">
|
||||||
BEGIN:VCARD<#lt>
|
<#local vCard><#t>
|
||||||
VERSION:3.0<#lt>
|
BEGIN:VCARD<#lt>
|
||||||
N:${lastName};${firstName}<#lt>
|
VERSION:3.0<#lt>
|
||||||
FN:${firstName} ${lastName}<#lt>
|
N:${lastName};${firstName}<#lt>
|
||||||
ORG:${org}<#lt>
|
FN:${firstName} ${lastName}<#lt>
|
||||||
TITLE:${title}<#lt>
|
<#if org != ""> ORG:${org}</#if><#lt>
|
||||||
TEL;TYPE=WORK,VOICE:${phoneNumber}<#lt>
|
<#if title != "">TITLE:${title}</#if><#lt>
|
||||||
EMAIL;TYPE=PREF,INTERNET:${email}<#lt>
|
<#if phoneNumber != "">TEL;TYPE=WORK,VOICE:${phoneNumber}</#if><#lt>
|
||||||
URL:${url}<#lt>
|
<#if email != "">EMAIL;TYPE=PREF,INTERNET:${email}</#if><#lt>
|
||||||
PHOTO;VALUE=URL;TYPE=JPG:${photo}<#lt>
|
<#if url != "">URL:${url}</#if><#lt>
|
||||||
REV:${rev}<#lt>
|
<#if photo != "">PHOTO;VALUE=URL;TYPE=JPG:${photo}</#if><#lt>
|
||||||
END:VCARD<#t>
|
<#if rev != "">REV:${rev}</#if><#lt>
|
||||||
</#assign><#t>
|
END:VCARD<#t>
|
||||||
|
</#local><#t>
|
||||||
|
|
||||||
<#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" >
|
<#local vCard = (removeBlankLines(vCard))?url>
|
||||||
|
|
||||||
<img src="${qrCodeUrl}" />
|
<#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" >
|
||||||
|
|
||||||
|
<img src="${qrCodeUrl}" />
|
||||||
|
</#if>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
|
<#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>
|
||||||
|
</#if>
|
||||||
|
</#list>
|
||||||
|
|
||||||
|
<#return output>
|
||||||
|
|
||||||
|
</#function>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue