1
0

Merge pull request #85 from rWatcher/master

New Quotas module + updates to Tag Albums
This commit is contained in:
Bharat Mediratta 2011-10-03 21:22:06 -07:00
commit 8aa1876987
32 changed files with 1668 additions and 144 deletions

View File

@ -0,0 +1,152 @@
<?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 Admin_Quotas_Controller extends Admin_Controller {
public function index() {
// Set up a new admin page for the quotas module.
$view = new Admin_View("admin.html");
$view->page_title = t("Users and groups");
$view->page_type = "collection";
$view->page_subtype = "admin_users_quotas";
$view->content = new View("admin_quotas.html");
$page_size = module::get_var("user", "page_size", 10);
$page = Input::instance()->get("page", "1");
$builder = db::build();
$user_count = $builder->from("users")->count_records();
$view->page = $page;
$view->page_size = $page_size;
$view->children_count = $user_count;
$view->max_pages = ceil($view->children_count / $view->page_size);
$view->content->pager = new Pagination();
$view->content->pager->initialize(
array("query_string" => "page",
"total_items" => $user_count,
"items_per_page" => $page_size,
"style" => "classic"));
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else if ($page > $view->content->pager->total_pages) {
url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
}
$view->content->users = ORM::factory("user")
->order_by("users.name", "ASC")
->find_all($page_size, $view->content->pager->sql_offset);
$view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
$view->content->quota_options = $this->_get_quota_settings_form();
print $view;
}
public function form_group_quota($id) {
// Display the form for setting a quota for the specified group ($id).
$group = ORM::factory("group", $id);
if (empty($group)) {
throw new Kohana_404_Exception();
}
print $this->_get_edit_group_quota($group);
}
static function _get_edit_group_quota($group) {
// Generate a form for setting a quota for the specified group ($group).
$record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find();
$form = new Forge(
"admin/quotas/edit_quota/$group->id", "", "post", array("id" => "g-edit-quota-form"));
$group = $form->group("edit_quota")->label(t("Edit group quota"));
$group->input("group_quota")->label(t("Limit (MB)"))->id("g-group_quota")->value($record->storage_limit / 1024 / 1024)
->error_messages("required", t("A value is required"));
$group->submit("")->value(t("Save"));
return $form;
}
public function edit_quota($id) {
// Save the specified quota to the database.
access::verify_csrf();
$group = ORM::factory("group", $id);
if (empty($group)) {
throw new Kohana_404_Exception();
}
$record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find();
$form = $this->_get_edit_group_quota($group);
try {
$valid = $form->validate();
$record->group_id = $id;
$record->storage_limit = $form->edit_quota->inputs["group_quota"]->value * 1024 * 1024;
} catch (ORM_Validation_Exception $e) {
// Translate ORM validation errors into form error messages
foreach ($e->validation->errors() as $key => $error) {
$form->edit_quota->inputs[$key]->add_error($error, 1);
}
$valid = false;
}
if ($valid) {
$record->save();
message::success(t("Limit for group %group_name set", array("group_name" => $group->name)));
json::reply(array("result" => "success"));
} else {
json::reply(array("result" => "error", "html" => (string) $form));
}
}
private function _get_quota_settings_form() {
// Make a new form to allow the admin to specify how the system should calculate a user's quota.
$form = new Forge("admin/quotas/saveprefs", "", "post",
array("id" => "g-quotas-admin-form"));
// Setup a checkbox for the form.
$quota_options["use_all_sizes"] = array(t("Count resizes and thumbnails towards a users limit?"), module::get_var("quotas", "use_all_sizes"));
$add_links = $form->group("quota_preferences");
$add_links->checklist("quota_preferences_list")
->options($quota_options);
// Add a save button to the form.
$form->submit("save_preferences")->value(t("Save"));
// Return the newly generated form.
return $form;
}
public function saveprefs() {
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out which boxes where checked
$checkboxes_array = Input::instance()->post("quota_preferences_list");
$use_all_sizes = false;
for ($i = 0; $i < count($checkboxes_array); $i++) {
if ($checkboxes_array[$i] == "use_all_sizes") {
$use_all_sizes = true;
}
}
// Save Settings.
module::set_var("quotas", "use_all_sizes", $use_all_sizes);
message::success(t("Your Selection Has Been Saved."));
// Load Admin page.
url::redirect("admin/quotas");
}
}

View File

@ -0,0 +1,110 @@
<?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 quotas_event_Core {
static function admin_menu($menu, $theme) {
// Add a User quotas link to the admin menu.
$menu->get("content_menu")
->append(Menu::factory("link")
->id("quotas")
->label(t("User quotas"))
->url(url::site("admin/quotas")));
}
static function user_created($user) {
// Set up some default values whenever a new user is created.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find();
if (!$record->loaded()) {
$record->owner_id = $user->id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
}
static function user_before_delete($user) {
// When deleting a user, all of that user's items get re-assigned to the admin account,
// so the file sizes need to be reassigned to the admin user as well.
$admin = identity::admin_user();
$admin_record = ORM::factory("users_space_usage")->where("owner_id", "=", $admin->id)->find();
$deleted_user_record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find();
if ($deleted_user_record->loaded()) {
$admin_record->fullsize = $admin_record->fullsize + $deleted_user_record->fullsize;
$admin_record->resize = $admin_record->resize + $deleted_user_record->resize;
$admin_record->thumb = $admin_record->thumb + $deleted_user_record->thumb;
$admin_record->save();
$deleted_user_record->delete();
}
}
static function item_before_create($item) {
// When creating a new item, make sure it's file size won't put the user over their limit.
// If it does, throw an error, which will prevent gallery from accepting the file.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
if (!$record->loaded()) {
$record->owner_id = $item->owner_id;
}
if ($record->get_usage_limit() == 0) {
return;
}
if ((filesize($item->data_file) + $record->current_usage()) > $record->get_usage_limit()) {
throw new Exception($item->name . " rejected, user #" . $item->owner_id . " over limit.");
}
}
static function item_created($item) {
// When a new item is created, add it's file size to the users_space_usage table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
if (!$record->loaded()) {
$record->owner_id = $item->owner_id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
$record->add_item($item);
}
static function item_before_delete($item) {
// When an item is deleted, remove it's file size from the users_space_usage table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->remove_item($item);
}
// I can't monitor the item_before_update / item_updated events to adjust for rotated photos,
// because they fire when a new photo is uploaded (before it's created) and cause all kinds of weirdness.
// So instead, I'm using graphics_rotate to detect a rotate and remove the existing file sizes, and
// item_updated_data_file to add in the new data file sizes.
// Does item_updated_data_file fire for any other reason? (watermarking? renaming/moving/deleting/keeporiginal do not cause updated_data_file.)
static function graphics_rotate($input_file, $output_file, $options) {
// Remove the current item's file size from the quotas table.
$item = item::find_by_path(substr(str_replace(VARPATH, "", $input_file), strpos(str_replace(VARPATH, "", $input_file), "/")+1));
if ($item->loaded()) {
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->remove_item($item);
}
}
static function item_updated_data_file($item) {
// Add the current item's file size into the quotas table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->add_item($item);
}
}

View File

@ -0,0 +1,47 @@
<?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 quotas_installer {
static function install() {
// Create tables.
$db = Database::instance();
$db->query("CREATE TABLE IF NOT EXISTS {users_space_usages} (
`id` int(9) NOT NULL auto_increment,
`owner_id` int(9) NOT NULL,
`fullsize` BIGINT UNSIGNED NOT NULL,
`resize` BIGINT UNSIGNED NOT NULL,
`thumb` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`owner_id`, `id`))
DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups_quotas} (
`id` int(9) NOT NULL auto_increment,
`group_id` int(9) NOT NULL,
`storage_limit` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`group_id`, `id`))
DEFAULT CHARSET=utf8;");
module::set_var("quotas", "use_all_sizes", true);
// Set the module version number.
module::set_version("quotas", 1);
}
}

View File

