[Linpha-cvs] SF.net SVN: linpha: [4768] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2007-09-01 22:55:31
|
Revision: 4768 http://linpha.svn.sourceforge.net/linpha/?rev=4768&view=rev Author: fangehrn Date: 2007-09-01 15:55:23 -0700 (Sat, 01 Sep 2007) Log Message: ----------- 2007-09-01 flo * worked some more on the maps plugin - save and load markers is now working Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/index.php trunk/linpha2/install/sql/sql.data.php trunk/linpha2/install/sql/sql.mysql.php trunk/linpha2/install/sql/sql.tables.php trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php trunk/linpha2/lib/classes/linpha.sql.class.php trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/ChangeLog 2007-09-01 22:55:23 UTC (rev 4768) @@ -1,3 +1,7 @@ +2007-09-01 flo + * worked some more on the maps plugin + - save and load markers is now working + 2007-08-23 bzrudi * Make Exiftool work with GPS EXIF data Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/docs/dev/TODO.txt 2007-09-01 22:55:23 UTC (rev 4768) @@ -37,6 +37,8 @@ - should enable browsers cache for the thumbnails and maybe also for the images +- fix error handler + ## Big Todos - Common Tasks @@ -54,6 +56,8 @@ -> otherwise it would be possible to overwrite the current installation, (and to delete cache folders) - DONT add feature to drop tables if they already exists - add Usage link after installation has been successfully finished + - dont create tables which start with plugins_ automatically + provide plugin interface to create such tables while activating plugin - Plugins (copy from linpha1) - Guestbook, first apply patch with security image Modified: trunk/linpha2/index.php =================================================================== --- trunk/linpha2/index.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/index.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -73,7 +73,7 @@ // plugins -case 'map': +case 'maps': /** * @todo check if plugin enabled */ @@ -86,4 +86,4 @@ break; } -?> +?> \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.data.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -107,7 +107,9 @@ 'plugins_log_email_subject' => 'Linpha Log', 'plugins_filemanager_enable' => '0', - 'plugins_filemanager_nruploads' => '5' + 'plugins_filemanager_nruploads' => '5', + + 'plugins_maps_defaultMarkerZoom' => '10', ); $options_user_overrideable = Array( Modified: trunk/linpha2/install/sql/sql.mysql.php =================================================================== --- trunk/linpha2/install/sql/sql.mysql.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.mysql.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -144,6 +144,16 @@ "md5sum VARCHAR(32) NOT NULL default '', " . "meta_data VARCHAR(255) NOT NULL default '', " . "PRIMARY KEY (id) " . + ")", + "CREATE TABLE ".$linpha_tables['plugins_maps_markers']." ( ". + "id INT NOT NULL AUTO_INCREMENT, " . + "albId INT NOT NULL default '0', " . + "albPath VARCHAR(255) NOT NULL default '', " . + "markerName VARCHAR(255) NOT NULL default '', " . + "markerLat VARCHAR(255) NOT NULL default '', " . + "markerLon VARCHAR(255) NOT NULL default '', " . + "markerZoom INT NOT NULL default '0', " . + "PRIMARY KEY (id) " . ")" ); ?> Modified: trunk/linpha2/install/sql/sql.tables.php =================================================================== --- trunk/linpha2/install/sql/sql.tables.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/install/sql/sql.tables.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -35,6 +35,7 @@ "meta_iptc" => "meta_iptc", "meta_xmp" => "meta_xmp", "meta_comments" => "meta_comments", - "meta_data" => "meta_data" + "meta_data" => "meta_data", + "plugins_maps_markers" => "plugins_maps_markers" ); ?> Modified: trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php =================================================================== --- trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/adodb/adodb-errorhandler.inc.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -30,6 +30,7 @@ */ function ADODB_Error_Handler($dbms, $fn, $errno, $errmsg, $p1, $p2, &$thisConnection) { + echo 'hi'; if (error_reporting() == 0) return; // obey @ protocol switch($fn) { case 'EXECUTE': Modified: trunk/linpha2/lib/classes/linpha.sql.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.sql.class.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/classes/linpha.sql.class.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -55,8 +55,11 @@ } else { + /** + * this seems to does not work correctly anymore error_reporting(0); include_once(LINPHA_DIR.'/lib/adodb/adodb-errorhandler.inc.php'); + */ $sql_dir = ''; include(LINPHA_DIR.'/var/config.dir.php'); // no include_once if we reconnect from another directory... Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-09-01 22:55:23 UTC (rev 4768) @@ -15,7 +15,11 @@ { this.editMarker = false; this.navIsHidden = false; - this.defaultMarkerZoom = 10; + this.defaultMarkerZoom = linMapsDefaultZoomSize; + + this.markersData = false; + this.markersObj = false; + this.bounds = false; }, /** @@ -23,8 +27,67 @@ */ loadMarkers: function() { + myLinGlobal.AjaxPost('cmd=loadMarkers',myLinMaps.showMarkers); + }, + showMarkers: function(t) + { + myLinMaps.markersData = eval('(' + t.responseText + ')'); + //myLinMaps.markers = t.responseText.evalJSON(true); + + /** + * delete existing markers + */ + if( myLinMaps.markersObj ) + { + for( i = 0; i < myLinMaps.markersObj.length; i++ ) + { + map.removeOverlay( myLinMaps.markersObj[i] ); + } + + myLinMaps.markersObj = false; + } + + /** + * draw new markers + */ + myLinMaps.bounds = new GLatLngBounds(); + for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) + { + myLinMaps.markersObj[i] = myLinMaps.createMarker( myLinMaps.markersData.markers[i] ); + } + + map.setCenter(myLinMaps.bounds.getCenter(), map.getBoundsZoomLevel(myLinMaps.bounds)); + }, + + createMarker: function( markerNode ) + { + /*var icon = new GIcon(); + icon.image = image[0]; + icon.iconSize = new GSize(image[1], image[2]); + subt = image[2] / 100 * 11; + subt = Math.ceil(subt); + var anchor = image[2] - subt; + icon.iconAnchor= new GPoint(10, anchor); + //{icon: icon, draggable: true}*/ + + //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon); + + var point = new GLatLng( markerNode.lat, markerNode.lon); + var marker = new GMarker(point/*, icon*/); + + GEvent.addListener(marker, "click", function() { + marker.openInfoWindowHtml( '<b>' + markerNode.name + '</b><br />' + markerNode.id ); + }); + + map.addOverlay( marker ); + + this.bounds.extend(point); + + return marker; + }, + geocodeAddress: function(address) { if( this.editMarker ) @@ -79,17 +142,19 @@ }, updateEditMarker: function() { - if( this.editMarker ) + if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class { - latlng = this.editMarker.getPoint(); + latlng = myLinMaps.editMarker.getPoint(); $('linInputLat').value = latlng.lat(); $('linInputLon').value = latlng.lng(); + $('linInputZoom').value = map.getZoom(); } else { $('linInputMarkerName').value = ''; $('linInputLat').value = ''; $('linInputLon').value = ''; + $('linInputZoom').value = ''; } }, saveMarker: function(t) @@ -201,6 +266,9 @@ linEnableOnResize(); linOnResizeWrapper(); + GEvent.addListener(map, "zoomend", myLinMaps.updateEditMarker); + + myLinMaps.loadMarkers(); } //initLinMaps(); Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -1,295 +1,352 @@ -<?php -/* - * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> - * Florian Angehrn - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -/** - * Google Maps - * @package Plugins - */ -if(!defined('LINPHA_DIR')) { exit(1); } - -error_reporting(E_ALL); -require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); - -if(isset($_GET['xml'])) -{ - header('Content-type: text/xml'); - echo '<?xml version="1.0" ?>'."\n"; - echo '<root>'."\n"; - - if(isset($_POST['cmd'])) - { - switch($_POST['cmd']) - { - case 'loadMarker': - break; - - case 'saveMarker': - - if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; - } - elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) - OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) - { - echo '<responseCode>failed</responseCode>'."\n"; - echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; - } - else - { - /** - * @todo save marker in db - */ - /* - $_POST['linInputMarkerName'] - floatval($_POST['linInputLat']) - floatval($_POST['linInputLon']) - */ - - echo '<responseCode>success</responseCode>'."\n"; - } - - break; - } - } - - echo '</root>'."\n"; - exit(); -} - -if(isset($_GET['albId'])) { - $albId = intval($_GET['albId']); -} - -$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . - "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . - "WHERE gpslatituderef IS NOT NULL " . - "AND gpslatitude IS NOT NULL " . - "AND gpslongituderef IS NOT NULL " . - "AND gpslongitude IS NOT NULL "); -while($data = $query->FetchRow()) -{ - $arrImg[] = $data; - $parentIds[ $data['parent_id'] ] = true; -} - -$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost -$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); - - -/** - * here starts the output - */ -ob_start(); - -?> - <div id="linDivMapTop"></div> - - <div id="linDivMapMain" style="height: 475px;"> - <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> - Nav - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - <br /><br /><br /><br /><br /><br /><br /><br /><br />tset - </div> - <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> - <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> - </div> - - <div id="linDivMapBottom"> - - <input type="text" id="linInputAddress" size="30"> - <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> - <br /><br /> - - <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> - <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: - </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> - <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat - </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> - <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: - </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> - </div> - - - - <br /><br /><br /> - - - <?php - /* - <input type="text" id="adresse" size="30"> - <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> - <br /><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> - <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( - "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> - - */ - - - - - - echo i18n("Please select the album to show in Google Maps:"); - echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=map&albId=0">'.i18n("All albums").'</a><br />'; - - foreach($parentIds as $id=>$value) - { - echo '<a href="'.LINPHA_LINK.'&linCat=map&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; - } - ?> - <br /> - - <div> - Legend:<br /> - (red) current marker<br /> - (yellow) location marker<br /> - (blue) location marker with assigned albums<br /> - (green) location marker with assigned images (GPS)<br /> - (pink) images<br /> - </div> - - <div> - Create marker:<br /> - 1. Enter address or just press "Geocode"<br /> - 2. Drag the marker to fine adjust<br /> - 3. Check marker name<br /> - 4. Press "Save"<br /> - <br /> - Assign albums:<br /> - 1. Click on a marker<br /> - 2. Press "Assign album"<br /> - 3. Choose album and press "Save"<br /> - 4. Repeat for multiple albums<br /> - <br /> - Assign images to an album marker:<br /> - This is done automatically. But it's required that your images have the - GPS information stored inside. You will need a GPS Data Logger to do this - automatically. It is also possible do it manually. Robogeo is a tool, but - it is not free. - </div> - - - </div> - - -<?php - $GLOBALS['linpha']->template->output['googleMap']->map( - $zoom = 4, - $lat = '49.9801', - $lng = '10.8731', - $type = "hybrid", - $min_zoom = 1, - $max_zoom = 23, - $navcontrol = "large", - $overview = 1, - $mousezoom = 1, - $tilecheck = 0 - ); -if(isset($albId)) -{ - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->bounds(); - //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed - - foreach($arrImg as $data) - { - if($albId == 0 OR $albId == $data['parent_id']) - { - $latlon = getExifLatLon($data); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker( - $latlon['gpslatitude'], - $latlon['gpslongitude'] , - '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. - $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], - array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) - ); - $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); - } - } - - $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - - /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr�cken Saarland Deutschland"); - // Wir f�gen einige Marker hinzu - $GLOBALS['linpha']->template->output['googleMap']->markstart(); - $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); - $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); - // Marker mit Infoblase - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); - $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); - $tabs = array( - array('Tab 1', 'Content1'), - array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), - array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') - ); - $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); - $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); - // Array mit Punkten zwischen denen eine Linie gezeichnet wird. - $punkte = array( - array('53.5', '12.7'), - array('52.5', '13'), - array('51.5', '12'), - array('51', '10'), - array('48', '11'), - array('47.5', '13') - ); - // Linie erzeugen - $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); - $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); - $GLOBALS['linpha']->template->output['googleMap']->markend(); - echo "L�nge der Linie: $dist Meter"; - */ -} - - - - - -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); -$linpha->template->overrideModule('head','map'); -$linpha->template->URL_full = LINPHA_LINK.'&linCat=map'; -$linpha->template->URL_base = LINPHA_LINK.'&linCat=map'; -$linpha->template->output['title'] = i18n("Google Maps"); -include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); - +<?php +/* + * Copyright (c) 2005 Heiko Rutenbeck <bz...@tu...> + * Florian Angehrn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/** + * Google Maps + * @package Plugins + */ +if(!defined('LINPHA_DIR')) { exit(1); } + +require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); +$urlFull = LINPHA_LINK.'&linCat=maps'; + +if(isset($_GET['xml'])) +{ + if(isset($_POST['cmd'])) + { + switch($_POST['cmd']) + { + case 'loadMarkers': + + echo '{ "markers": [' . "\n"; + + $query = $GLOBALS['linpha']->db->Execute( + "SELECT id, albId, albPath, markerName, markerLat, markerLon, markerZoom " . + "FROM ".LIN_PREFIX."plugins_maps_markers" + ); + + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['id'].', "albId": '.$data['albId'].', "path": "'.htmlspecialchars($data['albPath'],ENT_QUOTES).'", ' . + '"name": "'.htmlspecialchars($data['markerName'],ENT_QUOTES).'", ' . + '"lat": '.$data['markerLat'].', "lon": '.$data['markerLon'].', ' . + '"zoom": '.$data['markerZoom'].'},'. "\n"; + } + + /* + ?> + { + "markers": [ + {"id": 1, "path": "../../asd", "name": "my sweet home 1", "lat": 47.487868258751625, "lon": 9.388654232025146, "zoom": 17}, + {"id": 2, "path": "../../asd2", "name": "my sweet home 2", "lat": 47.587868258751625, "lon": 9.388654232025146, "zoom": 10}, + {"id": 3, "path": "../../asd3", "name": "my sweet home 3", "lat": 47.687868258751625, "lon": 9.388654232025146, "zoom": 15}, + ] + } + <?php + */ + + echo '] }' . "\n"; + + break; + + case 'saveMarker': + case 'editMarker': + + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; + + if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: no title specified").'</responseMsg>'."\n"; + } + elseif( !isset($_POST['linInputLat']) OR empty($_POST['linInputLat']) + OR !isset($_POST['linInputLon']) OR empty($_POST['linInputLon'])) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: Missing Lat/Lon values").'</responseMsg>'."\n"; + } + else + { + if( !isset($_POST['linInputZoom']) OR empty($_POST['linInputZoom']) ) + { + $_POST['linInputZoom'] = $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; + } + + if( $_POST['cmd'] == 'saveMarker' ) + { + $GLOBALS['linpha']->db->Execute("INSERT INTO ".LIN_PREFIX."plugins_maps_markers " . + "(markerName, markerLat, markerLon, markerZoom) " . + "VALUES (" . + "'".LinSql::linAddslashes($_POST['linInputMarkerName'])."', " . + "'".floatval($_POST['linInputLat'])."', " . + "'".floatval($_POST['linInputLon'])."', " . + "'".intval($_POST['linInputZoom'])."')" + ); + } + else // edit Marker + { + if( !isset($_POST['linInputMarkerId']) OR empty($_POST['linInputMarkerId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid marker").'</responseMsg>'."\n"; + } + } + + echo '<responseCode>success</responseCode>'."\n"; + } + + echo '</root>'."\n"; + + break; + } + } + + exit(); +} + +if(isset($_GET['albId'])) { + $albId = intval($_GET['albId']); +} + +$query = $GLOBALS['linpha']->db->Execute("SELECT P.id, P.parent_id, P.name, gpslatituderef,gpslatitude,gpslongituderef,gpslongitude " . + "FROM ".LIN_PREFIX."meta_exif E INNER JOIN ".LIN_PREFIX."photos P on E.md5sum = P.md5sum " . + "WHERE gpslatituderef IS NOT NULL " . + "AND gpslatitude IS NOT NULL " . + "AND gpslongituderef IS NOT NULL " . + "AND gpslongitude IS NOT NULL "); +while($data = $query->FetchRow()) +{ + $arrImg[] = $data; + $parentIds[ $data['parent_id'] ] = true; +} + +$key = "ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg"; // key for http://localhost +$GLOBALS['linpha']->template->output['googleMap'] = new gmap($key); + +/** + * here starts the output + */ +ob_start(); + +?> + <div id="linDivMapTop"></div> + + <div id="linDivMapMain" style="height: 475px;"> + <div id="linDivMapNav" style="width: 155px; height: 475px; float: right; overflow: auto; padding-left: 2px; padding-right: 1px;"> + Nav + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + <br /><br /><br /><br /><br /><br /><br /><br /><br />tset + </div> + <div style="width: 5px; height: 100%; float: right; cursor: e-resize; background-color: grey; border: 1px solid black;" ondblClick="linToggleNav();"></div> + <div id="gmapper_map" style="height: 100%; margin-right: 165px; "></div> + </div> + + <div id="linDivMapBottom"> + + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMaps.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> + <br /><br /> + + <div id="linDivEditMarker" style="border: 1px solid black; width: 550px; padding: 3px;"> + <form action="<?php /* <?php echo $urlFull; ?>&xml */ + ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" style="display: block; float: left; width: 150px;">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" style="display: block; float: left; width: 150px;">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" style="display: block; float: left; width: 150px;">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <label for="linInputZoom" style="display: block; float: left; width: 150px;">Zoom: + </label><input type="text" id="linInputZoom" name="linInputZoom" size="10" /><br /> + + <input type="submit" value="<?php echo i18n("Save"); ?>" /> + <input type="hidden" name="cmd" value="saveMarker" /> + </form> + </div> + + + + <br /><br /><br /> + + + <?php + /* + <input type="text" id="adresse" size="30"> + <input type="button" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "getAdress()", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/dash.png",32,32)); ?>" value="Geocode"> <br> + <br /><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Berlin", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/143.png",20,34)); ?>">Berlin</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Muenchen", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/rot.png",20,34), 10); ?>">München</a><br /> + <a href="javascript:void(0)" onclick="<?php $GLOBALS['linpha']->template->output['googleMap']->geocode( + "Koelner Dom", "otherMarker", array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gruen.png",20,34), 17); ?>">Kölner Dom</a> + + */ + + + + + + echo i18n("Please select the album to show in Google Maps:"); + echo '<br /><br /><a href="'.LINPHA_LINK.'&linCat=maps&albId=0">'.i18n("All albums").'</a><br />'; + + foreach($parentIds as $id=>$value) + { + echo '<a href="'.LINPHA_LINK.'&linCat=maps&albId='.$id.'">'; + echo implode( '/', LinSql::getFullFilenameFromId($id) ); + echo '</a><br />'; + } + ?> + <br /> + + <div> + Legend:<br /> + (red) current marker<br /> + (yellow) location marker<br /> + (blue) location marker with assigned albums<br /> + (green) location marker with assigned images (GPS)<br /> + (pink) images<br /> + </div> + + <div> + Create marker:<br /> + 1. Enter address or just press "Geocode"<br /> + 2. Drag the marker to fine adjust<br /> + 3. Check marker name<br /> + 4. Press "Save"<br /> + <br /> + Assign albums:<br /> + 1. Click on a marker<br /> + 2. Press "Assign album"<br /> + 3. Choose album and press "Save"<br /> + 4. Repeat for multiple albums<br /> + <br /> + Assign images to an album marker:<br /> + This is done automatically. But it's required that your images have the + GPS information stored inside. You will need a GPS Data Logger to do this + automatically. It is also possible do it manually. Robogeo is a tool, but + it is not free. + </div> + + <div> + Not assigned images:<br /> + albums/album1 (22 images)<br /> + </div> + + + </div> + + +<?php + $GLOBALS['linpha']->template->output['googleMap']->map( + $zoom = 4, + $lat = '49.9801', + $lng = '10.8731', + $type = "hybrid", + $min_zoom = 1, + $max_zoom = 23, + $navcontrol = "large", + $overview = 1, + $mousezoom = 1, + $tilecheck = 0 + ); +if(isset($albId)) +{ + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->bounds(); + //$GLOBALS['linpha']->template->output['googleMap']->lockMap(); not needed + + foreach($arrImg as $data) + { + if($albId == 0 OR $albId == $data['parent_id']) + { + $latlon = getExifLatLon($data); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker( + $latlon['gpslatitude'], + $latlon['gpslongitude'] , + '<img src="'.LINPHA_CLIENT.'/get_thumb.php?linId='.$data['id'].'" width="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" height="'. + $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max'].'" /><br />'.$data['name'], + array(LINPHA_CLIENT."/lib/plugins/maps/gmapper1/gelb.png",20,34) + ); + $GLOBALS['linpha']->template->output['googleMap']->boundsExtend(); + } + } + + $GLOBALS['linpha']->template->output['googleMap']->zoomToBounds(); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + + /*$gpoint = $GLOBALS['linpha']->template->output['googleMap']->getGeoPoint("Saarbr\xFCcken Saarland Deutschland"); + // Wir f\xFCgen einige Marker hinzu + $GLOBALS['linpha']->template->output['googleMap']->markstart(); + $GLOBALS['linpha']->template->output['googleMap']->marker($gpoint[0], $gpoint[1], "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('52.5', '13', "dash.png"); + $GLOBALS['linpha']->template->output['googleMap']->mapMarker('48', '11', "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->marker('47.5', '13', "gelb.png"); + // Marker mit Infoblase + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51.5', '12' , 'Text hier', "gelb.png"); + $GLOBALS['linpha']->template->output['googleMap']->otherMarker('51', '10' , 'Hallo Welt!'); + $tabs = array( + array('Tab 1', 'Content1'), + array('Tab 2', 'Lorem Ipsum Dolor sit amet Lorem Ipsum <br>Lorem Ispum'), + array('Tab 3', 'Lorem Ipsum Dolor sit amet Lorem Ipsum ') + ); + $GLOBALS['linpha']->template->output['googleMap']->tabMarker('52.6', '11.9' , $tabs, "gruen.png"); + $GLOBALS['linpha']->template->output['googleMap']->linkMarker('51.0', '6.5' , "http://www.gothic-singles.de", "rot.png"); + // Array mit Punkten zwischen denen eine Linie gezeichnet wird. + $punkte = array( + array('53.5', '12.7'), + array('52.5', '13'), + array('51.5', '12'), + array('51', '10'), + array('48', '11'), + array('47.5', '13') + ); + // Linie erzeugen + $GLOBALS['linpha']->template->output['googleMap']->polyline($punkte, '#FF00FF', 4, 1, "", 1); + $dist = $GLOBALS['linpha']->template->output['googleMap']->getDistance($punkte); + $GLOBALS['linpha']->template->output['googleMap']->markend(); + echo "L\xE4nge der Linie: $dist Meter"; + */ +} + + + + + +$linpha->template->output['default'] = ob_get_clean(); + +$linpha->template->setModuleName('default'); +$linpha->template->overrideModule('head','map'); +$linpha->template->URL_full = $urlFull; +$linpha->template->URL_base = $urlFull; +$linpha->template->output['title'] = i18n("Google Maps"); +include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); + + function getExifLatLon(&$LatLon) { /*Array PJMT @@ -345,4 +402,4 @@ } return $return; } -?> +?> \ No newline at end of file Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-08-23 19:14:12 UTC (rev 4767) +++ trunk/linpha2/templates/default/map.head.php 2007-09-01 22:55:23 UTC (rev 4768) @@ -11,4 +11,6 @@ var maxImageHeight = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_image_height']; ?>; var maxThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_max']; ?>; var displayThumbSize = <?php echo $GLOBALS['linpha']->sql->config->value['sys_style_thumb_size_display']; ?>; + +var linMapsDefaultZoomSize = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; </script> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |