From 5f2fe5a1df41fb7abd16b6f7af574e238e9ddeca Mon Sep 17 00:00:00 2001 From: rWatcher Date: Fri, 28 Jan 2011 10:53:57 -0500 Subject: [PATCH] Synced rWInfo with recent changes to info module. --- 3.0/modules/rwinfo/helpers/rwinfo_block.php | 65 ++++++++++++++++++- .../rwinfo/helpers/rwinfo_installer.php | 41 ++++++++++++ 3.0/modules/rwinfo/helpers/rwinfo_theme.php | 2 +- 3.0/modules/rwinfo/module.info | 2 +- 3.0/modules/rwinfo/notes.txt | 11 ++-- .../rwinfo/views/rwinfo_block.html.php | 50 +------------- 3.1/modules/rwinfo/helpers/rwinfo_block.php | 65 ++++++++++++++++++- .../rwinfo/helpers/rwinfo_installer.php | 41 ++++++++++++ 3.1/modules/rwinfo/helpers/rwinfo_theme.php | 2 +- 3.1/modules/rwinfo/module.info | 2 +- 3.1/modules/rwinfo/notes.txt | 11 ++-- .../rwinfo/views/rwinfo_block.html.php | 50 +------------- 12 files changed, 226 insertions(+), 116 deletions(-) create mode 100644 3.0/modules/rwinfo/helpers/rwinfo_installer.php create mode 100644 3.1/modules/rwinfo/helpers/rwinfo_installer.php diff --git a/3.0/modules/rwinfo/helpers/rwinfo_block.php b/3.0/modules/rwinfo/helpers/rwinfo_block.php index 7befb828..378d7a84 100644 --- a/3.0/modules/rwinfo/helpers/rwinfo_block.php +++ b/3.0/modules/rwinfo/helpers/rwinfo_block.php @@ -35,9 +35,9 @@ class rwinfo_block_Core { $block = new Block(); $block->css_id = "g-metadata"; - + // rWatcher Edit: Add Movie Info Option - //$block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); + //$block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info"); $block_title = ""; if ($theme->item->is_album()) { $block_title = t("Album Info"); @@ -48,9 +48,68 @@ class rwinfo_block_Core { } $block->title = $block_title; // End rWatcher Edit - + // rWatcher Edit: File Name change. $block->content = new View("rwinfo_block.html"); + + if ($theme->item->title && module::get_var("rwinfo", "show_title")) { + $info["title"] = array( + "label" => t("Title:"), + "value" => html::purify($theme->item->title) + ); + } + if ($theme->item->description && module::get_var("rwinfo", "show_description")) { + $info["description"] = array( + "label" => t("Description:"), + "value" => nl2br(html::purify($theme->item->description)) + ); + } + if (!$theme->item->is_album() && module::get_var("rwinfo", "show_name")) { + $info["file_name"] = array( + "label" => t("File name:"), + "value" => html::clean($theme->item->name) + ); + } + + // rWatcher Edit: + //if ($theme->item->captured && module::get_var("rwinfo", "show_captured")) { + // $info["captured"] = array( + // "label" => t("Captured:"), + // "value" => gallery::date_time($theme->item->captured) + // ); + //} + if ($theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) { + $info["captured"] = array( + "label" => t("Date:"), + "value" => gallery::date($theme->item->created) + ); + } + if (!$theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) { + $info["captured"] = array( + "label" => t("Date:"), + "value" => gallery::date_time($theme->item->captured) + ); + } + // End rWatcher Edit + + if ($theme->item->owner && module::get_var("rwinfo", "show_owner")) { + $display_name = $theme->item->owner->display_name(); + if ($theme->item->owner->url) { + $info["owner"] = array( + "label" => t("Owner:"), + "value" => "item->owner->url}\">" . + html::clean($display_name) . "" + ); + } else { + $info["owner"] = array( + "label" => t("Owner:"), + "value" => html::clean($display_name) + ); + } + } + $block->content->metadata = $info; + + module::event("info_block_get_metadata", $block, $theme->item); } break; } diff --git a/3.0/modules/rwinfo/helpers/rwinfo_installer.php b/3.0/modules/rwinfo/helpers/rwinfo_installer.php new file mode 100644 index 00000000..ca8b429d --- /dev/null +++ b/3.0/modules/rwinfo/helpers/rwinfo_installer.php @@ -0,0 +1,41 @@ +"; } - // rWatcher Edit: Display Tags + // rWatcher Edit: Display Tags on Thumbnails if (module::is_active("tag")) { $tags = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") diff --git a/3.0/modules/rwinfo/module.info b/3.0/modules/rwinfo/module.info index 7bbf8e37..684a31a0 100644 --- a/3.0/modules/rwinfo/module.info +++ b/3.0/modules/rwinfo/module.info @@ -1,3 +1,3 @@ name = "rWInfo" description = "Display extra information about photos and albums" -version = 1 +version = 2 diff --git a/3.0/modules/rwinfo/notes.txt b/3.0/modules/rwinfo/notes.txt index 74826f18..5085b0d1 100644 --- a/3.0/modules/rwinfo/notes.txt +++ b/3.0/modules/rwinfo/notes.txt @@ -1,11 +1,10 @@ -Drop Title and Description (they're displayed elsewhere in the default theme, no reason to show them twice on the same page) +Turn Title and Description off by Default in the installer.(they're displayed elsewhere in the default theme, no reason to show them twice on the same page) Hide the info sidebar for the root album (without title and description there really isn't anything worth displaying here) -Display date created for albums only (and continue to display the capture date for everything else) -Display tags in the info sidebar (if the tags module is active). Display tags when mousing over the thumbnails (if tags module is active). Display "Movie Info" on movies instead of "Photo Info" like the Gallery Info module does. -Use long month instead of short month on the album display. -Change Date/Time format to "F j, Y h:i:s a" for photos. - Changed block name on sidebar to rWInfo, to make it stick out more (helpers\rwinfo_block.php -> return array("metadata" => t("rWInfo")); +Change label for "captured" to "Date", display "created" for albums, "captured" for everything else. +Use gallery::date for formating the albums Date, and gallery::date_time for everything else. (I only want to see the Date an album was created, the time doesn't matter). +Change all occurences of get_var("info" to get_var("rwinfo" to avoid conflicts with the original info module. + diff --git a/3.0/modules/rwinfo/views/rwinfo_block.html.php b/3.0/modules/rwinfo/views/rwinfo_block.html.php index 32891268..b296fa1d 100644 --- a/3.0/modules/rwinfo/views/rwinfo_block.html.php +++ b/3.0/modules/rwinfo/views/rwinfo_block.html.php @@ -1,52 +1,8 @@ - diff --git a/3.1/modules/rwinfo/helpers/rwinfo_block.php b/3.1/modules/rwinfo/helpers/rwinfo_block.php index 7befb828..378d7a84 100644 --- a/3.1/modules/rwinfo/helpers/rwinfo_block.php +++ b/3.1/modules/rwinfo/helpers/rwinfo_block.php @@ -35,9 +35,9 @@ class rwinfo_block_Core { $block = new Block(); $block->css_id = "g-metadata"; - + // rWatcher Edit: Add Movie Info Option - //$block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); + //$block->title = $theme->item()->is_album() ? t("Album info") : t("Photo info"); $block_title = ""; if ($theme->item->is_album()) { $block_title = t("Album Info"); @@ -48,9 +48,68 @@ class rwinfo_block_Core { } $block->title = $block_title; // End rWatcher Edit - + // rWatcher Edit: File Name change. $block->content = new View("rwinfo_block.html"); + + if ($theme->item->title && module::get_var("rwinfo", "show_title")) { + $info["title"] = array( + "label" => t("Title:"), + "value" => html::purify($theme->item->title) + ); + } + if ($theme->item->description && module::get_var("rwinfo", "show_description")) { + $info["description"] = array( + "label" => t("Description:"), + "value" => nl2br(html::purify($theme->item->description)) + ); + } + if (!$theme->item->is_album() && module::get_var("rwinfo", "show_name")) { + $info["file_name"] = array( + "label" => t("File name:"), + "value" => html::clean($theme->item->name) + ); + } + + // rWatcher Edit: + //if ($theme->item->captured && module::get_var("rwinfo", "show_captured")) { + // $info["captured"] = array( + // "label" => t("Captured:"), + // "value" => gallery::date_time($theme->item->captured) + // ); + //} + if ($theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) { + $info["captured"] = array( + "label" => t("Date:"), + "value" => gallery::date($theme->item->created) + ); + } + if (!$theme->item->is_album() && $theme->item->created && module::get_var("rwinfo", "show_captured")) { + $info["captured"] = array( + "label" => t("Date:"), + "value" => gallery::date_time($theme->item->captured) + ); + } + // End rWatcher Edit + + if ($theme->item->owner && module::get_var("rwinfo", "show_owner")) { + $display_name = $theme->item->owner->display_name(); + if ($theme->item->owner->url) { + $info["owner"] = array( + "label" => t("Owner:"), + "value" => "item->owner->url}\">" . + html::clean($display_name) . "" + ); + } else { + $info["owner"] = array( + "label" => t("Owner:"), + "value" => html::clean($display_name) + ); + } + } + $block->content->metadata = $info; + + module::event("info_block_get_metadata", $block, $theme->item); } break; } diff --git a/3.1/modules/rwinfo/helpers/rwinfo_installer.php b/3.1/modules/rwinfo/helpers/rwinfo_installer.php new file mode 100644 index 00000000..ca8b429d --- /dev/null +++ b/3.1/modules/rwinfo/helpers/rwinfo_installer.php @@ -0,0 +1,41 @@ +"; } - // rWatcher Edit: Display Tags + // rWatcher Edit: Display Tags on Thumbnails if (module::is_active("tag")) { $tags = ORM::factory("tag") ->join("items_tags", "tags.id", "items_tags.tag_id") diff --git a/3.1/modules/rwinfo/module.info b/3.1/modules/rwinfo/module.info index 7bbf8e37..684a31a0 100644 --- a/3.1/modules/rwinfo/module.info +++ b/3.1/modules/rwinfo/module.info @@ -1,3 +1,3 @@ name = "rWInfo" description = "Display extra information about photos and albums" -version = 1 +version = 2 diff --git a/3.1/modules/rwinfo/notes.txt b/3.1/modules/rwinfo/notes.txt index 74826f18..5085b0d1 100644 --- a/3.1/modules/rwinfo/notes.txt +++ b/3.1/modules/rwinfo/notes.txt @@ -1,11 +1,10 @@ -Drop Title and Description (they're displayed elsewhere in the default theme, no reason to show them twice on the same page) +Turn Title and Description off by Default in the installer.(they're displayed elsewhere in the default theme, no reason to show them twice on the same page) Hide the info sidebar for the root album (without title and description there really isn't anything worth displaying here) -Display date created for albums only (and continue to display the capture date for everything else) -Display tags in the info sidebar (if the tags module is active). Display tags when mousing over the thumbnails (if tags module is active). Display "Movie Info" on movies instead of "Photo Info" like the Gallery Info module does. -Use long month instead of short month on the album display. -Change Date/Time format to "F j, Y h:i:s a" for photos. - Changed block name on sidebar to rWInfo, to make it stick out more (helpers\rwinfo_block.php -> return array("metadata" => t("rWInfo")); +Change label for "captured" to "Date", display "created" for albums, "captured" for everything else. +Use gallery::date for formating the albums Date, and gallery::date_time for everything else. (I only want to see the Date an album was created, the time doesn't matter). +Change all occurences of get_var("info" to get_var("rwinfo" to avoid conflicts with the original info module. + diff --git a/3.1/modules/rwinfo/views/rwinfo_block.html.php b/3.1/modules/rwinfo/views/rwinfo_block.html.php index 32891268..b296fa1d 100644 --- a/3.1/modules/rwinfo/views/rwinfo_block.html.php +++ b/3.1/modules/rwinfo/views/rwinfo_block.html.php @@ -1,52 +1,8 @@ -