Index: openacs-4/packages/forums/www/forum-view-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/forum-view-oracle.xql,v
diff -u -r1.5.2.1 -r1.5.2.1.2.1
--- openacs-4/packages/forums/www/forum-view-oracle.xql	22 Nov 2002 18:38:32 -0000	1.5.2.1
+++ openacs-4/packages/forums/www/forum-view-oracle.xql	17 Oct 2003 15:53:46 -0000	1.5.2.1.2.1
@@ -14,11 +14,13 @@
                     from forums_messages_approved fm1
                     where fm1.forum_id = :forum_id
                     and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages,
-                   to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
-                   case when fm.last_child_post > (sysdate - 1) then 't' else 'f' end as new_p                   
-            from forums_messages_approved fm
+                   to_char(acs_objects.last_modified, 'Mon DD YYYY HH24:MI:SS') as last_modified,
+                   case when acs_objects.last_modified > (sysdate - 1) then 't' else 'f' end as new_p                   
+            from forums_messages_approved fm,
+                 acs_objects
             where fm.forum_id = :forum_id
             and fm.parent_id is null
+            and fm.message_id = acs_objects.object_id
             order by fm.posting_date desc
         </querytext>
     </fullquery>
@@ -35,11 +37,13 @@
                     from forums_messages fm1
                     where fm1.forum_id = :forum_id
                     and fm1.tree_sortkey between tree.left(fm.tree_sortkey) and tree.right(fm.tree_sortkey)) as n_messages,
-                   to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
-                   case when fm.last_child_post > (sysdate - 1) then 't' else 'f' end as new_p                   
-            from forums_messages fm
+                   to_char(acs_objects.last_modified, 'Mon DD YYYY HH24:MI:SS') as last_modified,
+                   case when acs_objects.last_modified > (sysdate - 1) then 't' else 'f' end as new_p                   
+            from forums_messages fm,
+                 acs_objects
             where fm.forum_id = :forum_id
             and fm.parent_id is null
+            and fm.message_id = acs_objects.object_id
             order by fm.posting_date desc
         </querytext>
     </fullquery>
