[vhffs-dev] [1834] No more HTML::Template in tag/edit |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1834
Author: beuss
Date: 2011-05-31 22:04:45 +0200 (Tue, 31 May 2011)
Log Message:
-----------
No more HTML::Template in tag/edit
Modified Paths:
--------------
trunk/vhffs-panel/admin/tag/edit.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/admin/tag/edit.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/admin/tag/edit.tmpl
Modified: trunk/vhffs-panel/admin/tag/edit.pl
===================================================================
--- trunk/vhffs-panel/admin/tag/edit.pl 2011-05-31 20:04:33 UTC (rev 1833)
+++ trunk/vhffs-panel/admin/tag/edit.pl 2011-05-31 20:04:45 UTC (rev 1834)
@@ -32,38 +32,26 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use strict;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Admin;
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Template;
+use Vhffs::Panel::Modo;
use Vhffs::Tag;
-my $panel = new Vhffs::Panel::Main();
-exit 0 unless $panel;
-my $session = $panel->get_session;
-exit 0 unless $session;
+my $panel = new Vhffs::Panel::Modo();
-$panel->check_modo;
-
my $cgi = $panel->{cgi};
my $tag;
-my $template;
-my $templatedir = $panel->{templatedir};
my $vhffs = $panel->{vhffs};
my $user = $panel->{user};
if(!defined $cgi->param('tag_id')) {
- $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
- $template->param( MESSAGE => gettext('CGI Error!') );
+ $panel->render('misc/message.tt', { message => gettext('CGI Error!') } );
} elsif(!defined($tag = Vhffs::Tag::get_by_tag_id($panel->{vhffs}, $cgi->param('tag_id')))) {
- $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
- $template->param( MESSAGE => gettext('Tag not found!') );
+ $panel->render('misc/message.tt', { message => gettext('Tag not found!') } );
} else {
if(defined $cgi->param('update_tag_submit')) {
if(update()) {
@@ -73,21 +61,13 @@
}
}
- $template = new Vhffs::Panel::Template(filename => $templatedir.'/panel/admin/tag/edit.tmpl', die_on_bad_params => 0);
-
- $panel->set_title(gettext('Update Tag'));
-
- $template->param( LABEL_VALUE => $tag->{label} );
- $template->param( DESCRIPTION_VALUE => $tag->{description} );
- $template->param( CATEGORY_ID_VALUE => $tag->{category_id} );
- $template->param( CATEGORIES => Vhffs::Tag::Category::get_all($vhffs) );
- $template->param( TAG_ID => $tag->{tag_id} );
-
+ my $vars = {
+ tag => $tag,
+ categories => Vhffs::Tag::Category::get_all($vhffs)
+ };
+ $panel->render('admin/tag/edit.tt', $vars);
}
-$panel->build( $template );
-$panel->display;
-
sub update {
my $tag_id = $cgi->param('tag_id');
my $label = $cgi->param('label');
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-31 20:04:33 UTC (rev 1833)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-31 20:04:45 UTC (rev 1834)
@@ -5,7 +5,6 @@
admin/main/main.tmpl \
admin/misc/list.tmpl \
admin/object/search.tmpl \
- admin/tag/edit.tmpl \
admin/tag/list.tmpl \
admin/tag/category/create.tmpl \
admin/tag/category/edit.tmpl \
@@ -40,6 +39,7 @@
admin/object/edit.tt \
admin/object/list.tt \
admin/tag/create.tt \
+ admin/tag/edit.tt \
admin/user/list.tt \
anonymous/account_created.tt \
anonymous/login.tt \
Deleted: trunk/vhffs-panel/templates/admin/tag/edit.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/edit.tmpl 2011-05-31 20:04:33 UTC (rev 1833)
+++ trunk/vhffs-panel/templates/admin/tag/edit.tmpl 2011-05-31 20:04:45 UTC (rev 1834)
@@ -1,19 +0,0 @@
-<form name="updateTag" accept-charset="utf-8" method="post" action="#">
-<p><label for="category"><TMPL_I18N KEY="Category"></label>
-<select name="category_id" id="category">
-<TMPL_LOOP NAME="CATEGORIES">
-<option value="<TMPL_VAR NAME="CATEGORY_ID">"
-<TMPL_IF EXPR="CATEGORY_ID_VALUE==CATEGORY_ID">selected="selected"</TMPL_IF>>
-<TMPL_VAR NAME="LABEL"></option>
-</TMPL_LOOP>
-</select>
-</p>
-<p><label for="label"><TMPL_I18N KEY="Label"></label>
- <input type="text" name="label" id="label" value="<TMPL_VAR NAME="LABEL_VALUE">"/></p>
-<p><label for="description"><TMPL_I18N KEY="Description"></label>
- <textarea name="description" id="description"><TMPL_VAR NAME="DESCRIPTION_VALUE"></textarea></p>
-<p class="button">
- <input type="hidden" name="tag_id" value="<TMPL_VAR NAME="TAG_ID">"/>
- <input type="submit" name="update_tag_submit" value="<TMPL_I18N KEY="Update">"/>
-</p>
-</form>
\ No newline at end of file
Added: trunk/vhffs-panel/templates/admin/tag/edit.tt
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/edit.tt (rev 0)
+++ trunk/vhffs-panel/templates/admin/tag/edit.tt 2011-05-31 20:04:45 UTC (rev 1834)
@@ -0,0 +1,18 @@
+<form name="updateTag" accept-charset="utf-8" method="post" action="#">
+<p><label for="category">[% 'Category:' | i18n | html %]</label>
+<select name="category_id" id="category">
+[% FOREACH c IN categories %]
+<option value="[% c.category_id %]"[% ' selected="selected"' IF c.category_id == tag.category_id %]>
+ [% c.label | html %]</option>
+[% END %]
+</select>
+</p>
+<p><label for="label">[% 'Label:' | i18n | html %]</label>
+ <input type="text" name="label" id="label" value="[% tag.label | html %]"/></p>
+<p><label for="description">[% 'Description:' | i18n | html %]</label>
+ <textarea name="description" id="description">[% tag.description | html %]</textarea></p>
+<p class="button">
+ <input type="hidden" name="tag_id" value="[% tag.tag_id %]"/>
+ <input type="submit" name="update_tag_submit" value="[% 'Update' | i18n | html %]"/>
+</p>
+</form>