Index: openacs-4/packages/lab-report-central/www/detach-template-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/detach-template-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/detach-template-postgresql.xql 27 Apr 2006 04:51:00 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + DELETE FROM lrc_lab_template_map + WHERE template_id = :template_id + AND lab_id = :lab_id + + + + Index: openacs-4/packages/lab-report-central/www/detach-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/detach-template.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/detach-template.tcl 27 Apr 2006 04:51:00 -0000 1.1 @@ -0,0 +1,28 @@ +ad_page_contract { + Detaches the given template from the given lab. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-27 + @cvs-id $Id: detach-template.tcl,v 1.1 2006/04/27 04:51:00 ncarroll Exp $ +} { + lab_id:integer + template_id:integer + return_url:optional +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +permission::require_permission -party_id $user_id -object_id $package_id \ + -privilege lab_report_central_admin + +if { ![info exists return_url] } { + set return_url [export_vars -url -base lab {lab_id}] +} + +db_transaction { + db_dml detach_template {} +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/lab-report-central/www/lab.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/lab.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lab-report-central/www/lab.tcl 27 Apr 2006 04:34:34 -0000 1.2 +++ openacs-4/packages/lab-report-central/www/lab.tcl 27 Apr 2006 04:51:00 -0000 1.3 @@ -25,8 +25,9 @@ db_multirow -extend { view_url edit_url delete_url } rt rt {} { set view_url [export_vars -url -base template {template_id}] - set edit_url [export_vars -url -base template-ae { lab_id }] - set delete_url "" + set edit_url [export_vars -url -base template-ae {lab_id}] + set delete_url [export_vars -url \ + -base detach-template {lab_id template_id}] } set create_url [export_vars -url -base attach-template { lab_id }]