@ -0,0 +1,126 @@
<?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 quotas_task_Core {
static function available_tasks() {
// Total up all non-guest users in the users table that don't have a corresponding record
// in the users_space_usages table.
// If the result is greater then 0, display a warning for this task so the admin knows
// a user is missing and it should be run.
$missing_users = ORM::factory("user")
->where("users.guest", "=", "0")
->join("users_space_usages", "users.id", "users_space_usages.owner_id", "LEFT OUTER")
->and_where("users_space_usages.owner_id", "IS", NULL)->count_all();
$tasks = array();
$tasks[] = Task_Definition::factory()
->callback("quotas_task::update_quotasdb")
->name(t("Rebuild user quotas table"))
->description(t("Recalculates each users space usage."))
->severity($missing_users ? log::WARNING : log::SUCCESS);
return $tasks;
}
static function update_quotasdb($task) {
// Re-create the users_space_usages table and recalculate all values.
// Retrieve the total variable. If this is the first time this function has been run,
// total will be empty.
$total = $task->get("total");
$existing_items = ORM::factory("item")->where("type", "!=", "album")->find_all();
if (empty($total)) {
// If this is the first time this function has been run,
// delete and re-create the users_space_usages table, and set up
// some initial variables.
$db = Database::instance();
$db->query("DROP TABLE IF EXISTS {users_space_usages};");
$db->query("CREATE TABLE IF NOT EXISTS {users_space_usages} (
`id` int(9) NOT NULL auto_increment,
`owner_id` int(9) NOT NULL,
`fullsize` BIGINT UNSIGNED NOT NULL,
`resize` BIGINT UNSIGNED NOT NULL,
`thumb` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`owner_id`, `id`))
DEFAULT CHARSET=utf8;");
// Set the initial values for all variables.
$task->set("total", count($existing_items));
$total = $task->get("total");
$task->set("last_id", 0);
$task->set("completed_items", 0);
$task->set("total_users", ORM::factory("user")->where("guest", "=", "0")->count_all());
$task->set("completed_users", 0);
$task->set("last_user_id", 0);
}
// Retrieve the values for variables from the last time this
// function was run.
$last_id = $task->get("last_id");
$completed_items = $task->get("completed_items");
$total_users = $task->get("total_users");
$completed_users = $task->get("completed_users");
$last_user_id = $task->get("last_user_id");
// First set up default values for all non-guest users.
if ($total_users > $completed_users) {
$one_user = ORM::factory("user")
->where("guest", "=", "0")
->where("id", ">", $last_user_id)
->order_by("id")
->find_all(1);
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $one_user[0]->id)->find();
if (!$record->loaded()) {
$record->owner_id = $one_user[0]->id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
$task->set("last_user_id", $one_user[0]->id);
$task->set("completed_users", ++$completed_users);
$task->status = t("Populating quotas table...");
} else {
// Loop through each non-album item in Gallery and log its file size to its owner.
$item = ORM::factory("item")
->where("type", "!=", "album")
->where("id", ">", $last_id)
->order_by("id")
->find_all(1);
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item[0]->owner_id)->find();
$record->add_item($item[0]);
// Store the current position and update the status message.
$task->set("last_id", $item[0]->id);
$task->set("completed_items", ++$completed_items);
if ($total == $completed_items) {
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
$task->status = t("Complete");
} else {
$task->percent_complete = round(100 * $completed_items / $total);
$task->status = t("Scanning $completed_items of $total files");
}
}
}
}

View File

@ -0,0 +1,35 @@
<?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 quotas_theme_Core {
static function page_bottom($theme) {
// If a user is logged in, display their space usage at the bottom of the page.
if (!identity::active_user()->guest) {
$record = ORM::factory("users_space_usage")->where("owner_id", "=", identity::active_user()->id)->find();
if ($record->get_usage_limit() == 0) {
print t("You are using %usage MB", array("usage" => number_format($record->total_usage_mb(), 2)));
} else {
print t("You are using %usage of your %limit MB limit (%percentage%)",
array("usage" => number_format($record->current_usage_mb(), 2),
"limit" => number_format($record->get_usage_limit_mb(), 2),
"percentage" => number_format((($record->current_usage() / $record->get_usage_limit()) * 100), 2)));
}
}
}
}

View File

@ -0,0 +1,21 @@
<?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 Groups_Quota_Model extends ORM {
}

View File

@ -0,0 +1,131 @@
<?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 Users_Space_Usage_Model_Core extends ORM {
public function partial_usage_mb($file_type) {
// Return a value (in megabytes) for the user's total usage in fullsizes, resizes, or thumbs.
// $file_type should be either fullsize, resize, or thumb.
return ($this->$file_type / 1024 / 1024);
}
public function total_usage() {
// Return the user's total usage in bytes.
return ($this->fullsize + $this->resize + $this->thumb);
}
public function total_usage_mb() {
// Return the user's total usage in megabytes.
return (($this->total_usage()) / 1024 / 1024);
}
public function current_usage() {
// Return the users relevant usage in bytes based on the use_all_sizes setting.
if (module::get_var("quotas", "use_all_sizes") == true) {
return $this->total_usage();
} else {
return $this->fullsize;
}
}
public function current_usage_mb() {
// Return the users relevant usage in megabytes based on the use_all_sizes setting.
return ($this->current_usage() / 1024 / 1024);
}
public function get_usage_limit() {
// Returns a user's maximum limit in bytes.
$user_groups = ORM::factory("group")
->join("groups_users", "groups_users.group_id", "groups.id")
->join("groups_quotas", "groups_quotas.group_id", "groups.id")
->select("groups.id")
->select("groups_quotas.storage_limit")
->where("groups_users.user_id", "=", $this->owner_id)
->order_by("groups_quotas.storage_limit", "DESC")
->find_all(1);
if (!empty($user_groups)) {
if ($user_groups[0]->storage_limit <= "0") {
return 0;
} else {
return $user_groups[0]->storage_limit;
}
}
return 0;
}
public function get_usage_limit_mb() {
// Returns a user's maximum limit in megabytes.
return ($this->get_usage_limit() / 1024 / 1024);
}
public function add_item($item) {
// Adds an item's file size to the table.
if ($item->is_album()) {
return ;
}
$item_fullsize = 0;
$item_resize = 0;
$item_thumb = 0;
if (file_exists($item->file_path())) {
$item_fullsize = filesize($item->file_path());
}
if (file_exists($item->thumb_path())) {
$item_thumb = filesize($item->thumb_path());
}
if (file_exists($item->resize_path())) {
$item_resize = filesize($item->resize_path());
}
$this->fullsize = $this->fullsize + $item_fullsize;
$this->resize = $this->resize + $item_resize;
$this->thumb = $this->thumb + $item_thumb;
$this->save();
return ;
}
public function remove_item($item) {
// Removes an item's file size from the table.
if ($item->is_album()) {
return ;
}
$item_fullsize = 0;
$item_resize = 0;
$item_thumb = 0;
if (file_exists($item->file_path())) {
$item_fullsize = filesize($item->file_path());
}
if (file_exists($item->thumb_path())) {
$item_thumb = filesize($item->thumb_path());
}
if (file_exists($item->resize_path())) {
$item_resize = filesize($item->resize_path());
}
$this->fullsize = $this->fullsize - $item_fullsize;
$this->resize = $this->resize - $item_resize;
$this->thumb = $this->thumb - $item_thumb;
$this->save();
return ;
}
}

View File

@ -0,0 +1,7 @@
name = "Quotas"
description = "Assign quotas to user groups and track each users space usage."
version = 1
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:quotas"
discuss_url = "http://gallery.menalto.com/node/103606"

View File

