From 08a6df2274ea196056eb7441d4aff050dc3531fa Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Thu, 21 Apr 2011 15:50:53 -0700 Subject: Normally Router::find_uri() strips off the url suffix for us, but when we make the theme::$is_admin determination we're working off of the PATH_INFO so we need to strip it off manually. Fixes #1631. --- modules/gallery/helpers/theme.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index f285834c..a42fa7ad 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -41,6 +41,13 @@ class theme_Core { $config = Kohana_Config::instance(); $modules = $config->get("core.modules"); + + // Normally Router::find_uri() strips off the url suffix for us, but we're working off of the + // PATH_INFO here so we need to strip it off manually + if ($suffix = Kohana::config("core.url_suffix")) { + $path = preg_replace("#" . preg_quote($suffix) . "$#u", "", $path); + } + self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7); self::$site_theme_name = module::get_var("gallery", "active_site_theme"); if (self::$is_admin) { -- cgit v1.2.3 From 11703b24ffdf38443ac46afbfa65e6f07ec5648e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Fri, 22 Apr 2011 09:28:19 -0700 Subject: Detect if the users theme is missing (or missing a theme.info) and in that case fall back to the wind theme. Fixes #1655. --- modules/gallery/helpers/theme.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/theme.php b/modules/gallery/helpers/theme.php index a42fa7ad..37707f28 100644 --- a/modules/gallery/helpers/theme.php +++ b/modules/gallery/helpers/theme.php @@ -50,9 +50,25 @@ class theme_Core { self::$is_admin = $path == "/admin" || !strncmp($path, "/admin/", 7); self::$site_theme_name = module::get_var("gallery", "active_site_theme"); + + // If the site theme doesn't exist, fall back to wind. + if (!file_exists(THEMEPATH . self::$site_theme_name . "/theme.info")) { + site_status::error(t("Theme '%name' is missing. Falling back to the Wind theme.", + array("name" => self::$site_theme_name)), "missing_site_theme"); + module::set_var("gallery", "active_site_theme", self::$site_theme_name = "wind"); + } + if (self::$is_admin) { // Load the admin theme self::$admin_theme_name = module::get_var("gallery", "active_admin_theme"); + + // If the admin theme doesn't exist, fall back to admin_wind. + if (!file_exists(THEMEPATH . self::$admin_theme_name . "/theme.info")) { + site_status::error(t("Admin theme '%name' is missing! Falling back to the Wind theme.", + array("name" => self::$admin_theme_name)), "missing_admin_theme"); + module::set_var("gallery", "active_admin_theme", self::$admin_theme_name = "admin_wind"); + } + array_unshift($modules, THEMEPATH . self::$admin_theme_name); // If the site theme has an admin subdir, load that as a module so that -- cgit v1.2.3 From 4a9b45c9c3bbd574103e01debcd84cab1a18352a Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 22 Apr 2011 12:37:28 -0400 Subject: Created apple-touch-icon and added to wind and admin_wind themes. --- installer/install.sql | 1 + lib/images/apple-touch-icon.png | Bin 0 -> 4441 bytes modules/gallery/controllers/admin_theme_options.php | 4 ++++ modules/gallery/helpers/gallery_installer.php | 8 +++++++- modules/gallery/helpers/gallery_theme.php | 5 ++++- modules/gallery/module.info | 2 +- themes/admin_wind/views/admin.html.php | 2 ++ themes/wind/views/page.html.php | 3 ++- 8 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 lib/images/apple-touch-icon.png (limited to 'modules/gallery/helpers') diff --git a/installer/install.sql b/installer/install.sql index 77cda72b..06d2fcde 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -406,6 +406,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400'); INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0'); INSERT INTO {vars} VALUES (NULL,'gallery','visible_title_length','15'); INSERT INTO {vars} VALUES (NULL,'gallery','favicon_url','lib/images/favicon.ico'); +INSERT INTO {vars} VALUES (NULL,'gallery','apple_touch_url','lib/images/apple-touch-icon.png'); INSERT INTO {vars} VALUES (NULL,'gallery','email_from','unknown@unknown.com'); INSERT INTO {vars} VALUES (NULL,'gallery','email_reply_to','unknown@unknown.com'); INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70'); diff --git a/lib/images/apple-touch-icon.png b/lib/images/apple-touch-icon.png new file mode 100644 index 00000000..d15ce1a6 Binary files /dev/null and b/lib/images/apple-touch-icon.png differ diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 055e063c..840b3b3d 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -59,6 +59,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value); module::set_var("gallery", "favicon_url", $form->edit_theme->favicon_url->value); + module::set_var("gallery", "apple_touch_url", $form->edit_theme->apple_touch_url->value); module::event("theme_edit_form_completed", $form); @@ -93,6 +94,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $group->input("favicon_url")->label(t("URL (or relative path) to your favicon.ico")) ->id("g-favicon") ->value(module::get_var("gallery", "favicon_url")); + $group->input("apple_touch_url")->label(t("URL (or relative path) to your Apple Touch icon")) + ->id("g-apple-touch") + ->value(module::get_var("gallery", "apple_touch_url")); $group->textarea("header_text")->label(t("Header text"))->id("g-header-text") ->value(module::get_var("gallery", "header_text")); $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text") diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index 01c59eaa..cd9526b1 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -304,6 +304,7 @@ class gallery_installer { module::set_var("gallery", "maintenance_mode", 0); module::set_var("gallery", "visible_title_length", 15); module::set_var("gallery", "favicon_url", "lib/images/favicon.ico"); + module::set_var("gallery", "apple_touch_url", "lib/images/apple-touch-icon.png"); module::set_var("gallery", "email_from", ""); module::set_var("gallery", "email_reply_to", ""); module::set_var("gallery", "email_line_length", 70); @@ -311,7 +312,7 @@ class gallery_installer { module::set_var("gallery", "show_user_profiles_to", "registered_users"); module::set_var("gallery", "extra_binary_paths", "/usr/local/bin:/opt/local/bin:/opt/bin"); - module::set_version("gallery", 46); + module::set_version("gallery", 47); } static function upgrade($version) { @@ -677,6 +678,11 @@ class gallery_installer { module::set_var("gallery", "upgrade_checker_auto_enabled", true); module::set_version("gallery", $version = 46); } + + if ($version == 46) { + module::set_var("gallery", "apple_touch_url", "lib/images/apple-touch-icon.png"); + module::set_version("gallery", $version = 47); + } } static function uninstall() { diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index c4a82390..aa3fb7bb 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -60,11 +60,14 @@ class gallery_theme_Core { if ($session->get("debug")) { $buf .= $theme->css("debug.css"); } + if (in_array(URI::instance()->segment(1), array("admin", "admin/dashboard"))) { + $buf .= $theme->script("jquery.jcarousel.min.js"); + } if ($session->get("l10n_mode", false)) { $buf .= $theme->css("l10n_client.css"); $buf .= $theme->script("jquery.cookie.js"); - $buf .=$theme->script("l10n_client.js"); + $buf .= $theme->script("l10n_client.js"); } return $buf; } diff --git a/modules/gallery/module.info b/modules/gallery/module.info index 4c0c8866..aa1dc341 100644 --- a/modules/gallery/module.info +++ b/modules/gallery/module.info @@ -1,3 +1,3 @@ name = "Gallery 3" description = "Gallery core application" -version = 46 +version = 47 diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php index a56b6f41..0d35ac97 100644 --- a/themes/admin_wind/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php @@ -15,6 +15,8 @@ " type="image/x-icon" /> + " /> script("jquery.js") ?> script("jquery.form.js") ?> diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php index 2b86556d..8b9ddf8a 100644 --- a/themes/wind/views/page.html.php +++ b/themes/wind/views/page.html.php @@ -21,7 +21,8 @@ " type="image/x-icon" /> - + " /> page_type == "collection"): ?> -- cgit v1.2.3 From 3bce5d00eef5cd6c255ab63bd7391de4557a1784 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 22 Apr 2011 12:50:21 -0400 Subject: Renamed apple_touch_url to apple_touch_icon_url. --- installer/install.sql | 2 +- modules/gallery/controllers/admin_theme_options.php | 6 +++--- modules/gallery/helpers/gallery_installer.php | 4 ++-- themes/admin_wind/views/admin.html.php | 2 +- themes/wind/views/page.html.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/installer/install.sql b/installer/install.sql index 06d2fcde..c45b421b 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -406,7 +406,7 @@ INSERT INTO {vars} VALUES (NULL,'gallery','admin_area_timeout','5400'); INSERT INTO {vars} VALUES (NULL,'gallery','maintenance_mode','0'); INSERT INTO {vars} VALUES (NULL,'gallery','visible_title_length','15'); INSERT INTO {vars} VALUES (NULL,'gallery','favicon_url','lib/images/favicon.ico'); -INSERT INTO {vars} VALUES (NULL,'gallery','apple_touch_url','lib/images/apple-touch-icon.png'); +INSERT INTO {vars} VALUES (NULL,'gallery','apple_touch_icon_url','lib/images/apple-touch-icon.png'); INSERT INTO {vars} VALUES (NULL,'gallery','email_from','unknown@unknown.com'); INSERT INTO {vars} VALUES (NULL,'gallery','email_reply_to','unknown@unknown.com'); INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70'); diff --git a/modules/gallery/controllers/admin_theme_options.php b/modules/gallery/controllers/admin_theme_options.php index 840b3b3d..cb46da90 100644 --- a/modules/gallery/controllers/admin_theme_options.php +++ b/modules/gallery/controllers/admin_theme_options.php @@ -59,7 +59,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::set_var("gallery", "footer_text", $form->edit_theme->footer_text->value); module::set_var("gallery", "show_credits", $form->edit_theme->show_credits->value); module::set_var("gallery", "favicon_url", $form->edit_theme->favicon_url->value); - module::set_var("gallery", "apple_touch_url", $form->edit_theme->apple_touch_url->value); + module::set_var("gallery", "apple_touch_icon_url", $form->edit_theme->apple_touch_icon_url->value); module::event("theme_edit_form_completed", $form); @@ -94,9 +94,9 @@ class Admin_Theme_Options_Controller extends Admin_Controller { $group->input("favicon_url")->label(t("URL (or relative path) to your favicon.ico")) ->id("g-favicon") ->value(module::get_var("gallery", "favicon_url")); - $group->input("apple_touch_url")->label(t("URL (or relative path) to your Apple Touch icon")) + $group->input("apple_touch_icon_url")->label(t("URL (or relative path) to your Apple Touch icon")) ->id("g-apple-touch") - ->value(module::get_var("gallery", "apple_touch_url")); + ->value(module::get_var("gallery", "apple_touch_icon_url")); $group->textarea("header_text")->label(t("Header text"))->id("g-header-text") ->value(module::get_var("gallery", "header_text")); $group->textarea("footer_text")->label(t("Footer text"))->id("g-footer-text") diff --git a/modules/gallery/helpers/gallery_installer.php b/modules/gallery/helpers/gallery_installer.php index cd9526b1..20de1fea 100644 --- a/modules/gallery/helpers/gallery_installer.php +++ b/modules/gallery/helpers/gallery_installer.php @@ -304,7 +304,7 @@ class gallery_installer { module::set_var("gallery", "maintenance_mode", 0); module::set_var("gallery", "visible_title_length", 15); module::set_var("gallery", "favicon_url", "lib/images/favicon.ico"); - module::set_var("gallery", "apple_touch_url", "lib/images/apple-touch-icon.png"); + module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png"); module::set_var("gallery", "email_from", ""); module::set_var("gallery", "email_reply_to", ""); module::set_var("gallery", "email_line_length", 70); @@ -680,7 +680,7 @@ class gallery_installer { } if ($version == 46) { - module::set_var("gallery", "apple_touch_url", "lib/images/apple-touch-icon.png"); + module::set_var("gallery", "apple_touch_icon_url", "lib/images/apple-touch-icon.png"); module::set_version("gallery", $version = 47); } } diff --git a/themes/admin_wind/views/admin.html.php b/themes/admin_wind/views/admin.html.php index 0d35ac97..12301e02 100644 --- a/themes/admin_wind/views/admin.html.php +++ b/themes/admin_wind/views/admin.html.php @@ -16,7 +16,7 @@ href="" type="image/x-icon" /> " /> + href="" /> script("jquery.js") ?> script("jquery.form.js") ?> diff --git a/themes/wind/views/page.html.php b/themes/wind/views/page.html.php index 8b9ddf8a..1c67ff9d 100644 --- a/themes/wind/views/page.html.php +++ b/themes/wind/views/page.html.php @@ -22,7 +22,7 @@ href="" type="image/x-icon" /> " /> + href="" /> page_type == "collection"): ?> -- cgit v1.2.3 From 7deed8654549690ec7d5c7d9dd5ad479d9f0fdd8 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 22 Apr 2011 12:54:25 -0400 Subject: Removed incomplete jquery carousel code --- modules/gallery/helpers/gallery_theme.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index aa3fb7bb..e07839d9 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -60,9 +60,6 @@ class gallery_theme_Core { if ($session->get("debug")) { $buf .= $theme->css("debug.css"); } - if (in_array(URI::instance()->segment(1), array("admin", "admin/dashboard"))) { - $buf .= $theme->script("jquery.jcarousel.min.js"); - } if ($session->get("l10n_mode", false)) { $buf .= $theme->css("l10n_client.css"); -- cgit v1.2.3