Index: openacs-4/packages/new-portal/sql/oracle/portal-node-mapping-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/Attic/portal-node-mapping-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/sql/oracle/portal-node-mapping-create.sql 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,80 @@
+--
+-- Copyright (C) 2001, 2002 OpenForce, Inc.
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+
+--
+-- The "New" Portal Package
+-- A mechanism for associating location with a certain chunk of data.
+--
+-- Ben Adida (ben@openforce)
+-- $Id: portal-node-mapping-create.sql,v 1.1 2002/04/13 00:08:08 ben Exp $
+--
+
+
+
+create table portal_node_mappings (
+ object_id integer not null
+ constraint portal_node_map_obj_id_fk
+ references acs_objects(object_id)
+ constraint portal_node_map_obj_id_pk
+ primary key,
+ node_id integer not null
+ constraint portal_node_map_node_id_fk
+ references site_nodes(node_id)
+);
+
+
+create or replace package portal_node_mapping
+as
+ procedure new (
+ object_id in portal_node_mappings.object_id%TYPE,
+ node_id in portal_node_mappings.node_id%TYPE
+ );
+
+ procedure del (
+ object_id in portal_node_mappings.object_id%TYPE
+ );
+
+
+end portal_node_mapping;
+/
+show errors
+
+
+create or replace package body portal_node_mapping
+as
+ procedure new (
+ object_id in portal_node_mappings.object_id%TYPE,
+ node_id in portal_node_mappings.node_id%TYPE
+ ) is
+ begin
+ del(new.object_id);
+
+ insert into portal_node_mappings
+ (object_id, node_id) values
+ (new.object_id, new.node_id);
+ end new;
+
+ procedure del (
+ object_id in portal_node_mappings.object_id%TYPE
+ ) is
+ begin
+ delete from portal_node_mappings where object_id= del.object_id;
+ end del;
+
+
+end portal_node_mapping;
+/
+show errors
Index: openacs-4/packages/new-portal/sql/postgresql/portal-node-mapping-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/postgresql/Attic/portal-node-mapping-create.sql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/sql/postgresql/portal-node-mapping-create.sql 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,63 @@
+--
+-- Copyright (C) 2001, 2002 OpenForce, Inc.
+--
+-- This file is part of dotLRN.
+--
+-- dotLRN is free software; you can redistribute it and/or modify it under the
+-- terms of the GNU General Public License as published by the Free Software
+-- Foundation; either version 2 of the License, or (at your option) any later
+-- version.
+--
+-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+-- details.
+--
+
+--
+-- The "New" Portal Package
+-- A mechanism for associating location with a certain chunk of data.
+--
+-- Ben Adida (ben@openforce)
+-- $Id: portal-node-mapping-create.sql,v 1.1 2002/04/13 00:08:08 ben Exp $
+--
+
+
+
+create table portal_node_mappings (
+ object_id integer not null
+ constraint portal_node_map_obj_id_fk
+ references acs_objects(object_id)
+ constraint portal_node_map_obj_id_pk
+ primary key,
+ node_id integer not null
+ constraint portal_node_map_node_id_fk
+ references site_nodes(node_id)
+);
+
+
+select define_function_args('portal_node_mapping__new', 'object_id,node_id');
+select define_function_args('portal_node_mapping__del', 'object_id');
+
+create function portal_node_mapping__del(integer)
+returns integer as '
+DECLARE
+ p_object_id alias for $1;
+BEGIN
+ delete from portal_node_mappings where object_id= p__object_id;
+END;
+' language 'plpgsql';
+
+create function portal_node_mapping__new(integer,integer)
+returns integer as '
+DECLARE
+ p_object_id alias for $1;
+ p_node_id alias for $2;
+BEGIN
+ PERFORM portal_node_mapping__del(p_object_id);
+
+ insert into portal_node_mappings
+ (object_id, node_id) values
+ (p_object_id, p_node_id);
+END;
+' language 'plpgsql';
Index: openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/Attic/portal-node-mapping-procs-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-oracle.xql 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,25 @@
+
+
+
+oracle8.1.6
+
+
+
+declare
+begin
+portal_node_mapping.new(object_id => :object_id, node_id => :node_id);
+end;
+
+
+
+
+
+declare
+begin
+portal_node_mapping.del(object_id => :object_id);
+end;
+
+
+
+
+
Index: openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/Attic/portal-node-mapping-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/tcl/portal-node-mapping-procs-postgresql.xql 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,19 @@
+
+
+
+postgresql7.1
+
+
+
+select portal_node_mapping__new(:object_id, :node_id)
+
+
+
+
+
+select portal_node_mapping__del(:object_id)
+
+
+
+
+
Index: openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/Attic/portal-node-mapping-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.tcl 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2001, 2002 OpenForce, Inc.
+#
+# This file is part of dotLRN.
+#
+# dotLRN is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+# details.
+#
+
+# tcl/portal-node-mapping-procs.tcl
+
+ad_library {
+ Portal Node Mappings
+
+ @author Ben Adida (ben@openforce)
+ @creation-date April 2002
+ @cvs-id $Id: portal-node-mapping-procs.tcl,v 1.1 2002/04/13 00:08:08 ben Exp $
+}
+
+namespace eval portal::mapping {
+
+ ad_proc -public set {
+ {-object_id:required}
+ {-node_id:required}
+ } {
+ db_exec_plsql set_node_mapping {}
+ }
+
+ ad_proc -public unset {
+ {-object_id:required}
+ } {
+ db_exec_plsql unset_node_mapping {}
+ }
+
+ ad_proc -public get_node_id {
+ {-object_id:required}
+ } {
+ return [db_string select_node_mapping {} -default ""]
+ }
+
+ ad_proc -public get_url {
+ {-object_id:required}
+ } {
+ set node_id [get_node_id -object_id $object_id]
+
+ if {[empty_string_p $node_id]} {
+ return $node_id
+ }
+
+ return [site_nodes::get_url_from_node_id -node_id $node_id]
+ }
+
+}
Index: openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/Attic/portal-node-mapping-procs.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/new-portal/tcl/portal-node-mapping-procs.xql 13 Apr 2002 00:08:08 -0000 1.1
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+select node_id from portal_node_mappings where object_id= :object_id
+
+
+
+