From c650fb9fd34e48702a2865466e03064aa1e98c1b Mon Sep 17 00:00:00 2001 From: Patrice Neff Date: Wed, 9 Jun 2010 12:26:46 +0200 Subject: [PATCH 1/6] Set the global $user variable if the user is logged in. This is necessary for the userlogreq configuration to work e.g. for exporting CSV files. --- inc/init.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/init.php b/inc/init.php index 67fbc69..cb3e40b 100644 --- a/inc/init.php +++ b/inc/init.php @@ -45,4 +45,8 @@ function remove_magic_quotes(&$array) { // select the correct google api key $conf['gmapkey'] = $conf['gmaps'][$_SERVER['HTTP_HOST']]; + $user = null; + if (isset($_SESSION['ldapab']['username'])) { + $user = $_SESSION['ldapab']['username']; + } ?> From dc6752bd0ca0cf62373277051b1015f121ff9c56 Mon Sep 17 00:00:00 2001 From: Patrice Neff Date: Thu, 10 Jun 2010 14:33:49 +0200 Subject: [PATCH 2/6] Calculate the map bounds and zoom level correctly so the displayed map area shows all the included POIs. --- scripts/maps.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/maps.js b/scripts/maps.js index d1ef0c0..d7f1b55 100644 --- a/scripts/maps.js +++ b/scripts/maps.js @@ -1,6 +1,7 @@ var gmap_data = Array(); var gmap_centered = false; +var gmap_bounds = new GLatLngBounds(); function gmap_loader(){ if (!GBrowserIsCompatible()) { @@ -29,10 +30,11 @@ function gmap_add(map,gc,adr,info,t){ if (!point) { //alert(address + " not found"); } else { - if(!gmap_centered){ - map.setCenter(point, 5); - gmap_centered = true; - } + gmap_bounds.extend(point); + var zoom = map.getBoundsZoomLevel(gmap_bounds); + if (zoom > 17) zoom = 17; + map.setCenter(gmap_bounds.getCenter(), zoom); + var marker = new GMarker(point); map.addOverlay(marker); GEvent.addListener(marker, "click", function(){ From 83133bbd3f13567016034d287d533e0c834d0d3a Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Tue, 31 Aug 2010 12:31:00 +0200 Subject: [PATCH 3/6] use home address fields from mozilla schema Use separate address fields for home street, home location and home ZIP code instead of a single field for the entire private address. For this to work, the LDAP class mozillaAbPersonAlpha is required. The fields are also added to the edit page and the CSV export. --- inc/fields.php | 8 ++++++++ inc/lang/de.php | 4 +++- inc/lang/en.php | 4 +++- templates/entry_edit.tpl | 13 +++++++++++++ templates/entry_show.tpl | 4 ++++ templates/list_csv.tpl | 2 +- templates/list_csv_entry.tpl | 2 +- 7 files changed, 33 insertions(+), 4 deletions(-) diff --git a/inc/fields.php b/inc/fields.php index 9229e72..737b318 100644 --- a/inc/fields.php +++ b/inc/fields.php @@ -52,6 +52,14 @@ $FIELDS['_marker'] = 'marker'; // aka. tags $FIELDS['country'] = 'c'; +/** + * Mozilla uses a more elaborate schema + */ +$OCLASSES[] = 'mozillaAbPersonAlpha'; +$FIELDS['homestreet'] = 'mozillaHomeStreet'; +$FIELDS['homelocation'] = 'mozillaHomeLocalityName'; +$FIELDS['homezip'] = 'mozillaHomePostalCode'; + /** * If the open exchange schema is used the following fields * and object classes are added diff --git a/inc/lang/de.php b/inc/lang/de.php index 8d0fcdc..244576b 100644 --- a/inc/lang/de.php +++ b/inc/lang/de.php @@ -22,7 +22,9 @@ $lang['mobile'] = 'Handy'; $lang['pager'] = 'Pieper'; $lang['homephone'] = 'Telefon (priv.)'; -$lang['homestreet'] = 'Adresse (priv.)'; +$lang['homestreet'] = 'Straße (priv.)'; +$lang['homezip'] = 'Postleitzahl (priv.)'; +$lang['homelocation'] = 'Stadt (priv.)'; $lang['photo'] = 'Foto'; $lang['url'] = 'Webseite'; $lang['note'] = 'Notizen'; diff --git a/inc/lang/en.php b/inc/lang/en.php index edc9467..5a09c15 100644 --- a/inc/lang/en.php +++ b/inc/lang/en.php @@ -22,7 +22,9 @@ $lang['mobile'] = 'Mobile'; $lang['pager'] = 'Pager'; $lang['homephone'] = 'Phone (priv.)'; -$lang['homestreet'] = 'Address (priv.)'; +$lang['homestreet'] = 'Street (priv.)'; +$lang['homezip'] = 'Postal Code (priv.)'; +$lang['homelocation'] = 'City (priv.)'; $lang['photo'] = 'Picture'; $lang['url'] = 'Website'; $lang['note'] = 'Notes'; diff --git a/templates/entry_edit.tpl b/templates/entry_edit.tpl index ddad5dc..6f025bd 100644 --- a/templates/entry_edit.tpl +++ b/templates/entry_edit.tpl @@ -165,6 +165,19 @@ {/if} +{if $fields.homezip} + + {$lang.homezip}: + + +{/if} +{if $fields.homelocation} + + {$lang.homelocation}: + + +{/if} + {if $fields.homephone} {$lang.homephone}: diff --git a/templates/entry_show.tpl b/templates/entry_show.tpl index 1c4da29..63b6858 100644 --- a/templates/entry_show.tpl +++ b/templates/entry_show.tpl @@ -101,6 +101,10 @@ {if $entry.homestreet} {$entry.homestreet|h|nl2br}

{/if} +{if $entry.homelocation} + {$entry.homezip|h} {$entry.homelocation|h|nl2br}

+{/if} + {if $entry.homephone} diff --git a/templates/list_csv.tpl b/templates/list_csv.tpl index 5c00f3a..559104e 100644 --- a/templates/list_csv.tpl +++ b/templates/list_csv.tpl @@ -1,2 +1,2 @@ -{$lang.name|csv};{$lang.givenname|csv};{$lang.title|csv};{$lang.organization|csv};{$lang.office|csv};{$lang.street|csv};{$lang.zip|csv};{$lang.location|csv};{$lang.country|csv};{$lang.phone|csv};{$lang.fax|csv};{$lang.pager|csv};{$lang.homestreet|csv};{$lang.homephone|csv};{$lang.mobile|csv};{$lang.url|csv};{$lang.note|csv};{$lang.mail|csv};{$lang.mail|csv};{$lang.mail|csv};{$lang.marker|csv} +{$lang.name|csv};{$lang.givenname|csv};{$lang.title|csv};{$lang.organization|csv};{$lang.office|csv};{$lang.street|csv};{$lang.zip|csv};{$lang.location|csv};{$lang.country|csv};{$lang.phone|csv};{$lang.fax|csv};{$lang.pager|csv};{$lang.homestreet|csv};{$lang.homezip|csv};{$lang.homelocation|csv};{$lang.homephone|csv};{$lang.mobile|csv};{$lang.url|csv};{$lang.note|csv};{$lang.mail|csv};{$lang.mail|csv};{$lang.mail|csv};{$lang.marker|csv} {$list} diff --git a/templates/list_csv_entry.tpl b/templates/list_csv_entry.tpl index 6083bd4..8e13355 100644 --- a/templates/list_csv_entry.tpl +++ b/templates/list_csv_entry.tpl @@ -1,2 +1,2 @@ -{$entry.name|csv};{$entry.givenname|csv};{$entry.title|csv};{$entry.organization|csv};{$entry.office|csv};{$entry.street|csv};{$entry.zip|csv};{$entry.location|csv};{$entry.country|csv};{$entry.phone|csv};{$entry.fax|csv};{$entry.pager|csv};{$entry.homestreet|csv};{$entry.homephone|csv};{$entry.mobile|csv};{$lang.url|csv};{$entry.note|csv};{$entry.mail[0]|csv};{$entry.mail[1]|csv};{$entry.mail[2]|csv};{$entry.markers|csv} +{$entry.name|csv};{$entry.givenname|csv};{$entry.title|csv};{$entry.organization|csv};{$entry.office|csv};{$entry.street|csv};{$entry.zip|csv};{$entry.location|csv};{$entry.country|csv};{$entry.phone|csv};{$entry.fax|csv};{$entry.pager|csv};{$entry.homestreet|csv};{$entry.homezip|csv};{$entry.homelocation|csv};{$entry.homephone|csv};{$entry.mobile|csv};{$lang.url|csv};{$entry.note|csv};{$entry.mail[0]|csv};{$entry.mail[1]|csv};{$entry.mail[2]|csv};{$entry.markers|csv} From f9d3982c08450b270f8cc555e3ae30a4625051b5 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Fri, 29 Oct 2010 14:19:33 +0200 Subject: [PATCH 4/6] add print export This patch adds a "print" function to the addressbook; it displays all currently listed contacts in a smaller font, making it possible to print the entire address book (or parts of it). --- inc/lang/de.php | 1 + inc/lang/en.php | 1 + index.php | 27 ++-- styles/design.css | 5 + styles/layout.css | 5 + templates/list_print.tpl | 21 +++ templates/list_print_entry.tpl | 235 +++++++++++++++++++++++++++++++++ templates/toolbar.tpl | 4 + 8 files changed, 289 insertions(+), 10 deletions(-) create mode 100644 templates/list_print.tpl create mode 100644 templates/list_print_entry.tpl diff --git a/inc/lang/de.php b/inc/lang/de.php index 244576b..e7820dd 100644 --- a/inc/lang/de.php +++ b/inc/lang/de.php @@ -53,6 +53,7 @@ $lang['copy'] = 'Kopieren'; $lang['map'] = 'Karte'; $lang['csvexport'] = 'CSV'; +$lang['printexport'] = 'Drucken'; $lang['vcfexport'] = 'VCard'; $lang['vcfimport'] = 'Import'; $lang['search'] = 'Suchen'; diff --git a/inc/lang/en.php b/inc/lang/en.php index 5a09c15..60f652f 100644 --- a/inc/lang/en.php +++ b/inc/lang/en.php @@ -53,6 +53,7 @@ $lang['copy'] = 'Copy'; $lang['map'] = 'Map'; $lang['csvexport'] = 'CSV'; +$lang['printexport'] = 'Print'; $lang['vcfexport'] = 'VCard'; $lang['vcfimport'] = 'Import'; $lang['search'] = 'Search'; diff --git a/index.php b/index.php index 17240ac..602a1b7 100644 --- a/index.php +++ b/index.php @@ -8,6 +8,8 @@ $entrytpl = 'list_csv_entry.tpl'; }elseif(!empty($_REQUEST['export']) && $_REQUEST['export'] == 'map'){ $entrytpl = 'list_map_entry.tpl'; + }elseif(!empty($_REQUEST['export']) && $_REQUEST['export'] == 'print'){ + $entrytpl = 'list_print_entry.tpl'; }else{ $entrytpl = 'list_entry.tpl'; } @@ -22,6 +24,16 @@ // fetch results $result = ldap_queryabooks($ldapfilter,$fields); + //prepare templates + tpl_std(); + if (empty($_REQUEST['filter'])) $_REQUEST['filter']=''; + if (empty($_REQUEST['marker'])) $_REQUEST['marker']=''; + if (empty($_REQUEST['search'])) $_REQUEST['search']=''; + $smarty->assign('filter',$_REQUEST['filter']); + $smarty->assign('marker',$_REQUEST['marker']); + $smarty->assign('search',$_REQUEST['search']); + $smarty->assign('org',$_REQUEST['org']); + $list = ''; if(count($result)==1 && $_REQUEST['search']){ //only one result on a search -> display page @@ -35,17 +47,8 @@ $list .= $smarty->fetch($entrytpl); } } - - //prepare templates - tpl_std(); - if (empty($_REQUEST['filter'])) $_REQUEST['filter']=''; - if (empty($_REQUEST['marker'])) $_REQUEST['marker']=''; - if (empty($_REQUEST['search'])) $_REQUEST['search']=''; $smarty->assign('list',$list); - $smarty->assign('filter',$_REQUEST['filter']); - $smarty->assign('marker',$_REQUEST['marker']); - $smarty->assign('search',$_REQUEST['search']); - $smarty->assign('org',$_REQUEST['org']); + //display templates if(!empty($_REQUEST['export'])){ if ($conf['userlogreq'] && $user == ''){ @@ -63,6 +66,10 @@ header('Content-Type: text/html; charset=utf-8'); $smarty->display('list_map.tpl'); exit; + }elseif($_REQUEST['export'] == 'print'){ + header('Content-Type: text/html; charset=utf-8'); + $smarty->display('list_print.tpl'); + exit; } }else{ //save location in session diff --git a/styles/design.css b/styles/design.css index 6332081..af8cb0a 100644 --- a/styles/design.css +++ b/styles/design.css @@ -115,6 +115,11 @@ a.ed_csvexport { padding: 1px 0px 1px 16px; } +a.ed_printexport { + background: transparent url(../pix/page_white_excel.png) 0px 1px no-repeat; + padding: 1px 0px 1px 16px; +} + a.ed_vcfimport { background: transparent url(../pix/page_in.png) 0px 1px no-repeat; padding: 1px 0px 1px 16px; diff --git a/styles/layout.css b/styles/layout.css index 9bf1330..99a7599 100644 --- a/styles/layout.css +++ b/styles/layout.css @@ -243,3 +243,8 @@ div#footrow { div#footrow div.login{ float: right; } + +/* print export */ +div.print h2 { + border-bottom: 1px solid #999; +} diff --git a/templates/list_print.tpl b/templates/list_print.tpl new file mode 100644 index 0000000..0bf8ff2 --- /dev/null +++ b/templates/list_print.tpl @@ -0,0 +1,21 @@ + + + + ConTagged - {$lang.ldapab} + + + + + + + + +
+ {if $conf.userlogreq == 0 || $user != ''} + {* $list is a concatenation of multiple list_print_entry.tpl *} + {$list} + {/if} +
+ + diff --git a/templates/list_print_entry.tpl b/templates/list_print_entry.tpl new file mode 100644 index 0000000..a5d62da --- /dev/null +++ b/templates/list_print_entry.tpl @@ -0,0 +1,235 @@ +
+ +

