1
0

Merged in some code from the 3nids version of TagsMap and the bugfix from glip.

This commit is contained in:
rWatcher 2009-10-14 16:43:19 -04:00
parent acd3d9084f
commit 560f2ecf5f
10 changed files with 89 additions and 30 deletions

View File

@ -111,7 +111,7 @@ class Admin_TagsMap_Controller extends Admin_Controller {
private function _get_tagsgpsedit_form($tag_id) {
// Make a new form for editing GPS data associated with a tag ($tag_id).
$form = new Forge("admin/tagsmap/savegps", "", "post",
array("id" => "g-tags-mapAdminForm"));
array("id" => "g-tags-map-admin-form"));
// Add a few input boxes for GPS and Description
$tagsgps_group = $form->group("TagsMapGPS");
@ -181,7 +181,7 @@ class Admin_TagsMap_Controller extends Admin_Controller {
private function _get_googlemaps_form() {
// Make a new form for inputing information associated with google maps.
$form = new Forge("admin/tagsmap/savemapprefs", "", "post",
array("id" => "g-tags-mapAdminForm"));
array("id" => "g-tags-map-admin-form"));
// Input box for the Maps API Key
$googlemap_group = $form->group("GoogleMapsKey");

View File

@ -41,7 +41,8 @@ class TagsMap_Controller extends Controller {
print $view;
} else {
$template = new Theme_View("page.html", "Contact");
$template = new Theme_View("page.html", "TagsMap");
$template->page_title = t("Gallery :: Map");
$template->content = new View("tagsmap_googlemap.html");
// Load in module preferences.

View File

@ -40,4 +40,28 @@ class tagsmap_event_Core {
->label(t("TagsMap Settings"))
->url(url::site("admin/tagsmap")));
}
static function photo_menu($menu, $theme) {
$menu->append(Menu::factory("link")
->id("tagsmap")
->label(t("View Map"))
->url(url::site("tagsmap/googlemap/"))
->css_id("g-tagsmap-link"));
}
static function movie_menu($menu, $theme) {
$menu->append(Menu::factory("link")
->id("tagsmap")
->label(t("View Map"))
->url(url::site("tagsmap/googlemap/"))
->css_id("g-tagsmap-link"));
}
static function album_menu($menu, $theme) {
$menu->append(Menu::factory("link")
->id("tagsmap")
->label(t("View Map"))
->url(url::site("tagsmap/googlemap/"))
->css_id("g-tagsmap-link"));
}
}

View File

@ -43,5 +43,6 @@ class tagsmap_installer {
// Delete the GPS table before uninstalling.
$db = Database::instance();
$db->query("DROP TABLE IF EXISTS {tags_gpses};");
module::delete("tagsmap");
}
}

View File

@ -19,20 +19,7 @@
*/
class tagsmap_theme_Core {
static function sidebar_blocks($theme) {
// Display a link to the map in the Gallery sidebar
// Make sure the current page belongs to an item.
if (!$theme->item()) {
return;
}
// Create a new block to display the link in.
$block = new Block();
$block->css_id = "g-tags-map";
$block->title = t("Map:");
$block->content = new View("tagsmap_block.html");
return $block;
static function head($theme) {
$theme->css("tagsmap_menu.css");
}
}

View File

@ -1,3 +1,3 @@
name = TagsMap
description = Assign GPS coordinates to existing tags and display them on a map.
name = "TagsMap"
description = "Assign GPS coordinates to existing tags and display them on a map."
version = 1

View File

@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-tags-mapDeleteAdmin">
<div id="g-tags-map-delete-admin">
<h2> <?= t("Delete GPS Data For Tag ") . $tag_name . "?" ?> </h2>
<?= t("Are you sure you wish to delete all GPS data associated with this tag?") ?> <br/><br/>
<a href="<?= url::site("admin/tagsmap/delete_gps/" . $tag_id) ?>">Delete</a>

View File

@ -1,6 +1,58 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-tags-mapEditAdmin">
<div id="g-tags-map-edit-admin">
<h2> <?= t("Edit GPS Data for Tag ") . $tag_name ?> </h2>
<div ID="map" STYLE="width: 800px; height: 400px"></div>
<div id="g-tags-map-instructions"><?=t("Double-Click on the map to create a new marker."); ?><br />
<?=t("Drag and drop the marker to move it to a new location."); ?><br />
</div>
<?= $tagsmapedit_form ?>
</div>
<script src="http://www.google.com/jsapi?key=<?= module::get_var("tagsmap", "googlemap_api_key") ?>" type="text/javascript"></script>
<script type="text/javascript">
google.load("maps", "2.160");
var lat = document.getElementById("gps_latitude").value;
var lon = document.getElementById("gps_longitude").value;
var map;
function Gload() {
if (GBrowserIsCompatible()) {
map = new GMap2(document.getElementById("map"));
map.addMapType(G_PHYSICAL_MAP);
map.setMapType(G_PHYSICAL_MAP);
map.enableScrollWheelZoom();
map.setCenter(new GLatLng(<?=module::get_var("tagsmap", "googlemap_latitude"); ?>, <?=module::get_var("tagsmap", "googlemap_longitude"); ?>));
map.setZoom(<?=module::get_var("tagsmap", "googlemap_zoom"); ?>);
map.addControl(new GSmallMapControl()); // affiche le curseur de zoom
map.addControl(new GMapTypeControl()); // affiche le curseur de déplacement
map.addControl(new GScaleControl()); // affiche lechelle
GEvent.addListener(map,"dblclick",function(overlay, latlng) {
document.getElementById("gps_longitude").value = latlng.x;
document.getElementById("gps_latitude").value = latlng.y;
var markeri = new GMarker(latlng, {draggable: true});
map.addOverlay(markeri);
GEvent.addListener(markeri, "dragend", function(point){
document.getElementById("gps_longitude").value = point.x;
document.getElementById("gps_latitude").value = point.y;
});
});
}
if (lon != '' && lat != ''){
var point = new GLatLng(lat,lon);
map.setCenter(point, 8);
var marker = new GMarker(point, {draggable: true});
map.addOverlay(marker);
GEvent.addListener(marker, "dragend", function(point){
document.getElementById("gps_longitude").value = point.x;
document.getElementById("gps_latitude").value = point.y;
});
}
}
google.setOnLoadCallback(Gload);
</script>

View File

@ -1,7 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul id="g-tags-map">
<li>
<a href="<?= url::site("tagsmap/googlemap") ?>">
<?= t("Show Map") ?></a>
</li>
</ul>

View File

@ -3,7 +3,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>Gallery: Map</title>
<title><?= t("Gallery :: Map") ?></title>
</head>
<body>
<? } ?>
@ -20,6 +20,7 @@
map.addMapType(G_SATELLITE_3D_MAP);
var mapControl = new GMapTypeControl();
map.addControl(mapControl);
map.enableScrollWheelZoom();
// Set map defaults.
map.setCenter(new GLatLng(<?=$google_map_latitude ?>,