diff --git a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl index ee814921..5315a09e 100644 --- a/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl +++ b/productMods/templates/freemarker/body/partials/individual/individual-qrCodeFoafPerson.ftl @@ -27,30 +27,56 @@ END:VCARD <#local firstName = (allProperties.getProperty("${foaf}firstName").firstValue)! > <#local lastName = (allProperties.getProperty("${foaf}lastName").firstValue)! > - <#local org = "temp" > - <#local title = "temp" > + <#local org = "" > + <#local title = (allProperties.getProperty("${core}preferredTitle").firstValue)! > <#local phoneNumber = (allProperties.getProperty("${core}phoneNumber").firstValue)! > <#local email = (allProperties.getProperty("${core}email").firstValue)! > - <#local url = "temp" > - <#local photo = "temp" > + <#local url = urls.currentPage! > + <#local photo = individual.thumbUrl! > <#local rev = "temp" > - <#assign vCard><#t> - BEGIN:VCARD<#lt> - VERSION:3.0<#lt> - N:${lastName};${firstName}<#lt> - FN:${firstName} ${lastName}<#lt> - ORG:${org}<#lt> - TITLE:${title}<#lt> - TEL;TYPE=WORK,VOICE:${phoneNumber}<#lt> - EMAIL;TYPE=PREF,INTERNET:${email}<#lt> - URL:${url}<#lt> - PHOTO;VALUE=URL;TYPE=JPG:${photo}<#lt> - REV:${rev}<#lt> - END:VCARD<#t> - <#t> + <#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" > - <#local qrCodeUrl = "https://chart.googleapis.com/chart?cht=qr&chs=${qrCodeWidth}x${qrCodeWidth}&chl=${vCard}&choe=UTF-8" > - - + + + +<#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> + + + +