[vhffs-dev] [1062] Started to rework public part... |
[ Thread Index |
Date Index
| More vhffs.org/vhffs-dev Archives
]
Revision: 1062
Author: beuss
Date: 2007-11-04 16:36:25 +0000 (Sun, 04 Nov 2007)
Log Message:
-----------
Started to rework public part... Everything is not working for now but I've been working for several hours on it so I guess my disk will crash if I don't commit.
Modified Paths:
--------------
trunk/vhffs-api/src/Vhffs/Group.pm
trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
trunk/vhffs-api/src/Vhffs/Panel/Git.pm
trunk/vhffs-api/src/Vhffs/Panel/Group.pm
trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
trunk/vhffs-api/src/Vhffs/Panel/User.pm
trunk/vhffs-api/src/Vhffs/Panel/Web.pm
trunk/vhffs-api/src/Vhffs/User.pm
trunk/vhffs-api/src/examples/show_last_users.pl
trunk/vhffs-panel/templates/group/index.tmpl
trunk/vhffs-panel/templates/menu/main.tmpl
trunk/vhffs-public/allgroups.pl
trunk/vhffs-public/allwebsites.pl
trunk/vhffs-public/group.pl
trunk/vhffs-public/index.pl
trunk/vhffs-public/lastgroups.pl
trunk/vhffs-public/lastusers.pl
trunk/vhffs-public/rss/lastgroups.pl
trunk/vhffs-public/rss/lastusers.pl
trunk/vhffs-public/templates/allwebsites.tmpl
trunk/vhffs-public/templates/banner.tmpl
trunk/vhffs-public/templates/group.tmpl
trunk/vhffs-public/templates/group_part.tmpl
trunk/vhffs-public/templates/index.tmpl
trunk/vhffs-public/templates/lastgroups.tmpl
trunk/vhffs-public/templates/lastusers.tmpl
trunk/vhffs-public/templates/misc/cvs-part.tmpl
trunk/vhffs-public/templates/misc/git-part.tmpl
trunk/vhffs-public/templates/misc/lastgroups-part.tmpl
trunk/vhffs-public/templates/misc/lastusers-part.tmpl
trunk/vhffs-public/templates/misc/list-part.tmpl
trunk/vhffs-public/templates/misc/svn-part.tmpl
trunk/vhffs-public/templates/misc/web-part.tmpl
trunk/vhffs-public/templates/user.tmpl
trunk/vhffs-public/templates/user_part.tmpl
trunk/vhffs-public/user.pl
trunk/vhffs-themes/vhffs/main.css
Modified: trunk/vhffs-api/src/Vhffs/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Group.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Group.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -391,23 +391,6 @@
}
}
-sub get_last_groups
-{
- my $vhffs = shift;
- return unless defined $vhffs;
-
- my $request = $vhffs->{'db'}->prepare( 'SELECT g.gid FROM vhffs_groups g LEFT OUTER JOIN vhffs_users u ON u.username=g.groupname INNER JOIN vhffs_object o ON o.object_id=g.object_id WHERE o.state=? AND u.username IS NULL ORDER BY g.gid DESC LIMIT 10' );
- $request->execute( Vhffs::Constants::ACTIVATED );
-
- my @groups;
- while( my ($gid) = $request->fetchrow_array )
- {
- push @groups, Vhffs::Group::get_by_gid( $vhffs , $gid );
- }
- return \@groups;
-}
-
-
sub get_users
{
use Vhffs::User;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/Cvs.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -121,4 +121,12 @@
return $cvs;
}
+sub get_repos_per_group {
+ my ($main, $gid) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT c.cvsroot, o.description FROM vhffs_cvs c INNER JOIN vhffs_object o ON o.object_id = c.object_id WHERE o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
1;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Git.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/Git.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -81,6 +81,15 @@
return $git;
}
+sub get_repos_per_group {
+ my ($main, $gid) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT g.reponame, o.description FROM vhffs_git g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
+
sub search {
my ($main, $name) = @_;
Modified: trunk/vhffs-api/src/Vhffs/Panel/Group.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/Group.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -76,6 +76,25 @@
return $users;
}
+sub get_last_groups {
+ my $main = shift;
+ my @groups;
+
+ my $sql = 'SELECT g.gid, g.groupname, g.realname, o.description FROM vhffs_groups g LEFT OUTER JOIN vhffs_users u ON u.username=g.groupname INNER JOIN vhffs_object o ON o.object_id=g.object_id WHERE o.state=? AND u.username IS NULL ORDER BY o.date_creation DESC LIMIT 10';
+ my $dbh = $main->get_db_object;
+ my $sth = $dbh->prepare($sql);
+ $sql = 'SELECT u.username FROM vhffs_users u INNER JOIN vhffs_user_group ug ON ug.uid = u.uid WHERE ug.gid = ?';
+ my $ssth = $dbh->prepare($sql);
+ $sth->execute(Vhffs::Constants::ACTIVATED);
+ while(my $row = $sth->fetchrow_hashref) {
+ $ssth->execute($row->{gid});
+ $row->{users} = $ssth->fetchall_arrayref({});
+ push @groups, $row;
+ }
+
+ return \@groups;
+}
+
sub search
{
my ($main, $name) = @_;
Modified: trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/MailingList.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -102,6 +102,14 @@
return $mls;
}
+sub get_lists_per_group {
+ my ($main, $gid) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT l.local_part || \'@\' || l.domain AS listname, l.local_part, l.domain, o.description FROM vhffs_ml l INNER JOIN vhffs_object o ON l.object_id = o.object_id WHERE o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
=pod
=head2 getall_mdomains_per_group
Modified: trunk/vhffs-api/src/Vhffs/Panel/Svn.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/Svn.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -80,6 +80,14 @@
return $svn;
}
+sub get_repos_per_group {
+ my ($main, $gid) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT s.reponame, o.description FROM vhffs_svn s INNER JOIN vhffs_object o ON o.object_id = s.object_id WHERE o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
sub search {
my ($main, $name) = @_;
Modified: trunk/vhffs-api/src/Vhffs/Panel/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/User.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/User.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -74,6 +74,14 @@
=head1 METHODS
=cut
+=head2 get_last_users
+
+Fetches and returns an array of hashrefs {username, firstname, lastname,
+groups => {groupname}} containing information about the last ten users of the
+platform
+
+=cut
+
sub get_last_users
{
my $vhffs = shift;
@@ -81,19 +89,18 @@
return if ( !defined $vhffs );
- my $query = "SELECT uid FROM vhffs_users ORDER BY uid LIMIT 0,10";
- my $request = $vhffs->{'db'}->prepare( $query );
+ my $sql = 'SELECT uid, username, firstname, lastname FROM vhffs_users ORDER BY date_creation DESC LIMIT 10';
+ my $sth = $vhffs->get_db_object->prepare($sql);
+ $sth->execute();
+ $sql = 'SELECT g.groupname FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON ug.gid = g.gid WHERE ug.uid = ? AND g.groupname != ?';
+ my $ssth = $vhffs->get_db_object->prepare($sql);
+ while(my $row = $sth->fetchrow_hashref) {
+ $ssth->execute($row->{uid}, $row->{username});
+ $row->{groups} = $ssth->fetchall_arrayref({});
+ push @users, $row;
+ }
- while( my ($uid) = $request->fetchrow_array )
- {
- my $user = Vhffs::User::get_by_uid( $vhffs , $uid );
- if( defined $user )
- {
- push @users , $user;
- }
- }
- return \@users;
-
+ return \@users;
}
sub search {
@@ -117,13 +124,38 @@
while(my $u = $sth->fetchrow_hashref('NAME_lc')) {
$u->{state} = Vhffs::Functions::status_string_from_status_id($u->{state});
- $u->{firstname} = Encode::decode_utf8( $u->{firstname} );
- $u->{lastname} = Encode::decode_utf8( $u->{lastname} );
+ $u->{firstname} = Encode::decode_utf8( $u->{firstname} );
+ $u->{lastname} = Encode::decode_utf8( $u->{lastname} );
push(@$users, $u);
}
return $users;
}
+sub public_search {
+ my ($main, $username, $firstname, $lastname) = @_;
+
+ my $sql = 'SELECT u.uid, u.username, u.firstname, u.lastname FROM vhffs_users u INNER JOIN vhffs_object ON o.objectid = u.object_id WHERE o.state = ?';
+ my @params;
+
+ if(defined $username) {
+ $sql .= ' AND username LIKE ?';
+ push @params, '%'.$username.'%';
+ }
+
+ if(defined $firstname) {
+ $sql .= ' AND firstname LIKE ?';
+ push @params, '%'.$firstname.'%';
+ }
+
+ if(defined $lastname) {
+ $sql .= ' AND lastname LIKE ?';
+ push @params, '%'.$lastname.'%';
+ }
+
+ my $dbh = $main->get_db_object;
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, Vhffs::Constants::ACTIVATED, @params);
+}
+
sub set_lang
{
my $user = shift;
@@ -220,13 +252,13 @@
push @params, $user->get_uid;
if( defined $relation) {
if( $relation == $RELATION_OWNER ) {
- $sql = 'SELECT g.groupname AS project, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE o.owner_uid = ? AND g.groupname != ? ORDER BY g.groupname';
+ $sql = 'SELECT g.groupname, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE o.owner_uid = ? AND g.groupname != ? ORDER BY g.groupname';
push @params, $user->get_username;
} else {
- $sql = 'SELECT g.groupname AS project, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? AND o.owner_uid != ug.uid ORDER BY g.groupname';
+ $sql = 'SELECT g.groupname, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? AND o.owner_uid != ug.uid ORDER BY g.groupname';
}
} else {
- $sql = 'SELECT g.groupname AS project, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? ORDER BY g.groupname';
+ $sql = 'SELECT g.groupname, o.state , o.object_id AS oid FROM vhffs_groups g INNER JOIN vhffs_user_group ug ON g.gid=ug.gid INNER JOIN vhffs_object o ON o.object_id = g.object_id WHERE ug.uid=? ORDER BY g.groupname';
}
my $sth = $user->get_db_object->prepare( $sql );
return undef if( ! $sth->execute(@params) );
Modified: trunk/vhffs-api/src/Vhffs/Panel/Web.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/Panel/Web.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -82,6 +82,21 @@
return $web;
}
+=head2 get_websites_per_group
+
+Returns an array of hashrefs {servername, description} containing all active websites for a
+givent group.
+
+=cut
+
+sub get_websites_per_group {
+ my ($main, $gid) = @_;
+
+ my $dbh = $main->get_db_object;
+ my $sql = 'SELECT w.servername, o.description FROM vhffs_httpd w INNER JOIN vhffs_object o ON o.object_id = w.object_id WHERE o.owner_gid = ? AND o.state = ?';
+ return $dbh->selectall_arrayref($sql, { Slice => {} }, $gid, Vhffs::Constants::ACTIVATED);
+}
+
sub search {
my ($main, $name) = @_;
Modified: trunk/vhffs-api/src/Vhffs/User.pm
===================================================================
--- trunk/vhffs-api/src/Vhffs/User.pm 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/Vhffs/User.pm 2007-11-04 16:36:25 UTC (rev 1062)
@@ -145,7 +145,6 @@
sub check_username($) {
my $username = shift;
return ( defined($username) && ($username =~ /^[a-z0-9]{3,12}$/) );
-
}
=pod
@@ -747,23 +746,6 @@
}
-sub get_last_users
-{
- my $vhffs = shift;
- return unless defined $vhffs;
-
- my $request = $vhffs->{'db'}->prepare( 'SELECT u.uid FROM vhffs_users u INNER JOIN vhffs_object o ON u.object_id=o.object_id WHERE o.state=? ORDER BY uid DESC LIMIT 10' );
- $request->execute( Vhffs::Constants::ACTIVATED );
-
- my @users;
- while( my ($uid) = $request->fetchrow_array )
- {
- push @users, Vhffs::User::get_by_uid( $vhffs , $uid );
- }
- return \@users;
-}
-
-
sub get_groups
{
my $self = shift;
Modified: trunk/vhffs-api/src/examples/show_last_users.pl
===================================================================
--- trunk/vhffs-api/src/examples/show_last_users.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-api/src/examples/show_last_users.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -5,30 +5,15 @@
use Data::Dumper;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::Conf;
-use Vhffs::User;
-use Vhffs::Group;
+
use Vhffs::Main;
-use Vhffs::Object;
-use Vhffs::Services::DNS;
+use Vhffs::Panel::User;
-my $config;
-my $mysql_config;
-my $services_config;
-my $user;
-my $dbh;
-my $backend;
-my %infos;
-my $group;
-
my $princ = init Vhffs::Main;
-$config = $princ->get_config;
+my $users = Vhffs::Panel::User::get_last_users( $princ );
-my $users = Vhffs::User::get_last_users( $princ );
-
-
use Data::Dumper;
print Dumper $users;
Modified: trunk/vhffs-panel/templates/group/index.tmpl
===================================================================
--- trunk/vhffs-panel/templates/group/index.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-panel/templates/group/index.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -4,9 +4,9 @@
<ul>
<tmpl_loop name="OWNED_PROJECTS">
<tmpl_if name="ACTIVE">
- <li><a href="/group/view.pl?project=<tmpl_var name="PROJECT">"><tmpl_var name="PROJECT"></a></li>
+ <li><a href="/group/view.pl?project=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a></li>
<tmpl_else>
- <li><tmpl_var name="PROJECT"> — <tmpl_var name="STATE">
+ <li><tmpl_var name="GROUPNAME"> — <tmpl_var name="STATE">
<tmpl_if name="REFUSED">
- <a href="/object/resubmit.pl?oid=<tmpl_var name="OID">"><tmpl_var name="RESUBMIT_TEXT"></a>
- <a href="/object/quickdelete.pl?oid=<tmpl_var name="OID">"><tmpl_var name="DELETE_TEXT"></a>
@@ -23,9 +23,9 @@
<ul>
<tmpl_loop name="CONTRIBUTED_PROJECTS">
<tmpl_if name="ACTIVE">
- <li><a href="/group/view.pl?project=<tmpl_var name="PROJECT">"><tmpl_var name="PROJECT"></a></li>
+ <li><a href="/group/view.pl?project=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a></li>
<tmpl_else>
- <li><tmpl_var name="PROJECT"> — <tmpl_var name="STATE"></li>
+ <li><tmpl_var name="GROUPNAME"> — <tmpl_var name="STATE"></li>
<tmpl_if name="REFUSED">
- <a href="/object/resubmit.pl?oid=<tmpl_var name="OID">"><tmpl_var name="RESUBMIT_TEXT"></a>
- <a href="/object/quickdelete.pl?oid=<tmpl_var name="OID">"><tmpl_var name="DELETE_TEXT"></a>
Modified: trunk/vhffs-panel/templates/menu/main.tmpl
===================================================================
--- trunk/vhffs-panel/templates/menu/main.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-panel/templates/menu/main.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -4,7 +4,7 @@
<span id="groupname"><a href="/group/view.pl?project=<tmpl_var name="GROUPNAME">"><img src="/themes/<tmpl_var name="THEME">/images/projectcurrent.png" title="<tmpl_var name="PROJECT_HOME_TEXT">" alt="<tmpl_var name="PROJECT_HOME_TEXT">" onmouseover="javascript:this.timer=helpTimeout('user_project');" onmouseout="javascript:window.clearTimeout(this.timer);"/></a> <tmpl_var name="CURRENT_GROUP_TEXT"> <tmpl_var name="GROUPNAME"></span>
</div>
</tmpl_if>
- <div id="username_menu">
+ <div id="top_menu">
<div id="userToolBox">
<a href="/panel.pl" title="<tmpl_var name="TEXT_HOME">">
<img src="/themes/<tmpl_var name="THEME">/images/home.png" title="<tmpl_var name="TEXT_HOME">" alt="<tmpl_var name="TEXT_HOME">" onmouseover="javascript:this.timer=helpTimeout('home_page');" onmouseout="javascript:window.clearTimeout(this.timer);"/>
Modified: trunk/vhffs-public/allgroups.pl
===================================================================
--- trunk/vhffs-public/allgroups.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/allgroups.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,7 +33,6 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
@@ -42,6 +41,7 @@
use Vhffs::Group;
use Vhffs::Main;
use Vhffs::Panel::Main;
+use Vhffs::Panel::Template;
use Vhffs::Constants;
use CGI;
@@ -61,10 +61,11 @@
undef $letter if( $letter eq 'all');
my $groups = Vhffs::Group::getall_by_letter( $vhffs , $letter, Vhffs::Constants::ACTIVATED );
my $output_final="";
-my $maintemplate = new HTML::Template( filename => $templatedir."/public/lastgroups.tmpl" );
+my $maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/lastgroups.tmpl" );
my $hostname = $vhffs->get_config->get_host_name;
+$maintemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
$maintemplate->param( TEXT_TITLE => sprintf( gettext("All groups on %s") , $hostname ) );
$maintemplate->param( LETTERS => [ { letter => '0' }, { letter => '1' }, { letter => '2' }, { letter => '3' }, { letter => '4' }, { letter => '5' }, { letter => '6' }, { letter => '7' }, { letter => '8' }, { letter => '9' }, { letter => 'a' }, { letter => 'b' }, { letter => 'c' }, { letter => 'd' }, { letter => 'e' }, { letter => 'f' }, { letter => 'g' }, { letter => 'h' }, { letter => 'i' }, { letter => 'j' }, { letter => 'k' }, { letter => 'l' }, { letter => 'm' }, { letter => 'n' }, { letter => 'o' }, { letter => 'p' }, { letter => 'q' }, { letter => 'r' }, { letter => 's' }, { letter => 't' }, { letter => 'u' }, { letter => 'v' }, { letter => 'w' }, { letter => 'x' }, { letter => 'y' }, { letter => 'z' } ]);
$maintemplate->param( ALL => gettext('All') );
@@ -107,17 +108,7 @@
}
$output_final .= $template->output;
}
-$subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
-$subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-$subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
-$subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
-$subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
-$subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
-$subtemplate->param( LAST_USERS => gettext( "Last users" ) );
-$subtemplate->param( SEARCH => gettext( "Search:" ) );
-$maintemplate->param( BANNER => $subtemplate->output );
-
$maintemplate->param( VALUES => $output_final );
$panel->light( $maintemplate );
Modified: trunk/vhffs-public/allwebsites.pl
===================================================================
--- trunk/vhffs-public/allwebsites.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/allwebsites.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,7 +33,6 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -45,6 +44,7 @@
use Vhffs::Acl;
use Vhffs::Constants;
use Vhffs::Panel::Main;
+use Vhffs::Panel::Template;
use Vhffs::Services::Web;
my $panel = new Vhffs::Panel::Main();
@@ -67,12 +67,14 @@
my $subtemplate;
my $hostname = $vhffs->get_config->get_host_name;
-$maintemplate = new HTML::Template( filename => $templatedir."/public/allwebsites.tmpl" );
+$maintemplate = new Vhffs::Panel::Template( filename => $templatedir."/public/allwebsites.tmpl" );
$maintemplate->param( TEXT_TITLE => sprintf( gettext("All websites on %s") , $hostname ) );
$maintemplate->param( LETTERS => $letters );
$maintemplate->param( ALL => gettext('All') );
+$maintemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
+
if( @{$webs} == 0 )
{
$maintemplate->param( MESSAGE => gettext('No webarea') );
@@ -97,17 +99,5 @@
$maintemplate->param( VALUES => $output );
-$subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
-$subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-$subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
-$subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
-$subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
-$subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
-$subtemplate->param( LAST_USERS => gettext( "Last users" ) );
-$subtemplate->param( SEARCH => gettext( "Search:" ) );
-
-
-$maintemplate->param( BANNER => $subtemplate->output );
-
$panel->light( $maintemplate );
$panel->display;
Modified: trunk/vhffs-public/group.pl
===================================================================
--- trunk/vhffs-public/group.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/group.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,19 +33,16 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template::Expr;
use locale;
use Locale::gettext;
use CGI;
use CGI::Session;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
use Vhffs::Main;
-use Vhffs::Acl;
use Vhffs::Constants;
use Vhffs::Panel::Main;
+use Vhffs::Panel::Template;
use Vhffs::Functions;
my $panel = new Vhffs::Panel::Main();
@@ -86,189 +83,53 @@
else
{
$name = Vhffs::Functions::check_arg( $name );
- $template = new HTML::Template( filename => $templatedir."/public/group.tmpl" );
- $template->param( VALUE_REALNAME => $group->get_realname );
- $template->param( TEXT_GROUPNAME => gettext("Groupname") );
- $template->param( TEXT_DESCRIPTION => gettext("Description") );
- $template->param( VALUE_GROUPNAME => $group->get_groupname );
- $template->param( VALUE_DESCRIPTION => CGI::escapeHTML( $group->get_description ) );
- $template->param( TEXT_USERS => gettext("Users") );
+ $template = new Vhffs::Panel::Template( filename => $templatedir."/public/group.tmpl",
+ die_on_bad_params => 0,
+ loop_context_vars => 1,
+ global_var => 1,
+ functions => { obfuscate_email => \&obfuscate_email } );
+ $template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
+ $template->param( VALUE_REALNAME => $group->get_realname );
+ $template->param( VALUE_GROUPNAME => $group->get_groupname );
+ $template->param( VALUE_DESCRIPTION => $group->get_description );
+ $template->param( USERS => $group->get_users );
-
- my $output = "";
- my $users = $group->get_users;
- my $subtemplate;
- my $user;
- if( ! defined $users )
- {
- $template->param( VALUE_USERS => gettext("No user for this group") );
- }
- else
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/user_part.tmpl" );
-
- foreach $user (@{$users})
- {
- $subtemplate->param( VALUE => $user->get_username );
- $output .= $subtemplate->output;
- }
+ if( $vhffs->get_config->get_service_availability('web') == 1 ) {
+ use Vhffs::Panel::Web;
+ $template->param( WEBSITES_TITLE => gettext('Websites for this group') );
+ $template->param( WEBSITES => Vhffs::Panel::Web::get_websites_per_group($vhffs, $group->get_gid) );
+ }
- $template->param( VALUE_USERS => $output );
+ if( $vhffs->get_config->get_service_availability('cvs') == 1 ) {
+ use Vhffs::Panel::Cvs;
+ $template->param( WEBCVS => $vhffs->get_config->get_service('cvs')->{'cvsweb_url'} );
+ $template->param( CVSREPOS => Vhffs::Panel::Cvs::get_repos_per_group($vhffs, $group->get_gid ) );
+ }
- if( $vhffs->get_config->get_service_availability('web') == 1 )
- {
+ if( $vhffs->get_config->get_service_availability('svn') == 1 ) {
+ use Vhffs::Panel::Svn;
+ $template->param( WEBSVN => $vhffs->get_config->get_service('cvs')->{'svnweb_url'} );
+ $template->param( SVNREPOS => Vhffs::Panel::Svn::get_repos_per_group($vhffs, $group->get_gid) );
+ }
- use Vhffs::Services::Web;
+ if( $vhffs->get_config->get_service_availability('git') == 1 ) {
+ use Vhffs::Panel::Git;
+ $template->param( WEBGIT => $vhffs->get_config->get_service('git')->{'gitweb_url'} );
+ $template->param( GITREPOS => Vhffs::Panel::Git::get_repos_per_group($vhffs, $group->get_gid) );
+ }
- $output = "";
- my $webs = Vhffs::Services::Web::getall_by_group( $vhffs , $group );
- $template->param( WEBSITES_TITLE => gettext("Website for this group"));
- if( defined $webs )
- {
- foreach( @{$webs} )
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/misc/web-part.tmpl" );
- $subtemplate->param( SERVERNAME => $_->get_servername );
- $subtemplate->param( DESCRIPTION => CGI::escapeHTML( $_->get_description ) );
- $output .= $subtemplate->output;
- }
-
- $template->param( WEBSITES_VALUE => $output );
- }
- else
- {
- $template->param( WEBSITES_VALUE => gettext("No website available for this group") );
- }
- }
-
- if( $vhffs->get_config->get_service_availability('cvs') == 1 )
- {
- use Vhffs::Services::Cvs;
- $repos = Vhffs::Services::Cvs::getall_per_group( $vhffs , $group );
- $output = "";
- $template->param( CVS_TITLE => gettext("CVS repository for this group"));
- if( defined $repos )
- {
- foreach( @{$repos} )
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/misc/cvs-part.tmpl" );
- $subtemplate->param( CVSROOT => $_->get_cvsroot );
- my $cvspath = $_->get_cvsroot;
- $subtemplate->param( CVSURL => $vhffs->get_config->get_service('cvs')->{'cvsweb_url'} . '/' . $cvspath . '/' );
- $output .= $subtemplate->output;
- }
-
- $template->param( CVS_VALUE => $output );
- }
- else
- {
- $template->param( CVS_VALUE => gettext("No cvs repository available for this group") );
- }
- }
-
-
-
- if( $vhffs->get_config->get_service_availability('svn') == 1 )
- {
- use Vhffs::Services::Svn;
- $repos = Vhffs::Services::Svn::getall_by_group( $vhffs , $group );
- $output = "";
- $template->param( SVN_TITLE => gettext("SVN repository for this group"));
- if( defined $repos )
- {
- foreach( @{$repos} )
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/misc/svn-part.tmpl" );
- $subtemplate->param( SVNROOT => $_->get_reponame );
- $subtemplate->param( DESCRIPTION => CGI::escapeHTML( $_->get_description ) );
- my $svnpath = $_->get_reponame;
- $subtemplate->param( SVNURL => $vhffs->get_config->get_service('svn')->{'svnweb_url'} . '/' . $svnpath . '/' );
- $output .= $subtemplate->output;
- }
-
- $template->param( SVN_VALUE => $output );
- }
- else
- {
- $template->param( SVN_VALUE => gettext("No subversion repository available for this group") );
- }
- }
-
- if( $vhffs->get_config->get_service_availability('git') == 1 )
- {
- use Vhffs::Services::Git;
- $repos = Vhffs::Services::Git::getall_by_group( $vhffs , $group );
- $output = "";
- $template->param( GIT_TITLE => gettext("GIT repository for this group"));
- if( defined $repos )
- {
- foreach( @{$repos} )
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/misc/git-part.tmpl" );
- $subtemplate->param( GITROOT => $_->get_reponame );
- $subtemplate->param( DESCRIPTION => CGI::escapeHTML( $_->get_description ) );
- my $gitpath = $_->get_reponame;
- $subtemplate->param( GITURL => $vhffs->get_config->get_service('git')->{'gitweb_url'} . '/' . $gitpath . '/' );
- $output .= $subtemplate->output;
- }
-
- $template->param( GIT_VALUE => $output );
- }
- else
- {
- $template->param( GIT_VALUE => gettext("No git repository available for this group") );
- }
- }
-
-
-
- if( $vhffs->get_config->get_service_availability('mailinglist') == 1 )
- {
- use Vhffs::Services::MailingList;
- my $mailinglistconfig = $vhffs->get_config->get_service('mailinglist');
-
- $objs = Vhffs::Services::MailingList::getall_by_group( $vhffs , $group );
- $output = "";
- $template->param( LISTS_TITLE => gettext("List(s) for this group") );
- if( defined $objs )
- {
- foreach( @{$objs} )
- {
- $subtemplate = new HTML::Template::Expr(
- filename => $templatedir."/public/misc/list-part.tmpl",
- functions => { obfuscate_email => \&obfuscate_email } );
- $subtemplate->param( LISTNAME => $_->get_label );
- $subtemplate->param( DOMAIN => $_->get_domain );
- $subtemplate->param( LOCALPART => $_->get_localpart );
- $subtemplate->param( ARCHIVESURL => $mailinglistconfig->{'url_archives'} );
- $subtemplate->param( ARCHIVES_TEXT => gettext( "View archives" ) );
- $output .= $subtemplate->output;
- }
- $template->param( LISTS_VALUE => $output );
- }
- else
- {
- $template->param( LISTS_VALUE => gettext("No list available for this group") );
- }
- }
-
-
- }
- $subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
- $subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
- $subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
- $subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
- $subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
- $subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
- $subtemplate->param( LAST_USERS => gettext( "Last users" ) );
- $subtemplate->param( SEARCH => gettext( "Search:" ) );
- $template->param( BANNER => $subtemplate->output );
+ if( $vhffs->get_config->get_service_availability('mailinglist') == 1 ) {
+ use Vhffs::Panel::MailingList;
+ $template->param( ARCHIVESURL => $vhffs->get_config->get_service('mailinglist')->{'url_archives'} );
+ $template->param( LISTS => Vhffs::Panel::MailingList::get_lists_per_group($vhffs, $group->get_gid) );
+ }
}
-# This is ugly but we need it until Vhffs::Main is Singleton'ed
+# We've to wrap the function since $vhffs isn't reachable from templates
sub obfuscate_email {
return Vhffs::Functions::obfuscate_email($vhffs, $_[0]);
}
$panel->light( $template );
$panel->display;
+
Modified: trunk/vhffs-public/index.pl
===================================================================
--- trunk/vhffs-public/index.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/index.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,7 +33,6 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
@@ -45,6 +44,7 @@
use Vhffs::Acl;
use Vhffs::Constants;
use Vhffs::Panel::Main;
+use Vhffs::Panel::Template;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -59,36 +59,12 @@
my $template;
my $subtemplate;
-$template = new HTML::Template( filename => $templatedir."/public/index.tmpl" );
+$template = new Vhffs::Panel::Template( filename => $templatedir."/public/index.tmpl" );
$template->param( TEXT_TITLE => sprintf( gettext("%s public area") , $vhffs->get_config->get_host_name) );
-$template->param( TEXT_LASTUSERS => sprintf( gettext("Show me last users on %s") , $hostname ) );
-$template->param( USERS_TITLE => gettext("User public area") );
-$template->param( TEXT_SEARCH_USER => gettext("Show me this user according to this username") );
+$template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-
-$template->param( TEXT_LASTGROUPS => sprintf( gettext("Show me last groups on %s") , $hostname ) );
-$template->param( TEXT_ALLGROUPS => sprintf( gettext("Show me all groups on %s") , $hostname ) );
-$template->param( GROUPS_TITLE => gettext("Group public area") );
-$template->param( TEXT_SEARCH_GROUP => gettext("Show me this group according to this groupname") );
-
-$template->param( TEXT_WEBSITES => gettext("Show me all websites") );
-$template->param( WEBSITES_TITLE => gettext("Websites area") );
-$template->param( TEXT_SEARCH_WEBSITE => gettext("Search for a website") );
-
-
-$subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
-$subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-$subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
-$subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
-$subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
-$subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
-$subtemplate->param( LAST_USERS => gettext( "Last users" ) );
-$subtemplate->param( SEARCH => gettext( "Search:" ) );
-
-$template->param( BANNER => $subtemplate->output );
-
$panel->light( $template );
$panel->display;
Modified: trunk/vhffs-public/lastgroups.pl
===================================================================
--- trunk/vhffs-public/lastgroups.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/lastgroups.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,16 +33,13 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
+use Vhffs::Panel::Group;
use Vhffs::Panel::Main;
-use CGI;
+use Vhffs::Panel::Template;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -53,66 +50,14 @@
$panel->check_public();
-my $template;
-my $subtemplate;
-my $group;
-my $groups = Vhffs::Group::get_last_groups( $vhffs );
-my $output_final="";
-my $maintemplate = new HTML::Template( filename => $templatedir."/public/lastgroups.tmpl" );
+my $groups = Vhffs::Panel::Group::get_last_groups( $vhffs );
+my $template = new Vhffs::Panel::Template( filename => $templatedir."/public/lastgroups.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1);
my $hostname = $vhffs->get_config->get_host_name;
-$maintemplate->param( TEXT_TITLE => sprintf( gettext("Last groups on %s") , $hostname ) );
+$template->param( TEXT_TITLE => sprintf( gettext("Last groups on %s") , $hostname ) );
+$template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
+$template->param( GROUPS => $groups );
-
-foreach $group (@{$groups})
-{
- $template = new HTML::Template( filename => $templatedir."/public/misc/lastgroups-part.tmpl" );
-
- $template->param( VALUE_REALNAME => CGI::escapeHTML( $group->get_realname ) );
-
- $template->param( TEXT_GROUPNAME => gettext("Groupname") );
- $template->param( VALUE_GROUPNAME => $group->get_groupname );
- $template->param( TEXT_USERS => gettext("Users") );
-
- $template->param( TEXT_DESCRIPTION => gettext("Description") );
- $template->param( VALUE_DESCRIPTION => CGI::escapeHTML( $group->get_description ) );
-
- my $output = "";
- my $users = $group->get_users;
- my $subtemplate;
- my $user;
- if( ! defined $users )
- {
- $template->param( VALUE_USERS => gettext("No group for this user") );
- }
- else
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/user_part.tmpl" );
-
- foreach $user (@{$users})
- {
- $subtemplate->param( VALUE => $user->get_username );
- $output .= $subtemplate->output;
- }
-
- $template->param( VALUE_USERS => $output );
- }
- $output_final .= $template->output;
-}
-$subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
-$subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-$subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
-$subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
-$subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
-$subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
-$subtemplate->param( LAST_USERS => gettext( "Last users" ) );
-$subtemplate->param( SEARCH => gettext( "Search:" ) );
-
-$maintemplate->param( BANNER => $subtemplate->output );
-
-
-$maintemplate->param( VALUES => $output_final );
-
-$panel->light( $maintemplate );
+$panel->light( $template );
$panel->display;
Modified: trunk/vhffs-public/lastusers.pl
===================================================================
--- trunk/vhffs-public/lastusers.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/lastusers.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,19 +33,14 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Acl;
-use Vhffs::Constants;
use Vhffs::Panel::Main;
-use Vhffs::Conf;
+use Vhffs::Panel::Template;
+use Vhffs::Panel::User;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
@@ -57,69 +52,15 @@
$panel->check_public();
my $template;
-my $users = Vhffs::User::get_last_users( $vhffs );
-my $output_final = "";
-my $user;
-my $maintemplate;
-my $subtemplate;
-
+my $users = Vhffs::Panel::User::get_last_users( $vhffs );
my $hostname = $vhffs->get_config->get_host_name;
-$maintemplate = new HTML::Template( filename => $templatedir."/public/lastusers.tmpl" );
-$maintemplate->param( TEXT_TITLE => sprintf( gettext("Last users on %s") , $hostname ) );
+$template = new Vhffs::Panel::Template( filename => $templatedir."/public/lastusers.tmpl", global_var => 1, die_on_bad_params => 0, loop_context_vars => 1 );
+$template->param( TEXT_TITLE => sprintf( gettext("Last users on %s") , $hostname ) );
+$template->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
+$template->param( USE_AVATAR => $panel->use_users_avatars );
+$template->param( USERS => $users );
-foreach $user (@{$users})
-{
-
- $template = new HTML::Template( filename => $templatedir."/public/misc/lastusers-part.tmpl" );
-
- $template->param( TEXT_TITLE => $user->get_firstname . " " . $user->get_lastname );
-
- $template->param( TEXT_USERNAME => gettext("Username") );
- $template->param( VALUE_USERNAME => $user->get_username );
- $template->param( TEXT_FIRSTNAME => gettext("Firstname") );
- $template->param( VALUE_FIRSTNAME => $user->get_firstname );
- $template->param( TEXT_LASTNAME => gettext("Lastname") );
- $template->param( VALUE_LASTNAME => $user->get_lastname );
- $template->param( TEXT_GROUPS => gettext("Groups") );
- $template->param( IMG_AVATAR => "<img src=\"/getavatar.pl?oid=".$user->get_oid."\" alt=\"".$user->get_firstname." avatar\"/>" ) if( $panel->use_users_avatars );
- $template->param( VALUE_OID => $user->get_oid );
-
- my $output = "";
- my $groups = $user->get_groups;
- my $subtemplate;
- my $group;
- if( ! defined $groups )
- {
- $template->param( VALUE_GROUPS => gettext("No group for this user") );
- }
- else
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/group_part.tmpl" );
-
- foreach $group (@{$groups})
- {
- $subtemplate->param( VALUE => $group->get_groupname );
- $output .= $subtemplate->output;
- }
-
- $template->param( VALUE_GROUPS => $output );
- }
- $output_final .= $template->output;
-}
-
-$subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
-$subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
-$subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
-$subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
-$subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
-$subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
-$subtemplate->param( LAST_USERS => gettext( "Last users" ) );
-$subtemplate->param( SEARCH => gettext( "Search:" ) );
-
-$maintemplate->param( VALUES => $output_final );
-$maintemplate->param( BANNER => $subtemplate->output );
-
-$panel->light( $maintemplate );
+$panel->light( $template );
$panel->display;
Modified: trunk/vhffs-public/rss/lastgroups.pl
===================================================================
--- trunk/vhffs-public/rss/lastgroups.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/rss/lastgroups.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -34,7 +34,7 @@
use lib '%VHFFS_LIB_DIR%';
use Vhffs::Main;
-use Vhffs::User;
+use Vhffs::Panel::Group;
use XML::RSS;
@@ -44,19 +44,15 @@
$url = "" unless defined ( $url = $vhffs->get_config->get_panel->{'url_public'} );
-if( $vhffs->get_config->get_panel->{'rss_groups'} eq 'yes' && $vhffs->get_config->get_panel->{'use_public'} eq 'yes' )
-{
- my $groups = Vhffs::Group::get_last_groups( $vhffs );
+if( $vhffs->get_config->get_panel->{'rss_groups'} eq 'yes' && $vhffs->get_config->get_panel->{'use_public'} eq 'yes' ) {
+ my $groups = Vhffs::Panel::Group::get_last_groups( $vhffs );
my $rss = new XML::RSS( version => '1.0' );
my $title;
- if( defined $vhffs->get_config->get_host_name )
- {
- $title = $vhffs->get_config->get_host_name . " last groups";
- }
- else
- {
+ if( defined $vhffs->get_config->get_host_name ) {
+ $title = 'Last groups on '.$vhffs->get_config->get_host_name;
+ } else {
$title = "VHFFS last groups";
}
@@ -66,6 +62,7 @@
description => "Best hosting platform",
dc => {
date => '2000-08-23T07:00+00:00',
+ subject => 'Last groups on '.$vhffs->get_config->get_host_name,
subject => "danstoncul",
creator => 'vhffs@xxxxxxxxx',
publisher => 'vhffs@xxxxxxxxx',
@@ -83,22 +80,17 @@
]
);
- for( my $i = 0 ; $i < $#{$groups} ; $i++ )
- {
- my $name = $groups->[$i]->get_groupname;
- my $realname = $groups->[$i]->get_realname;
+ foreach(@{$groups}) {
$rss->add_item(
- title => $realname,
- link => "$url/group.pl?name=$name",
+ title => $_->{realname},
+ link => $url.'/group.pl?name='.$_->{groupname},
description => "Vhffs Group",
);
}
$rss->{output} = '2.0';
print "Content-Type: text/xml; charset=utf-8\n\n" . $rss->as_string;
-}
-else
-{
+} else {
use POSIX qw(locale_h);
use locale;
use Locale::gettext;
Modified: trunk/vhffs-public/rss/lastusers.pl
===================================================================
--- trunk/vhffs-public/rss/lastusers.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/rss/lastusers.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -32,11 +32,12 @@
use strict;
use utf8;
+use XML::RSS;
+
use lib '%VHFFS_LIB_DIR%';
use Vhffs::Main;
-use Vhffs::User;
+use Vhffs::Panel::User;
-use XML::RSS;
my $vhffs = init Vhffs::Main;
my $url;
@@ -44,18 +45,13 @@
if( $vhffs->get_config->get_panel->{'rss_users'} eq 'yes' && $vhffs->get_config->get_panel->{'use_public'} eq 'yes' )
{
- my $users = Vhffs::User::get_last_users( $vhffs );
-
my $rss = new XML::RSS( version => '1.0' );
my $title;
- if( defined $vhffs->get_config->get_host_name )
- {
- $title = $vhffs->get_config->get_host_name . " last groups";
+ if( defined $vhffs->get_config->get_host_name ) {
+ $title = 'Last users on '.$vhffs->get_config->get_host_name;
+ } else {
+ $title = "VHFFS last users";
}
- else
- {
- $title = "VHFFS last groups";
- }
$rss->channel(
@@ -80,17 +76,16 @@
'http://dmoz.org/Computers/PC'
]
);
-
- for( my $i = 0 ; $i < $#{$users} ; $i++ )
- {
- my $username = $users->[$i]->get_username;
- $rss->add_item(
- title => $username,
- link => "$url/user.pl?name=$username",
- description => "Vhffs User",
- );
-
- }
+
+ my $users = Vhffs::Panel::User::get_last_users( $vhffs );
+
+ foreach(@{$users}) {
+ $rss->add_item(
+ title => $_->{username},
+ link => $url.'/user.pl?name='.$_->{username},
+ description => 'VHFFS User'
+ );
+ }
$rss->{output} = '2.0';
print "Content-Type: text/xml; charset=utf-8\n\n" . $rss->as_string;
}
Modified: trunk/vhffs-public/templates/allwebsites.tmpl
===================================================================
--- trunk/vhffs-public/templates/allwebsites.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/allwebsites.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,7 +1,7 @@
-<tmpl_var name="BANNER">
+<TMPL_INCLUDE NAME="banner.tmpl">
<div id="public">
-<h1><tmpl_var name="TEXT_TITLE"></h1>
+<h1><TMPL_VAR NAME="TEXT_TITLE"></h1>
<tmpl_if name="LETTERS">
<p style="text-align:center">
<tmpl_loop name="LETTERS">
@@ -14,6 +14,6 @@
</tmpl_if>
</tmpl_if>
<ul>
-<tmpl_var name="VALUES">
+<tmpl_var escape=0 name="VALUES">
</ul>
</div>
Modified: trunk/vhffs-public/templates/banner.tmpl
===================================================================
--- trunk/vhffs-public/templates/banner.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/banner.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,11 +1,12 @@
-<div id="publicbanner">
- <ul>
- <li><a href="<tmpl_var name="URL_PANEL">"><tmpl_var name="BACK_LOGIN"></a></li>
- <li><a href="/index.pl"><tmpl_var name="BACK_PUBLIC"></a></li>
- <li><a href="/lastusers.pl"><tmpl_var name="LAST_USERS"></a></li>
- <li><a href="/lastgroups.pl"><tmpl_var name="LAST_GROUPS"></a></li>
- <li><a href="/allwebsites.pl"><tmpl_var name="WEBSITE_LIST"></a></li>
- <li><tmpl_var name="SEARCH"><form action="/group.pl"><input name="name" type="text"/></form></li>
- </ul>
+<div id="header">
+ <div id="top_menu">
+ <div id="userToolBox">
+ <a href="<tmpl_var name="URL_PANEL">"><img src="/themes/vhffs/images/login.png" alt="<TMPL_I18N KEY="Back to login page">" title="<TMPL_I18N KEY="Back to login page">"/></a>
+ <a href="/index.pl"><img src="/themes/vhffs/images/home.png" alt="<TMPL_I18N KEY="Homepage of public area">" title="<TMPL_I18N KEY="Homepage of public area">"/></a>
+ <a href="/lastusers.pl"><img src="/themes/vhffs/images/users.png" alt="<TMPL_I18N KEY="Last Users">" title="<TMPL_I18N KEY="Last Users">"/></a>
+ <a href="/lastgroups.pl"><img src="/themes/vhffs/images/projects.png" alt="<TMPL_I18N KEY="Last Groups">" title="<TMPL_I18N KEY="Last Groups">"/></a>
+ <a href="/allwebsites.pl"><img src="/themes/vhffs/images/webs.png" alt="<TMPL_I18N KEY="List of all websites">" title="<TMPL_I18N KEY="List of all websites">"/></a>
+ </div>
+ </div>
</div>
Modified: trunk/vhffs-public/templates/group.tmpl
===================================================================
--- trunk/vhffs-public/templates/group.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/group.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,48 +1,16 @@
-<tmpl_var name="BANNER">
-
- <h1><tmpl_var name="VALUE_REALNAME"></h1>
-
-
- <p>
- <tmpl_var name="TEXT_GROUPNAME">: <tmpl_var name="VALUE_GROUPNAME">
- <br/>
- <tmpl_var name="TEXT_DESCRIPTION">: <tmpl_var name="VALUE_DESCRIPTION">
- <br/>
- <tmpl_var name="TEXT_USERS">: <tmpl_var name="VALUE_USERS">
- </p>
-
-
- <p>
- <h2><tmpl_var name="WEBSITES_TITLE"></h2>
- <ul>
- <tmpl_var name="WEBSITES_VALUE">
- </ul>
- </p>
-
- <p>
- <h2><tmpl_var name="CVS_TITLE"></h2>
- <ul>
- <tmpl_var name="CVS_VALUE">
- </ul>
- </p>
-
- <p>
- <h2><tmpl_var name="SVN_TITLE"></h2>
- <ul>
- <tmpl_var name="SVN_VALUE">
- </ul>
- </p>
-
- <p>
- <h2><tmpl_var name="GIT_TITLE"></h2>
- <ul>
- <tmpl_var name="GIT_VALUE">
- </ul>
- </p>
-
- <p>
- <h2><tmpl_var name="LISTS_TITLE"></h2>
- <ul>
- <tmpl_var name="LISTS_VALUE">
- </ul>
- </p>
+<TMPL_INCLUDE NAME="banner.tmpl">
+<div id="public">
+<h1><TMPL_VAR NAME="VALUE_REALNAME"></h1>
+<ul>
+ <li><TMPL_I18N KEY="Groupname">: <TMPL_VAR NAME="VALUE_GROUPNAME"></li>
+ <li><TMPL_INCLUDE NAME="user_part.tmpl"></li>
+</ul>
+<fieldset><legend><TMPL_I18N KEY="Description"></legend>
+<TMPL_VAR ESCAPE=1 NAME="VALUE_DESCRIPTION">
+</fieldset>
+<TMPL_INCLUDE NAME="misc/web-part.tmpl">
+<TMPL_INCLUDE NAME="misc/cvs-part.tmpl">
+<TMPL_INCLUDE NAME="misc/svn-part.tmpl">
+<TMPL_INCLUDE NAME="misc/git-part.tmpl">
+<TMPL_INCLUDE NAME="misc/list-part.tmpl">
+</div>
Modified: trunk/vhffs-public/templates/group_part.tmpl
===================================================================
--- trunk/vhffs-public/templates/group_part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/group_part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1 +1,8 @@
-<a href="group.pl?name=<tmpl_var name="VALUE">"><tmpl_var name="VALUE"></a>
+<TMPL_IF NAME="GROUPS">
+ <TMPL_I18N KEY="Groups">:
+ <TMPL_LOOP NAME="GROUPS">
+ <a href="/group.pl?name=<TMPL_VAR NAME="GROUPNAME">"><TMPL_VAR NAME="GROUPNAME"></a><TMPL_UNLESS NAME="__LAST__">,</TMPL_UNLESS>
+ </TMPL_LOOP>
+<TMPL_ELSE>
+ <TMPL_I18N KEY="No group">
+</TMPL_IF>
Modified: trunk/vhffs-public/templates/index.tmpl
===================================================================
--- trunk/vhffs-public/templates/index.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/index.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,65 +1,52 @@
-<tmpl_var name="BANNER">
+<TMPL_INCLUDE NAME="banner.tmpl">
+<div id="public">
+ <h1><TMPL_VAR NAME="TEXT_TITLE"></h1>
- <div id="public">
- <h1><tmpl_var name="TEXT_TITLE"></h1>
+ <h2><TMPL_I18N KEY="Users"></h2>
+ <ul>
+ <li><a href="/lastusers.pl"><TMPL_I18N KEY="Last users"></a></li>
+ </ul>
+ <fieldset>
+ <legend><TMPL_I18N KEY="Search an user"></legend>
+ <form method="post" action="/searchuser.pl">
+ <p><label for="search_username"><TMPL_I18N KEY="Username">:</label>
+ <input type="text" name="username" id="search_username"/></p>
+ <p><label for="search_firstname"><TMPL_I18N KEY="Firstname">:</label>
+ <input type="text" name="first" id="search_firstname"/></p>
+ <p><label for="search_lastname"><TMPL_I18N KEY="Lastname">:</label>
+ <input type="text" name="lastname" id="search_lastname"/></p>
+ <p><input type="submit" name="search_user_submit" value="<TMPL_I18N KEY="Search">"/></p>
+ </form>
+ </fieldset>
-
- <div class="public_align_left">
- <p>
- <h2><tmpl_var name="USERS_TITLE"></h2>
- <ul>
-
- <li>
- <a href="lastusers.pl"><tmpl_var name="TEXT_LASTUSERS"></a>
- </li>
- <li>
- <form method="post" action="user.pl">
- <input type="text" name="name"/>
- <input type="submit" value="<tmpl_var name="TEXT_SEARCH_USER">"/>
- </form>
- </li>
- </ul>
- </p>
- </div>
+ <h2><TMPL_I18N KEY="Groups/Projects"></h2>
+ <ul>
+ <li><a href="/lastgroups.pl"><TMPL_I18N KEY="Last Groups"></a></li>
+ <li><a href="/allgroups.pl"><TMPL_I18N KEY="All Groups"></a></li>
+ </ul>
+ <fieldset>
+ <legend><TMPL_I18N KEY="Search a group"></legend>
+ <form method="post" action="/group.pl">
+ <p><label for="search_groupname"><TMPL_I18N KEY="Groupname">:</label>
+ <input type="text" name="groupname" id="search_groupname"/></p>
+ <p><label for="search_description"><TMPL_I18N KEY="Description contains">:</label>
+ <input type="text" name="description" id="search_description"/></p>
+ <p><input type="submit" name="search_group_submit" value="<TMPL_I18N KEY="Search">"/></p>
+ </form>
+ </fieldset>
- <div class="public_align_right">
- <p>
- <h2><tmpl_var name="GROUPS_TITLE"></h2>
- <ul>
-
- <li>
- <a href="lastgroups.pl"><tmpl_var name="TEXT_LASTGROUPS"></a>
- </li>
- <li>
- <a href="allgroups.pl"><tmpl_var name="TEXT_ALLGROUPS"></a>
- </li>
- <li>
- <form method="post" action="group.pl">
- <input type="text" name="name"/>
- <input type="submit" value="<tmpl_var name="TEXT_SEARCH_GROUP">"/>
- </form>
- </li>
- </ul>
- </p>
- </div>
+ <h2><TMPL_I18N KEY="Websites"></h2>
+ <ul>
+ <li><a href="/allwebsites.pl"><TMPL_I18N KEY="All Websites"></a></li>
+ </ul>
+ <fieldset>
+ <legend><TMPL_I18N KEY="Search a website"></legend>
+ <form method="post" action="/website.pl">
+ <p><label for="search_servername"><TMPL_I18N KEY="Website name">:</label>
+ <input type="text" name="servername" id="search_servername"/></p>
+ <p><input type="submit" name="search_website_submit" value="<TMPL_I18N KEY="Search">"/></p>
+ </form>
+ </fieldset>
- <div class="public_align_left">
- <p>
- <h2><tmpl_var name="WEBSITES_TITLE"></h2>
- <ul>
-
- <li>
- <a href="allwebsites.pl"><tmpl_var name="TEXT_WEBSITES"></a>
- </li>
- <li>
- <form method="post" action="websearch.pl">
- <input type="text" name="name"/>
- <input type="submit" value="<tmpl_var name="TEXT_SEARCH_WEBSITE">"/>
- </form>
- </li>
- </ul>
- </p>
- </div>
-
- </div>
+</div>
Modified: trunk/vhffs-public/templates/lastgroups.tmpl
===================================================================
--- trunk/vhffs-public/templates/lastgroups.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/lastgroups.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,4 +1,4 @@
-<tmpl_var name="BANNER">
+<TMPL_INCLUDE NAME="banner.tmpl">
<div id="public">
<h1><tmpl_var name="TEXT_TITLE"></h1>
@@ -13,5 +13,5 @@
<p style="text-align:center;font-weight:bold;"><tmpl_var name="MESSAGE"></p>
</tmpl_if>
</tmpl_if>
-<tmpl_var name="VALUES">
+<TMPL_INCLUDE NAME="misc/lastgroups-part.tmpl">
</div>
Modified: trunk/vhffs-public/templates/lastusers.tmpl
===================================================================
--- trunk/vhffs-public/templates/lastusers.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/lastusers.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,9 +1,28 @@
-<tmpl_var name="BANNER">
+<TMPL_INCLUDE NAME="banner.tmpl">
<div id="public">
<h1><tmpl_var name="TEXT_TITLE"></h1>
-<p>
-<tmpl_var name="VALUES">
-</p>
+<TMPL_LOOP NAME="USERS">
+<h2><tmpl_var name="USERNAME"></h2>
+<TMPL_IF NAME="USE_AVATAR">
+<img src="/getavatar.pl?oid=<tmpl_var name="OBJECT_ID">" alt="<tmpl_var
+name="USERNAME"> avatar" class="avatar"/>
+</TMPL_IF>
+<ul>
+<li>
+<TMPL_I18N KEY="Username">: <tmpl_var name="USERNAME">
+</li>
+<li>
+<TMPL_I18N KEY="Firstname">: <tmpl_var name="FIRSTNAME">
+</li>
+<li>
+<TMPL_I18N KEY="Lastname">: <tmpl_var name="LASTNAME">
+</li>
+<li>
+<TMPL_INCLUDE NAME="group_part.tmpl">
+</li>
+</ul>
+<div class="clear"></div>
+</TMPL_LOOP>
</div>
Modified: trunk/vhffs-public/templates/misc/cvs-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/cvs-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/cvs-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1 +1,8 @@
-<a href="<tmpl_var name="CVSURL">"><tmpl_var name="CVSROOT"></a> - <tmpl_var name="TEXT_GROUPNAME"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a> - <tmpl_var name="DESCRIPTION"><br/>
+<TMPL_IF NAME="CVSREPOS">
+<h2><TMPL_I18N KEY="CVS Repositories for this Group"></h2>
+<ul>
+<TMPL_LOOP NAME="CVSREPOS">
+<li><a href="<TMPL_VAR NAME="WEBCVS">/<TMPL_VAR NAME="CVSROOT">"><tmpl_var name="CVSROOT"></a> — <tmpl_var name="DESCRIPTION"></li>
+</TMPL_LOOP>
+</ul>
+</TMPL_IF>
Modified: trunk/vhffs-public/templates/misc/git-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/git-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/git-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1 +1,12 @@
-<a href="<tmpl_var name="GITURL">"><tmpl_var name="GITROOT"></a> - <tmpl_var name="TEXT_GROUPNAME"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a> - <tmpl_var name="DESCRIPTION"><br/>
+<TMPL_IF NAME="GITREPOS">
+<h2><TMPL_I18N KEY="Git Repositories for this group"></h2>
+<ul>
+<TMPL_LOOP NAME="GITREPOS">
+<li><a href="<TMPL_VAR NAME="WEBGIT">/<TMPL_VAR NAME="REPONAME">"><TMPL_VAR NAME="REPONAME"></a>
+<TMPL_IF NAME="GROUPNAME">
+— <TMPL_I18N KEY="Owned by"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a>
+</TMPL_IF>
+— <TMPL_VAR NAME="DESCRIPTION"></li>
+</TMPL_LOOP>
+</ul>
+</TMPL_IF>
Modified: trunk/vhffs-public/templates/misc/lastgroups-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/lastgroups-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/lastgroups-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,16 +1,8 @@
-
-<h2><a href="group.pl?name=<tmpl_var name="VALUE_GROUPNAME">"><tmpl_var name="VALUE_REALNAME"></a></h2>
-
+<TMPL_LOOP NAME="GROUPS">
+<h2><a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="REALNAME"></a></h2>
<ul>
-<li><tmpl_var name="TEXT_GROUPNAME">
-<tmpl_var name="VALUE_GROUPNAME">
-</li>
-<li>
-<tmpl_var name="TEXT_USERS">
-<tmpl_var name="VALUE_USERS">
-</li>
-<li>
-<tmpl_var name="TEXT_DESCRIPTION">
-<tmpl_var name="VALUE_DESCRIPTION">
-</li>
+<li><TMPL_I18N KEY="Groupname">: <TMPL_VAR NAME="GROUPNAME"></li>
+<li><TMPL_I18N KEY="Users">: <TMPL_INCLUDE NAME="../user_part.tmpl"></li>
+<li><TMPL_I18N KEY="Description">: <tmpl_var name="DESCRIPTION"></li>
</ul>
+</TMPL_LOOP>
Modified: trunk/vhffs-public/templates/misc/lastusers-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/lastusers-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/lastusers-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,7 +1,8 @@
<div class="public_user">
<h2><tmpl_var name="TEXT_TITLE"></h2>
-<!-- <img src="/getavatar.pl?oid=<tmpl_var name="VALUE_OID">" alt="<tmpl_var name="VALUE_USERNAME"> avatar"/> -->
-<tmpl_var name="IMG_AVATAR">
+<TMPL_IF NAME="USE_AVATAR">
+<img src="/getavatar.pl?oid=<tmpl_var name="VALUE_OID">" alt="<tmpl_var name="VALUE_USERNAME"> avatar" class="avatar"/>
+</TMPL_IF>
<ul>
<li>
<tmpl_var name="TEXT_USERNAME">
@@ -20,4 +21,5 @@
<tmpl_var name="VALUE_GROUPS">
</li>
</ul>
+<div class="clear"></div>
</div>
Modified: trunk/vhffs-public/templates/misc/list-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/list-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/list-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,3 +1,11 @@
+<TMPL_IF NAME="LISTS">
+<h2><TMPL_I18N KEY="Mailing lists for this group"></h2>
+<ul>
+<TMPL_LOOP NAME="LISTS">
<li>
-<tmpl_var expr="obfuscate_email(LISTNAME)"> <a href="<tmpl_var name="ARCHIVESURL">/<tmpl_var name="DOMAIN">/<tmpl_var name="LOCALPART">"><tmpl_var name="ARCHIVES_TEXT"></a>
+<a href="<TMPL_VAR NAME="ARCHIVESURL">/<TMPL_VAR NAME="DOMAIN">/<TMPL_VAR NAME="LOCAL_PART">" title="<TMPL_I18N KEY="View Archives">"><TMPL_VAR EXPR="obfuscate_email(LISTNAME)"></a>
+— <TMPL_VAR NAME="DESCRIPTION">
</li>
+</TMPL_LOOP>
+</ul>
+</TMPL_IF>
Modified: trunk/vhffs-public/templates/misc/svn-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/svn-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/svn-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1 +1,13 @@
-<a href="<tmpl_var name="SVNURL">"><tmpl_var name="SVNROOT"></a> - <tmpl_var name="TEXT_GROUPNAME"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a> - <tmpl_var name="DESCRIPTION"><br/>
+<TMPL_IF NAME="SVNREPOS">
+<h2><TMPL_I18N KEY="Subversion repositories for this group"></h2>
+<ul>
+ <TMPL_LOOP NAME="SVNREPOS">
+ <li><a href="<TMPL_VAR NAME="WEBSVN">/<TMPL_VAR NAME="REPONAME">"><TMPL_VAR NAME="REPONAME"></a>
+ <TMPL_IF NAME="GROUPNAME">
+ — <TMPL_I18N KEY="Owned by"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a>
+ </TMPL_IF>
+ — <tmpl_var name="DESCRIPTION"></li>
+ </TMPL_LOOP>
+</ul>
+</TMPL_IF>
+
Modified: trunk/vhffs-public/templates/misc/web-part.tmpl
===================================================================
--- trunk/vhffs-public/templates/misc/web-part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/misc/web-part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,3 +1,10 @@
+<TMPL_IF NAME="WEBSITES">
+<h2><TMPL_VAR NAME="WEBSITES_TITLE"></h2>
+<ul>
+<TMPL_LOOP NAME="WEBSITES">
<li>
-<a href="http://<tmpl_var name="SERVERNAME">"><tmpl_var name="SERVERNAME"></a> - <tmpl_var name="TEXT_GROUPNAME"> <a href="group.pl?name=<tmpl_var name="GROUPNAME">"><tmpl_var name="GROUPNAME"></a> - <tmpl_var name="DESCRIPTION"><br/>
+<a href="http://<tmpl_var name="SERVERNAME">"><tmpl_var name="SERVERNAME"></a> — <tmpl_var name="DESCRIPTION">
</li>
+</TMPL_LOOP>
+</ul>
+</TMPL_IF>
Modified: trunk/vhffs-public/templates/user.tmpl
===================================================================
--- trunk/vhffs-public/templates/user.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/user.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1,18 +1,15 @@
-<tmpl_var name="BANNER">
+<TMPL_INCLUDE NAME="banner.tmpl">
-<div class="public_user">
+<div id="public">
<h1><tmpl_var name="VALUE_USERNAME"></h1>
-<!-- <img src="/getavatar.pl?oid=<tmpl_var name="VALUE_OID">" alt="<tmpl_var name="VALUE_USERNAME"> avatar"/> -->
-<tmpl_var name="IMG_AVATAR">
-<p>
-<tmpl_var name="TEXT_USERNAME">: <tmpl_var name="VALUE_USERNAME">
-<br/>
-<tmpl_var name="TEXT_FIRSTNAME">: <tmpl_var name="VALUE_FIRSTNAME">
-<br/>
-<tmpl_var name="TEXT_LASTNAME">: <tmpl_var name="VALUE_LASTNAME">
-<br/>
-<tmpl_var name="TEXT_GROUPS">: <tmpl_var name="VALUE_GROUPS">
-<p>
-<tmpl_var name="VALUES">
-</p>
+<TMPL_IF NAME="USE_AVATAR">
+<img src="/getavatar.pl?oid=<TMPL_VAR NAME="VALUE_OID">" alt="<TMPL_VAR NAME="VALUE_USERNAME">" class="avatar"/>
+</TMPL_IF>
+<tmpl_var escape=0 name="IMG_AVATAR">
+<ul>
+ <li><TMPL_I18N KEY="Username">: <tmpl_var name="VALUE_USERNAME"></li>
+ <li><TMPL_I18N KEY="Firstname">: <tmpl_var name="VALUE_FIRSTNAME"></li>
+ <li><TMPL_I18N KEY="Lastname">: <tmpl_var name="VALUE_LASTNAME"></li>
+ <li><TMPL_INCLUDE NAME="group_part.tmpl"></li>
+</ul>
</div>
Modified: trunk/vhffs-public/templates/user_part.tmpl
===================================================================
--- trunk/vhffs-public/templates/user_part.tmpl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/templates/user_part.tmpl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -1 +1,8 @@
-<a href="user.pl?name=<tmpl_var name="VALUE">"><tmpl_var name="VALUE"></a>
+<TMPL_IF NAME="USERS">
+ <TMPL_I18N KEY="Users">:
+ <TMPL_LOOP NAME="USERS">
+ <a href="/user.pl?name=<TMPL_VAR NAME="USERNAME">"><TMPL_VAR NAME="USERNAME"></a><TMPL_UNLESS NAME="__LAST__">,</TMPL_UNLESS>
+ </TMPL_LOOP>
+<TMPL_ELSE>
+ <TMPL_I18N KEY="No user">
+</TMPL_IF>
Modified: trunk/vhffs-public/user.pl
===================================================================
--- trunk/vhffs-public/user.pl 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-public/user.pl 2007-11-04 16:36:25 UTC (rev 1062)
@@ -33,98 +33,45 @@
use utf8;
use POSIX qw(locale_h);
-use HTML::Template;
use locale;
use Locale::gettext;
use CGI;
-use CGI::Session;
use lib '%VHFFS_LIB_DIR%';
-use Vhffs::User;
-use Vhffs::Group;
-use Vhffs::Main;
-use Vhffs::Acl;
-use Vhffs::Constants;
use Vhffs::Panel::Main;
-use Vhffs::Functions;
+use Vhffs::Panel::Template;
+use Vhffs::Panel::User;
+use Vhffs::User;
my $panel = new Vhffs::Panel::Main();
exit 0 unless $panel;
-my $vhffs = $panel->{'vhffs'};
-my $templatedir = $panel->{'templatedir'};
-my $cgi = $panel->{'cgi'};
-
$panel->check_public();
+my $cgi = $panel->{cgi};
+my $vhffs = $panel->{vhffs};
+my $templatedir = $panel->{templatedir};
+my $username = $cgi->param('name');
+my $user;
my $template;
-my $subtemplate;
-my $name = $cgi->param("name");
-$name = Vhffs::Functions::check_arg( $name );
-
-my $user;
-
-if( ! defined $name )
-{
- $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
- my $message = gettext( "CGI ERROR!");
- $template->param( MESSAGE => $message );
+if(!defined $username) {
+ $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
+ my $message = gettext( "CGI ERROR!");
+ $template->param( MESSAGE => $message );
+} elsif(!defined($user = Vhffs::User::get_by_username($vhffs, $username))) {
+ $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
+ my $message = gettext( "CGI ERROR!");
+ $template->param( MESSAGE => $message );
+} else {
+ $template = new Vhffs::Panel::Template( filename => $templatedir.'/public/user.tmpl', loop_context_vars => 1, die_on_bad_params => 0);
+ $template->param( VALUE_OID => $user->get_oid );
+ $template->param( VALUE_USERNAME => $user->get_username );
+ $template->param( VALUE_FIRSTNAME => $user->get_firstname );
+ $template->param( VALUE_LASTNAME => $user->get_lastname );
+ $template->param( GROUPS => Vhffs::Panel::User::get_groups($user) );
+ $template->param( USE_AVATAR => $panel->use_users_avatars );
}
-elsif( ! defined ($user= Vhffs::User::get_by_username( $vhffs , $name ) ) )
-{
- $template = new HTML::Template( filename => $templatedir.'/public/simplemsg.tmpl' );
- my $message = gettext( "No such user");
- $template->param( MESSAGE => $message );
-
-}
-else
-{
- $template = new HTML::Template( filename => $templatedir."/public/user.tmpl" );
- $template->param( TEXT_USERNAME => gettext("Username") );
- $template->param( VALUE_USERNAME => $user->get_username );
- $template->param( TEXT_FIRSTNAME => gettext("Firstname") );
- $template->param( VALUE_FIRSTNAME => $user->get_firstname );
- $template->param( TEXT_LASTNAME => gettext("Lastname") );
- $template->param( VALUE_LASTNAME => $user->get_lastname );
- $template->param( TEXT_GROUPS => gettext("Groups") );
- $template->param( IMG_AVATAR => "<img src=\"/getavatar.pl?oid=".$user->get_oid."\" alt=\"".$user->get_firstname." avatar\"/>" ) if( $panel->use_users_avatars );
- $template->param( VALUE_OID => $user->get_oid );
-
-
- my $output = "";
- my $groups = $user->get_groups;
- my $subtemplate;
- my $group;
- if( ! defined $groups )
- {
- $template->param( VALUE_GROUPS => gettext("No group for this user") );
- }
- else
- {
- $subtemplate = new HTML::Template( filename => $templatedir."/public/group_part.tmpl" );
-
- foreach $group (@{$groups})
- {
- $subtemplate->param( VALUE => $group->get_groupname );
- $output .= $subtemplate->output;
- }
-
- $template->param( VALUE_GROUPS => $output );
- }
- $subtemplate = new HTML::Template( filename => $templatedir."/public/banner.tmpl" );
- $subtemplate->param( URL_PANEL => $vhffs->get_config->get_panel->{'url'} );
- $subtemplate->param( BACK_PUBLIC => gettext( "Homepage of public area") );
- $subtemplate->param( BACK_LOGIN => gettext( "Go on login page" ) );
- $subtemplate->param( WEBSITE_LIST => gettext( "List of all websites" ) );
- $subtemplate->param( LAST_GROUPS => gettext( "Last groups" ) );
- $subtemplate->param( LAST_USERS => gettext( "Last users" ) );
- $subtemplate->param( SEARCH => gettext( "Search:" ) );
-
- $template->param( BANNER => $subtemplate->output );
-
-}
-
$panel->light( $template );
$panel->display;
Modified: trunk/vhffs-themes/vhffs/main.css
===================================================================
--- trunk/vhffs-themes/vhffs/main.css 2007-11-03 02:49:44 UTC (rev 1061)
+++ trunk/vhffs-themes/vhffs/main.css 2007-11-04 16:36:25 UTC (rev 1062)
@@ -36,13 +36,15 @@
#public
{
margin-top: 5em;
+ width:575px;
+ margin-right:auto;
+ margin-left:auto;
}
#public h1
{
font-size: 3em;
padding-right: 2em;
- text-align: right;
}
#public h2
@@ -50,6 +52,11 @@
font-size: 2em;
}
+#public img.avatar {
+ float: left;
+ margin-right:2em;
+ border: 1px solid black;
+}
input, textarea, select {
color: black;
@@ -167,6 +174,7 @@
padding-top: 0;
z-index:1;
display: block;
+ top: 0;
}
#contextual_menu {
@@ -190,7 +198,7 @@
margin-right:0.1em;
}
-div#username_menu {
+div#top_menu {
width:350px;
text-align:right;
position:absolute;
@@ -477,35 +485,6 @@
float: right;
}
-.public_user h1 , .public_user h2
-{
- float: left;
- font-size: 1.2em;
- margin-left: 1em;
-}
-
-.public_user
-{
- border: thin solid black;
- margin-top: 5em;
- margin-left: 25%;
- width: 400px;
-}
-
-.public_user p , .public_user ul
-{
- margin-top: 6em;
-}
-
-.public_user img
-{
- position: relative;
- float: right;
- margin-top: 3em;
- margin-right: 1em;
-}
-
-
#publicbanner {
color: white;
position: absolute;