Index: openacs-4/packages/forums/www/forum-view-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/forum-view-postgresql.xql,v
diff -u -r1.4.2.3 -r1.4.2.3.2.1
--- openacs-4/packages/forums/www/forum-view-postgresql.xql	16 May 2003 09:17:46 -0000	1.4.2.3
+++ openacs-4/packages/forums/www/forum-view-postgresql.xql	17 Oct 2003 15:53:46 -0000	1.4.2.3.2.1
@@ -11,19 +11,19 @@
                    fm.posting_date,
                    fm.state,
                    (select count(*)
-                    from forums_messages_approved fm1
+                    from $forums_table fm1
                     where fm1.forum_id = :forum_id
                     and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
-                   to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
-                   case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p                   
+		    to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
             from forums_messages_approved fm
             where fm.forum_id = :forum_id
             and fm.parent_id is null
             order by fm.posting_date desc
         </querytext>
     </fullquery>
 
-    <fullquery name="messages_select_moderator">
+    <partialquery name="messages_select_display_data_partial">
         <querytext>
             select fm.message_id,
                    fm.subject,
@@ -32,16 +32,158 @@
                    fm.posting_date,
                    fm.state,
                    (select count(*)
-                    from forums_messages fm1
+                    from $forums_table fm1
                     where fm1.forum_id = :forum_id
                     and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
-                   to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
-                   case when fm.last_child_post > (now() - interval '1 day') then 't' else 'f' end as new_p                   
+	            to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.message_id IN (CURRENT_PAGE_SET)
+            order by fm.posting_date desc
+        </querytext>
+    </partialquery>
+
+
+    <fullquery name="messages_select_latest">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+		    to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
             from forums_messages_approved fm
             where fm.forum_id = :forum_id
             and fm.parent_id is null
+            order by fm.last_child_post desc
+        </querytext>
+    </fullquery>
+
+    <partialquery name="messages_select_latest_display_data_partial">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+	            to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.message_id IN (CURRENT_PAGE_SET)
+            order by fm.last_child_post desc
+        </querytext>
+    </partialquery>
+
+    <fullquery name="messages_select_unanswered">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+		    to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages_approved fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.max_child_sortkey is null
             order by fm.posting_date desc
         </querytext>
     </fullquery>
 
+    <partialquery name="messages_select_unanswered_display_data_partial">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+	            to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.max_child_sortkey is null
+	    and fm.message_id IN (CURRENT_PAGE_SET)
+            order by fm.posting_date desc
+        </querytext>
+    </partialquery>
+
+
+    <fullquery name="messages_select_sincelastvisit">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+		    to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages_approved fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.last_child_post > :second_to_last_visit
+            order by fm.last_child_post desc
+        </querytext>
+    </fullquery>
+
+    <partialquery name="messages_select_sincelastvisit_display_data_partial">
+        <querytext>
+            select fm.message_id,
+                   fm.subject,
+                   fm.user_id,
+                   person__name(fm.user_id) as user_name,
+                   fm.posting_date,
+                   fm.state,
+                   (select count(*)
+                    from $forums_table fm1
+                    where fm1.forum_id = :forum_id
+                    and fm1.tree_sortkey between tree_left(fm.tree_sortkey) and tree_right(fm.tree_sortkey)) as n_messages,
+	            to_char(fm.last_child_post, 'Mon DD YYYY HH24:MI:SS') as last_child_post,
+                    case when fm.last_child_post > (now() - interval '1') then 't' else 'f' end as new_p
+            from forums_messages fm
+            where fm.forum_id = :forum_id
+            and fm.parent_id is null
+	    and fm.last_child_post > :second_to_last_visit
+	    and fm.message_id IN (CURRENT_PAGE_SET)
+            order by fm.last_child_post desc
+        </querytext>
+    </partialquery>
+	
+    <fullquery name="get_last_visit">
+        <querytext>
+	    select second_to_last_visit from cc_users where user_id=:user_id
+        </querytext>
+    </fullquery>
+
 </queryset>
Index: openacs-4/packages/forums/www/message-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-chunk.adp,v
diff -u -r1.11.2.2 -r1.11.2.2.2.1
--- openacs-4/packages/forums/www/message-chunk.adp	26 Nov 2002 02:38:13 -0000	1.11.2.2
+++ openacs-4/packages/forums/www/message-chunk.adp	17 Oct 2003 15:53:46 -0000	1.11.2.2.2.1
@@ -1,30 +1,42 @@
-
-<tr style="color: black; background-color: @table_bgcolor@;">
+<div class="forum_message">
 <if @display_subject_p@>
-  <td align=left style="padding-left: 1em">
-    <strong>
+    <span class="fmessagetitle">
       <if @preview@ nil>
         <a href="message-view?message_id=@message.message_id@">@message.subject@</a>
       </if>
       <else>
         @message.subject@
       </else>
-    </strong>  
-  </td>
+    </span>
 </if>
-  <td align=center>
-    <a href="user-history?user_id=@message.user_id@">@message.user_name@</a></td>
-  <td align=center>@message.posting_date@</td>
 
   <if @preview@ nil>
+
+  </if>
+  <else>
+
+  </else>
+
+    <if @message.html_p@ false>
+    <div align="left">
+      <%= [ad_text_to_html --  "$message(content)"] %>
+    </div>
+    </if>
+    <else>
+      @message.content@
+    </else>
+
+
+<p class="fmessageauthor"> -- <a href="user-history?user_id=@message.user_id@">@message.user_name@</a> @message.posting_date@
+
+  <if @preview@ nil>
   
-    <td align=right style="padding-right: 1em; padding-left: 1em;">
-      <div style="white-space: nowrap; font-size: x-small">
+
+
         [ <a href="message-post?parent_id=@message.message_id@">reply</a>
         | <a href="message-email?message_id=@message.message_id@">email</a>
         ]
         <if @moderate_p@>
-          <br>
           [ <a href="moderate/message-edit?message_id=@message.message_id@">edit</a>
           | <a href="moderate/message-delete?message_id=@message.message_id@">delete</a>
           
@@ -38,32 +50,13 @@
           </if>
           ]
         </if>
-      </div>
-    </td>
 
   </if>
 
-</tr>
+</p>
 
-<tr style="color: black; background-color: @table_bgcolor@">
-  <if @preview@ nil>
-    <td colspan="4" style="padding: 1em">
-  </if>
-  <else>
-    <td colspan="3" align="left" style="padding: 1em">  
-  </else>
-
-    <if @message.html_p@ false>
-    <div align="left">
-      <%= [ad_text_to_html --  "$message(content)"] %>
-    </div>
-    </if>
-    <else>
-      @message.content@
-    </else>
-  </td>
-</tr>
-
 <if @message.n_attachments@ not nil and @message.n_attachments@ gt 0>
   <include src="message-attachment-chunk" &message="message" bgcolor=@table_bgcolor@>
 </if>
+<hr />
+</div>
Index: openacs-4/packages/forums/www/message-view-flat.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/Attic/message-view-flat.adp,v
diff -u -r1.6.2.3 -r1.6.2.3.2.1
--- openacs-4/packages/forums/www/message-view-flat.adp	13 Feb 2003 13:08:26 -0000	1.6.2.3
+++ openacs-4/packages/forums/www/message-view-flat.adp	17 Oct 2003 15:53:46 -0000	1.6.2.3.2.1
@@ -2,45 +2,24 @@
 <property name="title">Forum @forum.name@: @message.subject@</property>
 <property name="context">@context@</property>
 
-<center>
+<p>@notification_chunk@</p>
 
-  <table cellpadding="5" width="95%">
-    <tr>
-      <td colspan="4">
-        <nobr>@notification_chunk@</nobr>
-      </td>
-    </tr>
-  </table>
-
-  <br>
-
-  <table bgcolor="#cccccc" cellpadding="5" width="95%">
+<div class="forum_thread">
 <include src="message-chunk" bgcolor="#eeeeee" moderate_p=@moderate_p@ &message="message">
-  </table>
 
 <if @responses:rowcount@ gt 0>
   <br>
 
-  <table bgcolor="#cccccc" cellpadding="5" width="95%">
-
 <multiple name="responses">
-
-<if @responses.rownum@ odd>
-  <include src="message-chunk" bgcolor="#d9e4f9" moderate_p=@moderate_p@ &message="responses" root_subject="@message.root_subject@">
-</if>
-<else>
-  <include src="message-chunk" bgcolor="#eeeeee" moderate_p=@moderate_p@ &message="responses" root_subject="@message.root_subject@">
-</else>
-
+<include src="message-chunk" bgcolor="#eeeeee" moderate_p=@moderate_p@ &message="responses" root_subject="@message.root_subject@">
 </multiple>
 
-  </table>
 </if>
 
-</center>
 
 <if @reply_url@ not nil>
   <blockquote>
     <a href="@reply_url@"><b>Post a Reply</b></a>
   </blockquote>
 </if>
+</div>
Index: openacs-4/packages/forums/www/message-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/forums/www/message-view.adp,v
diff -u -r1.10.2.3 -r1.10.2.3.2.1
--- openacs-4/packages/forums/www/message-view.adp	13 Feb 2003 13:08:26 -0000	1.10.2.3
+++ openacs-4/packages/forums/www/message-view.adp	17 Oct 2003 15:53:46 -0000	1.10.2.3.2.1
@@ -2,70 +2,31 @@
 <property name="title">Forum @forum.name@: @message.subject@</property>
 <property name="context">@context@</property>
 
-<br>
-
-<center>
-
-<table width="95%">
-  <tr style="white-space: normal">
-    <td align=left>
+<p>
       @notification_chunk@
-    </td>
-    <td align=right>
-      <formtemplate id="search">
-        <formwidget id="forum_id">
-        Search:&nbsp;<formwidget id="search_text">
-      </formtemplate>
-    </td>
-  </tr>
-</table>
+</p>
 
-<br>
 
-<table bgcolor="@table_border_color@" width="95%">
   <include src="message-chunk" 
            bgcolor="@table_bgcolor@" 
            forum_moderated_p=@forum_moderated_p@ 
            moderate_p=@moderate_p@ 
            &message="message">
-</table>
 
 <if @responses:rowcount@ gt 0>
 
-  <table width="95%">
-
     <multiple name="responses">
     
-    <% set width [expr 100 - [expr $responses(tree_level) - 1] * 3] %>
-  
-    <tr style="padding-top: 1em">
-      <td>
-        <table align="right" bgcolor="@table_border_color@" width="@width@%">
-          <if @responses.rownum@ odd>
+
             <include src="message-chunk" 
                      bgcolor="@table_other_bgcolor@" 
                      forum_moderated_p=@forum_moderated_p@ 
                      moderate_p=@moderate_p@ 
                      &message="responses">
-          </if>
-          <else>
-            <include src="message-chunk" 
-                     bgcolor="@table_bgcolor@"
-                     forum_moderated_p=@forum_moderated_p@
-                     moderate_p=@moderate_p@
-                     &message="responses">
-          </else>
-        </table>
-      </td>
-    </tr>
-
     </multiple>
   
-  </table>
 </if>
 
-</center>
-
 <if @reply_url@ not nil>
   <blockquote>
     <a href="@reply_url@"><b>Post a Reply</b></a>