]> ruin.nu Git - ndwebbie.git/commitdiff
forum threads got uid linked to them
authorMichael Andreen <harv@ruin.nu>
Wed, 28 Mar 2007 11:24:12 +0000 (11:24 +0000)
committerMichael Andreen <harv@ruin.nu>
Wed, 28 Mar 2007 11:24:12 +0000 (11:24 +0000)
ND/Web/Forum.pm
ND/Web/Pages/Forum.pm
stylesheets/black.css
templates/forum.tmpl

index cbeb747083524a5240cb457af4c3867629b4b55c..6551518bf503967545dbcae446f6fa98ead55576 100644 (file)
@@ -83,9 +83,9 @@ sub addForumPost {
 sub addForumThread {
        my ($dbh,$board,$uid,$subject) = @_;
 
 sub addForumThread {
        my ($dbh,$board,$uid,$subject) = @_;
 
-       my $insert = $dbh->prepare(q{INSERT INTO forum_threads (fbid,subject) VALUES($1,$2)});
+       my $insert = $dbh->prepare(q{INSERT INTO forum_threads (fbid,subject,uid) VALUES($1,$2,$3)});
 
 
-       if ($insert->execute($board->{id},escapeHTML($subject))){
+       if ($insert->execute($board->{id},escapeHTML($subject),$ND::UID)){
                my $id = $dbh->last_insert_id(undef,undef,undef,undef,"forum_threads_ftid_seq");
                return $dbh->selectrow_hashref(q{SELECT ftid AS id, subject, $2::boolean AS post FROM forum_threads WHERE ftid = $1}
                        ,undef,$id,$board->{post})
                my $id = $dbh->last_insert_id(undef,undef,undef,undef,"forum_threads_ftid_seq");
                return $dbh->selectrow_hashref(q{SELECT ftid AS id, subject, $2::boolean AS post FROM forum_threads WHERE ftid = $1}
                        ,undef,$id,$board->{post})
index b18bc350c8ddb08044395c922377f5b02ba402de..55cbe9615481a4ca5ffe35c84ba6fb47e80bd5c7 100644 (file)
@@ -131,13 +131,15 @@ sub render_body {
                GROUP BY fb.fbid,fb.board
                ORDER BY fb.fbid
                        });
                GROUP BY fb.fbid,fb.board
                ORDER BY fb.fbid
                        });
-       my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,ft.subject,
+       my $threads = $DBH->prepare(q{SELECT ft.ftid AS id,u.username,ft.subject,
                count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts,
                date_trunc('seconds',max(fp.time)::timestamp) as last_post,
                min(fp.time)::date as posting_date, ft.sticky
                count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) AS unread,count(fp.fpid) AS posts,
                date_trunc('seconds',max(fp.time)::timestamp) as last_post,
                min(fp.time)::date as posting_date, ft.sticky
-               FROM forum_threads ft JOIN forum_posts fp USING (ftid) LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid
+               FROM forum_threads ft JOIN forum_posts fp USING (ftid) 
+                       JOIN users u ON u.uid = ft.uid
+                       LEFT OUTER JOIN (SELECT * FROM forum_thread_visits WHERE uid = $2) ftv ON ftv.ftid = ft.ftid
                WHERE ft.fbid = $1
                WHERE ft.fbid = $1
-               GROUP BY ft.ftid, ft.subject,ft.sticky
+               GROUP BY ft.ftid, ft.subject,ft.sticky,u.username
                HAVING count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) >= $3
                ORDER BY sticky DESC,last_post DESC});
 
                HAVING count(NULLIF(COALESCE(fp.time > ftv.time,TRUE),FALSE)) >= $3
                ORDER BY sticky DESC,last_post DESC});
 
index 94e2ce3a1fc835b1cdd861285d30ba92621f2acd..1466b8eec7a86a3d60d04af88f479119eb868471 100644 (file)
@@ -8,7 +8,7 @@ a {
        color: white;
        text-decoration:underline;
 }
        color: white;
        text-decoration:underline;
 }
-a:hover {
+a:hover, td.NAP a:hover {
        color: black;
        background: white;
 }
        color: black;
        background: white;
 }
@@ -151,14 +151,7 @@ td.Hostile{
        background: red;
        color: black;
 }
        background: red;
        color: black;
 }
-td.NAP{
-       background: blue;
-       color: white;
-}
-td.NAP a{
-       color: yellow;
-       background: blue;
-}
+
 table.old{
        border: outset 1pt;
        border-collapse: separate;
 table.old{
        border: outset 1pt;
        border-collapse: separate;
index 380f2763b08ea506e3525bcde3062d4e25e67bb8..9b74b2d047d29167a4e78f5d21210306aa35dc09 100644 (file)
@@ -22,6 +22,7 @@
        <th>Total</th>
        <th>Subject</th>
        <th>Posted</th>
        <th>Total</th>
        <th>Subject</th>
        <th>Posted</th>
+       <th>Creator</th>
        <th>Last post</th>
 </tr>
 <TMPL_LOOP Threads>
        <th>Last post</th>
 </tr>
 <TMPL_LOOP Threads>
@@ -29,8 +30,9 @@
                <td align="center"><TMPL_VAR NAME=Unread></td>
                <td align="center"><TMPL_VAR NAME=Posts></td>
                <td <TMPL_IF Sticky>class="sticky"</TMPL_IF>><a href="/<TMPL_VAR NAME=PAGE>?t=<TMPL_VAR NAME=Id>#NewPosts">&nbsp;<TMPL_VAR NAME=Subject>&nbsp;</a></td>
                <td align="center"><TMPL_VAR NAME=Unread></td>
                <td align="center"><TMPL_VAR NAME=Posts></td>
                <td <TMPL_IF Sticky>class="sticky"</TMPL_IF>><a href="/<TMPL_VAR NAME=PAGE>?t=<TMPL_VAR NAME=Id>#NewPosts">&nbsp;<TMPL_VAR NAME=Subject>&nbsp;</a></td>
-               <td align="center"><TMPL_VAR NAME=Posting_date></td>
-               <td align="center"><TMPL_VAR NAME=Last_post></td>
+               <td align="left"><TMPL_VAR NAME=Posting_date></td>
+               <td align="center"><TMPL_VAR NAME=Username></td>
+               <td align="left"><TMPL_VAR NAME=Last_post></td>
                <TMPL_IF Moderate><td><input type="checkbox" name="t:<TMPL_VAR NAME=Id>"/></td></TMPL_IF>
        </tr>
 </TMPL_LOOP>
                <TMPL_IF Moderate><td><input type="checkbox" name="t:<TMPL_VAR NAME=Id>"/></td></TMPL_IF>
        </tr>
 </TMPL_LOOP>