@ -0,0 +1,98 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-block">
<h1> <?= t("User quotas") ?> </h1>
<div class="g-block-content">
<div id="g-user-admin" class="g-block">
<h2> <?= t("Users") ?> </h2>
<div class="g-block-content">
<table id="g-user-admin-list">
<tr>
<th><?= t("Username") ?></th>
<th><?= t("Full name") ?></th>
<th><?= t("Fullsize") ?></th>
<th><?= t("Resize") ?></th>
<th><?= t("Thumbs") ?></th>
<th><?= t("Total") ?></th>
<th><?= t("Limit") ?></th>
</tr>
<? foreach ($users as $i => $user): ?>
<? $record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find(); ?>
<tr id="g-user-<?= $user->id ?>" class="<?= text::alternate("g-odd", "g-even") ?> g-user <?= $user->admin ? "g-admin" : "" ?>">
<td id="g-user-<?= $user->id ?>" class="g-core-info">
<img src="<?= $user->avatar_url(20, $theme->url("images/avatar.jpg", true)) ?>"
alt="<?= html::clean_attribute($user->name) ?>"
width="20"
height="20" />
<?= html::clean($user->name) ?>
</td>
<td>
<?= html::clean($user->full_name) ?>
</td>
<td>
<?= number_format($record->partial_usage_mb("fullsize"), 2); ?> MB
</td>
<td>
<?= number_format($record->partial_usage_mb("resize"), 2); ?> MB
</td>
<td>
<?= number_format($record->partial_usage_mb("thumb"), 2); ?> MB
</td>
<td>
<?= number_format($record->total_usage_mb(), 2) ?> MB
</td>
<td>
<?= number_format($record->get_usage_limit_mb(), 2) ?> MB
</td>
</tr>
<? endforeach ?>
</table>
<div class="g-paginator">
<?= $theme->paginator() ?>
</div>
</div>
</div>
<div id="g-group-admin" class="g-block ui-helper-clearfix">
<h2> <?= t("Groups") ?> </h2>
<table id="g-group-admin-list">
<tr>
<th><?= t("Group") ?></th>
<th><?= t("Limit") ?></th>
<th><?= t("Actions") ?></th>
</tr>
<? foreach ($groups as $i => $group): ?>
<? $record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find(); ?>
<tr id="g-group-<?= $group->id ?>" class="<?= text::alternate("g-odd", "g-even") ?> g-user ">
<td id="g-group-<?= $group->id ?>" class="g-core-info">
<?= html::clean($group->name) ?>
</td>
<td>
<?= number_format($record->storage_limit / 1024 / 1024, 2); ?> MB
</td>
<td>
<a href="<?= url::site("admin/quotas/form_group_quota/$group->id") ?>"
open_text="<?= t("Close") ?>"
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
<span class="ui-icon ui-icon-pencil"></span><span class="g-button-text"><?= t("Set limit") ?></span></a>
</td>
</tr>
<? endforeach ?>
</table>
</div>
</div>
<div class="g-block-content">
<div id="g-quota-settings-admin" class="g-block">
<h2> <?= t("Settings") ?> </h2>
<?= $quota_options ?>
</div>
</div>
</div>

View File

@ -56,8 +56,8 @@
<meta name="teoma" content="noindex, nofollow, noarchive" />
<? endif; ?>
<? if ($theme->blendpagetrans): ?>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)" />
<meta http-equiv="Page-Enter" content="blendtrans(duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendtrans(duration=0.5)" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : Start -->
<meta name="application-name" content="<?= $_title; ?>" />
@ -124,12 +124,20 @@
<style type="text/css"> #g-column-bottom #g-thumbnav-block, #g-column-top #g-thumbnav-block { display: none; } </style>
<? endif; ?>
</head>
<? if ($theme->item()): ?>
<? $item = $theme->item(); ?>
<? else: ?>
<? $item = item::root(); ?>
<? endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($theme->is_rtl)? "class=\"rtl\"" : null; ?> >
<? if ($theme->item()):
$item = $theme->item();
else:
$item = item::root();
endif;
if ($theme->is_rtl):
$body_class = "rtl";
else:
$body_class = "";
endif;
if ($theme->viewmode == "mini"):
$body_class .= "viewmode-mini";
endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($body_class)? 'class="' . $body_class . '"' : null; ?>>
<?= $theme->page_top() ?>
<?= $theme->site_status() ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position == "bar")): ?>
@ -140,14 +148,15 @@
<? endif ?>
<div id="g-header">
<?= $theme->header_top() ?>
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<? if ($theme->viewmode != "mini"): ?>
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<span id="g-header-text"><?= $theme->bb2html($header_text, 1) ?></span>
<? else: ?>
<? else: ?>
<a id="g-logo" href="<?= item::root()->url() ?><?= ($theme->allow_root_page)? "?root=yes" : null; ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
<img alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= $theme->logopath ?>" />
</a>
<? endif ?>
<? endif; ?>
<? endif; ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position != "bar")): ?>
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
@ -160,13 +169,18 @@
<? if ($theme->loginmenu_position == "header"): ?>
<?= $theme->user_menu() ?>
<? endif ?>
<?
// Custom rWatcher code, based on the breadcrumb menu function.
// The rest of this file is the original page.html.php file from the Grey Dragon theme.
?>
<? if (empty($breadcrumbs)): ?>
<? if (empty($parents)): ?>
<?= $theme->breadcrumb_menu($theme, null); ?>
<? else: ?>
<?= $theme->breadcrumb_menu($theme, $parents); ?>
<? endif; ?>
<? else: ?>
<?
$breadcrumb_content = "";
if ($this->breadcrumbs_position == "hide"):
@ -193,6 +207,7 @@
// End Edit.
?>
<? endif; ?>
<?= $theme->custom_header(); ?>
</div>
@ -281,15 +296,17 @@
</div>
<? endif; ?>
<div id="g-footer">
<?= $theme->footer() ?>
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
<? if ($theme->viewmode != "mini"): ?>
<?= $theme->footer() ?>
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
<span id="g-footer-text"><?= $theme->bb2html($footer_text, 1) ?></span>
<? endif ?>
<? endif ?>
<?= $theme->credits() ?>
<ul id="g-footer-rightside"><li><?= $theme->copyright ?></li></ul>
<? if ($theme->loginmenu_position == "default"): ?>
<? if ($theme->loginmenu_position == "default"): ?>
<?= $theme->user_menu() ?>
<? endif ?>
<? endif; ?>
<? endif; ?>
<?= $theme->custom_footer(); ?>
</div>
<?= $theme->page_bottom() ?>

View File

@ -53,7 +53,7 @@
$siblings = $dynamic_siblings;
for ($i = 1; $i <= $total_pages; $i++):
if ($page_type == "item") {
$_pagelist[$i] = url::site("tag_albums/show/" . $siblings[$i-1]->id . "/" . $tag_id . "/" . $album_id);
$_pagelist[$i] = url::site("tag_albums/show/" . $siblings[$i-1]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($siblings[$i-1]->name));
} elseif ($page_type == "") {
}
endfor;
@ -91,6 +91,7 @@
$_pagelist[1] = url::site();
break;
}
// rWatcher Mod
endif;
// End rWatcher Mod.

View File

