1
0

New module: all_tags not in GIT before

This commit is contained in:
floridave 2011-05-10 16:25:54 -06:00
parent ca9b69cfd7
commit 41135b6b2b
6 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,56 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class All_Tags_Controller extends Controller {
public function index() {
$template = new Theme_View("page.html", "other", "All Tags");
$template->css("all_tags.css");
$template->page_title = t("Gallery :: All Tags");
$template->content = new View("all_tags.html");
$filter = Input::instance()->get("filter");
$template->content->filter = $filter;
$query = ORM::factory("tag");
if ($filter) {
$query->like("name", $filter);
}
$template->content->tags = $query->order_by("name", "ASC")->find_all();
print $template;
}
}
/*
public function index() {
$filter = Input::instance()->get("filter");
$view = new Admin_View("admin.html");
$view->page_title = t("Manage tags");
$view->content = new View("admin_tags.html");
$view->content->filter = $filter;
$query = ORM::factory("tag");
if ($filter) {
$query->like("name", $filter);
}
$view->content->tags = $query->order_by("name", "ASC")->find_all();
print $view;
}
*/

View File

@ -0,0 +1,2 @@
table.all_tags { text-align: center; width:500px; }
table.all_tags caption { font-size: 1.5em; padding: 0.2em; }

View File

@ -0,0 +1,29 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class all_tags_event_Core {
static function site_menu($menu, $theme) {
if (module::get_var("all_tags", "hidden") != true) {
$menu->add_after("home", Menu::factory("link")
->id("all_tags")
->label(t("All Tags"))
->url(url::site("all_tags/")));
}
}
}

View File

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

View File

@ -0,0 +1,7 @@
name = "All Tags"
description = "All Tags page and menu item."
version = 2
author_name = "Undagiga"
author_url = "http://codex.gallery2.org/User:Undagiga"
info_url = "http://codex.gallery2.org/Gallery3:Modules:all_tags"
discuss_url = "http://gallery.menalto.com/forum_module_all_tags"

View File

@ -0,0 +1,44 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? $tags_per_column = $tags->count()/5 ?>
<? $column_tag_count = 0 ?>
<div class="g-block">
<h1> <?= t("All Tags in the Gallery") ?> </h1>
<div class="g-block-content">
<table id="g-tag-admin">
<caption>
<?= t2("There is one tag", "There are %count tags", $tags->count()) ?>
</caption>
<tr>
<td>
<? foreach ($tags as $i => $tag): ?>
<? $current_letter = strtoupper(mb_substr($tag->name, 0, 1)) ?>
<? if ($i == 0): /* first letter */ ?>
<strong><?= html::clean($current_letter) ?></strong>
<ul>
<? elseif ($last_letter != $current_letter): /* new letter */ ?>
</ul>
<? if ($column_tag_count > $tags_per_column): /* new column */ ?>
<? $column_tag_count = 0 ?>
</td>
<td>
<? endif ?>
<strong><?= html::clean($current_letter) ?></strong>
<ul>
<? endif ?>
<li>
<span class="g-editable g-tag-name" rel="<?= $tag->id ?>"><a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a></span>
<span class="g-understate">(<?= $tag->count ?>)</span>
</li>
<? $column_tag_count++ ?>
<? $last_letter = $current_letter ?>
<? endforeach ?>
</ul>
</td>
</tr>
</table>
</div>
</div>