[vhffs-dev] [1692] Get rid of HTML::Template on group creation.

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


Revision: 1692
Author:   beuss
Date:     2011-05-09 22:13:24 +0200 (Mon, 09 May 2011)
Log Message:
-----------
Get rid of HTML::Template on group creation.

Modified Paths:
--------------
    trunk/vhffs-panel/group/create.pl
    trunk/vhffs-panel/templates/Makefile.am

Added Paths:
-----------
    trunk/vhffs-panel/templates/group/create.tt

Removed Paths:
-------------
    trunk/vhffs-panel/templates/group/create.tmpl

Modified: trunk/vhffs-panel/group/create.pl
===================================================================
--- trunk/vhffs-panel/group/create.pl	2011-05-06 08:22:44 UTC (rev 1691)
+++ trunk/vhffs-panel/group/create.pl	2011-05-09 20:13:24 UTC (rev 1692)
@@ -93,20 +93,14 @@
 }
 
 if( ! $submitted || $panel->has_errors() ) {
-    my $template = new Vhffs::Panel::Template( filename => $templatedir.'/panel/group/create.tmpl', die_on_bad_params => 0, loop_context_vars => 1 );
+    my $vars = {};
+    $vars->{public_part_available} = $panel->is_public;
 
     $panel->set_title( gettext('Create a Project') );
-    $template->param( PROJECT_NAME => gettext('Project Name') );
-    $template->param( PROJECT_NAME_EXPLAIN => gettext('with only lowercase alphanumerical letters, no space, from 3 to 12 characters') );
-    $template->param( REALNAME_TEXT => gettext('Project full name') );
-    $template->param( TEXT_OWNER => gettext('Owner') );
-    $template->param( OWNER => $user->get_username );
-    $template->param( SEND => gettext('Send') );
-    $template->param( DESCRIPTION => gettext('Description') );
-    $template->param( WARNING_PUBLIC => gettext("Please consider that this description is going to be displayed in the public area. So you have to write it in impersonal form. You should take care to write it with correct grammar and tenses. Take all the time you need to fill it with the best content you are able to do.") ) if $panel->is_public;
-    $template->param( PROJECT_VALUE => $groupname );
-    $template->param( REALNAME_VALUE => $realname );
-    $template->param( DESCRIPTION_VALUE => $description );
+    $vars->{owner} = $user->get_username;
+    $vars->{groupname} = $groupname;
+    $vars->{realname} = $realname;
+    $vars->{description} = $description;
     
     my $categories =
 		Vhffs::Tag::Category::get_all($vhffs, Vhffs::Constants::TAG_VISIBILITY_GROUP_CREATION);
@@ -114,8 +108,7 @@
 		$c->{tags} = Vhffs::Tag::get_by_category_id($vhffs, $c->{category_id});
 	}
     
-    $template->param( TAG_CATEGORIES => $categories );
+    $vars->{tag_categories} = $categories;
 
-    $panel->build( $template );
-    $panel->display;
+    $panel->render('group/create.tt', $vars);
 }

Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am	2011-05-06 08:22:44 UTC (rev 1691)
+++ trunk/vhffs-panel/templates/Makefile.am	2011-05-09 20:13:24 UTC (rev 1692)
@@ -71,7 +71,6 @@
 	dns/prefs.tmpl \
 	group/add_user.tmpl \
 	group/admin.tmpl \
-	group/create.tmpl \
 	group/info.tmpl \
 	group/list_user.tmpl \
 	group/prefs.tmpl \
@@ -137,6 +136,7 @@
 	anonymous/lost-password.tt \
 	anonymous/lost-password-ack.tt \
 	anonymous/subscribe.tt \
+	group/create.tt \
 	layouts/anonymous.tt \
 	layouts/panel.tt \
 	menu/admin.tt \

