1
0

Update to use the new page_type and page_subtype designations.

This commit is contained in:
Bharat Mediratta 2009-11-17 14:06:04 -08:00
parent a19d2132b2
commit 99ec99a166
24 changed files with 86 additions and 73 deletions

View File

@ -21,7 +21,7 @@ class Basket_Controller extends Controller {
public function view_basket() { public function view_basket() {
$template = new Theme_View("page.html", "basket"); $template = new Theme_View("page.html", "other", "basket");
$view = new View("view_basket.html"); $view = new View("view_basket.html");
$view->basket = Session_Basket::get(); $view->basket = Session_Basket::get();
@ -48,7 +48,7 @@ class Basket_Controller extends Controller {
public function checkout () { public function checkout () {
$template = new Theme_View("page.html", "basket"); $template = new Theme_View("page.html", "other", "basket");
$view = new View("checkout.html"); $view = new View("checkout.html");
@ -89,7 +89,7 @@ class Basket_Controller extends Controller {
$basket->email = $form->contact->email->value; $basket->email = $form->contact->email->value;
$basket->phone = $form->contact->phone->value; $basket->phone = $form->contact->phone->value;
$template = new Theme_View("page.html", "basket"); $template = new Theme_View("page.html", "other", "basket");
$form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm")); $form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm"));
$view = new View("confirm_order.html"); $view = new View("confirm_order.html");
@ -149,7 +149,7 @@ Items Ordered:
$basket->clear(); $basket->clear();
$template = new Theme_View("page.html", "basket"); $template = new Theme_View("page.html", "other", "basket");
$view = new View("order_complete.html"); $view = new View("order_complete.html");
$template->content = $view; $template->content = $view;
print $template; print $template;

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
?> ?>
<? if ($theme->page_type != 'basket'): ?> <? if ($theme->page_subtype != 'basket'): ?>
<? if (isset($basket) && isset($basket->contents) && ($basket->size() > 0)): ?> <? if (isset($basket) && isset($basket->contents) && ($basket->size() > 0)): ?>
<div id="basket"> <div id="basket">
<a href="<?= url::site("basket/view_basket") ?>" <a href="<?= url::site("basket/view_basket") ?>"

View File

@ -24,13 +24,13 @@ class batchtag_block_Core {
static function get($block_id, $theme) { static function get($block_id, $theme) {
$block = ""; $block = "";
// Only display on album pages that the user can edit. // Only display on album pages that the user can edit.
$item = $theme->item(); $item = $theme->item();
if (!$item->is_album() || !access::can("edit", $item)) { if (!$item || !$item->is_album() || !access::can("edit", $item)) {
return; return;
} }
switch ($block_id) { switch ($block_id) {
case "batch_tag": case "batch_tag":
// Make a new sidebar block. // Make a new sidebar block.
@ -54,7 +54,7 @@ class batchtag_block_Core {
$group->submit("")->value(t("Add Tag")); $group->submit("")->value(t("Add Tag"));
$block->content->batch_tag_form = $form; $block->content->batch_tag_form = $form;
break; break;
} }
return $block; return $block;
} }

View File

@ -31,7 +31,7 @@ class CalendarView_Controller extends Controller {
} }
// Draw the page. // Draw the page.
$template = new Theme_View("page.html", "CalendarView"); $template = new Theme_View("page.html", "other", "CalendarView");
$template->page_title = t("Gallery :: Calendar"); $template->page_title = t("Gallery :: Calendar");
$template->content = new View("calendarview_year.html"); $template->content = new View("calendarview_year.html");
$template->content->calendar_year = $display_year; $template->content->calendar_year = $display_year;
@ -75,7 +75,7 @@ class CalendarView_Controller extends Controller {
} }
// Set up the page. // Set up the page.
$template = new Theme_View("page.html", "CalendarDayView"); $template = new Theme_View("page.html", "other", "CalendarDayView");
$template->page_title = t("Gallery :: Calendar"); $template->page_title = t("Gallery :: Calendar");
$template->set_global("page_size", $page_size); $template->set_global("page_size", $page_size);

View File

@ -41,7 +41,7 @@ class ContactOwner_Controller extends Controller {
$sendmail_fields->submit("SendMessage")->value(t("Send")); $sendmail_fields->submit("SendMessage")->value(t("Send"));
// Set up and display the actual page. // Set up and display the actual page.
$template = new Theme_View("page.html", "Contact"); $template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html"); $template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $form; $template->content->sendmail_form = $form;
print $template; print $template;
@ -75,7 +75,7 @@ class ContactOwner_Controller extends Controller {
$sendmail_fields->submit("SendMessage")->value(t("Send")); $sendmail_fields->submit("SendMessage")->value(t("Send"));
// Set up and display the actual page. // Set up and display the actual page.
$template = new Theme_View("page.html", "Contact"); $template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html"); $template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $form; $template->content->sendmail_form = $form;
print $template; print $template;
@ -122,7 +122,7 @@ class ContactOwner_Controller extends Controller {
->send(); ->send();
// Display a message telling the visitor that their email has been sent. // Display a message telling the visitor that their email has been sent.
$template = new Theme_View("page.html", "Contact"); $template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html"); $template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = t("Your Message Has Been Sent."); $template->content->sendmail_form = t("Your Message Has Been Sent.");
print $template; print $template;

View File

@ -47,7 +47,7 @@ class Dynamic_Controller extends Controller {
Kohana::show_404(); Kohana::show_404();
} }
$template = new Theme_View("page.html", "dynamic"); $template = new Theme_View("page.html", "other", "dynamic");
$template->set_global("page_size", $page_size); $template->set_global("page_size", $page_size);
$template->set_global("children", ORM::factory("item") $template->set_global("children", ORM::factory("item")
->viewable() ->viewable()

View File

@ -24,19 +24,23 @@ class embedlinks_block_Core {
static function get($block_id, $theme) { static function get($block_id, $theme) {
$block = ""; $block = "";
if (!$theme->item()) {
return;
}
switch ($block_id) { switch ($block_id) {
case "embed_links_dialog": case "embed_links_dialog":
// If displaying links in a dialog box is enabled then // If displaying links in a dialog box is enabled then
// insert buttons into the bottom of the side bar // insert buttons into the bottom of the side bar
// to open up the dialog window. // to open up the dialog window.
if (module::get_var("embedlinks", "DialogLinks") && $theme->item()) { if (module::get_var("embedlinks", "DialogLinks") && $theme->item()) {
$block = new Block(); $block = new Block();
$block->css_id = "g-embed-links-sidebar"; $block->css_id = "g-embed-links-sidebar";
$block->title = t("Link To This Page"); $block->title = t("Link To This Page");
$block->content = new View("embedlinks_sidebar.html"); $block->content = new View("embedlinks_sidebar.html");
} }
break; break;
case "embed_links_album": case "embed_links_album":
// If the current item is an album and if "In Page" links are enabled then // If the current item is an album and if "In Page" links are enabled then
@ -46,10 +50,10 @@ class embedlinks_block_Core {
$block->css_id = "g-embed-links-album-sidebar"; $block->css_id = "g-embed-links-album-sidebar";
$block->title = t("Links"); $block->title = t("Links");
$block->content = new View("embedlinks_album_block.html"); $block->content = new View("embedlinks_album_block.html");
} }
break; break;
} }
return $block; return $block;
} }
} }

View File

@ -108,23 +108,23 @@ class keeporiginal_event_Core {
@rename($old_original, $new_original); @rename($old_original, $new_original);
} }
} }
} }
} }
static function site_menu($menu, $theme) { static function site_menu($menu, $theme) {
// Create a menu option to restore the original photo. // Create a menu option to restore the original photo.
$item = $theme->item(); if ($item = $theme->item()) {
if ((access::can("view", $item)) && (access::can("edit", $item))) {
$original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path());
if ((access::can("view", $item)) && (access::can("edit", $item))) { if ($item->is_photo() && file_exists($original_image)) {
$original_image = VARPATH . "original/" . str_replace(VARPATH . "albums/", "", $item->file_path()); $menu->get("options_menu")
->append(Menu::factory("link")
if ($item->is_photo() && file_exists($original_image)) { ->id("restore")
$menu->get("options_menu") ->label(t("Restore original"))
->append(Menu::factory("link") ->css_id("g-keep-originals-link")
->id("restore") ->url(url::site("keeporiginal/restore/" . $item->id)));
->label(t("Restore original")) }
->css_id("g-keep-originals-link")
->url(url::site("keeporiginal/restore/" . $item->id)));
} }
} }
} }

