Index: openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl,v
diff -u -r1.10 -r1.10.2.1
--- openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl 4 Jan 2010 19:54:37 -0000 1.10
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl 22 Mar 2011 16:13:47 -0000 1.10.2.1
@@ -254,6 +254,32 @@
return [db_list links_from {}]
}
+ad_proc -public application_data_link::get_links_to {
+ -object_id:required
+ {-from_type}
+ {-relation_tag ""}
+} {
+ Get a list of objects that are linked to an object,
+ possible using the relation_tag.
+ If from_type is a subtype of content_revision, we lookup
+ content_items that have that content_type
+
+ @param object_id object_id two, get objects linked to this object
+ @param from_type object_type of the objects to get links from
+} {
+ set from_type_where_clause ""
+ set content_type_from_clause ""
+
+ if {[info exists from_type] && $from_type ne ""} {
+ set from_type_clause [db_map from_type_where_clause]
+ if {[content::type::is_content_type -content_type $from_type]} {
+ set from_type_clause [db_map content_type_where_clause]
+ set content_type_from_clause [db_map content_type_from_clause]
+ }
+ }
+ return [db_list links_to {}]
+}
+
ad_proc -public application_data_link::scan_for_links {
-text
} {
Index: openacs-4/packages/acs-tcl/tcl/application-data-link-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-data-link-procs.xql,v
diff -u -r1.6 -r1.6.2.1
--- openacs-4/packages/acs-tcl/tcl/application-data-link-procs.xql 4 Jan 2010 19:54:37 -0000 1.6
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs.xql 22 Mar 2011 16:13:47 -0000 1.6.2.1
@@ -99,6 +99,37 @@
+
+
+ select object_id_one
+ from acs_data_links,
+ acs_objects
+ $content_type_from_clause
+ where object_id_two = :object_id
+ and object_id = object_id_one
+ [application_data_link::relation_tag_where_clause -relation_tag $relation_tag]
+ $from_type_where_clause
+
+
+
+
+
+ and object_type = :from_type
+
+
+
+
+
+ , cr_items
+
+
+
+
+
+ and content_type = :object_type
+
+
+
delete from acs_data_links where object_id_one=:object_id