Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/courses/courses.info'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/courses/catalog/courses.en_US.ISO-8859-1.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/courses/sql/oracle/courses-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/sql/oracle/courses-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/sql/oracle/courses-create.sql 2 Feb 2005 17:16:30 -0000 1.1 @@ -0,0 +1,35 @@ +-- Course Catalog Data Model +-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net) +-- creation-date 2005-01-31 + +create table c_catalog ( + course_id integer constraint c_catalog_fk + references course_catalog + constraint c_catalog_pk + primary key +); + + +begin + acs_rel_type.create_role(''c_catalog_role'', ''Course Catalog Role'', ''Course Catalog Role''); + acs_rel_type.create_role(''dotlrn_class_role'', ''dotLRN Class Role'', ''dotLRN Class Role''); + acs_rel_type.create_type ( + rel_type => 'courses_catalog_rel', + pretty_name => 'Courses Catalog Relationship', + pretty_plural => 'Courses Catalog Relationship', + object_type_one => 'course_catalog', + role_one => 'c_catalog_role', + table_name => 'c_catalog', + id_column => 'course_id', + package_name => 'course_catalog_rel', + min_n_rels_one => 0, + max_n_rels_one => 1, + object_type_two => 'dotlrn_class_instance', + min_n_rels_two => 0, + max_n_rels_two => 1 + ); + + commit; +end; +/ +show errors \ No newline at end of file Index: openacs-4/packages/courses/sql/oracle/courses-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/sql/oracle/courses-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/sql/oracle/courses-drop.sql 2 Feb 2005 17:16:30 -0000 1.1 @@ -0,0 +1,11 @@ +-- +-- +-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net) +-- creation-date 2005-01-31 +-- + +begin + acs_rel_type.drop_type('courses_catalog_rel'); +end; +/ +show errors \ No newline at end of file Index: openacs-4/packages/courses/sql/postgresql/courses-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/sql/postgresql/courses-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/sql/postgresql/courses-create.sql 2 Feb 2005 17:17:49 -0000 1.1 @@ -0,0 +1,42 @@ +-- Courses Catalog Relation Model +-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net) +-- creation-date 2005-01-31 + + +create table c_catalog ( + course_id integer constraint c_catalog_fk + references course_catalog + constraint c_catalog_pk + primary key +); + +create function inline_0 () +returns integer as ' +begin + PERFORM acs_rel_type__create_role(''c_catalog_role'', ''Course Catalog Role'', ''Course Catalog Role''); + PERFORM acs_rel_type__create_role(''dotlrn_class_role'', ''dotLRN Class Role'', ''dotLRN Class Role''); + + PERFORM acs_rel_type__create_type ( + ''course_catalog_rel'', + ''Course Catalog Relationship'', + ''Course Catalog Relationship'', + ''relationship'', + ''c_catalog'', + ''course_id'', + ''course_catalog_rel'', + ''course_catalog'', + ''c_catalog_role'', + 0, + 1, + ''dotlrn_class_instance'', + ''dotlrn_class_role'', + 0, + 1 + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); + +drop function inline_0 (); \ No newline at end of file Index: openacs-4/packages/courses/sql/postgresql/courses-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/sql/postgresql/courses-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/sql/postgresql/courses-drop.sql 2 Feb 2005 17:17:49 -0000 1.1 @@ -0,0 +1,8 @@ +-- +-- +-- author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net) +-- creation-date 2005-01-31 +-- + +drop table c_catalog; +select acs_rel_type__drop_type('courses_catalog_rel', 'f'); Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/courses/tcl/apm-callback-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/courses/tcl/course-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/tcl/course-procs-oracle.xql 2 Feb 2005 17:19:54 -0000 1.1 @@ -0,0 +1,26 @@ + + +oracle8.1.6 + + + + begin + :1 := acs_rel.new ( + rel_type => 'user_portrait_rel', + object_id_one => :course_id, + object_id_two => :class_id); + end; + + + + + + begin + :1 := acs_rel.delete ( + rel_id => :rel_id); + end; + + + + + \ No newline at end of file Index: openacs-4/packages/courses/tcl/course-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/tcl/course-procs-postgresql.xql 2 Feb 2005 17:19:54 -0000 1.1 @@ -0,0 +1,28 @@ + + +postgresql7.4 + + + + select acs_rel__new ( + null, + 'course_catalog_rel', + :course_id, + :class_id, + null, + null, + null + ) + + + + + + select acs_rel__delete ( + :rel_id + ) + + + + + \ No newline at end of file Index: openacs-4/packages/courses/tcl/course-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/tcl/course-procs.tcl 2 Feb 2005 17:19:54 -0000 1.1 @@ -0,0 +1,128 @@ +ad_library { + + Tcl API for course_catalog store and manipulation + + @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net) +} + +namespace eval course_catalog {} + +ad_proc -private course_catalog::get_folder_id { } { + Returns the folder_id of the folder with the name "Course Catalog" +} { + return [db_string check_folder_name { } ] +} + +ad_proc -private course_catalog::get_item_id { + -name:required + -parent_id:required + -content_type:required +} { + Returns the item_id in the CR with the name @name@ under folder_id @folder_id@ + @name@ The name of the item id in the CR + @parent_id@ The folder_id where the item is stored + @content_type@ The content_type of the item +} { + + return [db_string get_item_from_name { } ] +} + +ad_proc -private course_catalog::set_live { + -name:required + -revision_id:required +} { + Sets the live_revision to @revision_id@ where name in cr_items equals @name@ + @name@ The item name in CR + @revision_id@ The revision to set as live +} { + db_transaction { + db_dml set_live_revision { } + } +} + + +ad_proc -private course_catalog::rename { + -item_id:required + -name:required +} { + Sets the item name to @name@ for given item_id + @revision_id@ The item_id of the item in the CR + @name@ The new name for the item in CR +} { + db_transaction { + db_dml set_item_name { } + } +} + + +ad_proc -public course_catalog::add_relation { + -course_id:required + -class_id:required +} { + Add a new relation between course_id from course_catalog and a class_instance_id from dotlrn + @course_id The id of the course in course_catalog + @class_id the class_instance_id of the class in dotlrn +} { + db_exec_plsql add_relation { } +} + +ad_proc -public course_catalog::has_relation { + -course_id:required +} { + Returns the class_id of dotlrn_class_instance related to course_id, returns 0 otherwise. + @course_id The id of the course in course_catalog +} { + return [db_string has_relation { } -default 0] +} + +ad_proc -public course_catalog::has_relation_rel_id { + -course_id:required +} { + Returns the class_id of dotlrn_class_instance related to course_id, returns 0 otherwise. + @course_id The id of the course in course_catalog +} { + return [db_string has_relation_rel_id { } -default 0] +} + + +ad_proc -public course_catalog::check_live_latest { + -revision_id:required +} { + Deletes the row of course_catalog table and cr_revisions table where revision_id = @course_id@ + @revision_id The id of the revision in cr_items +} { + set live [db_string check_live { } -default 0] + set latest [db_string check_latest { } -default 0] + if { [string equal $live "0"] && [string equal $latest "0"] } { + return 1 + } else { + return 0 + } +} + +ad_proc -public course_catalog::delete_row { + -course_id:required +} { + Deletes the row of course_catalog table and cr_revisions table where revision_id = @course_id@ + @course_id The id of the course in course_catalog +} { + if { [course_catalog::check_live_latest -revision_id $course_id] } { + db_transaction { + db_dml delete_row { } + db_dml delete_rev { } + } + course_catalog::delete_relation -course_id $course_id + } +} + +ad_proc -public course_catalog::delete_relation { + -course_id:required +} { + Deletes the relation of course_catalog and dotrln class + @object_id The id of the object_id_one +} { + set rel_id [course_catalog::has_relation_rel_id -course_id $course_id] + if { ![string equal $rel_id "0"] } { + db_exec_plsql remove_relation { } + } +} Index: openacs-4/packages/courses/tcl/course-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/courses/tcl/course-procs.xql 2 Feb 2005 17:19:54 -0000 1.1 @@ -0,0 +1,80 @@ + + + + + + select folder_id from cr_folders + where label = 'Course Catalog' + + + + + + select item_id from cr_items + where name = :name and parent_id = :parent_id and content_type = :content_type + + + + + + update cr_items + set live_revision = :revision_id + where name = :name + + + + + + update cr_items + set name = :name + where item_id = :item_id + + + + + + select object_id_two + from acs_rels where + rel_type = 'course_catalog_rel' and object_id_one = :course_id + + + + + + select rel_id + from acs_rels where + rel_type = 'course_catalog_rel' and object_id_one = :course_id + + + + + + + delete from course_catalog where course_id = :course_id + + + + + + delete from cr_revisions where revision_id = :course_id + + + + + + select 1 from cr_items where live_revision = :revision_id + + + + + + select 1 from cr_items where latest_revision = :revision_id + + + + + + + + +