1
0

Exif_GPS Version 3.

This commit is contained in:
rWatcher 2012-06-18 20:00:07 -04:00
parent d0d8a30db6
commit fd35b351f1
17 changed files with 525 additions and 178 deletions

View File

@ -36,17 +36,18 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
// Make sure the user filled out the form properly.
$form = $this->_get_admin_form();
if ($form->validate()) {
Kohana_Log::add("error",print_r($form,1));
// Save settings to Gallery's database.
module::set_var("exif_gps", "googlemap_api_key", $form->Global->google_api_key->value);
module::set_var("exif_gps", "googlemap_max_autozoom", $form->Global->max_auto_zoom_level->value);
module::set_var("exif_gps", "markercluster_gridsize", $form->markercluster->markercluster_gridsize->value);
module::set_var("exif_gps", "markercluster_maxzoom", $form->markercluster->markercluster_maxzoom->value);
module::set_var("exif_gps", "sidebar_zoom", $form->Sidebar->sidebar_default_zoom->value);
module::set_var("exif_gps", "sidebar_mapformat", $form->Sidebar->sidebar_mapformat->value);
module::set_var("exif_gps", "sidebar_maptype", $form->Sidebar->sidebar_maptype->value);
module::set_var("exif_gps", "largemap_maptype", $form->LargeMap->largemap_maptype->value);
$checkbox_album = false;
$checkbox_user = false;
$checkbox_restriction = false;
for ($i = 0; $i < count($form->Global->toolbar_map_album); $i++) {
if ($form->Global->toolbar_map_album->value[$i] == "checkbox_album") {
$checkbox_album = true;
@ -57,8 +58,14 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
$checkbox_user = true;
}
}
for ($i = 0; $i < count($form->Global->restrict_maps); $i++) {
if ($form->Global->restrict_maps->value[$i] == "checkbox_restriction") {
$checkbox_restriction = true;
}
}
module::set_var("exif_gps", "toolbar_map_album", $checkbox_album);
module::set_var("exif_gps", "toolbar_map_user", $checkbox_user);
module::set_var("exif_gps", "restrict_maps", $checkbox_restriction);
// Display a success message and redirect back to the TagsMap admin page.
message::success(t("Your settings have been saved."));
@ -81,18 +88,32 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
$gps_global_group = $form->group("Global")
->label(t("Global Settings"));
$gps_global_group->input("google_api_key")
->label(t("Google Maps API Key"))
->value(module::get_var("exif_gps", "googlemap_api_key"))
->rules("required");
->label(t("Google APIs Console key (optional):"))
->value(module::get_var("exif_gps", "googlemap_api_key"));
$gps_global_group->input("max_auto_zoom_level")
->label(t("Maximum Auto-Zoom Level:"))
->value(module::get_var("exif_gps", "googlemap_max_autozoom"));
$checkbox_user["checkbox_user"] = array(t("Show \"Map this user\" icon?"), module::get_var("exif_gps", "toolbar_map_user"));
$checkbox_album["checkbox_album"] = array(t("Show \"Map this album\" icon?"), module::get_var("exif_gps", "toolbar_map_album"));
$checkbox_restriction["checkbox_restriction"] = array(t("Restrict maps to registered users?"), module::get_var("exif_gps", "restrict_maps"));
$gps_global_group->checklist("toolbar_map_album")
->options($checkbox_album);
$gps_global_group->checklist("toolbar_map_user")
->options($checkbox_user);
$gps_global_group->checklist("restrict_maps")
->options($checkbox_restriction);
// Create a group for marker cluster settings
$gps_markercluster = $form->group("markercluster")
->label(t("Marker Cluster Settings"));
$gps_markercluster->input("markercluster_gridsize")
->label(t("Grid Size"))
->value(module::get_var("exif_gps", "markercluster_gridsize"))
->rules("required");
$gps_markercluster->input("markercluster_maxzoom")
->label(t("Max Zoom"))
->value(module::get_var("exif_gps", "markercluster_maxzoom"))
->rules("required");
// Create a group for sidebar settings
$gps_sidebar = $form->group("Sidebar")

View File

@ -18,33 +18,61 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class EXIF_GPS_Controller extends Controller {
public function item($item_id) {
// Make sure the context callback is set to album when linking to photos from map pages.
$item = ORM::factory("item", $item_id);
access::required("view", $item);
item::set_display_context_callback("Albums_Controller::get_display_context");
url::redirect($item->abs_url());
}
public function xml($query_type, $query_id) {
// Generate an xml output of the photos to be mapped.
// $query_type can be either "album" or "user", $query_id is the id# of the album or user to map.
// If the user can't view maps, don't let them view the xml.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
throw new Kohana_404_Exception();
}
$items = "";
if ($query_type == "user") {
$items = ORM::factory("item")
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->where("items.owner_id", "=", $query_id)
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->find_all();
} elseif ($query_type == "album") {
$items = ORM::factory("item", $query_id)
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->descendants();
}
$v = new View("exif_gps_coordinates_xml.html");
$v->items = $items;
header("Content-type: text/xml; charset=utf-8");
print $v;
}
public function map($map_type, $type_id) {
// Map all items in the specified album or user.
// Valid values for $map_type are "album" or "user", $type_id is either an
// album id# or a user id#.
// If the user can't view maps, throw a 404 error.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
throw new Kohana_404_Exception();
}
// Figure out what to display for the page title.
$map_title = "";
if ($map_type == "album") {
// Generate an array of all items in the current album that have exif gps
// coordinates and order by latitude (to group items w/ the same
// coordinates together).
$items = ORM::factory("item", $type_id)
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->descendants();
$curr_album = ORM::factory("item")->where("id", "=", $type_id)->find_all();
$map_title = $curr_album[0]->title;
} elseif ($map_type == "user") {
// Generate an array of all items uploaded by the current user that
// have exif gps coordinates and order by latitude (to group items
// w/ the same coordinates together).
$items = ORM::factory("item")
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->where("items.owner_id", "=", $type_id)
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->find_all();
$curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all();
$map_title = $curr_user[0]->full_name . "'s " . t("Photos");
}
@ -79,11 +107,15 @@ class EXIF_GPS_Controller extends Controller {
}
// Figure out default map type.
$int_map_type = module::get_var("exif_gps", "largemap_maptype");
if ($int_map_type == 0) $map_type = "ROADMAP";
if ($int_map_type == 1) $map_type = "SATELLITE";
if ($int_map_type == 2) $map_type = "HYBRID";
if ($int_map_type == 3) $map_type = "TERRAIN";
$template->content->map_type = $map_type;
if ($int_map_type == 0) $map_display_type = "ROADMAP";
if ($int_map_type == 1) $map_display_type = "SATELLITE";
if ($int_map_type == 2) $map_display_type = "HYBRID";
if ($int_map_type == 3) $map_display_type = "TERRAIN";
$template->content->map_type = $map_display_type;
// These are used to set up the URL to the xml file.
$template->content->query_type = $map_type;
$template->content->query_id = $type_id;
// Load in module preferences.
$template->content->items = $items;

View File

@ -26,6 +26,11 @@ class exif_gps_block_Core {
static function get($block_id, $theme) {
$block = "";
// Make sure the user can view maps before displaying any sidebars.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
return;
}
switch ($block_id) {
case "exif_gps_maps":
// Display links to a map of the current album and
@ -46,13 +51,13 @@ class exif_gps_block_Core {
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->descendants_count();
->descendants_count(1);
$user_items_count = ORM::factory("item")
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->where("items.owner_id", "=", $item->owner_id)
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->count_all();
->count_all(1);
if (($album_items_count > 0) || ($user_items_count > 0)) {
$block = new Block();
@ -130,17 +135,19 @@ class exif_gps_block_Core {
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->viewable()
->order_by("exif_coordinates.latitude", "ASC")
->descendants();
->descendants(1);
if (count($items) > 0) {
$block = new Block();
$block->css_id = "g-exif-gps-location";
$block->title = t("Location");
$block->content = new View("exif_gps_dynamic2_sidebar.html");
$block->content = new View("exif_gps_dynamic_sidebar.html");
if (module::get_var("exif_gps", "sidebar_maptype") == 0) $block->content->sidebar_map_type = "ROADMAP";
if (module::get_var("exif_gps", "sidebar_maptype") == 1) $block->content->sidebar_map_type = "SATELLITE";
if (module::get_var("exif_gps", "sidebar_maptype") == 2) $block->content->sidebar_map_type = "HYBRID";
if (module::get_var("exif_gps", "sidebar_maptype") == 3) $block->content->sidebar_map_type = "TERRAIN";
$block->content->items = $items;
$block->content->album_id = $theme->item->id;
$block->content->latitude = 0;
$block->content->longitude = 0;
$block->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
}
}

View File

@ -99,6 +99,13 @@ class exif_gps_event_Core {
}
static function photo_menu($menu, $theme) {
// Adds album and user map icons to photo pages.
// Do not display icons if the user can't view the page.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
return;
}
$album_id = "";
$item = $theme->item;
if ($item->is_album()) {
@ -139,6 +146,13 @@ class exif_gps_event_Core {
}
static function movie_menu($menu, $theme) {
// Adds album and user map icons to movie pages.
// Do not display icons if the user can't view the page.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
return;
}
$album_id = "";
$item = $theme->item;
if ($item->is_album()) {
@ -179,6 +193,13 @@ class exif_gps_event_Core {
}
static function album_menu($menu, $theme) {
// Adds album and user map icons to album pages.
// Do not display icons if the user can't view the page.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
return;
}
$album_id = "";
$item = $theme->item;
if ($item->is_album()) {
@ -217,4 +238,35 @@ class exif_gps_event_Core {
->css_id("g-exif-gps-user-link"));
}
}
static function show_user_profile($data) {
// Display a map on the user profile pages.
// Make sure the user can view maps before displaying one.
if ((module::get_var("exif_gps", "restrict_maps") == true) && (identity::active_user()->guest)) {
return;
}
// If there's nothing to map, hide the map.
$items = ORM::factory("item")
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
->where("items.owner_id", "=", $data->user->id)
->viewable()
->find_all(1);
if (count($items) == 0) {
return;
}
// Display the map block.
$v = new View("user_profile_exif_gps.html");
$int_map_type = module::get_var("exif_gps", "largemap_maptype");
if ($int_map_type == 0) $map_type = "ROADMAP";
if ($int_map_type == 1) $map_type = "SATELLITE";
if ($int_map_type == 2) $map_type = "HYBRID";
if ($int_map_type == 3) $map_type = "TERRAIN";
$v->map_type = $map_type;
$v->user_id = $data->user->id;
$v->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
$data->content[] = (object) array("title" => t("Photo Map"), "view" => $v);
}
}

View File

@ -33,6 +33,8 @@ class exif_gps_installer {
// If tagsmap is installed, copy the API key over.
if (module::is_active("tagsmap")) {
module::set_var("exif_gps", "googlemap_api_key", module::get_var("tagsmap", "googlemap_api_key"));
} else {
module::set_var("exif_gps", "googlemap_api_key", "");
}
// Set some default values.
@ -40,9 +42,15 @@ class exif_gps_installer {
module::set_var("exif_gps", "sidebar_mapformat", "1");
module::set_var("exif_gps", "sidebar_maptype", "1");
module::set_var("exif_gps", "largemap_maptype", "2");
module::set_var("exif_gps", "googlemap_max_autozoom", "");
module::set_var("exif_gps", "toolbar_map_album", "0");
module::set_var("exif_gps", "toolbar_map_user", "0");
module::set_var("exif_gps", "markercluster_gridsize", "50");
module::set_var("exif_gps", "markercluster_maxzoom", "15");
module::set_var("exif_gps", "restrict_maps", "0");
// Set the module version number.
module::set_version("exif_gps", 2);
module::set_version("exif_gps", 3);
}
static function upgrade($version) {
@ -50,6 +58,8 @@ class exif_gps_installer {
// If tagsmap is installed, copy the API key over.
if (module::is_active("tagsmap")) {
module::set_var("exif_gps", "googlemap_api_key", module::get_var("tagsmap", "googlemap_api_key"));
} else {
module::set_var("exif_gps", "googlemap_api_key", "");
}
// Set some default values.
@ -59,6 +69,12 @@ class exif_gps_installer {
module::set_var("exif_gps", "largemap_maptype", "2");
module::set_version("exif_gps", 2);
}
if ($version == 2) {
module::set_var("exif_gps", "markercluster_gridsize", "50");
module::set_var("exif_gps", "markercluster_maxzoom", "15");
module::set_var("exif_gps", "restrict_maps", "0");
module::set_version("exif_gps", 3);
}
}
static function deactivate() {

View File

@ -50,11 +50,6 @@ class exif_gps_task_Core {
$completed = $task->get("completed");
// Generate an array of the next 100 photos to check.
//$all_photos = ORM::factory("item")
// ->where("id", ">", $last_id)
// ->where("type", "=", "photo")
// ->order_by("id")
// ->find_all(100);
// Check each photo in the array to see if it already has exif gps data associated with it.
// If it doesn't, attempt to extract gps coordinates.

View File

@ -19,6 +19,7 @@
*/
class exif_gps_theme_Core {
static function head($theme) {
return $theme->css("exif_gps_menu.css");
return $theme->css("exif_gps_menu.css") .
$theme->script("markerclusterer_compiled.js");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

View File

@ -0,0 +1,21 @@
(function(){var d=null;function e(a){return function(b){this[a]=b}}function h(a){return function(){return this[a]}}var j;
function k(a,b,c){this.extend(k,google.maps.OverlayView);this.c=a;this.a=[];this.f=[];this.ca=[53,56,66,78,90];this.j=[];this.A=!1;c=c||{};this.g=c.gridSize||60;this.l=c.minimumClusterSize||2;this.J=c.maxZoom||d;this.j=c.styles||[];this.X=c.imagePath||this.Q;this.W=c.imageExtension||this.P;this.O=!0;if(c.zoomOnClick!=void 0)this.O=c.zoomOnClick;this.r=!1;if(c.averageCenter!=void 0)this.r=c.averageCenter;l(this);this.setMap(a);this.K=this.c.getZoom();var f=this;google.maps.event.addListener(this.c,
"zoom_changed",function(){var a=f.c.getZoom();if(f.K!=a)f.K=a,f.m()});google.maps.event.addListener(this.c,"idle",function(){f.i()});b&&b.length&&this.C(b,!1)}j=k.prototype;j.Q="http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m";j.P="png";j.extend=function(a,b){return function(a){for(var b in a.prototype)this.prototype[b]=a.prototype[b];return this}.apply(a,[b])};j.onAdd=function(){if(!this.A)this.A=!0,n(this)};j.draw=function(){};
function l(a){if(!a.j.length)for(var b=0,c;c=a.ca[b];b++)a.j.push({url:a.X+(b+1)+"."+a.W,height:c,width:c})}j.S=function(){for(var a=this.o(),b=new google.maps.LatLngBounds,c=0,f;f=a[c];c++)b.extend(f.getPosition());this.c.fitBounds(b)};j.z=h("j");j.o=h("a");j.V=function(){return this.a.length};j.ba=e("J");j.I=h("J");j.G=function(a,b){for(var c=0,f=a.length,g=f;g!==0;)g=parseInt(g/10,10),c++;c=Math.min(c,b);return{text:f,index:c}};j.$=e("G");j.H=h("G");
j.C=function(a,b){for(var c=0,f;f=a[c];c++)q(this,f);b||this.i()};function q(a,b){b.s=!1;b.draggable&&google.maps.event.addListener(b,"dragend",function(){b.s=!1;a.L()});a.a.push(b)}j.q=function(a,b){q(this,a);b||this.i()};function r(a,b){var c=-1;if(a.a.indexOf)c=a.a.indexOf(b);else for(var f=0,g;g=a.a[f];f++)if(g==b){c=f;break}if(c==-1)return!1;b.setMap(d);a.a.splice(c,1);return!0}j.Y=function(a,b){var c=r(this,a);return!b&&c?(this.m(),this.i(),!0):!1};
j.Z=function(a,b){for(var c=!1,f=0,g;g=a[f];f++)g=r(this,g),c=c||g;if(!b&&c)return this.m(),this.i(),!0};j.U=function(){return this.f.length};j.getMap=h("c");j.setMap=e("c");j.w=h("g");j.aa=e("g");
j.v=function(a){var b=this.getProjection(),c=new google.maps.LatLng(a.getNorthEast().lat(),a.getNorthEast().lng()),f=new google.maps.LatLng(a.getSouthWest().lat(),a.getSouthWest().lng()),c=b.fromLatLngToDivPixel(c);c.x+=this.g;c.y-=this.g;f=b.fromLatLngToDivPixel(f);f.x-=this.g;f.y+=this.g;c=b.fromDivPixelToLatLng(c);b=b.fromDivPixelToLatLng(f);a.extend(c);a.extend(b);return a};j.R=function(){this.m(!0);this.a=[]};
j.m=function(a){for(var b=0,c;c=this.f[b];b++)c.remove();for(b=0;c=this.a[b];b++)c.s=!1,a&&c.setMap(d);this.f=[]};j.L=function(){var a=this.f.slice();this.f.length=0;this.m();this.i();window.setTimeout(function(){for(var b=0,c;c=a[b];b++)c.remove()},0)};j.i=function(){n(this)};
function n(a){if(a.A)for(var b=a.v(new google.maps.LatLngBounds(a.c.getBounds().getSouthWest(),a.c.getBounds().getNorthEast())),c=0,f;f=a.a[c];c++)if(!f.s&&b.contains(f.getPosition())){for(var g=a,u=4E4,o=d,v=0,m=void 0;m=g.f[v];v++){var i=m.getCenter();if(i){var p=f.getPosition();if(!i||!p)i=0;else var w=(p.lat()-i.lat())*Math.PI/180,x=(p.lng()-i.lng())*Math.PI/180,i=Math.sin(w/2)*Math.sin(w/2)+Math.cos(i.lat()*Math.PI/180)*Math.cos(p.lat()*Math.PI/180)*Math.sin(x/2)*Math.sin(x/2),i=6371*2*Math.atan2(Math.sqrt(i),
Math.sqrt(1-i));i<u&&(u=i,o=m)}}o&&o.F.contains(f.getPosition())?o.q(f):(m=new s(g),m.q(f),g.f.push(m))}}function s(a){this.k=a;this.c=a.getMap();this.g=a.w();this.l=a.l;this.r=a.r;this.d=d;this.a=[];this.F=d;this.n=new t(this,a.z(),a.w())}j=s.prototype;
j.q=function(a){var b;a:if(this.a.indexOf)b=this.a.indexOf(a)!=-1;else{b=0;for(var c;c=this.a[b];b++)if(c==a){b=!0;break a}b=!1}if(b)return!1;if(this.d){if(this.r)c=this.a.length+1,b=(this.d.lat()*(c-1)+a.getPosition().lat())/c,c=(this.d.lng()*(c-1)+a.getPosition().lng())/c,this.d=new google.maps.LatLng(b,c),y(this)}else this.d=a.getPosition(),y(this);a.s=!0;this.a.push(a);b=this.a.length;b<this.l&&a.getMap()!=this.c&&a.setMap(this.c);if(b==this.l)for(c=0;c<b;c++)this.a[c].setMap(d);b>=this.l&&a.setMap(d);
a=this.c.getZoom();if((b=this.k.I())&&a>b)for(a=0;b=this.a[a];a++)b.setMap(this.c);else if(this.a.length<this.l)z(this.n);else{b=this.k.H()(this.a,this.k.z().length);this.n.setCenter(this.d);a=this.n;a.B=b;a.ga=b.text;a.ea=b.index;if(a.b)a.b.innerHTML=b.text;b=Math.max(0,a.B.index-1);b=Math.min(a.j.length-1,b);b=a.j[b];a.da=b.url;a.h=b.height;a.p=b.width;a.M=b.textColor;a.e=b.anchor;a.N=b.textSize;a.D=b.backgroundPosition;this.n.show()}return!0};
j.getBounds=function(){for(var a=new google.maps.LatLngBounds(this.d,this.d),b=this.o(),c=0,f;f=b[c];c++)a.extend(f.getPosition());return a};j.remove=function(){this.n.remove();this.a.length=0;delete this.a};j.T=function(){return this.a.length};j.o=h("a");j.getCenter=h("d");function y(a){a.F=a.k.v(new google.maps.LatLngBounds(a.d,a.d))}j.getMap=h("c");
function t(a,b,c){a.k.extend(t,google.maps.OverlayView);this.j=b;this.fa=c||0;this.u=a;this.d=d;this.c=a.getMap();this.B=this.b=d;this.t=!1;this.setMap(this.c)}j=t.prototype;
j.onAdd=function(){this.b=document.createElement("DIV");if(this.t)this.b.style.cssText=A(this,B(this,this.d)),this.b.innerHTML=this.B.text;this.getPanes().overlayMouseTarget.appendChild(this.b);var a=this;google.maps.event.addDomListener(this.b,"click",function(){var b=a.u.k;google.maps.event.trigger(b,"clusterclick",a.u);b.O&&a.c.fitBounds(a.u.getBounds())})};function B(a,b){var c=a.getProjection().fromLatLngToDivPixel(b);c.x-=parseInt(a.p/2,10);c.y-=parseInt(a.h/2,10);return c}
j.draw=function(){if(this.t){var a=B(this,this.d);this.b.style.top=a.y+"px";this.b.style.left=a.x+"px"}};function z(a){if(a.b)a.b.style.display="none";a.t=!1}j.show=function(){if(this.b)this.b.style.cssText=A(this,B(this,this.d)),this.b.style.display="";this.t=!0};j.remove=function(){this.setMap(d)};j.onRemove=function(){if(this.b&&this.b.parentNode)z(this),this.b.parentNode.removeChild(this.b),this.b=d};j.setCenter=e("d");
function A(a,b){var c=[];c.push("background-image:url("+a.da+");");c.push("background-position:"+(a.D?a.D:"0 0")+";");typeof a.e==="object"?(typeof a.e[0]==="number"&&a.e[0]>0&&a.e[0]<a.h?c.push("height:"+(a.h-a.e[0])+"px; padding-top:"+a.e[0]+"px;"):c.push("height:"+a.h+"px; line-height:"+a.h+"px;"),typeof a.e[1]==="number"&&a.e[1]>0&&a.e[1]<a.p?c.push("width:"+(a.p-a.e[1])+"px; padding-left:"+a.e[1]+"px;"):c.push("width:"+a.p+"px; text-align:center;")):c.push("height:"+a.h+"px; line-height:"+a.h+
"px; width:"+a.p+"px; text-align:center;");c.push("cursor:pointer; top:"+b.y+"px; left:"+b.x+"px; color:"+(a.M?a.M:"black")+"; position:absolute; font-size:"+(a.N?a.N:11)+"px; font-family:Arial,sans-serif; font-weight:bold");return c.join("")}window.MarkerClusterer=k;k.prototype.addMarker=k.prototype.q;k.prototype.addMarkers=k.prototype.C;k.prototype.clearMarkers=k.prototype.R;k.prototype.fitMapToMarkers=k.prototype.S;k.prototype.getCalculator=k.prototype.H;k.prototype.getGridSize=k.prototype.w;
k.prototype.getExtendedBounds=k.prototype.v;k.prototype.getMap=k.prototype.getMap;k.prototype.getMarkers=k.prototype.o;k.prototype.getMaxZoom=k.prototype.I;k.prototype.getStyles=k.prototype.z;k.prototype.getTotalClusters=k.prototype.U;k.prototype.getTotalMarkers=k.prototype.V;k.prototype.redraw=k.prototype.i;k.prototype.removeMarker=k.prototype.Y;k.prototype.removeMarkers=k.prototype.Z;k.prototype.resetViewport=k.prototype.m;k.prototype.repaint=k.prototype.L;k.prototype.setCalculator=k.prototype.$;
k.prototype.setGridSize=k.prototype.aa;k.prototype.setMaxZoom=k.prototype.ba;k.prototype.onAdd=k.prototype.onAdd;k.prototype.draw=k.prototype.draw;s.prototype.getCenter=s.prototype.getCenter;s.prototype.getSize=s.prototype.T;s.prototype.getMarkers=s.prototype.o;t.prototype.onAdd=t.prototype.onAdd;t.prototype.draw=t.prototype.draw;t.prototype.onRemove=t.prototype.onRemove;
})();

View File

@ -1,6 +1,6 @@
name = "Exif GPS Data"
description = "Extract Exif GPS data from photos."
version = 2
version = 3
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:exif_gps"

View File

@ -1,7 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-exif-gps-admin">
<h2> <?= t("EXIF GPS Settings") ?> </h2>
<br /><div><?=t("You may sign up for a Google Maps API key at"); ?> <a href="http://code.google.com/apis/maps/signup.html" target="_new">http://code.google.com/apis/maps/signup.html</a>.<br /></div>
<br /><div><?=t("You may sign up for a Google APIs Console key at"); ?> <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key" target="_new">http://code.google.com/apis/maps/signup.html</a>.<br /></div>
<?= $exifgps_form ?>
<br /><br /><div><strong><?=t("Default Zoom Level:"); ?></strong> <?=t("This value represents how far zoomed in or out the map will start out at. A value of 0 (the coarsest) will zoom the map all of the way out, while higher numbers will zoom the map further in. Depending on the map type, the highest zoom value you can use will be around 19-23."); ?></div>
</div>

View File

@ -0,0 +1,13 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
<markers>
<? foreach ($items as $item) { ?>
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
<? $str_thumb_html = str_replace("&", "&amp;", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))); ?>
<? $str_thumb_html = str_replace("\'", "&apos;", $str_thumb_html); ?>
<? $str_thumb_html = str_replace("<", "&lt;", $str_thumb_html); ?>
<? $str_thumb_html = str_replace(">", "&gt;", $str_thumb_html); ?>
<? $str_thumb_html = str_replace("\"", "&quot;", $str_thumb_html); ?>
<marker lat="<?= $item_coordinates->latitude; ?>" lng="<?= $item_coordinates->longitude; ?>" url="<?= url::abs_site("exif_gps/item/{$item->id}"); ?>" thumb="<?=$str_thumb_html; ?>" />
<? } ?>
</markers>

View File

@ -1,65 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
$latitude = 0;
$longitude = 0;
?>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
<script type="text/javascript">
google.load("maps", "3",{"other_params":"sensor=false"});
var google_zoom_hack = false;
function initialize() {
var latlng = new google.maps.LatLng(0,0);
var myOptions = {
zoom: 1,
center: latlng,
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type; ?>
};
var map = new google.maps.Map(document.getElementById("sidebar_map_canvas"), myOptions);
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
<? $counter = 1; ?>
<? foreach ($items as $item) { ?>
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
glatlngbounds.extend(new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>));
<? if (!isset($currLat)) { ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
<? $latitude = $item_coordinates->latitude; ?>
<? $longitude = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? } elseif (($currLat != $item_coordinates->latitude) && ($currLong != $item_coordinates->longitude)) { ?>
<? $counter++; ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? } else { ?>
<? } ?>
<? } ?>
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
// If there is a maximum auto-zoom value, then set up an event to check the zoom
// level the first time it is changed, and adjust it if necessary.
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
google.maps.event.addListener(map, 'zoom_changed', function() {
if (google_zoom_hack) {
if (map.getZoom() > <?= $max_autozoom ?>) map.setZoom(<?= $max_autozoom ?>);
google_zoom_hack = false;
}
});
<? endif ?>
google_zoom_hack = true;
map.fitBounds(glatlngbounds);
}
google.setOnLoadCallback(initialize);
</script>
<div id="sidebar_map_canvas" style="width:205px; height:214px"><img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=<?= module::get_var("exif_gps", "sidebar_zoom"); ?>&size=205x214&maptype=<?=$sidebar_map_type ?>&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false"></div>

View File

@ -1,22 +1,103 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("maps", "3",{"other_params":"sensor=false"});
<?
if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
print "google.load(\"maps\", \"3\", {other_params:\"key=" . module::get_var("exif_gps", "googlemap_api_key") . "&sensor=false\"});";
} else {
print "google.load(\"maps\", \"3\", {other_params:\"sensor=false\"});";
}
?>
var google_zoom_hack = false;
var map = null;
<?
if (isset($album_id)) {
print " var album_id = " . $album_id . ";\n";
} else {
print " var album_id = 0;\n";
}
?>
$.ajaxSetup({
error: function(xhr, status, error) {
var status_text = document.getElementById('exif-gps-status');
status_text.innerHTML = "<font size=\"4\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
}
});
function initialize() {
var latlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
var myLatlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
var myOptions = {
zoom: <?= module::get_var("exif_gps", "sidebar_zoom"); ?>,
center: latlng,
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type ?>
};
var map = new google.maps.Map(document.getElementById("sidebar_map_canvas"), myOptions);
var marker = new google.maps.Marker({
position: latlng,
map: map
zoom: 1,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type; ?>
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
var map_markers = [];
var current_latlng = null;
if (album_id > 0) {
jQuery.get("<?=url::abs_site("exif_gps/xml/album/{$album_id}"); ?>", {}, function(data) {
jQuery(data).find("marker").each(function() {
var xmlmarker = jQuery(this);
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
parseFloat(xmlmarker.attr("lng")));
if (!latlng.equals(current_latlng)) {
current_latlng = latlng;
glatlngbounds.extend(latlng);
var marker = new google.maps.Marker({position: latlng});
map_markers.push(marker);
}
});
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
google_zoom_hack = true;
map.fitBounds(glatlngbounds);
document.getElementById('over_map').style.display = 'none';
});
} else {
var latlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
var marker = new google.maps.Marker({
position: latlng,
map: map
});
map.setZoom(<?= module::get_var("exif_gps", "sidebar_zoom"); ?>);
document.getElementById('over_map').style.display = 'none';
}
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
// If there is a maximum auto-zoom value, then set up an event to check the zoom
// level the first time it is changed, and adjust it if necessary.
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
google.maps.event.addListener(map, 'zoom_changed', function() {
if (google_zoom_hack) {
if (map.getZoom() > <?= $max_autozoom ?>) map.setZoom(<?= $max_autozoom ?>);
google_zoom_hack = false;
}
});
<? endif ?>
}
google.setOnLoadCallback(initialize);
</script>
<div id="sidebar_map_canvas" style="width:205px; height:214px"><img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=<?= module::get_var("exif_gps", "sidebar_zoom"); ?>&size=205x214&maptype=<?=$sidebar_map_type ?>&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false"></div>
<style>
#wrapper { position: relative; }
#over_map { position: absolute; top: 0px; left: 0px; z-index: 99; }
</style>
<div id="wrapper">
<div id="map_canvas" style="width:205px; height:214px"></div>
<div id="over_map" style="width:205px; height:214px">
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width:205px; height:214px">
<font size="4" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
</p>
</div>
</div>

View File

@ -1,65 +1,81 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("maps", "3",{"other_params":"sensor=false"});
<?
if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
print "google.load(\"maps\", \"3\", {other_params:\"key=" . module::get_var("exif_gps", "googlemap_api_key") . "&sensor=false\"});";
} else {
print "google.load(\"maps\", \"3\", {other_params:\"sensor=false\"});";
}
?>
var google_zoom_hack = false;
var map = null;
var infoWindow = null;
$.ajaxSetup({
error: function(xhr, status, error) {
var status_text = document.getElementById('exif-gps-status');
status_text.innerHTML = "<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
}
});
function initialize() {
var latlng = new google.maps.LatLng(0,0);
var myLatlng = new google.maps.LatLng(0, 0);
var myOptions = {
zoom: 1,
center: latlng,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.<?=$map_type; ?>
};
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
<? $counter = 1; ?>
<? foreach ($items as $item) { ?>
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
glatlngbounds.extend(new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>));
<? if (!isset($currLat)) { ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } elseif (($currLat != $item_coordinates->latitude) && ($currLong != $item_coordinates->longitude)) { ?>
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
content: "<?=$windowContent; ?>",
size: new google.maps.Size(50,50)
});
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
});
<? $counter++; ?>
<? $currLat = $item_coordinates->latitude; ?>
<? $currLong = $item_coordinates->longitude; ?>
var marker<?=$counter; ?> = new google.maps.Marker({
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
map: map
});
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } else { ?>
<? $windowContent = $windowContent . " <div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
$item->url() . "\\\">" .
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
"</a></div>"; ?>
<? } ?>
<? } ?>
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
content: "<?=$windowContent; ?>",
size: new google.maps.Size(50,50)
});
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
infoWindow = new google.maps.InfoWindow();
var map_markers = [];
var str_marker_html = "";
var current_latlng = null;
jQuery.get("<?=url::abs_site("exif_gps/xml/{$query_type}/{$query_id}"); ?>", {}, function(data) {
jQuery(data).find("marker").each(function() {
var xmlmarker = jQuery(this);
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
parseFloat(xmlmarker.attr("lng")));
if (!latlng.equals(current_latlng)) {
if (current_latlng != null) {
var fn = markerClickFunction(str_marker_html, current_latlng);
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
}
current_latlng = latlng;
str_marker_html = "";
glatlngbounds.extend(latlng);
var marker = new google.maps.Marker({position: latlng});
map_markers.push(marker);
}
var str_thumb_html = String(xmlmarker.attr("thumb"));
str_thumb_html = str_thumb_html.replace("&lt;", "<");
str_thumb_html = str_thumb_html.replace("&gt;", ">");
str_thumb_html = str_thumb_html.replace("&apos;", "\'");
str_thumb_html = str_thumb_html.replace("&quot;", "\"");
str_thumb_html = str_thumb_html.replace("&amp;", "&");
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
str_marker_html += str_thumb_html;
});
var fn = markerClickFunction(str_marker_html, current_latlng);
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
google_zoom_hack = true;
map.fitBounds(glatlngbounds);
document.getElementById('over_map').style.display = 'none';
});
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
@ -74,14 +90,31 @@
}
});
<? endif ?>
google_zoom_hack = true;
map.fitBounds(glatlngbounds);
}
markerClickFunction = function(str_thumb_html, latlng) {
return function(e) {
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
infoWindow.setContent(str_thumb_html);
infoWindow.setPosition(latlng);
infoWindow.open(map);
};
};
google.setOnLoadCallback(initialize);
</script>
<style>
#wrapper { position: relative; }
#over_map { position: absolute; top: 0px; left: 0px; z-index: 99; }
</style>
<div id="g-exif-map-header">
<div id="g-exif-map-header-buttons">
<?= $theme->dynamic_top() ?>
@ -89,5 +122,13 @@
<h1><?= html::clean($title) ?></h1>
</div>
<br />
<div id="map_canvas" style="width:600px; height:480px;"></div>
<div id="wrapper">
<div id="map_canvas" style="width:690px; height:480px;"></div>
<div id="over_map" style="width:690px; height:480px;">
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
<font size="6" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
</p>
</div>
</div>
<?= $theme->dynamic_bottom() ?>