@ -48,7 +48,7 @@
<div id="g-info">
<h1><?= $_title ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<?= $theme->add_paginator("top", FALSE); ?>
<?= $theme->photo_top() ?>
<? if (($theme->photo_descmode == "top") and ($_description)): ?>
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
@ -56,7 +56,7 @@
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? $_resizewidth = $item->resize_width;
// rWatcher Modification.
$siblings = "";
if (isset($dynamic_siblings)) {
@ -116,7 +116,7 @@
<? if (($theme->photo_descmode == "bottom") and ($_description)): ?>
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>
<?= $theme->add_paginator("bottom", FALSE); ?>
<?= $theme->photo_bottom() ?>
</div>
<?= $script ?>

View File

@ -132,7 +132,7 @@
<?= $theme->header_bottom() ?>
</div>
<? // The following code was modifed to allow module-defined breadcrumbs.
<? // rWatcher EDIT: The following code was modifed to allow module-defined breadcrumbs.
// Everything else in this file is a copy of the default page.html.php file.
?>
<? if (!empty($breadcrumbs)): ?>
@ -145,9 +145,14 @@
the immediate parent so that when you go back up a
level you're on the right page. -->
<? if ($breadcrumb->url) : ?>
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
<a href="<?= $breadcrumb->url ?>">
<? // limit the title length to something reasonable (defaults to 15) ?>
<?= html::purify(text::limit_chars($breadcrumb->title,
module::get_var("gallery", "visible_title_length"))) ?>
</a>
<? else : ?>
<?= html::purify($breadcrumb->title) ?>
<?= html::purify(text::limit_chars($breadcrumb->title,
module::get_var("gallery", "visible_title_length"))) ?>
<? endif ?>
</li>
<? $i++ ?>
@ -156,7 +161,7 @@
<? endif ?>
<? // End modified code ?>
</div>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">

View File

@ -44,6 +44,9 @@ class tag_albums_Controller extends Controller {
$page_title = $album->title;
$page_description = $album->description;
// URL to this page
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->name);
// Determine page sort order.
$sort_page_field = $album->sort_column;
$sort_page_direction = $album->sort_order;
@ -68,7 +71,7 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect("tag_albums/album/" . $id . "/" . urlencode($album->name) . "?page=$page");
url::redirect($str_page_url . "?page=$page");
}
}
@ -79,7 +82,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/album/" . $id);
url::redirect($str_page_url);
}
// First item to display.
@ -90,7 +93,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/album/{$id}/?page=$max_pages");
url::redirect($str_page_url . "/?page=$max_pages");
}
// Figure out which items to display on this page and store their details in $children.
@ -110,11 +113,11 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/album/{$id}/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/album/{$id}/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
}
// Set up breadcrumbs.
@ -132,7 +135,7 @@ class tag_albums_Controller extends Controller {
// Set up and display the actual page.
$parent_album = ORM::factory("item", $album->parent_id);
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $page_title;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -153,7 +156,7 @@ class tag_albums_Controller extends Controller {
// tags whose name begins with $filter.
$this->index($id, $filter);
}
public function index($id, $filter) {
// Load a page containing sub-albums for each tag in the gallery.
@ -190,14 +193,17 @@ class tag_albums_Controller extends Controller {
$album = "";
$page_title = module::get_var("tag_albums", "tag_page_title", "All Tags");
$page_description = "";
$str_page_url = "";
if ($id == "") {
$album = ORM::factory("item", 1);
access::required("view", $album);
$str_page_url = "tag_albums/";
} else {
$album = ORM::factory("item", $album_tags[0]->album_id);
access::required("view", $album);
$page_title = $album->title;
$page_description = $album->description;
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->title);
}
// Figure out sort order from module preferences.
@ -233,11 +239,7 @@ class tag_albums_Controller extends Controller {
}
if ($index) {
$page = ceil($index / $page_size);
if ($id == "") {
url::redirect("tag_albums/?page=$page");
} else {
url::redirect("tag_albums/album/" . $id . "/" . urlencode($album->title) . "?page=$page");
}
url::redirect("$str_page_url?page=$page");
}
}
@ -245,7 +247,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/");
url::redirect($str_page_url);
}
// First item to display.
@ -274,7 +276,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/?page=$max_pages");
url::redirect("$str_page_url?page=$max_pages");
}
// Figure out which items to display on this page.
@ -298,11 +300,11 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/album/" . $id . "/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/album/" . $id . "/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "?page={$next_page}");
}
// Generate an arry of "fake" items, one for each tag on the page.
@ -346,7 +348,7 @@ class tag_albums_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $page_title;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -376,10 +378,16 @@ class tag_albums_Controller extends Controller {
$album_id = "";
}
// Load the current tag.
$display_tag = ORM::factory("tag", $id);
// Figure out sort order from module preferences.
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
// Figure out the URL to this page.
$str_page_url = "tag_albums/tag/{$id}/{$album_id}/" . urlencode($display_tag->name);
// Figure out how many items to display on each page.
$page_size = module::get_var("gallery", "page_size", 9);
@ -390,7 +398,7 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, Array($id), "items." . $sort_page_field, $sort_page_direction, "OR", true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect("tag_albums/tag/" . $id . "/" . $album_id . "?page=$page");
url::redirect($str_page_url . "?page=$page");
}
}
@ -398,7 +406,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/tag/" . $id . "/" . $album_id);
url::redirect($str_page_url);
}
// First item to display.
@ -413,7 +421,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/tag/{$id}/" . $album_id . "/?page=$max_pages");
url::redirect($str_page_url . "/?page=$max_pages");
}
// Figure out which items to display on this page.
@ -435,16 +443,13 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/tag/{$id}/" . $album_id . "/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/tag/{$id}/" . $album_id . "/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
}
// Load the current tag.
$display_tag = ORM::factory("tag", $id);
// Set up breadcrumbs for the page.
$tag_album_breadcrumbs = Array();
$parent_url = "";
@ -480,7 +485,7 @@ class tag_albums_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $display_tag->name;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -537,12 +542,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
}
}
$next_item_object = $this->_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
}
$dynamic_siblings = $this->_get_records(Array($tag_id), null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
} else {
@ -559,12 +564,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
}
}
$next_item_object = $this->_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
}
$dynamic_siblings = $this->_get_records($tag_ids, null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
}
@ -575,15 +580,15 @@ class tag_albums_Controller extends Controller {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($item->title, "");
if ($album_tags[0]->tags == "*") {
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id));
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
}
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
if ($album_tags[0]->tags == "*") {
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id);
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name));
} else {
$parent_url = $parent_item->url();
}
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, url::site("tag_albums/album/" . $album_id));
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
$parent_item = ORM::factory("item", $parent_item->parent_id);
while ($parent_item->id != 1) {
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
@ -595,9 +600,9 @@ class tag_albums_Controller extends Controller {
} else {
$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id) . "?show=" . $item->id);
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
$tag_album_breadcrumbs[3] = new Tag_Albums_Breadcrumb($item->title, "");
$parent_url = url::site("tag_albums/tag/" . $display_tag->id);
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name));
}
// Increase the items view count.
@ -780,7 +785,11 @@ class tag_albums_Controller extends Controller {
$str_html = "Filter: ";
if ($str_filter != "") {
if ($album_id > 0) {
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id) . "\">(All)</a> ";
$album_tags = ORM::factory("tags_album_id")
->where("id", "=", $album_id)
->find_all();
$album = ORM::factory("item", $album_tags[0]->album_id);
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id . "/" . urlencode($album->name)) . "\">(All)</a> ";
} else {
$str_html .= "<a href=\"" . url::site("tag_albums/") . "\">(All)</a> ";
}

View File

@ -21,9 +21,10 @@
<link rel="shortcut icon"
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
type="image/x-icon" />
<link rel="apple-touch-icon-precomposed"
href="<?= url::file(module::get_var("gallery", "apple_touch_icon_url")) ?>" />
<? if ($theme->page_type == "collection"): ?>
<? if ($thumb_proportion != 1): ?>
<? if (($thumb_proportion = $theme->thumb_proportion($theme->item())) != 1): ?>
<? $new_width = round($thumb_proportion * 213) ?>
<? $new_height = round($thumb_proportion * 240) ?>
<style type="text/css">
@ -66,16 +67,19 @@
<?= $theme->css("superfish/css/superfish.css") ?>
<?= $theme->css("themeroller/ui.base.css") ?>
<?= $theme->css("screen.css") ?>
<? if (locales::is_rtl()): ?>
<?= $theme->css("screen-rtl.css") ?>
<? endif; ?>
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css") ?>
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
</head>
<body <?= $theme->body_attributes() ?>>
@ -103,8 +107,7 @@
<?= $theme->header_bottom() ?>
</div>
<? // The following code was modifed to allow module-defined breadcrumbs.
<? // rWatcher Edit: The following code was modifed to allow module-defined breadcrumbs.
// Everything else in this file is a copy of the default page.html.php file.
?>
<? if (!empty($breadcrumbs)): ?>
@ -117,9 +120,11 @@
the immediate parent so that when you go back up a
level you're on the right page. -->
<? if ($breadcrumb->url) : ?>
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
<a href="<?= $breadcrumb->url ?>">
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
</a>
<? else : ?>
<?= html::purify($breadcrumb->title) ?>
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
<? endif ?>
</li>
<? $i++ ?>
@ -128,8 +133,6 @@
<? endif ?>
<? // End modified code ?>
</div>
<div id="bd">
<div id="yui-main">

View File

