[vhffs-dev] [1841] No more HTML::Template in tag/request/list. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1841
Author: beuss
Date: 2011-06-02 23:08:56 +0200 (Thu, 02 Jun 2011)
Log Message:
-----------
No more HTML::Template in tag/request/list.
Modified Paths:
--------------
trunk/vhffs-panel/admin/tag/request/list.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/admin/tag/request/list.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/admin/tag/request/list.tmpl
Modified: trunk/vhffs-panel/admin/tag/request/list.pl
===================================================================
--- trunk/vhffs-panel/admin/tag/request/list.pl 2011-06-02 21:08:48 UTC (rev 1840)
+++ trunk/vhffs-panel/admin/tag/request/list.pl 2011-06-02 21:08:56 UTC (rev 1841)
@@ -32,8 +32,6 @@
use utf8;
use POSIX qw(locale_h);
-use DateTime;
-use DateTime::Locale;
use locale;
use Locale::gettext;
use CGI;
@@ -43,42 +41,13 @@
use lib '%VHFFS_LIB_DIR%';
use Vhffs::Main;
-use Vhffs::ObjectFactory;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Template;
+use Vhffs::Panel::Modo;
use Vhffs::Tag::Request;
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
-my $templatedir = $panel->{'templatedir'};
+my $panel = new Vhffs::Panel::Modo();
-$panel->check_modo;
-
-my $template = new Vhffs::Panel::Template( filename => $templatedir.'/panel/admin/tag/request/list.tmpl', die_on_bad_params => 0 );
-# HTML::Template is wonderfull, I love to loop three
-# times over the same array.
-my $user = $panel->{user};
-my $loc = DateTime::Locale->load($user->get_lang);
-
my $requests = Vhffs::Tag::Request::get_all($panel->{vhffs});
-foreach my $r (@$requests) {
- if(defined $r->get_requester) {
- $r->{user} = $r->get_requester->get_username ;
- } else {
- $r->{user} = gettext('DELETED');
- }
+$panel->render('admin/tag/request/list.tt', {
+ requests => $requests
+});
- if(defined $r->get_tagged) {
- $r->{object} = $r->get_tagged->get_label;
- } else {
- $r->{object} = gettext('DELETED');
- }
- my $dt = DateTime->from_epoch( epoch => $r->{created}, locale => $user->get_lang);
- $r->{created} = $dt->strftime($loc->medium_date_format().' '.$loc->long_time_format());
-}
-$template->param('REQUESTS' => $requests);
-
-$panel->build($template);
-$panel->display;
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-06-02 21:08:48 UTC (rev 1840)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-06-02 21:08:56 UTC (rev 1841)
@@ -5,7 +5,6 @@
admin/main/main.tmpl \
admin/misc/list.tmpl \
admin/object/search.tmpl \
- admin/tag/request/list.tmpl \
menu/context.tmpl \
menu/context-group.tmpl \
menu/context-modo.tmpl \
@@ -40,6 +39,7 @@
admin/tag/edit.tt \
admin/tag/list.tt \
admin/tag/request/details.tt \
+ admin/tag/request/list.tt \
admin/user/list.tt \
anonymous/account_created.tt \
anonymous/login.tt \
Deleted: trunk/vhffs-panel/templates/admin/tag/request/list.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/request/list.tmpl 2011-06-02 21:08:48 UTC (rev 1840)
+++ trunk/vhffs-panel/templates/admin/tag/request/list.tmpl 2011-06-02 21:08:56 UTC (rev 1841)
@@ -1,28 +0,0 @@
-<h2><TMPL_I18N KEY="Tag Requests"></h2>
-<TMPL_IF NAME="REQUESTS">
-<table border="1">
-<thead>
-<tr>
- <th><TMPL_I18N KEY="Category"></th>
- <th><TMPL_I18N KEY="Tag"></th>
- <th><TMPL_I18N KEY="Requester"></th>
- <th><TMPL_I18N KEY="On object"></th>
- <th><TMPL_I18N KEY="Date"></th>
-</tr>
-</thead>
-<tbody>
-<TMPL_LOOP NAME="REQUESTS">
-<tr>
- <td><a href="/admin/tag/request/details.pl?request_id=<TMPL_VAR NAME="request_id">">
- <TMPL_VAR NAME="category_label"></a></td>
- <td><TMPL_VAR NAME="tag_label"></td>
- <td><TMPL_VAR NAME="user"></td>
- <td><TMPL_VAR NAME="object"></td>
- <td><TMPL_VAR NAME="created"></td>
-</tr>
-</TMPL_LOOP>
-</tbody>
-</table>
-<TMPL_ELSE>
-<p class="info"><TMPL_I18N KEY="No tag requests waiting"></p>
-</TMPL_IF>
\ No newline at end of file
Added: trunk/vhffs-panel/templates/admin/tag/request/list.tt
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/request/list.tt (rev 0)
+++ trunk/vhffs-panel/templates/admin/tag/request/list.tt 2011-06-02 21:08:56 UTC (rev 1841)
@@ -0,0 +1,29 @@
+[% USE date %]
+<h2>[% 'Tag Requests' | i18n | html %]</h2>
+[% IF requests.size() %]
+<table border="1">
+ <thead>
+ <tr>
+ <th>[% 'Category label' | i18n | html %]</th>
+ <th>[% 'Tag label' | i18n | html %]</th>
+ <th>[% 'Requester' | i18n | html %]</th>
+ <th>[% 'On object' | i18n | html %]</th>
+ <th>[% 'Date' | i18n | html %]</th>
+ </tr>
+ </thead>
+ <tbody>
+[% FOREACH r IN requests %]
+<tr>
+ <td><a href="/admin/tag/request/details.pl?request_id=[% r.request_id %]">
+ [% r.category_label | i18n | html %]</a></td>
+ <td>[% r.tag_label | i18n | html %]</td>
+ <td>[% (r.get_requester ? r.get_requester.get_username : 'DELETED') | html %]</td>
+ <td>[% (r.get_tagged ? r.get_tagged.get_label : 'DELETED') | html %]</td>
+ <td>[% date.format(r.created, '%x') %]</td>
+</tr>
+[% END %]
+</tbody>
+</table>
+[% ELSE %]
+<p class="info">[% 'No waiting tag requests.' | i18n | html %]</p>
+[% END %]