[vhffs-dev] [1699] No more HTML::Template in group index. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1699
Author: beuss
Date: 2011-05-09 22:54:02 +0200 (Mon, 09 May 2011)
Log Message:
-----------
No more HTML::Template in group index.
Modified Paths:
--------------
trunk/vhffs-panel/group/index.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/group/index.tt
Removed Paths:
-------------
trunk/vhffs-panel/templates/group/index.tmpl
Modified: trunk/vhffs-panel/group/index.pl
===================================================================
--- trunk/vhffs-panel/group/index.pl 2011-05-09 20:42:44 UTC (rev 1698)
+++ trunk/vhffs-panel/group/index.pl 2011-05-09 20:54:02 UTC (rev 1699)
@@ -46,23 +46,11 @@
my $session = $panel->get_session;
exit 0 unless $session;
-my $cgi = $panel->{cgi};
-my $vhffs = $panel->{vhffs};
my $user = $panel->{user};
-my $templatedir = $panel->{templatedir};
$panel->set_title( gettext('My Projects') );
-my $template = new HTML::Template( filename => $templatedir.'/panel/group/index.tmpl', global_vars => 1);
-my $groups = Vhffs::Panel::User::get_groups($user, $Vhffs::Panel::User::RELATION_OWNER);
-$template->param( OWNED_PROJECTS => $groups );
-$groups = Vhffs::Panel::User::get_groups($user, $Vhffs::Panel::User::RELATION_CONTRIB);
-$template->param( CONTRIBUTED_PROJECTS => $groups );
-$template->param( OWNED_PROJECTS_TEXT => gettext('Your projects') );
-$template->param( CONTRIBUTED_PROJECTS_TEXT => gettext('Projects you contribute to') );
-$template->param( NEW_PROJECT_TEXT => gettext('Create new project') );
-$template->param( RESUBMIT_TEXT => gettext('Propose a new description') );
-$template->param( DELETE_TEXT => gettext('Delete') );
-
-$panel->build( $template );
-$panel->display;
+$panel->render('group/index.tt', {
+ owned_projects => Vhffs::Panel::User::get_groups($user, $Vhffs::Panel::User::RELATION_OWNER),
+ contributed_projects => Vhffs::Panel::User::get_groups($user, $Vhffs::Panel::User::RELATION_CONTRIB)
+});
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-09 20:42:44 UTC (rev 1698)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-09 20:54:02 UTC (rev 1699)
@@ -77,7 +77,6 @@
group/prefs_avatar.tmpl \
group/history.tmpl \
group/history_part.tmpl \
- group/index.tmpl \
group/tags.tmpl \
mail/create.tmpl \
mailinglist/create.tmpl \
@@ -137,6 +136,7 @@
anonymous/lost-password-ack.tt \
anonymous/subscribe.tt \
group/create.tt \
+ group/index.tt \
layouts/anonymous.tt \
layouts/panel.tt \
menu/admin.tt \
Deleted: trunk/vhffs-panel/templates/group/index.tmpl
===================================================================
--- trunk/vhffs-panel/templates/group/index.tmpl 2011-05-09 20:42:44 UTC (rev 1698)
+++ trunk/vhffs-panel/templates/group/index.tmpl 2011-05-09 20:54:02 UTC (rev 1699)
@@ -1,38 +0,0 @@
-<TMPL_IF NAME="OWNED_PROJECTS">
-<div id="ownedProjects">
-<h2><TMPL_VAR ESCAPE=1 NAME="OWNED_PROJECTS_TEXT"></h2>
-<ul>
-<TMPL_LOOP NAME="OWNED_PROJECTS">
-<TMPL_IF NAME="ACTIVE">
- <li><a href="/group/view.pl?group=<TMPL_VAR ESCAPE=1 NAME="GROUPNAME">"><TMPL_VAR ESCAPE=1 NAME="GROUPNAME"></a></li>
-<tmpl_else>
- <li><TMPL_VAR ESCAPE=1 NAME="GROUPNAME"> — <TMPL_VAR ESCAPE=1 NAME="STATE">
- <TMPL_IF NAME="REFUSED">
- - <a href="/object/resubmit.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OID">"><TMPL_VAR ESCAPE=1 NAME="RESUBMIT_TEXT"></a>
- - <a href="/object/quickdelete.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OID">"><TMPL_VAR ESCAPE=1 NAME="DELETE_TEXT"></a>
- </TMPL_IF>
- </li>
-</TMPL_IF>
-</TMPL_LOOP>
-</ul>
-</div>
-</TMPL_IF>
-<TMPL_IF NAME="CONTRIBUTED_PROJECTS">
-<div id="contribProjects">
-<h2><TMPL_VAR ESCAPE=1 NAME="CONTRIBUTED_PROJECTS_TEXT"></h2>
-<ul>
-<TMPL_LOOP NAME="CONTRIBUTED_PROJECTS">
-<TMPL_IF NAME="ACTIVE">
- <li><a href="/group/view.pl?group=<TMPL_VAR ESCAPE=1 NAME="GROUPNAME">"><TMPL_VAR ESCAPE=1 NAME="GROUPNAME"></a></li>
-<tmpl_else>
- <li><TMPL_VAR ESCAPE=1 NAME="GROUPNAME"> — <TMPL_VAR ESCAPE=1 NAME="STATE"></li>
- <TMPL_IF NAME="REFUSED">
- - <a href="/object/resubmit.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OID">"><TMPL_VAR ESCAPE=1 NAME="RESUBMIT_TEXT"></a>
- - <a href="/object/quickdelete.pl?oid=<TMPL_VAR ESCAPE=1 NAME="OID">"><TMPL_VAR ESCAPE=1 NAME="DELETE_TEXT"></a>
- </TMPL_IF>
-</TMPL_IF>
-</TMPL_LOOP>
-</ul>
-</div>
-</TMPL_IF>
-<a href="/group/create.pl"><TMPL_VAR ESCAPE=1 NAME="NEW_PROJECT_TEXT"></a>
Added: trunk/vhffs-panel/templates/group/index.tt
===================================================================
--- trunk/vhffs-panel/templates/group/index.tt (rev 0)
+++ trunk/vhffs-panel/templates/group/index.tt 2011-05-09 20:54:02 UTC (rev 1699)
@@ -0,0 +1,39 @@
+[% IF owned_projects.size() %]
+<div id="ownedProjects">
+<h2>[% 'Your projects' | i18n | html %]</h2>
+<ul>
+[% FOR p IN owned_projects %]
+[% IF p.active %]
+ <li><a href="/group/view.pl?group=[% p.groupname | html %]">[% p.groupname | html %]</a></li>
+[% ELSE %]
+ <li>[% p.groupname | html %] — [% p.state | html %]
+ [% IF p.refused %]
+ - <a href="/object/resubmit.pl?oid=[% p.oid %]">[% 'Propose a new description' | i18n | html %]</a>
+ - <a href="/object/quickdelete.pl?oid=[% p.oid %]">[% 'Delete' | i18n | html %]</a>
+ [% END %]
+ </li>
+[% END %]
+[% END %]
+</ul>
+</div>
+[% END %]
+[% IF contributed_projects %]
+<div id="contribProjects">
+<h2>[% 'Projects you contribute to' | i18n | html %]</h2>
+<ul>
+[% FOR p IN contributed_projects %]
+[% IF p.active %]
+ <li><a href="/group/view.pl?group=[% p.groupname | html %]">[% p.groupname | html %]</a></li>
+[% ELSE %]
+ <li>[% p.groupname | html %] — [% p.state | html %]
+ [% IF p.refused %]
+ - <a href="/object/resubmit.pl?oid=[% p.oid %]">[% 'Propose a new description' | i18n | html %]</a>
+ - <a href="/object/quickdelete.pl?oid=[% p.oid %]">[% 'Delete' | i18n | html %]</a>
+ [% END %]
+ </li>
+[% END %]
+[% END %]
+</ul>
+</div>
+[% END %]
+<a href="/group/create.pl">[% 'Create new project' | i18n | html %]</a>