@ -0,0 +1,152 @@
<?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 Admin_Quotas_Controller extends Admin_Controller {
public function index() {
// Set up a new admin page for the quotas module.
$view = new Admin_View("admin.html");
$view->page_title = t("Users and groups");
$view->page_type = "collection";
$view->page_subtype = "admin_users_quotas";
$view->content = new View("admin_quotas.html");
$page_size = module::get_var("user", "page_size", 10);
$page = Input::instance()->get("page", "1");
$builder = db::build();
$user_count = $builder->from("users")->count_records();
$view->page = $page;
$view->page_size = $page_size;
$view->children_count = $user_count;
$view->max_pages = ceil($view->children_count / $view->page_size);
$view->content->pager = new Pagination();
$view->content->pager->initialize(
array("query_string" => "page",
"total_items" => $user_count,
"items_per_page" => $page_size,
"style" => "classic"));
if ($page < 1) {
url::redirect(url::merge(array("page" => 1)));
} else if ($page > $view->content->pager->total_pages) {
url::redirect(url::merge(array("page" => $view->content->pager->total_pages)));
}
$view->content->users = ORM::factory("user")
->order_by("users.name", "ASC")
->find_all($page_size, $view->content->pager->sql_offset);
$view->content->groups = ORM::factory("group")->order_by("name", "ASC")->find_all();
$view->content->quota_options = $this->_get_quota_settings_form();
print $view;
}
public function form_group_quota($id) {
// Display the form for setting a quota for the specified group ($id).
$group = ORM::factory("group", $id);
if (empty($group)) {
throw new Kohana_404_Exception();
}
print $this->_get_edit_group_quota($group);
}
static function _get_edit_group_quota($group) {
// Generate a form for setting a quota for the specified group ($group).
$record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find();
$form = new Forge(
"admin/quotas/edit_quota/$group->id", "", "post", array("id" => "g-edit-quota-form"));
$group = $form->group("edit_quota")->label(t("Edit group quota"));
$group->input("group_quota")->label(t("Limit (MB)"))->id("g-group_quota")->value($record->storage_limit / 1024 / 1024)
->error_messages("required", t("A value is required"));
$group->submit("")->value(t("Save"));
return $form;
}
public function edit_quota($id) {
// Save the specified quota to the database.
access::verify_csrf();
$group = ORM::factory("group", $id);
if (empty($group)) {
throw new Kohana_404_Exception();
}
$record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find();
$form = $this->_get_edit_group_quota($group);
try {
$valid = $form->validate();
$record->group_id = $id;
$record->storage_limit = $form->edit_quota->inputs["group_quota"]->value * 1024 * 1024;
} catch (ORM_Validation_Exception $e) {
// Translate ORM validation errors into form error messages
foreach ($e->validation->errors() as $key => $error) {
$form->edit_quota->inputs[$key]->add_error($error, 1);
}
$valid = false;
}
if ($valid) {
$record->save();
message::success(t("Limit for group %group_name set", array("group_name" => $group->name)));
json::reply(array("result" => "success"));
} else {
json::reply(array("result" => "error", "html" => (string) $form));
}
}
private function _get_quota_settings_form() {
// Make a new form to allow the admin to specify how the system should calculate a user's quota.
$form = new Forge("admin/quotas/saveprefs", "", "post",
array("id" => "g-quotas-admin-form"));
// Setup a checkbox for the form.
$quota_options["use_all_sizes"] = array(t("Count resizes and thumbnails towards a users limit?"), module::get_var("quotas", "use_all_sizes"));
$add_links = $form->group("quota_preferences");
$add_links->checklist("quota_preferences_list")
->options($quota_options);
// Add a save button to the form.
$form->submit("save_preferences")->value(t("Save"));
// Return the newly generated form.
return $form;
}
public function saveprefs() {
// Prevent Cross Site Request Forgery
access::verify_csrf();
// Figure out which boxes where checked
$checkboxes_array = Input::instance()->post("quota_preferences_list");
$use_all_sizes = false;
for ($i = 0; $i < count($checkboxes_array); $i++) {
if ($checkboxes_array[$i] == "use_all_sizes") {
$use_all_sizes = true;
}
}
// Save Settings.
module::set_var("quotas", "use_all_sizes", $use_all_sizes);
message::success(t("Your Selection Has Been Saved."));
// Load Admin page.
url::redirect("admin/quotas");
}
}

View File

@ -0,0 +1,110 @@
<?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 quotas_event_Core {
static function admin_menu($menu, $theme) {
// Add a User quotas link to the admin menu.
$menu->get("content_menu")
->append(Menu::factory("link")
->id("quotas")
->label(t("User quotas"))
->url(url::site("admin/quotas")));
}
static function user_created($user) {
// Set up some default values whenever a new user is created.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find();
if (!$record->loaded()) {
$record->owner_id = $user->id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
}
static function user_before_delete($user) {
// When deleting a user, all of that user's items get re-assigned to the admin account,
// so the file sizes need to be reassigned to the admin user as well.
$admin = identity::admin_user();
$admin_record = ORM::factory("users_space_usage")->where("owner_id", "=", $admin->id)->find();
$deleted_user_record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find();
if ($deleted_user_record->loaded()) {
$admin_record->fullsize = $admin_record->fullsize + $deleted_user_record->fullsize;
$admin_record->resize = $admin_record->resize + $deleted_user_record->resize;
$admin_record->thumb = $admin_record->thumb + $deleted_user_record->thumb;
$admin_record->save();
$deleted_user_record->delete();
}
}
static function item_before_create($item) {
// When creating a new item, make sure it's file size won't put the user over their limit.
// If it does, throw an error, which will prevent gallery from accepting the file.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
if (!$record->loaded()) {
$record->owner_id = $item->owner_id;
}
if ($record->get_usage_limit() == 0) {
return;
}
if ((filesize($item->data_file) + $record->current_usage()) > $record->get_usage_limit()) {
throw new Exception($item->name . " rejected, user #" . $item->owner_id . " over limit.");
}
}
static function item_created($item) {
// When a new item is created, add it's file size to the users_space_usage table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
if (!$record->loaded()) {
$record->owner_id = $item->owner_id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
$record->add_item($item);
}
static function item_before_delete($item) {
// When an item is deleted, remove it's file size from the users_space_usage table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->remove_item($item);
}
// I can't monitor the item_before_update / item_updated events to adjust for rotated photos,
// because they fire when a new photo is uploaded (before it's created) and cause all kinds of weirdness.
// So instead, I'm using graphics_rotate to detect a rotate and remove the existing file sizes, and
// item_updated_data_file to add in the new data file sizes.
// Does item_updated_data_file fire for any other reason? (watermarking? renaming/moving/deleting/keeporiginal do not cause updated_data_file.)
static function graphics_rotate($input_file, $output_file, $options) {
// Remove the current item's file size from the quotas table.
$item = item::find_by_path(substr(str_replace(VARPATH, "", $input_file), strpos(str_replace(VARPATH, "", $input_file), "/")+1));
if ($item->loaded()) {
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->remove_item($item);
}
}
static function item_updated_data_file($item) {
// Add the current item's file size into the quotas table.
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item->owner_id)->find();
$record->add_item($item);
}
}

View File

@ -0,0 +1,47 @@
<?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 quotas_installer {
static function install() {
// Create tables.
$db = Database::instance();
$db->query("CREATE TABLE IF NOT EXISTS {users_space_usages} (
`id` int(9) NOT NULL auto_increment,
`owner_id` int(9) NOT NULL,
`fullsize` BIGINT UNSIGNED NOT NULL,
`resize` BIGINT UNSIGNED NOT NULL,
`thumb` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`owner_id`, `id`))
DEFAULT CHARSET=utf8;");
$db->query("CREATE TABLE IF NOT EXISTS {groups_quotas} (
`id` int(9) NOT NULL auto_increment,
`group_id` int(9) NOT NULL,
`storage_limit` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`group_id`, `id`))
DEFAULT CHARSET=utf8;");
module::set_var("quotas", "use_all_sizes", true);
// Set the module version number.
module::set_version("quotas", 1);
}
}

View File