Deleted: trunk/vhffs-panel/templates/group/create.tmpl
===================================================================
--- trunk/vhffs-panel/templates/group/create.tmpl	2011-05-06 08:22:44 UTC (rev 1691)
+++ trunk/vhffs-panel/templates/group/create.tmpl	2011-05-09 20:13:24 UTC (rev 1692)
@@ -1,51 +0,0 @@
-<form method="post" action="#" accept-charset="utf-8">
-	<p>
-		<label>
-			<TMPL_VAR ESCAPE=1 NAME="TEXT_OWNER">:
-		</label>
-		<TMPL_VAR ESCAPE=1 NAME="OWNER">
-	</p>
-	<p>
-		<label for="project_name">
-			<TMPL_VAR ESCAPE=1 NAME="PROJECT_NAME">: 
-		</label>
-		<input type="text" size="12" maxlength="12" name="project_name" id="project_name" value="<TMPL_VAR ESCAPE=1 NAME="PROJECT_VALUE">"/>
-		<TMPL_VAR ESCAPE=1 NAME="PROJECT_NAME_EXPLAIN">
-	</p>
-	<p>
-		<label for="realname">
-			<TMPL_VAR ESCAPE=1 NAME="REALNAME_TEXT">: 
-		</label>
-		<input type="text" size="30" maxlength="100" name="realname" id="realname" value="<TMPL_VAR ESCAPE=1 NAME="REALNAME_VALUE">"/>
-	</p>
-	<p>
-		<label for="description">
-			<TMPL_VAR ESCAPE=1 NAME="DESCRIPTION">:
-		</label>
-		<textarea name="description" id="description" cols="45" rows="7"><TMPL_VAR ESCAPE=1 NAME="DESCRIPTION_VALUE"></textarea>
-	</p>
-	<TMPL_IF NAME="WARNING_PUBLIC">
-	<p>
-		<TMPL_VAR ESCAPE=1 NAME="WARNING_PUBLIC">
-	</p>
-	</TMPL_IF>
-	<TMPL_IF NAME="TAG_CATEGORIES">
-	<p class="info">
-		<TMPL_I18N KEY="You can chose some tags to be applied to your group right now. More tags will be available in your project's preferences once it is created">
-	</p>
-	<ul>
-	<TMPL_LOOP NAME="TAG_CATEGORIES">
-		<li><TMPL_VAR NAME="LABEL">:
-		<TMPL_LOOP NAME="TAGS">
-			<input type="checkbox" name="tags" value="<TMPL_VAR NAME="TAG_ID">" id="tag_<TMPL_VAR NAME="TAG_ID">"/>&nbsp;<label class="checkbox" for="tag_<TMPL_VAR NAME="TAG_ID">"><TMPL_VAR NAME="LABEL"></label><TMPL_UNLESS NAME="__LAST__">,</TMPL_UNLESS>
-		</TMPL_LOOP>
-		<TMPL_UNLESS NAME="__LAST__">;</TMPL_UNLESS>
-		<TMPL_IF NAME="__LAST__">.</TMPL_IF>
-		</li>
-	</TMPL_LOOP>
-	</ul>
-	</TMPL_IF>
-	<p class="button"  id="buttonSend">
-		<input type="submit" value="<TMPL_VAR ESCAPE=1 NAME="SEND">" name="project_submit"/>
-	</p>
-</form>

Added: trunk/vhffs-panel/templates/group/create.tt
===================================================================
--- trunk/vhffs-panel/templates/group/create.tt	                        (rev 0)
+++ trunk/vhffs-panel/templates/group/create.tt	2011-05-09 20:13:24 UTC (rev 1692)
@@ -0,0 +1,43 @@
+<form method="post" action="#" accept-charset="utf-8">
+	<p>
+		<label>[% 'Owner:' | i18n | html %]
+		</label>
+        [% owner | i18n | html %]
+	</p>
+	<p>
+		<label for="project_name">[% 'Project name:' | i18n | html %]</label>
+		<input type="text" size="12" maxlength="12" name="project_name" id="project_name" value="[% groupname | html %]"/>
+		[% 'only lowercase alphanumerical letters, no space, from 3 to 12 characters' | i18n | html %]
+	</p>
+	<p>
+		<label for="realname">[% 'Project full name:' | i18n | html %]</label>
+		<input type="text" size="30" maxlength="100" name="realname" id="realname" value="[% realname | html %]"/>
+	</p>
+	<p>
+		<label for="description">[% 'Description:' | i18n | html %]</label>
+		<textarea name="description" id="description" cols="45" rows="7">[% description | html %]</textarea>
+	</p>
+[% IF public_part_available %]
+	<p>
+        [% 'Please consider that this description is going to be displayed in the public area. So you have to write it in impersonal form. You should take care to write it with correct grammar and tenses. Take all the time you need to fill it with the best content you are able to do.' | i18n | html %]
+	</p>
+[% END %]
+[% IF tag_categories.size() %]
+	<p class="info">
+        [% 'You can chose some tags to be applied to your group right now. More tags will be available in your project\'s preferences once it is created.' | i18n %]
+	</p>
+	<ul>
+    [% FOREACH c IN tag_categories %]
+		<li>[% c.label %]:
+        [% FOREACH t IN c.tags %]
+			<input type="checkbox" name="tags" value="[% t.tag_id %]" id="tag_[% t.tag_id %]"/>&nbsp;<label class="checkbox" for="tag_[% t.tag_id %]">[% t.label | html %]</label>[% ', ' UNLESS loop.last() %]
+        [% END %]
+        [% loop.last() ? '.' : ';' %]
+		</li>
+    [% END %]
+	</ul>
+[% END %]
+	<p class="button"  id="buttonSend">
+		<input type="submit" value="[% 'Send' | i18n %]" name="project_submit"/>
+	</p>
+</form>


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