]> mj.ucw.cz Git - pciids.git/commitdiff
Show first part of email if login name is not present
authorMichal Vaner <vorner@ucw.cz>
Sun, 31 Aug 2008 16:47:06 +0000 (18:47 +0200)
committerMichal Vaner <vorner@ucw.cz>
Sun, 31 Aug 2008 16:47:06 +0000 (18:47 +0200)
PciIds/DBQ.pm
PciIds/Html/List.pm

index e3932f128a69eee92e2a9b94621446456b63bc82..4eeb33e42dbc32ab771951a9900c98213abc1073 100644 (file)
@@ -29,7 +29,7 @@ sub new( $ ) {
                'rights' => 'SELECT rightId FROM rights WHERE userId = ?',
                'newitem' => 'INSERT INTO locations (id, parent) VALUES(?, ?)',
                'newhistory' => 'INSERT INTO history (location, owner, discussion, nodename, nodenote) VALUES(?, ?, ?, ?, ?)',
-               'history' => 'SELECT history.id, history.discussion, history.time, history.nodename, history.nodenote, history.seen, users.login FROM history LEFT OUTER JOIN users ON history.owner = users.id WHERE history.location = ? ORDER BY history.time',
+               'history' => 'SELECT history.id, history.discussion, history.time, history.nodename, history.nodenote, history.seen, users.login, users.email FROM history LEFT OUTER JOIN users ON history.owner = users.id WHERE history.location = ? ORDER BY history.time',
                'admindump' => 'SELECT
                        locations.id, locations.name, locations.note, locations.mainhistory, musers.login, main.discussion,
                        history.id, history.discussion, history.nodename, history.nodenote, users.login
index bcd55257226864e85c5eb69bd8de12c03f5c576f..f4fbdb9dfdd5a16dcd481414e2c9ff7f79e88524 100644 (file)
@@ -39,7 +39,7 @@ sub list( $$$$ ) {
                        print "<div class='discussion'>\n<h2>Discussion</h2>";
                        $diss = 1;
                }
-               my( $id, $text, $time, $name, $note, $seen, $user ) = @{$history};
+               my( $id, $text, $time, $name, $note, $seen, $user, $email ) = @{$history};
                my $type = $seen ? 'history' : 'unseen-history';
                $type = 'main-history' if( defined( $mid ) && ( $id == $mid ) );
                print "<div class='$type'>\n";
@@ -51,6 +51,7 @@ sub list( $$$$ ) {
                        $text =~ s/\n/<br>/g;
                        print "<p class='discussion-text'>$text\n";
                }
+               ( $user ) = ( $email =~ /^(.*)@/ ) if defined $email && !defined $user;
                print "<p class='author'>".encode( $user )."\n" if( defined( $user ) );
                print "<p class='time'>".encode( $time )."\n";
                print "</div>\n";