From b79129e3651a92250b61a501b8c6a1d53bf4928c Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 23 Sep 2009 12:02:35 -0700 Subject: Clone the photo::get_edit_form to the movies helper and use it to generate the movie edit form. Fixes ticket #726. --- modules/gallery/helpers/gallery.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'modules/gallery/helpers/gallery.php') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 80ae65bd..91dd2073 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -114,19 +114,32 @@ class gallery_Core { } } + switch ($item->type) { + case "album": + $option_text = t("Album options"); + $edit_text = t("Edit album"); + break; + case "movie": + $option_text = t("Movie options"); + $edit_text = t("Edit movie"); + break; + default: + $option_text = t("Photo options"); + $edit_text = t("Edit photo"); + } + $menu->append($options_menu = Menu::factory("submenu") ->id("options_menu") - ->label(t("Photo options"))); + ->label($option_text)); if ($item && ($can_edit || $can_add)) { if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_item") - ->label($item->is_album() ? t("Edit album") : t("Edit photo")) + ->label($edit_text) ->url(url::site("form/edit/{$item->type}s/$item->id"))); } if ($item->is_album()) { - $options_menu->label(t("Album options")); if ($can_edit) { $options_menu->append(Menu::factory("dialog") ->id("edit_permissions") -- cgit v1.2.3 From 8bab030883647ffaf0e0bd4d172261159d19dd08 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Wed, 23 Sep 2009 19:45:23 -0700 Subject: Add a new api method gallery::find_file. This wraps the Kohana::find_file function, but allows the extension to supplied as part of the filename. Changed the Edit permission dialog to use the new api method to locate the icons from the active theme. --- modules/gallery/helpers/gallery.php | 14 +++++++++++ modules/gallery/views/permissions_form.html.php | 33 +++++++++++++------------ 2 files changed, 31 insertions(+), 16 deletions(-) (limited to 'modules/gallery/helpers/gallery.php') diff --git a/modules/gallery/helpers/gallery.php b/modules/gallery/helpers/gallery.php index 91dd2073..d4f733e4 100644 --- a/modules/gallery/helpers/gallery.php +++ b/modules/gallery/helpers/gallery.php @@ -79,6 +79,20 @@ class gallery_Core { return date(module::get_var("gallery", "time_format", "H:i:s"), $timestamp); } + /** + * Provide a wrapper function for Kohana::find_file, that first strips the extension and + * then calls the Kohana::find_file supply that extension + * @param string directory to search in + * @param string filename to look for (without extension) + * @param boolean file required + * @return the file relative to the DOCROOT + */ + static function find_file($directory, $file, $required=false) { + $file_name = substr($file, 0, -strlen($ext = strrchr($file, '.'))); + $file_name = Kohana::find_file($directory, $file_name, $required, substr($ext, 1)); + return substr($file_name, strlen(DOCROOT)); + } + static function site_menu($menu, $theme) { if ($theme->page_type != "login") { $menu->append(Menu::factory("link") diff --git a/modules/gallery/views/permissions_form.html.php b/modules/gallery/views/permissions_form.html.php index a0bb35f2..f5639439 100644 --- a/modules/gallery/views/permissions_form.html.php +++ b/modules/gallery/views/permissions_form.html.php @@ -1,7 +1,6 @@
- @@ -12,7 +11,8 @@ - + name, $item) ?> name, $item) ?> @@ -20,33 +20,34 @@ @@ -55,30 +56,30 @@ -- cgit v1.2.3
display_name) ?> display_name) ?> + - <?= t('denied icon')->for_html_attr() ?> + " + title="for_html_attr() ?>" + alt="for_html_attr() ?>" /> - <?= t('locked icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> - - <?= t('passive allowed icon')->for_html_attr() ?> + + " alt="for_html_attr() ?>" /> - <?= t('inactive denied icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> - <?= t('inactive allowed icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> - <?= t('passive denied icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> - <?= t('inactive allowed icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> id == 1): ?> - <?= t('denied icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" title="for_html_attr() ?>"/> - <?= t('denied icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> id == 1): ?> - for_html_attr() ?>" alt="for_html_attr() ?>" /> + " title="for_html_attr() ?>" alt="for_html_attr() ?>" /> - <?= t('allowed icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" /> - <?= t('inactive denied icon')->for_html_attr() ?> + " alt="for_html_attr() ?>" />