Index: openacs-4/packages/general-comments/www/delete-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete-2.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-2.tcl 6 Apr 2007 07:47:23 -0000 1.1 @@ -0,0 +1,36 @@ +# /packages/general-comments/www/admin/delete-2.tcl + +ad_page_contract { + Deletes a comment and its attachments + + @param comment_id The id of the comment to delete + + @author Phong Nguyen (phong@arsdigita.com) + @author Pascal Scheffers (pascal@scheffers.net) + @creation-date 2000-10-12 + @cvs-id $Id: delete-2.tcl,v 1.1 2007/04/06 07:47:23 maltes Exp $ +} { + comment_id:integer,notnull + { return_url {} } +} + +# There is a bug in content_item.delete that results in +# referential integrity violations when deleting a content +# item that has an image attachment. This is a temporary fix +# until ACS 4.1 is released. +db_dml delete_image_attachments { + delete from images + where image_id in (select latest_revision + from cr_items + where parent_id = :comment_id) +} + +# Only need to call on acs_message.delete since +# deletion of row from general_comments table +# relies on "on delete cascade" +db_exec_plsql delete_comment { + select acs_message__delete(:comment_id) from dual +} + +ad_returnredirect $return_url + Index: openacs-4/packages/general-comments/www/delete-2.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete-2.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-2.xql 6 Apr 2007 07:47:23 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + + delete from images + where image_id in (select latest_revision + from cr_items + where parent_id = :comment_id) + + + + + + Index: openacs-4/packages/general-comments/www/delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete.adp 6 Apr 2007 07:47:23 -0000 1.1 @@ -0,0 +1,38 @@ + +@page_title;noquote@ +@context;noquote@ + + +#general-comments.lt_Do_you_really_wish_to# + + @title@ (#general-comments.details#) + + <%= [util_convert_plaintext_to_html $content] %> + + + @content@ + + -- @author@ + (@pretty_date@) + + + + + + + <%= [export_form_vars comment_id return_url] %> + + + + + + + + + + + + + + Index: openacs-4/packages/general-comments/www/delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete.tcl 6 Apr 2007 07:47:23 -0000 1.1 @@ -0,0 +1,52 @@ +# /packages/general-comments/www/admin/delete.tcl + +ad_page_contract { + Delete a comment + + @param comment_id The id of the comment to delete + + @author Phong Nguyen (phong@arsdigita.com) + @author Pascal Scheffers (pascal@scheffers.net) + @creation-date 2000-10-12 + @cvs-id $Id: delete.tcl,v 1.1 2007/04/06 07:47:23 maltes Exp $ +} { + comment_id:integer,notnull + { return_url {}} +} -properties { + page_title:onevalue + context:onevalue + title:onevalue + comment_id:onevalue + mime_type:onevalue + content:onevalue + creation_user:onevalue + author:onevalue + pretty_date:onevalue + return_url:onevalue +} + +permission::require_permission -party_id [ad_conn user_id] -object_id $comment_id -privilege "write" +set revision_id [content::item::get_best_revision -item_id $comment_id] +# get data from database +set sql " + select r.title, + r.content, + r.mime_type, + o.creation_user, + to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date + from acs_objects o, + cr_revisions r, + general_comments g + where g.comment_id = :comment_id and + g.comment_id = o.object_id and + r.revision_id = $revision_id" + +if { ![db_0or1row get_comment $sql] } { + ad_return_complaint 1 "[_ general-comments.lt_The_comment_id_does_n]" +} + +set author [person::name -person_id $creation_user] +set page_title "[_ general-comments.Delete_a_comment]" +set context [list "[_ general-comments.Delete_a_comment]"] + +ad_return_template
+ @title@ (#general-comments.details#) + + <%= [util_convert_plaintext_to_html $content] %> + + + @content@ + + -- @author@ + (@pretty_date@) +