View File

@ -70,7 +70,7 @@ class latestupdates_Controller extends Controller {
} }
// Set up and display the actual page. // Set up and display the actual page.
$template = new Theme_View("page.html", "LatestUpdates"); $template = new Theme_View("page.html", "other", "LatestUpdates");
$template->page_title = t("Gallery :: Latest Updates"); $template->page_title = t("Gallery :: Latest Updates");
$template->set_global("page_size", $itemsPerPage); $template->set_global("page_size", $itemsPerPage);
$template->set_global("children", $children); $template->set_global("children", $children);
@ -128,7 +128,7 @@ class latestupdates_Controller extends Controller {
} }
// Set up and display the actual page. // Set up and display the actual page.
$template = new Theme_View("page.html", "LatestUpdates"); $template = new Theme_View("page.html", "other", "LatestUpdates");
$template->page_title = t("Gallery :: Latest Updates"); $template->page_title = t("Gallery :: Latest Updates");
$template->set_global("page_size", $itemsPerPage); $template->set_global("page_size", $itemsPerPage);
$template->set_global("children", $items); $template->set_global("children", $items);

View File

@ -25,6 +25,10 @@ class latestupdates_block_Core {
static function get($block_id, $theme) { static function get($block_id, $theme) {
$block = ""; $block = "";
if (!$theme->item()) {
return;
}
switch ($block_id) { switch ($block_id) {
case "latestupdates": case "latestupdates":
// Determine the ID# of the current album. // Determine the ID# of the current album.

View File

@ -26,7 +26,7 @@ class metadescription_theme_Core {
->where("id", $theme->tag()) ->where("id", $theme->tag())
->find_all(); ->find_all();
}elseif ($theme->item()) { } elseif ($theme->item()) {
// If the current page belongs to an item (album, photo, etc.), // If the current page belongs to an item (album, photo, etc.),
// look up any tags that have been applied to that item. // look up any tags that have been applied to that item.
$tagsItem = ORM::factory("tag") $tagsItem = ORM::factory("tag")
@ -40,8 +40,12 @@ class metadescription_theme_Core {
} }
// Load the meta tags into the top of the page. // Load the meta tags into the top of the page.
$metaView = new View("metadescription_block.html"); // @todo: metadescription_block.html requires an item so for now, don't render it unless we
$metaView->tags = $tagsItem; // have one.
return $metaView; if ($theme->item()) {
$metaView = new View("metadescription_block.html");
$metaView->tags = $tagsItem;
return $metaView;
}
} }
} }

View File

@ -9,14 +9,14 @@
} else { } else {
$metaTags = $metaTags . html::clean($tags[$counter]->name); $metaTags = $metaTags . html::clean($tags[$counter]->name);
} }
} }
} }
// If $metaTags is empty, use the item's title instead. // If $metaTags is empty, use the item's title instead.
if ($metaTags == "") { if ($metaTags == "") {
$metaTags = html::clean($item->title); $metaTags = html::clean($item->title);
} }
$metaDescription = ""; $metaDescription = "";
$metaDescription = trim(nl2br(html::purify($item->description))); $metaDescription = trim(nl2br(html::purify($item->description)));
// If description is empty, use title instead. // If description is empty, use title instead.

