Index: openacs-4/packages/lors/sql/postgresql/lors-imscp-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors/sql/postgresql/lors-imscp-create.sql,v
diff -u -r1.7 -r1.7.2.1
--- openacs-4/packages/lors/sql/postgresql/lors-imscp-create.sql	17 May 2005 16:35:10 -0000	1.7
+++ openacs-4/packages/lors/sql/postgresql/lors-imscp-create.sql	13 Jun 2005 15:10:41 -0000	1.7.2.1
@@ -96,7 +96,20 @@
 );
 
 
+create or replace function ims_manifest__get_title (integer)
+returns varchar as '
+declare
+  get_title__man_id             alias for $1;  
+  get_title__course_name        varchar(200);  
+begin
+  return course_name
+  from ims_cp_manifests
+  where man_id = get_title__man_id;
 
+end;' language 'plpgsql';
+
+
+
 -- Organizations
 create table ims_cp_organizations (
     org_id          integer
@@ -133,7 +146,17 @@
        'ims_organization__get_title' -- name_method
 );
 
+create or replace function ims_organization__get_title (integer)
+returns varchar as '
+declare
+  get_title__org_id             alias for $1;  
+  get_title__identifier        varchar(200);  
+begin
+  return identifier
+  from ims_cp_organizations
+  where org_id = get_title__org_id;
 
+end;' language 'plpgsql';
 
 
 -- Items
@@ -164,7 +187,8 @@
     timelimitaction varchar(1000),
     datafromlms     varchar(200),
     masteryscore    varchar(255),
-    isshared	    boolean default 'f' not null
+    isshared	    boolean default 'f' not null,
+    sort_order      integer
 );
 
 -- create index for ims_cp_items
@@ -183,8 +207,19 @@
        'ims_item__get_title' -- name_method
 );
 
+create or replace function ims_item__get_title (integer)
+returns varchar as '
+declare
+  get_title__ims_item_id       	alias for $1;  
+  get_title__item_title        varchar(200);  
+begin
+  return item_title
+  from ims_cp_items
+  where ims_item_id = get_title__ims_item_id;
 
+end;' language 'plpgsql';
 
+
 -- Resources
     
 create table ims_cp_resources (
@@ -222,7 +257,19 @@
        'ims_resource__get_title' -- name_method
 );
 
+create or replace function ims_resource__get_title (integer)
+returns varchar as '
+declare
+  get_title__res_id             alias for $1;  
+  get_title__identifier        varchar(200);  
+begin
+  return identifier
+  from ims_cp_resources
+  where res_id = get_title__res_id;
 
+end;' language 'plpgsql';
+
+
 -- An item can have reference to one of more resources
 -- therefore we need a table that takes care of this multiple
 -- relationship
@@ -266,7 +313,7 @@
 create table ims_cp_files (
     file_id         integer
                     constraint ims_cp_files_file_if_fk
-                    references cr_items(item_id)
+                    references cr_revisions(revision_id)
                     on delete cascade,
     res_id          integer
                     constraint ims_cp_file_res_id_fk
@@ -298,8 +345,8 @@
 			constraint ims_cp_manifest_class__class_key_fk
   			references dotlrn_community_types(community_type),
     isenabled           boolean default 't' not null,
-    istrackable         boolean default 'f' not null,
-                        primary key (man_id, lorsm_instance_id)
+    istrackable         boolean default 'f' not null
+                        -- primary key (man_id, lorsm_instance_id)
 );
 
 comment on table ims_cp_manifest_class is '
