Index: openacs-4/packages/cms/www/modules/items/relate-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/relate-items.tcl,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/cms/www/modules/items/relate-items.tcl 19 Feb 2007 22:17:43 -0000 1.6.2.2 +++ openacs-4/packages/cms/www/modules/items/relate-items.tcl 19 Feb 2007 22:30:35 -0000 1.6.2.3 @@ -11,56 +11,33 @@ -object_id $item_id -privilege write set page_title "Relate Items to [content::item::get_title -item_id $item_id]" -set content_type [content::item::content_type -item_id $item_id] +set item_type [content::item::content_type -item_id $item_id] # get related items from the clipboard set clip [cms::clipboard::parse_cookie] set items [cms::clipboard::get_items $clip $mount_point] set type_options_list [db_list_of_lists get_relation_type_options {}] - +set validation_proc "valid_${relation}_relation_p" set target_item_num 0 multirow create target_items item_id title type_options tag_options -if { $relation eq "cr_item_rel" } { - foreach clipped_item $items { - if {[cms::rel::valid_item_relation_p -item_id $item_id -target_item_id $clipped_item]} { - incr target_item_num - set target_type [content::item::content_type -item_id $clipped_item] - set tag_options "\n" - - set type_options "\n" - - multirow append target_items $clipped_item "[content::item::get_title -item_id $clipped_item]" $type_options $tag_options +foreach clipped_item $items { + if {[cms::rel::${validation_proc} -item_id $item_id -object_id $clipped_item]} { + incr target_item_num + set object_type [content::item::content_type -item_id $clipped_item] + set tag_options "\n\n" - foreach option [db_list ${relation}_tag_options {}] { - append tag_options "\n" - } - append tag_options "" - - set type_options "\n" - - multirow append target_items $clipped_item "[content::item::get_title -item_id $clipped_item]" $type_options $tag_options + append tag_options "" + + set type_options "\n" + + multirow append target_items $clipped_item "[content::item::get_title -item_id $clipped_item]" $type_options $tag_options } } Index: openacs-4/packages/cms/www/modules/items/relate-items.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/Attic/relate-items.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/cms/www/modules/items/relate-items.xql 19 Feb 2007 22:17:43 -0000 1.1.2.1 +++ openacs-4/packages/cms/www/modules/items/relate-items.xql 19 Feb 2007 22:30:35 -0000 1.1.2.2 @@ -5,17 +5,17 @@ select relation_tag from cr_type_relations - where content_type = :content_type - and target_type = :target_type + where content_type = :item_type + and target_type = :object_type select relation_tag from cr_type_children - where parent_type = :content_type - and child_type = :child_type + where parent_type = :item_type + and child_type = :object_type