View File

@ -27,7 +27,7 @@ class register_event {
static function user_menu($menu, $theme) { static function user_menu($menu, $theme) {
$user = identity::active_user(); $user = identity::active_user();
if ($theme->page_type != "login" && $user->guest) { if ($theme->page_subtype != "login" && $user->guest) {
$menu->append(Menu::factory("dialog") $menu->append(Menu::factory("dialog")
->id("user_menu_register") ->id("user_menu_register")
->css_id("g-register-menu") ->css_id("g-register-menu")

View File

@ -58,7 +58,7 @@ class tag_cloud_block {
$block->content->cloud = tag::cloud(30); $block->content->cloud = tag::cloud(30);
$block->content->options = $options; $block->content->options = $options;
if ($theme->item() && $theme->page_type() != "tag" && access::can("edit", $theme->item())) { if ($theme->item() && $theme->page_subtype() != "tag" && access::can("edit", $theme->item())) {
$controller = new Tags_Controller(); $controller = new Tags_Controller();
$block->content->form = tag::get_add_form($theme->item()); $block->content->form = tag::get_add_form($theme->item());
} else { } else {

View File

@ -27,10 +27,11 @@ class tagfaces_Controller extends Controller {
access::required("edit", $item); access::required("edit", $item);
// Create the page. // Create the page.
$template = new Theme_View("page.html", "drawfaces"); $template = new Theme_View("page.html", "other", "drawfaces");
$template->set_global("item_id", $id); $template->set_global("item_id", $id);
$template->set_global("page_title", t("Draw Faces")); $template->set_global("page_title", t("Draw Faces"));
$template->set_global("page_type", "photoface"); $template->set_global("page_type", "other");
$template->set_global("page_subtype", "photoface");
$template->content = new View("drawfaces.html"); $template->content = new View("drawfaces.html");
$template->content->title = t("Tag Faces"); $template->content->title = t("Tag Faces");
$template->content->form = $this->_get_faces_form($id); $template->content->form = $this->_get_faces_form($id);

View File

@ -41,7 +41,7 @@ class TagsMap_Controller extends Controller {
print $view; print $view;
} else { } else {
$template = new Theme_View("page.html", "TagsMap"); $template = new Theme_View("page.html", "other", "TagsMap");
$template->page_title = t("Gallery :: Map"); $template->page_title = t("Gallery :: Map");
$template->content = new View("tagsmap_googlemap.html"); $template->content = new View("tagsmap_googlemap.html");

View File

@ -35,7 +35,7 @@
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>" <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" /> media="screen,print,projection" />
<![endif]--> <![endif]-->
<? if ($theme->page_type == 'album'): ?> <? if ($theme->page_type == 'collection'): ?>
<? if ($thumb_proportion != 1): ?> <? if ($thumb_proportion != 1): ?>
<? $new_width = $thumb_proportion * 180 ?> <? $new_width = $thumb_proportion * 180 ?>
<? $new_height = $thumb_proportion * 230 ?> <? $new_height = $thumb_proportion * 230 ?>
@ -65,10 +65,10 @@
<?= $theme->script("ui.init.js") ?> <?= $theme->script("ui.init.js") ?>
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?> <? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
<? if ($theme->page_type == "photo"): ?> <? if ($theme->page_subtype == "photo"): ?>
<?= $theme->script("jquery.scrollTo.js") ?> <?= $theme->script("jquery.scrollTo.js") ?>
<?= $theme->script("gallery.show_full_size.js") ?> <?= $theme->script("gallery.show_full_size.js") ?>
<? elseif ($theme->page_type == "movie"): ?> <? elseif ($theme->page_subtype == "movie"): ?>
<?= $theme->script("flowplayer.js") ?> <?= $theme->script("flowplayer.js") ?>
<? endif ?> <? endif ?>
@ -149,7 +149,7 @@
</div> </div>
</div> </div>
<div id="g-sidebar" class="yui-b"> <div id="g-sidebar" class="yui-b">
<? if ($theme->page_type != "login"): ?> <? if ($theme->page_subtype != "login"): ?>
<?= new View("sidebar.html") ?> <?= new View("sidebar.html") ?>
<? endif ?> <? endif ?>
</div> </div>

View File

@ -2,13 +2,13 @@
<?= $theme->sidebar_top() ?> <?= $theme->sidebar_top() ?>
<div class="g-toolbar"> <div class="g-toolbar">
<div id="g-view-menu" class="g-buttonset ui-helper-clearfix"> <div id="g-view-menu" class="g-buttonset ui-helper-clearfix">
<? if ($page_type == "album"):?> <? if ($page_subtype == "album"):?>
<?= $theme->album_menu() ?> <?= $theme->album_menu() ?>
<? elseif ($page_type == "photo") : ?> <? elseif ($page_subtype == "photo") : ?>
<?= $theme->photo_menu() ?> <?= $theme->photo_menu() ?>
<? elseif ($page_type == "movie") : ?> <? elseif ($page_subtype == "movie") : ?>
<?= $theme->movie_menu() ?> <?= $theme->movie_menu() ?>
<? elseif ($page_type == "tag") : ?> <? elseif ($page_subtype == "tag") : ?>
<?= $theme->tag_menu() ?> <?= $theme->tag_menu() ?>
<? endif ?> <? endif ?>
</div> </div>

View File

@ -41,7 +41,7 @@ class TagsMap_Controller extends Controller {
print $view; print $view;
} else { } else {
$template = new Theme_View("page.html", "Contact"); $template = new Theme_View("page.html", "other", "Contact");
//$template->body_attributes("onload=\"GLoad\" onunload=\"Gunload\""); //$template->body_attributes("onload=\"GLoad\" onunload=\"Gunload\"");
$template->page_title = t("Gallery :: map"); $template->page_title = t("Gallery :: map");
$template->content = new View("tagsmap_googlemap.html"); $template->content = new View("tagsmap_googlemap.html");

View File

@ -49,7 +49,7 @@ class Comments_3nids_Controller extends REST_Controller {
break; break;
case "html": case "html":
$view = new Theme_View("comments.html", "page"); $view = new Theme_View("comments.html", "other", "page");
$view->comments = $comments; $view->comments = $comments;
$view->item_id = $item_id; $view->item_id = $item_id;
$view->thumb = $item->thumb_url(); $view->thumb = $item->thumb_url();
@ -122,7 +122,7 @@ class Comments_3nids_Controller extends REST_Controller {
"created" => $comment->created, "created" => $comment->created,
"text" => nl2br(html::purify($comment->text))))); "text" => nl2br(html::purify($comment->text)))));
} else { } else {
$view = new Theme_View("comment.html", "fragment"); $view = new Theme_View("comment.html", "other", "fragment");
$view->comment = $comment; $view->comment = $comment;
print $view; print $view;
} }

View File

@ -29,7 +29,7 @@ class Movie_3nids_Controller extends REST_Controller {
$item = ORM::factory("item", $item_id); $item = ORM::factory("item", $item_id);
access::required("view", $item); access::required("view", $item);
$view = new Theme_View("movie_3nids.html", "page"); $view = new Theme_View("movie_3nids.html", "other", "page");
$view->item = $item; $view->item = $item;
$view->attrs = array("class" => "g-movie", "id" => "g-movie-id-{$item->id}", "style" => "display:block;width:{$item->width}px;height:{$item->height}px"); $view->attrs = array("class" => "g-movie", "id" => "g-movie-id-{$item->id}", "style" => "display:block;width:{$item->width}px;height:{$item->height}px");
print $view; print $view;

View File

@ -29,7 +29,7 @@ class Photo_3nids_Controller extends REST_Controller {
$item = ORM::factory("item", $item_id); $item = ORM::factory("item", $item_id);
access::required("view", $item); access::required("view", $item);
$view = new Theme_View("photo_3nids.html", "page"); $view = new Theme_View("photo_3nids.html", "other", "page");
$view->item = $item; $view->item = $item;
$photo_size = module::get_var("theme_3nids","photo_size"); $photo_size = module::get_var("theme_3nids","photo_size");
if ($photo_size == "full"){ if ($photo_size == "full"){

View File

@ -33,7 +33,7 @@
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>" <link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" /> media="screen,print,projection" />
<![endif]--> <![endif]-->
<? if ($theme->page_type == 'album'): ?> <? if ($theme->page_type == 'collection'): ?>
<? if ($thumb_proportion != 1): ?> <? if ($thumb_proportion != 1): ?>
<? $new_width = $thumb_proportion * 213 ?> <? $new_width = $thumb_proportion * 213 ?>
<? $new_height = $thumb_proportion * 240 ?> <? $new_height = $thumb_proportion * 240 ?>
@ -61,10 +61,10 @@
<?= $theme->script("ui.init.js") ?> <?= $theme->script("ui.init.js") ?>
<? /* These are page specific, but if we put them before $theme->head() they get combined */ ?> <? /* These are page specific, but if we put them before $theme->head() they get combined */ ?>
<? if ($theme->page_type == "photo"): ?> <? if ($theme->page_subtype == "photo"): ?>
<?= $theme->script("jquery.scrollTo.js") ?> <?= $theme->script("jquery.scrollTo.js") ?>
<?= $theme->script("gallery.show_full_size.js") ?> <?= $theme->script("gallery.show_full_size.js") ?>
<? elseif ($theme->page_type == "movie"): ?> <? elseif ($theme->page_subtype == "movie"): ?>
<?= $theme->script("flowplayer.js") ?> <?= $theme->script("flowplayer.js") ?>
<? endif ?> <? endif ?>
@ -122,7 +122,7 @@
</div> </div>
</div> </div>
<div id="g-sidebar" class="yui-b"> <div id="g-sidebar" class="yui-b">
<? if ($theme->page_type != "login"): ?> <? if ($theme->page_subtype != "login"): ?>
<?= new View("sidebar.html") ?> <?= new View("sidebar.html") ?>
<? endif ?> <? endif ?>
</div> </div>

View File

@ -1,13 +1,13 @@
<?php defined("SYSPATH") or die("No direct script access.") ?> <?php defined("SYSPATH") or die("No direct script access.") ?>
<?= $theme->sidebar_top() ?> <?= $theme->sidebar_top() ?>
<div id="g-view-menu" class="g-buttonset ui-helper-clearfix"> <div id="g-view-menu" class="g-buttonset ui-helper-clearfix">
<? if ($page_type == "album"):?> <? if ($page_subtype == "album"):?>
<?= $theme->album_menu() ?> <?= $theme->album_menu() ?>
<? elseif ($page_type == "photo") : ?> <? elseif ($page_subtype == "photo") : ?>
<?= $theme->photo_menu() ?> <?= $theme->photo_menu() ?>
<? elseif ($page_type == "movie") : ?> <? elseif ($page_subtype == "movie") : ?>
<?= $theme->movie_menu() ?> <?= $theme->movie_menu() ?>
<? elseif ($page_type == "tag") : ?> <? elseif ($page_subtype == "tag") : ?>
<?= $theme->tag_menu() ?> <?= $theme->tag_menu() ?>
<? endif ?> <? endif ?>
</div> </div>