ShowAuth
edu.cornell.mannlib.vitro.webapp.controller.admin.ShowAuthController
diff --git a/productMods/js/individual/individualUtils.js b/productMods/js/individual/individualUtils.js
index da9729f2..82982684 100644
--- a/productMods/js/individual/individualUtils.js
+++ b/productMods/js/individual/individualUtils.js
@@ -104,8 +104,64 @@ $(document).ready(function(){
// Reveal vCard QR code when QR icon is clicked
$('#qrIcon, .qrCloseLink').click(function() {
- $('#qrCodeImage').toggleClass('hidden');
- return false;
+
+
+ // only create the img the first time, so check if it already exists
+ if ( !$('img#codeImage').length ) {
+ $.ajax({
+ url: "/vivo/qrCodeAjax",
+ dataType: "json",
+ data: {
+ action: "getQrCodeDetails",
+ uri: individualUri,
+ },
+ complete: function(xhr, status) {
+ var results = $.parseJSON(xhr.responseText);
+ if ( results.length == 0 ) {
+ var html = i18nStrings.currentlyNoResearchers;
+ }
+ else {
+ if ( results[0].firstName.length < 1 || results[1].lastName.length < 1 ) {
+ $('#qrCodeImage').css("width","225px");
+ var noCodeStr = ""
+ + "The QR Code could not be generated due to incomplete information about this person.
"
+ $('#qrCodeImage').prepend(noCodeStr);
+ }
+ else if ( results[0].firstName.length > 0 || results[1] == null || results[1].lastName.length > 0 ) {
+ var vcard = "";
+ vcard += "BEGIN:VCARD" + String.fromCharCode(13);
+ vcard += "VERSION:3.0" + String.fromCharCode(13);
+ vcard += "N:" + results[1].lastName + String.fromCharCode(13);
+ vcard += "FN:" + results[0].firstName + String.fromCharCode(13);
+ if ( results[2].preferredTitle.length > 0 ) {
+ vcard += "TITLE:" + results[2].preferredTitle + String.fromCharCode(13);
+ }
+ if ( results[3].phoneNumber.length > 0 ) {
+ vcard += "TEL;TYPE=WORK,VOICE:" + results[3].phoneNumber + String.fromCharCode(13);
+ }
+ if ( results[4].email.length > 0 ) {
+ vcard += "EMAIL;TYPE=PREF,INTERNET:" + results[4].email + String.fromCharCode(13);
+ }
+ vcard += "URL:" + individualUri + String.fromCharCode(13);
+ if ( individualPhoto.length > 0 ) {
+ vcard += "PHOTO;VALUE=URL;TYPE=JPG:" + individualPhoto + String.fromCharCode(13);
+ }
+ vcard += "END:VCARD";
+
+ spanStr = ""
+ + "
"
+ + "";
+
+ $('#qrCodeImage').prepend(spanStr);
+ }
+ }
+ }
+ });
+ }
+ $('#qrCodeImage').toggleClass('hidden');
});
// For pubs and grants on the foaf:person profile, and affiliated people
diff --git a/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl b/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl
index 8fca3a7d..bfce4e4c 100644
--- a/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl
+++ b/productMods/templates/freemarker/body/foaf-person--exportQrCode.ftl
@@ -5,7 +5,7 @@
<#include "individual-qrCodeGenerator.ftl">
-
+
<#assign thumbUrl = individual.thumbUrl! "${urls.images}/placeholders/person.thumbnail.jpg" >
diff --git a/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl b/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl
index f892ea2e..f19b3201 100644
--- a/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl
+++ b/productMods/templates/freemarker/body/individual/individual--foaf-person-2column.ftl
@@ -160,6 +160,9 @@
#if>
#if>