summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Haas2009-05-22 19:23:33 +0000
committerRobert Haas2009-05-22 19:23:33 +0000
commita60a6817d968c50d06958d4010cee84afbb58502 (patch)
treea3f38fd5c60722e786e732ce798b894deeda8630
parent5bc9ab5aee7ff20941e0ea6a42aa9c80e5f8f946 (diff)
Log in/log out links.
In passing, fix a wrong identifier in PgCommitFest::DB::delete, fix session cookie path in PgCommitFest::Handler::login and remove an unnecessary trace setting, and rip out some superfluous CSS code.
-rw-r--r--html/layout/css/blue/commitfest.css110
-rw-r--r--perl-lib/PgCommitFest/DB.pm4
-rw-r--r--perl-lib/PgCommitFest/Handler.pm14
-rw-r--r--perl-lib/PgCommitFest/Request.pm1
-rw-r--r--template/header.tt221
5 files changed, 40 insertions, 110 deletions
diff --git a/html/layout/css/blue/commitfest.css b/html/layout/css/blue/commitfest.css
index 5a7df94..e23729e 100644
--- a/html/layout/css/blue/commitfest.css
+++ b/html/layout/css/blue/commitfest.css
@@ -27,7 +27,11 @@ body {
height: 83px;
margin: 0px;
padding: 0px;
- display: block;
+ width: 100%
+}
+
+#commitfestHeader tr {
+ vertical-align: top
}
#commitfestHeaderLogo {
@@ -42,76 +46,14 @@ body {
#commitfestHeaderLogo img { border: 0px; }
-#commitfestNavSearchContainer {
- padding-bottom: 2px;
-}
-
#commitfestNav {
position: relative;
- text-align: left;
+ text-align: right;
margin-left: 10px;
margin-top: 5px;
- color: #666;
- font-size: 0.95em;
-}
-
-#commitfestSearch {
- position: relative;
- text-align: right;
- padding: 0;
- margin: 0;
- color: #666;
-}
-
-#commitfestTextSize {
- text-align: right;
- white-space: nowrap;
- margin-top: 7px;
- font-size: 0.95em;
-}
-
-#commitfestSearch form {
- position: relative;
- top: 5px;
- right: 0;
- margin: 0; /* need for IE Mac */
- text-align: right; /* need for IE Mac */
- white-space: nowrap; /* for Opera */
-}
-
-#commitfestSearch form label { color: #666; font-size: 0.95em; }
-#commitfestSearch form input { font-size: 0.95em; }
-
-#commitfestSearch form #submit {
- font-size: 0.95em;
- background: #7A7A7A;
- color: #fff;
- border-right: 1px solid #7A7A7A;
- border-bottom: 1px solid #7A7A7A;
- border-top: 1px solid #7A7A7A;
- border-left: 1px solid #7A7A7A;
- padding: 1px 4px;
-}
-
-#commitfestSearch form #q {
- width: 170px;
- font-size: 0.95em;
- border: 1px solid #7A7A7A;
- background: #E1E1E1;
- color: #000000;
- padding: 2px;
-}
-
-.frmDocSearch {
- padding: 0;
- margin: 0;
- display: inline;
-}
-
-.inpDocSearch {
- padding: 0;
- margin: 0;
- color: #000;
+ color: #fff;
+ font-weight: bold;
+ font-size: 0.95em
}
#commitfestContent {
@@ -130,16 +72,6 @@ body {
margin-right: 10px;
}
-#commitfestComments {
- margin-top: 10px;
-}
-
-#commitfestClear {
- clear: both;
- margin: 0;
- padding: 0;
-}
-
/* Heading Definitions */
h1 {
@@ -170,32 +102,10 @@ p, ol, ul, li {
line-height: 1.5em;
}
-.txtCommentsWrap {
- border: 2px solid #F5F5F5;
- width: 100%;
-}
-
-.txtCommentsContent {
- background: #F5F5F5;
- padding: 3px;
-}
-
-.txtCommentsPoster {
- float: left;
-}
-
-.txtCommentsDate {
- float: right;
-}
-
-.txtCommentsComment {
- padding: 3px;
-}
-
/* Link Styles */
#commitfestNav a {
- font-weight: bold;
+ color: #ffffff
}
diff --git a/perl-lib/PgCommitFest/DB.pm b/perl-lib/PgCommitFest/DB.pm
index c0d4e49..0cd3b7d 100644
--- a/perl-lib/PgCommitFest/DB.pm
+++ b/perl-lib/PgCommitFest/DB.pm
@@ -26,11 +26,11 @@ sub delete {
while (my ($k, $v) = each %$criteria) {
if (ref $v) {
push @where,
- $self->{'dbh'}->quote_identifier($table) . ' = ' . $$v;
+ $self->{'dbh'}->quote_identifier($k) . ' = ' . $$v;
}
else {
push @where,
- $self->{'dbh'}->quote_identifier($table) . ' = ?';
+ $self->{'dbh'}->quote_identifier($k) . ' = ?';
push @bind, $v;
}
}
diff --git a/perl-lib/PgCommitFest/Handler.pm b/perl-lib/PgCommitFest/Handler.pm
index 72b0c4f..b2a32ad 100644
--- a/perl-lib/PgCommitFest/Handler.pm
+++ b/perl-lib/PgCommitFest/Handler.pm
@@ -109,11 +109,10 @@ EOM
sysread(RANDOM_BITS, $random_bits, 16);
close(RANDOM_BITS);
my $session_cookie = unpack("H*", $random_bits);
- $r->db->{'trace'} = 1;
$r->db->insert('session', { 'id' => $session_cookie,
'username' => $u->{'username'} });
$r->db->commit;
- $r->header('Set-Cookie', "session=$session_cookie");
+ $r->header('Set-Cookie', "session=$session_cookie; path=/");
$r->redirect($value{'uri'} ne '' ? $value{'uri'} : '/');
}
else {
@@ -125,4 +124,15 @@ EOM
$r->render_template('login');
}
+sub logout {
+ my ($r) = @_;
+ $r->header('Set-Cookie', "session=; path=/");
+ my $session = $r->cookie('session');
+ if (defined $r->cookie('session')) {
+ $r->db->delete('session', { 'id' => $r->cookie('session') });
+ $r->db->commit();
+ }
+ $r->redirect('/');
+}
+
1;
diff --git a/perl-lib/PgCommitFest/Request.pm b/perl-lib/PgCommitFest/Request.pm
index 7f99b2e..7e3e878 100644
--- a/perl-lib/PgCommitFest/Request.pm
+++ b/perl-lib/PgCommitFest/Request.pm
@@ -170,6 +170,7 @@ sub render_template {
%stash = %$vars if defined $vars;
$stash{'control'} = $self->{'control'};
$template->process('header.tt2', {
+ 'authenticate' => $self->authenticate(),
'link' => $self->{'link'},
'title' => $self->{'title'},
'error_list' => $self->{'error_list'},
diff --git a/template/header.tt2 b/template/header.tt2
index aee22b4..561259c 100644
--- a/template/header.tt2
+++ b/template/header.tt2
@@ -2,16 +2,25 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en" dir="ltr">
<head>
- <title>PostgreSQL CommitFest Management[% IF title != '' %]: [% title %][% END %]</title>
+ <title>PostgreSQL CommitFest Management[% IF title != '' %]: [% title | htmlsafe %][% END %]</title>
<style type="text/css" media="screen" title="Normal Text">@import url("/https/git.postgresql.org/layout/css/blue/commitfest.css");</style>
<script type="text/javascript" src="/https/git.postgresql.org/layout/js/geckostyle.js"></script>
</head>
<body>
-<div id="commitfestHeader">
- <div id="commitfestHeaderLogo">
- <a href="/" title="PostgreSQL"><img src="/https/git.postgresql.org/layout/images/docs/hdr_logo.png" width="206" height="80" alt="PostgreSQL" /></a>
- </div>
-</div>
+<table id="commitfestHeader">
+ <tr>
+ <td>
+ <div id="commitfestHeaderLogo">
+ <a href="/" title="PostgreSQL"><img src="/https/git.postgresql.org/layout/images/docs/hdr_logo.png" width="206" height="80" alt="PostgreSQL" /></a>
+ </div>
+ </td>
+ <td id="commitfestNav">
+ [% IF authenticate.username.defined %]Welcome, [% authenticate.username | htmlsafe %] - <a href='/https/git.postgresql.org/action/logout'>Log Out</a>
+ [% ELSE %]<a href='/https/git.postgresql.org/action/login'>Log In</a>
+ [% END %]
+ </td>
+ </tr>
+</table>
<div id="commitfestContent">
<table cellspacing='0' cellpadding='0' border='0' width='100%'>