Support for theme options
This commit is contained in:
parent
970068a0ee
commit
9a8bbdfa09
341
admin/controllers/admin_theme_options.php
Normal file
341
admin/controllers/admin_theme_options.php
Normal file
@ -0,0 +1,341 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
/*
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
class Admin_Theme_Options_Controller extends Admin_Controller {
|
||||
|
||||
protected $min_gallery_ver = 46;
|
||||
|
||||
private function load_theme_info() {
|
||||
$file = THEMEPATH . "pear4gallery3/theme.info";
|
||||
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
|
||||
return $theme_info;
|
||||
}
|
||||
|
||||
private function get_theme_version() {
|
||||
$theme_info = $this->load_theme_info();
|
||||
return ($theme_info->version);
|
||||
}
|
||||
|
||||
private function get_theme_name() {
|
||||
$theme_info = $this->load_theme_info();
|
||||
return ($theme_info->name);
|
||||
}
|
||||
|
||||
private function get_packlist($type, $filename) {
|
||||
$packlist = array();
|
||||
$packroot = THEMEPATH . 'pear4gallery3/css/' . $type . '/';
|
||||
|
||||
foreach (scandir($packroot) as $pack_name):
|
||||
if (file_exists($packroot . "$pack_name/" . $filename . ".css")):
|
||||
if ($pack_name[0] == "."):
|
||||
continue;
|
||||
endif;
|
||||
|
||||
$packlist[$pack_name] = t($pack_name);
|
||||
endif;
|
||||
endforeach;
|
||||
return $packlist;
|
||||
}
|
||||
|
||||
private function prerequisite_check($group, $id, $is_ok, $caption, $caption_ok, $caption_failed, $iswarning, $msg_error) {
|
||||
$confirmation_caption = ($is_ok)? $caption_ok : $caption_failed;
|
||||
$checkbox = $group->checkbox($id)
|
||||
->label($caption . " " . $confirmation_caption)
|
||||
->checked($is_ok)
|
||||
->disabled(true);
|
||||
if ($is_ok):
|
||||
$checkbox->class("g-success");
|
||||
elseif ($iswarning):
|
||||
$checkbox->class("g-prerequisite g-warning")->error_messages("failed", $msg_error)->add_error("failed", 1);
|
||||
else:
|
||||
$checkbox->class("g-error")->error_messages("failed", $msg_error)->add_error("failed", 1);
|
||||
endif;
|
||||
}
|
||||
|
||||
/* Convert old values ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
protected function upgrade_settings() {
|
||||
/* if (module::get_var("th_pear4gallery3", "hide_thumbmeta")):
|
||||
module::set_var("th_pear4gallery3", "thumb_metamode", "hide");
|
||||
module::clear_var("th_pear4gallery3", "hide_thumbmeta");
|
||||
endif;*/
|
||||
}
|
||||
|
||||
protected function get_edit_form_admin() {
|
||||
$this->upgrade_settings();
|
||||
|
||||
$form = new Forge("admin/theme_options/save/", "", null, array("id" =>"g-theme-options-form"));
|
||||
|
||||
// Just commenting out, we might want rssmodule in future versions.
|
||||
// $rssmodulecheck = (module::is_active("rss") && module::info("rss"));
|
||||
|
||||
/* Prerequisites ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
$group = $form->group("requirements")->label(t("Prerequisites"));
|
||||
$gallery_ver = module::get_version("gallery");
|
||||
$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));
|
||||
$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."));
|
||||
if (!module::get_var("th_pear4gallery3", "hide_thumbmeta")):
|
||||
$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."));
|
||||
endif;
|
||||
|
||||
/* General Settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
$group = $form->group("edit_theme")->label(t("General Settings"));
|
||||
$group->input("favicon")
|
||||
->label(t("URL (or relative path) to your favicon.ico"))
|
||||
->value(module::get_var("gallery", "favicon_url"));
|
||||
$group->input("appletouchicon")
|
||||
->label(t("URL (or relative path) to your apple-touch-icon.png"))
|
||||
->value(module::get_var("gallery", "appletouchicon_url"));
|
||||
|
||||
/* Advanced Options - General ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
$group = $form->group("edit_theme_adv_main")->label(t("Advanced Options - General"));
|
||||
$group->checkbox("show_logo")
|
||||
->label(t("Show Bottom Pear Logo"))
|
||||
->checked(module::get_var("th_pear4gallery3", "show_logo"));
|
||||
$group->dropdown("mainmenu_view")
|
||||
->label(t("Main page View"))
|
||||
->options(array("grid" => t("Grid (Default)"), "mosaic" => t("Mosaic")))
|
||||
->selected(module::get_var("th_pear4gallery3", "mainmenu_view"));
|
||||
$group->checkbox("show_guest_menu")
|
||||
->label(t("Show Main Menu for Guest Users"))
|
||||
->checked(module::get_var("th_pear4gallery3", "show_guest_menu"));
|
||||
$group->dropdown("background")
|
||||
->label(t("Background color"))
|
||||
->options(array("black" => t("Black (Default)"), "dkgrey" => t("Dark-Grey"), "ltgrey" => t("Light-Grey"), "white" => t("White")))
|
||||
->selected(module::get_var("th_pear4gallery3", "background"));
|
||||
$group->input("ga_code")
|
||||
->label(t("<a href=\"http://www.google.com/analytics/\">Google analytics</a> code."))
|
||||
->value(module::get_var("th_pear4gallery3", "ga_code"));
|
||||
|
||||
/* Advanced Options - Photo page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
/*
|
||||
$group = $form->group("edit_theme_adv_photo")->label(t("Advanced Options - Photo Page"));
|
||||
$group->dropdown("photo_popupbox")
|
||||
->label(t($sb_fb_caption) . " " . t("Mode"))
|
||||
->options(array("default" => t("Default (Slideshow/Preview)"), "preview" => t("Preview Only"), "none" => t("Disable")))
|
||||
->selected(module::get_var("th_pear4gallery3", "photo_popupbox"));
|
||||
$group->dropdown("photo_descmode")
|
||||
->label(t("Description Display Mode"))
|
||||
->options(array("overlay_top" => t("Overlay Top"), "overlay_bottom" => t("Overlay Bottom"), "bottom" => t("Bottom"), "top" => t("Top"), "hide" => t("Hide")))
|
||||
->selected(module::get_var("th_pear4gallery3", "photo_descmode"));
|
||||
$group->checkbox("thumb_inpage")
|
||||
->label(t("Keep Thumb Nav Block on the side"))
|
||||
->checked(module::get_var("th_pear4gallery3", "thumb_inpage"));
|
||||
if (!$thumbnavcheck):
|
||||
$group->thumb_inpage->disabled(true);
|
||||
endif;
|
||||
$group->checkbox("hide_photometa")
|
||||
->label(t("Hide Item Meta Data"))
|
||||
->checked(module::get_var("th_pear4gallery3", "hide_photometa", TRUE));
|
||||
$group->checkbox("desc_allowbbcode")
|
||||
->label(t("Allow BBCode/HTML in Descriptions"))
|
||||
->checked(module::get_var("th_pear4gallery3", "desc_allowbbcode"));
|
||||
*/
|
||||
/* Maintenance ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||
|
||||
$group = $form->group("maintenance")->label(t("Maintenance"));
|
||||
$group->checkbox("build_resize")->label(t("Mark all Image Resizes for Rebuild"))->checked(false);
|
||||
$group->checkbox("build_thumbs")->label(t("Mark all Thumbnails for Rebuild"))->checked(false);
|
||||
$group->checkbox("build_exif")->label(t("Mark Exif Info data for reload"))->checked(false);
|
||||
if ($iptccheck):
|
||||
$group->checkbox("build_iptc")->label(t("Mark IPTC Info data for reload"))->checked(false);
|
||||
endif;
|
||||
$group->checkbox("purge_cache")->label(t("Purge cache data"))->checked(false);
|
||||
$group->checkbox("reset_theme")->label(t("Reset Theme to a Default State"))->checked(false);
|
||||
|
||||
module::event("theme_edit_form", $form);
|
||||
|
||||
$form->submit("g-theme-options-save")->value(t("Save Changes"));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
protected function get_edit_form_help() {
|
||||
$help = '<fieldset>';
|
||||
$help .= '<legend>Help</legend><ul>';
|
||||
$help .= '<li><h3>Prerequisites</h3>
|
||||
<p style="color: red;">Requirements need to be met for theme to function properly.
|
||||
</li>';
|
||||
|
||||
$help .= '<li><h3>General Settings</h3>
|
||||
</li>';
|
||||
|
||||
$help .= '<li><h3>Advanced Options - General</h3>
|
||||
</li>';
|
||||
$help .= '<li><h3>Advanced Options - Photo Page</h3>
|
||||
</li>';
|
||||
$help .= '<li><h3>Maintenance</h3>
|
||||
<p>Without changing image size, you can <b>Mark all Resizes for Rebuild</b>.
|
||||
Then you need to visit Admin\Maintenance to initiate the process.
|
||||
<p>Same can be done for image thumbs with <b>Mark all Thumbnails for Rebuild</b>.
|
||||
<p><b>Mark Exif/IPTC Info for reload</b> would mark all Exif or IPTC records as "Dirty" allowing it to be repopulated.
|
||||
<p>And just in case you think that something is not right, you can always <b>Reset Theme to a Default State</b>.
|
||||
</li>';
|
||||
$help .= '</ul></fieldset>';
|
||||
return t($help);
|
||||
}
|
||||
|
||||
private function save_item_state($statename, $state, $value) {
|
||||
if ($state):
|
||||
module::set_var("th_pear4gallery3", $statename, $value);
|
||||
else:
|
||||
module::clear_var("th_pear4gallery3", $statename);
|
||||
endif;
|
||||
}
|
||||
|
||||
protected function legacy() {
|
||||
module::clear_var("th_pear4gallery3", "show_logo");
|
||||
module::clear_var("th_pear4gallery3", "mainmenu_view");
|
||||
module::clear_var("th_pear4gallery3", "show_guest_menu");
|
||||
module::clear_var("th_pear4gallery3", "background");
|
||||
module::clear_var("th_pear4gallery3", "ga_code");
|
||||
}
|
||||
|
||||
protected function reset_theme() {
|
||||
// Default core theme settings
|
||||
module::set_var("gallery", "page_size", 9);
|
||||
module::set_var("gallery", "resize_size", 640);
|
||||
module::set_var("gallery", "thumb_size", 200);
|
||||
module::set_var("gallery", "header_text", "");
|
||||
module::set_var("gallery", "footer_text", "");
|
||||
module::set_var("gallery", "show_credits", FALSE);
|
||||
module::clear_all_vars("th_pear4gallery3");
|
||||
}
|
||||
|
||||
public function save() {
|
||||
site_status::clear("gd_init_configuration");
|
||||
access::verify_csrf();
|
||||
|
||||
$form = self::get_edit_form_admin();
|
||||
|
||||
if ($form->validate()):
|
||||
$this->legacy();
|
||||
|
||||
if ($form->maintenance->reset_theme->value):
|
||||
$this->reset_theme();
|
||||
module::event("theme_edit_form_completed", $form);
|
||||
message::success(t("Theme details are reset"));
|
||||
else:
|
||||
// * General Settings ****************************************************
|
||||
|
||||
$resize_size = 800;
|
||||
|
||||
$build_resize = $form->maintenance->build_resize->value;
|
||||
$build_thumbs = $form->maintenance->build_thumbs->value;
|
||||
$build_exif = $form->maintenance->build_exif->value;
|
||||
if (module::is_active("iptc") and module::info("iptc")):
|
||||
$build_iptc = $form->maintenance->build_iptc->value;
|
||||
else:
|
||||
$build_iptc = FALSE;
|
||||
endif;
|
||||
$purge_cache = $form->maintenance->purge_cache->value;
|
||||
|
||||
$thumb_descmode_a = $form->edit_theme_adv_thumb->thumb_descmode_a->value;
|
||||
$thumb_descmode = $form->edit_theme_adv_thumb->thumb_descmode->value;
|
||||
$thumb_metamode = $form->edit_theme_adv_thumb->thumb_metamode->value;
|
||||
$photo_descmode = $form->edit_theme_adv_photo->photo_descmode->value;
|
||||
$photo_popupbox = $form->edit_theme_adv_photo->photo_popupbox->value;
|
||||
|
||||
if ($build_resize):
|
||||
graphics::remove_rule("gallery", "resize", "gallery_graphics::resize");
|
||||
graphics::add_rule("gallery", "resize", "gallery_graphics::resize",
|
||||
array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100);
|
||||
endif;
|
||||
|
||||
if (module::get_var("gallery", "resize_size") != $resize_size):
|
||||
module::set_var("gallery", "resize_size", $resize_size);
|
||||
endif;
|
||||
|
||||
$thumb_size = 200;
|
||||
$rule = Image::AUTO;
|
||||
|
||||
if ($build_thumbs):
|
||||
graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize");
|
||||
graphics::add_rule("gallery", "thumb", "gallery_graphics::resize",
|
||||
array("width" => $thumb_size, "height" => $thumb_size, "master" => $rule), 100);
|
||||
endif;
|
||||
|
||||
if (module::get_var("gallery", "thumb_size") != $thumb_size):
|
||||
module::set_var("gallery", "thumb_size", $thumb_size);
|
||||
endif;
|
||||
|
||||
module::set_var("gallery", "page_size", 50);
|
||||
module::set_var("gallery", "favicon_url", $form->edit_theme->favicon->value);
|
||||
module::set_var("gallery", "appletouchicon_url", $form->edit_theme->appletouchicon->value);
|
||||
|
||||
$this->save_item_state("logo_path", $form->edit_theme->logo_path->value, $form->edit_theme->logo_path->value);
|
||||
|
||||
// * Advanced Options - General ******************************************
|
||||
|
||||
$this->save_item_state("show_logo", $form->edit_theme_adv_main->show_logo->value, TRUE);
|
||||
$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("background", $form->edit_theme_adv_main->background->value != "black", $form->edit_theme_adv_main->background->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 ***************************************
|
||||
/*
|
||||
$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("thumb_inpage", $form->edit_theme_adv_photo->thumb_inpage->value, TRUE);
|
||||
$this->save_item_state("hide_photometa", !$form->edit_theme_adv_photo->hide_photometa->value, FALSE);
|
||||
$this->save_item_state("desc_allowbbcode", $form->edit_theme_adv_photo->desc_allowbbcode->value, TRUE);
|
||||
*/
|
||||
|
||||
module::event("theme_edit_form_completed", $form);
|
||||
|
||||
if ($_priorratio != $thumb_ratio):
|
||||
message::warning(t("Thumb aspect ratio has been changed. Consider rebuilding thumbs if needed."));
|
||||
endif;
|
||||
|
||||
message::success(t("Updated theme details"));
|
||||
|
||||
if ($build_exif):
|
||||
db::update('exif_records')
|
||||
->set(array('dirty'=>'1'))
|
||||
->execute();
|
||||
endif;
|
||||
|
||||
if ($build_iptc):
|
||||
db::update('iptc_records')
|
||||
->set(array('dirty'=>'1'))
|
||||
->execute();
|
||||
endif;
|
||||
|
||||
if ($purge_cache):
|
||||
db::build()
|
||||
->delete("caches")
|
||||
->execute();
|
||||
endif;
|
||||
endif;
|
||||
url::redirect("admin/theme_options");
|
||||
else:
|
||||
print $this->get_admin_view();
|
||||
endif;
|
||||
}
|
||||
|
||||
protected function get_admin_view() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->page_title = t(".Pear Theme");
|
||||
$view->content = new View("admin_theme_options.html");
|
||||
$view->content->name = self::get_theme_name();
|
||||
$view->content->version = self::get_theme_version();
|
||||
$view->content->form = self::get_edit_form_admin();
|
||||
$view->content->help = self::get_edit_form_help();
|
||||
return $view;
|
||||
}
|
||||
|
||||
public function index() {
|
||||
site_status::clear("gd_init_configuration");
|
||||
print $this->get_admin_view();
|
||||
}
|
||||
}
|
||||
?>
|
90
admin/views/admin_include.html.php
Normal file
90
admin/views/admin_include.html.php
Normal file
@ -0,0 +1,90 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Grey Dragon Theme - a custom theme for Gallery 3
|
||||
* This theme was designed and built by Serguei Dosyukov, whose blog you will find at http://blog.dragonsoft.us
|
||||
* Copyright (C) 2009-2011 Serguei Dosyukov
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
?>
|
||||
<style>
|
||||
#g-header { margin-bottom: 10px; }
|
||||
#gd-admin { position: relative; font-size: 0.9em; }
|
||||
#gd-admin legend { width: 99.5%; padding: 0.4em 0.8em; margin-left: -11px; background: url(/themes/greydragon/images/blue-grad.png) #d5e6f2 repeat-x left top; border: #dfdfdf 1px solid;}
|
||||
|
||||
.g-admin-left { float: left; width: 53%; }
|
||||
.g-admin-right { float: left; width: 46%; margin-left: 1%; margin-top: 1em; }
|
||||
.g-admin-right h3 { border-bottom: #a2bdbf 1px solid; margin-top: 0.3em; margin-bottom: 0.3em; }
|
||||
|
||||
#gd-admin-head { position: relative; height: auto; clear: both; display: block; overflow: auto; font-size: 11px; padding: 0.4em 0.8em; background-color: #b7c9d6; border: #a2bdbf 1px solid; }
|
||||
#gd-admin-title { float: left; color: #333v42; font-weight: bold; font-size: 1.6em; text-shadow: #deeefa 0 1px 0; }
|
||||
#gd-admin-hlinks ul { float: right; margin-top: 0.4em; font-size: 11px; }
|
||||
#gd-admin-hlinks li { list-style-type: none; float: left; color: #618299; display: inline; }
|
||||
#gd-admin-hlinks a { font-weight: bold; font-size: 13px; }
|
||||
|
||||
#gd-admin form { border: none; }
|
||||
#gd-admin fieldset { border: #ccc 1px solid; }
|
||||
#gd-admin input.g-error { padding-left: 30px; border: none; }
|
||||
#gd-admin input.g-success { background-color: transparent; }
|
||||
#gd-admin input.g-warning { background-color: transparent; border: none; }
|
||||
#gd-admin p.g-error { padding-left: 30px; border: none; margin-bottom: 0; background-image: none; }
|
||||
|
||||
#g-content { padding: 0 1em; width: 97%; font-size: 1em; }
|
||||
#g-content form ul li input { display: inline; float: left; margin-right: 0.8em; }
|
||||
#g-content form ul li select { display: inline; float: left; margin-right: 0.8em; width: 50.6%; padding: 0 0 0 .2em; }
|
||||
#g-content form ul li input[type='text'] { width: 50%; }
|
||||
#g-content form ul li textarea { height: 6em; }
|
||||
#g-content form input[type="submit"] { border: #5b86ab 2px solid; padding: 0.3em; color: #fff; background: url(/themes/greydragon/images/button-grad-vs.png) #5580a6 repeat-x left top; }
|
||||
#g-content form input[type="submit"]:hover,
|
||||
input.ui-state-hover { background-image: url(/themes/greydragon/images/button-grad-active-vs.png); border-color: #2e5475; color: #eaf2fa !important; }
|
||||
#g-content form #vercheck, #g-content form #shadowbox, #g-content form #organizecheck { display: none; }
|
||||
</style>
|
||||
|
||||
<script>
|
||||
$(document).ready( function() {
|
||||
$('form').submit( function() {
|
||||
$('input[type=submit]', this).attr('disabled', 'disabled');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<?
|
||||
if ($is_module):
|
||||
$admin_info = new ArrayObject(parse_ini_file(MODPATH . $name . "/module.info"), ArrayObject::ARRAY_AS_PROPS);
|
||||
$version = number_format($admin_info->version / 10, 1, '.', '');
|
||||
else:
|
||||
$admin_info = new ArrayObject(parse_ini_file(THEMEPATH . $name . "/theme.info"), ArrayObject::ARRAY_AS_PROPS);
|
||||
$version = $admin_info->version;
|
||||
endif;
|
||||
?>
|
||||
|
||||
<div id="gd-admin" class="g-block">
|
||||
<div id="gd-admin-head">
|
||||
<div id="gd-admin-title"><?= t($admin_info->name) ?> - <?= $version ?></div>
|
||||
<div id="gd-admin-hlinks">
|
||||
<ul><li><a href="http://codex.gallery2.org/Gallery3:Themes:pear" target="_blank"><?= t("Home") ?></a> | </li>
|
||||
<? if (isset($admin_info->support)): ?>
|
||||
<li><a href="<?= $admin_info->support; ?>" target="_blank"><?= t("Support") ?></a> | </li>
|
||||
<? endif; ?>
|
||||
<? if (isset($admin_info->download)): ?>
|
||||
<li><a href="<?= $admin_info->download; ?>" target="_blank"><?= t("Download") ?></a> | </li>
|
||||
<? endif; ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="g-block-content g-admin-left">
|
||||
<?= $form ?>
|
||||
</div>
|
||||
<div class="g-admin-right">
|
||||
<?= $help ?>
|
||||
</div>
|
||||
</div>
|
14
admin/views/admin_theme_options.html.php
Normal file
14
admin/views/admin_theme_options.html.php
Normal file
@ -0,0 +1,14 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
$view = new View("admin_include.html");
|
||||
|
||||
$view->is_module = FALSE;
|
||||
$view->name = "pear4gallery3";
|
||||
$view->form = $form;
|
||||
$view->help = $help;
|
||||
print $view;
|
||||
?>
|
||||
|
27
helpers/pear4gallery3_installer.php
Normal file
27
helpers/pear4gallery3_installer.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access."); ?>
|
||||
<?
|
||||
class pear4gallery3_installer {
|
||||
static function install() {
|
||||
site_status::warning(t("Initial configuration for the theme may be required. Visit Admin\Appearance\Theme Options before continue."), "gd_init_configuration");
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::warning(t("DeActivate."), "gd_init_configuration");
|
||||
//site_status::clear("gd_init_configuration");
|
||||
}
|
||||
|
||||
static function activate() {
|
||||
site_status::warning(t("Activate."), "gd_init_configuration");
|
||||
if (module::get_var("gallery", "resize_size") != 800):
|
||||
module::set_var("gallery", "resize_size", 800);
|
||||
endif;
|
||||
if (module::get_var("gallery", "thumb_size") != 200):
|
||||
module::set_var("gallery", "thumb_size", 200);
|
||||
endif;
|
||||
if (module::get_var("gallery", "page_size") != 50):
|
||||
module::set_var("gallery", "page_size", 50);
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
19
js/pear.js
19
js/pear.js
@ -214,7 +214,7 @@ function mosaicResize()
|
||||
if($('#conf_imageflow').length) refresh();
|
||||
}
|
||||
|
||||
$(function() {
|
||||
function bodyLoad(viewMode, bgcolor) {
|
||||
/* Parse hash */
|
||||
hash = window.location.hash;
|
||||
var h = $.parseQuery(hash.substring(1));
|
||||
@ -253,13 +253,18 @@ $(function() {
|
||||
$('#prev_detail').click(function(){ swatchImg(currentImg-1); });
|
||||
$('#next_detail').click(function(){ swatchImg(currentImg+1); });
|
||||
|
||||
if(!slideshowImages.length) opt=1;
|
||||
opt=1;
|
||||
switch (opt) {
|
||||
case 1:
|
||||
co=getCookie('swatchSkin');
|
||||
if (co==null || co=="")
|
||||
swatchSkin(bgcolor);
|
||||
|
||||
if(!slideshowImages.length)
|
||||
viewMode='grid';
|
||||
|
||||
switch (viewMode) {
|
||||
case 'grid':
|
||||
switchToGrid();
|
||||
break;
|
||||
case 2:
|
||||
case 'mosaic':
|
||||
switchToMosaic();
|
||||
break;
|
||||
default:
|
||||
@ -269,7 +274,7 @@ $(function() {
|
||||
$('#loading').hide();
|
||||
//window.setTimeout("preFetch()", 500);
|
||||
setKeys();
|
||||
});
|
||||
}
|
||||
|
||||
function switchToGrid()
|
||||
{
|
||||
|
@ -1,6 +1,6 @@
|
||||
name = ".Pear"
|
||||
name = ".Pear Theme"
|
||||
description = "A theme with the intention to mimic Apples mobile me gallery."
|
||||
version = 1
|
||||
version = 1.0.1
|
||||
author = "Fredrik Erlandsson <fredrik.e@gmail.com>"
|
||||
site = 1
|
||||
admin = 0
|
||||
|
@ -1,5 +1,11 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? /* Placeholder for infromation in mosaic view. */ ?>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
bodyLoad( "<?=module::get_var("th_pear4gallery3", "mainmenu_view")?>",
|
||||
"<?=module::get_var("th_pear4gallery3", "background")?>");
|
||||
});
|
||||
</script>
|
||||
<table id="mosaicTable" style="width: 100%; margin: -2px -2px 0px 0px; overflow: hidden">
|
||||
<tr>
|
||||
<td class="left" style=" width: 65%; vertical-align: middle; padding: 0px;">
|
||||
|
@ -81,7 +81,20 @@
|
||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/pear.css") ?>" media="screen,print,projection" />
|
||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("icons/pear.css") ?>" media="screen,print,projection" />
|
||||
<script type="text/javascript" src="<?= $theme->url("js/pear.js"); ?>"></script>
|
||||
</head>
|
||||
<!-- Google analytics code -->
|
||||
<script type="text/javascript">
|
||||
var _gaq = _gaq || [];
|
||||
_gaq.push(['_setAccount', '<? $account = module::get_var("th_pear4gallery3", "ga_code"); if ((!isset($account)) or ($account == "")) print "UA-23621420-1"; else print $account;?>']);
|
||||
_gaq.push(['_setDomainName', 'none']);
|
||||
_gaq.push(['_setAllowLinker', true]);
|
||||
_gaq.push(['_trackPageview']);
|
||||
(function() {
|
||||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
||||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
||||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body <?= $theme->body_attributes() ?>>
|
||||
<?= new View("hoverView.html") ?>
|
||||
@ -101,7 +114,7 @@
|
||||
<? endif ?>
|
||||
</div>
|
||||
<div class="pearTitle" title="<?= $theme->item()->description ?>"> <?= html::purify(text::limit_chars($theme->item()->title, 40)) ?>
|
||||
<span class="count">(<?= $theme->item()->children() ?>)</span>
|
||||
<span class="count">(<?= count($theme->item()->children()) ?>)</span>
|
||||
</div>
|
||||
<? endif ?>
|
||||
<div class="rNavBar">
|
||||
@ -161,7 +174,7 @@
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
||||
<button id="logoButton"></button>
|
||||
<? if (module::get_var("th_pear4gallery3", "show_logo")): ?><button id="logoButton"></button><?endif?>
|
||||
</div>
|
||||
</div> <? /*class="pear"*/ ?>
|
||||
<? endif ?>
|
||||
|
Reference in New Issue
Block a user