[vhffs-dev] [1836] No more HTML::Template in tag/category/create

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1836
Author:   beuss
Date:     2011-05-31 22:05:04 +0200 (Tue, 31 May 2011)
Log Message:
-----------
No more HTML::Template in tag/category/create

Modified Paths:
--------------
    trunk/vhffs-panel/admin/tag/category/create.pl
    trunk/vhffs-panel/templates/Makefile.am

Added Paths:
-----------
    trunk/vhffs-panel/templates/admin/tag/category/create.tt

Removed Paths:
-------------
    trunk/vhffs-panel/templates/admin/tag/category/create.tmpl

Modified: trunk/vhffs-panel/admin/tag/category/create.pl
===================================================================
--- trunk/vhffs-panel/admin/tag/category/create.pl	2011-05-31 20:04:56 UTC (rev 1835)
+++ trunk/vhffs-panel/admin/tag/category/create.pl	2011-05-31 20:05:04 UTC (rev 1836)
@@ -38,53 +38,40 @@
 
 
 use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Panel::Main;
-use Vhffs::Panel::Admin;
-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 $vars = {};
 
 if(defined $cgi->param('create_tag_category_submit')) {
 	if(create()) {
 		$panel->redirect('/admin/tag/index.pl?msg='.gettext('Tag category successfully created'));
-		exit(0);
 	}
 }
 
-my $templatedir = $panel->{templatedir};
 
-my $template = new Vhffs::Panel::Template(filename => $templatedir.'/panel/admin/tag/category/create.tmpl');
-
 $panel->set_title(gettext('Create Tag Category'));
+$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') }
+];
 
-$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( CREATE_TEXT => gettext('Create') );
+$panel->render('admin/tag/category/create.tt', $vars);
 
-$panel->build( $template );
-$panel->display;
-
-
 sub create {
 	my $vhffs = $panel->{vhffs};
 	my $label = $cgi->param('label');
 	my $description = $cgi->param('description');
 	my $visibility = $cgi->param('visibility');
+
+    $vars->{label} = $label;
+    $vars->{description} = $description;
+    $vars->{visibility} = $visibility;
 	
 	if(!(defined $label && defined $description && defined $visibility)) {
 		$panel->add_error( gettext('CGI error') );
@@ -101,4 +88,4 @@
 		return 0;
 	}
 	return 1;
-}
\ No newline at end of file
+}

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-31 20:04:56 UTC (rev 1835)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-31 20:05:04 UTC (rev 1836)
@@ -5,7 +5,6 @@
 	admin/main/main.tmpl \
 	admin/misc/list.tmpl \
 	admin/object/search.tmpl \
-	admin/tag/category/create.tmpl \
 	admin/tag/category/edit.tmpl \
 	admin/tag/category/list.tmpl \
 	admin/tag/request/details.tmpl \
@@ -37,6 +36,7 @@
 	admin/moderation/index.tt \
 	admin/object/edit.tt \
 	admin/object/list.tt \
+	admin/tag/category/create.tt \
 	admin/tag/create.tt \
 	admin/tag/edit.tt \
 	admin/tag/list.tt \

Deleted: trunk/vhffs-panel/templates/admin/tag/category/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/category/create.tmpl	2011-05-31 20:04:56 UTC (rev 1835)
+++ trunk/vhffs-panel/templates/admin/tag/category/create.tmpl	2011-05-31 20:05:04 UTC (rev 1836)
@@ -1,16 +0,0 @@
-<form name="createTagCategory" accept-charset="utf-8" method="post">
-<p><label for="label"><TMPL_VAR NAME="LABEL_TEXT"></label>
-	<input type="text" name="label" id="label" value="<TMPL_VAR NAME="LABEL_VALUE">"/></p>
-<p><label for="description"><TMPL_VAR NAME="DESCRIPTION_TEXT"></label>
-	<textarea name="description" id="description"></textarea></p>
-<p><label for="visibility"><TMPL_VAR NAME="VISIBILITY_TEXT"></label>
-<select name="visibility" id="visibility">
-<TMPL_LOOP NAME="VISIBILITIES">
-<option value="<TMPL_VAR NAME="CODE">"><TMPL_VAR NAME="LABEL"></option>
-</TMPL_LOOP>
-</select>
-</p>
-<p class="button">
-	<input type="submit" name="create_tag_category_submit" value="<TMPL_VAR NAME="CREATE_TEXT">"/>
-</p> 
-</form>
\ No newline at end of file

Added: trunk/vhffs-panel/templates/admin/tag/category/create.tt
===================================================================
--- trunk/vhffs-panel/templates/admin/tag/category/create.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/admin/tag/category/create.tt	2011-05-31 20:05:04 UTC (rev 1836)
@@ -0,0 +1,16 @@
+<form name="createTagCategory" accept-charset="utf-8" method="post">
+<p><label for="label">[% 'Label:' | i18n | html %]</label>
+	<input type="text" name="label" id="label" value="[% label | html %]"/></p>
+<p><label for="description">[% 'Description:' | i18n | html %]</label>
+	<textarea name="description" id="description">[% 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 == visibility %]>[% v.label | html %]</option>
+[% END %]
+</select>
+</p>
+<p class="button">
+	<input type="submit" name="create_tag_category_submit" value="[% 'Create' | i18n | html %]"/>
+</p> 
+</form>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/