@ -0,0 +1,126 @@
<?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 quotas_task_Core {
static function available_tasks() {
// Total up all non-guest users in the users table that don't have a corresponding record
// in the users_space_usages table.
// If the result is greater then 0, display a warning for this task so the admin knows
// a user is missing and it should be run.
$missing_users = ORM::factory("user")
->where("users.guest", "=", "0")
->join("users_space_usages", "users.id", "users_space_usages.owner_id", "LEFT OUTER")
->and_where("users_space_usages.owner_id", "IS", NULL)->count_all();
$tasks = array();
$tasks[] = Task_Definition::factory()
->callback("quotas_task::update_quotasdb")
->name(t("Rebuild user quotas table"))
->description(t("Recalculates each users space usage."))
->severity($missing_users ? log::WARNING : log::SUCCESS);
return $tasks;
}
static function update_quotasdb($task) {
// Re-create the users_space_usages table and recalculate all values.
// Retrieve the total variable. If this is the first time this function has been run,
// total will be empty.
$total = $task->get("total");
$existing_items = ORM::factory("item")->where("type", "!=", "album")->find_all();
if (empty($total)) {
// If this is the first time this function has been run,
// delete and re-create the users_space_usages table, and set up
// some initial variables.
$db = Database::instance();
$db->query("DROP TABLE IF EXISTS {users_space_usages};");
$db->query("CREATE TABLE IF NOT EXISTS {users_space_usages} (
`id` int(9) NOT NULL auto_increment,
`owner_id` int(9) NOT NULL,
`fullsize` BIGINT UNSIGNED NOT NULL,
`resize` BIGINT UNSIGNED NOT NULL,
`thumb` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
KEY(`owner_id`, `id`))
DEFAULT CHARSET=utf8;");
// Set the initial values for all variables.
$task->set("total", count($existing_items));
$total = $task->get("total");
$task->set("last_id", 0);
$task->set("completed_items", 0);
$task->set("total_users", ORM::factory("user")->where("guest", "=", "0")->count_all());
$task->set("completed_users", 0);
$task->set("last_user_id", 0);
}
// Retrieve the values for variables from the last time this
// function was run.
$last_id = $task->get("last_id");
$completed_items = $task->get("completed_items");
$total_users = $task->get("total_users");
$completed_users = $task->get("completed_users");
$last_user_id = $task->get("last_user_id");
// First set up default values for all non-guest users.
if ($total_users > $completed_users) {
$one_user = ORM::factory("user")
->where("guest", "=", "0")
->where("id", ">", $last_user_id)
->order_by("id")
->find_all(1);
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $one_user[0]->id)->find();
if (!$record->loaded()) {
$record->owner_id = $one_user[0]->id;
$record->fullsize = 0;
$record->resize = 0;
$record->thumb = 0;
$record->save();
}
$task->set("last_user_id", $one_user[0]->id);
$task->set("completed_users", ++$completed_users);
$task->status = t("Populating quotas table...");
} else {
// Loop through each non-album item in Gallery and log its file size to its owner.
$item = ORM::factory("item")
->where("type", "!=", "album")
->where("id", ">", $last_id)
->order_by("id")
->find_all(1);
$record = ORM::factory("users_space_usage")->where("owner_id", "=", $item[0]->owner_id)->find();
$record->add_item($item[0]);
// Store the current position and update the status message.
$task->set("last_id", $item[0]->id);
$task->set("completed_items", ++$completed_items);
if ($total == $completed_items) {
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
$task->status = t("Complete");
} else {
$task->percent_complete = round(100 * $completed_items / $total);
$task->status = t("Scanning $completed_items of $total files");
}
}
}
}

View File

@ -0,0 +1,35 @@
<?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 quotas_theme_Core {
static function page_bottom($theme) {
// If a user is logged in, display their space usage at the bottom of the page.
if (!identity::active_user()->guest) {
$record = ORM::factory("users_space_usage")->where("owner_id", "=", identity::active_user()->id)->find();
if ($record->get_usage_limit() == 0) {
print t("You are using %usage MB", array("usage" => number_format($record->total_usage_mb(), 2)));
} else {
print t("You are using %usage of your %limit MB limit (%percentage%)",
array("usage" => number_format($record->current_usage_mb(), 2),
"limit" => number_format($record->get_usage_limit_mb(), 2),
"percentage" => number_format((($record->current_usage() / $record->get_usage_limit()) * 100), 2)));
}
}
}
}

View File

@ -0,0 +1,21 @@
<?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 Groups_Quota_Model extends ORM {
}

View File

@ -0,0 +1,131 @@
<?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 Users_Space_Usage_Model_Core extends ORM {
public function partial_usage_mb($file_type) {
// Return a value (in megabytes) for the user's total usage in fullsizes, resizes, or thumbs.
// $file_type should be either fullsize, resize, or thumb.
return ($this->$file_type / 1024 / 1024);
}
public function total_usage() {
// Return the user's total usage in bytes.
return ($this->fullsize + $this->resize + $this->thumb);
}
public function total_usage_mb() {
// Return the user's total usage in megabytes.
return (($this->total_usage()) / 1024 / 1024);
}
public function current_usage() {
// Return the users relevant usage in bytes based on the use_all_sizes setting.
if (module::get_var("quotas", "use_all_sizes") == true) {
return $this->total_usage();
} else {
return $this->fullsize;
}
}
public function current_usage_mb() {
// Return the users relevant usage in megabytes based on the use_all_sizes setting.
return ($this->current_usage() / 1024 / 1024);
}
public function get_usage_limit() {
// Returns a user's maximum limit in bytes.
$user_groups = ORM::factory("group")
->join("groups_users", "groups_users.group_id", "groups.id")
->join("groups_quotas", "groups_quotas.group_id", "groups.id")
->select("groups.id")
->select("groups_quotas.storage_limit")
->where("groups_users.user_id", "=", $this->owner_id)
->order_by("groups_quotas.storage_limit", "DESC")
->find_all(1);
if (!empty($user_groups)) {
if ($user_groups[0]->storage_limit <= "0") {
return 0;
} else {
return $user_groups[0]->storage_limit;
}
}
return 0;
}
public function get_usage_limit_mb() {
// Returns a user's maximum limit in megabytes.
return ($this->get_usage_limit() / 1024 / 1024);
}
public function add_item($item) {
// Adds an item's file size to the table.
if ($item->is_album()) {
return ;
}
$item_fullsize = 0;
$item_resize = 0;
$item_thumb = 0;
if (file_exists($item->file_path())) {
$item_fullsize = filesize($item->file_path());
}
if (file_exists($item->thumb_path())) {
$item_thumb = filesize($item->thumb_path());
}
if (file_exists($item->resize_path())) {
$item_resize = filesize($item->resize_path());
}
$this->fullsize = $this->fullsize + $item_fullsize;
$this->resize = $this->resize + $item_resize;
$this->thumb = $this->thumb + $item_thumb;
$this->save();
return ;
}
public function remove_item($item) {
// Removes an item's file size from the table.
if ($item->is_album()) {
return ;
}
$item_fullsize = 0;
$item_resize = 0;
$item_thumb = 0;
if (file_exists($item->file_path())) {
$item_fullsize = filesize($item->file_path());
}
if (file_exists($item->thumb_path())) {
$item_thumb = filesize($item->thumb_path());
}
if (file_exists($item->resize_path())) {
$item_resize = filesize($item->resize_path());
}
$this->fullsize = $this->fullsize - $item_fullsize;
$this->resize = $this->resize - $item_resize;
$this->thumb = $this->thumb - $item_thumb;
$this->save();
return ;
}
}

View File

@ -0,0 +1,7 @@
name = "Quotas"
description = "Assign quotas to user groups and track each users space usage."
version = 1
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:quotas"
discuss_url = "http://gallery.menalto.com/node/103606"

View File

@ -0,0 +1,98 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-block">
<h1> <?= t("User quotas") ?> </h1>
<div class="g-block-content">
<div id="g-user-admin" class="g-block">
<h2> <?= t("Users") ?> </h2>
<div class="g-block-content">
<table id="g-user-admin-list">
<tr>
<th><?= t("Username") ?></th>
<th><?= t("Full name") ?></th>
<th><?= t("Fullsize") ?></th>
<th><?= t("Resize") ?></th>
<th><?= t("Thumbs") ?></th>
<th><?= t("Total") ?></th>
<th><?= t("Limit") ?></th>
</tr>
<? foreach ($users as $i => $user): ?>
<? $record = ORM::factory("users_space_usage")->where("owner_id", "=", $user->id)->find(); ?>
<tr id="g-user-<?= $user->id ?>" class="<?= text::alternate("g-odd", "g-even") ?> g-user <?= $user->admin ? "g-admin" : "" ?>">
<td id="g-user-<?= $user->id ?>" class="g-core-info">
<img src="<?= $user->avatar_url(20, $theme->url("images/avatar.jpg", true)) ?>"
alt="<?= html::clean_attribute($user->name) ?>"
width="20"
height="20" />
<?= html::clean($user->name) ?>
</td>
<td>
<?= html::clean($user->full_name) ?>
</td>
<td>
<?= number_format($record->partial_usage_mb("fullsize"), 2); ?> MB
</td>
<td>
<?= number_format($record->partial_usage_mb("resize"), 2); ?> MB
</td>
<td>
<?= number_format($record->partial_usage_mb("thumb"), 2); ?> MB
</td>
<td>
<?= number_format($record->total_usage_mb(), 2) ?> MB
</td>
<td>
<?= number_format($record->get_usage_limit_mb(), 2) ?> MB
</td>
</tr>
<? endforeach ?>
</table>
<div class="g-paginator">
<?= $theme->paginator() ?>
</div>
</div>
</div>
<div id="g-group-admin" class="g-block ui-helper-clearfix">
<h2> <?= t("Groups") ?> </h2>
<table id="g-group-admin-list">
<tr>
<th><?= t("Group") ?></th>
<th><?= t("Limit") ?></th>
<th><?= t("Actions") ?></th>
</tr>
<? foreach ($groups as $i => $group): ?>
<? $record = ORM::factory("groups_quota")->where("group_id", "=", $group->id)->find(); ?>
<tr id="g-group-<?= $group->id ?>" class="<?= text::alternate("g-odd", "g-even") ?> g-user ">
<td id="g-group-<?= $group->id ?>" class="g-core-info">
<?= html::clean($group->name) ?>
</td>
<td>
<?= number_format($record->storage_limit / 1024 / 1024, 2); ?> MB
</td>
<td>
<a href="<?= url::site("admin/quotas/form_group_quota/$group->id") ?>"
open_text="<?= t("Close") ?>"
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
<span class="ui-icon ui-icon-pencil"></span><span class="g-button-text"><?= t("Set limit") ?></span></a>
</td>
</tr>
<? endforeach ?>
</table>
</div>
</div>
<div class="g-block-content">
<div id="g-quota-settings-admin" class="g-block">
<h2> <?= t("Settings") ?> </h2>
<?= $quota_options ?>
</div>
</div>
</div>

