From: Andreas Gohr Date: Fri, 10 Jul 2009 08:50:10 +0000 (+0200) Subject: Added QR Code export X-Git-Tag: 0.7.1~6 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=28dc08534bbf5b53f747bd0419d5259b5be60208;p=contagged Added QR Code export A contact can now be exported to a vcard encoded in a 2D barcode that can be scanned with a mobile phone. The feature was tested with QuickMark on the iPhone. --- diff --git a/inc/lang/en.php b/inc/lang/en.php index ef06d76..edc9467 100644 --- a/inc/lang/en.php +++ b/inc/lang/en.php @@ -59,6 +59,7 @@ $lang['help'] = 'Help'; $lang['select'] = 'Select'; $lang['orgs'] = 'Companies'; $lang['upload'] = 'Upload'; +$lang['qrcode'] = 'QR Code'; $lang['publicbook'] = 'Public Addressbook'; $lang['privatebook'] = 'Private Addressbook'; diff --git a/inc/template.php b/inc/template.php index 81c0b93..6042c7b 100644 --- a/inc/template.php +++ b/inc/template.php @@ -76,6 +76,8 @@ function tpl_entry($in){ // join marker field to markers if(is_array($out['marker'])) $out['markers'] = join(', ',$out['marker']); + $out['qrcode'] = tpl_qrcode($out); + /* print '
';
 print_r($out);
@@ -85,6 +87,20 @@ print '
'; $smarty->assign('entry',$out); } +function tpl_qrcode($in){ + $data = "BEGIN:VCARD\n"; + $data .= "N:{$in['name']};{$in['givenname']}\n"; + if($in['mobile']) $data .= "TEL;CELL:{$in['mobile']}\n"; + if($in['phone']) $data .= "TEL;WORK:{$in['phone']}\n"; + if($in['homephone']) $data .= "TEL;HOME:{$in['homephone']}\n"; + if($in['mail'][0]) $data .= "EMAIL:{$in['mail'][0]}\n"; + $data .= "END:VCARD"; + $data = rawurlencode($data); + + return 'http://chart.apis.google.com/chart?cht=qr&chld=L|5&chs=500x500&chl='.$data.'&.png'; +} + + /** * assigns the last LDAP error to the template */ diff --git a/pix/qrcode.png b/pix/qrcode.png new file mode 100644 index 0000000..26b6c4e Binary files /dev/null and b/pix/qrcode.png differ diff --git a/styles/design.css b/styles/design.css index aab3323..6332081 100644 --- a/styles/design.css +++ b/styles/design.css @@ -105,6 +105,11 @@ a.ed_vcfexport { padding: 1px 0px 1px 16px; } +a.ed_qrcode { + background: transparent url(../pix/qrcode.png) 0px 1px no-repeat; + padding: 1px 0px 1px 16px; +} + a.ed_csvexport { background: transparent url(../pix/page_white_excel.png) 0px 1px no-repeat; padding: 1px 0px 1px 16px; diff --git a/templates/entry_show.tpl b/templates/entry_show.tpl index 36de36c..69ec28d 100644 --- a/templates/entry_show.tpl +++ b/templates/entry_show.tpl @@ -238,7 +238,6 @@ - {include file="footer.tpl"} diff --git a/templates/toolbar.tpl b/templates/toolbar.tpl index 014348d..743d268 100644 --- a/templates/toolbar.tpl +++ b/templates/toolbar.tpl @@ -45,6 +45,11 @@ {$lang.vcfexport} + +
  • + {$lang.qrcode} +
  • + {if $smarty.request.mode == 'map' && $conf.gmapkey}