Merge branch 'master' of git://github.com/rWatcher/gallery3-contrib
Conflicts: modules/exif_gps/controllers/admin_exif_gps.php modules/exif_gps/helpers/exif_gps_event.php modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php modules/exif_gps/views/exif_gps_map.html.php
This commit is contained in:
commit
97088a3b03
@ -40,10 +40,25 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
|
||||
// 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", "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;
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_album); $i++) {
|
||||
if ($form->Global->toolbar_map_album->value[$i] == "checkbox_album") {
|
||||
$checkbox_album = true;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_user); $i++) {
|
||||
if ($form->Global->toolbar_map_user->value[$i] == "checkbox_user") {
|
||||
$checkbox_user = true;
|
||||
}
|
||||
}
|
||||
module::set_var("exif_gps", "toolbar_map_album", $checkbox_album);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $checkbox_user);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your settings have been saved."));
|
||||
@ -69,6 +84,15 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
->label(t("Google Maps API Key"))
|
||||
->value(module::get_var("exif_gps", "googlemap_api_key"))
|
||||
->rules("required");
|
||||
$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"));
|
||||
$gps_global_group->checklist("toolbar_map_album")
|
||||
->options($checkbox_album);
|
||||
$gps_global_group->checklist("toolbar_map_user")
|
||||
->options($checkbox_user);
|
||||
|
||||
// Create a group for sidebar settings
|
||||
$gps_sidebar = $form->group("Sidebar")
|
||||
|
6
modules/exif_gps/css/exif_gps_menu.css
Normal file
6
modules/exif_gps/css/exif_gps_menu.css
Normal file
@ -0,0 +1,6 @@
|
||||
#g-view-menu #g-exif-gps-album-link {
|
||||
background-image: url('../images/ico-view-exif_gps_album.png');
|
||||
}
|
||||
#g-view-menu #g-exif-gps-user-link {
|
||||
background-image: url('../images/ico-view-exif_gps_user.png');
|
||||
}
|
@ -97,4 +97,124 @@ class exif_gps_event_Core {
|
||||
->label(t("EXIF_GPS Settings"))
|
||||
->url(url::site("admin/exif_gps")));
|
||||
}
|
||||
|
||||
static function photo_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$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)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
|
||||
static function movie_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$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)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
|
||||
static function album_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$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)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
24
modules/exif_gps/helpers/exif_gps_theme.php
Normal file
24
modules/exif_gps/helpers/exif_gps_theme.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class exif_gps_theme_Core {
|
||||
static function head($theme) {
|
||||
$theme->css("exif_gps_menu.css");
|
||||
}
|
||||
}
|
BIN
modules/exif_gps/images/ico-view-exif_gps_album.png
Normal file
BIN
modules/exif_gps/images/ico-view-exif_gps_album.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
modules/exif_gps/images/ico-view-exif_gps_user.png
Normal file
BIN
modules/exif_gps/images/ico-view-exif_gps_user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@ -2,6 +2,8 @@
|
||||
<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 = {
|
||||
@ -33,6 +35,20 @@
|
||||
<? } else { ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? if (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() > 18) map.setZoom(18);
|
||||
google_zoom_hack = false;
|
||||
}
|
||||
});
|
||||
<? endif ?>
|
||||
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
<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 = {
|
||||
@ -59,11 +61,25 @@
|
||||
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
|
||||
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
|
||||
});
|
||||
|
||||
<? if (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() > 18) map.setZoom(18);
|
||||
google_zoom_hack = false;
|
||||
}
|
||||
});
|
||||
<? endif ?>
|
||||
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(initialize);
|
||||
|
||||
</script>
|
||||
|
||||
<div id="g-exif-map-header">
|
||||
|
Reference in New Issue
Block a user