Merge commit 'upstream/master'
This commit is contained in:
commit
b6a73d861c
@ -36,25 +36,25 @@ class rescue_task_Core {
|
||||
$total = $task->get("total");
|
||||
if (empty($total)) {
|
||||
$task->set("total", $total = Database::instance()->count_records("items"));
|
||||
$task->set("stack", array(array(1, self::LEFT)));
|
||||
$task->set("stack", "1:" . self::LEFT);
|
||||
$task->set("ptr", 1);
|
||||
$task->set("completed", 0);
|
||||
}
|
||||
|
||||
$ptr = $task->get("ptr");
|
||||
$stack = $task->get("stack");
|
||||
$stack = explode(" ", $task->get("stack"));
|
||||
$completed = $task->get("completed");
|
||||
|
||||
// Implement a depth-first tree walk using a stack. Not the most efficient, but it's simple.
|
||||
while ($stack && microtime(true) - $start < 1.5) {
|
||||
list($id, $state) = array_pop($stack);
|
||||
list($id, $state) = explode(":", array_pop($stack));
|
||||
switch ($state) {
|
||||
case self::LEFT:
|
||||
self::set_left($id, $ptr++);
|
||||
$item = ORM::factory("item", $id);
|
||||
array_push($stack, array($id, self::RIGHT));
|
||||
array_push($stack, $id . ":" . self::RIGHT);
|
||||
foreach (self::children($id) as $child) {
|
||||
array_push($stack, array($child->id, self::LEFT));
|
||||
array_push($stack, $child->id . ":" . self::LEFT);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -65,7 +65,7 @@ class rescue_task_Core {
|
||||
}
|
||||
}
|
||||
|
||||
$task->set("stack", $stack);
|
||||
$task->set("stack", implode(" ", $stack));
|
||||
$task->set("ptr", $ptr);
|
||||
$task->set("completed", $completed);
|
||||
|
||||
|
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