View File

@ -1,2 +1,8 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=<?= module::get_var("exif_gps", "sidebar_zoom"); ?>&size=205x214&maptype=<?=$sidebar_map_type ?>&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false">
<?
$map_api_key = "";
if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
$map_api_key = "&key=" . module::get_var("exif_gps", "googlemap_api_key");
}
?>
<img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=<?= module::get_var("exif_gps", "sidebar_zoom"); ?>&size=205x214&maptype=<?=$sidebar_map_type ?>&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?><?= $map_api_key; ?>&sensor=false">

View File

@ -0,0 +1,126 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
<?
if (module::get_var("exif_gps", "googlemap_api_key", "") != "") {
print "google.load(\"maps\", \"3\", {other_params:\"key=" . module::get_var("exif_gps", "googlemap_api_key") . "&sensor=false\"});";
} else {
print "google.load(\"maps\", \"3\", {other_params:\"sensor=false\"});";
}
?>
var google_zoom_hack = false;
var map = null;
var infoWindow = null;
$.ajaxSetup({
error: function(xhr, status, error) {
var status_text = document.getElementById('exif-gps-status');
status_text.innerHTML = "<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " + status + "<br />\nError: " + error + "</strong></font>";
}
});
function initialize() {
var myLatlng = new google.maps.LatLng(0, 0);
var myOptions = {
zoom: 1,
center: myLatlng,
mapTypeId: google.maps.MapTypeId.<?=$map_type; ?>
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
infoWindow = new google.maps.InfoWindow();
var map_markers = [];
var str_marker_html = "";
var current_latlng = null;
jQuery.get("<?=url::abs_site("exif_gps/xml/user/{$user_id}"); ?>", {}, function(data) {
jQuery(data).find("marker").each(function() {
var xmlmarker = jQuery(this);
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
parseFloat(xmlmarker.attr("lng")));
if (!latlng.equals(current_latlng)) {
if (current_latlng != null) {
var fn = markerClickFunction(str_marker_html, current_latlng);
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
}
current_latlng = latlng;
str_marker_html = "";
glatlngbounds.extend(latlng);
var marker = new google.maps.Marker({position: latlng});
map_markers.push(marker);
}
var str_thumb_html = String(xmlmarker.attr("thumb"));
str_thumb_html = str_thumb_html.replace("&lt;", "<");
str_thumb_html = str_thumb_html.replace("&gt;", ">");
str_thumb_html = str_thumb_html.replace("&apos;", "\'");
str_thumb_html = str_thumb_html.replace("&quot;", "\"");
str_thumb_html = str_thumb_html.replace("&amp;", "&");
str_thumb_html = "<div class=\"g-exif-gps-thumb\"><a href=\"" +
String(xmlmarker.attr("url")) + "\">" + str_thumb_html + "</a></div>";
str_marker_html += str_thumb_html;
});
var fn = markerClickFunction(str_marker_html, current_latlng);
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
var mcOptions = { gridSize: <?= module::get_var("exif_gps", "markercluster_gridsize"); ?>, maxZoom: <?= module::get_var("exif_gps", "markercluster_maxzoom"); ?>};
var markerCluster = new MarkerClusterer(map, map_markers, mcOptions);
google_zoom_hack = true;
map.fitBounds(glatlngbounds);
document.getElementById('over_map').style.display = 'none';
});
<? if (($max_autozoom = module::get_var("exif_gps", "googlemap_max_autozoom")) != "") : ?>
// If there is a maximum auto-zoom value, then set up an event to check the zoom
// level the first time it is changed, and adjust it if necessary.
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
google.maps.event.addListener(map, 'zoom_changed', function() {
if (google_zoom_hack) {
if (map.getZoom() > <?= $max_autozoom ?>) map.setZoom(<?= $max_autozoom ?>);
google_zoom_hack = false;
}
});
<? endif ?>
}
markerClickFunction = function(str_thumb_html, latlng) {
return function(e) {
e.cancelBubble = true;
e.returnValue = false;
if (e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
infoWindow.setContent(str_thumb_html);
infoWindow.setPosition(latlng);
infoWindow.open(map);
};
};
google.setOnLoadCallback(initialize);
</script>
<style>
#wrapper { position: relative; }
#over_map { position: absolute; top: 0px; left: 0px; z-index: 99; }
</style>
<div id="wrapper">
<div id="map_canvas" style="width:690px; height:480px;"></div>
<div id="over_map" style="width:690px; height:480px;">
<p id="exif-gps-status" style="text-align: center; display: table-cell; vertical-align: middle; width: 690px; height: 480px;">
<font size="6" color="white"><strong><?= t("Loading..."); ?></strong></font><br /><br />
<img src="<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>" style="vertical-align: middle;"></img>
</p>
</div>
</div>