View File

@ -56,8 +56,8 @@
<meta name="teoma" content="noindex, nofollow, noarchive" />
<? endif; ?>
<? if ($theme->blendpagetrans): ?>
<meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5)" />
<meta http-equiv="Page-Enter" content="blendtrans(duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendtrans(duration=0.5)" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : Start -->
<meta name="application-name" content="<?= $_title; ?>" />
@ -124,12 +124,20 @@
<style type="text/css"> #g-column-bottom #g-thumbnav-block, #g-column-top #g-thumbnav-block { display: none; } </style>
<? endif; ?>
</head>
<? if ($theme->item()): ?>
<? $item = $theme->item(); ?>
<? else: ?>
<? $item = item::root(); ?>
<? endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($theme->is_rtl)? "class=\"rtl\"" : null; ?> >
<? if ($theme->item()):
$item = $theme->item();
else:
$item = item::root();
endif;
if ($theme->is_rtl):
$body_class = "rtl";
else:
$body_class = "";
endif;
if ($theme->viewmode == "mini"):
$body_class .= "viewmode-mini";
endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($body_class)? 'class="' . $body_class . '"' : null; ?>>
<?= $theme->page_top() ?>
<?= $theme->site_status() ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position == "bar")): ?>
@ -140,14 +148,15 @@
<? endif ?>
<div id="g-header">
<?= $theme->header_top() ?>
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<? if ($theme->viewmode != "mini"): ?>
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
<span id="g-header-text"><?= $theme->bb2html($header_text, 1) ?></span>
<? else: ?>
<? else: ?>
<a id="g-logo" href="<?= item::root()->url() ?><?= ($theme->allow_root_page)? "?root=yes" : null; ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
<img alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= $theme->logopath ?>" />
</a>
<? endif ?>
<? endif; ?>
<? endif; ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position != "bar")): ?>
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
@ -160,13 +169,18 @@
<? if ($theme->loginmenu_position == "header"): ?>
<?= $theme->user_menu() ?>
<? endif ?>
<?
// Custom rWatcher code, based on the breadcrumb menu function.
// The rest of this file is the original page.html.php file from the Grey Dragon theme.
?>
<? if (empty($breadcrumbs)): ?>
<? if (empty($parents)): ?>
<?= $theme->breadcrumb_menu($theme, null); ?>
<? else: ?>
<?= $theme->breadcrumb_menu($theme, $parents); ?>
<? endif; ?>
<? else: ?>
<?
$breadcrumb_content = "";
if ($this->breadcrumbs_position == "hide"):
@ -193,6 +207,7 @@
// End Edit.
?>
<? endif; ?>
<?= $theme->custom_header(); ?>
</div>
@ -281,15 +296,17 @@
</div>
<? endif; ?>
<div id="g-footer">
<?= $theme->footer() ?>
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
<? if ($theme->viewmode != "mini"): ?>
<?= $theme->footer() ?>
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
<span id="g-footer-text"><?= $theme->bb2html($footer_text, 1) ?></span>
<? endif ?>
<? endif ?>
<?= $theme->credits() ?>
<ul id="g-footer-rightside"><li><?= $theme->copyright ?></li></ul>
<? if ($theme->loginmenu_position == "default"): ?>
<? if ($theme->loginmenu_position == "default"): ?>
<?= $theme->user_menu() ?>
<? endif ?>
<? endif; ?>
<? endif; ?>
<?= $theme->custom_footer(); ?>
</div>
<?= $theme->page_bottom() ?>

View File

@ -53,7 +53,7 @@
$siblings = $dynamic_siblings;
for ($i = 1; $i <= $total_pages; $i++):
if ($page_type == "item") {
$_pagelist[$i] = url::site("tag_albums/show/" . $siblings[$i-1]->id . "/" . $tag_id . "/" . $album_id);
$_pagelist[$i] = url::site("tag_albums/show/" . $siblings[$i-1]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($siblings[$i-1]->name));
} elseif ($page_type == "") {
}
endfor;
@ -91,6 +91,7 @@
$_pagelist[1] = url::site();
break;
}
// rWatcher Mod
endif;
// End rWatcher Mod.

View File

