Skip to content
Browse files

New module: all_tags not in GIT before

  • Loading branch information...
1 parent ca9b69c commit 41135b6b2b4405b2c7f2cd717adb376860380465 @floridave floridave committed May 10, 2011
View
56 3.0/modules/all_tags/controllers/all_tags.php
@@ -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
2 3.0/modules/all_tags/css/all_tags.css
@@ -0,0 +1,2 @@
+table.all_tags { text-align: center; width:500px; }
+table.all_tags caption { font-size: 1.5em; padding: 0.2em; }
View
29 3.0/modules/all_tags/helpers/all_tags_event.php
@@ -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
24 3.0/modules/all_tags/helpers/all_tags_theme.php
@@ -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
7 3.0/modules/all_tags/module.info
@@ -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
44 3.0/modules/all_tags/views/all_tags.html.php
@@ -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>

0 comments on commit 41135b6

Please sign in to comment.
Something went wrong with that request. Please try again.