Initial commit of rWInfo module.
This commit is contained in:
parent
de0538c3ef
commit
65787ec9cb
24
modules/rwinfo/helpers/rwinfo_installer.php
Normal file
24
modules/rwinfo/helpers/rwinfo_installer.php
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2009 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_version("rwinfo", 1);
|
||||||
|
}
|
||||||
|
}
|
73
modules/rwinfo/helpers/rwinfo_theme.php
Normal file
73
modules/rwinfo/helpers/rwinfo_theme.php
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2009 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_theme_Core {
|
||||||
|
static function sidebar_blocks($theme) {
|
||||||
|
if ($theme->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 .= "<li>";
|
||||||
|
$results .= t("Views: %view_count", array("view_count" => $item->view_count));
|
||||||
|
$results .= "</li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
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 .= "<li>";
|
||||||
|
$results .= t("Tags:") . " ";
|
||||||
|
for ($counter=0; $counter<count($tagsItem); $counter++) {
|
||||||
|
if ($counter < count($tagsItem)-1) {
|
||||||
|
$results .= "<a href=" . url::site("tags/$tagsItem[$counter]") . ">" . html::clean($tagsItem[$counter]->name) . "</a>, ";
|
||||||
|
} else {
|
||||||
|
$results .= "<a href=" . url::site("tags/$tagsItem[$counter]") . ">" . html::clean($tagsItem[$counter]->name) . "</a>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$results .= "</li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($item->owner) {
|
||||||
|
$results .= "<li>";
|
||||||
|
if ($item->owner->url) {
|
||||||
|
$results .= t("By: %owner_name", array("owner_name" => "<a href=\"{$item->owner->url}\">{$item->owner->full_name}</a>"));
|
||||||
|
} else {
|
||||||
|
$results .= t("By: %owner_name", array("owner_name" => "{$item->owner->full_name}"));
|
||||||
|
}
|
||||||
|
$results .= "</li>";
|
||||||
|
}
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
}
|
3
modules/rwinfo/module.info
Normal file
3
modules/rwinfo/module.info
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
name = "rWInfo"
|
||||||
|
description = "Display extra information about photos and albums"
|
||||||
|
version = 1
|
5
modules/rwinfo/notes.txt
Normal file
5
modules/rwinfo/notes.txt
Normal file
|
@ -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).
|
55
modules/rwinfo/views/rwinfo_block.html.php
Normal file
55
modules/rwinfo/views/rwinfo_block.html.php
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<ul class="gMetadata">
|
||||||
|
<? if ($item->owner): ?>
|
||||||
|
<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 ?>
|
||||||
|
</li>
|
||||||
|
<? if ($item->is_album()): ?>
|
||||||
|
<li>
|
||||||
|
<strong class="caption"><?= t("Date:") ?></strong>
|
||||||
|
<?= date("M j, Y", $item->created)?>
|
||||||
|
</li>
|
||||||
|
<? endif ?>
|
||||||
|
<? endif ?>
|
||||||
|
|
||||||
|
|
||||||
|
<? if (!$item->is_album()): ?>
|
||||||
|
<li>
|
||||||
|
<strong class="caption"><?= t("File name:") ?></strong>
|
||||||
|
<?= html::clean($item->name) ?>
|
||||||
|
</li>
|
||||||
|
<? endif ?>
|
||||||
|
<? if ($item->captured): ?>
|
||||||
|
<li>
|
||||||
|
<strong class="caption"><?= t("Date:") ?></strong>
|
||||||
|
<?= date("M j, Y H:i:s", $item->captured)?>
|
||||||
|
</li>
|
||||||
|
<? endif ?>
|
||||||
|
|
||||||
|
<? 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): ?>
|
||||||
|
<li>
|
||||||
|
<strong class="caption"><?= t("Tags:") ?></strong>
|
||||||
|
<? for ($counter=0; $counter<count($tagsItem); $counter++) { ?>
|
||||||
|
<? if ($counter < count($tagsItem)-1) { ?>
|
||||||
|
<a href="<?= url::site("tags/$tagsItem[$counter]") ?>"><?= html::clean($tagsItem[$counter]->name) ?></a>,
|
||||||
|
<? } else {?>
|
||||||
|
<a href="<?= url::site("tags/$tagsItem[$counter]") ?>"><?= html::clean($tagsItem[$counter]->name) ?></a>
|
||||||
|
<? } ?>
|
||||||
|
<? } ?>
|
||||||
|
</li>
|
||||||
|
<? endif ?>
|
||||||
|
<? endif ?>
|
||||||
|
|
||||||
|
</ul>
|
Reference in New Issue
Block a user