| Revision 2 (by moose, 2006/07/10 13:21:14) |
initial import
|
#!/usr/bin/perl
package main;
use strict;
use warnings;
use CGI::Carp qw/fatalsToBrowser/;
use CGI::Pretty qw/:all *table *TR *Tr *td *div *span *label/;
use Session;
use SVNACL;
use File::Spec::Functions;
use File::Basename;
umask 0000;
our $q = new CGI;
our $session = new Session(BASE_PATH => '/home/svn/htdocs/admin/', NAME => 'SID');
our $acl = new SVNACL(digest => 'Crypt', svn_conf => '/var/svn/conf', svn_parent => '/var/svn/repos');
our $login_info;
our $username = quotemeta $session->key('username');
if($session->key_exists('loggedin')) {
$login_info =
start_div({-class=>'login_info_box'}) .
'Currently logged in as ' . a({-href => uri("user.pl")}, $session->key('username')) . ' || ' .
a({-href => uri('logout.pl')}, 'Logout') .
end_div();
}
else {
}
our $header = start_html({-style => 'style.css', -title => 'Subversion Admin'}) .
start_div({-class => 'page'}) .
img({-src=>'/admin/subversion_logo.jpg'}) . br() .
$login_info;
our $footer = end_div() . end_html();
# conf
our $uri_path = '/admin/';
our $uri = 'http://svn.tomasu.org/';
sub header {
return $q->header(-cookie => $session->cookie(), -type => 'text/html');
}
sub redirect {
my %p = @_;
return $q->redirect(%p, -cookie => $session->cookie());
}
sub uri {
my ($dummy, $path) = fileparse(url(-full => 0, -absolute => 1));
my $base = url(-base => 1);
return $base . catfile($path,@_);
}
END {
undef $acl;
undef $session;
} # make sure the acl data is saved.