[Linpha-cvs] SF.net SVN: linpha: [4775] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2007-10-28 20:36:22
|
Revision: 4775 http://linpha.svn.sourceforge.net/linpha/?rev=4775&view=rev Author: fangehrn Date: 2007-10-28 13:36:19 -0700 (Sun, 28 Oct 2007) Log Message: ----------- some parts of linpha are maybe broken for the moment... 2007-10-08 flo * fixed bug in admin meta define exif (javascript error) * maps plugin - removed gmapper classes, using now own classes (its much easier) - splitted map functions -> it's now possible to add easily other map providers - added loadAlbums, loadImages, assignAlbum functions (AJAX) Modified Paths: -------------- trunk/linpha2/ChangeLog trunk/linpha2/admin/metadata_define.php trunk/linpha2/docs/dev/TODO.txt trunk/linpha2/docs/dev/important stuff.txt trunk/linpha2/install/sql/sql.data.php trunk/linpha2/lib/classes/linpha.class.php trunk/linpha2/lib/classes/linpha.template.class.php trunk/linpha2/lib/js/LinGlobal.js trunk/linpha2/lib/js/LinImage.js trunk/linpha2/lib/plugins/maps/LinMaps.js trunk/linpha2/lib/plugins/maps/module.exampleMap.php trunk/linpha2/templates/default/map.head.php trunk/linpha2/templates/default/view_img.html.php Added Paths: ----------- trunk/linpha2/lib/plugins/maps/class.googlemaps.js trunk/linpha2/lib/plugins/maps/class.maps.php trunk/linpha2/templates/default/maps.html.php trunk/linpha2/templates/default/themes/default/css/maps.css Property Changed: ---------------- trunk/linpha2/ Property changes on: trunk/linpha2 ___________________________________________________________________ Name: svn:ignore - .project project.index + .project project.index .cache .settings Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/ChangeLog 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,3 +1,4 @@ + 2007-10-09 bzrudi * Make Exiftool work with MAC OS!? ;-) * Add new Option to Installer 'Install Location' from where you choose @@ -7,6 +8,14 @@ on public servers by default. Config entry for this 'sys_public_installation' isn't used anywhere for now +2007-10-08 flo + * fixed bug in admin meta define exif (javascript error) + * maps plugin + - removed gmapper classes, using now own classes (its much easier) + - splitted map functions + -> it's now possible to add easily other map providers + - added loadAlbums, loadImages, assignAlbum functions (AJAX) + 2007-09-01 flo * worked some more on the maps plugin - save and load markers is now working Modified: trunk/linpha2/admin/metadata_define.php =================================================================== --- trunk/linpha2/admin/metadata_define.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/admin/metadata_define.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -431,6 +431,10 @@ { obj_from.selectedIndex = obj_from.selectedIndex - 1; } + else if( old_index > obj_from.length -1 ) + { + obj_from.selectedIndex = obj_from.length -1; + } else { obj_from.selectedIndex = old_index; Modified: trunk/linpha2/docs/dev/TODO.txt =================================================================== --- trunk/linpha2/docs/dev/TODO.txt 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/docs/dev/TODO.txt 2007-10-28 20:36:19 UTC (rev 4775) @@ -15,14 +15,6 @@ - escape exif data (see Common Tasks UTF8) - optimize DB querys (index) -- how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? - i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file - and use it this way: echo i18n( LIN_STR_SUBMIT ); - or use: - define('LIN_STR_SUBMIT', i18n("Submit") ); - echo LIN_STR_SUBMIT; - ? - - if GDLib is not installed, the rounded corner stuff does not work -> create for each installed theme and/or example in the admin page rounded corners by hand and save them to /lib/graphics -> in roundedcorners.php add a check if function_exists 'imagejpeg' and if not, take them from /lib/graphics @@ -41,6 +33,21 @@ ## Big Todos +- Switch to strict mode + - we should changed html type to strict mode: + old: + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> + <html> + + new: + <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + + the xmlns:v="urn:schemas-microsoft-com:vml" is required for google maps + + - but then we need to adapt the linpha styles because some stuff will not work anymore + - Common Tasks - Switch to UTF8 as default - Use Effekts is sometimes hardcoded, make use of config @@ -78,6 +85,15 @@ DONE ==== +- how to handle common language strings like "Successfully updated data.", "Submit", "Access denied", "Check file permissions" ?? + i suggest using define('LIN_STR_SUBMIT', "Submit"); in the language file + and use it this way: echo i18n( LIN_STR_SUBMIT ); + or use: + define('LIN_STR_SUBMIT', i18n("Submit") ); + echo LIN_STR_SUBMIT; + ? + implemented in linpha.class.php + - Videos - Video thumbnail (what about ffmpeg?) - switch between quicktime and mplayer? Modified: trunk/linpha2/docs/dev/important stuff.txt =================================================================== --- trunk/linpha2/docs/dev/important stuff.txt 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/docs/dev/important stuff.txt 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,4 +1,27 @@ +- adodb eof + $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM meta_fields WHERE flags = '7'"); + if( ! $query->EOF ) -> on or more results + if( $query->EOF ) -> no results + +- trycatch + try + { + if(!isset( $_GET['id'] ) ) + { + throw new Exception("no id supplied!"); + } + } + catch(Exception $error) + { + echo "Error: ".$error -> getMessage(); + } + +- $GLOBALS['linpha']->sql->config->value['sys_'] + +- if possible, use common strings: LIN_STR_SUBMIT, LIN_STR_ACCESSDENIED, LIN_STR_SUCCUPDATEDDATA, LIN_STR_CHKFILEPERM + + exec(): - if we use exec($str, $array_output=array(), $return_value=''); it will always return empty $array_output and $return_value @@ -14,9 +37,6 @@ - if you need to get all outputs you have to append 2>&1 under windows you cannot override stdout, but it does not produce an error - - - - filesize($tmp_file) may return zero if clearstatcache() is not executed! clearstatcache(); @@ -26,23 +46,3 @@ - is_writable() does not work correctly under windows, it returns just the readonly attribute see http://bugs.php.net/bug.php?id=27609 for details see http://ch2.php.net/is_writable for alternative implementations - -- adodb eof - $query = $GLOBALS['linpha']->db->Execute("SELECT id FROM meta_fields WHERE flags = '7'"); - if( ! $query->EOF ) -> on or more results - if( $query->EOF ) -> no results - -- trycatch - try - { - if(!isset( $_GET['id'] ) ) - { - throw new Exception("no id supplied!"); - } - } - catch(Exception $error) - { - echo "Error: ".$error -> getMessage(); - } - -- $GLOBALS['linpha']->sql->config->value['sys_'] \ No newline at end of file Modified: trunk/linpha2/install/sql/sql.data.php =================================================================== --- trunk/linpha2/install/sql/sql.data.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/install/sql/sql.data.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -110,6 +110,9 @@ 'plugins_filemanager_nruploads' => '5', 'plugins_maps_defaultMarkerZoom' => '10', + 'plugins_maps_mapType' => 'google', + 'plugins_maps_google_key' => 'ABQIAAAAAXCMfho4_sqSSh0VqMB80xT2yXp_ZAY8_ufC3CFXhHIE1NvwkxSfO_6bbb_ScfT_zPgcnJMKyGltOg', // key for http://localhost + ); $options_user_overrideable = Array( @@ -188,7 +191,10 @@ "VALUES ('stats', '')"; $sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . "VALUES ('download', '')"; +$sql_queries[] = "INSERT INTO ".LIN_PREFIX."permissions (perm_type, permission) " . + "VALUES ('plugins_maps_setMarkers', '')"; + /** * MetaData * see http://linpha.sourceforge.net/wiki/index.php/Tables_linpha_meta_fields for the definition Modified: trunk/linpha2/lib/classes/linpha.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.class.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/classes/linpha.class.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -104,4 +104,23 @@ } // end class Linpha + +/** + * handle common language strings + * prefer + * define('LIN_STR_SUBMIT', i18n("Submit") ); + * echo LIN_STR_SUBMIT; + * + * instead of + * define('LIN_STR_SUBMIT', "Submit"); + * echo i18n(LIN_STR_SUBMIT); + * + * to keep the update language file routine working + */ +define('LIN_STR_SUBMIT', i18n("Submit") ); +define('LIN_STR_ACCESSDENIED', i18n("Error: Access denied") ); +define('LIN_STR_SUCCUPDATEDDATA', i18n("Successfully updated data") ); +define('LIN_STR_CHKFILEPERM', i18n("Check file permissions") ); + + ?> \ No newline at end of file Modified: trunk/linpha2/lib/classes/linpha.template.class.php =================================================================== --- trunk/linpha2/lib/classes/linpha.template.class.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/classes/linpha.template.class.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -159,8 +159,8 @@ </style> <![endif]--> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/prototype.js"></script> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/LinGlobal.js"></script> <script type="text/javascript" language="JavaScript"> var LINPHA_LINK = '<?php echo LINPHA_LINK; ?>'; var LINPHA_CLIENT = '<?php echo LINPHA_CLIENT; ?>'; @@ -168,10 +168,12 @@ var startIdCurrent = <?php echo $this->idCurrent; ?>; var IdCurrent = startIdCurrent; <?php -if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) -{ - echo "myLinGlobal.checkAjaxCompatibility();"."\n"; -} +if(! isset($_SESSION['use_js']) && ! isset($_SESSION['disable_ajax'])) { + //echo "var checkAjaxCompatibility = true;"."\n"; + echo "myLinGlobal.checkAjaxCompatibility();"."\n"; +} /*else { + echo "var checkAjaxCompatibility = false;"."\n"; +}*/ ?> </script> Modified: trunk/linpha2/lib/js/LinGlobal.js =================================================================== --- trunk/linpha2/lib/js/LinGlobal.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/js/LinGlobal.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -19,6 +19,8 @@ this.linInnerHeight = 0; this.linPageXOffset = 0; this.linPageYOffset = 0; + + this.tabs = new Array(); }, /** @@ -195,6 +197,40 @@ txt += "URL: " + url + "\n"; txt += "Line: " + line; alert(txt); + }, + + /** + * menu tab functions + */ + openTab: function( className, tabNr ) { + divElems = document.getElementsByTagName('div'); + for(i = 0, n = 0; i < divElems.length; i++) + { + if( divElems[i].className == className ) + { + if(n == tabNr && + typeof this.tabs[ className ]!='undefined' && + typeof this.tabs[ className ][ tabNr ]!='undefined' && + this.tabs[ className ][ tabNr ]!='disabled') + { + divElems[i].style.display = ''; + } else { + divElems[i].style.display = 'none'; + } + + n++; + } + } + }, + disableTab: function( className, tabNr, elemAId ) { + this.tabs[ className ][ tabNr ] = 'disabled'; + $(elemAId).style.color = 'grey'; + }, + enableTab: function( className, tabNr, elemAId ) { + alert(className + ' ' + typeof this.tabs[ className ] + ' ' + this.tabs[ className ]); + //this.tabs[ className ][ tabNr ] = ''; + //this.tabs.className.tabNr = ''; + $(elemAId).style.color = ''; } } @@ -208,6 +244,10 @@ myLinGlobal = new LinGlobal(); Event.observe(window, 'error', myLinGlobal.fOnError, false); + + /*if( checkAjaxCompatibility ) { + myLinGlobal.checkAjaxCompatibility(); + }*/ } //Event.observe(window, 'load', initLinGlobal, false); Modified: trunk/linpha2/lib/js/LinImage.js =================================================================== --- trunk/linpha2/lib/js/LinImage.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/js/LinImage.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -14,8 +14,8 @@ */ initialize: function() { - this.imgInfoColorNotActive = $('linDivInfoLink').style.color; - this.imgInfoColorActive = $('linHrefInfoLink').style.color; + /*this.imgInfoColorNotActive = $('linDivInfoLink').style.color; + this.imgInfoColorActive = $('linHrefInfoLink').style.color;*/ this.imgInfoShowHide = 'hide'; @@ -37,11 +37,7 @@ this.currentFileType; // 1 = image, 2 = video, 3 = others this.curLocationHash; - this.timerResize; - - this.testarray = new Array(); - this.testarray[0] = 'test 2'; - + //this.timerResize; }, @@ -59,6 +55,7 @@ this.curLocationHash = location.hash; // update current Hash, this value is periodically checked to reload the image if neccessary + // do not load the data again if it is already cached if(this.preloadXmlFinished[imgId] && typeof this.xmlDoc[imgId] != "undefined" ) // use typeof to work in IE { this.changeImage(); @@ -213,7 +210,7 @@ /** * hide elements during transition */ - this.hideImgInfoNow(); // hide meta text immediately + this.hideImgInfoNow(); // hide text info link immediately Element.hide('linImgMainimage'); // hide mainimage while changing image to prevent flicker Element.hide('linDivInfoLink'); @@ -228,7 +225,7 @@ Element.show('linDivloading'); } - $('linImgMainimage').style.marginLeft = 0; + //$('linImgMainimage').style.marginLeft = 0; // restore left margin, set when viewing videos /** * calc image width and height @@ -262,7 +259,7 @@ break; case '2': // video - $('linImgMainimage').style.marginLeft = 200; + //$('linImgMainimage').style.marginLeft = 200; /** * show video thumbnail @@ -480,17 +477,23 @@ this.setImageInfoLink(); // show the "info" link, must be called after Appear('linImgMainimage') Element.hide('linDivVideoLink'); - Element.show('linDivExifLink'); + //Element.show('linDivExifLink'); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; + myLinGlobal.enableTab( 'linDivTab', 3, 'linAMetaExif' ); break; case '2': // video Element.show('linDivVideoLink'); - Element.hide('linDivExifLink'); + //Element.hide('linDivExifLink'); + //$('linAMetaExif').href = $('linAMetaExif').href.substring(1); + //$('linAMetaExif').href = '#' + $('linAMetaExif').href; - $('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop; + myLinGlobal.disableTab( 'linDivTab', 3, 'linAMetaExif' ); + + /*$('linDivMetaOuter').style.top = $('linImgMainimage').offsetTop; $('linDivMetaOuter').style.height = $('linImgMainimage').offsetHeight; // 'auto' - Element.show('linDivMetaOuter'); + Element.show('linDivMetaOuter');*/ break; } @@ -781,7 +784,9 @@ /** * reload image with new position and size */ - this.resizeWindow(); + //this.resizeWindow(); + //linOnResizeCreateTrigger(); + linOnResizeWrapper(); }, fullscreenStop: function() { @@ -901,6 +906,7 @@ }, /** + * DEPRECATED * showImgInfo() * * fade out the image, show the meta infos, sets the color of the "Info" link to another @@ -941,12 +947,12 @@ }, hideImgInfoNow: function() { - Element.hide('linDivMetaOuter'); + //Element.hide('linDivMetaOuter'); Element.hide('linHrefPanoLink'); Element.setOpacity('linDivMainimage',1); this.imgInfoShowHide = 'hide'; - $('linHrefInfoLink').style.color = this.imgInfoColorActive; + //$('linHrefInfoLink').style.color = this.imgInfoColorActive; }, /** @@ -1082,11 +1088,11 @@ /** * resizeWindow, use this wrapper function because internet explorer triggers the resize event to fast */ - resizeWindow: function () + /*resizeWindow: function () { clearTimeout(this.timerResize); this.timerResize = setTimeout(linImageWrapper,250); - } + }*/ } /** @@ -1095,7 +1101,7 @@ * use this wrapper function if called from setTimeout() * because 'this.' would not work otherwise */ -function linImageWrapper() +function linOnResizeWrapper() { if(myLinImage.fullscreenActive) { @@ -1123,7 +1129,6 @@ function initLinImage() { $('linDivMainimage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded - $('linImgMainimage').style.height = startImgHeight; // initial sets correct height at begin and not after the image is loaded myLinImage = new LinImage(); /** @@ -1186,7 +1191,7 @@ // setMainHeight(); // defined in LinGlobal.js // window.onresize = onWindowResize; // Event.observe(window, 'resize', onWindowResize, false); - Event.observe(window, 'resize', myLinImage.resizeWindow, false); + Event.observe(window, 'resize', linOnResizeCreateTrigger, false); } } Modified: trunk/linpha2/lib/plugins/maps/LinMaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/plugins/maps/LinMaps.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -14,12 +14,11 @@ initialize: function() { this.editMarker = false; - this.navIsHidden = false; - this.defaultMarkerZoom = linMapsDefaultZoomSize; + this.showNav = true; + this.defaultMarkerZoom = linMapsDefaultMarkerZoom; this.markersData = false; this.markersObj = false; - this.bounds = false; }, /** @@ -41,7 +40,7 @@ { for( i = 0; i < myLinMaps.markersObj.length; i++ ) { - map.removeOverlay( myLinMaps.markersObj[i] ); + myLinMapObject.removeMarker( myLinMaps.markersObj[i] ); } myLinMaps.markersObj = false; @@ -50,129 +49,120 @@ /** * draw new markers */ - myLinMaps.bounds = new GLatLngBounds(); + myLinMapObject.initBounds(); for( i = 0; i < myLinMaps.markersData.markers.length; i++ ) { - myLinMaps.markersObj[i] = myLinMaps.createMarker( myLinMaps.markersData.markers[i] ); + myLinMaps.markersObj[i] = myLinMapObject.createMarker( myLinMaps.markersData.markers[i] ); } - map.setCenter(myLinMaps.bounds.getCenter(), map.getBoundsZoomLevel(myLinMaps.bounds)); - + myLinMapObject.updateCenter(); }, - - createMarker: function( markerNode ) + + saveMarker: function(t) { - /*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}*/ + xmlAnswer = t.responseXML.documentElement; - //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 ); - }); + if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + { + myLinMapObject.removeMarker( myLinMaps.editMarker ); + + myLinMaps.editMarker = false; + myLinMaps.updateEditMarker(); - map.addOverlay( marker ); - - this.bounds.extend(point); - - return marker; + myLinMaps.loadMarkers(); + } + else + { + alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + } }, - geocodeAddress: function(address) + assignAlbum: function(albId) { - if( this.editMarker ) - { - map.removeOverlay( this.editMarker ) - } + alert( albId ); + myLinGlobal.AjaxPost('cmd=assignAlbum&albId='+albId,myLinMaps.assignAlbumFinish); + }, + assignAlbumFinsih: function(t) + { + }, + + loadAlbums: function() + { + myLinGlobal.AjaxPost('cmd=loadAlbums',myLinMaps.showAlbums); + }, + showAlbums: function(t) + { + $('linDivMapAlbums').innerHTML = ''; + albumsData = eval('(' + t.responseText + ')'); - if( address == '' ) + for( i = 0; i < albumsData.albums.length; i++ ) { - this.createEditMarker( map.getCenter() ); + $('linDivMapAlbums').innerHTML += + '<a href="javascript:myLinMaps.loadImages(' + albumsData.albums[i].id + ')">' + + albumsData.albums[i].name + '</a><br />'; } - else - { - geocoder.getLatLng( - address, - function(point) - { - if(!point) - { - alert(address + " not found"); - } - else - { - map.setCenter(point, myLinMaps.defaultMarkerZoom); - myLinMaps.createEditMarker( point ); - - $('linInputMarkerName').value = address; - } - } - ); + }, + + loadImages: function(albId) + { + if( !this.showNav ) { + this.toggleNav(); } + + myLinGlobal.AjaxPost('cmd=loadImages&albId='+albId,myLinMaps.showImages); + }, - createEditMarker: function( center ) + showImages: function(t) { - this.editMarker = new GMarker(center, {draggable: true}); + myLinMaps.imagesData = eval('(' + t.responseText + ')'); + //myLinMaps.images = t.responseText.evalJSON(true); + + /** + * draw new markers / create thumbnails list + */ + $('linDivMapNav').innerHTML = ''; + //myLinMapObject.initBounds(); - /*GEvent.addListener(marker, "dragstart", function() { - map.closeInfoWindow(); - });*/ - - /*GEvent.addListener(marker, "dragend", function() { - marker.openInfoWindowHtml("Just bouncing along..."); - });*/ + for( i = 0; i < myLinMaps.imagesData.images.length; i++ ) + { + thumbId = myLinMaps.imagesData.images[i].id; - GEvent.addListener(this.editMarker, "drag", function() { - myLinMaps.updateEditMarker(); - }); + var ElemImg = Builder.node('img', {src: thumbSrc + thumbId, width: displayThumbSize, height: displayThumbSize}); + var ElemA = Builder.node('a', {href: 'javascript:myLinMaps.openImage(' + i + ')'}); + var ElemDiv = Builder.node('div', {className: 'linDivMapsThumb'}); + + ElemA.appendChild( ElemImg ); + ElemDiv.appendChild( ElemA ); + $('linDivMapNav').appendChild(ElemDiv); + + //myLinMaps.imagesObj[i] = myLinMapObject.createMarker( myLinMaps.imagesData.images[i] ); + + } - map.addOverlay( this.editMarker ); + myLinMapObject.updateCenter(); - this.updateEditMarker(); }, - updateEditMarker: function() + + openImage: function(imgIndex) { - if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class - { - 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 = ''; - } + alert( myLinMaps.imagesData.images[imgIndex].lat + ' ' + myLinMaps.imagesData.images[imgIndex].lon); }, - saveMarker: function(t) + + getMarkerInfo: function( markerNode ) // maybe use markerId oder markerIndex (but that could be unsafe) { - xmlAnswer = t.responseXML.documentElement; + var infoStr = '<b>' + markerNode.name + '</b><br />' + markerNode.id; - if( xmlAnswer.getElementsByTagName('responseCode').item(0).firstChild.data == 'success' ) + if( markerNode.albId == 0 ) { - map.removeOverlay( myLinMaps.editMarker ); - myLinMaps.editMarker = false; - myLinMaps.updateEditMarker(); - - myLinMaps.loadMarkers(); + infoStr += "assign"; } else { - alert(xmlAnswer.getElementsByTagName('responseMsg').item(0).firstChild.data ); + infoStr += "change assigned album"; } + + return infoStr; }, @@ -182,30 +172,30 @@ toggleNav: function() { - if( this.navIsHidden ) + if( this.showNav ) { - // restore save margin - $('gmapper_map').style.marginRight = $('linDivMapNav').style.marginRight; - $('linDivMapNav').style.marginRight = 0; + Element.hide('linDivMapNav'); - Element.show('linDivMapNav'); + // backup current margin + $('linDivMapNav').style.marginRight = $('linDivMapObject').style.marginRight; + + $('linDivMapObject').style.marginRight = 7; - this.navIsHidden = false; + this.showNav = false; } else { - Element.hide('linDivMapNav'); + // restore saved margin + $('linDivMapObject').style.marginRight = $('linDivMapNav').style.marginRight; + $('linDivMapNav').style.marginRight = 0; - // backup current margin - $('linDivMapNav').style.marginRight = $('gmapper_map').style.marginRight; - - $('gmapper_map').style.marginRight = 7; + Element.show('linDivMapNav'); - this.navIsHidden = true; + this.showNav = true; } // update google map size - map.checkResize(); + myLinMapObject.checkResize(); } @@ -220,7 +210,7 @@ function linOnResizeWrapper() { myLinGlobal.setWindowSize(); - var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - 80; + var newHeight = myLinGlobal.linInnerHeight - $('linDivMain').offsetTop - $('linDivMapBottom').offsetHeight - 30; if(newHeight < 100) { newHeight = 100; @@ -251,7 +241,7 @@ /*$('linDivMapNav').style.height = $('linDivMapMain').style.height;*/ // resize google map itself also - map.checkResize(); + myLinMapObject.checkResize(); } /** @@ -261,21 +251,17 @@ */ function initLinMaps() { - myLinMaps = new LinMaps(); + myLinMaps.toggleNav(); + if( doLoadAlbums ) + myLinMaps.loadAlbums(); + linEnableOnResize(); linOnResizeWrapper(); - - GEvent.addListener(map, "zoomend", myLinMaps.updateEditMarker); - + myLinMaps.loadMarkers(); } - -//initLinMaps(); Event.observe(window, 'load', initLinMaps, false); -// prevent memory leaks in internet explorer -Event.observe(window, 'unload', GUnload, false); - - - +myLinMaps = new LinMaps(); +linMapObjectInit(); Added: trunk/linpha2/lib/plugins/maps/class.googlemaps.js =================================================================== --- trunk/linpha2/lib/plugins/maps/class.googlemaps.js (rev 0) +++ trunk/linpha2/lib/plugins/maps/class.googlemaps.js 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,213 @@ + +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()); + googlemap.setCenter(new GLatLng(mapDefaultLat,mapDefaultLng), mapDefaultZoom); + + 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); + }, + + initBounds: function() + { + this.bounds = new GLatLngBounds(); + }, + updateCenter: function() + { + googlemap.setCenter(this.bounds.getCenter(), googlemap.getBoundsZoomLevel(this.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( myLinMaps.getMarkerInfo( markerNode ) ); + }); + + googlemap.addOverlay( marker ); + + this.bounds.extend(point); + + return marker; + }, + + createEditMarker: function( center ) + { + this.editMarker = new GMarker(center, {draggable: true}); + + /*GEvent.addListener(marker, "dragstart", function() { + map.closeInfoWindow(); + });*/ + + /*GEvent.addListener(marker, "dragend", function() { + marker.openInfoWindowHtml("Just bouncing along..."); + });*/ + + GEvent.addListener(this.editMarker, "drag", function() { + myLinMapObject.updateEditMarker(); + }); + + googlemap.addOverlay( this.editMarker ); + + this.updateEditMarker(); + }, + + updateEditMarker: function() + { + if( myLinMaps.editMarker ) // marker activated, use myLinMaps. instead of this. when fired from GEvent class + { + 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 = ''; + } + }, + + removeMarker: function( marker) + { + googlemap.removeOverlay( marker ); + }, + + checkResize: function() + { + //alert("typeof googlemap.checkResize: " + typeof googlemap.checkResize ); + if( typeof googlemap.checkResize != "undefined" ) { + googlemap.checkResize(); + } + }, + + geocodeAddress: function(address) + { + if( myLinMaps.editMarker ) + { + map.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); + + ///GEvent.addListener(googlemap, "zoomend", myLinMapObject.updateEditMarker); +} 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 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,20 @@ +<?php + +class LinMaps +{ +function printHeader() +{ + +} + + function createMap() + { + } + + function addMarker() + { + + } +} + +?> \ No newline at end of file Modified: trunk/linpha2/lib/plugins/maps/module.exampleMap.php =================================================================== --- trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/lib/plugins/maps/module.exampleMap.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -24,14 +24,14 @@ */ if(!defined('LINPHA_DIR')) { exit(1); } -require_once(LINPHA_DIR."/lib/plugins/maps/gmapper1/class.gmapper.php"); -$urlFull = LINPHA_LINK.'&linCat=maps'; - +/** + * xml load/save stuff + */ if(isset($_GET['xml'])) { - if(isset($_POST['cmd'])) + if(isset($_REQUEST['cmd'])) // $_POST { - switch($_POST['cmd']) + switch($_REQUEST['cmd']) // $_POST { case 'loadMarkers': @@ -50,17 +50,11 @@ '"zoom": '.$data['markerZoom'].'},'. "\n"; } - /* - ?> - { - "markers": [ + /* ?> { "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 - */ + ] } <?php */ echo '] }' . "\n"; @@ -72,10 +66,15 @@ header('Content-type: text/xml'); echo '<?xml version="1.0" ?>'."\n"; echo '<root>'."\n"; - - if( !isset($_POST['linInputMarkerName']) OR empty($_POST['linInputMarkerName'])) + + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) { echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !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']) @@ -117,233 +116,126 @@ echo '</root>'."\n"; break; - } - } + case 'assignAlbum': - 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 /> + header('Content-type: text/xml'); + echo '<?xml version="1.0" ?>'."\n"; + echo '<root>'."\n"; - <input type="submit" value="<?php echo i18n("Save"); ?>" /> - <input type="hidden" name="cmd" value="saveMarker" /> - </form> - </div> + if( !$GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.LIN_STR_ACCESSDENIED.'</responseMsg>'."\n"; + } + elseif( !isset($_REQUEST['markerId']) OR !isset($_REQUEST['albId']) ) + { + echo '<responseCode>failed</responseCode>'."\n"; + echo '<responseMsg>'.i18n("Error: No valid data").'</responseMsg>'."\n"; + } + else + { + $markerId = intval($_REQUEST['markerId']); + $albId = intval($_REQUEST['albId']); + + $GLOBALS['linpha']->db->Execute("UPDATE ".LIN_PREFIX."plugins_maps_markers " . + "SET albId = '".LinSql::linAddslashes($albId)."' WHERE id='".LinSql::linAddslashes($markerId)."'"); + + echo '<responseCode>success</responseCode>'."\n"; + } + echo '</root>'."\n"; - <br /><br /><br /> + break; + + case 'loadAlbums': - - <?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 />'; + echo '{ "albums": [' . "\n"; - foreach($parentIds as $id=>$value) + $query = $GLOBALS['linpha']->db->Execute("SELECT DISTINCT P.parent_id " . + "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 "); + + echo '{"id": 0, "name": "'.i18n("All albums").'"},'."\n"; + + if( !$query ) { - echo '<a href="'.LINPHA_LINK.'&linCat=maps&albId='.$id.'">'; - echo implode( '/', LinSql::getFullFilenameFromId($id) ); - echo '</a><br />'; + //echo "Error: Please enable EXIF GPS fields!"; } - ?> - <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> + else + { + while($data = $query->FetchRow()) + { + echo '{"id": '.$data['parent_id'].', "name": "'. + htmlspecialchars( implode( '/', LinSql::getFullFilenameFromId($data['parent_id']) ),ENT_QUOTES).'"},'. + "\n"; + } + } - <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> + echo '] }' . "\n"; - <div> - Not assigned images:<br /> - albums/album1 (22 images)<br /> - </div> + break; + case 'loadImages': + + if( !isset($_REQUEST['albId']) ) { + break; + } + + $albId = intval($_REQUEST['albId']); + + if($albId == 0) { + $filterStr = ""; + } else { + $filterStr = "AND P.parent_id = '".$albId."'"; + } - - </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']) + $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 " . + $filterStr); + + echo '{ "images": [' . "\n"; + + if( !$query ) { - $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(); + //echo "Error: Please enable EXIF GPS fields!"; } + else + { + while($data = $query->FetchRow()) + { + $latlon = getExifLatLon($data); + + echo '{"id": '.$data['id'].', "parent_id": '.$data['parent_id'].', ' . + '"name": "'.htmlspecialchars( $data['name'] ,ENT_QUOTES).'", ' . + '"lat": '.$latlon['gpslatitude'].', "lon": '.$latlon['gpslongitude'] . + "},\n"; + } + } + + echo '] }' . "\n"; + + break; } - - $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"; - */ + exit(); } +$urlFull = LINPHA_LINK.'&linCat=maps'; - - -$linpha->template->output['default'] = ob_get_clean(); - -$linpha->template->setModuleName('default'); +$linpha->template->setModuleName('maps'); $linpha->template->overrideModule('head','map'); $linpha->template->URL_full = $urlFull; $linpha->template->URL_base = $urlFull; -$linpha->template->output['title'] = i18n("Google Maps"); +$linpha->template->output['title'] = i18n("Maps"); include_once(LINPHA_DIR.'/templates/'.$linpha->template->template_name.'/global.html.php'); Modified: trunk/linpha2/templates/default/map.head.php =================================================================== --- trunk/linpha2/templates/default/map.head.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/templates/default/map.head.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -1,8 +1,4 @@ -<?php -$linTpl->output['googleMap']->headjs(); -?> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/gmapper1/bodyjs.js"></script> -<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> +<script type="text/javascript" language="javascript" src="<?php echo LINPHA_CLIENT; ?>/lib/js/scriptaculous.js?load=effects,builder,dragdrop"></script> <script language="JavaScript" type="text/javascript"> var xmlUrl = '<?php echo linConvertAmp($linTpl->URL_base); ?>'; var imageSrc = '<?php echo LINPHA_CLIENT.'/get_image.php?linId='; ?>'; @@ -12,5 +8,39 @@ 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 +var linMapsDefaultMarkerZoom = <?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_defaultMarkerZoom']; ?>; +</script> + +<?php +if( $GLOBALS['linpha']->sql->config->value['plugins_maps_mapType'] == 'google' ) +{ + ?> + <script type="text/javascript" src="http://www.google.com/jsapi?key=<?php echo $GLOBALS['linpha']->sql->config->value['plugins_maps_google_key']; ?>"></script> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.googlemaps.js"></script> + <?php + + /** + * @todo + * google recommends using this kind of html header: + * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> + <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> + * but without strict mode we need this css stuff to get polylines also working + * http://www.google.com/apis/maps/documentation/#XHTML_and_VML + ?> + <style type="text/css"> + v\:* { + behavior:url(#default#VML); + } + </style> + <?php + */ +} +elseif( $linTpl->output['mapType'] == 'xyz' ) +{ + ?> + <script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/class.xyz.js"></script> + <?php +} +?> +<script type="text/javascript" language="JavaScript" src="<?php echo LINPHA_CLIENT; ?>/lib/plugins/maps/LinMaps.js"></script> Added: trunk/linpha2/templates/default/maps.html.php =================================================================== --- trunk/linpha2/templates/default/maps.html.php (rev 0) +++ trunk/linpha2/templates/default/maps.html.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,112 @@ + +<div id="linDivMainOuter"> + <?php echo $linTpl->divRoundCorners('top'); ?> + <div id="linDivMain"> + + +<div id="linDivMapTop"></div> + +<div id="linDivMapMain"> + <div id="linDivMapNav"></div> + <div id="linDivMapResizeBorder" ondblClick="myLinMaps.toggleNav();"></div> + <div id="linDivMapObject"></div> +</div> + +<div id="linDivMapBottom"> + <input type="text" id="linInputAddress" size="30"> + <input type="button" onclick="myLinMapObject.geocodeAddress( $('linInputAddress').value )" value="<?php echo i18n("Geocode"); ?>"> +</div> + +<div id="linDivEditMarker" style="display: none"> + <form action="<?php /* <?php echo $urlFull; ?>&xml */ + ?>" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinMaps.saveMarker); return false;"> + <label for="linInputMarkerName" class="linInputEditMarker">Marker Name: + </label><input type="text" id="linInputMarkerName" name="linInputMarkerName" size="30" /><br /> + <label for="linInputLat" class="linInputEditMarker">Lat + </label><input type="text" id="linInputLat" name="linInputLat" size="10" /><br /> + <label for="linInputLon" class="linInputEditMarker">Lon: + </label><input type="text" id="linInputLon" name="linInputLon" size="10" /><br /> + <label for="linInputZoom" class="linInputEditMarker">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> +<script type="text/javascript"> +//new Draggable('linDivEditMarker',{revert:false}); +</script> + +<?php +if( $GLOBALS['linpha']->sql->checkPermission('plugins_maps_setMarkers') ) +{ +?> + <div> + <?php echo i18n("Please select the album to show in Google Maps:"); ?> + <div id="linDivMapAlbums"></div> + </div> + <script type="text/javascript"> + var doLoadAlbums = true; + </script> + + + <div id="linDivMapListOfAllAlbums"> + <form> + <select name="linInputAlbum" style="width: 250px;"> + <?php linBuildAlbumSelect($with_all_albs_entry=false); ?> + </select><br /> + <input type="button" value="<?php echo i18n("Assign Album"); ?>" onclick="myLinMaps.assignAlbum(this.form.linInputAlbum.value)"> + </form> + </div> + + + <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> +<?php +} +else +{ +?> + <script type="text/javascript"> + var doLoadAlbums = false; + </script> +<?php +} +?> + + </div> + <?php echo $linTpl->divRoundCorners('bottom'); ?> +</div> \ No newline at end of file Added: trunk/linpha2/templates/default/themes/default/css/maps.css =================================================================== --- trunk/linpha2/templates/default/themes/default/css/maps.css (rev 0) +++ trunk/linpha2/templates/default/themes/default/css/maps.css 2007-10-28 20:36:19 UTC (rev 4775) @@ -0,0 +1,39 @@ +#linDivMapMain { + height: 675px; +} + +#linDivMapObject { + height: 100%; + margin-right: 180px; +} + +#linDivMapResizeBorder { + width: 5px; + height: 100%; + float: right; + cursor: e-resize; + background-color: grey; + border: 1px solid black; +} + +#linDivMapNav { + width: 170px; + height: 675px; + float: right; + overflow: auto; + padding-left: 2px; + padding-right: 1px; +} + + +#linDivEditMarker { + border: 1px solid black; + width: 550px; + padding: 3px; +} + +.linInputEditMarker { + display: block; + float: left; + width: 150px; +} \ No newline at end of file Modified: trunk/linpha2/templates/default/view_img.html.php =================================================================== --- trunk/linpha2/templates/default/view_img.html.php 2007-10-10 09:15:41 UTC (rev 4774) +++ trunk/linpha2/templates/default/view_img.html.php 2007-10-28 20:36:19 UTC (rev 4775) @@ -40,52 +40,74 @@ <img id="linImgMainimage" style="display: none;"> </div> - <div id="linDivMetaOuter" style="display: none;"> - <div id="linDivMeta"></div> - <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> - <div id="linDivVideoLink" class="linDivMetaLinks"> - <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> - <br /> - <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> - </div> - </div> - <div id="linDivInfoLink" style="display: none; color: grey;"> <a id="linHrefPanoLink" href="<?php echo LINPHA_LINK.'linCat=panorama&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank" style="color: black;"><?php echo i18n("Panorama"); ?></a> - <a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a> + <?php /*<a id="linHrefInfoLink" href="javascript:myLinImage.showImgInfo()" style="color: black;">Info</a>*/ ?> </div> <br /><br /> - <!-- comments --> - <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> - <!-- show add comment form --> - <div id="linDivAddComment"> - <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); return false;"> - <?php echo i18n("Add Comment"); ?>:<br /> - <div id="linDivAddCommentText"> - <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> - <a href="javascript:myLinImage.openTextarea()">(+)</a> + <div id="linDivTabs"> + <a href="javascript:myLinGlobal.openTab('linDivTab',0)">Comments</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',1)">Rating</a> | + <a href="javascript:myLinGlobal.openTab('linDivTab',2)">Info</a> | + <a id="linAMetaExif" href="javascript:myLinGlobal.openTab('linDivTab',3)">EXIF</a> + <br /><br /> + + <div class="linDivTab"> + <!-- comments --> + <?php if($GLOBALS['linpha']->sql->checkPermission('metadata_comments')) { ?> + <!-- show add comment form --> + <div id="linDivAddComment"> + <form action="" method="POST" onsubmit="myLinGlobal.AjaxPost(Form.serialize(this),myLinImage.saveComment); return false;"> + <?php echo i18n("Add Comment"); ?>:<br /> + <div id="linDivAddCommentText"> + <input type="text" id="linInputAddCommentText" class="linForms" name="inputAddCommentText" value="" tabindex="1" style="width: 300px" /> + <a href="javascript:myLinImage.openTextarea()">(+)</a> + </div> + <div id="linDivAddCommentTextarea" style="display: none;"> + <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> + </div> + + <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> + + <input type="hidden" name="cmd" value="add_comment" /> + <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> + </form> + </div> + + <br /> + <?php } /* end if checkPermission('metadata_comments') */ ?> + + <!-- show image comments --> + <div id="linDivComments"></div> + </div> + <div class="linDivTab"> + Rating + </div> + <div class="linDivTab"> + Info + <div id="linDivMeta"></div> + + <div id="linDivVideoLink" class="linDivMetaLinks"> + <a href="<?php echo LINPHA_LINK.'linCat=video&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Play Video"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a> + <br /> + <a href="<?php echo LINPHA_LINK.'linCat=download&linId='.$linTpl->idCurrent; ?>&isDownload=true" onclick="javascript:myLinImage.updateLinId(this)"><?php echo i18n("Download Video"); ?></a> + </div> + + </div> + <div class="linDivTab"> + EXIF + + <div id="linDivExifLink" class="linDivMetaLinks"><a href="<?php echo LINPHA_LINK.'linCat=metadata&linId='.$linTpl->idCurrent; ?>" onclick="javascript:myLinImage.updateLinId(this)" target="_blank"><?php echo i18n("Show All Metadata"); ?></a></div> + </div> + <script type="text/javascript"> + myLinGlobal.openTab('linDivTab',0); + </script> </div> - <div id="linDivAddCommentTextarea" style="display: none;"> - <textarea id="linInputAddCommentTextarea" class="linForms" name="inputAddCommentTextarea" tabindex="1" rows="10" style="width: 300px"></textarea> - </div> - - <?php echo i18n("Name"); ?>: <input type="text" class="linForms" name="inputAddCommentAuthor" value="" tabindex="2" size="10" style="width: 100px" maxlength="255" /> - - <input type="hidden" name="cmd" value="add_comment" /> - <input type="submit" name="submit" class="linButton" value="<?php echo i18n("Submit"); ?>" tabindex="2" /> - </form> - </div> - - <br /> - <?php } /* end if checkPermission('metadata_comments') */ ?> - - <!-- show image comments --> - <div id="linDivComments"></div> </div> <?php echo $linTpl->divRoundCorners('bottom'); ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |