Permalink
Browse files

Merge branch 'master' of github.com:gallery/gallery3-contrib

  • Loading branch information...
2 parents 033e35d + 0757ada commit 76e0a771e7f68a344aeb588e74601aba1d41e8f6 @bharat bharat committed Jun 20, 2010
Showing with 1,009 additions and 97 deletions.
  1. +1 −2 modules/calendarview/controllers/calendarview.php
  2. +0 −1 modules/calendarview/css/calendarview_calendar.css
  3. +19 −1 modules/calendarview/helpers/calendarview_block.php
  4. +4 −0 modules/calendarview/views/calendarview_sidebar.html.php
  5. +36 −0 modules/database_info/helpers/database_info_block.php
  6. +3 −0 modules/database_info/module.info
  7. +18 −0 modules/database_info/views/admin_block_db.html.php
  8. +105 −0 modules/exif_gps/controllers/admin_exif_gps.php
  9. +78 −0 modules/exif_gps/controllers/exif_gps.php
  10. +3 −8 modules/exif_gps/helpers/exif_gps.php
  11. +115 −33 modules/exif_gps/helpers/exif_gps_block.php
  12. +17 −7 modules/exif_gps/helpers/exif_gps_event.php
  13. +29 −1 modules/exif_gps/helpers/exif_gps_installer.php
  14. +1 −1 modules/exif_gps/models/exif_coordinate.php
  15. +1 −1 modules/exif_gps/module.info
  16. +7 −0 modules/exif_gps/views/admin_exif_gps.html.php
  17. +43 −0 modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php
  18. +22 −0 modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php
  19. +80 −0 modules/exif_gps/views/exif_gps_map.html.php
  20. +9 −0 modules/exif_gps/views/exif_gps_maps_sidebar.html.php
  21. +0 −3 modules/exif_gps/views/exif_gps_sidebar.html.php
  22. +2 −0 modules/exif_gps/views/exif_gps_static_sidebar.html.php
  23. +3 −0 modules/jhead/helpers/jhead_event.php
  24. BIN modules/language_flags/images/round/sl-SI.png
  25. +1 −1 modules/language_flags/views/user_languages_block.html.php
  26. +2 −2 modules/metadescription/views/metadescription_block.html.php
  27. +125 −0 modules/moduleupdates/controllers/admin_moduleupdates.php
  28. +30 −0 modules/moduleupdates/helpers/moduleupdates_event.php
  29. +37 −0 modules/moduleupdates/helpers/moduleupdates_installer.php
  30. +3 −0 modules/moduleupdates/module.info
  31. +36 −0 modules/moduleupdates/views/admin_moduleupdates.html.php
  32. +2 −2 modules/nobots/views/nobots_block.html.php
  33. +5 −0 modules/tag_cloud/controllers/admin_tag_cloud.php
  34. +4 −1 modules/tag_cloud/helpers/tag_cloud_block.php
  35. +1 −1 modules/tagfaces/js/jquery.Jcrop.js
  36. +43 −31 modules/tagfaces/views/drawfaces.html.php
  37. +121 −1 modules/user_homes/helpers/user_homes_event.php
  38. +3 −0 modules/user_homes/js/user_homes_add_album.js