@ -48,7 +48,7 @@
<div id="g-info">
<h1><?= $_title ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<?= $theme->add_paginator("top", FALSE); ?>
<?= $theme->photo_top() ?>
<? if (($theme->photo_descmode == "top") and ($_description)): ?>
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
@ -56,7 +56,7 @@
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? $_resizewidth = $item->resize_width;
// rWatcher Modification.
$siblings = "";
if (isset($dynamic_siblings)) {
@ -116,7 +116,7 @@
<? if (($theme->photo_descmode == "bottom") and ($_description)): ?>
<div id="g-info"><div class="g-description"><?= $_description ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>
<?= $theme->add_paginator("bottom", FALSE); ?>
<?= $theme->photo_bottom() ?>
</div>
<?= $script ?>

View File

@ -132,7 +132,7 @@
<?= $theme->header_bottom() ?>
</div>
<? // The following code was modifed to allow module-defined breadcrumbs.
<? // rWatcher EDIT: The following code was modifed to allow module-defined breadcrumbs.
// Everything else in this file is a copy of the default page.html.php file.
?>
<? if (!empty($breadcrumbs)): ?>
@ -145,9 +145,14 @@
the immediate parent so that when you go back up a
level you're on the right page. -->
<? if ($breadcrumb->url) : ?>
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
<a href="<?= $breadcrumb->url ?>">
<? // limit the title length to something reasonable (defaults to 15) ?>
<?= html::purify(text::limit_chars($breadcrumb->title,
module::get_var("gallery", "visible_title_length"))) ?>
</a>
<? else : ?>
<?= html::purify($breadcrumb->title) ?>
<?= html::purify(text::limit_chars($breadcrumb->title,
module::get_var("gallery", "visible_title_length"))) ?>
<? endif ?>
</li>
<? $i++ ?>
@ -156,7 +161,7 @@
<? endif ?>
<? // End modified code ?>
</div>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">

View File

@ -44,6 +44,9 @@ class tag_albums_Controller extends Controller {
$page_title = $album->title;
$page_description = $album->description;
// URL to this page
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->name);
// Determine page sort order.
$sort_page_field = $album->sort_column;
$sort_page_direction = $album->sort_order;
@ -68,7 +71,7 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect("tag_albums/album/" . $id . "/" . urlencode($album->name) . "?page=$page");
url::redirect($str_page_url . "?page=$page");
}
}
@ -79,7 +82,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/album/" . $id);
url::redirect($str_page_url);
}
// First item to display.
@ -90,7 +93,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/album/{$id}/?page=$max_pages");
url::redirect($str_page_url . "/?page=$max_pages");
}
// Figure out which items to display on this page and store their details in $children.
@ -110,11 +113,11 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/album/{$id}/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/album/{$id}/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
}
// Set up breadcrumbs.
@ -132,7 +135,7 @@ class tag_albums_Controller extends Controller {
// Set up and display the actual page.
$parent_album = ORM::factory("item", $album->parent_id);
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $page_title;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -153,7 +156,7 @@ class tag_albums_Controller extends Controller {
// tags whose name begins with $filter.
$this->index($id, $filter);
}
public function index($id, $filter) {
// Load a page containing sub-albums for each tag in the gallery.
@ -190,14 +193,17 @@ class tag_albums_Controller extends Controller {
$album = "";
$page_title = module::get_var("tag_albums", "tag_page_title", "All Tags");
$page_description = "";
$str_page_url = "";
if ($id == "") {
$album = ORM::factory("item", 1);
access::required("view", $album);
$str_page_url = "tag_albums/";
} else {
$album = ORM::factory("item", $album_tags[0]->album_id);
access::required("view", $album);
$page_title = $album->title;
$page_description = $album->description;
$str_page_url = "tag_albums/album/" . $id . "/" . urlencode($album->title);
}
// Figure out sort order from module preferences.
@ -233,11 +239,7 @@ class tag_albums_Controller extends Controller {
}
if ($index) {
$page = ceil($index / $page_size);
if ($id == "") {
url::redirect("tag_albums/?page=$page");
} else {
url::redirect("tag_albums/album/" . $id . "/" . urlencode($album->title) . "?page=$page");
}
url::redirect("$str_page_url?page=$page");
}
}
@ -245,7 +247,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/");
url::redirect($str_page_url);
}
// First item to display.
@ -274,7 +276,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/?page=$max_pages");
url::redirect("$str_page_url?page=$max_pages");
}
// Figure out which items to display on this page.
@ -298,11 +300,11 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/album/" . $id . "/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/album/" . $id . "/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "?page={$next_page}");
}
// Generate an arry of "fake" items, one for each tag on the page.
@ -346,7 +348,7 @@ class tag_albums_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $page_title;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -376,10 +378,16 @@ class tag_albums_Controller extends Controller {
$album_id = "";
}
// Load the current tag.
$display_tag = ORM::factory("tag", $id);
// Figure out sort order from module preferences.
$sort_page_field = module::get_var("tag_albums", "subalbum_sort_by", "title");
$sort_page_direction = module::get_var("tag_albums", "subalbum_sort_direction", "ASC");
// Figure out the URL to this page.
$str_page_url = "tag_albums/tag/{$id}/{$album_id}/" . urlencode($display_tag->name);
// Figure out how many items to display on each page.
$page_size = module::get_var("gallery", "page_size", 9);
@ -390,7 +398,7 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, Array($id), "items." . $sort_page_field, $sort_page_direction, "OR", true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect("tag_albums/tag/" . $id . "/" . $album_id . "?page=$page");
url::redirect($str_page_url . "?page=$page");
}
}
@ -398,7 +406,7 @@ class tag_albums_Controller extends Controller {
// don't allow the visitor to go below page 1.
$page = Input::instance()->get("page", 1);
if ($page < 1) {
url::redirect("tag_albums/tag/" . $id . "/" . $album_id);
url::redirect($str_page_url);
}
// First item to display.
@ -413,7 +421,7 @@ class tag_albums_Controller extends Controller {
// Don't let the visitor go past the last page.
if ($max_pages && $page > $max_pages) {
url::redirect("tag_albums/tag/{$id}/" . $album_id . "/?page=$max_pages");
url::redirect($str_page_url . "/?page=$max_pages");
}
// Figure out which items to display on this page.
@ -435,16 +443,13 @@ class tag_albums_Controller extends Controller {
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
$view->previous_page_link = url::site("tag_albums/tag/{$id}/" . $album_id . "/?page={$previous_page}");
$view->previous_page_link = url::site($str_page_url . "/?page={$previous_page}");
}
if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("tag_albums/tag/{$id}/" . $album_id . "/?page={$next_page}");
$view->next_page_link = url::site($str_page_url . "/?page={$next_page}");
}
// Load the current tag.
$display_tag = ORM::factory("tag", $id);
// Set up breadcrumbs for the page.
$tag_album_breadcrumbs = Array();
$parent_url = "";
@ -480,7 +485,7 @@ class tag_albums_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("calpage.html", "other", "Tag Albums");
$template = new Theme_View("calpage.html", "collection", "Tag Albums");
$template->page_title = $display_tag->name;
$template->set_global("page", $page);
$template->set_global("page_size", $page_size);
@ -537,12 +542,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
}
}
$next_item_object = $this->_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
}
$dynamic_siblings = $this->_get_records(Array($tag_id), null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
} else {
@ -559,12 +564,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records($tag_ids, 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
}
}
$next_item_object = $this->_get_records($tag_ids, 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
}
$dynamic_siblings = $this->_get_records($tag_ids, null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
}
@ -575,15 +580,15 @@ class tag_albums_Controller extends Controller {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($item->title, "");
if ($album_tags[0]->tags == "*") {
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id));
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name)));
}
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
if ($album_tags[0]->tags == "*") {
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id);
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . $album_id . "/" . urlencode($display_tag->name));
} else {
$parent_url = $parent_item->url();
}
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, url::site("tag_albums/album/" . $album_id));
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, url::site("tag_albums/album/" . $album_id . "/" . urlencode($parent_item->name)));
$parent_item = ORM::factory("item", $parent_item->parent_id);
while ($parent_item->id != 1) {
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($parent_item->title, $parent_item->url());
@ -595,9 +600,9 @@ class tag_albums_Controller extends Controller {
} else {
$tag_album_breadcrumbs[0] = new Tag_Albums_Breadcrumb(item::root()->title, item::root()->url());
$tag_album_breadcrumbs[1] = new Tag_Albums_Breadcrumb(module::get_var("tag_albums", "tag_page_title", "All Tags"), url::site("tag_albums/"));
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id) . "?show=" . $item->id);
$tag_album_breadcrumbs[2] = new Tag_Albums_Breadcrumb($display_tag->name, url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name)) . "?show=" . $item->id);
$tag_album_breadcrumbs[3] = new Tag_Albums_Breadcrumb($item->title, "");
$parent_url = url::site("tag_albums/tag/" . $display_tag->id);
$parent_url = url::site("tag_albums/tag/" . $display_tag->id . "/" . urlencode($display_tag->name));
}
// Increase the items view count.
@ -780,7 +785,11 @@ class tag_albums_Controller extends Controller {
$str_html = "Filter: ";
if ($str_filter != "") {
if ($album_id > 0) {
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id) . "\">(All)</a> ";
$album_tags = ORM::factory("tags_album_id")
->where("id", "=", $album_id)
->find_all();
$album = ORM::factory("item", $album_tags[0]->album_id);
$str_html .= "<a href=\"" . url::site("tag_albums/album/" . $album_id . "/" . urlencode($album->name)) . "\">(All)</a> ";
} else {
$str_html .= "<a href=\"" . url::site("tag_albums/") . "\">(All)</a> ";
}

View File

@ -21,9 +21,10 @@
<link rel="shortcut icon"
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
type="image/x-icon" />
<link rel="apple-touch-icon-precomposed"
href="<?= url::file(module::get_var("gallery", "apple_touch_icon_url")) ?>" />
<? if ($theme->page_type == "collection"): ?>
<? if ($thumb_proportion != 1): ?>
<? if (($thumb_proportion = $theme->thumb_proportion($theme->item())) != 1): ?>
<? $new_width = round($thumb_proportion * 213) ?>
<? $new_height = round($thumb_proportion * 240) ?>
<style type="text/css">
@ -66,16 +67,19 @@
<?= $theme->css("superfish/css/superfish.css") ?>
<?= $theme->css("themeroller/ui.base.css") ?>
<?= $theme->css("screen.css") ?>
<? if (locales::is_rtl()): ?>
<?= $theme->css("screen-rtl.css") ?>
<? endif; ?>
<!--[if lte IE 8]>
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
media="screen,print,projection" />
<![endif]-->
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css") ?>
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
</head>
<body <?= $theme->body_attributes() ?>>
@ -103,8 +107,7 @@
<?= $theme->header_bottom() ?>
</div>
<? // The following code was modifed to allow module-defined breadcrumbs.
<? // rWatcher Edit: The following code was modifed to allow module-defined breadcrumbs.
// Everything else in this file is a copy of the default page.html.php file.
?>
<? if (!empty($breadcrumbs)): ?>
@ -117,9 +120,11 @@
the immediate parent so that when you go back up a
level you're on the right page. -->
<? if ($breadcrumb->url) : ?>
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
<a href="<?= $breadcrumb->url ?>">
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
</a>
<? else : ?>
<?= html::purify($breadcrumb->title) ?>
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
<? endif ?>
</li>
<? $i++ ?>
@ -128,8 +133,6 @@
<? endif ?>
<? // End modified code ?>
</div>
<div id="bd">
<div id="yui-main">