diff --git a/themes/greydragon/admin/controllers/admin_theme_options.php b/themes/greydragon/admin/controllers/admin_theme_options.php new file mode 100644 index 00000000..ed4d0426 --- /dev/null +++ b/themes/greydragon/admin/controllers/admin_theme_options.php @@ -0,0 +1,146 @@ +"g-theme-options-form")); + + $group = $form->group("requirements")->label("Prerequisites checklist"); + $group->checkbox("shadowbox")->label(t("Shadowbox module")) + ->checked((module::is_active("shadowbox")))->disabled(true); + + $file = THEMEPATH . "greydragon/theme.info"; + $theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS); + + $group = $form->group("edit_theme")->label(t("Grey Dragon Theme") . " - " . t("v.") . $theme_info->version); + $group->input("row_count")->label(t("Rows per album page"))->id("g-page-size") + ->rules("required|valid_digit") + ->value(module::get_var("gallery", "page_size") / 3); + + $group->input("resize_size")->label(t("Resized image size (in pixels)"))->id("g-resize-size") + ->rules("required|valid_digit") + ->value(module::get_var("gallery", "resize_size")); + $group->checkbox("build_resize")->label(t("Mark to build all resizes (from Maintenace page)"))->id("g-build-resize")->value(false); + $group->checkbox("build_thumbs")->label(t("Mark to build all thumbnails (200x200) (from Maintenace page)"))->id("g-build-thumb")->value(false); + + $group->checkbox("photonav_top")->label(t("Show top photo navigator")) + ->checked(module::get_var("th_greydragon", "photonav_top")); + $group->checkbox("photonav_bottom")->label(t("Show bottom photo navigator")) + ->checked(module::get_var("th_greydragon", "photonav_bottom")); + + $group->dropdown("sidebar_allowed")->label(t("Allowed SideBar Positions")) + ->options(array("any" => t("Any"), "left" => t("Left"), "right" => t("Right"), "none" => t("None"))) + ->selected(module::get_var("th_greydragon", "sidebar_allowed")); + $group->dropdown("sidebar_visible")->label(t("Default SideBar Position")) + ->options(array("right" => t("Right"), "left" => t("Left"), "none" => t("None"))) + ->selected(module::get_var("th_greydragon", "sidebar_visible")); + + $group->input("header_text")->label(t("Header text"))->id("g-header-text") + ->value(module::get_var("gallery", "header_text")); + $group->input("footer_text")->label(t("Footer text"))->id("g-footer-text") + ->value(module::get_var("gallery", "footer_text")); + $group->checkbox("show_credits")->label(t("Show site credits"))->id("g-footer-text") + ->checked(module::get_var("gallery", "show_credits")); + + $group->input("copyright")->label(t("Copyright message to display on footer"))->id("g-theme-copyright") + ->value(module::get_var("th_greydragon", "copyright")); + $group->input("logo_path")->label(t("URL or path to alternate logo image"))->id("g-site-logo") + ->value(module::get_var("th_greydragon", "logo_path")); + + module::event("theme_edit_form", $form); + + $group = $form->group("buttons"); + $group->submit("")->value(t("Save")); + return $form; + } + + public function index() { + $view = new Admin_View("admin.html"); + $view->content = new View("admin_theme_options.html"); + $view->content->form = self::get_edit_form_admin(); + print $view; + } + + public function save() { + access::verify_csrf(); + + $form = self::get_edit_form_admin(); + if ($form->validate()) { + $edit_theme = $form->edit_theme; + + module::set_var("gallery", "page_size", $edit_theme->row_count->value * 3); + + $resize_size = $edit_theme->resize_size->value; + $thumb_size = 200; + $build_resize = $edit_theme->build_resize->value; + $build_thumbs = $edit_theme->build_thumbs->value; + + if (module::get_var("gallery", "resize_size") != $resize_size) { + module::set_var("gallery", "resize_size", $resize_size); + $build_resize = true; + } + if (module::get_var("gallery", "thumb_size") != $thumb_size) { + module::set_var("gallery", "thumb_size", $thumb_size); + } + + 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); + } + + if ($build_thumbs) { + graphics::remove_rule("gallery", "thumb", "gallery_graphics::resize"); + graphics::add_rule("gallery", "thumb", "gallery_graphics::resize", + array("width" => 200, "height" => 200, "master" => Image::AUTO), 100); + } + + module::set_var("th_greydragon", "photonav_top", $edit_theme->photonav_top->value); + module::set_var("th_greydragon", "photonav_bottom", $edit_theme->photonav_bottom->value); + + $sidebar_allowed = $edit_theme->sidebar_allowed->value; + $sidebar_visible = $edit_theme->sidebar_visible->value; + + if ($sidebar_allowed == "none") { $sidebar_visible = "none"; } + if ($sidebar_allowed == "right") { $sidebar_visible = "right"; } + if ($sidebar_allowed == "left") { $sidebar_visible = "left"; } + + module::set_var("th_greydragon", "sidebar_allowed", $sidebar_allowed); + module::set_var("th_greydragon", "sidebar_visible", $sidebar_visible); + + module::set_var("gallery", "header_text", $edit_theme->header_text->value); + module::set_var("gallery", "footer_text", $edit_theme->footer_text->value); + module::set_var("gallery", "show_credits", $edit_theme->show_credits->value); + + module::set_var("th_greydragon", "copyright", $edit_theme->copyright->value); + module::set_var("th_greydragon", "logo_path", $edit_theme->logo_path->value); + + module::event("theme_edit_form_completed", $form); + + message::success(t("Updated theme details")); + url::redirect("admin/theme_options"); + } else { + $view = new Admin_View("admin.html"); + $view->content = $form; + print $view; + } + } +} + diff --git a/themes/greydragon/changelog.txt b/themes/greydragon/changelog.txt index 6db84369..f6750d23 100644 --- a/themes/greydragon/changelog.txt +++ b/themes/greydragon/changelog.txt @@ -1,5 +1,18 @@ Grey Dragon Theme Changelog +version 1.5.8 +- Finally admin module for theme is there. After theme installation, visit Appearance/Theme Options to configure the theme. + If you had older version of the theme, initial setup is also required. + The following settings are available: + - Rows per album page - theme uses 3 columns layout for pictures, therefore default page_size is computed in x3 increments + - Thumb size is restricted to 200 and therefore not available for administration + - Mark to build resizes/thumbs - allows force rebuilding of images + - Show/Hide top/bottom photo navigators + - Specify allowed and default sidebar position + - Administrator can now specify Copyright message to display in the footer + - Site logo is now default to Gallery 3 logo, but admin can provide a path to custom logo. +- Sidebar session cookie is set to expire in 365 days + version 1.5.7 - Status message has been moved into header as popup to prevent obstruction of the main view. jQuery is used to fade it out in 10 sec. diff --git a/themes/greydragon/css/screen.css b/themes/greydragon/css/screen.css index 86d28b45..974521a1 100644 --- a/themes/greydragon/css/screen.css +++ b/themes/greydragon/css/screen.css @@ -81,7 +81,7 @@ h5 { font-weight: bold; } /* Pagination ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -.g-paginator { display: inline-block; width: 100%; padding: 4px 0 6px 0; font-size: 80%; zoom: 1; } +.g-paginator { display: inline-block; width: 100%; padding: 4px 0 0 0; font-size: 80%; zoom: 1; } .g-paginator li { display: inline; float: left; margin-left: 0; zoom: 1; } .g-paginator a { padding: 0 0 0 2px; } @@ -91,7 +91,7 @@ h5 { font-weight: bold; } /* Album grid ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ .g-thumbcrop { overflow: hidden; position: relative; width: 200px; height: 150px; } -#g-album-grid { padding: 0px; width: 100%; } +#g-album-grid { padding: 6px 0 0 0; width: 100%; } #g-album-grid .g-item { position: relative; float: left; padding: 10px 9px 0px 9px; width: 30.5%; height: 190px; background: url('../images/image_thumb.gif') no-repeat; } #g-album-grid .g-item p { text-align: center; } #g-album-grid h2 { position: absolute; top: 164px; left: 12px; width: 150px; font: 100%/100% Arial, Helvetica, sans-serif; } @@ -119,7 +119,7 @@ h5 { font-weight: bold; } #g-info h1 { padding-bottom: 1px; border-bottom: 1px solid #888; } #g-info .g-description { display: none; } /* #g-info h1:hover .g-description { position: relative; z-index: 10; top: 10px; left: 0px; width: 90%; display: block; afloat: left; border: 1px solid #888; padding: 6px; }*/ -#g-photo { padding: 6px 0 0 6px; text-align: center; } +#g-photo { padding: 6px 0 6px 6px; text-align: center; } #g-albumheader h1 { padding-bottom: 1px; margin-bottom: 6px; border-bottom: 1px solid #888; } /* Footer section ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ diff --git a/themes/greydragon/images/logo.png b/themes/greydragon/images/logo.png deleted file mode 100644 index 2a06cd6c..00000000 Binary files a/themes/greydragon/images/logo.png and /dev/null differ diff --git a/themes/greydragon/theme.info b/themes/greydragon/theme.info index c22e9d69..2deac9b4 100644 --- a/themes/greydragon/theme.info +++ b/themes/greydragon/theme.info @@ -1,6 +1,6 @@ name = "Grey Dragon Theme" description = "A Crisp theme uses on clear grey colors and minimized on JS overhead" -version = 1.5.6 +version = 1.5.8 author = "2009 Serguei Dosyukov" site = 1 admin = 0 diff --git a/themes/greydragon/views/album.html.php b/themes/greydragon/views/album.html.php index 224cbe31..8164bace 100644 --- a/themes/greydragon/views/album.html.php +++ b/themes/greydragon/views/album.html.php @@ -5,7 +5,11 @@