@@ -265,7 +265,6 @@ public function setprefs() {
$str_year_id = Input::instance()->post("cal_year");
// redirect to the currect page.
- url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id));
-
+ url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id, request::protocol()));
}
}
@@ -37,7 +37,6 @@ table.calendar caption {
table.calendar th, table.calendar td {
padding: 0.2em;
- background: #ffffff;
border: 0px;
}
@@ -38,14 +38,32 @@ static function get($block_id, $theme) {
$display_date = $item->created;
}
+ // Make sure there are photo's to display.
+ $day_count = ORM::factory("item")
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->where("captured", ">=", mktime(0, 0, 0, date("n", $display_date), date("j", $display_date), date("Y", $display_date)))
+ ->where("captured", "<", mktime(0, 0, 0, date("n", $display_date), date("j", $display_date)+1, date("Y", $display_date)))
+ ->find_all()
+ ->count();
+ $month_count = ORM::factory("item")
+ ->viewable()
+ ->where("type", "!=", "album")
+ ->where("captured", ">=", mktime(0, 0, 0, date("n", $display_date), 1, date("Y", $display_date)))
+ ->where("captured", "<", mktime(0, 0, 0, date("n", $display_date)+1, 1, date("Y", $display_date)))
+ ->find_all()
+ ->count();
+
switch ($block_id) {
case "calendarview_photo":
- if ($display_date != "") {
+ if ( ($display_date != "") && (($day_count > 0) || ($month_count > 0)) ) {
$block = new Block();
$block->css_id = "g-calendarview-sidebar";
$block->title = t("Calendar");
$block->content = new View("calendarview_sidebar.html");
$block->content->date = $display_date;
+ $block->content->day_count = $day_count;
+ $block->content->month_count = $month_count;
}
break;
}
@@ -1,5 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<ul>
+ <? if ($day_count > 0): ?>
<li><a href="<?=url::site("calendarview/day/" . date("Y", $date) . "/-1/" . date("n", $date) . "/" . date("j", $date)); ?>"><?=t("More from"); ?> <?=date("F", $date); ?> <?=date("j", $date); ?><?=date("S", $date); ?></a></li>
+ <? endif ?>
+ <? if ($month_count > 0): ?>
<li><a href="<?=url::site("calendarview/month/" . date("Y", $date) . "/-1/" . date("n", $date)); ?>"><?=t("More from"); ?> <?=date("F", $date); ?></a></li>
+ <? endif ?>
</ul>
@@ -0,0 +1,36 @@
+<?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 database_info_block_Core {
+ static function get_admin_list() {
+ return array("database_info" => t("Database info"));
+ }
+
+ static function get($block_id) {
+ $block = new Block();
+ switch ($block_id) {
+ case "database_info":
+ $block->css_id = "g-database-info";
+ $block->title = t("Database information");
+ $block->content = new View("admin_block_db.html");
+ break;
+ }
+ return $block;
+ }
+}
@@ -0,0 +1,3 @@
+name = "Database Info"
+description = "View information about your Gallery 3 database on the admin dashboard."
+version = 1
@@ -0,0 +1,18 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?
+ $db = Database::instance();
+ $tables = $db->query("SHOW TABLE STATUS");
+ $database_size = 0;
+ foreach($tables as $table) {
+ $database_size += ($table->Data_length + $table->Index_length);
+ }
+ $database_size = $database_size / 1024 / 1024;
+?>
+<ul>
+ <li>
+ <?= t("Database size: %dbsize MB", array("dbsize" => number_format($database_size, 2))) ?>
+ </li>
+ <li>
+ <?= t("Number of tables: %dbtables", array("dbtables" => count($tables))) ?>
+ </li>
+</ul>
@@ -0,0 +1,105 @@
+<?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 Admin_EXIF_GPS_Controller extends Admin_Controller {
+ public function index() {
+ // Generate a new admin page.
+ $view = new Admin_View("admin.html");
+ $view->content = new View("admin_exif_gps.html");
+ $view->content->exifgps_form = $this->_get_admin_form();
+ print $view;
+ }
+
+ public function saveprefs() {
+ // Save user preferences to the database.
+
+ // Prevent Cross Site Request Forgery
+ access::verify_csrf();
+
+ // 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", "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);
+
+ // Display a success message and redirect back to the TagsMap admin page.
+ message::success(t("Your settings have been saved."));
+ url::redirect("admin/exif_gps");
+ }
+
+ // Else show the page with errors
+ $view = new Admin_View("admin.html");
+ $view->content = new View("admin_exif_gps.html");
+ $view->content->exifgps_form = $form;
+ print $view;
+ }
+
+ private function _get_admin_form() {
+ // Make a new Form.
+ $form = new Forge("admin/exif_gps/saveprefs", "", "post",
+ array("id" => "g-exif-gps-adminForm"));
+
+ // Create group for global settings, like the Maps API Key
+ $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");
+
+ // 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 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"));
+
+ // Add a save button to the form.
+ $form->submit("SaveSettings")->value(t("Save"));
+
+ // Return the newly generated form.
+ return $form;
+ }
+}
@@ -0,0 +1,78 @@
+<?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_Controller extends Controller {
+ public function map($map_type, $type_id) {
+ // Map all items in the specified album or user.
+
+ $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]->name;
+ } 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");
+ }
+
+ // Make a new page.
+ $template = new Theme_View("page.html", "other", "EXIFMap");
+ $template->page_title = t("Gallery :: Map");
+ $template->content = new View("exif_gps_map.html");
+ if ($map_title == "") {
+ $template->content->title = t("Map");
+ } else {
+ $template->content->title = t("Map of") . " " . $map_title;
+ }
+
+ // 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;
+
+ // When mapping an album, generate a "return to album" link.
+ if (isset($curr_album)) $template->content->return_url = url::abs_site("{$curr_album[0]->type}s/{$curr_album[0]->id}");
+
+ // Load in module preferences.
+ $template->content->items = $items;
+ $template->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
+
+ // Display the page.
+ print $template;
+ }
+}
@@ -17,12 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
-/**
- * This is the API for handling exif data.
- */
class exif_gps_Core {
-
protected static $exif_keys;
static function extract($item) {
@@ -52,10 +47,10 @@ static function extract($item) {
$record->latitude = str_replace(",", ".", $keys["Latitude"]);
$record->longitude = str_replace(",", ".", $keys["Longitude"]);
// Represent N/S/E/W as postive and negative numbers
- if ($keys["Latitude Reference"] == "S") {
+ if (substr(strtoupper($keys["Latitude Reference"]), 0, 1) == "S") {
$record->latitude = "-" . $record->latitude;
}
- if ($keys["Longitude Reference"] == "W") {
+ if (substr(strtoupper($keys["Longitude Reference"]), 0, 1) == "W") {
$record->longitude = "-" . $record->longitude;
}
$record->save();
@@ -74,4 +69,4 @@ private static function _keys() {
}
return self::$exif_keys;
}
-}
+}
Oops, something went wrong.

0 comments on commit 76e0a77

Please sign in to comment.