1
0

Added support for breadcrumbs and sidebar (enable via theme options)

This commit is contained in:
Fredrik Erlandsson 2011-12-21 15:20:26 +01:00
parent fad0fe48aa
commit 7be51a8700
5 changed files with 45 additions and 11 deletions

View File

@ -3,7 +3,7 @@
/* /*
*/ */
?> ?>
<? <?
class Admin_Theme_Options_Controller extends Admin_Controller { class Admin_Theme_Options_Controller extends Admin_Controller {
protected $min_gallery_ver = 46; protected $min_gallery_ver = 46;
@ -53,22 +53,22 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$form = new Forge("admin/theme_options/save/", "", null, array("id" =>"g-theme-options-form")); $form = new Forge("admin/theme_options/save/", "", null, array("id" =>"g-theme-options-form"));
// Just commenting out, we might want rssmodule in future versions. // Just commenting out, we might want rssmodule in future versions.
// $rssmodulecheck = (module::is_active("rss") && module::info("rss")); // $rssmodulecheck = (module::is_active("rss") && module::info("rss"));
/* Prerequisites ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* Prerequisites ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$group = $form->group("requirements")->label(t("Prerequisites")); $group = $form->group("requirements")->label(t("Prerequisites"));
$gallery_ver = module::get_version("gallery"); $gallery_ver = module::get_version("gallery");
$this->prerequisite_check($group, "vercheck", $gallery_ver >= $this->min_gallery_ver, $this->prerequisite_check($group, "vercheck", $gallery_ver >= $this->min_gallery_ver,
t("Gallery 3 Core v.") . $this->min_gallery_ver . "+", t("Installed"), t("Required"), FALSE, sprintf(t("Check Failed. Minimum Required Version is %s. Found %s."), $this->min_gallery_ver, $gallery_ver)); t("Gallery 3 Core v.") . $this->min_gallery_ver . "+", t("Installed"), t("Required"), FALSE, sprintf(t("Check Failed. Minimum Required Version is %s. Found %s."), $this->min_gallery_ver, $gallery_ver));
$this->prerequisite_check($group, "square_thumbs", (module::is_active("square_thumbs") and module::info("square_thumbs")), $this->prerequisite_check($group, "square_thumbs", (module::is_active("square_thumbs") and module::info("square_thumbs")),
t("Square Thumbnails"), t("Found"), t("Required"), FALSE, t("Install <a href=\"http://codex.gallery2.org/Gallery3:Modules:square_thumbs\">Square Thumbnails</a> to display Thumbs correctly.")); t("Square Thumbnails"), t("Found"), t("Required"), FALSE, t("Install <a href=\"http://codex.gallery2.org/Gallery3:Modules:square_thumbs\">Square Thumbnails</a> to display Thumbs correctly."));
if (!module::get_var("th_pear4gallery3", "hide_thumbmeta")): if (!module::get_var("th_pear4gallery3", "hide_thumbmeta")):
$this->prerequisite_check($group, "info", (module::is_active("info") and module::info("info")), $this->prerequisite_check($group, "info", (module::is_active("info") and module::info("info")),
t("Info Module"), t("Found"), t("Required"), FALSE, t("Check Failed. Module is required to display Thumb metadata.")); t("Info Module"), t("Found"), t("Required"), FALSE, t("Check Failed. Module is required to display Thumb metadata."));
endif; endif;
/* General Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ /* General Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
$group = $form->group("edit_theme")->label(t("General Settings")); $group = $form->group("edit_theme")->label(t("General Settings"));
@ -96,6 +96,12 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
->label(t("Background color")) ->label(t("Background color"))
->options(array("black" => t("Black (Default)"), "dkgrey" => t("Dark-Grey"), "ltgrey" => t("Light-Grey"), "white" => t("White"))) ->options(array("black" => t("Black (Default)"), "dkgrey" => t("Dark-Grey"), "ltgrey" => t("Light-Grey"), "white" => t("White")))
->selected(module::get_var("th_pear4gallery3", "background")); ->selected(module::get_var("th_pear4gallery3", "background"));
$group->checkbox("show_breadcrumbs")
->label(t("Show breadcrumbs for navigation."))
->checked(module::get_var("th_pear4gallery3", "show_breadcrumbs"));
$group->checkbox("show_sidebar")
->label(t("Show Sidebar"))
->checked(module::get_var("th_pear4gallery3", "show_sidebar"));
$group->input("ga_code") $group->input("ga_code")
->label(t("<a href=\"http://www.google.com/analytics/\">Google analytics</a> code.")) ->label(t("<a href=\"http://www.google.com/analytics/\">Google analytics</a> code."))
->value(module::get_var("th_pear4gallery3", "ga_code")); ->value(module::get_var("th_pear4gallery3", "ga_code"));
@ -139,7 +145,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::event("theme_edit_form", $form); module::event("theme_edit_form", $form);
$form->submit("g-theme-options-save")->value(t("Save Changes")); $form->submit("g-theme-options-save")->value(t("Save Changes"));
return $form; return $form;
} }
@ -181,6 +187,8 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
module::clear_var("th_pear4gallery3", "mainmenu_view"); module::clear_var("th_pear4gallery3", "mainmenu_view");
module::clear_var("th_pear4gallery3", "show_guest_menu"); module::clear_var("th_pear4gallery3", "show_guest_menu");
module::clear_var("th_pear4gallery3", "background"); module::clear_var("th_pear4gallery3", "background");
module::clear_var("th_pear4gallery3", "show_breadcrumbs");
module::clear_var("th_pear4gallery3", "show_sidebar");
module::clear_var("th_pear4gallery3", "ga_code"); module::clear_var("th_pear4gallery3", "ga_code");
} }
@ -265,10 +273,12 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
$this->save_item_state("mainmenu_view", $form->edit_theme_adv_main->mainmenu_view->value != "grid", $form->edit_theme_adv_main->mainmenu_view->value); $this->save_item_state("mainmenu_view", $form->edit_theme_adv_main->mainmenu_view->value != "grid", $form->edit_theme_adv_main->mainmenu_view->value);
$this->save_item_state("show_guest_menu",$form->edit_theme_adv_main->show_guest_menu->value, TRUE); $this->save_item_state("show_guest_menu",$form->edit_theme_adv_main->show_guest_menu->value, TRUE);
$this->save_item_state("background", $form->edit_theme_adv_main->background->value != "black", $form->edit_theme_adv_main->background->value); $this->save_item_state("background", $form->edit_theme_adv_main->background->value != "black", $form->edit_theme_adv_main->background->value);
$this->save_item_state("show_breadcrumbs",$form->edit_theme_adv_main->show_breadcrumbs->value, TRUE);
$this->save_item_state("show_sidebar",$form->edit_theme_adv_main->show_sidebar->value, TRUE);
$this->save_item_state("ga_code", $form->edit_theme_adv_main->ga_code->value, $form->edit_theme_adv_main->ga_code->value); $this->save_item_state("ga_code", $form->edit_theme_adv_main->ga_code->value, $form->edit_theme_adv_main->ga_code->value);
// * Advanced Options - Photo page *************************************** // * Advanced Options - Photo page ***************************************
/* /*
$this->save_item_state("photo_descmode", $photo_descmode != "overlay_top", $photo_descmode); $this->save_item_state("photo_descmode", $photo_descmode != "overlay_top", $photo_descmode);
$this->save_item_state("photo_popupbox", $photo_popupbox != "default", $photo_popupbox); $this->save_item_state("photo_popupbox", $photo_popupbox != "default", $photo_popupbox);
$this->save_item_state("thumb_inpage", $form->edit_theme_adv_photo->thumb_inpage->value, TRUE); $this->save_item_state("thumb_inpage", $form->edit_theme_adv_photo->thumb_inpage->value, TRUE);

View File

@ -50,6 +50,16 @@ function getCookie(c_name) {
} }
return ""; return "";
} }
function toggleSidebar() {
if ($('#sidebar').length === 0) { return; }
if ($('#sidebar').is(':visible')) {
$('#sidebar').hide('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '+=220' }, 1000, function () { mosaicResize(); });
} else {
$('#sidebar').show('slide', { direction: 'right'}, 1000);
$('#mosaicGridContainer').animate( { width: '-=220' }, 1000, function () { mosaicResize(); });
}
}
function mosaicResize() { function mosaicResize() {
if ($('#mosaicGridContainer').length === 0) { if ($('#mosaicGridContainer').length === 0) {
@ -90,6 +100,9 @@ function mosaicResize() {
if ($('#g-movie').length) { if ($('#g-movie').length) {
myHeight += 18; myHeight += 18;
} }
/*Sidebar*/
if ($('#sidebar').is(':visible')) { myWidth = myWidth - 220; }
$('#sidebar').css('height', (myHeight + 53) + "px");
if (!mosaicView) { if (!mosaicView) {
$('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': myWidth + "px"}); $('#mosaicGridContainer').css({'height': (myHeight + 33) + "px", 'width': myWidth + "px"});
} else { } else {

View File

@ -1,6 +1,6 @@
name = ".Pear Theme" name = ".Pear Theme"
description = "A theme with the intention to mimic Apples mobile me gallery." description = "A theme with the intention to mimic Apples mobile me gallery."
version = 2.7 version = 2.7.1
author = "Fredrik Erlandsson <fredrik.e@gmail.com>" author = "Fredrik Erlandsson <fredrik.e@gmail.com>"
site = 1 site = 1
admin = 0 admin = 0

View File

@ -95,6 +95,14 @@ endif;
<? endif; ?> <? endif; ?>
<? endif; ?> <? endif; ?>
</div> </div>
<? if (module::get_var("th_pear4gallery3", "show_sidebar")): ?>
</td><td>
<div id="sidebar" class="sidebar" style="width: 220px;">
<? if ($theme->page_subtype != "login"): ?>
<?= new View("sidebar.html") ?>
<? endif ?>
</div>
<? endif ?>
</td></tr></table> </td></tr></table>
<div id="pearFlowPadd" class="imageflow" style="display: none;"></div> <div id="pearFlowPadd" class="imageflow" style="display: none;"></div>
<div id="pearImageFlow" class="imageflow" style="display: none;"> </div> <div id="pearImageFlow" class="imageflow" style="display: none;"> </div>

View File

@ -120,8 +120,11 @@
<? if ($theme->item()): ?> <? if ($theme->item()): ?>
<div class="lNavBar"> <div class="lNavBar">
<? if(!empty($parents)): ?> <? if(!empty($parents)): ?>
<? $parent = end($parents) ?> <? foreach ($parents as $parent): ?>
<? if (!module::get_var("th_pear4gallery3", "show_breadcrumbs")) $parent = end($parents); ?>
<button class="large push large-with-push" onclick="window.location='<?= $parent->url($parent->id == $theme->item()->parent_id ? "show={$theme->item()->id}" : null) ?>' + '#viewMode=' + viewMode;"> <div class="outer"> <div class="label"> <?= html::purify(text::limit_chars($parent->title, module::get_var("gallery", "visible_title_length"))) ?></div> </div></button> <button class="large push large-with-push" onclick="window.location='<?= $parent->url($parent->id == $theme->item()->parent_id ? "show={$theme->item()->id}" : null) ?>' + '#viewMode=' + viewMode;"> <div class="outer"> <div class="label"> <?= html::purify(text::limit_chars($parent->title, module::get_var("gallery", "visible_title_length"))) ?></div> </div></button>
<? if (!module::get_var("th_pear4gallery3", "show_breadcrumbs")) break; ?>
<? endforeach ?>
<? endif ?> <? endif ?>
</div> </div>
<div class="pearTitle" title="<?= $theme->item()->description ?>"> <?= html::purify(text::limit_chars($theme->item()->title, 40)) ?> &nbsp; <div class="pearTitle" title="<?= $theme->item()->description ?>"> <?= html::purify(text::limit_chars($theme->item()->title, 40)) ?> &nbsp;
@ -183,7 +186,7 @@
<div class="clear"></div> <div class="clear"></div>
<? endif ?> <? endif ?>
</div> </div>
<? if (!module::get_var("th_pear4gallery3", "hide_logo")): ?><button id="logoButton"></button><?endif?> <? if (!module::get_var("th_pear4gallery3", "hide_logo")): ?><button id="logoButton" onclick="toggleSidebar();"></button><? endif ?>
</div> </div>
</div> <? /*class="pear"*/ ?> </div> <? /*class="pear"*/ ?>
<? endif ?> <? endif ?>