[Linpha-cvs] SF.net SVN: linpha: [4931] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
|
From: <fan...@us...> - 2008-04-27 12:37:18
|
Revision: 4931
http://linpha.svn.sourceforge.net/linpha/?rev=4931&view=rev
Author: fangehrn
Date: 2008-04-27 05:37:17 -0700 (Sun, 27 Apr 2008)
Log Message:
-----------
2008-04-27 flo
* GPS Tab
- implemented mini google map and reverse geocoding
* More bug fixes
- Album/Image view and Map plugin seems to be ok now (tested in FF, IE, Opera)
Modified Paths:
--------------
trunk/linpha2/ChangeLog
trunk/linpha2/admin/maintenance_import.php
trunk/linpha2/docs/dev/external_libraries.txt
trunk/linpha2/lib/classes/linpha.view.album.class.php
trunk/linpha2/lib/classes/linpha.view.image.class.php
trunk/linpha2/lib/js/LinYUIAlbum.js
trunk/linpha2/lib/js/LinYUIPage.js
trunk/linpha2/lib/plugins/maps/LinMapsYUI.js
trunk/linpha2/lib/plugins/maps/module.maps.php
trunk/linpha2/templates/default/maps.head.php
trunk/linpha2/templates/default/maps.html.php
trunk/linpha2/templates/default/tabs/gps.html.php
trunk/linpha2/templates/default/viewer.head.php
trunk/linpha2/templates/default/viewer.html.php
Added Paths:
-----------
trunk/linpha2/lib/plugins/maps/LinMaps_old.js
trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js
trunk/linpha2/lib/plugins/maps/class.maps.php
trunk/linpha2/lib/plugins/maps/greversegeocoder.js
Removed Paths:
-------------
trunk/linpha2/lib/plugins/maps/LinMaps.js
trunk/linpha2/lib/plugins/maps/class.googlemaps.js
Modified: trunk/linpha2/ChangeLog
===================================================================
--- trunk/linpha2/ChangeLog 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/ChangeLog 2008-04-27 12:37:17 UTC (rev 4931)
@@ -1,4 +1,11 @@
+2008-04-27 flo
+ * GPS Tab
+ - implemented mini google map and reverse geocoding
+
+ * More bug fixes
+ - Album/Image view and Map plugin seems to be ok now (tested in FF, IE, Opera)
+
2008-04-26 flo
* Search bug fixes
* Menu bug fixes
Modified: trunk/linpha2/admin/maintenance_import.php
===================================================================
--- trunk/linpha2/admin/maintenance_import.php 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/admin/maintenance_import.php 2008-04-27 12:37:17 UTC (rev 4931)
@@ -197,13 +197,44 @@
}
- /**
- * exif, iptc, xmp
- *
- * if "Delete First" and "All albums" was selected, the whole table will be deleted
- */
+ /**
+ * get imgids to indexing, if reindex is selected: delete these entries first
+ */
+ if ($all_albums)
+ {
+ echo i18n("All Directories selected").'<br />';
+
+ $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999");
+ while ($data = $query->FetchRow())
+ {
+ $array_meta_ids[$data['id']] = $data['md5sum'];
+ }
+ }
+ else
+ {
+ echo i18n("Directory selected:").' ';
+ foreach ($_REQUEST['album_select'] AS $key=>$value)
+ {
+ $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'");
+ echo $data['name'].', ';
+
+ $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " .
+ "parent_id = '".LinSql::linAddslashes($value)."' AND " .
+ "img_type <> 0 AND img_type <> 9999999");
+ while ($data = $query->FetchRow())
+ {
+ $array_meta_ids[$data['id']] = $data['md5sum'];
+ }
+ }
+ echo '<br />';
+ }
+
+ /**
+ * exif, iptc, xmp
+ *
+ * if "Delete First" and "All albums" was selected, the whole table will be deleted
+ */
$MetaData = new LinMetaData();
-
foreach($array_meta as $meta_value)
{
if ( isset($_REQUEST['index_'.$meta_value]) &&
@@ -212,38 +243,6 @@
echo '<h2 class="linStyle">'.i18n("File Indexing").' ('.strtoupper($meta_value).')</h2>';
/**
- * get imgids to indexing, if reindex is selected: delete these entries first
- */
- if ($all_albums)
- {
- echo i18n("All Directories selected").'<br />';
-
- $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE img_type <> 0 AND img_type <> 9999999");
- while ($data = $query->FetchRow())
- {
- $array_meta_ids[$data['id']] = $data['md5sum'];
- }
- }
- else
- {
- echo i18n("Directory selected:").' ';
- foreach ($_REQUEST['album_select'] AS $key=>$value)
- {
- $data = $GLOBALS['linpha']->db->GetRow("SELECT name FROM ".LIN_PREFIX."photos WHERE id = '".LinSql::linAddslashes($value)."'");
- echo $data['name'].', ';
-
- $query = $GLOBALS['linpha']->db->Execute("SELECT id, md5sum FROM ".LIN_PREFIX."photos WHERE " .
- "parent_id = '".LinSql::linAddslashes($value)."' AND " .
- "img_type <> 0 AND img_type <> 9999999");
- while ($data = $query->FetchRow())
- {
- $array_meta_ids[$data['id']] = $data['md5sum'];
- }
- }
- echo '<br />';
- }
-
- /**
* delete first (if selected)
*/
if ( isset($_REQUEST['index_'.$meta_value.'_delete']) )
@@ -287,8 +286,43 @@
echo '<br /><br />';
}
- unset($array_meta_ids);
+ //unset($array_meta_ids);
}
+
+ if ($GLOBALS['linpha']->sql->config->isPluginActive('maps')
+ && $GLOBALS['linpha']->sql->config->value['plugins_maps_enable_geotagged']
+ && $GLOBALS['linpha']->sql->config->value['plugins_maps_geotagged_autoimport']
+ && isset($array_meta_ids)
+ && $_REQUEST['index_exif'] == 'index')
+ {
+ echo '<h2 class="linStyle">'.i18n("Import Geo Data").'</h2>';
+
+ $table = LIN_PREFIX."plugins_maps_image_geodata";
+
+ foreach ($array_meta_ids as $id=>$md5sum)
+ {
+ if (LinMetaData::fileNeedsIndexing($md5sum, $table))
+ {
+ $full_filename = LinSql::getFullImagePath($id);
+
+ if ($MetaData->saveMetaDataToDatabase('exifgps', $table, $full_filename, $md5sum ))
+ {
+ $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."photos " .
+ "SET geodata='1' WHERE md5sum='".$md5sum."' ");
+
+ echo " ".$id." (GPS),";
+ }
+ else
+ {
+ echo " ".$id.",";
+ }
+
+ flush();
+ }
+ }
+
+ echo '<br /><br />';
+ }
}
Modified: trunk/linpha2/docs/dev/external_libraries.txt
===================================================================
--- trunk/linpha2/docs/dev/external_libraries.txt 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/docs/dev/external_libraries.txt 2008-04-27 12:37:17 UTC (rev 4931)
@@ -1,16 +1,24 @@
-- csshover.htc V1.42.060206
+Javascript:
-- scriptaculous 1.8.0 (contains prototype)
-- prototype 1.6.0
+//- csshover.htc V1.42.060206
+//- scriptaculous 1.8.0 (contains prototype)
+//- prototype 1.6.0
- JSCookMenu
CHANGES
-------
fixed bug in cmEnableItem() reported here:
http://sourceforge.net/tracker/index.php?func=detail&aid=1766028&group_id=149372&atid=778279
-
+- Google Reverse Geocoder (greversegeocoder.js) v1.0.6
+ http://nicogoeminne.googlepages.com/documentation.html
+
+- YUI 2.5.1
+
+
+PHP:
+
- adodb
- getid3 1.7.7
Modified: trunk/linpha2/lib/classes/linpha.view.album.class.php
===================================================================
--- trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/classes/linpha.view.album.class.php 2008-04-27 12:37:17 UTC (rev 4931)
@@ -500,8 +500,15 @@
}
if (isset($arrOpt)) {
$opt = '{';
+ $i = 0;
foreach( $arrOpt as $key=>$value) {
- $opt .= '"'.$key.'": '.$value.', ';
+ $opt .= '"'.$key.'": '.$value;
+
+ if ($i != count($arrOpt)-1) {
+ $opt .= ', ';
+ }
+
+ $i++;
}
$opt .= '}';
} else {
Modified: trunk/linpha2/lib/classes/linpha.view.image.class.php
===================================================================
--- trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/classes/linpha.view.image.class.php 2008-04-27 12:37:17 UTC (rev 4931)
@@ -76,8 +76,10 @@
break;
case 'gps':
- $this->getImageData('gps');
- require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/gps.html.php');
+ if ($GLOBALS['linpha']->sql->config->isPluginActive('maps')) {
+ $this->getImageData('gps');
+ require_once(LINPHA_DIR.'/templates/'.$GLOBALS['linpha']->template->template_name.'/tabs/gps.html.php');
+ }
break;
case 'exif':
$this->getImageData('exif');
@@ -281,6 +283,15 @@
}
break;
+ case 'gps':
+ require_once(LINPHA_DIR.'/lib/plugins/maps/class.maps.php');
+
+ $data = $GLOBALS['linpha']->db->GetRow("SELECT gpslatituderef, gpslatitude, gpslongituderef, gpslongitude " .
+ "FROM ".LIN_PREFIX."plugins_maps_image_geodata " .
+ "WHERE md5sum = '".LinSql::linAddslashes($this->imgData['md5sum'])."'");
+ $this->latlon = LinMaps::getExifLatLon($data);
+
+ break;
}
}
Modified: trunk/linpha2/lib/js/LinYUIAlbum.js
===================================================================
--- trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/js/LinYUIAlbum.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -450,6 +450,7 @@
//this.indexCommentTab = idx; // used by saveComment()
this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['comments']);
+ loadGPSimmediate = false;
switch( this.currentFileType )
{
@@ -457,7 +458,13 @@
this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['imageInfo']);
if (this.album.Thumbs[imgIndex].opt != null && this.album.Thumbs[imgIndex].opt.gps) {
- this.Tabs[idx++] = new YAHOO.widget.Tab(tabConf['gps']);
+ this.Tabs[idx] = new YAHOO.widget.Tab(tabConf['gps']);
+ this.Tabs[idx].addListener('contentChange', linLoadGPSMap); // click
+
+ //if (tabConf['gps'].active)
+ // loadGPSimmediate = true;
+
+ idx++;
}
if (linEXIFEnabled) {
@@ -494,6 +501,15 @@
this.TabView.addTab( this.Tabs[tabIndex] );
}
+ // check if there's again an active tab, and if not make the first tab active
+ if (typeof(this.TabView.get('activeTab')) == "undefined")
+ {
+ this.TabView.set('activeIndex', 0);
+ }
+
+ if (loadGPSimmediate)
+ linLoadGPSMap();
+
for(i = 1; i <= linPreloadImages; i++)
{
if ( this.album.Thumbs[imgIndex+i] )
@@ -685,3 +701,46 @@
var myLinAlbum = new YAHOO.linpha.Album();
myLinAlbum.loadAlbum('local');
+
+/**
+ * show google map
+ * see not in viewer.html.php why this functions cannot be directly in the gps tab
+ */
+function linShowGoogleMap()
+{
+ //linYUILoader.onSuccess = null;
+
+ if (GBrowserIsCompatible()) {
+ var map = new GMap2(document.getElementById("linDivMapObject"));
+ var point = new GLatLng(parseFloat($("linSpanLatitude").innerHTML), parseFloat($("linSpanLongitude").innerHTML));
+
+ map.setCenter(point, 10);
+ map.addControl(new GSmallMapControl());
+
+ map.addOverlay( new GMarker(point, {}) );
+
+ var reversegeocoder = new GReverseGeocoder(map);
+
+ GEvent.addListener(reversegeocoder, "load", linSetGeocodeLocation);
+ /*function(placemark) {
+ $("linSpanNearestLocation").innerHTML = placemark.address;
+ }
+ );*/
+
+ GEvent.addListener(reversegeocoder, "error",
+ function() {
+ $("linSpanNearestLocation").innerHTML = "Unable to Reverse geocode";
+ }
+ );
+
+
+ reversegeocoder.reverseGeocode(point);
+
+ YAHOO.util.Event.addListener(window, "unload", GUnload);
+ }
+}
+function linSetGeocodeLocation(placemark)
+{
+ // not an anonymous function to be able to debug it...
+ $("linSpanNearestLocation").innerHTML = placemark.address;
+}
Modified: trunk/linpha2/lib/js/LinYUIPage.js
===================================================================
--- trunk/linpha2/lib/js/LinYUIPage.js 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/js/LinYUIPage.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -23,7 +23,7 @@
// onResize()
YAHOO.linpha.Page.prototype.onResize = function() {
- if (typeof(linOnResizeWrapper) != null)
+ if (typeof(linOnResizeWrapper) != "undefined")
linOnResizeWrapper();
else
myLinPage.setMainHeight(true);
Deleted: trunk/linpha2/lib/plugins/maps/LinMaps.js
===================================================================
--- trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -1,355 +0,0 @@
-
-/**
- * class and global definitions
- */
-var LinMaps = Class.create();
-var myLinMaps;
-
-LinMaps.prototype =
-{
- /**
- * initialize()
- * Constructor runs on completion of the DOM loading.
- */
- initialize: function()
- {
- this.editMarker = false;
- this.showNav = true;
- this.defaultMarkerZoom = linMapsDefaultMarkerZoom;
-
- this.markersData = false;
- this.markersObj = new Array();
- this.imagesObj = new Array();
-
- this.ajaxUrl = linUrlBase + '&linId=' + linIdCurrent + '&xml';
- },
-
- /**
- * Marker functions
- */
- loadMarkers: function()
- {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers);
- },
- showMarkers: function(t)
- {
- var i;
-
- 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++ )
- {
- myLinMapObject.removeMarker( myLinMaps.markersObj[i] );
- }
-
- myLinMaps.markersObj = new Array();
- }
-
- /**
- * draw new markers
- */
- myLinMapObject.initBounds();
-
- for( i = 0; i < myLinMaps.markersData.markers.length; i++ )
- {
- myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i], false );
- }
-
- /**
- * update center
- * only if there is more than one marker
- * prevent zooming to high
- */
- if( i > 0) {
- if( i == 1 ) {
- myLinMapObject.updateCenter( myLinMaps.markersData.markers[0].zoom );
- } else {
- myLinMapObject.updateCenter( 0 );
- }
- }
- },
-
- updateEditMarker: function()
- {
- if( myLinMaps.editMarker ) // marker activated. use myLinMaps. instead of "this." when fired from GEvent class
- {
- latlng = myLinMaps.editMarker.getPoint();
- $('linFormEditMarker').linInputLat.value = latlng.lat();
- $('linFormEditMarker').linInputLon.value = latlng.lng();
- $('linFormEditMarker').linInputZoom.value = googlemap.getZoom();
- }
- },
-
- saveMarker: function(t)
- {
- xmlAnswer = t.responseXML.documentElement;
-
- if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
- {
- myLinMaps.removeEditMarker();
-
- myLinMaps.loadMarkers();
- }
- else
- {
- alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
- }
- },
-
- deleteMarker: function(markerId)
- {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish);
- },
- deleteMarkerFinish: function(t)
- {
- xmlAnswer = t.responseXML.documentElement;
-
- if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
- {
- var markerId = xmlAnswer.getElementsByTagName('responseData').item(0).firstChild.data;
-
- for( i = 0; i < myLinMaps.markersData.markers.length; i++ )
- {
- if( myLinMaps.markersData.markers[i].id == markerId )
- {
- myLinMapObject.removeMarker( myLinMaps.markersObj[i] );
- myLinMaps.markersObj[i] = false;
- }
- }
- }
- else
- {
- alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
- }
- },
-
- removeEditMarker: function()
- {
- myLinMapObject.removeMarker( this.editMarker );
- this.editMarker = false;
- },
-
- assignAlbum: function(markerId,albId)
- {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
- },
- assignAlbumChange: function(markerId,albId) {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
- },
- assignAlbumDelete: function(markerId,albId)
- {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
- },
- assignAlbumFinish: function(t)
- {
- xmlAnswer = t.responseXML.documentElement;
-
- // recreate marker on success
- if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
- {
- myLinMaps.loadMarkers();
- }
- else
- {
- // print error message
- alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
- }
- },
-
- loadAlbums: function()
- {
- myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums);
- },
- showAlbums: function(t)
- {
- $('linDivMapAlbums').innerHTML = '';
- albumsData = eval('(' + t.responseText + ')');
-
- for( i = 0; i < albumsData.albums.length; i++ )
- {
- $('linDivMapAlbums').innerHTML +=
- '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">'
- + albumsData.albums[i].name + '</a><br />';
- }
-
- myLinGlobal.createPopup('linDivPopupAlbums');
- },
-
- /**
- * Thumbnail functions
- */
- loadImages: function(albId)
- {
- this.startLoading();
-
- myLinMapObject.closeMarkerWindows();
-
- if( !this.showNav ) {
- this.toggleNav();
- }
-
- myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages);
-
- },
- showImages: function(t)
- {
- myLinMaps.imagesData = eval('(' + t.responseText + ')');
- //myLinMaps.images = t.responseText.evalJSON(true);
-
- /**
- * delete existing images
- */
- $('linDivMapNav').innerHTML = '';
- if( myLinMaps.imagesObj )
- {
- for( i = 0; i < myLinMaps.imagesObj.length; i++ )
- {
- myLinMapObject.removeMarker( myLinMaps.imagesObj[i] );
- }
-
- myLinMaps.imagesObj = new Array();
- }
-
-
- /**
- * draw new markers / create thumbnails list
- */
- myLinMapObject.initBounds();
-
- for( i = 0; i < myLinMaps.imagesData.images.length; i++ )
- {
- thumbId = myLinMaps.imagesData.images[i].id;
-
- var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize});
- var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'});
- var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'});
-
- ElemA.appendChild( ElemImg );
- ElemDiv.appendChild( ElemA );
- $('linDivMapNav').appendChild(ElemDiv);
-
- if( i == 0 )
- myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], true );
- else
- myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], false );
- }
-
- myLinMapObject.updateCenter(0);
-
- myLinMaps.stopLoading();
-
- },
-
- toggleNav: function()
- {
-
- if( this.showNav )
- {
- Element.hide('linDivMapNav');
-
- // backup current margin
- $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight;
-
- $('linDivMapObject').style.marginRight = '7px';
-
- this.showNav = false;
- }
- else
- {
- // restore saved margin
- $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight;
- $('linDivMapNav').style.marginRight = 0;
-
- Element.show('linDivMapNav');
-
- this.showNav = true;
- }
-
- // update google map size
- myLinMapObject.checkResize();
- },
-
-
-
- startLoading: function() {
- Element.show('linDivLoadingOuter');
- },
- stopLoading: function() {
- Element.hide('linDivLoadingOuter');
- }
-
-
-
-
-
-
-
-
-} // end class LinMaps
-
-function linOnResizeWrapper()
-{
- myLinGlobal.setWindowSize();
- var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30;
- if(newHeight < 100)
- {
- newHeight = 100;
- }
-
- $('linDivMapNav').style.height = newHeight + 'px';
- $('linDivMapMain').style.height = newHeight + 'px';
-
-
- /**
- * tempoarely set the map heigth to a small value (zero does not work!)
- * in IE setMainHeight() would not work while reducing the window size
- * because IE takes always as much space as he actually needs ignoring
- * the height attribute
- */
-
- /*$('linDivMapNav').style.height = '10px';
- $('linDivMapMain').style.height = '10px';
-
- myLinGlobal.setMainHeight();
-
- $('linDivMapMain').style.height = ($('linDivMain').offsetHeight - $("linDivTop").offsetHeight - $('linDivMapBottom').offsetHeight - 5) + 'px';*/
-
- /**
- * set also height of the navigation bar
- * overflow:auto does not work in IE with height: 100%
- */
- /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/
-
- // resize also google map itself
- myLinMapObject.checkResize();
-}
-
-/**
- * initLinMaps()
- *
- * create the class object
- */
-function initLinMaps()
-{
- myLinMaps.toggleNav();
-
- /*if( doLoadAlbums )
- myLinMaps.loadAlbums();*/
-
- //linEnableOnResize();
- //linOnResizeWrapper();
- myLinPage.enableOnResize('maps');
-
- myLinMaps.loadMarkers();
-}
-Event.observe(window, 'load', initLinMaps, false);
-//Event.observe(body, 'load', initLinMaps, false);
-
-myLinMaps = new LinMaps();
-linMapObjectInit();
Modified: trunk/linpha2/lib/plugins/maps/LinMapsYUI.js
===================================================================
--- trunk/linpha2/lib/plugins/maps/LinMapsYUI.js 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/plugins/maps/LinMapsYUI.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -70,6 +70,13 @@
myLinMapObject.updateCenter( 0 );
}
}
+
+ if (startupAlbum != -1)
+ {
+ myLinMaps.loadImages(startupAlbum);
+ startupAlbum = -1;
+ }
+
};
YAHOO.linpha.Maps.prototype.updateEditMarker = function()
@@ -233,7 +240,7 @@
{
thumbId = myLinMaps.imagesData.images[i].id;
- var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize});
+ var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, border: 0 /*required for IE*/, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize});
var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'});
var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'});
Copied: trunk/linpha2/lib/plugins/maps/LinMaps_old.js (from rev 4924, trunk/linpha2/lib/plugins/maps/LinMaps.js)
===================================================================
--- trunk/linpha2/lib/plugins/maps/LinMaps_old.js (rev 0)
+++ trunk/linpha2/lib/plugins/maps/LinMaps_old.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -0,0 +1,355 @@
+
+/**
+ * class and global definitions
+ */
+var LinMaps = Class.create();
+var myLinMaps;
+
+LinMaps.prototype =
+{
+ /**
+ * initialize()
+ * Constructor runs on completion of the DOM loading.
+ */
+ initialize: function()
+ {
+ this.editMarker = false;
+ this.showNav = true;
+ this.defaultMarkerZoom = linMapsDefaultMarkerZoom;
+
+ this.markersData = false;
+ this.markersObj = new Array();
+ this.imagesObj = new Array();
+
+ this.ajaxUrl = linUrlBase + '&linId=' + linIdCurrent + '&xml';
+ },
+
+ /**
+ * Marker functions
+ */
+ loadMarkers: function()
+ {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadMarkers',myLinMaps.showMarkers);
+ },
+ showMarkers: function(t)
+ {
+ var i;
+
+ 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++ )
+ {
+ myLinMapObject.removeMarker( myLinMaps.markersObj[i] );
+ }
+
+ myLinMaps.markersObj = new Array();
+ }
+
+ /**
+ * draw new markers
+ */
+ myLinMapObject.initBounds();
+
+ for( i = 0; i < myLinMaps.markersData.markers.length; i++ )
+ {
+ myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i], false );
+ }
+
+ /**
+ * update center
+ * only if there is more than one marker
+ * prevent zooming to high
+ */
+ if( i > 0) {
+ if( i == 1 ) {
+ myLinMapObject.updateCenter( myLinMaps.markersData.markers[0].zoom );
+ } else {
+ myLinMapObject.updateCenter( 0 );
+ }
+ }
+ },
+
+ updateEditMarker: function()
+ {
+ if( myLinMaps.editMarker ) // marker activated. use myLinMaps. instead of "this." when fired from GEvent class
+ {
+ latlng = myLinMaps.editMarker.getPoint();
+ $('linFormEditMarker').linInputLat.value = latlng.lat();
+ $('linFormEditMarker').linInputLon.value = latlng.lng();
+ $('linFormEditMarker').linInputZoom.value = googlemap.getZoom();
+ }
+ },
+
+ saveMarker: function(t)
+ {
+ xmlAnswer = t.responseXML.documentElement;
+
+ if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
+ {
+ myLinMaps.removeEditMarker();
+
+ myLinMaps.loadMarkers();
+ }
+ else
+ {
+ alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
+ }
+ },
+
+ deleteMarker: function(markerId)
+ {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=deleteMarker&markerId='+markerId,myLinMaps.deleteMarkerFinish);
+ },
+ deleteMarkerFinish: function(t)
+ {
+ xmlAnswer = t.responseXML.documentElement;
+
+ if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
+ {
+ var markerId = xmlAnswer.getElementsByTagName('responseData').item(0).firstChild.data;
+
+ for( i = 0; i < myLinMaps.markersData.markers.length; i++ )
+ {
+ if( myLinMaps.markersData.markers[i].id == markerId )
+ {
+ myLinMapObject.removeMarker( myLinMaps.markersObj[i] );
+ myLinMaps.markersObj[i] = false;
+ }
+ }
+ }
+ else
+ {
+ alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
+ }
+ },
+
+ removeEditMarker: function()
+ {
+ myLinMapObject.removeMarker( this.editMarker );
+ this.editMarker = false;
+ },
+
+ assignAlbum: function(markerId,albId)
+ {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbum&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
+ },
+ assignAlbumChange: function(markerId,albId) {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumChange&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
+ },
+ assignAlbumDelete: function(markerId,albId)
+ {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=assignAlbumDelete&markerId='+markerId+'&albId='+albId,myLinMaps.assignAlbumFinish);
+ },
+ assignAlbumFinish: function(t)
+ {
+ xmlAnswer = t.responseXML.documentElement;
+
+ // recreate marker on success
+ if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' )
+ {
+ myLinMaps.loadMarkers();
+ }
+ else
+ {
+ // print error message
+ alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data );
+ }
+ },
+
+ loadAlbums: function()
+ {
+ myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, 'cmd=loadAlbums',myLinMaps.showAlbums);
+ },
+ showAlbums: function(t)
+ {
+ $('linDivMapAlbums').innerHTML = '';
+ albumsData = eval('(' + t.responseText + ')');
+
+ for( i = 0; i < albumsData.albums.length; i++ )
+ {
+ $('linDivMapAlbums').innerHTML +=
+ '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">'
+ + albumsData.albums[i].name + '</a><br />';
+ }
+
+ myLinGlobal.createPopup('linDivPopupAlbums');
+ },
+
+ /**
+ * Thumbnail functions
+ */
+ loadImages: function(albId)
+ {
+ this.startLoading();
+
+ myLinMapObject.closeMarkerWindows();
+
+ if( !this.showNav ) {
+ this.toggleNav();
+ }
+
+ myLinGlobal.AjaxPost(this.ajaxUrl, 'cmd=loadImages&albId='+albId,myLinMaps.showImages);
+
+ },
+ showImages: function(t)
+ {
+ myLinMaps.imagesData = eval('(' + t.responseText + ')');
+ //myLinMaps.images = t.responseText.evalJSON(true);
+
+ /**
+ * delete existing images
+ */
+ $('linDivMapNav').innerHTML = '';
+ if( myLinMaps.imagesObj )
+ {
+ for( i = 0; i < myLinMaps.imagesObj.length; i++ )
+ {
+ myLinMapObject.removeMarker( myLinMaps.imagesObj[i] );
+ }
+
+ myLinMaps.imagesObj = new Array();
+ }
+
+
+ /**
+ * draw new markers / create thumbnails list
+ */
+ myLinMapObject.initBounds();
+
+ for( i = 0; i < myLinMaps.imagesData.images.length; i++ )
+ {
+ thumbId = myLinMaps.imagesData.images[i].id;
+
+ var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, className: 'linImgMapThumb', width: displayThumbSize, height: displayThumbSize});
+ var ElemA = Builder.node('a', {id: "thumb_"+thumbId, href: 'javascript:myLinMapObject.openImage(' + i + ')'});
+ var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'});
+
+ ElemA.appendChild( ElemImg );
+ ElemDiv.appendChild( ElemA );
+ $('linDivMapNav').appendChild(ElemDiv);
+
+ if( i == 0 )
+ myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], true );
+ else
+ myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i], false );
+ }
+
+ myLinMapObject.updateCenter(0);
+
+ myLinMaps.stopLoading();
+
+ },
+
+ toggleNav: function()
+ {
+
+ if( this.showNav )
+ {
+ Element.hide('linDivMapNav');
+
+ // backup current margin
+ $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight;
+
+ $('linDivMapObject').style.marginRight = '7px';
+
+ this.showNav = false;
+ }
+ else
+ {
+ // restore saved margin
+ $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight;
+ $('linDivMapNav').style.marginRight = 0;
+
+ Element.show('linDivMapNav');
+
+ this.showNav = true;
+ }
+
+ // update google map size
+ myLinMapObject.checkResize();
+ },
+
+
+
+ startLoading: function() {
+ Element.show('linDivLoadingOuter');
+ },
+ stopLoading: function() {
+ Element.hide('linDivLoadingOuter');
+ }
+
+
+
+
+
+
+
+
+} // end class LinMaps
+
+function linOnResizeWrapper()
+{
+ myLinGlobal.setWindowSize();
+ var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30;
+ if(newHeight < 100)
+ {
+ newHeight = 100;
+ }
+
+ $('linDivMapNav').style.height = newHeight + 'px';
+ $('linDivMapMain').style.height = newHeight + 'px';
+
+
+ /**
+ * tempoarely set the map heigth to a small value (zero does not work!)
+ * in IE setMainHeight() would not work while reducing the window size
+ * because IE takes always as much space as he actually needs ignoring
+ * the height attribute
+ */
+
+ /*$('linDivMapNav').style.height = '10px';
+ $('linDivMapMain').style.height = '10px';
+
+ myLinGlobal.setMainHeight();
+
+ $('linDivMapMain').style.height = ($('linDivMain').offsetHeight - $("linDivTop").offsetHeight - $('linDivMapBottom').offsetHeight - 5) + 'px';*/
+
+ /**
+ * set also height of the navigation bar
+ * overflow:auto does not work in IE with height: 100%
+ */
+ /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/
+
+ // resize also google map itself
+ myLinMapObject.checkResize();
+}
+
+/**
+ * initLinMaps()
+ *
+ * create the class object
+ */
+function initLinMaps()
+{
+ myLinMaps.toggleNav();
+
+ /*if( doLoadAlbums )
+ myLinMaps.loadAlbums();*/
+
+ //linEnableOnResize();
+ //linOnResizeWrapper();
+ myLinPage.enableOnResize('maps');
+
+ myLinMaps.loadMarkers();
+}
+Event.observe(window, 'load', initLinMaps, false);
+//Event.observe(body, 'load', initLinMaps, false);
+
+myLinMaps = new LinMaps();
+linMapObjectInit();
Deleted: trunk/linpha2/lib/plugins/maps/class.googlemaps.js
===================================================================
--- trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-04-27 09:35:57 UTC (rev 4930)
+++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -1,270 +0,0 @@
-
-var LinMapObject = Class.create();
-var myLinMapObject;
-
-var googlemap = false; // the main google map object
-var geocoder = false; // the main google geocoder object
-
-LinMapObject.prototype =
-{
- /**
- * initialize()
- * Constructor runs on completion of the DOM loading.
- */
- initialize: function()
- {
- this.bounds = false;
- },
-
- createMap: function()
- {
- var mapType = 'hybrid'; // 'normal', 'satellite'
- var mapLargeControl = 1;
- var mapMouseZoom = 1;
- var mapOverview = 1;
- var mapMinZoom = 1;
- var mapMaxZoom = 23;
- var mapDefaultZoom = 4;
- var mapDefaultLat = 49.9801;
- var mapDefaultLng = 10.8731;
-
- geocoder = new GClientGeocoder();
- googlemap = new google.maps.Map2(document.getElementById("linDivMapObject"));
-
- googlemap.setCenter(new google.maps.LatLng(mapDefaultLat, mapDefaultLng), mapDefaultZoom);
-
- switch(mapType) {
- case 'normal':
- googlemap.setMapType(G_NORMAL_MAP);
- break;
- case 'satellite':
- googlemap.setMapType(G_SATELLITE_MAP);
- break;
- case 'hybrid':
- googlemap.setMapType(G_HYBRID_MAP);
- break;
- }
-
-
- if(mapMouseZoom) {
- googlemap.enableScrollWheelZoom();
- var mapdiv = document.getElementById("linDivMapObject");
- GEvent.addDomListener(mapdiv, "DOMMouseScroll", linMapWheelevent);
- mapdiv.onmousewheel = linMapWheelevent;
- }
- if(mapOverview) {
- googlemap.addControl(new GOverviewMapControl());
- }
-
- if(mapLargeControl) {
- googlemap.addControl(new GLargeMapControl());
- } else {
- googlemap.addControl(new GSmallMapControl());
- }
-
- googlemap.addControl(new GMapTypeControl());
-
- var mycontrol = new GMapTypeControl();
- googlemap.addControl(mycontrol);
- new GKeyboardHandler(googlemap);
- googlemap.enableDoubleClickZoom();
- googlemap.enableContinuousZoom();
-
-
- // prevent memory leaks in internet explorer
- Event.observe(window, 'unload', GUnload, false);
- GEvent.addListener(googlemap, "zoomend", myLinMaps.updateEditMarker);
- },
-
- initBounds: function()
- {
- this.bounds = new GLatLngBounds();
- },
- updateCenter: function( zoom )
- {
- if( zoom == 0 ) {
- zoom = googlemap.getBoundsZoomLevel(this.bounds);
- }
-
- googlemap.setCenter(this.bounds.getCenter(), zoom);
- },
-
- createMarker: function( markerNode, markerType, openMarker )
- {
- /*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}*/
-
- /**
- *
- http://www.google.com/intl/de_ALL/mapfiles/marker.png
- http://www.google.com/intl/de_ALL/mapfiles/shadow50.png
-
- http://maps.google.com/mapfiles/ms/micons/red.png
- http://maps.google.com/mapfiles/ms/micons/blue.png
- http://maps.google.com/mapfiles/ms/micons/green.png
- http://maps.google.com/mapfiles/ms/micons/lightblue.png
- http://maps.google.com/mapfiles/ms/micons/yellow.png
- http://maps.google.com/mapfiles/ms/micons/purple.png
- http://maps.google.com/mapfiles/ms/micons/pink.png
-
- http://maps.google.com/mapfiles/ms/micons/red-dot.png
- http://maps.google.com/mapfiles/ms/micons/blue-dot.png
- http://maps.google.com/mapfiles/ms/micons/green-dot.png
- http://maps.google.com/mapfiles/ms/micons/ltblue-dot.png
- http://maps.google.com/mapfiles/ms/micons/yellow-dot.png
- http://maps.google.com/mapfiles/ms/micons/purple-dot.png
- http://maps.google.com/mapfiles/ms/micons/pink-dot.png
-
- http://maps.google.com/mapfiles/ms/micons/pushpin_shadow.png
- http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/red-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/grn-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/ltblu-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/ylw-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/purple-pushpin.png
- http://maps.google.com/mapfiles/ms/micons/pink-pushpin.png
- *
- */
-
- //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon);
-
- var point = new GLatLng( markerNode.lat, markerNode.lon);
-
- switch(markerNode.type) {
- case 'album':
- var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")
- break;
- case 'marker':
- var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/purple-dot.png")
- break;
- case 'albumWithImg':
- var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/green-dot.png")
- break;
- case 'images':
- var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png")
- break;
- default:
- var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")
- break;
- }
- icon.iconSize = new GSize(32, 32);
- var marker = new GMarker(point, icon);
-
- GEvent.addListener(marker, "click", function() {
- marker.openInfoWindowHtml( linGetMarkerHtml(markerNode) );
- });
-
- googlemap.addOverlay( marker );
-
- this.bounds.extend(point);
-
- if( openMarker ) {
- GEvent.trigger(marker, 'click');
- }
-
- return marker;
- },
-
- createEditMarker: function( center )
- {
- myLinMaps.editMarker = new GMarker(center, {draggable: true});
-
- var inputForm = document.createElement("form");
- inputForm.setAttribute("action","");
- inputForm.setAttribute("method","POST");
- inputForm.setAttribute("id","linFormEditMarker");
- inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;};
- inputForm.innerHTML = $('linDivEditMarker').innerHTML;
-
- myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked.
-
- GEvent.addListener(myLinMaps.editMarker, "drag", function() {
- myLinMaps.updateEditMarker();
- });
-
- /*GEvent.addListener(marker, "dragstart", function() {
- map.closeInfoWindow();
- });*/
-
- GEvent.addListener(myLinMaps.editMarker, "dragend", function() {
- GEvent.trigger(myLinMaps.editMarker, 'click');
- });
-
- googlemap.addOverlay( myLinMaps.editMarker );
- GEvent.trigger(myLinMaps.editMarker, 'click');
- myLinMaps.updateEditMarker();
- },
-
- closeMarkerWindows: function() {
- googlemap.closeInfoWindow();
- },
-
- removeMarker: function( marker)
- {
- googlemap.removeOverlay( marker );
- },
-
- openImage: function(imgIndex)
- {
- GEvent.trigger(myLinMaps.imagesObj[imgIndex], 'click');
- },
-
- checkResize: function()
- {
- //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize );
- if( typeof googlemap.checkResize != "undefined" ) {
- googlemap.checkResize();
- }
- },
-
- geocodeAddress: function(address)
- {
- if( myLinMaps.editMarker )
- {
- googlemap.removeOverlay( myLinMaps.editMarker );
- }
-
- if( address == '' )
- {
- this.createEditMarker( googlemap.getCenter() );
- }
- else
- {
- geocoder.getLatLng(
- address,
- function(point)
- {
- if(!point) {
- alert(address + " not found");
- } else {
- googlemap.setCenter(point, myLinMaps.defaultMarkerZoom);
- myLinMapObject.createEditMarker( point );
- $('linInputMarkerName').value = address;
- }
- }
- );
- }
- }
-}
-
-
-function linMapWheelevent(e)
-{
- if (!e) e = window.event;
- if (e.preventDefault) e.preventDefault();
- e.returnValue = false;
-}
-
-function linMapObjectInit()
-{
- myLinMapObject = new LinMapObject();
-
- google.load("maps", "2.x");
- google.setOnLoadCallback(myLinMapObject.createMap);
-}
Copied: trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js (from rev 4923, trunk/linpha2/lib/plugins/maps/class.googlemaps.js)
===================================================================
--- trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js (rev 0)
+++ trunk/linpha2/lib/plugins/maps/class.googlemaps_old.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -0,0 +1,270 @@
+
+var LinMapObject = Class.create();
+var myLinMapObject;
+
+var googlemap = false; // the main google map object
+var geocoder = false; // the main google geocoder object
+
+LinMapObject.prototype =
+{
+ /**
+ * initialize()
+ * Constructor runs on completion of the DOM loading.
+ */
+ initialize: function()
+ {
+ this.bounds = false;
+ },
+
+ createMap: function()
+ {
+ var mapType = 'hybrid'; // 'normal', 'satellite'
+ var mapLargeControl = 1;
+ var mapMouseZoom = 1;
+ var mapOverview = 1;
+ var mapMinZoom = 1;
+ var mapMaxZoom = 23;
+ var mapDefaultZoom = 4;
+ var mapDefaultLat = 49.9801;
+ var mapDefaultLng = 10.8731;
+
+ geocoder = new GClientGeocoder();
+ googlemap = new google.maps.Map2(document.getElementById("linDivMapObject"));
+
+ googlemap.setCenter(new google.maps.LatLng(mapDefaultLat, mapDefaultLng), mapDefaultZoom);
+
+ switch(mapType) {
+ case 'normal':
+ googlemap.setMapType(G_NORMAL_MAP);
+ break;
+ case 'satellite':
+ googlemap.setMapType(G_SATELLITE_MAP);
+ break;
+ case 'hybrid':
+ googlemap.setMapType(G_HYBRID_MAP);
+ break;
+ }
+
+
+ if(mapMouseZoom) {
+ googlemap.enableScrollWheelZoom();
+ var mapdiv = document.getElementById("linDivMapObject");
+ GEvent.addDomListener(mapdiv, "DOMMouseScroll", linMapWheelevent);
+ mapdiv.onmousewheel = linMapWheelevent;
+ }
+ if(mapOverview) {
+ googlemap.addControl(new GOverviewMapControl());
+ }
+
+ if(mapLargeControl) {
+ googlemap.addControl(new GLargeMapControl());
+ } else {
+ googlemap.addControl(new GSmallMapControl());
+ }
+
+ googlemap.addControl(new GMapTypeControl());
+
+ var mycontrol = new GMapTypeControl();
+ googlemap.addControl(mycontrol);
+ new GKeyboardHandler(googlemap);
+ googlemap.enableDoubleClickZoom();
+ googlemap.enableContinuousZoom();
+
+
+ // prevent memory leaks in internet explorer
+ Event.observe(window, 'unload', GUnload, false);
+ GEvent.addListener(googlemap, "zoomend", myLinMaps.updateEditMarker);
+ },
+
+ initBounds: function()
+ {
+ this.bounds = new GLatLngBounds();
+ },
+ updateCenter: function( zoom )
+ {
+ if( zoom == 0 ) {
+ zoom = googlemap.getBoundsZoomLevel(this.bounds);
+ }
+
+ googlemap.setCenter(this.bounds.getCenter(), zoom);
+ },
+
+ createMarker: function( markerNode, markerType, openMarker )
+ {
+ /*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}*/
+
+ /**
+ *
+ http://www.google.com/intl/de_ALL/mapfiles/marker.png
+ http://www.google.com/intl/de_ALL/mapfiles/shadow50.png
+
+ http://maps.google.com/mapfiles/ms/micons/red.png
+ http://maps.google.com/mapfiles/ms/micons/blue.png
+ http://maps.google.com/mapfiles/ms/micons/green.png
+ http://maps.google.com/mapfiles/ms/micons/lightblue.png
+ http://maps.google.com/mapfiles/ms/micons/yellow.png
+ http://maps.google.com/mapfiles/ms/micons/purple.png
+ http://maps.google.com/mapfiles/ms/micons/pink.png
+
+ http://maps.google.com/mapfiles/ms/micons/red-dot.png
+ http://maps.google.com/mapfiles/ms/micons/blue-dot.png
+ http://maps.google.com/mapfiles/ms/micons/green-dot.png
+ http://maps.google.com/mapfiles/ms/micons/ltblue-dot.png
+ http://maps.google.com/mapfiles/ms/micons/yellow-dot.png
+ http://maps.google.com/mapfiles/ms/micons/purple-dot.png
+ http://maps.google.com/mapfiles/ms/micons/pink-dot.png
+
+ http://maps.google.com/mapfiles/ms/micons/pushpin_shadow.png
+ http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/red-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/grn-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/ltblu-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/ylw-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/purple-pushpin.png
+ http://maps.google.com/mapfiles/ms/micons/pink-pushpin.png
+ *
+ */
+
+ //alert( markerNode.id + ' ' + markerNode.name + ' ' + markerNode.lat + ' ' + markerNode.lon);
+
+ var point = new GLatLng( markerNode.lat, markerNode.lon);
+
+ switch(markerNode.type) {
+ case 'album':
+ var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")
+ break;
+ case 'marker':
+ var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/purple-dot.png")
+ break;
+ case 'albumWithImg':
+ var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/green-dot.png")
+ break;
+ case 'images':
+ var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/yellow-dot.png")
+ break;
+ default:
+ var icon = new GIcon(G_DEFAULT_ICON, "http://maps.google.com/mapfiles/ms/micons/blue-dot.png")
+ break;
+ }
+ icon.iconSize = new GSize(32, 32);
+ var marker = new GMarker(point, icon);
+
+ GEvent.addListener(marker, "click", function() {
+ marker.openInfoWindowHtml( linGetMarkerHtml(markerNode) );
+ });
+
+ googlemap.addOverlay( marker );
+
+ this.bounds.extend(point);
+
+ if( openMarker ) {
+ GEvent.trigger(marker, 'click');
+ }
+
+ return marker;
+ },
+
+ createEditMarker: function( center )
+ {
+ myLinMaps.editMarker = new GMarker(center, {draggable: true});
+
+ var inputForm = document.createElement("form");
+ inputForm.setAttribute("action","");
+ inputForm.setAttribute("method","POST");
+ inputForm.setAttribute("id","linFormEditMarker");
+ inputForm.onsubmit = function() {myLinGlobal.AjaxPost(myLinMaps.ajaxUrl, Form.serialize(this),myLinMaps.saveMarker); return false;};
+ inputForm.innerHTML = $('linDivEditMarker').innerHTML;
+
+ myLinMaps.editMarker.bindInfoWindow( inputForm ); // The marker.bindInfoWindow*() methods create GEvent listeners that perform the corresponding marker.openInfoWindow*() calls when the marker is clicked.
+
+ GEvent.addListener(myLinMaps.editMarker, "drag", function() {
+ myLinMaps.updateEditMarker();
+ });
+
+ /*GEvent.addListener(marker, "dragstart", function() {
+ map.closeInfoWindow();
+ });*/
+
+ GEvent.addListener(myLinMaps.editMarker, "dragend", function() {
+ GEvent.trigger(myLinMaps.editMarker, 'click');
+ });
+
+ googlemap.addOverlay( myLinMaps.editMarker );
+ GEvent.trigger(myLinMaps.editMarker, 'click');
+ myLinMaps.updateEditMarker();
+ },
+
+ closeMarkerWindows: function() {
+ googlemap.closeInfoWindow();
+ },
+
+ removeMarker: function( marker)
+ {
+ googlemap.removeOverlay( marker );
+ },
+
+ openImage: function(imgIndex)
+ {
+ GEvent.trigger(myLinMaps.imagesObj[imgIndex], 'click');
+ },
+
+ checkResize: function()
+ {
+ //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize );
+ if( typeof googlemap.checkResize != "undefined" ) {
+ googlemap.checkResize();
+ }
+ },
+
+ geocodeAddress: function(address)
+ {
+ if( myLinMaps.editMarker )
+ {
+ googlemap.removeOverlay( myLinMaps.editMarker );
+ }
+
+ if( address == '' )
+ {
+ this.createEditMarker( googlemap.getCenter() );
+ }
+ else
+ {
+ geocoder.getLatLng(
+ address,
+ function(point)
+ {
+ if(!point) {
+ alert(address + " not found");
+ } else {
+ googlemap.setCenter(point, myLinMaps.defaultMarkerZoom);
+ myLinMapObject.createEditMarker( point );
+ $('linInputMarkerName').value = address;
+ }
+ }
+ );
+ }
+ }
+}
+
+
+function linMapWheelevent(e)
+{
+ if (!e) e = window.event;
+ if (e.preventDefault) e.preventDefault();
+ e.returnValue = false;
+}
+
+function linMapObjectInit()
+{
+ myLinMapObject = new LinMapObject();
+
+ google.load("maps", "2.x");
+ google.setOnLoadCallback(myLinMapObject.createMap);
+}
Added: trunk/linpha2/lib/plugins/maps/class.maps.php
===================================================================
--- trunk/linpha2/lib/plugins/maps/class.maps.php (rev 0)
+++ trunk/linpha2/lib/plugins/maps/class.maps.php 2008-04-27 12:37:17 UTC (rev 4931)
@@ -0,0 +1,94 @@
+<?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.
+ */
+
+/**
+ * This class holds database related methods
+ * @package Database
+ */
+
+if(!defined('LINPHA_DIR')) { exit(1); }
+
+class LinMaps
+{
+function __construct()
+{
+
+}
+
+static function getExifLatLon(&$LatLon)
+{
+ /*Array PJMT
+ (
+ [md5sum] => 084a9633ae7544e35ff1faad6cb05564
+ [gpslatituderef] => N
+ [gpslatitude] => 469762048/16777216 (28),285212672/16777216 (17),820803480/16777216 (48.9236998558) (Degrees Minutes Seconds North or South)
+ [gpslongituderef] => W
+ [gpslongitude] => 1879048192/134217728 (14),1207959552/134217728 (9),472055494/16777216 (28.1367000341) (Degrees Minutes Seconds East or West)
+ )
+ /*Array Exiftool
+ (
+ [md5sum] => 084a9633ae7544e35ff1faad6cb05564
+ [gpslatituderef] => North
+ [gpslatitude] => 46.9762048
+ [gpslongituderef] => West
+ [gpslongitude] => 18.79048192
+ )*/
+
+ /**
+ * Exiftool saves lat and lon as float
+ */
+ /*if($GLOBALS['linpha']->sql->config->value['sys_import_use_exiftool']
+ && $GLOBALS['linpha']->sql->config->value['sys_import_exiftool_avail'])*/
+ if (strpos($LatLon['gpslatitude'], '(') === false) // do this check dynamically to be able to turn on/off exiftool without re-indexing all images
+ {
+ foreach(array('gpslatitude','gpslongitude') as $value)
+ {
+ if( $LatLon[$value.'ref'] == 'South' OR $LatLon[$value.'ref'] == 'West' )
+ {
+ $return[ $value ] = $LatLon[$value]*-1;
+ }
+ else
+ {
+ $return[$value] = $LatLon[$value];
+ }
+ }
+ }
+ else
+ {
+ foreach(array('gpslatitude','gpslongitude') as $value)
+ {
+ error_log("USING PJMT",'','0');
+ $arrHits = array();
+
+ // use '?' to be �non-greedy� (http://de.wikipedia.org/wiki/Regul%C3%A4rer_Ausdruck#Gieriges_Verhalten)
+ preg_match_all('/\((.*?)\)/', $LatLon[ $value ], $arrHits);
+
+ $return[ $value ] = $arrHits[1][0] + ($arrHits[1][1] * 1/60) + ($arrHits[1][2] * 1/60 * 1/60);
+ if( $LatLon[ $value.'ref'] == 'S' OR $LatLon[ $value.'ref'] == 'W' )
+ {
+ $return[ $value ] *= -1;
+ }
+ }
+ }
+ return $return;
+}
+
+}
+?>
\ No newline at end of file
Added: trunk/linpha2/lib/plugins/maps/greversegeocoder.js
===================================================================
--- trunk/linpha2/lib/plugins/maps/greversegeocoder.js (rev 0)
+++ trunk/linpha2/lib/plugins/maps/greversegeocoder.js 2008-04-27 12:37:17 UTC (rev 4931)
@@ -0,0 +1,398 @@
+/*
+ Copyright 2007-2008 Nico Goeminne (nic...@gm...)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+/*
+ * Class GReverseGeocoder v1.0.6
+ *
+ * This class is used to obtain reverse geocodes (addresses) for user specified points.
+ * It does not use any caching mechanisme and is limited to 10 000 request per day.
+ * It uses both GDirections as GClientGeocoder. The default country is set to "Belguim".
+ * The country could be set using the GReverseGeocoder.setBaseCountrybefore method
+ * before any reverse geocoding is attempted.
+ *
+ * All data is obtained by use of the Google Maps API only!
+ * Therefore Reverse Geocoding is only supported for those countries in which Google Maps
+ * supports Geocoding (GClientGeocoder) and Driving Directions (GDirections).
+ * As a result only street level results are returned. (No house numbers)
+ */
+
+ /* Change Log 5/01/08
+ *
+ * - Changed getStreet() function
+ * Now numbered roads are parsed correctly
+ * - Added the getPlacemarkProperty(placemark,propertyname) function
+ * The helper function is useful to investigate the resulting placemark.
+ * Since the placemark structure depends on the used data provider, the structure
+ * and property names may be different. This method searches the placemark for a certain
+ * property name. For example, if one needs the postal code:
+ *
+ * GEvent.addListener(reversegeocoder, "load",
+ * function(placemark) {
+ * var postalcodenumber = reversegeocoder.getPlacemarkProperty(placemark,"PostalCodeNumber");
+ * if (postalcodenumber != null) alert("Postal Code Number: " + postalcodenumber);
+ * else alert("Postal Code Number Unknown");
+ * }
+ * );
+ *
+ */
+
+ /* Change Log 18/11/07
+ *
+ * - Removed setBaseCountry() function
+ * The user of the script doesn't have to set the country anymore,
+ * instead the geocoder is provided by a bounding box (works in the 2.x api - fixed by google)
+ * - Reported lng bug to google
+ */
+
+
+/*
+ * Creates a new instance of a reversegeocoder.
+ * Note that the reverseGeocode() method initiates a new query,
+ * which in turn triggers a "load" event once the query has finished loading.
+ *
+ * Additionally, the object contains thwo event listeners which you can intercept:
+ * "load": This event is triggered when the results of a reverse geocode query issued via
+ * GReverseGeocoder.reverseGeocode() are available. Note that the reverseGeocode() method
+ * initiates a new query, which in turn triggers a "load" event once the query has finished
+ * loading.
+ * "error": This event is triggered if a reverse geocode request results in an error.
+ * Callers can use GReverseGeocoder.getStatus() to get more information about the error.
+ * In GReverseGeocoder v1.0 the getStatus() method proxies the GDirections.getStatus() behavior.
+ */
+function GReverseGeocoder(map) {
+ // we don't actually need the map variable but to be sure the Google Map API
+ // is loaded
+ this.map=map;
+ this.gdirections = new GDirections();
+ this.geocoder = new GClientGeocoder();
+ this.lastpoint=null;
+ this.closestonroad=null;
+ this.experimental=false;
+ this.ad="";
+ this.step=10;
+ this.start=1;
+ this.gdirectionsrefine = new GDirections();
+ GEvent.bind(this.gdirections, "error", this, this.handleError);
+ GEvent.bind(this.gdirections, "load", this, this.processDirection);
+ GEvent.bind(this.gdirectionsrefine, "error", this, this.handleError);
+ GEvent.bind(this.gdirectionsrefine, "load", this, this.processDirectionRefine);
+}
+
+/*
+ * This method issues a new reverse geocode query.
+ * The parameter is a GLatLng point.
+ * If successful the Placemark object is passed to the user-specified
+ * listener.
+ *
+ * E.g. var listener = GEvent.addListener(reversegeocoder,"load",
+ * function(placemark){
+ * alert("The reverse geocoded address is " + placemark.address);
+ * }
+ * );
+ */
+GReverseGeocoder.prototype.reverseGeocode = function(point){
+ this.lastpoint = point;
+ this.closestonroad = null;
+ this.gdirections.clear();
+ this.gdirections.loadFromWaypoints([point.toUrlValue(6),point.toUrlValue(6)],{getSteps: true, locale: "GB", getPolyline:true});
+}
+
+/*
+ * Returns the status of the reverse geocode request.
+ * In GReverseGeocoder v1.0 the getStatus() method proxies the GDirections.getStatus() behavior.
+ * The returned object has the following form: { code: 200 request: "directions" }
+ * The status code can take any of the values defined in GGeoStatusCode. (Since Google Map API 2.81)
+ */
+GReverseGeocoder.prototype.getStatus = function(){
+ return this.gdirections.getStatus();
+}
+
+
+/*
+ * Private implementation methods
+ */
+
+/*
+ * This method is called when a GDirection error occurs,
+ * or if the GReverseGeocoder does not find an address.
+ */
+GReverseGeocoder.prototype.handleError = function() {
+ GEvent.trigger(this, "error");
+}
+
+/*
+ * This method first gets the closest street using GDirections,
+ * then tries to find addresses by combinating that street
+ * with the supplied country using the GClientGeocoder.
+ * This can result in multiple addresses and is filtered
+ * by the GReverseGeocoder.getBestMatchingPlacemark() method.
+ */
+GReverseGeocoder.prototype.processDirection = function() {
+ var source = this;
+ // snap to road
+ if ( this.gdirections.getPolyline() != null){
+ this.closestonroad=this.gdirections.getPolyline().getVertex(0);;
+ }
+
+ var nrroutes = this.gdirections.getNumRoutes();
+ if (nrroutes != 0) {
+ var route = this.gdirections.getRoute(0);
+ var nrsteps = route.getNumSteps();
+ if (nrsteps != 0) {
+ var step = route.getStep(0);
+ var street = step.getDescriptionHtml();
+ /* v102 */
+ street = this.getStreet(street);
+ var sw = new GLatLng(Number(this.lastpoint.lat()) - 0.01, Number(this.lastpoint.lng()) - 0.01);
+ var ne = new GLatLng(Number(this.lastpoint.lat()) + 0.01, Number(this.lastpoint.lng()) + 0.01);
+ var bounds = new GLatLngBounds(sw, ne);
+ this.geocoder.setViewport(bounds);
+ /* end change */
+ this.geocoder.getLocations(street,
+ function(response) {
+ var placemark = source.getBestMatchingPlacemark(response);
+ if (placemark != null) {
+ if(source.experimental) {
+ source.ad = placemark.address;
+ source.step=10;
+ source.start=1;
+ source.houseNumberSearch();
+ }
+ else {
+ GEvent.trigger(source, "load", placemark);
+ }
+ }
+ else{
+ source.handleError();
+ }
+ }
+ );
+ }
+ }
+}
+
+/*
+ * Finds the closest address towards the original point
+ * form the resultset obtained by the GClientGeocoder request.
+ * In GReverseGeocoder v1.0 an address is considered only if
+ * it is...
[truncated message content] |