[vhffs-dev] [1683] Added missing piece for full Template::Toolkit. |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1683
Author: beuss
Date: 2011-05-01 16:26:00 +0200 (Sun, 01 May 2011)
Log Message:
-----------
Added missing piece for full Template::Toolkit.
Only anonymous panel was handled until now.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Conf.pm
trunk/vhffs-api/src/Vhffs/Panel/Main.pm
trunk/vhffs-intl/extra_strings.pl
trunk/vhffs-panel/templates/Makefile.am
Added Paths:
-----------
trunk/vhffs-panel/templates/layouts/panel.tt
trunk/vhffs-panel/templates/menu/admin.tt
trunk/vhffs-panel/templates/menu/context.tt
trunk/vhffs-panel/templates/menu/group.tt
trunk/vhffs-panel/templates/menu/moderator.tt
trunk/vhffs-panel/templates/misc/header.tt
Modified: trunk/vhffs-api/src/Vhffs/Conf.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Conf.pm 2011-05-01 14:25:51 UTC (rev 1682)
+++ trunk/vhffs-api/src/Vhffs/Conf.pm 2011-05-01 14:26:00 UTC (rev 1683)
@@ -130,6 +130,24 @@
return Vhffs::Functions::strtobool( $Config{'services'}{$service}{'activate'} );
}
+=head2 get_available_services
+
+Returns an hashref with one entry set to 1 if the associated
+service is available.
+
+=cut
+
+sub get_available_services
+{
+ my ($self) = @_;
+
+ my $result = {};
+ foreach(qw/web mysql pgsql cvs svn git mercurial bazaar dns repository mail mailinglist cron/) {
+ $result->{$_} = $self->get_service_availability($_);
+ }
+ return $result;
+}
+
sub get_listengine
{
return $Config{'listengine'};
Modified: trunk/vhffs-api/src/Vhffs/Panel/Main.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-01 14:25:51 UTC (rev 1682)
+++ trunk/vhffs-api/src/Vhffs/Panel/Main.pm 2011-05-01 14:26:00 UTC (rev 1683)
@@ -398,7 +398,7 @@
$menutemplate->param( TEXT_LOGOUT => gettext("Logout") );
$menutemplate->param( HELP_URL => $vhffs->get_config->get_panel->{'url_help'} || 'http://www.vhffs.org/' );
- # Current project stuff (TODO stop handle it in session)
+ # Current project stuff
if( ( CGI::url( -absolute => 1) =~ /^\/admin\// ) || defined $cgi->param('admin_menu')) {
if( $user->is_admin ) {
$menutemplate->param( CONTEXTUAL_MENU => Vhffs::Panel::Menu::generate_admin_ctxmenu( $vhffs->get_config ) );
@@ -772,10 +772,13 @@
$vars->{panel_url} = $conf->get_panel->{url};
$vars->{help_url} = $conf->get_panel->{url_help};
$vars->{title} = sprintf( gettext( '%s\'s Panel' ), $conf->get_host_name );
+ $vars->{page_title} = $self->{title};
my @langs = $self->{vhffs}->get_config->get_available_languages;
$vars->{languages} = \@langs;
$vars->{errors} = $self->{errors};
$vars->{infos} = $self->{infos};
+ $vars->{current_user} = $self->{user};
+ $vars->{current_group} = ( defined $self->{cgi}->param('group') ? Vhffs::Group::get_by_groupname( $self->{vhffs} , $self->{cgi}->param('group') ) : undef );
# Handling ajax stuff
if($self->{is_ajax_request}) {
@@ -785,6 +788,11 @@
$create_vars->{PROCESS} = "layouts/$layout";
} else {
$create_vars->{PROCESS} = 'layouts/panel.tt';
+ $vars->{panel_header} = {
+ help_url => $conf->get_panel->{'url_help'} || 'http://www.vhffs.org/',
+ admin_menu => (( CGI::url( -absolute => 1) =~ /^\/admin\// ) || defined $self->{cgi}->param('admin_menu')),
+ available_services => $conf->get_available_services
+ };
}
}
Modified: trunk/vhffs-intl/extra_strings.pl
===================================================================
--- trunk/vhffs-intl/extra_strings.pl 2011-05-01 14:25:51 UTC (rev 1682)
+++ trunk/vhffs-intl/extra_strings.pl 2011-05-01 14:26:00 UTC (rev 1683)
@@ -49,3 +49,8 @@
gettext_noop('Public');
gettext_noop('Moderators');
gettext_noop('Administrators');
+
+# Account types
+gettext_noop('Admin account');
+gettext_noop('Moderator account');
+gettext_noop('User account');
Modified: trunk/vhffs-panel/templates/Makefile.am
===================================================================
--- trunk/vhffs-panel/templates/Makefile.am 2011-05-01 14:25:51 UTC (rev 1682)
+++ trunk/vhffs-panel/templates/Makefile.am 2011-05-01 14:26:00 UTC (rev 1683)
@@ -142,8 +142,14 @@
anonymous/login.tt \
anonymous/subscribe.tt \
layouts/anonymous.tt \
+ layouts/panel.tt \
+ menu/admin.tt \
+ menu/context.tt \
+ menu/group.tt \
+ menu/moderator.tt \
misc/closed.tt \
misc/errors.tt \
+ misc/header.tt \
misc/infos.tt \
misc/languages.tt \
misc/message.tt
Added: trunk/vhffs-panel/templates/layouts/panel.tt
===================================================================
--- trunk/vhffs-panel/templates/layouts/panel.tt (rev 0)
+++ trunk/vhffs-panel/templates/layouts/panel.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>[% title | html %]</title>
+ <link rel="stylesheet" type="text/css" href="/themes/[% theme %]/main.css"/>
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
+ <script language="javascript" type="text/javascript" charset="utf-8" src="/js/prototype.js"></script>
+ <script language="javascript" type="text/javascript" charset="utf-8" src="/js/commons.js"></script>
+ <script language="javascript" type="text/javascript" charset="utf-8" src="/js/tooltip.js"></script>
+</head>
+<body>
+[% INCLUDE 'misc/header.tt' %]
+<div class="main" id="main">
+ <h1>[% page_title | html %]</h1>
+ [% INCLUDE 'misc/errors.tt' %]
+ [% INCLUDE 'misc/infos.tt' %]
+[% PROCESS $template %]
+</div>
+</body>
+</html>
Added: trunk/vhffs-panel/templates/menu/admin.tt
===================================================================
--- trunk/vhffs-panel/templates/menu/admin.tt (rev 0)
+++ trunk/vhffs-panel/templates/menu/admin.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,16 @@
+<a href="/admin/index.pl">[% 'General' | i18n | html %]</a>
+<a href="/admin/user/index.pl">[% 'Users' | i18n | html %]</a>
+<a href="/admin/group/index.pl">[% 'Groups' | i18n | html %]</a>
+[% IF panel_header.available_services.web %]<a href="/admin/web/index.pl">[% 'Web' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mysql %]<a href="/admin/mysql/index.pl">[% 'MySQL' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.pgsql %]<a href="/admin/pgsql/index.pl">[% 'PgSQL' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.cvs %]<a href="/admin/cvs/index.pl">[% 'CVS' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.svn %]<a href="/admin/svn/index.pl">[% 'SVN' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.git %]<a href="/admin/git/index.pl">[% 'Git' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mercurial %]<a href="/admin/mercurial/index.pl">[% 'Mercurial' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.bazaar %]<a href="/admin/bazaar/index.pl">[% 'Bazaar' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.dns %]<a href="/admin/dns/index.pl">[% 'DNS' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.repository %]<a href="/admin/repository/index.pl">[% 'Web' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mail %]<a href="/admin/mail/index.pl">[% 'Mail' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mailinglist %]<a href="/admin/mailinglist/index.pl">[% 'ML' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.cron %]<a href="/admin/cron/index.pl">[% 'Crons' | i18n | html %]</a>[% END %]
Added: trunk/vhffs-panel/templates/menu/context.tt
===================================================================
--- trunk/vhffs-panel/templates/menu/context.tt (rev 0)
+++ trunk/vhffs-panel/templates/menu/context.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,9 @@
+[% IF panel_header.admin_menu %]
+ [% IF current_user.is_admin() %]
+ [% INCLUDE 'menu/admin.tt' %]
+ [% ELSIF current_user.is_moderator() %]
+ [% INCLUDE 'menu/moderator.tt' %]
+ [% END %]
+[% ELSIF current_group %]
+ [% INCLUDE 'menu/group.tt' %]
+[% END %]
Added: trunk/vhffs-panel/templates/menu/group.tt
===================================================================
--- trunk/vhffs-panel/templates/menu/group.tt (rev 0)
+++ trunk/vhffs-panel/templates/menu/group.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,13 @@
+[% IF panel_header.available_services.web %]<a href="/web/index.pl?groupname=[% current_group.get_groupname %]">[% 'Web' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mysql %]<a href="/mysql/index.pl?groupname=[% current_group.get_groupname %]">[% 'MySQL' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.pgsql %]<a href="/pgsql/index.pl?groupname=[% current_group.get_groupname %]">[% 'PgSQL' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.cvs %]<a href="/cvs/index.pl?groupname=[% current_group.get_groupname %]">[% 'CVS' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.svn %]<a href="/svn/index.pl?groupname=[% current_group.get_groupname %]">[% 'SVN' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.git %]<a href="/git/index.pl?groupname=[% current_group.get_groupname %]">[% 'Git' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mercurial %]<a href="/mercurial/index.pl?groupname=[% current_group.get_groupname %]">[% 'Mercurial' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.bazaar %]<a href="/bazaar/index.pl?groupname=[% current_group.get_groupname %]">[% 'Bazaar' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.dns %]<a href="/dns/index.pl?groupname=[% current_group.get_groupname %]">[% 'DNS' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.repository %]<a href="/repository/index.pl?groupname=[% current_group.get_groupname %]">[% 'Web' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mail %]<a href="/mail/index.pl?groupname=[% current_group.get_groupname %]">[% 'Mail' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.mailinglist %]<a href="/mailinglist/index.pl?groupname=[% current_group.get_groupname %]">[% 'ML' | i18n | html %]</a>[% END %]
+[% IF panel_header.available_services.cron %]<a href="/cron/index.pl?groupname=[% current_group.get_groupname %]">[% 'Crons' | i18n | html %]</a>[% END %]
Added: trunk/vhffs-panel/templates/menu/moderator.tt
===================================================================
--- trunk/vhffs-panel/templates/menu/moderator.tt (rev 0)
+++ trunk/vhffs-panel/templates/menu/moderator.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,2 @@
+<a href="/admin/stats.pl">[% 'Get statistics' | i18n | html %]</a>
+<a href="/admin/moderation.pl">[% 'Moderation' | i18n | html %]</a>
Added: trunk/vhffs-panel/templates/misc/header.tt
===================================================================
--- trunk/vhffs-panel/templates/misc/header.tt (rev 0)
+++ trunk/vhffs-panel/templates/misc/header.tt 2011-05-01 14:26:00 UTC (rev 1683)
@@ -0,0 +1,40 @@
+<div id="header">
+ <div id="logo">
+ <a class="logomenu" href="/panel.pl">
+ <img src="/themes/[% theme %]/images/logo.png" alt="logo"/>
+ </a>
+ </div>
+ <div id="top_menu">
+ <div id="userToolBox">
+ <a href="/panel.pl" title="[% 'Home page' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/home.png" title="[% 'Home page' | i18n | html %]" alt="[% 'Home page' | i18n | html %]" />
+ </a>
+ <a href="/user/prefs.pl" title="[% 'User Preferences' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/prefs.png" title="[% 'User Preferences' | i18n | html %]" alt="[% 'User Preferences' | i18n | html %]" />
+ </a>
+ <a href="/group/index.pl" title="[% 'My Projects' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/projects.png" title="[% 'My Projects' | i18n | html %]" alt="[% 'My Projects' | i18n | html %]" />
+ </a>
+ [% IF current_user.is_admin() %]
+ <a href="/admin/index.pl" title="[% 'Administration' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/admin.png" title="[% 'Administration' | i18n | html %]" alt="[% 'Administration' | i18n | html %]" />
+ </a>
+ [% END %]
+ <a href="[% panel_header.help_url %]" title="[% 'Help' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/help.png" title="[% 'Help' | i18n | html %]" alt="[% 'Help' | i18n | html %]" />
+ </a>
+ <a href="/alert.pl" title="[% 'Report a bug' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/bug.png" title="[% 'Report a bug' | i18n | html %]" alt="[% 'Report a bug' | i18n | html %]" />
+ </a>
+ <a href="/auth.pl?logout=1" title="[% 'Logout' | i18n | html %]">
+ <img src="/themes/[% theme %]/images/logout.png" title="[% 'Logout' | i18n | html %]" alt="[% 'Logout' | i18n | html %]" />
+ </a>
+ </div>
+ <span id="username" title="[% (current_user.is_admin() ? 'Admin account' : (current_user.is_moderator ? 'Moderator account' : 'User account' )) | i18n | html %]">[% current_user.get_username() %]</span>
+ </div>
+<div id="contextual_menu">
+<p>
+ [% INCLUDE 'menu/context.tt' %]
+</p>
+</div>
+</div>