Index: openacs-4/packages/acs-subsite/www/admin/relations/remove-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/Attic/remove-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/relations/remove-oracle.xql 7 Aug 2017 23:47:58 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/relations/remove-oracle.xql 20 Jun 2018 08:23:51 -0000 1.3 @@ -3,19 +3,6 @@ oracle8.1.6 - - - - select acs_object_type.pretty_name(r.rel_type) as rel_type_pretty_name, - acs_object.name(r.object_id_one) as object_id_one_name, - acs_object.name(r.object_id_two) as object_id_two_name, - r.object_id_two - from acs_rels r - where r.rel_id = :rel_id - - - - @@ -28,6 +15,5 @@ - Index: openacs-4/packages/acs-subsite/www/admin/relations/remove-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/Attic/remove-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-subsite/www/admin/relations/remove-postgresql.xql 7 Aug 2017 23:47:58 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/relations/remove-postgresql.xql 20 Jun 2018 08:23:51 -0000 1.3 @@ -3,19 +3,6 @@ postgresql7.1 - - - - select acs_object_type__pretty_name(r.rel_type) as rel_type_pretty_name, - acs_object__name(r.object_id_one) as object_id_one_name, - acs_object__name(r.object_id_two) as object_id_two_name, - r.object_id_two - from acs_rels r - where r.rel_id = :rel_id - - - - @@ -28,6 +15,5 @@ - Index: openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl 7 Jun 2018 17:46:16 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/admin/relations/remove.tcl 20 Jun 2018 08:23:51 -0000 1.6 @@ -29,22 +29,29 @@ set context [list "Remove relation"] -if { ![db_0or1row select_rel_info {} -column_array rel] -} { +if { ![db_0or1row select_rel_info { + select (select pretty_name from acs_object_types + where object_type = r.rel_type) as rel_type_pretty_name, + r.object_id_one, + r.object_id_two + from acs_rels r + where r.rel_id = :rel_id +} -column_array rel] } { ad_return_error "Error" "Relation $rel_id does not exist" ad_script_abort } +set rel(object_id_one_name) [acs_object_name $rel(object_id_one)] +set rel(object_id_two_name) [acs_object_name $rel(object_id_two)] + # Now let's see if removing this relation would violate some # constraint. if { [relation_segment_has_dependent -rel_id $rel_id] } { set return_url "[ad_conn url]?[ad_conn query]" # We can't remove this relation - display the violations - template::multirow create dependents rel_id rel_type_pretty_name object_id_one_name object_id_two_name export_vars - - db_foreach select_dependents {} { - template::multirow append dependents $rel_id $rel_type_pretty_name $object_id_one_name $object_id_two_name [export_vars {rel_id return_url}] + db_multirow -extend {export_vars} dependents select_dependents {} { + set export_vars [export_vars {rel_id return_url}] } ad_return_template remove-dependents-exist return @@ -53,8 +60,6 @@ set export_vars [export_vars -form {rel_id return_url}] -ad_return_template - # Local variables: # mode: tcl # tcl-indent-level: 4