$template='entry_edit.tpl';
}elseif($_REQUEST['mode']=='vcf'){
$template='entry_vcf.tpl';
+}elseif($_REQUEST['mode']=='map'){
+ $template='entry_map.tpl';
}else{
$template='entry_show.tpl';
}
$dn = $_REQUEST['dn'];
-$sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array('jpegPhoto'));
+$sr = ldap_search($LDAP_CON,$dn,'(objectClass=inetOrgPerson)',array($FIELDS['photo']));
if(!ldap_count_entries($LDAP_CON,$sr)){
exit;
}
$entry = $result[0];
header("Content-type: image/jpeg");
-print $entry['jpegPhoto'][0];
+print $entry[$FIELDS['photo']][0];
?>
// Dateformat for birthdays when using extended schema
// see http://www.php.net/manual/en/function.strftime.php
- #$conf['dateformat'] = '%Y/%m/%d';
- $conf['dateformat'] = '%d.%m.%Y';
+ $conf['dateformat'] = '%Y/%m/%d';
+ #$conf['dateformat'] = '%d.%m.%Y';
+
+ // Google maps key, you can specify multiple when running the app through different vhosts
+ $conf['gmaps'] = array(
+ 'localhost' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSoniRWQPYZHIWuWPbij8hFqvrEuw',
+ 'intranet.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTxyuybgLnXtMVD7dljhze3zUboVhTqk9yc-rQVvv2YwFFJN20RCNbIVA',
+ 'intranet' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RTjlGRJ-JcA4ENdYSxSTUELqnaldxSOyZdbUNylw_BZHH1bBLrQNGtjZg',
+ 'fileserver.cosmo' => 'ABQIAAAAwcgTzX14Lq48uGhuAgaC-RQ2oMD1p7-NjsUZiDyjvzpK3IuhixTXdHGQRp8jtjwAl-P4oPPEB_hGgw',
+ );
// Force recompilation of smarty templates?
$conf['smartycompile'] = 1;
$smarty->use_sub_dirs = 0;
$smarty->template_dir = dirname(__FILE__).'/../templates';
$smarty->force_compile = $conf['smartycompile'];
+
+ // select the correct google api key
+ $conf['gmapkey'] = $conf['gmaps'][$_SERVER['HTTP_HOST']];
+
?>
$lang['new'] = 'New';
$lang['delete'] = 'Delete';
$lang['copy'] = 'Copy';
+$lang['map'] = 'Map';
$lang['csvexport'] = 'CSV';
$lang['vcfexport'] = 'VCard';
$lang['vcfimport'] = 'Import';
// select entry template
if(!empty($_REQUEST['export']) && $_REQUEST['export'] == 'csv'){
- $entrytpl = 'export_list_csv_entry.tpl';
+ $entrytpl = 'list_csv_entry.tpl';
+ }elseif(!empty($_REQUEST['export']) && $_REQUEST['export'] == 'map'){
+ $entrytpl = 'list_map_entry.tpl';
}else{
$entrytpl = 'list_entry.tpl';
}
$smarty->assign('marker',$_REQUEST['marker']);
$smarty->assign('search',$_REQUEST['search']);
//display templates
- if(!empty($_REQUEST['export']) && $_REQUEST['export'] == 'csv'){
- if ($conf['userlogreq'] == 1 && $user == '')
- {
+ if(!empty($_REQUEST['export'])){
+ if ($conf['userlogreq'] == 1 && $user == ''){
header("HTTP/1.1 401 ACCESS DENIED");
exit();
- } else {
+ }
+
+ if($_REQUEST['export'] == 'csv'){
header("Content-Type: text/csv");
header('Content-Disposition: Attachement; filename="contagged_export.csv"');
- $smarty->display('export_list_csv.tpl');
+ $smarty->display('list_csv.tpl');
+ exit;
+ }elseif($_REQUEST['export'] == 'map'){
+ header('Content-Type: text/html; charset=utf-8');
+ $smarty->display('list_map.tpl');
+ exit;
}
}else{
//save location in session
$('#noteedit_editor').focus();
}
-
-
/**
* Initialize everything when DOM is ready
*/
});
// tag editing
- if($('#tagedit')){
+ if($('#tagedit').length){
var img = new Image();
img.src = 'pix/tag_blue_edit.png';
img.className = 'click';
}
// note editing
- if($('#noteedit')){
+ if($('#noteedit').length){
var img;
img = new Image();
// set focus
- if($('#searchfield')) $('#searchfield').focus();
- if($('#firstfield')) $('#firstfield').focus();
+ if($('#searchfield').length) $('#searchfield').focus();
+ if($('#firstfield').length) $('#firstfield').focus();
+
+ // run google maps loader
+ if($('#google_map').length) gmap_loader();
});
--- /dev/null
+
+var gmap_data = Array();
+var gmap_centered = false;
+
+function gmap_loader(){
+ if (!GBrowserIsCompatible()) return;
+
+ var map = new GMap2(document.getElementById("google_map"));
+ var geocoder = new GClientGeocoder();
+ map.addControl(new GLargeMapControl());
+ map.addControl(new GMapTypeControl());
+ map.setCenter(new GLatLng(52.514863,13.381863),10);
+
+ for (var i=0; i<gmap_data.length; i++){
+ var t = 1;
+ if(i>10) t = 1000;
+ if(i>20) t = 2000;
+ gmap_add(map,geocoder,gmap_data[i].adr,gmap_data[i].info,t)
+ }
+}
+
+function gmap_add(map,gc,adr,info,t){
+ setTimeout(function(){
+ gc.getLatLng(
+ adr,
+ function(point) {
+ if (!point) {
+ //alert(address + " not found");
+ } else {
+ if(!gmap_centered){
+ map.setCenter(point, 5);
+ gmap_centered = true;
+ }
+ var marker = new GMarker(point);
+ map.addOverlay(marker);
+ GEvent.addListener(marker, "click", function(){
+ this.openInfoWindowHtml( info );
+ });
+ }
+ }
+ );
+ },t);
+}
+
padding: 1px 0px 1px 16px;
}
+a.ed_map {
+ background: transparent url(../pix/map.png) 0px 1px no-repeat;
+ padding: 1px 0px 1px 18px;
+}
+
a.ed_login {
background: transparent url(../pix/key.png) 0px 1px no-repeat;
padding: 1px 0px 1px 18px;
font-size: 75%;
}
+/* mapping */
+div#map div#google_map {
+ width: 95%;
+ margin: 2em auto;
+ height: 40em;
+}
+
+
/* tagcloud */
div#tagcloud {
margin: 2em;
--- /dev/null
+{include file="header.tpl"}
+
+<script type="text/javascript">
+
+ gmap_data = [
+ {ldelim}
+ adr: '{$entry.street|escape:javascript}, {$entry.zip|escape:javascript} {$entry.location|escape:javascript}',
+ info: '<h4>{$lang.business|escape:javascript}</h4>{$entry.street|escape:javascript}<br />{$entry.zip|escape:javascript} {$entry.location|escape:javascript}'
+ {rdelim},
+ {ldelim}
+ adr: '{$entry.homestreet|replace:"\n":", "|escape:javascript}',
+ info: '<h4>{$lang.private|escape:javascript}</h4>{$entry.homestreet|replace:"\n":"<br />"|escape:javascript}'
+ {rdelim}
+ ];
+</script>
+
+<div id="map">
+
+ <h1>
+ <img src="pix/{$entry.type|h}.png" border="0" width="22" height="22"
+ align="middle" title="{$entry.type|h}" alt="" />
+ {$entry.givenname|h} {$entry.name|h}
+ </h1>
+
+
+ <div id="google_map"></div>
+
+
+
+</div>
+
+{include file="footer.tpl"}
<table width="100%">
<tr>
<td colspan="2">
+
{$entry.title|h} {$entry.givenname|h} {$entry.name|h}<br />
{if $entry.organization}
<a href="index.php?org={$entry.organization|escape:url}">{$entry.organization|h}</a><br />
{$entry.street|h}<br />
{/if}
{if $entry.location}
- {$entry.zip} {$entry.location|h}<br />
+ {$entry.zip|h} {$entry.location|h}<br />
{/if}
{if $entry.state}
{$entry.state|h}
{if $entry.country}
{$entry.country|h}
{/if}
- <br /><br />
+ </br /><br />
</td>
</tr>
{if $entry.phone}
+++ /dev/null
-{$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.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}
-{$list}
<script src="scripts/interface/imagebox.js" type="text/javascript"></script>
<script src="scripts/formatDate.js" type="text/javascript"></script>
+ {if $conf.gmapkey}
+ <script src="http://maps.google.com/maps?file=api&v=2&key={$conf.gmapkey}" type="text/javascript"></script>
+ <script src="scripts/maps.js" type="text/javascript"></script>
+ {/if}
+
<script src="scripts/gui.js" type="text/javascript"></script>
<script type="text/javascript">
--- /dev/null
+{$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.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}
+{$list}
--- /dev/null
+{include file="header.tpl"}
+
+<script type="text/javascript">
+
+ gmap_data = [
+ {$list}
+ ];
+</script>
+
+<div id="map">
+
+<div id="google_map"></div>
+</div>
+
+{include file="footer.tpl"}
--- /dev/null
+
+{ldelim}
+ adr: '{$entry.street|escape:javascript}, {$entry.zip|escape:javascript} {$entry.location|escape:javascript}',
+ info: '<h4>{$entry.organization|escape:javascript}</h4>{$entry.street|escape:javascript}<br />{$entry.zip|escape:javascript} {$entry.location|escape:javascript}'
+{rdelim},
+
+
<li class="sep"> </li>
{if $dn} <!-- begin contact page functions -->
+
{if $user} <!-- begin editing functions -->
<!-- edit/show, copy, delete -->
<a href="entry.php?dn={$dn|escape:url}&mode=vcf" class="ed_vcfexport">{$lang.vcfexport}</a>
</li>
+ <!-- show on map -->
+ {if $smarty.request.mode == 'map' && $conf.gmapkey}
+ <li>
+ <a href="entry.php?dn={$dn|escape:url}" class="ed_show">{$lang.show}</a>
+ </li>
+ {elseif $conf.gmapkey}
+ <li>
+ <a href="entry.php?dn={$dn|escape:url}&mode=map" class="ed_map">{$lang.map}</a>
+ </li>
+ {/if}
+
<li class="sep"> </li>
{/if} <!-- end contact page functions -->
{if $list} <!-- export -->
+ {if $smarty.request.export != 'map' && $conf.gmapkey}
+ <li>
+ <a href="index.php?filter={$filter|escape:url}&marker={$marker|escape:url}&search={$search|escape:url}&export=map" class="ed_map">{$lang.map}</a>
+ </li>
+ {/if}
<li>
<a href="index.php?filter={$filter|escape:url}&marker={$marker|escape:url}&search={$search|escape:url}&export=csv"
class="ed_csvexport">{$lang.csvexport}</a>