Index: openacs-4/packages/acs-subsite/tcl/relation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 17 May 2003 09:58:37 -0000 1.6 +++ openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 21 Sep 2003 19:31:18 -0000 1.7 @@ -10,6 +10,8 @@ } +namespace eval relation {} + ad_proc -public relation_permission_p { { -user_id "" } { -privilege "read" } @@ -108,7 +110,7 @@ ad_proc -public relation_remove { - rel_id + {rel_id ""} } { Removes the specified relation. Throws an error if we violate a relational constraint by removing this relation. @@ -120,7 +122,6 @@ relation was already deleted) } { - # Pull out the segment_id and the party_id (object_id_two) from # acs_rels. Note the outer joins since the segment may not exist. if { ![db_0or1row select_rel_info {}] } { @@ -286,3 +287,15 @@ } return $group_rel_type_list } + +ad_proc -public relation::get_id { + {-object_id_one:required} + {-object_id_two:required} + {-rel_type "membership_rel"} +} { + Find the rel_id of the relation matching the given object_id_one, object_id_two, and rel_type. + + @return rel_id of the found acs_rel, or the empty string if none existed. +} { + return [db_string select_rel_id {} -default {}] +} Index: openacs-4/packages/acs-subsite/tcl/relation-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-subsite/tcl/relation-procs.xql 15 Aug 2002 18:09:34 -0000 1.3 +++ openacs-4/packages/acs-subsite/tcl/relation-procs.xql 21 Sep 2003 19:31:18 -0000 1.4 @@ -53,4 +53,16 @@ + + + + select rel_id + from acs_rels + where rel_type = :rel_type + and object_id_one = :object_id_one + and object_id_two = :object_id_two + + + +