1
0

Added optional toolbar icons.

This commit is contained in:
rWatcher 2010-03-24 21:53:47 -04:00
parent b155ea730a
commit e017b7351c
6 changed files with 170 additions and 0 deletions

View File

@ -44,6 +44,20 @@ class Admin_EXIF_GPS_Controller extends Admin_Controller {
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 +83,12 @@ 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");
$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")

View 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');
}

View File

@ -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"));
}
}
}

View 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");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB