mirror of
https://github.com/Pathduck/gallery3-themes-modules.git
synced 2024-11-10 14:26:11 -05:00
revert exif_gps to working version
This commit is contained in:
parent
8660b327f5
commit
86d8e88428
@ -37,29 +37,20 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
$form = $this->_get_admin_form();
|
||||
if ($form->validate()) {
|
||||
// Save settings to Gallery's database.
|
||||
module::set_var("exif_gps", "provider", $form->Global->provider->value);
|
||||
// switch (module::get_var("exif_gps", "provider")) {
|
||||
// case "gmaps":
|
||||
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);
|
||||
module::set_var("exif_gps", "toolbar_map_album", $form->Global->toolbar_map_album->value);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $form->Global->toolbar_map_user->value);
|
||||
module::set_var("exif_gps", "restrict_maps", $form->Global->restrict_maps->value);
|
||||
// break;
|
||||
// case "osm":
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
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);
|
||||
module::set_var("exif_gps", "toolbar_map_album", $form->Global->toolbar_map_album->value);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $form->Global->toolbar_map_user->value);
|
||||
module::set_var("exif_gps", "restrict_maps", $form->Global->restrict_maps->value);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your settings have been saved."));
|
||||
message::success($form->Global->provider->value);
|
||||
url::redirect("admin/exif_gps");
|
||||
}
|
||||
|
||||
@ -78,76 +69,56 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
// Create group for global settings, like the Maps API Key
|
||||
$gps_global_group = $form->group("Global")
|
||||
->label(t("Global Settings"));
|
||||
$gps_global_group->dropdown("provider")
|
||||
->label(t("Map Provider"))
|
||||
->options(array(
|
||||
"gmaps" => "Google Maps",
|
||||
"osm" => "OpenStreetMap"
|
||||
))
|
||||
->selected(module::get_var("exif_gps", "provider"));
|
||||
$gps_global_group->input("google_api_key")
|
||||
->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"));
|
||||
$gps_global_group->checkbox("toolbar_map_album")->label(t("Show \"Map this album\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_album", false));
|
||||
$gps_global_group->checkbox("toolbar_map_user")->label(t("Show \"Map this user\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_user", false));
|
||||
$gps_global_group->checkbox("restrict_maps")->label(t("Restrict maps to registered users?"))
|
||||
->checked(module::get_var("exif_gps", "restrict_maps", false));
|
||||
|
||||
// switch (module::get_var("exif_gps", "provider")) {
|
||||
// case "gmaps":
|
||||
$gps_global_group->input("google_api_key")
|
||||
->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"));
|
||||
$gps_global_group->checkbox("toolbar_map_album")->label(t("Show \"Map this album\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_album", false));
|
||||
$gps_global_group->checkbox("toolbar_map_user")->label(t("Show \"Map this user\" icon?"))
|
||||
->checked(module::get_var("exif_gps", "toolbar_map_user", false));
|
||||
$gps_global_group->checkbox("restrict_maps")->label(t("Restrict maps to registered users?"))
|
||||
->checked(module::get_var("exif_gps", "restrict_maps", false));
|
||||
// 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 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")
|
||||
->label(t("Sidebar Settings"));
|
||||
$gps_sidebar->input("sidebar_default_zoom")
|
||||
->label(t("Default Zoom Level"))
|
||||
->value(module::get_var("exif_gps", "sidebar_zoom"))
|
||||
->rules("required");
|
||||
$gps_sidebar->dropdown("sidebar_mapformat")
|
||||
->label(t("Map Interface"))
|
||||
->options(array(t("Static"), t("Interactive")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_mapformat"));
|
||||
$gps_sidebar->dropdown("sidebar_maptype")
|
||||
->label(t("Default Map Type"))
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
t("Hybrid"), t("Terrain")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_maptype"));
|
||||
|
||||
// Create a group for sidebar settings
|
||||
$gps_sidebar = $form->group("Sidebar")
|
||||
->label(t("Sidebar Settings"));
|
||||
$gps_sidebar->input("sidebar_default_zoom")
|
||||
->label(t("Default Zoom Level"))
|
||||
->value(module::get_var("exif_gps", "sidebar_zoom"))
|
||||
->rules("required");
|
||||
$gps_sidebar->dropdown("sidebar_mapformat")
|
||||
->label(t("Map Interface"))
|
||||
->options(array(t("Static"), t("Interactive")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_mapformat"));
|
||||
$gps_sidebar->dropdown("sidebar_maptype")
|
||||
// Create a group for map album/user settings
|
||||
$gps_large_map_group = $form->group("LargeMap")
|
||||
->label(t("Map Album/User Settings"));
|
||||
$gps_large_map_group->dropdown("largemap_maptype")
|
||||
->label(t("Default Map Type"))
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
t("Hybrid"), t("Terrain")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_maptype"));
|
||||
|
||||
// Create a group for map album/user settings
|
||||
$gps_large_map_group = $form->group("LargeMap")
|
||||
->label(t("Map Album/User Settings"));
|
||||
$gps_large_map_group->dropdown("largemap_maptype")
|
||||
->label(t("Default Map Type"))
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
t("Hybrid"), t("Terrain")))
|
||||
->selected(module::get_var("exif_gps", "largemap_maptype"));
|
||||
// break;
|
||||
// case "osm":
|
||||
// $gps_large_map_group->dropdown("xxx")
|
||||
// ->label(t("Map Style"))
|
||||
// ->options(array(
|
||||
// "OSM Bright"
|
||||
// ))
|
||||
// ->selected(module::get_var("exif_gps", "osm_map_style"));
|
||||
// break;
|
||||
// }
|
||||
->selected(module::get_var("exif_gps", "largemap_maptype"));
|
||||
|
||||
// Add a save button to the form.
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
|
@ -52,47 +52,16 @@ class EXIF_GPS_Controller extends Controller {
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants(EXIF_GPS_Controller::$xml_records_limit, $offset);
|
||||
}
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
$v = new View("$map_provider_id/exif_gps_coordinates_xml.html");
|
||||
|
||||
$v = new View("exif_gps_coordinates_xml.html");
|
||||
$v->items = $items;
|
||||
header("Content-type: text/xml; charset=utf-8");
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function geojson($query_type, $query_id, $offset) {
|
||||
// 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(EXIF_GPS_Controller::$xml_records_limit, $offset);
|
||||
} 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(EXIF_GPS_Controller::$xml_records_limit, $offset);
|
||||
}
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
$v = new View("$map_provider_id/exif_gps_coordinates_geojson.html");
|
||||
$v->items = $items;
|
||||
header("Content-type: application/json; 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
|
||||
// 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.
|
||||
@ -109,6 +78,7 @@ class EXIF_GPS_Controller extends Controller {
|
||||
$items_count = ORM::factory("item", $type_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
} elseif ($map_type == "user") {
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all();
|
||||
@ -117,6 +87,7 @@ class EXIF_GPS_Controller extends Controller {
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $type_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
}
|
||||
|
||||
@ -126,9 +97,6 @@ class EXIF_GPS_Controller extends Controller {
|
||||
$counter = 0;
|
||||
$breadcrumbs[] = Breadcrumb::instance(t("Map"), url::site("exif_gps/map/album/{$type_id}"))->set_last();
|
||||
$parent_item = ORM::factory("item", $type_id);
|
||||
if (!$parent_item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
while ($parent_item->id != 1) {
|
||||
$breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
@ -145,8 +113,7 @@ class EXIF_GPS_Controller extends Controller {
|
||||
$template = new Theme_View("page.html", "other", "EXIF_GPS_MAP");
|
||||
$template->page_title = t("Gallery :: Map");
|
||||
$template->set_global(array("breadcrumbs" => $breadcrumbs));
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
$template->content = new View("$map_provider_id/exif_gps_map.html");
|
||||
$template->content = new View("exif_gps_map.html");
|
||||
if ($map_title == "") {
|
||||
$template->content->title = t("Map");
|
||||
} else {
|
||||
|
@ -53,19 +53,20 @@ class exif_gps_block_Core {
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->descendants_count();
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->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(1);
|
||||
|
||||
if (($album_items_count > 0) || ($user_items_count > 0)) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-maps";
|
||||
$block->title = t("Maps");
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
$block->content = new View("$map_provider_id/exif_gps_maps_sidebar.html");
|
||||
$block->content = new View("exif_gps_maps_sidebar.html");
|
||||
$block->content->album_id = $album_id;
|
||||
$block->content->user_id = $item->owner_id;
|
||||
$block->content->user_name = $user_name;
|
||||
@ -116,16 +117,15 @@ class exif_gps_block_Core {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-location";
|
||||
$block->title = t("Location");
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
if (module::get_var("exif_gps", "sidebar_mapformat") == 1) {
|
||||
$block->content = new View("$map_provider_id/exif_gps_dynamic_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_count = 1;
|
||||
} else {
|
||||
$block->content = new View("$map_provider_id/exif_gps_static_sidebar.html");
|
||||
$block->content = new View("exif_gps_static_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";
|
||||
@ -138,13 +138,13 @@ class exif_gps_block_Core {
|
||||
$items_count = ORM::factory("item", $theme->item->id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
if ($items_count > 0) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-location";
|
||||
$block->title = t("Location");
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
$block->content = new View("$map_provider_id/exif_gps_dynamic_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";
|
||||
|
@ -77,7 +77,7 @@ class exif_gps_event_Core {
|
||||
db::build()
|
||||
->delete("exif_coordinates")
|
||||
->where("item_id", "=", $item->id)
|
||||
->execute();
|
||||
->execute();
|
||||
} else {
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find();
|
||||
if (!$record->loaded()) {
|
||||
@ -120,11 +120,13 @@ class exif_gps_event_Core {
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$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();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
@ -165,11 +167,13 @@ class exif_gps_event_Core {
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$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();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
@ -210,11 +214,13 @@ class exif_gps_event_Core {
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$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();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
@ -246,15 +252,14 @@ class exif_gps_event_Core {
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $data->user->id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
if ($items_count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$map_provider_id = module::get_var("exif_gps", "provider");
|
||||
|
||||
// Display the map block.
|
||||
$v = new View("$map_provider_id/user_profile_exif_gps.html");
|
||||
$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";
|
||||
|
BIN
modules/exif_gps/images/m1.png
Executable file
BIN
modules/exif_gps/images/m1.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 2.9 KiB |
BIN
modules/exif_gps/images/m2.png
Executable file
BIN
modules/exif_gps/images/m2.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
@ -1,6 +1,6 @@
|
||||
(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(){};
|
||||
"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="https://raw.githubusercontent.com/googlemaps/js-marker-clusterer/gh-pages/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");
|
||||
|
@ -1,9 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-exif-gps-admin">
|
||||
<h2> <?= t("EXIF GPS Settings") ?> </h2>
|
||||
<?php if (module::get_var("exif_gps", "provider") == "gmaps"): ?>
|
||||
<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>
|
||||
<br /><div><?=t("You may sign up for a Google APIs Console key"); ?> <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key" target="_new">here</a>.<br /></div>
|
||||
<?php endif; ?>
|
||||
<br /><div><?=t("You may sign up for a Google APIs Console key"); ?> <a href="https://developers.google.com/maps/documentation/javascript/tutorial#api_key" target="_new">here</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>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?php print "<?phpxml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
|
||||
<? print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
|
||||
<markers>
|
||||
<?php
|
||||
<?
|
||||
$thumb_arr=array();
|
||||
$items_id=array();;
|
||||
foreach ($items as $item) {
|
||||
@ -17,5 +17,5 @@ $str_thumb_html = str_replace(">", ">", $str_thumb_html);
|
||||
$str_thumb_html = str_replace("\"", """, $str_thumb_html);
|
||||
?>
|
||||
<marker lat="<?= $item_coordinates->latitude; ?>" lng="<?= $item_coordinates->longitude; ?>" url="<?= url::abs_site("exif_gps/item/$item_coordinates->item_id"); ?>" thumb="<?=$str_thumb_html; ?>" />
|
||||
<?php } ?>
|
||||
<? } ?>
|
||||
</markers>
|
169
modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php
Executable file
169
modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php
Executable file
@ -0,0 +1,169 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="//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\"});";
|
||||
}
|
||||
?>
|
||||
<?
|
||||
if (isset($album_id)) {
|
||||
print " var album_id = " . $album_id . ";\n";
|
||||
} else {
|
||||
print " var album_id = 0;\n";
|
||||
}
|
||||
?>
|
||||
|
||||
var google_zoom_hack = false;
|
||||
var map = null;
|
||||
|
||||
$.ajaxSetup({
|
||||
error: function(xhr, status, error) {
|
||||
$('p.exif-gps-status').html("<font size=\"4\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
var myLatlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
center: myLatlng,
|
||||
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type; ?>
|
||||
}
|
||||
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
if (album_id > 0) {
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
} else {
|
||||
// Only display a single marker.
|
||||
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';
|
||||
}
|
||||
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/album/{$album_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"4\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
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);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
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 ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
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:205px; height:214px"></div>
|
||||
<div id="over_map" style="width:205px; height:214px">
|
||||
<p id="exif-gps-status" class="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>
|
189
modules/exif_gps/views/exif_gps_map.html.php
Executable file
189
modules/exif_gps/views/exif_gps_map.html.php
Executable file
@ -0,0 +1,189 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="//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) {
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
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);
|
||||
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Initialize the infoWindow.
|
||||
infoWindow = new google.maps.InfoWindow();
|
||||
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var str_marker_html = ""; // infoWindow HTML for the current set of coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/{$query_type}/{$query_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker and info window.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
// If the latest record has different coordinates then the previous record
|
||||
// and this is not the first record (!=null) then set up the click function
|
||||
// for the previous marker...
|
||||
if (current_latlng != null) {
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
}
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
// Convert any XML escape characters in this record to regular text.
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
// Set up the HTML for this record and append it to the bottom of the info window.
|
||||
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;
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Set up the click function for the last coordinate.
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
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);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
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 ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
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() ?>
|
||||
</div>
|
||||
<h1><?= html::clean($title) ?></h1>
|
||||
</div>
|
||||
<br />
|
||||
<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" class="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() ?>
|
@ -1,9 +1,9 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<?php if (isset($album_items) && ($album_items > 0)): ?>
|
||||
<? if (isset($album_items) && ($album_items > 0)): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/album/" . $album_id) ?>"><?=t("Map this album"); ?></a></li>
|
||||
<?php endif ?>
|
||||
<?php if (isset($user_items) && ($user_items > 0)): ?>
|
||||
<? endif ?>
|
||||
<? if (isset($user_items) && ($user_items > 0)): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/user/" . $user_id) ?>"><?=t("Map"); ?> <?=$user_name; ?><?=t("'s photos"); ?></a></li>
|
||||
<?php endif ?>
|
||||
<? endif ?>
|
||||
</ul>
|
8
modules/exif_gps/views/exif_gps_static_sidebar.html.php
Executable file
8
modules/exif_gps/views/exif_gps_static_sidebar.html.php
Executable file
@ -0,0 +1,8 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?
|
||||
$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="//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">
|
@ -1,33 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
[
|
||||
<?php
|
||||
$thumb_arr=array();
|
||||
$items_id=array();;
|
||||
foreach ($items as $item) {
|
||||
array_push($items_id, $item->id);
|
||||
$thumb_arr[$item->id] = $item->thumb_img(array("class" => "g-exif-gps-thumbnail"));
|
||||
}
|
||||
$item_coordinates_all = ORM::factory("exif_coordinate")->where("item_id", "IN", $items_id)->find_all();
|
||||
foreach ($item_coordinates_all as $zero_index => $item_coordinates) {
|
||||
$thumb_html = base64_encode($thumb_arr[$item_coordinates->item_id]);
|
||||
$separator = $zero_index == count($item_coordinates_all) - 1 ? "\n" : ",\n";
|
||||
?>
|
||||
{
|
||||
"type": "Feature",
|
||||
"properties": {
|
||||
"name": "<?= $item->name ?>",
|
||||
"image_html_base64": "<?= $thumb_html ?>",
|
||||
"url": "<?= url::abs_site("exif_gps/item/$item_coordinates->item_id"); ?>"
|
||||
},
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
"<?= $item_coordinates->longitude; ?>",
|
||||
"<?= $item_coordinates->latitude; ?>"
|
||||
]
|
||||
}
|
||||
}<?= $separator; ?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
]
|
@ -1,63 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"
|
||||
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
|
||||
crossorigin=""/>
|
||||
<div id="wrapper">
|
||||
<div id="map" style="width: 100%; height: 214px;"></div>
|
||||
</div>
|
||||
<style>
|
||||
.ui-widget-overlay.ui-front:visible {
|
||||
z-index: 998;
|
||||
}
|
||||
.ui-widget-overlay.ui-front:visible img {
|
||||
z-index: 999;
|
||||
}
|
||||
</style>
|
||||
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"
|
||||
integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA=="
|
||||
crossorigin=""></script><script>
|
||||
|
||||
var zoomImg = document.getElementsByClassName('g-fullsize-link');
|
||||
zoomImg[0].addEventListener('click', toggleMiniMap, false);
|
||||
|
||||
function onEachFeature(feature, layer) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
function toggleMiniMap() {
|
||||
var miniMap = document.getElementById('map');
|
||||
if (document.getElementById('g-fullsize-overlay')) {
|
||||
miniMap.style.display = '';
|
||||
document.getElementsByTagName('body')[0].removeEventListener('click', toggleMiniMap);
|
||||
}
|
||||
else {
|
||||
miniMap.style.display = 'none';
|
||||
window.exifGpsOsmSidebarMiniMap = document.getElementsByTagName('body')[0].addEventListener('click', toggleMiniMap, false);
|
||||
}
|
||||
}
|
||||
|
||||
var map = L.map('map').setView([<?=$longitude; ?>, <?=$latitude; ?>], 13);
|
||||
|
||||
var geojsonFeatures = [
|
||||
{
|
||||
"type": "Feature",
|
||||
"geometry": {
|
||||
"type": "Point",
|
||||
"coordinates": [
|
||||
<?=$longitude; ?>,
|
||||
<?=$latitude; ?>
|
||||
]
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
var ggFeatureGroup = L.geoJSON(geojsonFeatures, {
|
||||
onEachFeature: onEachFeature
|
||||
}).addTo(map);
|
||||
map.fitBounds(ggFeatureGroup.getBounds());
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> collaborators'
|
||||
}).addTo(map);
|
||||
|
||||
</script>
|
@ -1,65 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"
|
||||
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
|
||||
crossorigin=""/>
|
||||
<div id="g-exif-map-header">
|
||||
<div id="g-exif-map-header-buttons">
|
||||
<?= $theme->dynamic_top() ?>
|
||||
</div>
|
||||
<h1><?= html::clean($title) ?></h1>
|
||||
</div>
|
||||
<br />
|
||||
<div id="wrapper">
|
||||
<div id="map" style="width: 100%; height: 500px;"></div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"
|
||||
integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA=="
|
||||
crossorigin=""></script><script>
|
||||
|
||||
function onEachFeature(feature, layer) {
|
||||
// does this feature have a property named popupContent?
|
||||
if (feature.properties && feature.properties.image_html_base64) {
|
||||
layer.bindPopup(
|
||||
"<h3 style=\"max-width: 200px; text-align: center; overflow-wrap: break-word; margin-bottom: 1ex;\">" + feature.properties.name + "</h3>" +
|
||||
"<div style=\"text-align: center;\"><a href=\"" + feature.properties.url + "\">" +
|
||||
// decode HTML element with thumb
|
||||
window.atob(feature.properties.image_html_base64)
|
||||
+ "</a></div>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
var int_offset = 0;
|
||||
request.open('GET', '<?= url::abs_site("exif_gps/geojson/{$query_type}/{$query_id}"); ?>/' + int_offset, true);
|
||||
|
||||
request.onload = function() {
|
||||
if (this.status >= 200 && this.status < 400) {
|
||||
// Success!
|
||||
var geojsonFeatures = JSON.parse(this.response);
|
||||
|
||||
var map = L.map('map').setView([0, 0], 13);
|
||||
var ggFeatureGroup = L.geoJSON(geojsonFeatures, {
|
||||
onEachFeature: onEachFeature
|
||||
}).addTo(map);
|
||||
map.fitBounds(ggFeatureGroup.getBounds());
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> collaborators'
|
||||
}).addTo(map);
|
||||
// L.marker(.addTo(map);
|
||||
|
||||
} else {
|
||||
// We reached our target server, but it returned an error
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function() {
|
||||
// There was a connection error of some sort
|
||||
};
|
||||
|
||||
request.send();
|
||||
|
||||
</script>
|
||||
<?= $theme->dynamic_bottom() ?>
|
@ -1,58 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.4/dist/leaflet.css"
|
||||
integrity="sha512-puBpdR0798OZvTTbP4A8Ix/l+A4dHDD0DGqYW6RQ+9jxkRFclaxxQb/SJAWZfWAkuyeQUytO7+7N4QKrDh+drA=="
|
||||
crossorigin=""/>
|
||||
<div id="wrapper">
|
||||
<div id="map" style="width: 100%; height: 500px;"></div>
|
||||
</div>
|
||||
<script src="https://unpkg.com/leaflet@1.3.4/dist/leaflet.js"
|
||||
integrity="sha512-nMMmRyTVoLYqjP9hrbed9S+FzjZHW5gY1TWCHA5ckwXZBadntCNs8kEqAWdrb9O7rxbCaA4lKTIWjDXZxflOcA=="
|
||||
crossorigin=""></script><script>
|
||||
|
||||
function onEachFeature(feature, layer) {
|
||||
// does this feature have a property named popupContent?
|
||||
if (feature.properties && feature.properties.image_html_base64) {
|
||||
layer.bindPopup(
|
||||
"<h3 style=\"max-width: 200px; text-align: center; overflow-wrap: break-word; margin-bottom: 1ex;\">" + feature.properties.name + "</h3>" +
|
||||
"<div style=\"text-align: center;\"><a href=\"" + feature.properties.url + "\">" +
|
||||
// decode HTML element with thumb
|
||||
window.atob(feature.properties.image_html_base64)
|
||||
+ "</a></div>"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
var request = new XMLHttpRequest();
|
||||
var int_offset = 0;
|
||||
alert(<?= $user_id ?>);
|
||||
request.open('GET', '<?= url::abs_site("exif_gps/geojson/user/{$user_id}"); ?>/' + int_offset, true);
|
||||
|
||||
request.onload = function() {
|
||||
if (this.status >= 200 && this.status < 400) {
|
||||
// Success!
|
||||
var geojsonFeatures = JSON.parse(this.response);
|
||||
|
||||
var map = L.map('map').setView([0, 0], 13);
|
||||
var ggFeatureGroup = L.geoJSON(geojsonFeatures, {
|
||||
onEachFeature: onEachFeature
|
||||
}).addTo(map);
|
||||
map.fitBounds(ggFeatureGroup.getBounds());
|
||||
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> collaborators'
|
||||
}).addTo(map);
|
||||
// L.marker(.addTo(map);
|
||||
|
||||
} else {
|
||||
// We reached our target server, but it returned an error
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
request.onerror = function() {
|
||||
// There was a connection error of some sort
|
||||
};
|
||||
|
||||
request.send();
|
||||
|
||||
</script>
|
181
modules/exif_gps/views/user_profile_exif_gps.html.php
Executable file
181
modules/exif_gps/views/user_profile_exif_gps.html.php
Executable file
@ -0,0 +1,181 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="//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) {
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong>An AJAX error occured: " +
|
||||
status + "<br />\nError: " + error + "</strong></font>");
|
||||
}
|
||||
});
|
||||
|
||||
function initialize() {
|
||||
// Set up some initial variables and make a new map.
|
||||
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);
|
||||
|
||||
// This is so we can auto-center and zoom the map.
|
||||
// We will grow this each time a new set of coordinates is added onto the map
|
||||
var glatlngbounds = new google.maps.LatLngBounds( );
|
||||
|
||||
// Initialize the infoWindow.
|
||||
infoWindow = new google.maps.InfoWindow();
|
||||
|
||||
// Set up some initial variables for looping through the coordinates in the xml files.
|
||||
var map_markers = []; // Array of all unique coordinates.
|
||||
var str_marker_html = ""; // infoWindow HTML for the current set of coordinates.
|
||||
var current_latlng = null; // Current coordinates. Used for merging duplicate coordinates together.
|
||||
var item_counter = 0; // Current number of XML records that have been processed.
|
||||
var int_max_items = <?= $items_count; ?>; // Total number of XML records to process.
|
||||
var int_offset = 0; // Number of XML records to skip. Sent as a URL parameter when retrieving XML data.
|
||||
|
||||
// Retrieve the first batch of XML records.
|
||||
// This function runs recursively until item_counter equals int_max_items.
|
||||
// We're using recursion instead of a normal looping control, because normal
|
||||
// loops would prevent the web browser from responding until the loop is finished.
|
||||
get_xml();
|
||||
|
||||
function get_xml() {
|
||||
// This function uses ajax requests to download and process a chunck of records, in XML format.
|
||||
jQuery.ajax({
|
||||
url: '<?=url::abs_site("exif_gps/xml/user/{$user_id}/"); ?>/' + int_offset,
|
||||
success: function(data) {
|
||||
jQuery(data).find("marker").each(function() {
|
||||
// Loop through the retrieved records and add each one to the map.
|
||||
|
||||
// Process the current record.
|
||||
item_counter++;
|
||||
var xmlmarker = jQuery(this);
|
||||
var latlng = new google.maps.LatLng(parseFloat(xmlmarker.attr("lat")),
|
||||
parseFloat(xmlmarker.attr("lng")));
|
||||
|
||||
// Group multiple records with the same lat and lng coordinates together into
|
||||
// the same marker and info window.
|
||||
if (!latlng.equals(current_latlng)) {
|
||||
// If the latest record has different coordinates then the previous record
|
||||
// and this is not the first record (!=null) then set up the click function
|
||||
// for the previous marker...
|
||||
if (current_latlng != null) {
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
}
|
||||
|
||||
// ... then set up a new marker for this record.
|
||||
current_latlng = latlng;
|
||||
str_marker_html = "";
|
||||
glatlngbounds.extend(latlng);
|
||||
var marker = new google.maps.Marker({position: latlng});
|
||||
map_markers.push(marker);
|
||||
}
|
||||
|
||||
// Convert any XML escape characters in this record to regular text.
|
||||
var str_thumb_html = String(xmlmarker.attr("thumb"));
|
||||
str_thumb_html = str_thumb_html.replace("<", "<");
|
||||
str_thumb_html = str_thumb_html.replace(">", ">");
|
||||
str_thumb_html = str_thumb_html.replace("'", "\'");
|
||||
str_thumb_html = str_thumb_html.replace(""", "\"");
|
||||
str_thumb_html = str_thumb_html.replace("&", "&");
|
||||
|
||||
// Set up the HTML for this record and append it to the bottom of the info window.
|
||||
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;
|
||||
});
|
||||
|
||||
// Display a status message telling the user what percentage of records have been processed.
|
||||
$('p.exif-gps-status').html("<font size=\"6\" color=\"white\"><strong><?= t("Loading..."); ?> " +
|
||||
parseInt((item_counter / int_max_items) * 100) + "%</strong></font>" +
|
||||
"<br /><br /><img src=\"<?= url::file("modules/exif_gps/images/exif_gps-loading-map-large.gif"); ?>\"" +
|
||||
" style=\"vertical-align: middle;\"></img>");
|
||||
|
||||
// If item counter is less then max items, get the next batch of records.
|
||||
// If item counter is equal to max items, then finish setting up the map and exit.
|
||||
if (item_counter < int_max_items) {
|
||||
int_offset += <?= EXIF_GPS_Controller::$xml_records_limit; ?>;
|
||||
get_xml();
|
||||
} else {
|
||||
// Set up the click function for the last coordinate.
|
||||
var fn = markerClickFunction(str_marker_html, current_latlng);
|
||||
google.maps.event.addListener(map_markers[map_markers.length-1], 'click', fn);
|
||||
|
||||
// Add the coordinates to the map, grouping clusters of similar coordinates together.
|
||||
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);
|
||||
|
||||
// Auto zoom and center the map around the coordinates.
|
||||
// Set google_zoom_hack to true, to when the zoom changed function triggers
|
||||
// we can re-zoom to the admin specified auto-zoom value, if necessary.
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
|
||||
// Hide the loading message and exit.
|
||||
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 ?>
|
||||
}
|
||||
|
||||
// Set up an info window at the specified coordinates
|
||||
// to display the specified html.
|
||||
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" class="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>
|
Loading…
Reference in New Issue
Block a user