Merge pull request #112 from rWatcher/master
Virtual Album Updates for CalendarView, Tag Albums, new module Fotomoto rW
This commit is contained in:
commit
877dbda7c4
@ -18,17 +18,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class CalendarView_Controller extends Controller {
|
||||
public function calendar($display_year="", $display_user="") {
|
||||
public function calendar($display_year="", $display_user="-1") {
|
||||
// Draw a calendar for the year specified by $display_year.
|
||||
|
||||
// Make sure the function parameters aren't null,
|
||||
// give them default values if they are.
|
||||
// Display the current year by default if a year wasn't provided.
|
||||
if ($display_year == "") {
|
||||
$display_year = date('Y');
|
||||
}
|
||||
if ($display_user == "") {
|
||||
$display_user = "-1";
|
||||
}
|
||||
|
||||
// Draw the page.
|
||||
$root = item::root();
|
||||
@ -50,26 +46,16 @@ class CalendarView_Controller extends Controller {
|
||||
public function day($display_year, $display_user, $display_month, $display_day) {
|
||||
// Display all images for the specified day.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", "=", $display_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
// Set up default search conditions for retrieving all photos from the specified day.
|
||||
$where = array(array("type", "!=", "album"));
|
||||
if ($display_user != "-1") {
|
||||
$where[] = array("owner_id", "=", $display_user);
|
||||
}
|
||||
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year));
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = calendarview::get_items_count($where);
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
@ -83,25 +69,7 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
$children = "";
|
||||
if ($display_user == "-1") {
|
||||
$children = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->order_by("captured", "ASC")
|
||||
->find_all($page_size, $offset);
|
||||
} else {
|
||||
$children = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", "=", $display_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->order_by("captured", "ASC")
|
||||
->find_all($page_size, $offset);
|
||||
}
|
||||
$children = calendarview::get_items($page_size, $offset, $where);
|
||||
|
||||
// Create and display the page.
|
||||
$root = item::root();
|
||||
@ -121,31 +89,46 @@ class CalendarView_Controller extends Controller {
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
item::set_display_context_callback("CalendarView_Controller::get_display_day_context", $display_user, $display_year, $display_month, $display_day);
|
||||
}
|
||||
|
||||
static function get_display_day_context($item, $display_user, $display_year, $display_month, $display_day) {
|
||||
// Set up default search conditions for retrieving all photos from the specified day.
|
||||
$where = array(array("type", "!=", "album"));
|
||||
if ($display_user != "-1") {
|
||||
$where[] = array("owner_id", "=", $display_user);
|
||||
}
|
||||
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year));
|
||||
|
||||
// Generate breadcrumbs for the photo page.
|
||||
$root = item::root();
|
||||
$breadcrumbs = array(
|
||||
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month)),
|
||||
Breadcrumb::instance($display_day, url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month . "/" . $display_day)),
|
||||
Breadcrumb::instance($item->title, $item->url())->set_last()
|
||||
);
|
||||
|
||||
return CalendarView_Controller::get_display_context($item, $where, $breadcrumbs);
|
||||
}
|
||||
|
||||
public function month($display_year, $display_user, $display_month) {
|
||||
// Display all images for the specified month.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", "=", $display_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
// Set up default search conditions for retrieving all photos from the specified month.
|
||||
$where = array(array("type", "!=", "album"));
|
||||
if ($display_user != "-1") {
|
||||
$where[] = array("owner_id", "=", $display_user);
|
||||
}
|
||||
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year));
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = calendarview::get_items_count($where);
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
@ -159,25 +142,7 @@ class CalendarView_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
$children = "";
|
||||
if ($display_user == "-1") {
|
||||
$children = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->order_by("captured", "ASC")
|
||||
->find_all($page_size, $offset);
|
||||
} else {
|
||||
$children = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", "=", $display_user)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->order_by("captured", "ASC")
|
||||
->find_all($page_size, $offset);
|
||||
}
|
||||
$children = calendarview::get_items($page_size, $offset, $where);
|
||||
|
||||
// Create and display the page.
|
||||
$root = item::root();
|
||||
@ -196,6 +161,53 @@ class CalendarView_Controller extends Controller {
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
print $template;
|
||||
|
||||
// Set up breadcrumbs for the photo pages to point back to the calendar month view.
|
||||
item::set_display_context_callback("CalendarView_Controller::get_display_month_context", $display_user, $display_year, $display_month);
|
||||
}
|
||||
|
||||
static function get_display_month_context($item, $display_user, $display_year, $display_month) {
|
||||
// Set up default search conditions for retrieving all photos from the specified month.
|
||||
$where = array(array("type", "!=", "album"));
|
||||
if ($display_user != "-1") {
|
||||
$where[] = array("owner_id", "=", $display_user);
|
||||
}
|
||||
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year));
|
||||
|
||||
// Generate breadcrumbs for the photo page.
|
||||
$root = item::root();
|
||||
$breadcrumbs = array(
|
||||
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month)),
|
||||
Breadcrumb::instance($item->title, $item->url())->set_last()
|
||||
);
|
||||
|
||||
return CalendarView_Controller::get_display_context($item, $where, $breadcrumbs);
|
||||
}
|
||||
|
||||
private function get_display_context($item, $where=array(), $breadcrumbs=array()) {
|
||||
// Set up previous / next / breadcrumbs / etc to point to CalendarView instead of the album.
|
||||
|
||||
// Figure out the photo's position.
|
||||
$position = calendarview::get_position($item, $where);
|
||||
|
||||
// Figure out the previous and next items.
|
||||
if ($position > 1) {
|
||||
list ($previous_item, $ignore, $next_item) = calendarview::get_items(3, $position - 2, $where);
|
||||
} else {
|
||||
list ($next_item) = calendarview::get_items(1, $position, $where);
|
||||
}
|
||||
|
||||
// Figure out the total number of photos.
|
||||
$sibling_count = calendarview::get_items_count($where);
|
||||
|
||||
return array("position" => $position,
|
||||
"previous_item" => $previous_item,
|
||||
"next_item" => $next_item,
|
||||
"sibling_count" => $sibling_count,
|
||||
"breadcrumbs" => $breadcrumbs);
|
||||
}
|
||||
|
||||
private function _get_calenderprefs_form($display_year, $display_user) {
|
||||
@ -224,7 +236,6 @@ class CalendarView_Controller extends Controller {
|
||||
$valid_years = Array();
|
||||
$all_photos = ORM::factory("item")
|
||||
->viewable()
|
||||
//->where("owner_id", "=", $one_user->id)
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", "!=", "")
|
||||
->order_by("captured", "DESC")
|
||||
|
48
3.0/modules/calendarview/helpers/calendarview.php
Normal file
48
3.0/modules/calendarview/helpers/calendarview.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2012 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_Core {
|
||||
static function get_items_count($where=array()) {
|
||||
// Returns the number of viewable items identified by $where.
|
||||
return ORM::factory("item")
|
||||
->viewable()
|
||||
->merge_where($where)
|
||||
->order_by("captured", "ASC")
|
||||
->count_all();
|
||||
}
|
||||
|
||||
static function get_items($limit=null, $offset=null, $where=array()) {
|
||||
// Returns the items identified by $where, up to $limit, and starting at $offset.
|
||||
return ORM::factory("item")
|
||||
->viewable()
|
||||
->merge_where($where)
|
||||
->order_by("captured", "ASC")
|
||||
->find_all($limit, $offset);
|
||||
}
|
||||
|
||||
static function get_position($item, $where=array()) {
|
||||
// Get's $item's position within $where.
|
||||
return ORM::factory("item")
|
||||
->viewable()
|
||||
->merge_where($where)
|
||||
->where("items.id", "<=", $item->id)
|
||||
->order_by("captured", "ASC")
|
||||
->count_all();
|
||||
}
|
||||
}
|
111
3.0/modules/fotomotorw/controllers/admin_fotomotorw.php
Normal file
111
3.0/modules/fotomotorw/controllers/admin_fotomotorw.php
Normal file
@ -0,0 +1,111 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class Admin_FotomotorW_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
// Display the admin page.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t("Fotomoto");
|
||||
$view->content = new View("admin_fotomotorw.html");
|
||||
|
||||
// Generate a form to allow the user to choose which links to display under photos.
|
||||
$form = new Forge("admin/fotomotorw/savedisplay", "", "post",
|
||||
array("id" => "g-fotomotorw-admin-display-prefs"));
|
||||
|
||||
$display_links_group = $form->group("fotomoto_display_links_group");
|
||||
$link_options["fotomoto_buy_prints"] = array(t("Buy Prints"), module::get_var("fotomotorw", "fotomoto_buy_prints"));
|
||||
$link_options["fotomoto_buy_cards"] = array(t("Buy Cards"), module::get_var("fotomotorw", "fotomoto_buy_cards"));
|
||||
$link_options["fotomoto_buy_download"] = array(t("Download"), module::get_var("fotomotorw", "fotomoto_buy_download"));
|
||||
$link_options["fotomoto_share_ecard"] = array(t("Send eCard"), module::get_var("fotomotorw", "fotomoto_share_ecard"));
|
||||
$link_options["fotomoto_share_facebook"] = array(t("Share on Facebook"), module::get_var("fotomotorw", "fotomoto_share_facebook"));
|
||||
$link_options["fotomoto_share_twitter"] = array(t("Share on Twitter"), module::get_var("fotomotorw", "fotomoto_share_twitter"));
|
||||
$link_options["fotomoto_share_digg"] = array(t("Share on Digg"), module::get_var("fotomotorw", "fotomoto_share_digg"));
|
||||
|
||||
// Turn the array into a series of checkboxes.
|
||||
$display_links_group->checklist("fotomoto_display_links")
|
||||
->options($link_options);
|
||||
|
||||
// Add a save button to the form.
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
|
||||
$view->content->display_form = $form;
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function reset_private_key() {
|
||||
// Generate a new (random) private key.
|
||||
module::set_var("fotomotorw", "fotomoto_private_key", md5(random::hash() . access::private_key()));
|
||||
message::success(t("Your Photomoto private key has been reset."));
|
||||
url::redirect("admin/fotomotorw");
|
||||
}
|
||||
|
||||
public function savedisplay() {
|
||||
// Save the admin's preferences for which fotomoto links to display under each photo.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Figure out which boxes where checked
|
||||
$linkOptions_array = Input::instance()->post("fotomoto_display_links");
|
||||
$buy_prints = false;
|
||||
$buy_cards = false;
|
||||
$buy_download = false;
|
||||
$share_ecard = false;
|
||||
$share_facebook = false;
|
||||
$share_twitter = false;
|
||||
$share_digg = false;
|
||||
for ($i = 0; $i < count($linkOptions_array); $i++) {
|
||||
if ($linkOptions_array[$i] == "fotomoto_buy_prints") {
|
||||
$buy_prints = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_buy_cards") {
|
||||
$buy_cards = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_buy_download") {
|
||||
$buy_download = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_share_ecard") {
|
||||
$share_ecard = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_share_facebook") {
|
||||
$share_facebook = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_share_twitter") {
|
||||
$share_twitter = true;
|
||||
}
|
||||
if ($linkOptions_array[$i] == "fotomoto_share_digg") {
|
||||
$share_digg = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Save Settings.
|
||||
module::set_var("fotomotorw", "fotomoto_buy_prints", $buy_prints);
|
||||
module::set_var("fotomotorw", "fotomoto_buy_cards", $buy_cards);
|
||||
module::set_var("fotomotorw", "fotomoto_buy_download", $buy_download);
|
||||
module::set_var("fotomotorw", "fotomoto_share_ecard", $share_ecard);
|
||||
module::set_var("fotomotorw", "fotomoto_share_facebook", $share_facebook);
|
||||
module::set_var("fotomotorw", "fotomoto_share_twitter", $share_twitter);
|
||||
module::set_var("fotomotorw", "fotomoto_share_digg", $share_digg);
|
||||
|
||||
// Display a success message and reload the admin page.
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
url::redirect("admin/fotomotorw");
|
||||
}
|
||||
}
|
76
3.0/modules/fotomotorw/controllers/fotomotorw.php
Normal file
76
3.0/modules/fotomotorw/controllers/fotomotorw.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2012 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 FotomotorW_Controller extends Controller {
|
||||
public function resize($item_id) {
|
||||
// Displayed the "resized" version of an image by it's ID number.
|
||||
// This both gives fotomoto access to resizes regardless of permissions
|
||||
// and forces fotomoto to track images by unique id instead of file name
|
||||
// which is necessary for auto-pickup.
|
||||
|
||||
// Load the photo from the provided id#. If invalid, display a 404 error.
|
||||
$item = ORM::factory("item", $item_id);
|
||||
if (!$item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// If the resize file doesn't exist for some reason, display a 404 error.
|
||||
if (!file_exists($item->resize_path())) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Display the image.
|
||||
header("Content-Type: {$item->mime_type}");
|
||||
Kohana::close_buffers(false);
|
||||
$fd = fopen($item->resize_path(), "rb");
|
||||
fpassthru($fd);
|
||||
fclose($fd);
|
||||
}
|
||||
|
||||
public function print_proxy($site_key, $file_id) {
|
||||
// This function retrieves the full-sized image for fotomoto.
|
||||
// As this function by-passes normal Gallery security, a private
|
||||
// site-key is used to try and prevent people other then fotomoto
|
||||
// from finding the URL.
|
||||
|
||||
// If the site key doesn't match, display a 404 error.
|
||||
if ($site_key != module::get_var("fotomotorw", "fotomoto_private_key")) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Load the photo from the provided id. If the id# is invalid, display a 404 error.
|
||||
$item = ORM::factory("item", $file_id);
|
||||
if (!$item->loaded()) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// If the image file doesn't exist for some reason, display a 404 error.
|
||||
if (!file_exists($item->file_path())) {
|
||||
throw new Kohana_404_Exception();
|
||||
}
|
||||
|
||||
// Display the image.
|
||||
header("Content-Type: {$item->mime_type}");
|
||||
Kohana::close_buffers(false);
|
||||
$fd = fopen($item->file_path(), "rb");
|
||||
fpassthru($fd);
|
||||
fclose($fd);
|
||||
}
|
||||
}
|
@ -17,15 +17,14 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Tag_Albums_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 = 1;
|
||||
public $url = "";
|
||||
|
||||
public function __construct($new_title, $new_url) {
|
||||
$this->title = $new_title;
|
||||
$this->url = $new_url;
|
||||
class fotomotorw_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
// Display an option under the admin Settings menu.
|
||||
$menu->get("settings_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("fotomotorw_menu")
|
||||
->label(t("Fotomoto"))
|
||||
->url(url::site("admin/fotomotorw")));
|
||||
}
|
||||
}
|
35
3.0/modules/fotomotorw/helpers/fotomotorw_installer.php
Normal file
35
3.0/modules/fotomotorw/helpers/fotomotorw_installer.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2012 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 fotomotorw_installer {
|
||||
static function install() {
|
||||
// Set up some default values.
|
||||
module::set_var("fotomotorw", "fotomoto_site_key", '');
|
||||
module::set_var("fotomotorw", "fotomoto_private_key", md5(random::hash() . access::private_key()));
|
||||
module::set_var("fotomotorw", "fotomoto_buy_prints", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_buy_cards", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_buy_download", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_share_ecard", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_share_facebook", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_share_twitter", 1);
|
||||
module::set_var("fotomotorw", "fotomoto_share_digg", 1);
|
||||
module::set_version("fotomotorw", 1);
|
||||
}
|
||||
}
|
71
3.0/modules/fotomotorw/helpers/fotomotorw_theme.php
Normal file
71
3.0/modules/fotomotorw/helpers/fotomotorw_theme.php
Normal file
@ -0,0 +1,71 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2012 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 fotomotorw_theme_Core {
|
||||
static function head($theme) {
|
||||
// Load fotomoto's js file on photo pages.
|
||||
if($theme->page_subtype == "photo") {
|
||||
return html::script('http://widget.fotomoto.com/stores/script/' . module::get_var("fotomotorw", "fotomoto_site_key") . '.js?api=true');
|
||||
}
|
||||
}
|
||||
|
||||
static function resize_bottom($theme) {
|
||||
// Generate an array of links to display below photos.
|
||||
$block = new Block;
|
||||
$block->css_id = "g-fotomoto";
|
||||
$block->anchor = "fotomoto";
|
||||
|
||||
$link_array = array();
|
||||
$counter = 0;
|
||||
if (module::get_var("fotomotorw", "fotomoto_buy_prints")) {
|
||||
$link_array[$counter] = array("100", "Buy Prints");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_buy_cards")) {
|
||||
$link_array[$counter] = array("300", "Buy Cards");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_buy_download")) {
|
||||
$link_array[$counter] = array("400", "Download");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_share_ecard")) {
|
||||
$link_array[$counter] = array("200", "Send eCard");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_share_facebook")) {
|
||||
$link_array[$counter] = array("201", "Share on Facebook");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_share_twitter")) {
|
||||
$link_array[$counter] = array("202", "Share on Twitter");
|
||||
$counter++;
|
||||
}
|
||||
if (module::get_var("fotomotorw", "fotomoto_share_digg")) {
|
||||
$link_array[$counter] = array("203", "Share on Digg");
|
||||
$counter++;
|
||||
}
|
||||
|
||||
$view = new View("fotomotorw_block.html");
|
||||
$view->details = $link_array;
|
||||
$block->content = $view;
|
||||
return $block;
|
||||
}
|
||||
}
|
7
3.0/modules/fotomotorw/module.info
Normal file
7
3.0/modules/fotomotorw/module.info
Normal file
@ -0,0 +1,7 @@
|
||||
name = "Fotomoto (rWatcher)"
|
||||
description = "Sell photos on your site through Fotomoto"
|
||||
version = 1
|
||||
author_name = "rWatcher"
|
||||
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:fotomotorw"
|
||||
discuss_url = "http://gallery.menalto.com/node/106765"
|
64
3.0/modules/fotomotorw/views/admin_fotomotorw.html.php
Normal file
64
3.0/modules/fotomotorw/views/admin_fotomotorw.html.php
Normal file
@ -0,0 +1,64 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Fotomoto settings") ?> </h1>
|
||||
<div class="g-block-content">
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th> <?= t("Fotomoto Site Key") ?></th>
|
||||
</tr>
|
||||
<tr class="setting-row g-odd">
|
||||
<td>
|
||||
<a href="<?= url::site("admin/advanced_settings/edit/fotomotorw/fotomoto_site_key"); ?>" class="g-dialog-link">
|
||||
<? if (module::get_var("fotomotorw", "fotomoto_site_key", "") == ""): ?>
|
||||
<i> <?= t("Click to add your Fotomoto Site Key") ?> </i>
|
||||
<? else: ?>
|
||||
<?= module::get_var("fotomotorw", "fotomoto_site_key"); ?>
|
||||
<? endif; ?>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>(Log in to the <a href="http://my.fotomoto.com/">Fotomoto Dashboard</a> to get your Site Key.)</p>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th> <?= t("Fotomoto Display Options") ?></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<?=$display_form; ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th> <?= t("Fotomoto Private Key") ?>
|
||||
(<a href="<?= url::site("admin/fotomotorw/reset_private_key"); ?>"><?= t("Reset Private Key"); ?></a>)</th>
|
||||
</tr>
|
||||
<tr class="setting-row g-odd">
|
||||
<td><?= module::get_var("fotomotorw", "fotomoto_private_key"); ?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="g-block">
|
||||
<h1> <?= t("Configuring Auto Pickup") ?> </h1>
|
||||
<?
|
||||
if (module::get_var("fotomotorw", "fotomoto_private_key") == "") {
|
||||
print t("Please click the \"Reset Private Key\" link above to continue.");
|
||||
} else {
|
||||
?>
|
||||
<?= t("Step 1: Log into your Fotomoto account and select Settings -> Auto Pickup, or <a href=\"http://my.fotomoto.com/cloud_storage_interfaces\" target=\"_blank\">click here</a>."); ?><br />
|
||||
<?= t("Step 2: Select \"Create New Profile\"."); ?><br />
|
||||
<?= t("Step 3: Enter in a Profile Name, and set \"Storage Type\" to \"HTTP\". Leave \"Username\" and \"Password\" blank."); ?><br />
|
||||
<?= t("Step 4: For \"Host\", enter in \"") . substr(url::abs_site(), 0, strpos(substr(url::abs_site(), 7), "/")+7); ?>"<br />
|
||||
<?= t("Step 5: For \"Path\", enter in \"") . str_replace(Kohana::config('core.url_suffix'), "", substr(url::site("fotomotorw/print_proxy/" . module::get_var("fotomotorw", "fotomoto_private_key")), 1)) . "\""; ?><br />
|
||||
<?= t("Step 6: For \"Filename Lookup Pattern\", enter in \"FILENAME.EXT\"."); ?><br />
|
||||
<?= t("Step 7: Press \"Save Profile\" to finish."); ?>
|
||||
<? } ?>
|
||||
</div>
|
15
3.0/modules/fotomotorw/views/fotomotorw_block.html.php
Normal file
15
3.0/modules/fotomotorw/views/fotomotorw_block.html.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<center>
|
||||
<? if (count($details) > 0): ?>
|
||||
<a href="javascript:void(0);" onclick="showFotomotoDialog(<?=$details[0][0]; ?>);" style="font-weight: bold; font-size: 14px;"><?=$details[0][1]; ?></a>
|
||||
<? for ($i = 1; $i < count($details); $i++): ?>
|
||||
<span style="font-weight: bold; font-size: 14px;"> | </span>
|
||||
<a href="javascript:void(0);" onclick="showFotomotoDialog(<?=$details[$i][0]; ?>);" style="font-weight: bold; font-size: 14px;"><?=$details[$i][1]; ?></a>
|
||||
<? endfor ?>
|
||||
<? endif; ?>
|
||||
</center>
|
||||
<script>
|
||||
function showFotomotoDialog(window_type) {
|
||||
FOTOMOTO.API.showWindow(window_type, "<?= url::abs_site("fotomotorw/resize/{$item->id}"); ?>");
|
||||
}
|
||||
</script>
|
@ -144,18 +144,6 @@ class tag_albums_Controller extends Controller {
|
||||
|
||||
// Figure out which items to display on this page and store their details in $children.
|
||||
$tag_children = $this->_get_records($tag_ids, $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
|
||||
$children_array = Array();
|
||||
foreach ($tag_children as $one_child) {
|
||||
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/0/" . $id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
|
||||
$child_tag->id = $one_child->id;
|
||||
$child_tag->view_count = $one_child->view_count;
|
||||
$child_tag->owner = identity::lookup_user($one_child->owner_id);
|
||||
if ($one_child->has_thumb()) {
|
||||
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
|
||||
}
|
||||
$children_array[] = $child_tag;
|
||||
}
|
||||
$children = new Tag_Albums_Children($children_array);
|
||||
|
||||
// Set up the previous and next page buttons.
|
||||
if ($page > 1) {
|
||||
@ -168,37 +156,146 @@ class tag_albums_Controller extends Controller {
|
||||
}
|
||||
|
||||
// Set up breadcrumbs.
|
||||
$tag_album_breadcrumbs = Array();
|
||||
$tag_album_breadcrumbs = array();
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($album->title, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
|
||||
$parent_item = ORM::factory("item", $album->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
|
||||
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
|
||||
// Set up and display the actual page.
|
||||
$parent_album = ORM::factory("item", $album->parent_id);
|
||||
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
|
||||
//$template = new Theme_View("calpage.html", "collection", "Tag Albums");
|
||||
$template = new Theme_View("page.html", "collection", "Tag Albums");
|
||||
$template->set_global(
|
||||
array("page" => $page,
|
||||
"max_pages" => $max_pages,
|
||||
"page_size" => $page_size,
|
||||
"children" => $tag_children,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs,
|
||||
"children_count" => $count));
|
||||
$template->page_title = $page_title;
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("children", $children);
|
||||
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
|
||||
$template->set_global("children_count", $count);
|
||||
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
|
||||
$template->content = new View("tag_albums_album.html");
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $page_title;
|
||||
$template->content->description = $page_description;
|
||||
$template->set_global("breadcrumbs", $tag_album_breadcrumbs);
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
|
||||
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", 0, $id);
|
||||
}
|
||||
}
|
||||
|
||||
static function get_display_context($item, $tag_id, $album_id) {
|
||||
// Make sure #album_id is valid, clear it out if it isn't.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) == 0) {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Load the tag and item, make sure the user has access to the item.
|
||||
$display_tag = ORM::factory("tag", $tag_id);
|
||||
|
||||
// Figure out sort order from module preferences.
|
||||
$sort_page_field = "";
|
||||
$sort_page_direction = "";
|
||||
if (($tag_id > 0) || (count($album_tags) == 0)) {
|
||||
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
|
||||
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
|
||||
} else {
|
||||
$parent_album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$sort_page_field = $parent_album->sort_column;
|
||||
$sort_page_direction = $parent_album->sort_order;
|
||||
}
|
||||
|
||||
// Load the number of items in the parent album, and determine previous and next items.
|
||||
$sibling_count = "";
|
||||
$tag_children = "";
|
||||
$previous_item = "";
|
||||
$next_item = "";
|
||||
$position = 0;
|
||||
if ($tag_id > 0) {
|
||||
$sibling_count = tag_albums_Controller::_count_records(Array($tag_id), "OR", false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
} else {
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
$sibling_count = tag_albums_Controller::_count_records($tag_ids, $album_tags_search_type, false);
|
||||
$position = tag_albums_Controller::_get_position($item->$sort_page_field, $item->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = $previous_item_object[0];
|
||||
}
|
||||
}
|
||||
$next_item_object = tag_albums_Controller::_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = $next_item_object[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$tag_album_breadcrumbs = Array();
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
|
||||
}
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $item->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($item->title, $item->url())->set_last();
|
||||
}
|
||||
|
||||
return array("position" => $position,
|
||||
"previous_item" => $previous_item,
|
||||
"next_item" => $next_item,
|
||||
"tag_id" => $tag_id,
|
||||
"album_id" => $album_id,
|
||||
"is_tagalbum_page" => true,
|
||||
"sibling_count" => $sibling_count,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs);
|
||||
}
|
||||
|
||||
public function filter($id, $filter) {
|
||||
// Display the index page, but only show albums for
|
||||
// tags whose name begins with $filter.
|
||||
@ -411,36 +508,38 @@ class tag_albums_Controller extends Controller {
|
||||
$parent_url = "";
|
||||
if ($id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($album->title, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($album->title, $album->url())->set_last();
|
||||
$parent_item = ORM::factory("item", $album->parent_id);
|
||||
$parent_url = $parent_item->url();
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $album->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$parent_url = item::root()->url();
|
||||
$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb($page_title, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($page_title, $str_page_url)->set_first();
|
||||
}
|
||||
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
|
||||
$template = new Theme_View("page.html", "collection", "Tag Albums");
|
||||
$template->set_global(
|
||||
array("page" => $page,
|
||||
"max_pages" => $max_pages,
|
||||
"page_size" => $page_size,
|
||||
"children" => $children,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs,
|
||||
"children_count" => $all_tags_count));
|
||||
$template->page_title = $page_title;
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("children", $children);
|
||||
$template->set_global("children_count", $all_tags_count);
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->content = new View("tag_albums_album.html");
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $page_title;
|
||||
$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->content->filter_text = $this->_get_filter_html($id, $filter);
|
||||
$template->set_global("breadcrumbs", $tag_album_breadcrumbs);
|
||||
print $template;
|
||||
}
|
||||
|
||||
@ -511,20 +610,6 @@ class tag_albums_Controller extends Controller {
|
||||
// Figure out which items to display on this page.
|
||||
$tag_children = $this->_get_records(Array($id), $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, "OR", true);
|
||||
|
||||
// Create an array of "fake" items to display on the page.
|
||||
$children_array = Array();
|
||||
foreach ($tag_children as $one_child) {
|
||||
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/" . $id . "/" . $album_id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
|
||||
$child_tag->id = $one_child->id;
|
||||
$child_tag->view_count = $one_child->view_count;
|
||||
$child_tag->owner = identity::lookup_user($one_child->owner_id);
|
||||
if ($one_child->has_thumb()) {
|
||||
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
|
||||
}
|
||||
$children_array[] = $child_tag;
|
||||
}
|
||||
$children = new Tag_Albums_Children($children_array);
|
||||
|
||||
// Set up the previous and next page buttons.
|
||||
if ($page > 1) {
|
||||
$previous_page = $page - 1;
|
||||
@ -540,204 +625,73 @@ class tag_albums_Controller extends Controller {
|
||||
$parent_url = "";
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
if ($album_tags[0]->tags != "*") {
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$parent_url = $parent_item->url(); // Used by Grey Dragon.
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
//$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($parent_item->title, $parent_item->url())->set_first();
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
/*
|
||||
if ((module::get_var("tag_albums", "tag_index_scope", "false")) && (module::get_var("tag_albums", "tag_index", "default") != "default")) {
|
||||
$tag_album_breadcrumbs[1]->url = url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name));
|
||||
} else {
|
||||
$tag_album_breadcrumbs[1]->url = url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)) . "?show=" . $id;
|
||||
}
|
||||
*/
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $id;
|
||||
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$parent_url = url::site("tag_albums/");
|
||||
$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
|
||||
//$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(item::root()->title, item::root()->url())->set_first();
|
||||
if (module::get_var("tag_albums", "tag_index", "default") == "default") {
|
||||
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
//$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/") . "?show=" . $id);
|
||||
} else {
|
||||
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
//$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
}
|
||||
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
//$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, "");
|
||||
$tag_album_breadcrumbs[] = Breadcrumb::instance($display_tag->name, $str_page_url)->set_last();
|
||||
}
|
||||
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
|
||||
$template = new Theme_View("page.html", "collection", "Tag Albums");
|
||||
$template->set_global(
|
||||
array("page" => $page,
|
||||
"max_pages" => $max_pages,
|
||||
"page_size" => $page_size,
|
||||
"children" => $tag_children,
|
||||
"breadcrumbs" => $tag_album_breadcrumbs,
|
||||
"children_count" => $count));
|
||||
$template->page_title = $display_tag->name;
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("children", $children);
|
||||
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
|
||||
$template->set_global("children_count", $count);
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->content = new View("tag_albums_album.html");
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = $display_tag->name;
|
||||
$template->set_global("breadcrumbs", $tag_album_breadcrumbs);
|
||||
//$template->content->description = $page_description;
|
||||
|
||||
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
print $template;
|
||||
|
||||
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", $id, $album_id);
|
||||
}
|
||||
|
||||
public function show($item_id, $tag_id, $album_id) {
|
||||
// Display the specified photo or video ($item_id) with breadcrumbs
|
||||
// that point back to a virtual album ($tag_id / $album_id).
|
||||
|
||||
// Make sure #album_id is valid, clear it out if it isn't.
|
||||
$album_tags = ORM::factory("tags_album_id")
|
||||
->where("id", "=", $album_id)
|
||||
->find_all();
|
||||
if (count($album_tags) == 0) {
|
||||
$album_id = 0;
|
||||
}
|
||||
|
||||
// Load the tag and item, make sure the user has access to the item.
|
||||
$display_tag = ORM::factory("tag", $tag_id);
|
||||
item::set_display_context_callback("tag_albums_Controller::get_display_context", $tag_id, $album_id);
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
$parent_url = "";
|
||||
|
||||
// Figure out sort order from module preferences.
|
||||
$sort_page_field = "";
|
||||
$sort_page_direction = "";
|
||||
if (($tag_id > 0) || (count($album_tags) == 0)) {
|
||||
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
|
||||
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
|
||||
} else {
|
||||
$parent_album = ORM::factory("item", $album_tags[0]->album_id);
|
||||
$sort_page_field = $parent_album->sort_column;
|
||||
$sort_page_direction = $parent_album->sort_order;
|
||||
}
|
||||
|
||||
// Load the number of items in the parent album, and determine previous and next items.
|
||||
$sibling_count = "";
|
||||
$tag_children = "";
|
||||
$previous_item = "";
|
||||
$next_item = "";
|
||||
$position = 0;
|
||||
$dynamic_siblings = "";
|
||||
if ($tag_id > 0) {
|
||||
$sibling_count = $this->_count_records(Array($tag_id), "OR", false);
|
||||
$position = $this->_get_position($item->$sort_page_field, $item->id, Array($tag_id), "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = $this->_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type, $previous_item_object[0]->id);
|
||||
}
|
||||
}
|
||||
$next_item_object = $this->_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type, $next_item_object[0]->id);
|
||||
}
|
||||
$dynamic_siblings = $this->_get_records(Array($tag_id), null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
} else {
|
||||
$tag_ids = Array();
|
||||
foreach (explode(",", $album_tags[0]->tags) as $tag_name) {
|
||||
$tag = ORM::factory("tag")->where("name", "=", trim($tag_name))->find();
|
||||
if ($tag->loaded()) {
|
||||
$tag_ids[] = $tag->id;
|
||||
}
|
||||
}
|
||||
$album_tags_search_type = $album_tags[0]->search_type;
|
||||
$sibling_count = $this->_count_records($tag_ids, $album_tags_search_type, false);
|
||||
$position = $this->_get_position($item->$sort_page_field, $item->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if ($position > 1) {
|
||||
$previous_item_object = $this->_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($previous_item_object) > 0) {
|
||||
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
|
||||
}
|
||||
}
|
||||
$next_item_object = $this->_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
if (count($next_item_object) > 0) {
|
||||
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
|
||||
}
|
||||
$dynamic_siblings = $this->_get_records($tag_ids, null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$tag_album_breadcrumbs = Array();
|
||||
if ($album_id > 0) {
|
||||
$counter = 0;
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($item->title, "");
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
|
||||
}
|
||||
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
|
||||
if ($album_tags[0]->tags == "*") {
|
||||
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name));
|
||||
} else {
|
||||
$parent_url = $parent_item->url();
|
||||
}
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
while ($parent_item->id != 1) {
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$parent_item = ORM::factory("item", $parent_item->parent_id);
|
||||
}
|
||||
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
|
||||
$tag_album_breadcrumbs[1]->url .= "?show=" . $item->id;
|
||||
$tag_album_breadcrumbs = array_reverse($tag_album_breadcrumbs, true);
|
||||
} else {
|
||||
$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
|
||||
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
|
||||
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
|
||||
$tag_album_breadcrumbs[3] = new Tag_Albums_Breadcrumb($item->title, "");
|
||||
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name));
|
||||
}
|
||||
|
||||
// Increase the items view count.
|
||||
$item->increment_view_count();
|
||||
|
||||
// Load the page.
|
||||
if ($item->is_photo()) {
|
||||
$template = new Theme_View("calpage.html", "item", "photo");
|
||||
$template->page_title = $item->title;
|
||||
$template->set_global("children", Array());
|
||||
$template->set_global("item", $item);
|
||||
$template->set_global("previous_item", $previous_item);
|
||||
$template->set_global("next_item", $next_item);
|
||||
$template->set_global("is_tagalbum_page", true); // used for grey dragon
|
||||
$template->set_global("tag_id", $tag_id); // used for grey dragon
|
||||
$template->set_global("album_id", $album_id); // used for grey dragon
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->set_global("dynamic_siblings", $dynamic_siblings); // Used by Grey Dragon.
|
||||
$template->set_global("children_count", 0);
|
||||
$template->set_global("position", $position);
|
||||
$template->set_global("sibling_count", $sibling_count);
|
||||
$template->content = new View("photo.html");
|
||||
$template->content->title = $item->title;
|
||||
$template->set_global("breadcrumbs", $tag_album_breadcrumbs);
|
||||
print $template;
|
||||
} elseif ($item->is_movie()) {
|
||||
$template = new Theme_View("calpage.html", "item", "movie");
|
||||
$template->page_title = $item->title;
|
||||
$template->set_global("children", Array());
|
||||
$template->set_global("item", $item);
|
||||
$template->set_global("previous_item", $previous_item);
|
||||
$template->set_global("next_item", $next_item);
|
||||
$template->set_global("is_tagalbum_page", true); // used for grey dragon
|
||||
$template->set_global("tag_id", $tag_id); // used for grey dragon
|
||||
$template->set_global("album_id", $album_id); // used for grey dragon
|
||||
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
|
||||
$template->set_global("dynamic_siblings", $dynamic_siblings); // Used by Grey Dragon.
|
||||
$template->set_global("children_count", 0);
|
||||
$template->set_global("position", $position);
|
||||
$template->set_global("sibling_count", $sibling_count);
|
||||
$template->content = new View("movie.html");
|
||||
$template->content->title = $item->title;
|
||||
$template->set_global("breadcrumbs", $tag_album_breadcrumbs);
|
||||
print $template;
|
||||
} else {
|
||||
// If it's something we don't know how to deal with, just redirect to its real page.
|
||||
url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
|
||||
}
|
||||
}
|
||||
|
||||
private function _get_position($item_title, $item_id, $tag_ids, $sort_field, $sort_direction, $search_type, $include_albums) {
|
||||
// Determine an item's position within a virtual album.
|
||||
|
@ -1,167 +0,0 @@
|
||||
<?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" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<? $theme->start_combining("script,css") ?>
|
||||
<title>
|
||||
<? if ($page_title): ?>
|
||||
<?= $page_title ?>
|
||||
<? else: ?>
|
||||
<? if ($theme->item()): ?>
|
||||
<?= $theme->item()->title ?>
|
||||
<? elseif ($theme->tag()): ?>
|
||||
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
||||
<?= item::root()->title ?>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
</title>
|
||||
<link rel="shortcut icon"
|
||||
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
|
||||
type="image/x-icon" />
|
||||
<link rel="apple-touch-icon-precomposed"
|
||||
href="<?= url::file(module::get_var("gallery", "apple_touch_icon_url")) ?>" />
|
||||
<? if ($theme->page_type == "collection"): ?>
|
||||
<? if (($thumb_proportion = $theme->thumb_proportion($theme->item())) != 1): ?>
|
||||
<? $new_width = round($thumb_proportion * 213) ?>
|
||||
<? $new_height = round($thumb_proportion * 240) ?>
|
||||
<style type="text/css">
|
||||
.g-view #g-content #g-album-grid .g-item {
|
||||
width: <?= $new_width ?>px;
|
||||
height: <?= $new_height ?>px;
|
||||
/* <?= $thumb_proportion ?> */
|
||||
}
|
||||
</style>
|
||||
<? endif ?>
|
||||
<? endif ?>
|
||||
|
||||
<?= $theme->script("json2-min.js") ?>
|
||||
<?= $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") ?>
|
||||
|
||||
<? /* These are page specific but 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() ?>
|
||||
|
||||
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
|
||||
<?= $theme->script("ui.init.js") ?>
|
||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
||||
<?= $theme->css("screen.css") ?>
|
||||
<? if (locales::is_rtl()): ?>
|
||||
<?= $theme->css("screen-rtl.css") ?>
|
||||
<? endif; ?>
|
||||
<!--[if lte IE 8]>
|
||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
||||
media="screen,print,projection" />
|
||||
<![endif]-->
|
||||
|
||||
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
|
||||
<?= $theme->get_combined("css") ?>
|
||||
|
||||
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
|
||||
<?= $theme->get_combined("script") ?>
|
||||
</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 until after the page has loaded, to minimize menu flicker -->
|
||||
<div id="g-site-menu" style="visibility: hidden">
|
||||
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
||||
</div>
|
||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
||||
|
||||
<?= $theme->header_bottom() ?>
|
||||
</div>
|
||||
|
||||
<? // rWatcher Edit: 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(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
|
||||
</a>
|
||||
<? else : ?>
|
||||
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
|
||||
<? 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,50 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?
|
||||
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
|
||||
// $item->title and $item->description have been changed to $title and $description.
|
||||
//
|
||||
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
|
||||
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
|
||||
?>
|
||||
<div id="g-info">
|
||||
<?= $theme->dynamic_top() ?>
|
||||
<h1><?= html::purify($title) ?></h1>
|
||||
<div class="g-description"><?= nl2br(html::purify($description)) ?></div>
|
||||
</div>
|
||||
|
||||
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
|
||||
<div id="g-tags-filter">
|
||||
<br/ >
|
||||
<center><?= $filter_text; ?></center>
|
||||
</div>
|
||||
<? endif ?>
|
||||
|
||||
<ul id="g-album-grid" class="ui-helper-clearfix">
|
||||
<? if (count($children)): ?>
|
||||
<? foreach ($children as $i => $child): ?>
|
||||
<? $item_class = "g-photo"; ?>
|
||||
<? if ($child->is_album()): ?>
|
||||
<? $item_class = "g-album"; ?>
|
||||
<? endif ?>
|
||||
<li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">
|
||||
<?= $theme->thumb_top($child) ?>
|
||||
<a href="<?= $child->url() ?>">
|
||||
<? if ($child->has_thumb()): ?>
|
||||
<?= $child->thumb_img(array("class" => "g-thumbnail")) ?>
|
||||
<? endif ?>
|
||||
</a>
|
||||
<?= $theme->thumb_bottom($child) ?>
|
||||
<h2><span class="<?= $item_class ?>"></span>
|
||||
<a href="<?= $child->url() ?>"><?= html::purify($child->title) ?></a></h2>
|
||||
<ul class="g-metadata">
|
||||
<?= $theme->thumb_info($child) ?>
|
||||
</ul>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
<? else: ?>
|
||||
<li><?= t("There aren't any photos here yet!") ?></li>
|
||||
<? endif; ?>
|
||||
</ul>
|
||||
<?= $theme->dynamic_bottom() ?>
|
||||
|
||||
<?= $theme->paginator() ?>
|
Reference in New Issue
Block a user