+ {$entry.givenname|h} {$entry.name|h} +

+ + + + + + + + +
+

{$lang.business}

+ + + + +{if $entry.phone} + + + + +{/if} +{if $entry.switchboard} + + + + +{/if} +{if $entry.fax} + + + + +{/if} +{if $entry.pager} + + + + +{/if} +{if $managername} + + + + +{/if} +{if $entry.position} + + + + +{/if} +{if $entry.department} + + + + +{/if} + +
+ + {$entry.title|h} {$entry.givenname|h} {$entry.name|h}
+{if $entry.organization} + {$entry.organization|h}
+{/if} +{if $entry.office} + {$entry.office|h}
+{/if} +{if $entry.street} + {$entry.street|h}
+{/if} +{if $entry.location} + {$entry.zip|h} {$entry.location|h}
+{/if} +{if $entry.state} + {$entry.state|h} +{/if} +{if $entry.country} + {$iso3166[$entry.country]} +{/if} +

+
{$lang.phone}:{$entry.phone|h}
{$lang.switchboard}:{$entry.switchboard|h}
{$lang.fax}:{$entry.fax|h}
{$lang.pager}:{$entry.pager|h}
{$lang.manager}:{$managername}
{$lang.position}:{$entry.position|h}
{$lang.department}:{$entry.department|h}
+ +
+

