1
0

Synced rWInfo with recent changes to info module.

This commit is contained in:
rWatcher 2011-01-28 10:53:57 -05:00
parent 976e8d2b55
commit 5f2fe5a1df
12 changed files with 226 additions and 116 deletions

View File

@ -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" => "<a href=\"{$theme->item->owner->url}\">" .
html::clean($display_name) . "</a>"
);
} 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;
}

View File

@ -0,0 +1,41 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class rwinfo_installer {
static function install() {
module::set_var("rwinfo", "show_title", 0);
module::set_var("rwinfo", "show_description", 0);
module::set_var("rwinfo", "show_owner", 1);
module::set_var("rwinfo", "show_name", 1);
module::set_var("rwinfo", "show_captured", 1);
module::set_version("rwinfo", 2);
}
static function upgrade($version) {
if ($version == 1) {
module::set_var("rwinfo", "show_title", 0);
module::set_var("rwinfo", "show_description", 0);
module::set_var("rwinfo", "show_owner", 1);
module::set_var("rwinfo", "show_name", 1);
module::set_var("rwinfo", "show_captured", 1);
module::set_version("rwinfo", $version = 2);
}
}
}

View File

@ -26,7 +26,7 @@ class rwinfo_theme_Core {
$results .= "</li>";
}
// 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")

View File

@ -1,3 +1,3 @@
name = "rWInfo"
description = "Display extra information about photos and albums"
version = 1
version = 2

View File

@ -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.

View File

@ -1,52 +1,8 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? date_default_timezone_set('America/New_York'); ?>
<ul class="g-metadata">
<? if ($item->owner): ?>
<? foreach($metadata as $info): ?>
<li>
<strong class="caption"><?= t("Owner:") ?></strong>
<? if ($item->owner->url): ?>
<a href="<?= $item->owner->url ?>"><?= html::clean($item->owner->display_name()) ?></a>
<? else: ?>
<?= html::clean($item->owner->display_name()) ?>
<? endif ?>
<strong class="caption"><?= $info["label"] ?></strong> <?= $info["value"] ?>
</li>
<? endif ?>
<? if ($item->is_album()): ?>
<li>
<strong class="caption"><?= t("Date:") ?></strong>
<?= date("F j, Y", $item->created)?>
</li>
<? endif ?>
<? if ($item->captured): ?>
<li>
<strong class="caption"><?= t("Date:") ?></strong>
<?= date("F j, Y h:i:s a T", $item->captured)?>
</li>
<? endif ?>
<? if (!$item->is_album()): ?>
<li>
<strong class="caption"><?= t("File name:") ?></strong>
<?= html::clean($item->name) ?>
</li>
<? endif ?>
<? if (module::is_active("tag")): ?>
<? $tags = ORM::factory("tag")
->join("items_tags", "tags.id", "items_tags.tag_id")
->where("items_tags.item_id", "=", $item->id)
->find_all();
?>
<? if (count($tags)): ?>
<li>
<strong class="caption"><?= t("Tags:") ?></strong>
<? $not_first = 0; ?>
<? foreach ($tags as $tag): ?>
<?= ($not_first++) ? "," : "" ?>
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>
<? endforeach ?>
</li>
<? endif ?>
<? endif ?>
<? endforeach; ?>
</ul>

View File

@ -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" => "<a href=\"{$theme->item->owner->url}\">" .
html::clean($display_name) . "</a>"
);
} 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;
}

View File

@ -0,0 +1,41 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class rwinfo_installer {
static function install() {
module::set_var("rwinfo", "show_title", 0);
module::set_var("rwinfo", "show_description", 0);
module::set_var("rwinfo", "show_owner", 1);
module::set_var("rwinfo", "show_name", 1);
module::set_var("rwinfo", "show_captured", 1);
module::set_version("rwinfo", 2);
}
static function upgrade($version) {
if ($version == 1) {
module::set_var("rwinfo", "show_title", 0);
module::set_var("rwinfo", "show_description", 0);
module::set_var("rwinfo", "show_owner", 1);
module::set_var("rwinfo", "show_name", 1);
module::set_var("rwinfo", "show_captured", 1);
module::set_version("rwinfo", $version = 2);
}
}
}

View File

@ -26,7 +26,7 @@ class rwinfo_theme_Core {
$results .= "</li>";
}
// 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")

View File

@ -1,3 +1,3 @@
name = "rWInfo"
description = "Display extra information about photos and albums"
version = 1
version = 2

View File

@ -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.

View File

@ -1,52 +1,8 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? date_default_timezone_set('America/New_York'); ?>
<ul class="g-metadata">
<? if ($item->owner): ?>
<? foreach($metadata as $info): ?>
<li>
<strong class="caption"><?= t("Owner:") ?></strong>
<? if ($item->owner->url): ?>
<a href="<?= $item->owner->url ?>"><?= html::clean($item->owner->display_name()) ?></a>
<? else: ?>
<?= html::clean($item->owner->display_name()) ?>
<? endif ?>
<strong class="caption"><?= $info["label"] ?></strong> <?= $info["value"] ?>
</li>
<? endif ?>
<? if ($item->is_album()): ?>
<li>
<strong class="caption"><?= t("Date:") ?></strong>
<?= date("F j, Y", $item->created)?>
</li>
<? endif ?>
<? if ($item->captured): ?>
<li>
<strong class="caption"><?= t("Date:") ?></strong>
<?= date("F j, Y h:i:s a T", $item->captured)?>
</li>
<? endif ?>
<? if (!$item->is_album()): ?>
<li>
<strong class="caption"><?= t("File name:") ?></strong>
<?= html::clean($item->name) ?>
</li>
<? endif ?>
<? if (module::is_active("tag")): ?>
<? $tags = ORM::factory("tag")
->join("items_tags", "tags.id", "items_tags.tag_id")
->where("items_tags.item_id", "=", $item->id)
->find_all();
?>
<? if (count($tags)): ?>
<li>
<strong class="caption"><?= t("Tags:") ?></strong>
<? $not_first = 0; ?>
<? foreach ($tags as $tag): ?>
<?= ($not_first++) ? "," : "" ?>
<a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a>
<? endforeach ?>
</li>
<? endif ?>
<? endif ?>
<? endforeach; ?>
</ul>