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/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/init.php b/inc/init.php index be47441..e86a4f8 100644 --- a/inc/init.php +++ b/inc/init.php @@ -51,4 +51,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']; + } ?> diff --git a/inc/lang/de.php b/inc/lang/de.php index 8d0fcdc..e7820dd 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'; @@ -51,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 edc9467..60f652f 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'; @@ -51,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 2e13d65..2d6d46e 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/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(){ 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/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_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/entry_show.tpl b/templates/entry_show.tpl index 1c4da29..539319a 100644 --- a/templates/entry_show.tpl +++ b/templates/entry_show.tpl @@ -18,6 +18,26 @@

{$lang.business}

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

{$lang.private}

+ + + + {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} 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} +

+ +
@@ -101,6 +141,10 @@ {if $entry.homestreet} {$entry.homestreet|h|nl2br}

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

+{/if} +
+ + + + + + +
+

{$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..e9ab8a0 100644 --- a/templates/toolbar.tpl +++ b/templates/toolbar.tpl @@ -44,6 +44,9 @@
  • {$lang.vcfexport}
  • +
  • + {$lang.printexport} +
  • @@ -74,6 +77,10 @@
  • {$lang.csvexport} +
  • + {$lang.printexport} +
  • {/if}