From 65787ec9cb185dfcce0dce3be45c1470ff92acf2 Mon Sep 17 00:00:00 2001 From: rWatcher Date: Wed, 9 Sep 2009 14:50:04 -0400 Subject: [PATCH] Initial commit of rWInfo module. --- modules/rwinfo/helpers/rwinfo_installer.php | 24 +++++++ modules/rwinfo/helpers/rwinfo_theme.php | 73 +++++++++++++++++++++ modules/rwinfo/module.info | 3 + modules/rwinfo/notes.txt | 5 ++ modules/rwinfo/views/rwinfo_block.html.php | 55 ++++++++++++++++ 5 files changed, 160 insertions(+) create mode 100644 modules/rwinfo/helpers/rwinfo_installer.php create mode 100644 modules/rwinfo/helpers/rwinfo_theme.php create mode 100644 modules/rwinfo/module.info create mode 100644 modules/rwinfo/notes.txt create mode 100644 modules/rwinfo/views/rwinfo_block.html.php diff --git a/modules/rwinfo/helpers/rwinfo_installer.php b/modules/rwinfo/helpers/rwinfo_installer.php new file mode 100644 index 00000000..fd0359ae --- /dev/null +++ b/modules/rwinfo/helpers/rwinfo_installer.php @@ -0,0 +1,24 @@ +item()) { + if ($theme->item->id == 1) { + return ; + } + + $block = new Block(); + $block->css_id = "gMetadata"; + $block->title = $theme->item()->is_album() ? t("Album Info") : t("Photo Info"); + $block->content = new View("rwinfo_block.html"); + return $block; + } + } + + static function thumb_info($theme, $item) { + $results = ""; + if ($item->view_count) { + $results .= "
  • "; + $results .= t("Views: %view_count", array("view_count" => $item->view_count)); + $results .= "
  • "; + } + + if (module::is_active("tag")) { + $tagsItem = ORM::factory("tag") + ->join("items_tags", "tags.id", "items_tags.tag_id") + ->where("items_tags.item_id", $item->id) + ->find_all(); + if (count($tagsItem) > 0) { + $results .= "
  • "; + $results .= t("Tags:") . " "; + for ($counter=0; $counter" . html::clean($tagsItem[$counter]->name) . ", "; + } else { + $results .= "" . html::clean($tagsItem[$counter]->name) . ""; + } + } + $results .= "
  • "; + } + } + + if ($item->owner) { + $results .= "
  • "; + if ($item->owner->url) { + $results .= t("By: %owner_name", array("owner_name" => "owner->url}\">{$item->owner->full_name}")); + } else { + $results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}")); + } + $results .= "
  • "; + } + return $results; + } +} \ No newline at end of file diff --git a/modules/rwinfo/module.info b/modules/rwinfo/module.info new file mode 100644 index 00000000..7bbf8e37 --- /dev/null +++ b/modules/rwinfo/module.info @@ -0,0 +1,3 @@ +name = "rWInfo" +description = "Display extra information about photos and albums" +version = 1 diff --git a/modules/rwinfo/notes.txt b/modules/rwinfo/notes.txt new file mode 100644 index 00000000..38a3ed67 --- /dev/null +++ b/modules/rwinfo/notes.txt @@ -0,0 +1,5 @@ +Drop Title and Description (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). diff --git a/modules/rwinfo/views/rwinfo_block.html.php b/modules/rwinfo/views/rwinfo_block.html.php new file mode 100644 index 00000000..b657bb82 --- /dev/null +++ b/modules/rwinfo/views/rwinfo_block.html.php @@ -0,0 +1,55 @@ + +