From a58a1d348a0830f7a35313fb70571cabae4c33f4 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Mon, 16 Apr 2012 19:18:43 -0400 Subject: [PATCH] Replace custom breadcrumbs code with Gallery 3.0.3's breadcrumb code. --- .../calendarview/controllers/calendarview.php | 93 +++++----- .../libraries/Calendar_Breadcrumb.php | 31 ---- .../calendarview/views/calpage.html.php | 164 ------------------ 3 files changed, 47 insertions(+), 241 deletions(-) delete mode 100644 3.0/modules/calendarview/libraries/Calendar_Breadcrumb.php delete mode 100644 3.0/modules/calendarview/views/calpage.html.php diff --git a/3.0/modules/calendarview/controllers/calendarview.php b/3.0/modules/calendarview/controllers/calendarview.php index ac33e0d4..d9dfb7d5 100644 --- a/3.0/modules/calendarview/controllers/calendarview.php +++ b/3.0/modules/calendarview/controllers/calendarview.php @@ -31,18 +31,19 @@ class CalendarView_Controller extends Controller { } // Draw the page. - $template = new Theme_View("calpage.html", "other", "CalendarView"); - $template->set_global("calendar_user", $display_user); + $root = item::root(); + $template = new Theme_View("page.html", "other", "CalendarView"); + $template->set_global( + array("calendar_user" => $display_user, + "breadcrumbs" => array( + Breadcrumb::instance($root->title, $root->url())->set_first(), + Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year))->set_last()))); $template->page_title = t("Gallery :: Calendar"); $template->content = new View("calendarview_year.html"); $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; } @@ -81,42 +82,42 @@ class CalendarView_Controller extends Controller { throw new Kohana_404_Exception(); } - // Set up the page. - $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); - $template->page_title = t("Gallery :: Calendar"); - // Figure out which photos go on this page. + $children = ""; if ($display_user == "-1") { - $template->set_global("children", ORM::factory("item") + $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)); + ->find_all($page_size, $offset); } else { - $template->set_global("children", ORM::factory("item") + $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)); + ->find_all($page_size, $offset); } - // 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, $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); + // Create and display the page. + $root = item::root(); + $template = new Theme_View("page.html", "collection", "CalendarDayView"); + $template->set_global( + array("page" => $page, + "max_pages" => $max_pages, + "page_size" => $page_size, + "children" => $children, + "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))->set_last()), + "children_count" => $day_count)); + $template->page_title = t("Gallery :: Calendar"); $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; @@ -157,41 +158,41 @@ class CalendarView_Controller extends Controller { throw new Kohana_404_Exception(); } - // Set up the page. - $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); - $template->page_title = t("Gallery :: Calendar"); - // Figure out which photos go on this page. + $children = ""; if ($display_user == "-1") { - $template->set_global("children", ORM::factory("item") + $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)); + ->find_all($page_size, $offset); } else { - $template->set_global("children", ORM::factory("item") + $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)); + ->find_all($page_size, $offset); } - // 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); + // Create and display the page. + $root = item::root(); + $template = new Theme_View("page.html", "collection", "CalendarMonthView"); + $template->set_global( + array("page" => $page, + "max_pages" => $max_pages, + "page_size" => $page_size, + "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))->set_last()), + "children" => $children, + "children_count" => $day_count)); + $template->page_title = t("Gallery :: Calendar"); $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; @@ -266,4 +267,4 @@ class CalendarView_Controller extends Controller { // redirect to the currect page. url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id, request::protocol())); } -} \ No newline at end of file +} diff --git a/3.0/modules/calendarview/libraries/Calendar_Breadcrumb.php b/3.0/modules/calendarview/libraries/Calendar_Breadcrumb.php deleted file mode 100644 index 20b39843..00000000 --- a/3.0/modules/calendarview/libraries/Calendar_Breadcrumb.php +++ /dev/null @@ -1,31 +0,0 @@ -title = $new_title; - $this->url = $new_url; - } -} diff --git a/3.0/modules/calendarview/views/calpage.html.php b/3.0/modules/calendarview/views/calpage.html.php deleted file mode 100644 index 3dab5fc0..00000000 --- a/3.0/modules/calendarview/views/calpage.html.php +++ /dev/null @@ -1,164 +0,0 @@ - - -html_attributes() ?> xml:lang="en" lang="en"> - - - start_combining("script,css") ?> - - <? 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 ?> - - " - type="image/x-icon" /> - - page_type == "collection"): ?> - - - - - - - - script("json2-min.js") ?> - script("jquery.js") ?> - script("jquery.form.js") ?> - script("jquery-ui.js") ?> - script("gallery.common.js") ?> - - - script("gallery.ajax.js") ?> - script("gallery.dialog.js") ?> - script("superfish/js/superfish.js") ?> - script("jquery.localscroll.js") ?> - - - page_subtype == "photo"): ?> - script("jquery.scrollTo.js") ?> - script("gallery.show_full_size.js") ?> - page_subtype == "movie"): ?> - script("flowplayer.js") ?> - - - head() ?> - - - script("ui.init.js") ?> - css("yui/reset-fonts-grids.css") ?> - css("superfish/css/superfish.css") ?> - css("themeroller/ui.base.css") ?> - css("screen.css") ?> - - - - get_combined("script") ?> - - - get_combined("css") ?> - - - body_attributes() ?>> - page_top() ?> -
- site_status() ?> -
-
- - - - - - user_menu() ?> - header_top() ?> - - - - - - header_bottom() ?> -
- - - - -
    - - - > - - url) : ?> - title) ?> - - title) ?> - - - - -
- - - - - -
-
-
-
-
- messages() ?> - -
-
-
-
- page_subtype != "login"): ?> - - -
-
- -
- page_bottom() ?> - - \ No newline at end of file