{$lang.private}

+ + + + +{if $entry.homephone} + + + + +{/if} +{if $entry.mobile} + + + + +{/if} +{if $entry.birthday} + + + + +{/if} +{if $entry.anniversary} + + + + +{/if} +{if $entry.spouse} + + + + +{/if} + +
+ {$entry.title|h} {$entry.givenname|h} {$entry.name|h}
+{if $entry.homestreet} + {$entry.homestreet|h|nl2br}

+{/if} +{if $entry.homelocation} + {$entry.homezip|h} {$entry.homelocation|h|nl2br}

+{/if} + +
{$lang.homephone}:{$entry.homephone|h}
{$lang.mobile}:{$entry.mobile|h}
{$lang.birthday}:{$entry.birthday|h}
{$lang.anniversary}:{$entry.anniversary|date_format:$conf.dateformat|h}
{$lang.spouse}:{$entry.spouse|h}
+ +

{$lang.communication}

+ +{if $entry.url} + + + + +{/if} +{if $entry.mail} + + + + +{/if} +{if $entry.instantmessenger} + + + + +{/if} +{if $entry.ipphone} + + + + +{/if} + +
{$lang.url}:{$entry.url|http}
{$lang.mail}: + {foreach from=$entry.mail item=mail} + {$mail|h}
+ {/foreach} +
{$lang.instantmessenger}:{$entry.instantmessenger|h}
{$lang.ipphone}:{$entry.ipphone|h}
+ +
+ +

