[vhffs-dev] [1837] No more HTML::Template in tag/category/edit |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1837
Author: beuss
Date: 2011-05-31 22:05:15 +0200 (Tue, 31 May 2011)
Log Message:
-----------
No more HTML::Template in tag/category/edit
Modified Paths:
--------------
trunk/vhffs-panel/admin/tag/category/edit.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/admin/tag/category/edit.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/admin/tag/category/edit.tmpl
Modified: trunk/vhffs-panel/admin/tag/category/edit.pl
===================================================================
--- trunk/vhffs-panel/admin/tag/category/edit.pl 2011-05-31 20:05:04 UTC (rev 1836)
+++ trunk/vhffs-panel/admin/tag/category/edit.pl 2011-05-31 20:05:15 UTC (rev 1837)
@@ -32,37 +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::Category;
-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 $category;
-my $template;
-my $templatedir = $panel->{templatedir};
my $user = $panel->{user};
+my $vars = {};
if(!defined $cgi->param('category_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($category = Vhffs::Tag::Category::get_by_category_id($panel->{vhffs}, $cgi->param('category_id')))) {
- $template = new HTML::Template( filename => $templatedir.'/panel/misc/simplemsg.tmpl' );
- $template->param( MESSAGE => gettext('Category not found!') );
+ $panel->render('misc/message.tt', { message => gettext('Category not found!') } );
} else {
if(defined $cgi->param('update_tag_category_submit')) {
if(update()) {
@@ -71,31 +60,18 @@
$panel->add_error( gettext('Unable to update category') )
}
}
-
- $template = new Vhffs::Panel::Template(filename => $templatedir.'/panel/admin/tag/category/edit.tmpl');
-
+
$panel->set_title(gettext('Update Tag Category'));
-
- $template->param( LABEL_TEXT => gettext('Label') );
- $template->param( DESCRIPTION_TEXT => gettext('Description') );
- $template->param( VISIBILITY_TEXT => gettext('Visibility') );
- $template->param( VISIBILITIES => [
- { CODE => Vhffs::Constants::TAG_VISIBILITY_GROUP_CREATION, LABEL => gettext('Public (available on group creation)') },
- { CODE => Vhffs::Constants::TAG_VISIBILITY_PUBLIC, LABEL => gettext('Public') },
- { CODE => Vhffs::Constants::TAG_VISIBILITY_MODERATORS, LABEL => gettext('Moderators') },
- { CODE => Vhffs::Constants::TAG_VISIBILITY_ADMINS, LABEL => gettext('Administrators') }
- ]);
- $template->param( UPDATE_TEXT => gettext('Update') );
- $template->param( LABEL_VALUE => $category->{label} );
- $template->param( DESCRIPTION_VALUE => $category->{description} );
- $template->param( VISIBILITY_VALUE => $category->{visibility} );
- $template->param( CATEGORY_ID_VALUE => $category->{category_id} );
-
+ $vars->{visibilities} = [
+ { code => Vhffs::Constants::TAG_VISIBILITY_GROUP_CREATION, label => gettext('Public (available on group creation)') },
+ { code => Vhffs::Constants::TAG_VISIBILITY_PUBLIC, label => gettext('Public') },
+ { code => Vhffs::Constants::TAG_VISIBILITY_MODERATORS, label => gettext('Moderators') },
+ { code => Vhffs::Constants::TAG_VISIBILITY_ADMINS, label => gettext('Administrators') }
+ ];
+ $vars->{category} = $category;
+ $panel->render('admin/tag/category/edit.tt', $vars);
}
-$panel->build( $template );
-$panel->display;
-
sub update {
my $vhffs = $panel->{vhffs};
my $label = $cgi->param('label');
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-31 20:05:04 UTC (rev 1836)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-31 20:05:15 UTC (rev 1837)
@@ -5,7 +5,6 @@
admin/main/main.tmpl \
admin/misc/list.tmpl \
admin/object/search.tmpl \
- admin/tag/category/edit.tmpl \
admin/tag/category/list.tmpl \
admin/tag/request/details.tmpl \
admin/tag/request/list.tmpl \
@@ -37,6 +36,7 @@
admin/object/edit.tt \
admin/object/list.tt \
admin/tag/category/create.tt \
+ admin/tag/category/edit.tt \
admin/tag/create.tt \
admin/tag/edit.tt \
admin/tag/list.tt \
Deleted: trunk/vhffs-panel/templates/admin/tag/category/edit.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/category/edit.tmpl 2011-05-31 20:05:04 UTC (rev 1836)
+++ trunk/vhffs-panel/templates/admin/tag/category/edit.tmpl 2011-05-31 20:05:15 UTC (rev 1837)
@@ -1,19 +0,0 @@
-<form name="updateTagCategory" accept-charset="utf-8" method="post" action="#">
-<p><label for="label"><TMPL_VAR NAME="LABEL_TEXT"></label>
- <input type="text" name="label" id="label" value="<TMPL_VAR ESCAPE=1 NAME="LABEL_VALUE">"/></p>
-<p><label for="description"><TMPL_VAR NAME="DESCRIPTION_TEXT"></label>
- <textarea name="description" id="description"><TMPL_VAR NAME="DESCRIPTION_VALUE"></textarea></p>
-<p><label for="visibility"><TMPL_VAR NAME="VISIBILITY_TEXT" ESCAPE=1></label>
-<select name="visibility" id="visibility">
-<TMPL_LOOP NAME="VISIBILITIES">
-<option value="<TMPL_VAR NAME="CODE">"
- <TMPL_IF EXPR="visibility_value==CODE">selected="selected"</TMPL_IF>>
-<TMPL_VAR NAME="LABEL"></option>
-</TMPL_LOOP>
-</select>
-</p>
-<p class="button">
- <input type="hidden" name="category_id" value="<TMPL_VAR NAME="CATEGORY_ID_VALUE">"/>
- <input type="submit" name="update_tag_category_submit" value="<TMPL_VAR NAME="UPDATE_TEXT">"/>
-</p>
-</form>
Added: trunk/vhffs-panel/templates/admin/tag/category/edit.tt
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/category/edit.tt (rev 0)
+++ trunk/vhffs-panel/templates/admin/tag/category/edit.tt 2011-05-31 20:05:15 UTC (rev 1837)
@@ -0,0 +1,18 @@
+<form name="updateTagCategory" accept-charset="utf-8" method="post" action="#">
+<p><label for="label">[% 'Label:' | i18n | html %]</label>
+ <input type="text" name="label" id="label" value="[% category.label | html %]"/></p>
+<p><label for="description">[% 'Description:' | i18n | html %]</label>
+ <textarea name="description" id="description">[% category.description | html %]</textarea></p>
+<p><label for="visibility">[% 'Visibility:' | i18n | html %]</label>
+<select name="visibility" id="visibility">
+[% FOREACH v IN visibilities %]
+<option value="[% v.code %]"[% ' selected="selected"' IF v.code == category.visibility %]>
+ [% v.label | html %]</option>
+[% END %]
+</select>
+</p>
+<p class="button">
+ <input type="hidden" name="category_id" value="[% category.category_id %]"/>
+ <input type="submit" name="update_tag_category_submit" value="[% 'Update' | i18n | html %]"/>
+</p>
+</form>