Merge branch 'master' of github.com:gallery/gallery3-contrib
This commit is contained in:
commit
8fa33819f0
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -37,9 +37,9 @@ alert("New title: <b>{$album->data->entity->title}</b>");
|
||||
|
||||
$photo = Gallery3::factory()
|
||||
->set("type", "photo")
|
||||
->set("name", "Sample Photo.jpg")
|
||||
->set("name", "Sample Photo.png")
|
||||
->set("title", "Sample Photo")
|
||||
->set_file("/tmp/foo.jpg")
|
||||
->set_file("gallery.png")
|
||||
->create($album->url, $auth);
|
||||
alert("Uploaded photo: <b>{$photo->url}</b>");
|
||||
alert("Album members: <b>" . join(", ", $album->data->members) . "</b>");
|
||||
|
BIN
client/gallery.png
Normal file
BIN
client/gallery.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 22 KiB |
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
d<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -31,7 +31,7 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Draw the page.
|
||||
$template = new Theme_View("page.html", "other", "CalendarView");
|
||||
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
||||
$template->css("calendarview_calendar.css");
|
||||
$template->set_global("calendar_user", $display_user);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
@ -39,6 +39,11 @@ class CalendarView_Controller extends Controller {
|
||||
$template->content->calendar_year = $display_year;
|
||||
$template->content->calendar_user = $display_user;
|
||||
$template->content->calendar_user_year_form = $this->_get_calenderprefs_form($display_year, $display_user);
|
||||
$template->content->title = t("Calendar") . ": " . $display_year;
|
||||
// Set up breadcrumbs
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, "");
|
||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
||||
print $template;
|
||||
}
|
||||
|
||||
@ -78,7 +83,7 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarDayView");
|
||||
$template = new Theme_View("calpage.html", "collection", "CalendarDayView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
@ -105,11 +110,11 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
|
||||
$fake_item = new Calendar_Breadcrumb($display_day, "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$calendar_breadcrumbs[2] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
|
||||
$calendar_breadcrumbs[3] = new Calendar_Breadcrumb($display_day, "");
|
||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
@ -154,7 +159,7 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarMonthView");
|
||||
$template = new Theme_View("calpage.html", "collection", "CalendarMonthView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
@ -180,11 +185,11 @@ class CalendarView_Controller extends Controller {
|
||||
->find_all($page_size, $offset));
|
||||
}
|
||||
|
||||
// Set up breadcrumbs for this page.
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$fake_item = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
// Set up breadcrumbs
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$calendar_breadcrumbs[2] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
|
||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
@ -195,7 +200,7 @@ class CalendarView_Controller extends Controller {
|
||||
|
||||
private function _get_calenderprefs_form($display_year, $display_user) {
|
||||
// Generate a form to allow the visitor to select a year and a gallery photo owner.
|
||||
$form = new Forge("calendarview/setprefs", "", "post",
|
||||
$calendar_group = new Forge("calendarview/setprefs", "", "post",
|
||||
array("id" => "g-view-calendar-form"));
|
||||
|
||||
// Generate a list of all Gallery users who have uploaded photos.
|
||||
@ -231,21 +236,22 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Create the form.
|
||||
$calendar_group = $form->group("CalendarPrefs");
|
||||
$calendar_group->dropdown('cal_user')
|
||||
->label(t("Display Photos From User: "))
|
||||
->id('cal_user')
|
||||
->options($valid_users)
|
||||
->selected($display_user);
|
||||
$calendar_group->dropdown('cal_year')
|
||||
->label(t("For Year: "))
|
||||
->id('cal_year')
|
||||
->options($valid_years)
|
||||
->selected($display_year);
|
||||
|
||||
// Add a save button to the form.
|
||||
$calendar_group->submit("SaveSettings")->value(t("Go"));
|
||||
$calendar_group->submit("SaveSettings")->value(t("Go"))->id('cal_go');
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
return $calendar_group;
|
||||
}
|
||||
|
||||
public function setprefs() {
|
||||
|
@ -1,8 +1,51 @@
|
||||
table.calendar { text-align: center; width:100px; }
|
||||
table.calendar caption { font-size: 1.5em; padding: 0.2em; }
|
||||
table.calendar th, table.calendar td { padding: 0.2em; background: #fff; border: 0; }
|
||||
table.calendar td:hover { background: #ddf; }
|
||||
table.calendar td.prev-next { background: #ccc; color: #999; }
|
||||
table.calendar td.today { color: #800; }
|
||||
#cal_user, #cal_year, #g-view-calendar-form li { display: inline; }
|
||||
#SaveSettings { float: right; }
|
||||
/* Grid view ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
#g-calendar-grid {
|
||||
position: relative;
|
||||
align: center;
|
||||
float: left;
|
||||
width: 200px;
|
||||
height: 220px;
|
||||
margin: 10px 10px 10px 10px;
|
||||
}
|
||||
|
||||
/* Search form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
#cal_user {
|
||||
top: 0px;
|
||||
left: 60px;
|
||||
display: inline;
|
||||
}
|
||||
#cal_year {
|
||||
top: 0px;
|
||||
left: 240px;
|
||||
display: inline;
|
||||
}
|
||||
#cal_go {
|
||||
top: 0px;
|
||||
left: 328px;
|
||||
display: inline;
|
||||
}
|
||||
|
||||
/* Content ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
table.calendar {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.calendar caption {
|
||||
font-size: 1.5em;
|
||||
padding: 0.2em;
|
||||
}
|
||||
|
||||
table.calendar th, table.calendar td {
|
||||
padding: 0.2em;
|
||||
background: #ffffff;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.calendar td:hover {
|
||||
background: #ddf;
|
||||
}
|
||||
|
||||
/* For RTL Languages ~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
.rtl #g-calendar-grid {
|
||||
float: right;
|
||||
}
|
||||
|
54
modules/calendarview/helpers/calendarview_block.php
Normal file
54
modules/calendarview/helpers/calendarview_block.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 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 calendarview_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("calendarview_photo" => t("More Photos From This Date"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
$item = $theme->item;
|
||||
|
||||
$display_date = "";
|
||||
if (isset($item->captured)) {
|
||||
$display_date = $item->captured;
|
||||
}elseif (isset($item->created)) {
|
||||
$display_date = $item->created;
|
||||
}
|
||||
|
||||
switch ($block_id) {
|
||||
case "calendarview_photo":
|
||||
if ($display_date != "") {
|
||||
$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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -41,4 +41,32 @@ class calendarview_event_Core {
|
||||
->url(url::site("calendarview/calendar/"))
|
||||
->css_id("g-calendarview-link"));
|
||||
}
|
||||
|
||||
static function tag_menu($menu, $theme) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("calendarview")
|
||||
->label(t("View Calendar"))
|
||||
->url(url::site("calendarview/calendar/"))
|
||||
->css_id("g-calendarview-link"));
|
||||
}
|
||||
|
||||
static function pre_deactivate($data) {
|
||||
// If the admin is about to deactivate EXIF, warn them that this module requires it.
|
||||
if ($data->module == "exif") {
|
||||
$data->messages["warn"][] = t("The CalendarView module requires the EXIF module.");
|
||||
}
|
||||
}
|
||||
|
||||
static function module_change($changes) {
|
||||
// If EXIF is deactivated, display a warning that it is required for this module to function properly.
|
||||
if (!module::is_active("exif") || in_array("exif", $changes->deactivate)) {
|
||||
site_status::warning(
|
||||
t("The CalendarView module requires the EXIF module. " .
|
||||
"<a href=\"%url\">Activate the EXIF module now</a>",
|
||||
array("url" => html::mark_clean(url::site("admin/modules")))),
|
||||
"calendarview_needs_exif");
|
||||
} else {
|
||||
site_status::clear("calendarview_needs_exif");
|
||||
}
|
||||
}
|
||||
}
|
32
modules/calendarview/helpers/calendarview_installer.php
Normal file
32
modules/calendarview/helpers/calendarview_installer.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 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 calendarview_installer {
|
||||
static function install() {
|
||||
module::set_version("calendarview", 1);
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("calendarview_needs_exif");
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
module::delete("calendarview");
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,362 +0,0 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
/**
|
||||
* Calendar creation library.
|
||||
*
|
||||
* $Id: Calendar.php 3769 2008-12-15 00:48:56Z zombor $
|
||||
*
|
||||
* @package Calendar
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2007-2008 Kohana Team
|
||||
* @license http://kohanaphp.com/license.html
|
||||
*/
|
||||
class Calendar_Core extends Event_Subject {
|
||||
|
||||
// Start the calendar on Sunday by default
|
||||
public static $start_monday = FALSE;
|
||||
|
||||
// Month and year to use for calendaring
|
||||
protected $month;
|
||||
protected $year;
|
||||
|
||||
// Week starts on Sunday
|
||||
protected $week_start = 0;
|
||||
|
||||
// Observed data
|
||||
protected $observed_data;
|
||||
|
||||
/**
|
||||
* Returns an array of the names of the days, using the current locale.
|
||||
*
|
||||
* @param integer left of day names
|
||||
* @return array
|
||||
*/
|
||||
public static function days($length = TRUE)
|
||||
{
|
||||
// strftime day format
|
||||
$format = ($length > 3) ? '%A' : '%a';
|
||||
|
||||
// Days of the week
|
||||
$days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
|
||||
|
||||
if (Calendar::$start_monday === TRUE)
|
||||
{
|
||||
// Push Sunday to the end of the days
|
||||
array_push($days, array_shift($days));
|
||||
}
|
||||
|
||||
if (strpos(Kohana::config('locale.language.0'), 'en') !== 0)
|
||||
{
|
||||
// This is a bit awkward, but it works properly and is reliable
|
||||
foreach ($days as $i => $day)
|
||||
{
|
||||
// Convert the English names to i18n names
|
||||
$days[$i] = strftime($format, strtotime($day));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_int($length) OR ctype_digit($length))
|
||||
{
|
||||
foreach ($days as $i => $day)
|
||||
{
|
||||
// Shorten the days to the expected length
|
||||
$days[$i] = mb_substr($day, 0, $length);
|
||||
}
|
||||
}
|
||||
|
||||
return $days;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Calendar instance. A month and year can be specified.
|
||||
* By default, the current month and year are used.
|
||||
*
|
||||
* @param integer month number
|
||||
* @param integer year number
|
||||
* @return object
|
||||
*/
|
||||
public static function factory($month = NULL, $year = NULL)
|
||||
{
|
||||
return new Calendar($month, $year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Calendar instance. A month and year can be specified.
|
||||
* By default, the current month and year are used.
|
||||
*
|
||||
* @param integer month number
|
||||
* @param integer year number
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($month = NULL, $year = NULL)
|
||||
{
|
||||
empty($month) and $month = date('n'); // Current month
|
||||
empty($year) and $year = date('Y'); // Current year
|
||||
|
||||
// Set the month and year
|
||||
$this->month = (int) $month;
|
||||
$this->year = (int) $year;
|
||||
|
||||
if (Calendar::$start_monday === TRUE)
|
||||
{
|
||||
// Week starts on Monday
|
||||
$this->week_start = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows fetching the current month and year.
|
||||
*
|
||||
* @param string key to get
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if ($key === 'month' OR $key === 'year')
|
||||
{
|
||||
return $this->$key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar_Event factory method.
|
||||
*
|
||||
* @param string unique name for the event
|
||||
* @return object Calendar_Event
|
||||
*/
|
||||
public function event($name = NULL)
|
||||
{
|
||||
return new Calendar_Event($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar_Event factory method.
|
||||
*
|
||||
* @chainable
|
||||
* @param string standard event type
|
||||
* @return object
|
||||
*/
|
||||
public function standard($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'today':
|
||||
// Add an event for the current day
|
||||
$this->attach($this->event()->condition('timestamp', strtotime('today'))->add_class('today'));
|
||||
break;
|
||||
case 'prev-next':
|
||||
// Add an event for padding days
|
||||
$this->attach($this->event()->condition('current', FALSE)->add_class('prev-next'));
|
||||
break;
|
||||
case 'holidays':
|
||||
// Base event
|
||||
$event = $this->event()->condition('current', TRUE)->add_class('holiday');
|
||||
|
||||
// Attach New Years
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 1)->condition('day', 1));
|
||||
|
||||
// Attach Valentine's Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 2)->condition('day', 14));
|
||||
|
||||
// Attach St. Patrick's Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 3)->condition('day', 17));
|
||||
|
||||
// Attach Easter
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('easter', TRUE));
|
||||
|
||||
// Attach Memorial Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 5)->condition('day_of_week', 1)->condition('last_occurrence', TRUE));
|
||||
|
||||
// Attach Independance Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 7)->condition('day', 4));
|
||||
|
||||
// Attach Labor Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 9)->condition('day_of_week', 1)->condition('occurrence', 1));
|
||||
|
||||
// Attach Halloween
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 10)->condition('day', 31));
|
||||
|
||||
// Attach Thanksgiving
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 11)->condition('day_of_week', 4)->condition('occurrence', 4));
|
||||
|
||||
// Attach Christmas
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 12)->condition('day', 25));
|
||||
break;
|
||||
case 'weekends':
|
||||
// Weekend events
|
||||
$this->attach($this->event()->condition('weekend', TRUE)->add_class('weekend'));
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array for use with a view. The array contains an array for
|
||||
* each week. Each week contains 7 arrays, with a day number and status:
|
||||
* TRUE if the day is in the month, FALSE if it is padding.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function weeks()
|
||||
{
|
||||
// First day of the month as a timestamp
|
||||
$first = mktime(1, 0, 0, $this->month, 1, $this->year);
|
||||
|
||||
// Total number of days in this month
|
||||
$total = (int) date('t', $first);
|
||||
|
||||
// Last day of the month as a timestamp
|
||||
$last = mktime(1, 0, 0, $this->month, $total, $this->year);
|
||||
|
||||
// Make the month and week empty arrays
|
||||
$month = $week = array();
|
||||
|
||||
// Number of days added. When this reaches 7, start a new week
|
||||
$days = 0;
|
||||
$week_number = 1;
|
||||
|
||||
if (($w = (int) date('w', $first) - $this->week_start) < 0)
|
||||
{
|
||||
$w = 6;
|
||||
}
|
||||
|
||||
if ($w > 0)
|
||||
{
|
||||
// Number of days in the previous month
|
||||
$n = (int) date('t', mktime(1, 0, 0, $this->month - 1, 1, $this->year));
|
||||
|
||||
// i = number of day, t = number of days to pad
|
||||
for ($i = $n - $w + 1, $t = $w; $t > 0; $t--, $i++)
|
||||
{
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month - 1, $i, $this->year, $week_number, FALSE));
|
||||
|
||||
// Add previous month padding days
|
||||
$week[] = array($i, FALSE, $this->observed_data);
|
||||
$days++;
|
||||
}
|
||||
}
|
||||
|
||||
// i = number of day
|
||||
for ($i = 1; $i <= $total; $i++)
|
||||
{
|
||||
if ($days % 7 === 0)
|
||||
{
|
||||
// Start a new week
|
||||
$month[] = $week;
|
||||
$week = array();
|
||||
|
||||
$week_number++;
|
||||
}
|
||||
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month, $i, $this->year, $week_number, TRUE));
|
||||
|
||||
// Add days to this month
|
||||
$week[] = array($i, TRUE, $this->observed_data);
|
||||
$days++;
|
||||
}
|
||||
|
||||
if (($w = (int) date('w', $last) - $this->week_start) < 0)
|
||||
{
|
||||
$w = 6;
|
||||
}
|
||||
|
||||
if ($w >= 0)
|
||||
{
|
||||
// i = number of day, t = number of days to pad
|
||||
for ($i = 1, $t = 6 - $w; $t > 0; $t--, $i++)
|
||||
{
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month + 1, $i, $this->year, $week_number, FALSE));
|
||||
|
||||
// Add next month padding days
|
||||
$week[] = array($i, FALSE, $this->observed_data);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty($week))
|
||||
{
|
||||
// Append the remaining days
|
||||
$month[] = $week;
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new data from an observer. All event data contains and array of CSS
|
||||
* classes and an array of output messages.
|
||||
*
|
||||
* @param array observer data.
|
||||
* @return void
|
||||
*/
|
||||
public function add_data(array $data)
|
||||
{
|
||||
// Add new classes
|
||||
$this->observed_data['classes'] += $data['classes'];
|
||||
|
||||
if ( ! empty($data['output']))
|
||||
{
|
||||
// Only add output if it's not empty
|
||||
$this->observed_data['output'][] = $data['output'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the observed data and sends a notify to all attached events.
|
||||
*
|
||||
* @param array UNIX timestamp
|
||||
* @return void
|
||||
*/
|
||||
public function notify($data)
|
||||
{
|
||||
// Reset observed data
|
||||
$this->observed_data = array
|
||||
(
|
||||
'classes' => array(),
|
||||
'output' => array(),
|
||||
);
|
||||
|
||||
// Send a notify
|
||||
parent::notify($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the calendar to HTML using the kohana_calendar view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$view = new View('kohana_calendar', array
|
||||
(
|
||||
'month' => $this->month,
|
||||
'year' => $this->year,
|
||||
'weeks' => $this->weeks(),
|
||||
));
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Magically convert this object to a string, the rendered calendar.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
||||
} // End Calendar
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -21,27 +21,11 @@ class Calendar_Breadcrumb_Core {
|
||||
// Creates a class to maintain a single breadcrumb.
|
||||
// Multiple breadcrumbs can be achieved by createing an array of this class type.
|
||||
public $title = "";
|
||||
public $id = 0;
|
||||
public $id = 1;
|
||||
public $url = "";
|
||||
|
||||
public function __construct($new_title, $new_url) {
|
||||
$this->title = $new_title;
|
||||
$this->url = $new_url;
|
||||
}
|
||||
|
||||
public function url($query=null) {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function parent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_album() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function is_photo() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1,307 +0,0 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
/**
|
||||
* Calendar event observer class.
|
||||
*
|
||||
* $Id: Calendar_Event.php 4129 2009-03-27 17:47:03Z zombor $
|
||||
*
|
||||
* @package Calendar
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2007-2008 Kohana Team
|
||||
* @license http://kohanaphp.com/license.html
|
||||
*/
|
||||
class Calendar_Event_Core extends Event_Observer {
|
||||
|
||||
// Boolean conditions
|
||||
protected $booleans = array
|
||||
(
|
||||
'current',
|
||||
'weekend',
|
||||
'first_day',
|
||||
'last_day',
|
||||
'last_occurrence',
|
||||
'easter',
|
||||
);
|
||||
|
||||
// Rendering conditions
|
||||
protected $conditions = array();
|
||||
|
||||
// Cell classes
|
||||
protected $classes = array();
|
||||
|
||||
// Cell output
|
||||
protected $output = '';
|
||||
|
||||
/**
|
||||
* Adds a condition to the event. The condition can be one of the following:
|
||||
*
|
||||
* timestamp - UNIX timestamp
|
||||
* day - day number (1-31)
|
||||
* week - week number (1-5)
|
||||
* month - month number (1-12)
|
||||
* year - year number (4 digits)
|
||||
* day_of_week - day of week (1-7)
|
||||
* current - active month (boolean) (only show data for the month being rendered)
|
||||
* weekend - weekend day (boolean)
|
||||
* first_day - first day of month (boolean)
|
||||
* last_day - last day of month (boolean)
|
||||
* occurrence - occurrence of the week day (1-5) (use with "day_of_week")
|
||||
* last_occurrence - last occurrence of week day (boolean) (use with "day_of_week")
|
||||
* easter - Easter day (boolean)
|
||||
* callback - callback test (boolean)
|
||||
*
|
||||
* To unset a condition, call condition with a value of NULL.
|
||||
*
|
||||
* @chainable
|
||||
* @param string condition key
|
||||
* @param mixed condition value
|
||||
* @return object
|
||||
*/
|
||||
public function condition($key, $value)
|
||||
{
|
||||
if ($value === NULL)
|
||||
{
|
||||
unset($this->conditions[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($key === 'callback')
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
elseif (in_array($key, $this->booleans))
|
||||
{
|
||||
// Make the value boolean
|
||||
$value = (bool) $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make the value an int
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
$this->conditions[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function add_class($class)
|
||||
{
|
||||
$this->classes[$class] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function remove_class($class)
|
||||
{
|
||||
unset($this->classes[$class]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set HTML output for this event.
|
||||
*
|
||||
* @chainable
|
||||
* @param string HTML output
|
||||
* @return object
|
||||
*/
|
||||
public function output($str)
|
||||
{
|
||||
$this->output = $str;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function notify($data)
|
||||
{
|
||||
// Split the date and current status
|
||||
list ($month, $day, $year, $week, $current) = $data;
|
||||
|
||||
// Get a timestamp for the day
|
||||
$timestamp = mktime(0, 0, 0, $month, $day, $year);
|
||||
|
||||
// Date conditionals
|
||||
$condition = array
|
||||
(
|
||||
'timestamp' => (int) $timestamp,
|
||||
'day' => (int) date('j', $timestamp),
|
||||
'week' => (int) $week,
|
||||
'month' => (int) date('n', $timestamp),
|
||||
'year' => (int) date('Y', $timestamp),
|
||||
'day_of_week' => (int) date('w', $timestamp),
|
||||
'current' => (bool) $current,
|
||||
);
|
||||
|
||||
// Tested conditions
|
||||
$tested = array();
|
||||
|
||||
foreach ($condition as $key => $value)
|
||||
{
|
||||
// Timestamps need to be handled carefully
|
||||
if($key === 'timestamp' AND isset($this->conditions['timestamp']))
|
||||
{
|
||||
// This adds 23 hours, 59 minutes and 59 seconds to today's timestamp, as 24 hours
|
||||
// is classed as a new day
|
||||
$next_day = $timestamp + 86399;
|
||||
|
||||
if($this->conditions['timestamp'] < $timestamp OR $this->conditions['timestamp'] > $next_day)
|
||||
return FALSE;
|
||||
}
|
||||
// Test basic conditions first
|
||||
elseif (isset($this->conditions[$key]) AND $this->conditions[$key] !== $value)
|
||||
return FALSE;
|
||||
|
||||
// Condition has been tested
|
||||
$tested[$key] = TRUE;
|
||||
}
|
||||
|
||||
if (isset($this->conditions['weekend']))
|
||||
{
|
||||
// Weekday vs Weekend
|
||||
$condition['weekend'] = ($condition['day_of_week'] === 0 OR $condition['day_of_week'] === 6);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['first_day']))
|
||||
{
|
||||
// First day of month
|
||||
$condition['first_day'] = ($condition['day'] === 1);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['last_day']))
|
||||
{
|
||||
// Last day of month
|
||||
$condition['last_day'] = ($condition['day'] === (int) date('t', $timestamp));
|
||||
}
|
||||
|
||||
if (isset($this->conditions['occurrence']))
|
||||
{
|
||||
// Get the occurance of the current day
|
||||
$condition['occurrence'] = $this->day_occurrence($timestamp);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['last_occurrence']))
|
||||
{
|
||||
// Test if the next occurance of this date is next month
|
||||
$condition['last_occurrence'] = ((int) date('n', $timestamp + 604800) !== $condition['month']);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['easter']))
|
||||
{
|
||||
if ($condition['month'] === 3 OR $condition['month'] === 4)
|
||||
{
|
||||
// This algorithm is from Practical Astronomy With Your Calculator, 2nd Edition by Peter
|
||||
// Duffett-Smith. It was originally from Butcher's Ecclesiastical Calendar, published in
|
||||
// 1876. This algorithm has also been published in the 1922 book General Astronomy by
|
||||
// Spencer Jones; in The Journal of the British Astronomical Association (Vol.88, page
|
||||
// 91, December 1977); and in Astronomical Algorithms (1991) by Jean Meeus.
|
||||
|
||||
$a = $condition['year'] % 19;
|
||||
$b = (int) ($condition['year'] / 100);
|
||||
$c = $condition['year'] % 100;
|
||||
$d = (int) ($b / 4);
|
||||
$e = $b % 4;
|
||||
$f = (int) (($b + 8) / 25);
|
||||
$g = (int) (($b - $f + 1) / 3);
|
||||
$h = (19 * $a + $b - $d - $g + 15) % 30;
|
||||
$i = (int) ($c / 4);
|
||||
$k = $c % 4;
|
||||
$l = (32 + 2 * $e + 2 * $i - $h - $k) % 7;
|
||||
$m = (int) (($a + 11 * $h + 22 * $l) / 451);
|
||||
$p = ($h + $l - 7 * $m + 114) % 31;
|
||||
|
||||
$month = (int) (($h + $l - 7 * $m + 114) / 31);
|
||||
$day = $p + 1;
|
||||
|
||||
$condition['easter'] = ($condition['month'] === $month AND $condition['day'] === $day);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Easter can only happen in March or April
|
||||
$condition['easter'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->conditions['callback']))
|
||||
{
|
||||
// Use a callback to determine validity
|
||||
$condition['callback'] = call_user_func($this->conditions['callback'], $condition, $this);
|
||||
}
|
||||
|
||||
$conditions = array_diff_key($this->conditions, $tested);
|
||||
|
||||
foreach ($conditions as $key => $value)
|
||||
{
|
||||
if ($key === 'callback')
|
||||
{
|
||||
// Callbacks are tested on a TRUE/FALSE basis
|
||||
$value = TRUE;
|
||||
}
|
||||
|
||||
// Test advanced conditions
|
||||
if ($condition[$key] !== $value)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->caller->add_data(array
|
||||
(
|
||||
'classes' => $this->classes,
|
||||
'output' => $this->output,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the week day occurrence for a specific timestamp. The occurrence is
|
||||
* relative to the current month. For example, the second Saturday of any
|
||||
* given month will return "2" as the occurrence. This is used in combination
|
||||
* with the "occurrence" condition.
|
||||
*
|
||||
* @param integer UNIX timestamp
|
||||
* @return integer
|
||||
*/
|
||||
protected function day_occurrence($timestamp)
|
||||
{
|
||||
// Get the current month for the timestamp
|
||||
$month = date('m', $timestamp);
|
||||
|
||||
// Default occurrence is one
|
||||
$occurrence = 1;
|
||||
|
||||
// Reduce the timestamp by one week for each loop. This has the added
|
||||
// benefit of preventing an infinite loop.
|
||||
while ($timestamp -= 604800)
|
||||
{
|
||||
if (date('m', $timestamp) !== $month)
|
||||
{
|
||||
// Once the timestamp has gone into the previous month, the
|
||||
// proper occurrence has been found.
|
||||
return $occurrence;
|
||||
}
|
||||
|
||||
// Increment the occurrence
|
||||
$occurrence++;
|
||||
}
|
||||
}
|
||||
|
||||
} // End Calendar Event
|
87
modules/calendarview/libraries/PHPCalendar.php
Normal file
87
modules/calendarview/libraries/PHPCalendar.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
|
||||
class PHPCalendar_Core {
|
||||
// Month and year to use for calendaring
|
||||
protected $month;
|
||||
protected $year;
|
||||
protected $month_url;
|
||||
|
||||
// First Day of the Week (0 = Sunday or 1 = Monday).
|
||||
protected $week_start = 0;
|
||||
|
||||
// Events for the current month.
|
||||
protected $event_data = Array();
|
||||
|
||||
public function __construct($month = NULL, $year = NULL, $url = NULL)
|
||||
{
|
||||
empty($month) and $month = date('n'); // Current month
|
||||
empty($year) and $year = date('Y'); // Current year
|
||||
|
||||
// Set the month and year
|
||||
$this->month = (int) $month;
|
||||
$this->year = (int) $year;
|
||||
$this->month_url = $url;
|
||||
}
|
||||
|
||||
public function event($day_of_the_week, $event_url = NULL, $css_id = NULL, $custom_text = NULL)
|
||||
{
|
||||
$this->event_data += Array($day_of_the_week => Array($event_url, $css_id, $custom_text));
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return $this->generate_calendar($this->year, $this->month, $this->event_data, 2, $this->month_url, $this->week_start, NULL);
|
||||
}
|
||||
|
||||
# PHP Calendar (version 2.3), written by Keith Devens
|
||||
# http://keithdevens.com/software/php_calendar
|
||||
# see example at http://keithdevens.com/weblog
|
||||
# License: http://keithdevens.com/software/license
|
||||
function generate_calendar($year, $month, $days = array(), $day_name_length = 3, $month_href = NULL, $first_day = 0, $pn = array())
|
||||
{
|
||||
$first_of_month = gmmktime(0,0,0,$month,1,$year);
|
||||
#remember that mktime will automatically correct if invalid dates are entered
|
||||
# for instance, mktime(0,0,0,12,32,1997) will be the date for Jan 1, 1998
|
||||
# this provides a built in "rounding" feature to generate_calendar()
|
||||
|
||||
if ($first_day == 0) $day_names = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
|
||||
if ($first_day == 1) $day_names = array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
|
||||
|
||||
list($month, $year, $month_name, $weekday) = explode(',',gmstrftime('%m,%Y,%B,%w',$first_of_month));
|
||||
$weekday = ($weekday + 7 - $first_day) % 7; #adjust for $first_day
|
||||
$title = t(date("F", mktime(0, 0, 0, $month, 1, $year))) . ' ' . $year;
|
||||
|
||||
#Begin calendar. Uses a real <caption>. See http://diveintomark.org/archives/2002/07/03
|
||||
@list($p, $pl) = each($pn); @list($n, $nl) = each($pn); #previous and next links, if applicable
|
||||
if($p) $p = '<span class="calendar-prev">'.($pl ? '<a href="'.htmlspecialchars($pl).'">'.$p.'</a>' : $p).'</span> ';
|
||||
if($n) $n = ' <span class="calendar-next">'.($nl ? '<a href="'.htmlspecialchars($nl).'">'.$n.'</a>' : $n).'</span>';
|
||||
$calendar = '<table class="calendar" id="g-calendar-month">'."\n".
|
||||
'<td class="title" colspan="7" align="center">'.$p.($month_href ? '<a href="'. ($month_href) .'">'.$title.'</a>' : $title).$n."</td></tr>\n<tr>";
|
||||
|
||||
if($day_name_length){ #if the day names should be shown ($day_name_length > 0)
|
||||
#if day_name_length is >3, the full name of the day will be printed
|
||||
foreach($day_names as $d)
|
||||
$calendar .= '<th abbr="' . $d .'">'.t($day_name_length < 4 ? substr($d,0,$day_name_length) : $d) . '</th>';
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
|
||||
if($weekday > 0) $calendar .= '<td colspan="'.$weekday.'"> </td>'; #initial 'empty' days
|
||||
for($day=1,$days_in_month=gmdate('t',$first_of_month); $day<=$days_in_month; $day++,$weekday++){
|
||||
if($weekday == 7){
|
||||
$weekday = 0; #start a new week
|
||||
$calendar .= "</tr>\n<tr>";
|
||||
}
|
||||
if(isset($days[$day]) and is_array($days[$day])){
|
||||
@list($link, $classes, $content) = $days[$day];
|
||||
if(is_null($content)) $content = $day;
|
||||
$calendar .= '<td'.($classes ? ' class="'.htmlspecialchars($classes).'">' : '>').
|
||||
($link ? '<a href="'.htmlspecialchars($link).'">'.$content.'</a>' : $content).'</td>';
|
||||
}
|
||||
else $calendar .= "<td class=\"day\">$day</td>";
|
||||
}
|
||||
if($weekday != 7) $calendar .= '<td colspan="'.(7-$weekday).'"> </td>'; #remaining "empty" days
|
||||
|
||||
return $calendar."</tr>\n</table>\n";
|
||||
}
|
||||
}
|
||||
?>
|
5
modules/calendarview/views/calendarview_sidebar.html.php
Normal file
5
modules/calendarview/views/calendarview_sidebar.html.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<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>
|
||||
<li><a href="<?=url::site("calendarview/month/" . date("Y", $date) . "/-1/" . date("n", $date)); ?>"><?=t("More from"); ?> <?=date("F", $date); ?></a></li>
|
||||
</ul>
|
@ -1,15 +1,18 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-album-header">
|
||||
<div id="g-album-header-buttons">
|
||||
<?= $theme->dynamic_top() ?>
|
||||
</div>
|
||||
<h1><?= html::clean($title) ?></h1>
|
||||
</div>
|
||||
|
||||
<h1 align="center"><?=t($calendar_year) ?></h1>
|
||||
<?= $calendar_user_year_form ?>
|
||||
<br/><?= $calendar_user_year_form ?><br /><br />
|
||||
|
||||
<?
|
||||
print "<table><tr>";
|
||||
$counter_months = 1;
|
||||
// Loop through each month in the current year.
|
||||
// Loop through January to November in the current year.
|
||||
while ($counter_months <12) {
|
||||
print "<td>";
|
||||
$calendar = new Calendar($counter_months, $calendar_year);
|
||||
print "<div id=\"g-calendar-grid\">";
|
||||
|
||||
// Figure out if any photos were taken for the current month.
|
||||
if ($calendar_user == "-1") {
|
||||
@ -23,13 +26,19 @@
|
||||
} else {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("owner_id", "=", $calendar_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($month_count > 0) {
|
||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||
} else {
|
||||
$month_url = "";
|
||||
}
|
||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||
|
||||
// If there are photos, loop through each day in the month and display links on the correct dates.
|
||||
if ($month_count > 0) {
|
||||
@ -47,7 +56,7 @@
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("owner_id", "=", $calendar_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
||||
@ -55,11 +64,7 @@
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $curr_day)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count)));
|
||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
||||
}
|
||||
$curr_day++;
|
||||
}
|
||||
@ -84,24 +89,16 @@
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $MAX_DAYS)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count)));
|
||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
||||
}
|
||||
}
|
||||
echo $calendar->render();
|
||||
print "</td>";
|
||||
if (($counter_months == 3) || ($counter_months == 6) || ($counter_months == 9)) {
|
||||
print "</tr><tr>";
|
||||
}
|
||||
print "</div>";
|
||||
$counter_months++;
|
||||
}
|
||||
|
||||
// Do December seperately, because the mktime code is different.
|
||||
print "<td>";
|
||||
$calendar = new Calendar($counter_months, $calendar_year);
|
||||
print "<div id=\"g-calendar-grid\">";
|
||||
if ($calendar_user == "-1") {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
@ -120,6 +117,12 @@
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($month_count > 0) {
|
||||
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
|
||||
} else {
|
||||
$month_url = "";
|
||||
}
|
||||
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||
if ($month_count > 0) {
|
||||
$curr_day = 1;
|
||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
||||
@ -143,11 +146,7 @@
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $curr_day)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count)));
|
||||
$calendar->event($curr_day, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day));
|
||||
}
|
||||
$curr_day++;
|
||||
}
|
||||
@ -170,15 +169,10 @@
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $MAX_DAYS)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count)));
|
||||
|
||||
$calendar->event($MAX_DAYS, url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS));
|
||||
}
|
||||
}
|
||||
$counter_months++;
|
||||
echo $calendar->render();
|
||||
print "</td></tr></table>";
|
||||
?>
|
||||
print "</div>";
|
||||
?>
|
154
modules/calendarview/views/calpage.html.php
Normal file
154
modules/calendarview/views/calpage.html.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<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>
|
||||
<? if ($page_title): ?>
|
||||
<?= $page_title ?>
|
||||
<? else: ?>
|
||||
<? if ($theme->item()): ?>
|
||||
<? if ($theme->item()->is_album()): ?>
|
||||
<?= t("Browse Album :: %album_title", array("album_title" => $theme->item()->title)) ?>
|
||||
<? elseif ($theme->item()->is_photo()): ?>
|
||||
<?= t("Photo :: %photo_title", array("photo_title" => $theme->item()->title)) ?>
|
||||
<? else: ?>
|
||||
<?= t("Movie :: %movie_title", array("movie_title" => $theme->item()->title)) ?>
|
||||
<? endif ?>
|
||||
<? elseif ($theme->tag()): ?>
|
||||
<?= t("Browse Tag :: %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||
<?= t("Gallery") ?>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
</title>
|
||||
<link rel="shortcut icon" href="<?= url::file("lib/images/favicon.ico") ?>" type="image/x-icon" />
|
||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
||||
<?= $theme->css("gallery.common.css") ?>
|
||||
<?= $theme->css("screen.css") ?>
|
||||
<!--[if lt IE 8]>
|
||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
||||
media="screen,print,projection" />
|
||||
<![endif]-->
|
||||
<? if ($theme->page_type == "collection"): ?>
|
||||
<? if ($thumb_proportion != 1): ?>
|
||||
<? $new_width = $thumb_proportion * 213 ?>
|
||||
<? $new_height = $thumb_proportion * 240 ?>
|
||||
<style type="text/css">
|
||||
#g-content #g-album-grid .g-item {
|
||||
width: <?= $new_width ?>px;
|
||||
height: <?= $new_height ?>px;
|
||||
/* <?= $thumb_proportion ?> */
|
||||
}
|
||||
</style>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
<?= $theme->script("jquery.js") ?>
|
||||
<?= $theme->script("jquery.form.js") ?>
|
||||
<?= $theme->script("jquery-ui.js") ?>
|
||||
<?= $theme->script("gallery.common.js") ?>
|
||||
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
|
||||
<script type="text/javascript">
|
||||
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
|
||||
</script>
|
||||
<?= $theme->script("gallery.ajax.js") ?>
|
||||
<?= $theme->script("gallery.dialog.js") ?>
|
||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
||||
<?= $theme->script("jquery.localscroll.js") ?>
|
||||
<?= $theme->script("ui.init.js") ?>
|
||||
|
||||
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
|
||||
<? if ($theme->page_subtype == "photo"): ?>
|
||||
<?= $theme->script("jquery.scrollTo.js") ?>
|
||||
<?= $theme->script("gallery.show_full_size.js") ?>
|
||||
<? elseif ($theme->page_subtype == "movie"): ?>
|
||||
<?= $theme->script("flowplayer.js") ?>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->head() ?>
|
||||
</head>
|
||||
|
||||
<body <?= $theme->body_attributes() ?>>
|
||||
<?= $theme->page_top() ?>
|
||||
<div id="doc4" class="yui-t5 g-view">
|
||||
<?= $theme->site_status() ?>
|
||||
<div id="g-header" class="ui-helper-clearfix">
|
||||
<div id="g-banner">
|
||||
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
|
||||
<?= $header_text ?>
|
||||
<? else: ?>
|
||||
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
|
||||
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
|
||||
</a>
|
||||
<? endif ?>
|
||||
<?= $theme->user_menu() ?>
|
||||
<?= $theme->header_top() ?>
|
||||
|
||||
<!-- hide the menu and make it visible after the page has loaded, to minimize menu flicker -->
|
||||
<div id="g-site-menu" style="visibility: hidden">
|
||||
<?= $theme->site_menu() ?>
|
||||
</div>
|
||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
||||
|
||||
<?= $theme->header_bottom() ?>
|
||||
</div>
|
||||
|
||||
<? // The following code was modifed to allow module-defined breadcrumbs.
|
||||
// Everything else in this file is a copy of the default page.html.php file.
|
||||
?>
|
||||
<? if (!empty($breadcrumbs)): ?>
|
||||
<ul class="g-breadcrumbs">
|
||||
<? $i = 0 ?>
|
||||
<? foreach ($breadcrumbs as $breadcrumb): ?>
|
||||
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
|
||||
<!-- Adding ?show=<id> causes Gallery3 to display the page
|
||||
containing that photo. For now, we just do it for
|
||||
the immediate parent so that when you go back up a
|
||||
level you're on the right page. -->
|
||||
<? if ($breadcrumb->url) : ?>
|
||||
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
|
||||
<? else : ?>
|
||||
<?= html::purify($breadcrumb->title) ?>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? $i++ ?>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
<? // End modified code ?>
|
||||
|
||||
</div>
|
||||
<div id="bd">
|
||||
<div id="yui-main">
|
||||
<div class="yui-b">
|
||||
<div id="g-content" class="yui-g">
|
||||
<?= $theme->messages() ?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="g-sidebar" class="yui-b">
|
||||
<? if ($theme->page_subtype != "login"): ?>
|
||||
<?= new View("sidebar.html") ?>
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id="g-footer" class="ui-helper-clearfix">
|
||||
<?= $theme->footer() ?>
|
||||
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
|
||||
<?= $footer_text ?>
|
||||
<? endif ?>
|
||||
|
||||
<? if (module::get_var("gallery", "show_credits")): ?>
|
||||
<ul id="g-credits" class="g-inline">
|
||||
<?= $theme->credits() ?>
|
||||
</ul>
|
||||
<? endif ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= $theme->page_bottom() ?>
|
||||
</body>
|
||||
</html>
|
@ -1,56 +0,0 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
|
||||
// Get the day names
|
||||
$days = Calendar::days(2);
|
||||
|
||||
// Previous and next month timestamps
|
||||
$next = mktime(0, 0, 0, $month + 1, 1, $year);
|
||||
$prev = mktime(0, 0, 0, $month - 1, 1, $year);
|
||||
|
||||
// Import the GET query array locally and remove the day
|
||||
$qs = $_GET;
|
||||
unset($qs['day']);
|
||||
|
||||
// Previous and next month query URIs
|
||||
$prev = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev))));
|
||||
$next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next))));
|
||||
|
||||
?>
|
||||
<table class="calendar">
|
||||
<tr class="controls">
|
||||
<td class="title" colspan="7" align="center">
|
||||
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php print t(strftime('%B', mktime(0, 0, 0, $month, 1, $year))) . " " . t(strftime('%Y', mktime(0, 0, 0, $month, 1, $year))) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($days as $day): ?>
|
||||
<th><?php echo t($day) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php foreach ($weeks as $week): ?>
|
||||
<tr>
|
||||
<?php foreach ($week as $day):
|
||||
|
||||
list ($number, $current, $data) = $day;
|
||||
|
||||
if (is_array($data))
|
||||
{
|
||||
$classes = $data['classes'];
|
||||
$output = empty($data['output']) ? '' : '<ul class="output"><li>'.implode('</li><li>', $data['output']).'</li></ul>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$classes = array();
|
||||
$output = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<? if ($day[1] == true) { ?>
|
||||
<td class="<?php echo implode(' ', $classes) ?>"><span class="day"><?php echo $day[0] ?></span><?php echo $output ?></td>
|
||||
<? } else { ?>
|
||||
<td></td>
|
||||
<? } ?>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -2,7 +2,7 @@
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -39,7 +39,6 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
$BBCodeButton = false;
|
||||
$FullURLButton = false;
|
||||
$InPageLinks = false;
|
||||
$DialogLinks = false;
|
||||
|
||||
for ($i = 0; $i < count($linkOpts_array); $i++) {
|
||||
if ($linkOpts_array[$i] == "HTMLCode") {
|
||||
@ -56,9 +55,6 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
if ($displayType_array[$i] == "InPageLinks") {
|
||||
$InPageLinks = true;
|
||||
}
|
||||
if ($displayType_array[$i] == "DialogLinks") {
|
||||
$DialogLinks = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Save Settings.
|
||||
@ -66,7 +62,6 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
module::set_var("embedlinks", "BBCode", $BBCodeButton);
|
||||
module::set_var("embedlinks", "FullURL", $FullURLButton);
|
||||
module::set_var("embedlinks", "InPageLinks", $InPageLinks);
|
||||
module::set_var("embedlinks", "DialogLinks", $DialogLinks);
|
||||
message::success(t("Your Selection Has Been Saved."));
|
||||
|
||||
// Load Admin page.
|
||||
@ -88,7 +83,6 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
|
||||
// Make an array for the different methods of displaying the links.
|
||||
$linkDisplays["InPageLinks"] = array(t("Show Links In The Actual Page"), module::get_var("embedlinks", "InPageLinks"));
|
||||
$linkDisplays["DialogLinks"] = array(t("Show Links In a Seperate Dialog Box"), module::get_var("embedlinks", "DialogLinks"));
|
||||
|
||||
// Setup a few checkboxes on the form.
|
||||
$add_links = $form->group("EmbedLinks");
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -31,15 +31,11 @@ class embedlinks_block_Core {
|
||||
|
||||
switch ($block_id) {
|
||||
case "embed_links_dialog":
|
||||
// If displaying links in a dialog box is enabled then
|
||||
// insert buttons into the bottom of the side bar
|
||||
// to open up the dialog window.
|
||||
if (module::get_var("embedlinks", "DialogLinks") && $theme->item()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-embed-links-sidebar";
|
||||
$block->title = t("Link To This Page");
|
||||
$block->content = new View("embedlinks_sidebar.html");
|
||||
}
|
||||
// Display dialog buttons in the sidebar.
|
||||
$block = new Block();
|
||||
$block->css_id = "g-embed-links-sidebar";
|
||||
$block->title = t("Link To This Page");
|
||||
$block->content = new View("embedlinks_sidebar.html");
|
||||
break;
|
||||
|
||||
case "embed_links_album":
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
77
modules/exif_gps/helpers/exif_gps.php
Normal file
77
modules/exif_gps/helpers/exif_gps.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the API for handling exif data.
|
||||
*/
|
||||
class exif_gps_Core {
|
||||
|
||||
protected static $exif_keys;
|
||||
|
||||
static function extract($item) {
|
||||
$keys = array();
|
||||
// Extract Latitude and Longitude from the image (if they exist).
|
||||
if ($item->is_photo() && $item->mime_type == "image/jpeg") {
|
||||
$data = array();
|
||||
require_once(MODPATH . "exif/lib/exif.php");
|
||||
$exif_raw = read_exif_data_raw($item->file_path(), false);
|
||||
if (isset($exif_raw['ValidEXIFData'])) {
|
||||
foreach(self::_keys() as $field => $exifvar) {
|
||||
if (isset($exif_raw[$exifvar[0]][$exifvar[1]])) {
|
||||
$value = $exif_raw[$exifvar[0]][$exifvar[1]];
|
||||
if (function_exists("mb_detect_encoding") && mb_detect_encoding($value) != "UTF-8") {
|
||||
$value = utf8_encode($value);
|
||||
}
|
||||
$keys[$field] = Input::clean($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If coordinates were extracted, save them to the database.
|
||||
if (isset($keys["Latitude"]) && isset($keys["Longitude"])) {
|
||||
$record = ORM::factory("exif_coordinate");
|
||||
$record->item_id = $item->id;
|
||||
$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") {
|
||||
$record->latitude = "-" . $record->latitude;
|
||||
}
|
||||
if ($keys["Longitude Reference"] == "W") {
|
||||
$record->longitude = "-" . $record->longitude;
|
||||
}
|
||||
$record->save();
|
||||
}
|
||||
}
|
||||
|
||||
private static function _keys() {
|
||||
// EXIF fields to extract.
|
||||
if (!isset(self::$exif_keys)) {
|
||||
self::$exif_keys = array(
|
||||
"Latitude Reference" => array("GPS", "Latitude Reference", t("GPS: Latitude Reference"), ),
|
||||
"Longitude Reference" => array("GPS", "Longitude Reference", t("GPS: Longitude Reference"),),
|
||||
"Latitude" => array("GPS", "Latitude", t("GPS: Latitude"), ),
|
||||
"Longitude" => array("GPS", "Longitude", t("GPS: Longitude"), )
|
||||
);
|
||||
}
|
||||
return self::$exif_keys;
|
||||
}
|
||||
}
|
69
modules/exif_gps/helpers/exif_gps_block.php
Normal file
69
modules/exif_gps/helpers/exif_gps_block.php
Normal file
@ -0,0 +1,69 @@
|
||||
<?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_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("exif_gps_map" => t("EXIF GPS Map"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($block_id) {
|
||||
case "exif_gps_map":
|
||||
// Check and see if the item has exif coordinates associated with it.
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $theme->item->id)->find();
|
||||
if ($record->loaded()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-sidebar";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("exif_gps_sidebar.html");
|
||||
$block->content->latitude = $record->latitude;
|
||||
$block->content->longitude = $record->longitude;
|
||||
} elseif (module::is_active("tagsmap") && module::is_active("tag")) {
|
||||
// If there are no exif coordinates, check for tagsmap coordinates instead.
|
||||
$tagsItem = ORM::factory("tag")
|
||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||
->where("items_tags.item_id", "=", $theme->item->id)
|
||||
->find_all();
|
||||
if (count($tagsItem) > 0) {
|
||||
foreach ($tagsItem as $oneTag) {
|
||||
$tagsGPS = ORM::factory("tags_gps")->where("tag_id", "=", $oneTag->id)->find();
|
||||
if ($tagsGPS->loaded()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-sidebar";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("exif_gps_sidebar.html");
|
||||
$block->content->latitude = $tagsGPS->latitude;
|
||||
$block->content->longitude = $tagsGPS->longitude;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
90
modules/exif_gps/helpers/exif_gps_event.php
Normal file
90
modules/exif_gps/helpers/exif_gps_event.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?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_event_Core {
|
||||
static function pre_deactivate($data) {
|
||||
// If the admin is about to deactivate EXIF, warn them that this module requires it.
|
||||
if ($data->module == "exif") {
|
||||
$data->messages["warn"][] = t("The EXIF_GPS module requires the EXIF module.");
|
||||
}
|
||||
}
|
||||
|
||||
static function module_change($changes) {
|
||||
// If EXIF is deactivated, display a warning that it is required for this module to function properly.
|
||||
if (!module::is_active("exif") || in_array("exif", $changes->deactivate)) {
|
||||
site_status::warning(
|
||||
t("The EXIF_GPS module requires the EXIF module. " .
|
||||
"<a href=\"%url\">Activate the EXIF module now</a>",
|
||||
array("url" => html::mark_clean(url::site("admin/modules")))),
|
||||
"exif_gps_needs_exif");
|
||||
} else {
|
||||
site_status::clear("exif_gps_needs_exif");
|
||||
}
|
||||
}
|
||||
|
||||
static function item_created($item) {
|
||||
// Whenever a new non-album item is created, check it for GPS coordinates.
|
||||
if (!$item->is_album()) {
|
||||
exif_gps::extract($item);
|
||||
}
|
||||
}
|
||||
|
||||
static function item_deleted($item) {
|
||||
// Whenever an item is deleted, delete any corresponding GPS coordinates.
|
||||
db::build()
|
||||
->delete("exif_coordinates")
|
||||
->where("item_id", "=", $item->id)
|
||||
->execute();
|
||||
}
|
||||
|
||||
static function item_edit_form($item, $form) {
|
||||
// Allow users to set / edit the GPS coordinates associated with the current item.
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find();
|
||||
if ($record->loaded()) {
|
||||
$form->edit_item->input("latitude")->label(t("Latitude"))
|
||||
->value($record->latitude);
|
||||
$form->edit_item->input("longitude")->label(t("Longitude"))
|
||||
->value($record->longitude);
|
||||
} else {
|
||||
$form->edit_item->input("latitude")->label(t("Latitude"));
|
||||
$form->edit_item->input("longitude")->label(t("Longitude"));
|
||||
}
|
||||
}
|
||||
|
||||
static function item_edit_form_completed($item, $form) {
|
||||
// Update the db records with the user-specified coordinates.
|
||||
|
||||
// Require a set of coordinates (both latitude and longitude).
|
||||
// If one or both fields are blank, completely delete any coordinates associated with this item.
|
||||
if (($form->edit_item->latitude->value == "") || ($form->edit_item->longitude->value == "")) {
|
||||
db::build()
|
||||
->delete("exif_coordinates")
|
||||
->where("item_id", "=", $item->id)
|
||||
->execute();
|
||||
} else {
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find();
|
||||
if (!$record->loaded()) {
|
||||
$record->item_id = $item->id;
|
||||
}
|
||||
$record->latitude = $form->edit_item->latitude->value;
|
||||
$record->longitude = $form->edit_item->longitude->value;
|
||||
$record->save();
|
||||
}
|
||||
}
|
||||
}
|
46
modules/exif_gps/helpers/exif_gps_installer.php
Normal file
46
modules/exif_gps/helpers/exif_gps_installer.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?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_installer {
|
||||
static function install() {
|
||||
// Create a table to store GPS data in.
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {exif_coordinates} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`item_id` int(9) NOT NULL,
|
||||
`latitude` varchar(128) NOT NULL,
|
||||
`longitude` varchar(128) NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY(`item_id`, `id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
module::set_version("exif_gps", 1);
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("exif_gps_needs_exif");
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
// Delete the GPS table before uninstalling.
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS {exif_coordinates};");
|
||||
module::delete("exif_gps");
|
||||
}
|
||||
}
|
90
modules/exif_gps/helpers/exif_gps_task.php
Normal file
90
modules/exif_gps/helpers/exif_gps_task.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?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_task_Core {
|
||||
static function available_tasks() {
|
||||
// Automatically delete extra exif_coordinates whenever the maintance screen is loaded.
|
||||
db::build()
|
||||
->delete("exif_coordinates")
|
||||
->where("item_id", "NOT IN",
|
||||
db::build()->select("id")->from("items"))
|
||||
->execute();
|
||||
|
||||
// Display an option on the maintance screen for scanning existing photos
|
||||
// for GPS data (in case photos were uploaded before the module was active).
|
||||
return array(Task_Definition::factory()
|
||||
->callback("exif_gps_task::update_gps_index")
|
||||
->name(t("Extract Exif GPS data"))
|
||||
->description(t("Scan all photos for missing GPS data"))
|
||||
->severity(log::SUCCESS));
|
||||
}
|
||||
|
||||
static function update_gps_index($task) {
|
||||
$start = microtime(true);
|
||||
|
||||
// Figure out the total number of photos in the database.
|
||||
// If this is the first run, also set last_id and completed to 0.
|
||||
$total = $task->get("total");
|
||||
if (empty($total)) {
|
||||
$task->set("total", $total = count(ORM::factory("item")->where("type", "=", "photo")->find_all()));
|
||||
$task->set("last_id", 0);
|
||||
$task->set("completed", 0);
|
||||
}
|
||||
$last_id = $task->get("last_id");
|
||||
$completed = $task->get("completed");
|
||||
|
||||
// Generate an array of the next 100 photos to check.
|
||||
$all_photos = ORM::factory("item")
|
||||
->where("id", ">", $last_id)
|
||||
->where("type", "=", "photo")
|
||||
->find_all(100);
|
||||
|
||||
// Check each photo in the array to see if it already has exif gps data associated with it.
|
||||
// If it doesn't, attempt to extract gps coordinates.
|
||||
foreach (ORM::factory("item")
|
||||
->where("id", ">", $last_id)
|
||||
->where("type", "=", "photo")
|
||||
->find_all(100) as $item) {
|
||||
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find();
|
||||
if (!$record->loaded()) {
|
||||
exif_gps::extract($item);
|
||||
}
|
||||
$last_id = $item->id;
|
||||
$completed++;
|
||||
|
||||
if ($completed == $total || microtime(true) - $start > 1.5) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$task->set("completed", $completed);
|
||||
$task->set("last_id", $last_id);
|
||||
|
||||
if ($total == $completed) {
|
||||
$task->done = true;
|
||||
$task->state = "success";
|
||||
$task->percent_complete = 100;
|
||||
} else {
|
||||
$task->percent_complete = round(100 * $completed / $total);
|
||||
}
|
||||
$task->status = t2("One photo scanned", "%count / %total photos scanned", $completed,
|
||||
array("total" => $total));
|
||||
}
|
||||
}
|
21
modules/exif_gps/models/exif_coordinate.php
Normal file
21
modules/exif_gps/models/exif_coordinate.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?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_Coordinate_Model extends ORM {
|
||||
}
|
3
modules/exif_gps/module.info
Normal file
3
modules/exif_gps/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "Exif GPS Data"
|
||||
description = "Extract Exif GPS data from photos."
|
||||
version = 1
|
3
modules/exif_gps/views/exif_gps_sidebar.html.php
Normal file
3
modules/exif_gps/views/exif_gps_sidebar.html.php
Normal file
@ -0,0 +1,3 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=14&size=205x214&maptype=roadmap&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false">
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#Tue Jan 26 16:51:26 NZDT 2010
|
||||
#Thu Feb 11 15:27:06 NZDT 2010
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -33,6 +33,13 @@ class Admin_Upload_Configure_Controller extends Controller
|
||||
|
||||
upload_configuration::extractForm($form);
|
||||
message::success(t("GWTOrganise Module Configured!"));
|
||||
print json_encode(array("result" => "success"));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -147,6 +147,7 @@ class Json_Album_Controller extends Controller {
|
||||
}
|
||||
|
||||
public function add_photo($id) {
|
||||
|
||||
access::verify_csrf();
|
||||
$album = ORM::factory("item", $id);
|
||||
access::required("view", $album);
|
||||
@ -180,40 +181,32 @@ class Json_Album_Controller extends Controller {
|
||||
|
||||
fclose($file);
|
||||
|
||||
$item = ORM::factory("item");
|
||||
$item->name = basename($temp_filename); // Skip unique identifier Kohana adds
|
||||
$item->title = item::convert_filename_to_title($item->name);
|
||||
$item->parent_id = $album->id;
|
||||
$item->set_data_file($temp_filename);
|
||||
|
||||
|
||||
$title = item::convert_filename_to_title($name);
|
||||
$path_info = @pathinfo($temp_filename);
|
||||
if (array_key_exists("extension", $path_info) &&
|
||||
in_array(strtolower($path_info["extension"]), array("flv", "mp4"))) {
|
||||
$item = ORM::factory("item");
|
||||
$item->type = "movie";
|
||||
$item->parent_id = $album->id;
|
||||
$item->set_data_file($temp_filename);
|
||||
$item->name = $name;
|
||||
$item->title = $title;
|
||||
$item->save();
|
||||
log::success("content", t("Added a movie"),
|
||||
html::anchor("movies/$item->id", t("view movie")));
|
||||
} else {
|
||||
$item = ORM::factory("item");
|
||||
$item->type = "photo";
|
||||
$item->parent_id = $album->id;
|
||||
$item->set_data_file($temp_filename);
|
||||
$item->name = $name;
|
||||
$item->title = $title;
|
||||
$item->save();
|
||||
log::success("content", t("Added a photo"),
|
||||
html::anchor("photos/$item->id", t("view photo")));
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
|
||||
} catch (Exception $e) {
|
||||
Kohana::log("alert", $e->__toString());
|
||||
if (file_exists($temp_filename)) {
|
||||
unlink($temp_filename);
|
||||
}
|
||||
header("HTTP/1.1 500 Internal Server Error");
|
||||
print "ERROR: " . $e->getMessage();
|
||||
return;
|
||||
throw new Kohana_Exception('Problem creating file.'. $e->__toString());
|
||||
}
|
||||
unlink($temp_filename);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
@ -19,16 +19,13 @@
|
||||
*/
|
||||
|
||||
class gwtorganise_event_Core{
|
||||
/**
|
||||
* adds the shopping basket administration controls to the admin menu
|
||||
*/
|
||||
static function admin_menu($menu, $theme){
|
||||
|
||||
|
||||
$menu->add_after("users_groups",
|
||||
Menu::factory("link")
|
||||
static function admin_menu($menu, $theme) {
|
||||
$menu->add_after("dashboard",
|
||||
Menu::factory("link")
|
||||
->id("gwtorganise")
|
||||
->label(t("GWT Organise"))
|
||||
->url(url::site("admin/gwtorganise")));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
* 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
|
||||
|
@ -29,5 +29,5 @@
|
||||
<when-property-is name="user.agent" value="ie8" />
|
||||
</any>
|
||||
</replace-with>
|
||||
|
||||
|
||||
</module>
|
||||
|
@ -54,14 +54,15 @@ public class Album extends TreeItem {
|
||||
|
||||
private final Map<Integer, Album> m_IDtoAlbum = new HashMap<Integer, Album>();
|
||||
|
||||
private final LinkedList<UploadFile> m_UploadQueue = new LinkedList<UploadFile>();
|
||||
|
||||
private boolean m_Running = false;
|
||||
private final Set<UploadFile> m_AllUploads = new HashSet<UploadFile>();
|
||||
|
||||
private final AlbumTreeDropController m_DropController;
|
||||
|
||||
private final UploadControl m_UploadControl;
|
||||
|
||||
public Album(JSONObject jsonObject, G3Viewer a_Container)
|
||||
{
|
||||
m_UploadControl = a_Container.getUploadControl();
|
||||
m_ID = Utils.extractId(jsonObject.get("id"));
|
||||
m_Title = ((JSONString)jsonObject.get("title")).stringValue();
|
||||
m_Sort = ((JSONString)jsonObject.get("sort")).stringValue();
|
||||
@ -75,6 +76,7 @@ public class Album extends TreeItem {
|
||||
|
||||
public Album(G3Viewer a_Container)
|
||||
{
|
||||
m_UploadControl = a_Container.getUploadControl();
|
||||
m_ID = 1;
|
||||
m_Title = "Root";
|
||||
m_Container = a_Container;
|
||||
@ -109,7 +111,7 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
updateValues(aValue);
|
||||
}
|
||||
},false);
|
||||
},false,true);
|
||||
}
|
||||
|
||||
|
||||
@ -281,7 +283,7 @@ public class Album extends TreeItem {
|
||||
m_View.getCurrentAlbum().expand();
|
||||
m_View.getCurrentAlbum().select();
|
||||
}
|
||||
},true);
|
||||
},true,true);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -300,7 +302,7 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
m_View.getCurrentAlbum().select();
|
||||
}
|
||||
},true);
|
||||
},true,true);
|
||||
}
|
||||
|
||||
|
||||
@ -331,7 +333,7 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
addAlbums(aValue);
|
||||
}
|
||||
},false);
|
||||
},false,true);
|
||||
}
|
||||
|
||||
|
||||
@ -344,7 +346,7 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
viewAlbum(aValue);
|
||||
}
|
||||
},false);
|
||||
},false,true);
|
||||
|
||||
}
|
||||
|
||||
@ -433,68 +435,53 @@ public class Album extends TreeItem {
|
||||
ResizeOptions ro = new ResizeOptions(jso);
|
||||
UploadFile uf;
|
||||
for (File file : files){
|
||||
uf = new UploadFile(Album.this, file, ro);
|
||||
uf = m_UploadControl.createUploadFile(Album.this, file, ro);
|
||||
m_AllUploads.add(uf);
|
||||
m_View.addToView(uf);
|
||||
m_UploadQueue.addLast(uf);
|
||||
m_Container.addUpload(uf);
|
||||
}
|
||||
|
||||
if (!m_Running){
|
||||
m_Running = true;
|
||||
next();
|
||||
}
|
||||
m_Container.updateInformation();
|
||||
}
|
||||
}
|
||||
},false);
|
||||
},false,true);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void addPendingDownloads()
|
||||
public void removeUpload(UploadFile a_Uf)
|
||||
{
|
||||
for (UploadFile uf: m_UploadQueue)
|
||||
{
|
||||
m_View.addToView(uf);
|
||||
}
|
||||
m_AllUploads.remove(a_Uf);
|
||||
}
|
||||
|
||||
public void finishedUpload(UploadFile uf, JSONValue a_Return)
|
||||
{
|
||||
m_UploadQueue.remove(uf);
|
||||
m_Container.removeUpload(uf);
|
||||
next();
|
||||
|
||||
public void replaceUpload(UploadFile a_Uf, JSONValue a_Return)
|
||||
{
|
||||
m_AllUploads.remove(a_Uf);
|
||||
|
||||
JSONObject jo = a_Return.isObject();
|
||||
|
||||
if (jo != null){
|
||||
Item item = new Item(this,jo,m_Container);
|
||||
m_IDtoItem.put(item.getID(), item);
|
||||
m_Items.add(item);
|
||||
|
||||
|
||||
if (m_View.getCurrentAlbum() == this){
|
||||
m_View.replaceInView(uf, item);
|
||||
m_View.replaceInView(a_Uf, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_View.getCurrentAlbum() == this){
|
||||
m_View.removeFromView(uf);
|
||||
m_View.removeFromView(a_Uf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void next()
|
||||
public void addPendingDownloads()
|
||||
{
|
||||
if (m_UploadQueue.size() > 0)
|
||||
for (UploadFile uf: m_AllUploads)
|
||||
{
|
||||
UploadFile uf = m_UploadQueue.getFirst();
|
||||
uf.startUpload();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Running = false;
|
||||
m_View.addToView(uf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -30,29 +30,28 @@ public class AsyncResizer implements RunAsyncCallback{
|
||||
Canvas upThumb = com.gloopics.g3viewer.client.canvas.Factory.getInstance().createCanvas();
|
||||
upThumb.decode(m_Blob);
|
||||
|
||||
float imageWidth = (float)upThumb.getWidth();
|
||||
float imageHeight = (float)upThumb.getHeight();
|
||||
|
||||
int imageWidth = upThumb.getWidth();
|
||||
int imageHeight = upThumb.getHeight();
|
||||
|
||||
int widthRatio = imageWidth/m_ResizeOptions.getMaxWidth();
|
||||
int heightRatio = imageHeight/m_ResizeOptions.getMaxHeight();
|
||||
float widthRatio = imageWidth/((float)m_ResizeOptions.getMaxWidth());
|
||||
float heightRatio = imageHeight/((float)m_ResizeOptions.getMaxHeight());
|
||||
|
||||
if (widthRatio > heightRatio){
|
||||
if (widthRatio > 1) {
|
||||
upThumb.resize(m_ResizeOptions.getMaxWidth(), imageHeight / widthRatio );
|
||||
upThumb.resize(m_ResizeOptions.getMaxWidth(), (int)(imageHeight / widthRatio) );
|
||||
m_UploadFile.uploadBlob(upThumb.encode());
|
||||
return;
|
||||
}
|
||||
m_UploadFile.uploadBlob(m_Blob);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (heightRatio > 1){
|
||||
upThumb.resize(imageWidth / heightRatio, m_ResizeOptions.getMaxHeight());
|
||||
upThumb.resize((int)(imageWidth / heightRatio), m_ResizeOptions.getMaxHeight());
|
||||
m_UploadFile.uploadBlob(upThumb.encode());
|
||||
return;
|
||||
}
|
||||
m_UploadFile.uploadBlob(m_Blob);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import com.google.gwt.core.client.RunAsyncCallback;
|
||||
|
||||
public class AsyncRunner implements RunAsyncCallback{
|
||||
|
||||
private final Runnable m_Runnable;
|
||||
|
||||
public AsyncRunner(Runnable a_Runnable){
|
||||
m_Runnable = a_Runnable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable reason) {
|
||||
G3Viewer.displayError("Error Running Async", reason.toString());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
m_Runnable.run();
|
||||
}
|
||||
}
|
@ -61,7 +61,9 @@ public class G3Viewer {
|
||||
|
||||
DockPanel dp = new DockPanel();
|
||||
dp.addStyleName("error");
|
||||
dp.add(new HTML(error), DockPanel.CENTER);
|
||||
|
||||
error = error.replaceAll("<", "<").replaceAll(">", ">");
|
||||
dp.add(new HTML("<pre>" + error + "</pre>"), DockPanel.CENTER);
|
||||
|
||||
|
||||
// DialogBox is a SimplePanel, so you have to set its widget property to
|
||||
@ -154,7 +156,7 @@ public class G3Viewer {
|
||||
/**
|
||||
* the only dialog box
|
||||
*/
|
||||
private final HttpDialogBox m_HttpDialogBox= new HttpDialogBox();
|
||||
private final HttpDialogBox m_HttpDialogBox= new HttpDialogBox(this);
|
||||
|
||||
private class SimplePanelEx extends SimplePanel
|
||||
{
|
||||
@ -223,6 +225,11 @@ public class G3Viewer {
|
||||
*/
|
||||
private final PickupDragController m_DragController;
|
||||
|
||||
/**
|
||||
* the upload control
|
||||
*/
|
||||
private final UploadControl m_UploadControl;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*/
|
||||
@ -232,14 +239,19 @@ public class G3Viewer {
|
||||
m_DragController.setBehaviorMultipleSelection(true);
|
||||
m_DragController.setBehaviorDragStartSensitivity(5);
|
||||
m_DragController.setBehaviorDragProxy(true);
|
||||
|
||||
m_InfoBar = new InformationBar(this);
|
||||
m_UploadControl = new UploadControl(this);
|
||||
m_InfoBar = new InformationBar(this, m_UploadControl);
|
||||
m_Tree = new AlbumTree(this);
|
||||
|
||||
|
||||
checkAdmin();
|
||||
}
|
||||
|
||||
public UploadControl getUploadControl()
|
||||
{
|
||||
return m_UploadControl;
|
||||
}
|
||||
|
||||
public static String getCSRF()
|
||||
{
|
||||
return m_CSRF;
|
||||
@ -275,7 +287,7 @@ public class G3Viewer {
|
||||
}
|
||||
});
|
||||
}
|
||||
},false);
|
||||
},false,true);
|
||||
}
|
||||
|
||||
|
||||
@ -307,15 +319,10 @@ public class G3Viewer {
|
||||
return m_View;
|
||||
}
|
||||
|
||||
public void addUpload(UploadFile a_UF){
|
||||
m_InfoBar.addUpload(a_UF);
|
||||
public void updateInformation(){
|
||||
m_InfoBar.updateInformation();
|
||||
}
|
||||
|
||||
public void removeUpload(UploadFile a_UF){
|
||||
m_InfoBar.removeUpload(a_UF);
|
||||
}
|
||||
|
||||
|
||||
public void doDialog(String a_Url, HttpDialogHandler a_Handler)
|
||||
{
|
||||
m_HttpDialogBox.doDialog(BASE_URL + a_Url, a_Handler);
|
||||
@ -326,10 +333,16 @@ public class G3Viewer {
|
||||
m_ImageDialogBox.doDialog( a_Url);
|
||||
}
|
||||
|
||||
public void doJSONRequest(final String a_URL, final HttpSuccessHandler a_Handler, final boolean a_hasParams){
|
||||
public void doJSONRequest(final String a_URL, final HttpSuccessHandler a_Handler, final boolean a_hasParams, final boolean a_IncludeCSRF){
|
||||
doJSONRequest(a_URL, a_Handler, a_hasParams, a_IncludeCSRF, "");
|
||||
}
|
||||
|
||||
|
||||
public void doJSONRequest(final String a_URL, final HttpSuccessHandler a_Handler, final boolean a_hasParams, final boolean a_IncludeCSRF,
|
||||
String a_Data ){
|
||||
try {
|
||||
String url;
|
||||
if (m_CSRF != null)
|
||||
if (m_CSRF != null && a_IncludeCSRF)
|
||||
{
|
||||
url = a_URL + (a_hasParams?"&csrf=":"?csrf=") + m_CSRF;
|
||||
}
|
||||
@ -338,7 +351,9 @@ public class G3Viewer {
|
||||
url = a_URL;
|
||||
}
|
||||
RequestBuilder requestBuilder = new RequestBuilder(
|
||||
RequestBuilder.GET, url);
|
||||
RequestBuilder.POST, url);
|
||||
requestBuilder.setHeader("Content-Type", "application/x-www-form-urlencoded");
|
||||
requestBuilder.setHeader("X-Requested-With", "XMLHttpRequest");
|
||||
requestBuilder.setCallback(new JSONResponseTextHandler(
|
||||
new JSONResponseCallback() {
|
||||
|
||||
@ -370,6 +385,7 @@ public class G3Viewer {
|
||||
}}
|
||||
));
|
||||
|
||||
requestBuilder.setRequestData(a_Data);
|
||||
requestBuilder.send();
|
||||
} catch (RequestException ex) {
|
||||
displayError("Request Exception", ex.toString() + " - " + a_URL);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user