Index: openacs-4/packages/acs-tcl/tcl/application-data-link-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/application-data-link-procs-oracle.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs-oracle.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<queryset>
+<rdbms><type>oracle</type><version>8.0</version></rdbms>
+
+<fullquery name="application_data_link::new.create_forward_link">
+    <querytext>
+		    begin
+		    :1 = acs_rel.new (
+				      rel_id => null,
+				      rel_type => 'application_data_link',
+				      object_id_one => :this_object_id,
+				      object_id_two => :target_object_id,
+				      context_id => :this_object_id,
+				      creation_user => :user_id,
+				      creation_ip => :id_addr
+				      );
+		    end;
+    </querytext>
+</fullquery>
+
+<fullquery name="application_data_link::new.create_backward_link">
+    <querytext>
+		    begin
+		    :1 = acs_rel.new (
+				      rel_id => null,
+				      rel_type => 'application_data_link',
+				      object_id_one => :target_object_id,
+				      object_id_two => :this_object_id,
+				      context_id => :this_object_id,
+				      creation_user => :user_id,
+				      creation_ip => :id_addr
+				      );
+		    end;
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/acs-tcl/tcl/application-data-link-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/application-data-link-procs-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs-postgresql.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<queryset>
+<rdbms><type>postgresql</type><version>7.2</version></rdbms>
+
+<fullquery name="application_data_link::new.create_forward_link">
+    <querytext>
+		    select acs_rel__new (
+					 null,
+					 'application_data_link',
+					 :this_object_id,
+					 :target_object_id,
+					 :this_object_id,
+					 :user_id,
+					 :id_addr
+					 )
+    </querytext>
+</fullquery>
+
+<fullquery name="application_data_link::new.create_backward_link">
+    <querytext>
+		    select acs_rel__new (
+					 null,
+					 'application_data_link',
+					 :target_object_id,
+					 :this_object_id,
+					 :this_object_id,
+					 :user_id,
+					 :id_addr
+					 )
+    </querytext>
+</fullquery>
+
+</queryset>
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
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs.tcl	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,43 @@
+ad_library {
+    
+    Procs of application data linking
+    
+    @author Timo Hentschel (timo@timohentschel.de)
+    @creation-date 2005-05-23
+}
+
+namespace eval application_data_link {}
+
+ad_proc -public application_data_link::new {
+    -this_object_id:required
+    -target_object_id:required
+} {
+    set user_id [ad_conn user_id]
+    set id_addr [ad_conn peeraddr]
+
+    db_exec_plsql create_forward_link {}
+    db_exec_plsql create_backward_link {}
+}
+
+ad_proc -public application_data_link::delete_links {
+    -object_id:required
+} {
+    set rel_ids [db_list linked_objects {}]
+
+    foreach rel_id $rel_ids {
+	relation_remove $rel_id
+    }
+}
+
+ad_proc -public application_data_link::get {
+    -object_id:required
+} {
+    return [db_list linked_objects {}]
+}
+
+ad_proc -public application_data_link::get_linked {
+    -from_object_id:required
+    -to_object_type:required
+} {
+    return [db_list linked_object {}]
+}
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
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-data-link-procs.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<queryset>
+
+<fullquery name="application_data_link::delete_links.linked_objects">
+    <querytext>
+	    select rel_id
+	    from acs_rels
+	    where rel_type = 'application_data_link'
+	    and (object_id_one = :object_id
+		 or object_id_two = :object_id)
+    </querytext>
+</fullquery>
+
+<fullquery name="application_data_link::get.linked_objects">
+    <querytext>
+	select object_id_two
+	from acs_rels
+	where object_id_one = :package_id
+	and rel_type = 'application_data_link'
+    </querytext>
+</fullquery>
+
+<fullquery name="application_data_link::get_linked.linked_object">
+    <querytext>
+	select o.object_id
+	from acs_rels r, acs_objects o
+	where r.object_id_one = :from_object_id
+	and r.object_id_two = o.object_id
+	and o.object_type = :to_object_type
+	and r.rel_type = 'application_data_link'
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/acs-tcl/tcl/application-link-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-link-procs-oracle.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-link-procs-oracle.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<queryset>
+<rdbms><type>oracle</type><version>8.0</version></rdbms>
+
+<fullquery name="application_link::new.create_forward_link">
+    <querytext>
+		    begin
+		    :1 = acs_rel.new (
+				      rel_id => null,
+				      rel_type => 'application_link',
+				      object_id_one => :this_package_id,
+				      object_id_two => :target_package_id,
+				      context_id => :this_package_id,
+				      creation_user => :user_id,
+				      creation_ip => :id_addr
+				      );
+		    end;
+    </querytext>
+</fullquery>
+
+<fullquery name="application_link::new.create_backward_link">
+    <querytext>
+		    begin
+		    :1 = acs_rel.new (
+				      rel_id => null,
+				      rel_type => 'application_link',
+				      object_id_one => :target_package_id,
+				      object_id_two => :this_package_id,
+				      context_id => :this_package_id,
+				      creation_user => :user_id,
+				      creation_ip => :id_addr
+				      );
+		    end;
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/acs-tcl/tcl/application-link-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-link-procs-postgresql.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-link-procs-postgresql.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<queryset>
+<rdbms><type>postgresql</type><version>7.2</version></rdbms>
+
+<fullquery name="application_link::new.create_forward_link">
+    <querytext>
+		    select acs_rel__new (
+					 null,
+					 'application_link',
+					 :this_package_id,
+					 :target_package_id,
+					 :this_package_id,
+					 :user_id,
+					 :id_addr
+					 )
+    </querytext>
+</fullquery>
+
+<fullquery name="application_link::new.create_backward_link">
+    <querytext>
+		    select acs_rel__new (
+					 null,
+					 'application_link',
+					 :target_package_id,
+					 :this_package_id,
+					 :this_package_id,
+					 :user_id,
+					 :id_addr
+					 )
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-link-procs.tcl	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,57 @@
+ad_library {
+    
+    Procs of application linking
+    
+    @author Timo Hentschel (timo@timohentschel.de)
+    @creation-date 2005-05-23
+}
+
+namespace eval application_link {}
+
+ad_proc -public application_link::new {
+    -this_package_id:required
+    -target_package_id:required
+} {
+    set user_id [ad_conn user_id]
+    set id_addr [ad_conn peeraddr]
+
+    db_exec_plsql create_forward_link {}
+    db_exec_plsql create_backward_link {}
+}
+
+ad_proc -public application_link::delete_links {
+    -package_id:required
+} {
+    set rel_ids [db_list linked_packages {}]
+
+    foreach rel_id $rel_ids {
+	relation_remove $rel_id
+    }
+}
+
+ad_proc -public application_link::get {
+    -package_id:required
+} {
+    return [db_list linked_packages {}]
+}
+
+ad_proc -public application_link::get_linked {
+    -from_package_id:required
+    -to_package_key:required
+} {
+    return [db_list linked_package {}]
+}
+
+ad_proc -private ::install::xml::action::application-link { node } {
+    Create a forum instance from an install.xml file
+} {
+    set this_package_url [apm_required_attribute_value $node this_package_url]
+    set target_package_url [apm_required_attribute_value $node target_package_url]
+
+    set this_package_id [site_node::get_element -url $this_package_url -element package_id]
+    set target_package_id [site_node::get_element -url $target_package_url -element package_id]
+
+    application_link::new -this_package_id $this_package_id -target_package_id $target_package_id
+
+}
+
Index: openacs-4/packages/acs-tcl/tcl/application-link-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/application-link-procs.xql,v
diff -u
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-tcl/tcl/application-link-procs.xql	1 Jun 2005 08:03:16 -0000	1.1
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<queryset>
+
+<fullquery name="application_link::delete_links.linked_packages">
+    <querytext>
+	    select rel_id
+	    from acs_rels
+	    where rel_type = 'application_link'
+	    and (object_id_one = :package_id
+		 or object_id_two = :package_id)
+    </querytext>
+</fullquery>
+
+<fullquery name="application_link::get.linked_packages">
+    <querytext>
+	select object_id_two
+	from acs_rels
+	where object_id_one = :package_id
+	and rel_type = 'application_link'
+    </querytext>
+</fullquery>
+
+<fullquery name="application_link::get_linked.linked_package">
+    <querytext>
+	select p.package_id
+	from acs_rels r, apm_packages p
+	where r.object_id_one = :from_package_id
+	and r.object_id_two = p.package_id
+	and p.package_key = :to_package_key
+	and r.rel_type = 'application_link'
+    </querytext>
+</fullquery>
+
+</queryset>
Index: openacs-4/packages/acs-tcl/tcl/object-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/object-procs.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/acs-tcl/tcl/object-procs.tcl	29 Jan 2005 18:43:28 -0000	1.6
+++ openacs-4/packages/acs-tcl/tcl/object-procs.tcl	1 Jun 2005 08:03:16 -0000	1.7
@@ -68,7 +68,7 @@
 } {
     Gets information about an acs_object.
 
-    Returns object_id, object_type, context_id, security_inherit_p, 
+    Returns object_id, package_id, object_type, context_id, security_inherit_p, 
     creation_user, creation_date_ansi, creation_ip, last_modified_ansi,
     modifying_user, modifying_ip, tree_sortkey,  object_name
 
@@ -95,4 +95,3 @@
     acs_object::get -object_id $object_id -array row
     return $row($element)
 }
-