Index: openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql	20 Apr 2001 20:51:09 -0000	1.1
+++ openacs-4/contrib/obsolete-packages/bboard/sql/oracle/bboard-packages.sql	29 Jun 2001 20:28:38 -0000	1.2
@@ -48,6 +48,10 @@
 	message_id    in acs_messages.message_id%TYPE
     ) return bboard_forums.forum_id%TYPE;
 
+    function name (
+        forum_id      in acs_objects.object_id%TYPE
+    ) return varchar2;
+
 end bboard_forum;
 /
 show errors
@@ -87,6 +91,10 @@
         subscriber_id in bboard_category_subscribers.subscriber_id%TYPE
     );
 
+    function name (
+        category_id      acs_objects.object_id%TYPE
+    ) return varchar2;
+
 end bboard_category;
 /
 show errors
@@ -150,6 +158,18 @@
         subscriber_id in bboard_thread_subscribers.subscriber_id%TYPE
     );
 
+    function name (
+        message_id      acs_objects.object_id%TYPE
+    ) return varchar2;
+
+    procedure remove_thread (
+        thread_id    in bboard_messages_all.message_id%TYPE
+    );
+
+    procedure remove (
+        message_id   in bboard_messages_all.message_id%TYPE
+    );
+
 end bboard_message;
 /
 show errors
@@ -280,6 +300,18 @@
         end if;
     end forum_containing_message;
 
+    function name (
+        forum_id      in acs_objects.object_id%TYPE
+    ) return varchar2
+    is
+        v_forum_name   bboard_forums.short_name%TYPE;
+    begin
+        select short_name into v_forum_name
+            from bboard_forums
+	    where forum_id = name.forum_id;
+        return v_forum_name;
+    end name;
+
 end bboard_forum;
 /
 show errors
@@ -321,7 +353,7 @@
         v_context_id := nvl(context_id, forum_id);
         v_category_id := acs_object.new (
             object_id => category_id,
-            context_id => forum_id,
+            context_id => v_context_id,
             creation_date => creation_date,
             creation_user => creation_user,
             creation_ip => creation_ip,
@@ -386,6 +418,18 @@
             values (category_id, subscriber_id);
     end;
 
+    function name (
+        category_id      in acs_objects.object_id%TYPE
+    ) return varchar2
+    is
+        v_category_name   bboard_categories.short_name%TYPE;
+    begin
+        select short_name into v_category_name
+            from bboard_categories
+	    where category_id = name.category_id;
+        return v_category_name;
+    end name;
+
 end bboard_category;
 /
 show errors
@@ -566,6 +610,87 @@
             values (thread_id, subscriber_id);
     end;
 
+    function name (
+        message_id      in acs_objects.object_id%TYPE
+    ) return varchar2
+    is
+        v_message_name   bboard_messages_all.title%TYPE;
+    begin
+        select title into v_message_name
+            from bboard_messages_all
+            where message_id = name.message_id;
+        return v_message_name;
+    end name;
+
+    procedure remove_thread (
+        thread_id    in bboard_messages_all.message_id%TYPE
+    )
+    is
+	cursor messages_children is
+	   select object_id as child_id, object_type
+	       from acs_objects
+               where context_id in (select message_id 
+                                       from acs_messages
+                                       connect by prior message_id = reply_to
+                                       start with message_id = thread_id);
+
+        cursor messages is
+	   select message_id
+	       from acs_messages
+	       connect by prior message_id = reply_to
+	       start with message_id = thread_id;
+
+        image_p	     number;
+    begin
+	for child_val in messages_children loop
+	    if child_val.object_type = 'acs_message' then
+	       acs_message.delete(child_val.child_id);
+	    elsif child_val.object_type = 'content_item' then
+		select count(*) into image_p
+		    from images
+                    where image_id = child_val.child_id;
+                if image_p = 1 then
+                    acs_message.delete_image(child_val.child_id);
+                else
+                    acs_message.delete_file(child_val.child_id);
+                end if;
+           end if;
+       end loop;
+
+       for message_val in messages loop
+           acs_message.delete(message_val.message_id);
+       end loop;
+
+    end remove_thread;
+
+    procedure remove (
+        message_id    in bboard_messages_all.message_id%TYPE
+    )
+    is
+	cursor messages_children is
+	   select object_id as child_id, object_type
+	       from acs_objects
+               where context_id = message_id;
+        image_p	     number;
+    begin
+	for child_val in messages_children loop
+	    if child_val.object_type = 'acs_message' then
+	       acs_message.delete(child_val.child_id);
+	    elsif child_val.object_type = 'content_item' then
+		select count(*) into image_p
+		    from images
+                    where image_id = child_val.child_id;
+                if image_p = 1 then
+                    acs_message.delete_image(child_val.child_id);
+                else
+                    acs_message.delete_file(child_val.child_id);
+                end if;
+           end if;
+       end loop;
+
+       acs_message.delete(message_id);
+    end remove;
+
 end bboard_message;
 /
 show errors
