Index: openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml,v
diff -u -r1.19 -r1.20
--- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 20 Apr 2006 08:50:52 -0000 1.19
+++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 16 May 2006 09:24:34 -0000 1.20
@@ -5,6 +5,7 @@
+
Index: openacs-4/packages/imsld/lib/imsld-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/lib/imsld-chunk.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/imsld/lib/imsld-chunk.tcl 19 Apr 2006 16:29:19 -0000 1.7 +++ openacs-4/packages/imsld/lib/imsld-chunk.tcl 16 May 2006 09:24:35 -0000 1.8 @@ -6,46 +6,49 @@ set imsld_url "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]" template::list::create \ - -name imslds \ - -multirow imslds \ - -key imsld_id \ + -name imsld_runs \ + -multirow imsld_runs \ + -key run_id \ -elements { imsld_title { label "[_ imsld.IMS_LD_Name]" orderby_asc {imsld_title asc} orderby_desc {imsld_title desc} - display_template {@imslds.imsld_title@} + display_template {@imsld_runs.imsld_title@} } creation_date { - label "Creation Date" + label "[_ imsld.Creation_Date]" orderby_asc {creation_date asc} orderby_desc {creation_date desc} } } \ -orderby { default_value imsld_title } -set orderby [template::list::orderby_clause -orderby -name imslds] +set orderby [template::list::orderby_clause -orderby -name imsld_runs] if {[string equal $orderby ""]} { set orderby " order by imsld_title asc" } set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] -db_multirow imslds get_manifests " - select imsld.imsld_id, +db_multirow imsld_runs get_manifests " + select run.run_id, coalesce(imsld.title, imsld.identifier) as imsld_title, - to_char(imsld.creation_date,'MM/DD/YYYY HH24:MI') as creation_date - from cr_items cr1, cr_items cr2, cr_items cr3, cr_items cr4, - imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld - where cr1.live_revision = icm.manifest_id + to_char(ao.creation_date,'MM/DD/YYYY HH24:MI') as creation_date + from cr_items cr1, cr_items cr2, cr_items cr3, cr_items cr4, acs_objects ao, + imsld_runs run, imsld_cp_manifests icm, imsld_cp_organizations ico, imsld_imsldsi imsld + where run.imsld_id = imsld.imsld_id + and ao.object_id = run.run_id + and cr1.live_revision = icm.manifest_id and cr1.parent_id = cr4.item_id and cr4.parent_id = :cr_root_folder_id and ico.manifest_id = cr1.item_id and imsld.organization_id = cr2.item_id and cr2.live_revision = ico.organization_id and cr3.live_revision = imsld.imsld_id + and run.status = 'active' $orderby " {} Index: openacs-4/packages/imsld/sql/postgresql/imsld-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-create.sql,v diff -u -r1.14 -r1.15 --- openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 30 Mar 2006 09:47:01 -0000 1.14 +++ openacs-4/packages/imsld/sql/postgresql/imsld-create.sql 16 May 2006 09:24:35 -0000 1.15 @@ -9,4 +9,5 @@ \i imsld-cp-create.sql \i imsld-level-b-create.sql \i imsld-production-delivery-create.sql +\i imsld-production-delivery-package-create.sql \i imsld-tree-create.sql Index: openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 29 Mar 2006 15:55:24 -0000 1.8 +++ openacs-4/packages/imsld/sql/postgresql/imsld-drop.sql 16 May 2006 09:24:35 -0000 1.9 @@ -13,4 +13,6 @@ \i imsld-production-delivery-drop.sql +\i imsld-production-delivery-package-drop.sql + \i imsld-level-b-drop.sql \ No newline at end of file Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 29 Mar 2006 15:55:24 -0000 1.3 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 16 May 2006 09:24:35 -0000 1.4 @@ -6,36 +6,36 @@ -- create table imsld_properties ( - property_id integer - constraint imsld_pro_id_fk - references cr_revisions - on delete cascade - constraint imsld_pro_id_pk - primary key, - component_id integer - constraint imsld_pro_comp_fk - references cr_items --imsld_components - not null, - identifier varchar(100) - not null, - type varchar(20) - check (type in ('loc','locpers','locrole','globpers','global')), - datatype varchar(20) - check (datatype in ('boolean','integer','real','string','file','uri','datetime','duration','text','other')), - initial_value varchar(4000), - role_id integer - constraint imsld_pro_rid_fk - references cr_items, --imsld_roles - existing_href varchar(2000), - uri varchar(2000) + property_id integer + constraint imsld_pro_id_fk + references cr_revisions + on delete cascade + constraint imsld_pro_id_pk + primary key, + component_id integer + constraint imsld_pro_comp_fk + references cr_items --imsld_components + not null, + identifier varchar(100) + not null, + type varchar(20) + check (type in ('loc','locpers','locrole','globpers','global')), + datatype varchar(20) + check (datatype in ('boolean','integer','real','string','file','uri','datetime','duration','text','other')), + initial_value varchar(4000), + role_id integer + constraint imsld_pro_rid_fk + references cr_items, --imsld_roles + existing_href varchar(2000), --the href of the existing properties + uri varchar(2000) --for global_definition elements: the uri ); create index imsld_prop_comp_idx on imsld_properties(component_id); comment on table imsld_properties is ' Properties are introduced in the level B of the IMS-LD spec, and are stored in this table (the definition, because the instantiantion for each user/role is stored in the imsld_property_instanced table). -The global definitions of the globpers and global property types are stored in the same row of the table (in this case the existing_href field is not null)'; +The global definitions of the globpers and global property types are stored in this table also, because they share all but one fields.'; create table imsld_property_groups ( property_group_id integer @@ -297,9 +297,3 @@ --This then model consists in three types: show, hide (elements refered by ref_id and ref_type -- to know what table are we refering to) or change property value, with the respective reference to the property and value to be changed.'; - - - - - - Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 29 Mar 2006 15:55:24 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 16 May 2006 09:24:35 -0000 1.2 @@ -7,43 +7,66 @@ -- @creation-date sept-2005 -- +create table imsld_runs ( + run_id integer + constraint imsld_run_fk + references acs_objects + on delete cascade + constraint imsld_run_pk + primary key, + imsld_id integer + constraint imsld_run_imsld_id_fk + references imsld_imslds + not null, + status varchar(15) +); + +create index imsld_run_imsld_idx on imsld_runs(imsld_id); + +comment on table imsld_runs is ' +This table holds the runs of a UoL as suggested in the specification. In this case a run is just an identifier mapped to the UoL, and the users, roles, properties and status will be mapped to the run_id, allowing multiple instances of the same UoL.'; + create table imsld_status_user ( - imsld_id integer - constraint imsld_stat_imsldid_fk - references imsld_imslds - not null, - play_id integer - constraint imsld_stat_pl_fk - references imsld_plays, - act_id integer - constraint imsld_stat_act_fk - references imsld_acts, - role_part_id integer - constraint imsld_stat_rp_fk - references imsld_role_parts, - related_id integer - constraint imsld_stat_aid_fk - references cr_revisions -- reference to a learning_activity OR support_activity OR - not null, -- activity_structure OR environment OR role_part OR act OR play - user_id integer - constraint imsld_stat_user_fk - references users - not null, - role_id integer - constraint imsld_stat_role_fk - references cr_revisions, -- imsld_roles (not implemented, add not null then) - type varchar(20) - check (type in ('learning','support','structure','act','role-part','play','method','resource')), - status_date timestamptz - default current_timestamp - not null, - status varchar(20) - check (status in ('started','finished')), + imsld_id integer + constraint imsld_stat_imsldid_fk + references imsld_imslds + not null, + run_id integer + constraint imsld_stat_rn_fk + references imsld_runs, + play_id integer + constraint imsld_stat_pl_fk + references imsld_plays, + act_id integer + constraint imsld_stat_act_fk + references imsld_acts, + role_part_id integer + constraint imsld_stat_rp_fk + references imsld_role_parts, + related_id integer + constraint imsld_stat_aid_fk + references cr_revisions -- reference to a learning_activity OR support_activity OR + not null, -- activity_structure OR environment OR role_part OR act OR play + user_id integer + constraint imsld_stat_user_fk + references users + not null, + role_id integer + constraint imsld_stat_role_fk + references cr_revisions, -- imsld_roles (not implemented, add not null then) + type varchar(20) + check (type in ('learning','support','structure','act','role-part','play','method','resource')), + status_date timestamptz + default current_timestamp + not null, + status varchar(20) + check (status in ('started','finished')), constraint imsld_status_un - unique (related_id,user_id,status) + unique (run_id,related_id,user_id,status) ); create index imsld_stat_imsld_idx on imsld_status_user(imsld_id); +create index imsld_stat_run_idx on imsld_status_user(run_id); create index imsld_stat_rp_idx on imsld_status_user(role_part_id); create index imsld_stat_comp_idx on imsld_status_user(related_id); create index imsld_stat_user_idx on imsld_status_user(user_id); @@ -54,23 +77,54 @@ create table imsld_property_instances ( instance_id integer - constraint imsld_pin_fk - references cr_revisions - on delete cascade constraint imsld_pin_pk primary key, property_id integer constraint imsld_pin_pro_fk - references imsld_properties --since this table will only be used during run time, and because - not null, --of performance issues, the reference is directly to the imsld_properties table + references imsld_properties -- since this table will only be used during run time, and because + not null, -- of performance issues, the reference is directly to the imsld_properties table. + identifier varchar(100) -- the same identifier that the corresponding propert (cache) + not null, party_id integer - references parties, --for the property of type loc, locpers, locrole orpst globpers + references parties, -- for the property of type loc, locpers, locrole orpst globpers + run_id integer + constraint imsld_pin_rn_fk + references imsld_runs, value varchar(4000) ); create index imsld_prop_pin_pro_idx on imsld_property_instances(property_id); create index imsld_prop_pin_party_idx on imsld_property_instances(party_id); +create index imsld_prop_pin_run_idx on imsld_property_instances(run_id); comment on table imsld_property_instances is ' This table holds the property instance values of the unit of learning. The property may refer to a role (role instance, which is a group) or a single user, using the party_id field.'; + +create table imsld_attribute_instances ( + instance_id integer + constraint imsld_attri_pk + primary key, + owner_id integer + constraint imsld_atri_own_fk + references cr_revisions, -- learning or support acctivity, item, play, learning object or service + type varchar(10) -- isvissible or class + check (type in ('isvisible','class')), + name varchar(100), -- for instance, for the class attribute we need to know the class name + run_id integer + constraint imsld_pin_rn_fk + references imsld_runs, + is_visible_p char(1) + check (is_visible_p in ('t','f')) +); + +create index imsld_attri_own_idx on imsld_attribute_instances(owner_id); +create index imsld_attri_run_idx on imsld_attribute_instances(run_id); + +comment on table imsld_attribute_instances is ' +This table holds the attribute instances for those attributes like isvisible or class (by the +moment only used to indicate if the activity, play or whatever is visible or not) +which scope is the current run. So every time a run is created, those attributes can be +initializated according to the initial parsed values from the manifest, not being affected +by a previous run.'; + Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql 29 Mar 2006 15:55:24 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql 16 May 2006 09:24:35 -0000 1.2 @@ -5,5 +5,10 @@ -- @creation-date sept-2005 -- +drop table imsld_runs cascade; + drop table imsld_status_user cascade; +drop table imsld_property_instances cascade; + +drop table imsld_attribute_instances cascade; \ No newline at end of file Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql 16 May 2006 09:24:35 -0000 1.1 @@ -0,0 +1,206 @@ +-- P/pgLSQL packages for the production deivery datamodel +-- +-- @author jopez@inv.it.uc3m.es +-- @creation-date Abr 2006 + +select acs_object_type__create_type ( + 'imsld_run', --object type + 'IMS-LD Run', --pretty name + 'IMS-LD Runss', --pretty prural + 'acs_object', --supertype + 'imsld_runs', --table_name + 'run_id', --id_column + null, --package_name + 'f', --abstract_p + null, --type_extension_table + null --name_method +); + +insert into acs_object_type_tables + (object_type, table_name, id_column) + values + ('imsld_run', 'imsld_runs', 'run_id'); + +select acs_attribute__create_attribute ( + 'imsld_run', --object_type + 'imsld_id', --oattribute_name + 'integer', --datatype + 'IMS-LD id', --pretty_name + 'IMS-LD ids', --pretty_plural + 'imsld_runs', --table_name + 'imsld_id', --column_name + null, --default_value + 1, --min_n_values + 1, --max_n_values + null, --sort_order + 'type_specific', --storage + 'f' --static_p +); + +select acs_attribute__create_attribute ( + 'imsld_run', --object_type + 'status', --oattribute_name + 'string', --datatype + 'Status', --pretty_name + 'Status', --pretty_plural + 'imsld_runs', --table_name + 'status', --column_name + null, --default_value + 1, --min_n_values + 1, --max_n_values + null, --sort_order + 'type_specific', --storage + 'f' --static_p +); + +select define_function_args('imsld_run__new','run_id,imsld_id,status,object_type,creation_date,creatrion_user,creation_ip,context_id,title'); +create or replace function imsld_run__new ( + integer, -- run_id + integer, -- imsld_id + varchar, -- status + varchar, -- object_type + timestamptz, -- creation_date + integer, -- creation_user + varchar, -- creation_ip + integer, -- context_id + varchar -- title +) +returns integer as ' +declare + p_run_id alias for $1; -- default null, + p_imsld_id alias for $2; + p_status alias for $3; + p_object_type alias for $4; -- default ''imsld_run'' + p_creation_date alias for $5; -- default now() + p_creation_user alias for $6; -- default null + p_creation_ip alias for $7; -- default null + p_context_id alias for $8; -- default null + p_title alias for $9; -- default null + + v_run_id integer; + v_object_type varchar; + +begin + if p_object_type is null then + v_object_type := ''imsld_run''; + else + v_object_type := p_object_type; + end if; + + -- Instantiate the ACS Object super type + v_run_id := acs_object__new( + p_run_id, + v_object_type, + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id, + ''t'', + p_title, + null + ); + + insert into imsld_runs (run_id, imsld_id, status) + values (v_run_id, p_imsld_id, p_status); + + return v_run_id; +end; +' language 'plpgsql'; + +create or replace function imsld_run__del (integer) +returns integer as ' +declare + p_run_id alias for $1; +begin + perform acs_object__delete(p_run_id); + + return 0; +end;' language 'plpgsql'; + +select define_function_args('imsld_property_instance__new','instance_id,property_id,identifier,party_id,run_id,value'); +create or replace function imsld_property_instance__new ( + integer, -- instance_id + integer, -- property_id + varchar, -- identifier + integer, -- party_id + integer, -- run_id + varchar -- value +) +returns integer as ' +declare + p_property_instance_id alias for $1; -- default null + p_property_id alias for $2; + p_identifier alias for $3; + p_party_id alias for $4; -- default null + p_run_id alias for $5; + p_value alias for $6; -- default ''
Tag a resource as finished into an activity. Return true if success, false otherwise
@@ -4168,6 +3971,7 @@ where icr.item_id = :res_id and icr.resource_id = stat.completed_id and user_id = :user_id + and run_id = :run_id }] } { # if the resource is not in the imsld_status_user, then the resource is not finished set all_finished_p 0 @@ -4180,6 +3984,7 @@ if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] } { foreach role_part_id $role_part_id_list { imsld::finish_component_element -imsld_id $imsld_id \ + -run_id $run_id \ -role_part_id $role_part_id \ -element_id $activity_id \ -type $activity_type\ @@ -4217,4 +4022,4 @@ } } ad_register_proc GET /finish-component-element* imsld::finish_component_element -ad_register_proc POST /finish-component-element* imsld::finish_component_element +ad_register_proc POST /finish-component-elementx* imsld::finish_component_element Index: openacs-4/packages/imsld/tcl/imsld-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v diff -u -r1.19 -r1.20 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 19 Apr 2006 16:29:20 -0000 1.19 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 16 May 2006 09:24:35 -0000 1.20 @@ -193,6 +193,7 @@