{$lang.extended}

+ + + + + + +
+ +{if $fields.note} + + + + +{/if} +
+ {$lang.note}: +
 
+
+
+ {$entry.note|noteparser} +   +
+
+
+ +{if $fields._marker} + + + + +{/if} +{if $entry.certificate} + + + + +{/if} +{if $entry.domain} + + + + +{/if} +{if $entry.timezone} + + + + +{/if} +
+ {$lang.marker}: +
 
+
+ + {foreach from=$entry.marker item=marker} + {$marker|h} + {/foreach} +   + +
{$lang.certificate}:
+ +
{$lang.domain}:{$entry.domain|h}
{$lang.timezone}:{$entry.timezone|h}
+
+ +
diff --git a/templates/toolbar.tpl b/templates/toolbar.tpl index 743d268..192dc80 100644 --- a/templates/toolbar.tpl +++ b/templates/toolbar.tpl @@ -74,6 +74,10 @@
  • {$lang.csvexport} +
  • + {$lang.printexport} +
  • {/if} From ee12dc98b948f88ec879fa61834a83ae5f122862 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Tue, 30 Nov 2010 09:11:15 +0100 Subject: [PATCH 5/6] add print view for single addresses --- templates/entry_print.tpl | 20 ++++++++++++++++++++ templates/toolbar.tpl | 3 +++ 2 files changed, 23 insertions(+) create mode 100644 templates/entry_print.tpl diff --git a/templates/entry_print.tpl b/templates/entry_print.tpl new file mode 100644 index 0000000..d2b6e0c --- /dev/null +++ b/templates/entry_print.tpl @@ -0,0 +1,20 @@ + + + + ConTagged - {$lang.ldapab} + + + + + + + + +
    + {if $conf.userlogreq == 0 || $user != ''} + {include file="list_print_entry.tpl"} + {/if} +
    + + diff --git a/templates/toolbar.tpl b/templates/toolbar.tpl index 192dc80..e9ab8a0 100644 --- a/templates/toolbar.tpl +++ b/templates/toolbar.tpl @@ -44,6 +44,9 @@
  • {$lang.vcfexport}
  • +
  • + {$lang.printexport} +
  • From 1909530213656c220291bf12bdd21691541d7872 Mon Sep 17 00:00:00 2001 From: Stefan Tomanek Date: Tue, 23 Nov 2010 17:14:55 +0100 Subject: [PATCH 6/6] embed 'clippy' to copy address to clipboard It is often convinient to copy a complete address to the system clipboard; to achieve this, this patch includes the flash widget "clippy" to the contact view. Clicking on one of the widgets copies either the office or home address to the clipboard, making it simple to include it in other applications. Clippy itself is hosted here: https://github.com/mojombo/clippy --- inc/config.php | 3 ++- templates/entry_show.tpl | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/inc/config.php b/inc/config.php index 03741d4..b6732f5 100644 --- a/inc/config.php +++ b/inc/config.php @@ -68,4 +68,5 @@ // Force recompilation of smarty templates? $conf['smartycompile'] = 0; - + // load clipboard flash widget from this URL: + $conf['clippyurl'] = 'http://github.com/mojombo/clippy/raw/master/build/clippy.swf'; diff --git a/templates/entry_show.tpl b/templates/entry_show.tpl index 63b6858..539319a 100644 --- a/templates/entry_show.tpl +++ b/templates/entry_show.tpl @@ -18,6 +18,26 @@

    {$lang.business}

    + + +
    @@ -94,6 +114,26 @@

    {$lang.private}

    + + + +