Index: openacs-4/packages/dotlrn-imsld/tcl/dotlrn-imsld-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-imsld/tcl/dotlrn-imsld-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/dotlrn-imsld/tcl/dotlrn-imsld-procs.tcl 25 Apr 2006 10:48:46 -0000 1.5
+++ openacs-4/packages/dotlrn-imsld/tcl/dotlrn-imsld-procs.tcl 20 Sep 2006 08:26:28 -0000 1.6
@@ -109,14 +109,14 @@
} {
Add a user to a specifc dotlrn community
} {
-# set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
-# set portal_id [dotlrn::get_portal_id -user_id $user_id]
+ set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
-# # use "append" here since we want to aggregate
-# set args [ns_set create]
-# ns_set put $args package_id $package_id
-# ns_set put $args param_action append
-# add_portlet_helper $portal_id $args
+ # use "append" here since we want to aggregate
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action append
+ add_portlet_helper $portal_id $args
}
ad_proc -public dotlrn_imsld::remove_user_from_community {
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.28 -r1.29
--- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 19 Sep 2006 11:02:48 -0000 1.28
+++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 20 Sep 2006 08:26:29 -0000 1.29
@@ -12,6 +12,7 @@
Caluclate Identifier
Calulate Identifier
Class
+ Community
Complete Act
Complete Acts
Component Identifier
@@ -116,6 +117,7 @@
Activity Structure Identifier
<br /> Warnings: <ul> %warnings% </ul>
Change Property Value Identifier
+ Change Property Value XML
Complete Act Identifier
Could not determine whit what program uncompress the file %upload_file% has. Aborting
Couldn't determine if this is a well formed IMS-LD: %message%
@@ -263,6 +265,7 @@
We will continue automatically when processing is complete.
When Last Act Completed?
When Property Value is Set Identifier
+ When property value is set XML
Mail Data
(make it live)
Manage Members
@@ -304,6 +307,7 @@
Restriction Type
Role Identifier
Role Type
+ Role(s) in Run
Run (IMS-LD) Name
Runs (IMS-LD instances)
select user...
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.10 -r1.11
--- openacs-4/packages/imsld/lib/imsld-chunk.tcl 20 Jun 2006 19:20:38 -0000 1.10
+++ openacs-4/packages/imsld/lib/imsld-chunk.tcl 20 Sep 2006 08:26:29 -0000 1.11
@@ -1,34 +1,35 @@
# imsld/lib/imsld-chunk.tcl
-set imsld_package_id [site_node_apm_integration::get_child_package_id \
- -package_id [dotlrn_community::get_package_id $community_id] \
- -package_key "[imsld::package_key]"]
-set imsld_url "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]"
set user_id [ad_conn user_id]
+set elements [list imsld_title \
+ [list label "[_ imsld.IMS_LD_Name]" \
+ orderby_asc {imsld_title asc} \
+ orderby_desc {imsld_title desc} \
+ display_template {@imsld_runs.imsld_title@}] \
+ user_roles \
+ [list label "[_ imsld.Roles_in_Run]" \
+ display_template {@imsld_runs.user_roles;noquote@}] \
+ status \
+ [list label "[_ imsld.Status]" \
+ orderby_asc {status asc} \
+ orderby_desc {status desc} \
+ display_template {}] \
+ creation_date \
+ [list label "[_ imsld.Creation_Date]" \
+ orderby_asc {creation_date asc} \
+ orderby_desc {creation_date desc}]]
+
+if { [llength $$list_of_package_ids] > 1 } {
+ lappend elements community_name \
+ [list label "[_ imsld.Community]"]
+}
+
template::list::create \
-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 {@imsld_runs.imsld_title@}
- }
- status {
- label "[_ imsld.Status]"
- orderby_asc {status asc}
- orderby_desc {status desc}
- display_template {}
- }
- creation_date {
- label "[_ imsld.Creation_Date]"
- orderby_asc {creation_date asc}
- orderby_desc {creation_date desc}
- }
- } \
+ -elements $elements \
-orderby { default_value imsld_title }
@@ -38,30 +39,45 @@
set orderby " order by imsld_title asc"
}
-set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id]
+template::multirow create imsld_runs run_id imsld_title creation_date image_alt image_title image_path imsld_url community_name user_roles
+
+foreach package_id $list_of_package_ids {
+
+ set community_id [dotlrn_community::get_community_id_from_url -url [site_node::get_url -node_id [site_node::get_node_id_from_object_id -object_id $package_id]]]
+ set community_name [dotlrn_community::get_community_name $community_id]
-template::multirow create imsld_runs run_id imsld_title creation_date image_alt image_title image_path
+ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id]
+
+ set imsld_package_id [site_node_apm_integration::get_child_package_id \
+ -package_id [dotlrn_community::get_package_id $community_id] \
+ -package_key "[imsld::package_key]"]
+ set imsld_url "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]"
-db_foreach active_runs { *SQL* } {
- if { [llength [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]] } {
- switch $status {
- waiting {
- set image_alt "[_ imsld.waiting]"
- set image_title "[_ imsld.waiting]"
- set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/waiting.png"
+ db_foreach active_runs { *SQL* } {
+ set user_roles_ids_list [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]
+ if { [llength $user_roles_ids_list] } {
+ switch $status {
+ waiting {
+ set image_alt "[_ imsld.waiting]"
+ set image_title "[_ imsld.waiting]"
+ set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/waiting.png"
+ }
+ active {
+ set image_alt "[_ imsld.active]"
+ set image_title "[_ imsld.active]"
+ set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/active.png"
+ }
+ stopped {
+ set image_alt "[_ imsld.stopped]"
+ set image_title "[_ imsld.stopped]"
+ set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png"
+ }
}
- active {
- set image_alt "[_ imsld.active]"
- set image_title "[_ imsld.active]"
- set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/active.png"
- }
- stopped {
- set image_alt "[_ imsld.stopped]"
- set image_title "[_ imsld.stopped]"
- set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png"
- }
+ set role_names [imsld::roles::get_roles_names -roles_list $user_roles_ids_list]
+ # remove added in the previous proc
+ regsub -all " " $role_names "" $role_names
+ template::multirow append imsld_runs $run_id $imsld_title $creation_date $image_alt $image_title $image_path $imsld_url $community_name [join $role_names "
"]
}
- template::multirow append imsld_runs $run_id $imsld_title $creation_date $image_alt $image_title $image_path
}
}
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.8 -r1.9
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 21 Jun 2006 13:01:34 -0000 1.8
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-b-create.sql 20 Sep 2006 08:26:29 -0000 1.9
@@ -78,27 +78,6 @@
comment on table imsld_restrictions is '
Restrictions of the properties. Defined in the IMS-LD spec';
-create table imsld_properties_values (
- property_value_id integer
- constraint imsld_propv_id_fk
- references cr_revisions
- on delete cascade
- constraint imsld_propv_id_pk
- primary key,
- property_id integer
- constraint imsld_propv_prop_fk
- references cr_items --imsld_properties
- not null,
- langstring varchar(400),
- expression_xml text, --calcualte, which is actually an expression
- property_value_ref integer
- constraint imsld_prop_ref_fk
- references cr_items --imsld_properties_values
-);
-
-comment on table imsld_properties_values is '
-Table used to store the values of the properties for the ''when_property_value_is set'' and ''change_property_value''.';
-
create table imsld_monitor_services (
monitor_id integer
constraint imsld_monserv_fk
@@ -147,11 +126,15 @@
comment on table imsld_when_condition_true is '
Simple expression for a condition. This condition applies to all the individual users mentioned in the containing role-ref. When the contained expression is true for all users in the specified roles, this condition is true.';
+alter table imsld_on_completion add column change_property_value_xml text;
+
alter table imsld_send_mail_services add column email_property_id integer constraint imsld_emailprop_fk references cr_items; --imsld_properties
alter table imsld_send_mail_services add column username_property_id integer constraint imsld_unameprop_fk references cr_items; --imsld_properties
alter table imsld_complete_acts add column time_property_id integer constraint imsld_compa_timepropv_fk references cr_items; --imsld_properties
-alter table imsld_complete_acts add column when_prop_val_is_set_id integer constraint imsld_compa_wpvis_fk references cr_items; --imsld_properties_values
+
+alter table imsld_complete_acts add column when_prop_val_is_set_xml text;
+
alter table imsld_complete_acts add column when_condition_true_id integer constraint imsld_compa_whencondt_fk references cr_items; --imsld_properties
Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-b-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-b-drop.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-b-drop.sql 21 Jun 2006 11:12:13 -0000 1.2
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-b-drop.sql 20 Sep 2006 08:26:29 -0000 1.3
@@ -11,8 +11,6 @@
drop table imsld_restrictions cascade;
-drop table imsld_property_values cascade;
-
drop table imsld_monitor_services cascade;
drop table imsld_when_condition_true cascade;
Index: openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl,v
diff -u -r1.14 -r1.15
--- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 26 Jul 2006 14:37:27 -0000 1.14
+++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 20 Sep 2006 08:26:30 -0000 1.15
@@ -60,26 +60,323 @@
-run_id
} {
} {
-foreach condition_xml [db_list get_other_conditions {
- select ici.condition_xml
- from imsld_conditionsi ici,
- imsld_methodsi imi,
- imsld_imsldsi iii,
- imsld_runs iri
- where ici.item_id not in (select object_id_two
- from acs_rels
- where (rel_type='imsld_prop_cond_rel' or rel_type='imsld_ilm_cond_rel'))
- and ici.method_id=imi.item_id
- and imi.imsld_id=iii.item_id
- and iri.imsld_id=iii.imsld_id
- and iri.run_id=:run_id
+ foreach condition_xml [db_list get_other_conditions {
+ select ici.condition_xml
+ from imsld_conditionsi ici,
+ imsld_methodsi imi,
+ imsld_imsldsi iii,
+ imsld_runs iri
+ where ici.item_id not in (select object_id_two
+ from acs_rels
+ where (rel_type='imsld_prop_cond_rel' or rel_type='imsld_ilm_cond_rel'))
+ and ici.method_id=imi.item_id
+ and imi.imsld_id=iii.item_id
+ and iri.imsld_id=iii.imsld_id
+ and iri.run_id=:run_id
}] {
dom parse $condition_xml document
$document documentElement condition_node
imsld::condition::execute -run_id $run_id -condition $condition_node
}
}
+ad_proc -public imsld::condition::eval_when_condition_true {
+ -when_condition_true_item_id:required
+ -run_id:required
+} {
+ Executes the expression of the when-condition-true for all the roles, and if it's for all the individual users
+ of the role, then the act which references when-condition-true is set to completed.
+} {
+ # 1. get the epression and the role from the when-condition-true table
+ # 2. get all the users in the role and evaluate the expression for all of them
+ # 3. if the expression is true for all of the users, mark the act as completed
+
+ # 1. get the expression and role
+ db_1row get_condition_info {
+ select iri.role_id,
+ iwct.expression_xml
+ from imsld_when_condition_truei iwct, imsld_rolesi iri
+ where iwct.item_id = :when_condition_true_item_id
+ and iwct.role_id = iri.item_id
+ and content_revision__is_live(iri.role_id) = 't'
+ }
+
+ # 2. evaluate the expression for all the users
+ set expression_true_p 1
+ dom parse $expression_xml document
+ $document documentElement expression_root
+ set expression [$expression_root childNodes]
+ foreach member_id [imsld::roles::get_users_in_role -role_id $role_id -run_id $run_id] {
+ if { ![imsld::expression::eval -run_id $run_id -expression $expression -user_id $member_id] } {
+ # expression is false for one user. exit
+ set expression_true_p 0
+ break
+ }
+ }
+
+ # 3. if the expression is true for all of the users, mark the rererencer act as completed
+ db_1row get_context_info {
+ select ir.imsld_id,
+ ip.play_id
+ from imsld_runs ir,
+ imsld_methodsi im,
+ imsld_playsi ip,
+ imsld_imsldsi ii
+ where ir.run_id = :run_id
+ and ir.imsld_id = ii.imsld_id
+ and im.imsld_id = ii.item_id
+ and ip.method_id = im.item_id
+ and content_revision__is_live(ip.play_id) = 't'
+ }
+
+ if { $expression_true_p } {
+ # get the act_id
+ db_1row get_act_from_when_cond_true_id {
+ select ia.act_id
+ from imsld_actsi ia,
+ imsld_complete_actsi ica
+ where ica.when_condition_true_id = :when_condition_true_item_id
+ and ia.complete_act_id = ica.item_id
+ }
+ # mark the act completed for all the users in the run
+ set users_in_run [db_list get_users_in_run {
+ select gmm.member_id
+ from group_member_map gmm,
+ imsld_run_users_group_ext iruge,
+ acs_rels ar1
+ where iruge.run_id=:run_id
+ and ar1.object_id_two=iruge.group_id
+ and ar1.object_id_one=gmm.group_id
+ group by member_id
+ }]
+ foreach user $users_in_run {
+ if { [imsld::user_participate_p -run_id $run_id -act_id $act_id -user_id $user]} {
+ imsld::mark_act_finished -act_id $act_id \
+ -play_id $play_id \
+ -imsld_id $imsld_id \
+ -run_id $run_id \
+ -user_id $user
+ }
+ }
+ }
+}
+
+ad_proc -public imsld::condition::eval_change_property_value {
+ -change_property_value_xml:required
+ -run_id:required
+} {
+ Executes the expression of the change-property-value and sets the result to the associated property.
+} {
+ dom parse $change_property_value_xml document
+ $document documentElement change_property_value_root
+ imsld::statement::execute -run_id $run_id -statement [$change_property_value_root childNodes]
+}
+
+ad_proc -public imsld::condition::eval_when_prop_value_is_set {
+ -complete_act_item_id:required
+ -run_id:required
+} {
+ Executes the expression of the when-property-value-is-set and compares the result with the referenced property. If the value is the same for both of them (or if there is no expression at all), the referenced activity is marked as completed.
+} {
+ # get the referenced expression in order to evaluate it
+ db_1row context_info {
+ select when_prop_val_is_set_xml
+ from imsld_complete_actsi
+ where item_id = :complete_act_item_id
+ and content_revision__is_live(complete_act_id) = 't'
+ }
+ set user_id [ad_conn user_id]
+ dom parse $when_prop_val_is_set_xml document
+ $document documentElement when_prop_val_is_set_root
+ set wpv_is_node [$when_prop_val_is_set_root childNodes]
+# set wpv_is_node [$statement childNodes]
+
+ set equal_value_p 0
+ # get the property value
+ set property_ref [$wpv_is_node selectNodes {*[local-name()='property-ref']}]
+ set property_value [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$property_ref getAttribute {ref}]]
+
+ # get the value of the referenced exression
+ set propertyvalueNode [$wpv_is_node selectNodes {*[local-name()='property-value']}]
+
+ if { [llength $propertyvalueNode] } {
+ set propertyvalueChildNode [$propertyvalueNode childNodes]
+ set nodeType [$propertyvalueChildNode nodeType]
+ switch -- $nodeType {
+ {ELEMENT_NODE} {
+ switch -- [$propertyvalueChildNode localName] {
+ {calculate} {
+ set expression_value [imsld::expression::eval -run_id $run_id -expression [$propertyvalueChildNode childNodes]]
+ }
+ {property-ref} {
+ set expression_value [imsld::runtime::property::property_value_get -run_id $run_id -user_id $user_id -identifier [$propertyvalueChildNode getAttribute {ref}]]
+ }
+ }
+ }
+ {TEXT_NODE} {
+ set expression_value [$propertyvalueNode text]
+ }
+ }
+
+ if { [string eq $property_value $expression_value] } {
+ set equal_value_p 1
+ }
+
+ } else {
+ # there is no associated value, the activity is completed
+ set equal_value_p 1
+ }
+
+ if { $equal_value_p } {
+ # the values are the same, mark the referenced activity as completed
+ # 1. identify what kind of activiy we must mark as finished.
+ # it can be a support activity, learning activity, act or play
+ db_1row get_extra_info {
+ select imsld_id
+ from imsld_runs
+ where run_id = :run_id
+ }
+
+ if { [db_0or1row learning_activity_p {
+ select 'learning' as activity_type,
+ item_id as activity_item_id,
+ activity_id
+ from imsld_learning_activitiesi
+ where complete_act_id = :complete_act_item_id
+ and content_revision__is_live(activity_id) = 't'
+ }] } {
+ # mark the act completed for all the users in the run
+ set role_part_id_list [imsld::get_role_part_from_activity -activity_type learning -leaf_id $activity_item_id]
+
+ set users_in_run [db_list get_users_in_run {
+ select gmm.member_id
+ from group_member_map gmm,
+ imsld_run_users_group_ext iruge,
+ acs_rels ar1
+ where iruge.run_id=:run_id
+ and ar1.object_id_two=iruge.group_id
+ and ar1.object_id_one=gmm.group_id
+ group by member_id
+ }]
+ foreach user $users_in_run {
+ foreach role_part_id $role_part_id_list {
+ db_1row context_info {
+ select acts.act_id,
+ plays.play_id
+ from imsld_actsi acts, imsld_playsi plays, imsld_role_parts rp
+ where rp.role_part_id = :role_part_id
+ and rp.act_id = acts.item_id
+ and acts.play_id = plays.item_id
+ }
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -run_id $run_id \
+ -play_id $play_id \
+ -act_id $act_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type learning \
+ -code_call
+ }
+ }
+ }
+ if { [db_0or1row support_activity_p {
+ select 'support' as activity_type
+ from imsld_support_activities
+ where complete_act_id = :complete_act_item_id
+ and content_revision__is_live(activity_id) = 't'
+ }] } {
+ # mark the act completed for all the users in the run
+ set role_part_id_list [imsld::get_role_part_from_activity -activity_type learning -leaf_id $activity_item_id]
+
+ set users_in_run [db_list get_users_in_run {
+ select gmm.member_id
+ from group_member_map gmm,
+ imsld_run_users_group_ext iruge,
+ acs_rels ar1
+ where iruge.run_id=:run_id
+ and ar1.object_id_two=iruge.group_id
+ and ar1.object_id_one=gmm.group_id
+ group by member_id
+ }]
+ foreach user $users_in_run {
+ foreach role_part_id $role_part_id_list {
+ db_1row context_info {
+ select acts.act_id,
+ plays.play_id
+ from imsld_actsi acts, imsld_playsi plays, imsld_role_parts rp
+ where rp.role_part_id = :role_part_id
+ and rp.act_id = acts.item_id
+ and acts.play_id = plays.item_id
+ }
+ imsld::finish_component_element -imsld_id $imsld_id \
+ -run_id $run_id \
+ -play_id $play_id \
+ -act_id $act_id \
+ -role_part_id $role_part_id \
+ -element_id $activity_id \
+ -type learning \
+ -code_call
+ }
+ }
+ }
+ if { [db_0or1row act_activity_p {
+ select 'act' as activity_type,
+ ia.act_id,
+ ip.play_id
+ from imsld_acts ia, imsld_playsi ip
+ where ia.complete_act_id = :complete_act_item_id
+ and content_revision__is_live(ia.act_id) = 't'
+ and ia.play_id = ip.item_id
+ }] } {
+ # mark the act completed for all the users in the run
+ set users_in_run [db_list get_users_in_run {
+ select gmm.member_id
+ from group_member_map gmm,
+ imsld_run_users_group_ext iruge,
+ acs_rels ar1
+ where iruge.run_id=:run_id
+ and ar1.object_id_two=iruge.group_id
+ and ar1.object_id_one=gmm.group_id
+ group by member_id
+ }]
+ foreach user $users_in_run {
+ if { [imsld::user_participate_p -run_id $run_id -act_id $act_id -user_id $user] } {
+ imsld::mark_act_finished -act_id $act_id \
+ -play_id $play_id \
+ -imsld_id $imsld_id \
+ -run_id $run_id \
+ -user_id $user
+ }
+ }
+ }
+ if { [db_0or1row play_p {
+ select 'play' as activity_type,
+ play_id
+ from imsld_plays
+ where complete_act_id = :complete_act_item_id
+ and content_revision__is_live(play_id) = 't'
+ }] } {
+ # mark the act completed for all the users in the run
+ set users_in_run [db_list get_users_in_run {
+ select gmm.member_id
+ from group_member_map gmm,
+ imsld_run_users_group_ext iruge,
+ acs_rels ar1
+ where iruge.run_id=:run_id
+ and ar1.object_id_two=iruge.group_id
+ and ar1.object_id_one=gmm.group_id
+ group by member_id
+ }]
+ foreach user $users_in_run {
+ imsld::mark_play_finished -play_id $play_id \
+ -imsld_id $imsld_id \
+ -run_id $run_id \
+ -user_id $user
+ }
+ }
+ }
+}
+
ad_proc -public imsld::expression::eval {
-run_id
-expression
@@ -425,7 +722,6 @@
set propertyValue [$propertyvalueNode text]
}
}
-
imsld::runtime::property::property_value_set -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}] -value $propertyValue
}
{notification} {}
Index: openacs-4/packages/imsld/tcl/imsld-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-install-procs.tcl,v
diff -u -r1.34 -r1.35
--- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 26 Jul 2006 14:37:27 -0000 1.34
+++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 20 Sep 2006 08:26:30 -0000 1.35
@@ -278,19 +278,14 @@
content::type::attribute::new -content_type imsld_restriction -attribute_name restriction_type -datatype string -pretty_name "#imsld.Restriction_Type#" -column_spec "varchar(20)"
content::type::attribute::new -content_type imsld_restriction -attribute_name value -datatype string -pretty_name "#imsld.Value#" -column_spec "varchar"
- # property values
- content::type::new -content_type imsld_property_value -supertype content_revision -pretty_name "#imsld.lt_IMS-LD_Property_Value#" -pretty_plural "#imsld.lt_IMS-LD_Property_Value_1#" -table_name imsld_properties_values -id_column property_value_id
-
- content::type::attribute::new -content_type imsld_property_value -attribute_name property_id -datatype number -pretty_name "#imsld.Property_Identifier#" -column_spec "integer"
- content::type::attribute::new -content_type imsld_property_value -attribute_name langstring -datatype string -pretty_name "#imsld.Langstring#" -column_spec "varchar(4000)"
- content::type::attribute::new -content_type imsld_property_value -attribute_name expression_xml -datatype number -pretty_name "#imsld.Calculateexpression#" -column_spec "integer"
- content::type::attribute::new -content_type imsld_property_value -attribute_name property_value_ref -datatype number -pretty_name "#imsld.Property_Value_Ref#" -column_spec "integer"
-
# complete acts
content::type::attribute::new -content_type imsld_complete_act -attribute_name time_property_id -datatype number -pretty_name "#imsld.lt_Time_Property_Identif#" -column_spec "integer"
- content::type::attribute::new -content_type imsld_complete_act -attribute_name when_prop_val_is_set_id -datatype number -pretty_name "#imsld.lt_When_Property_Value_i#" -column_spec "integer"
content::type::attribute::new -content_type imsld_complete_act -attribute_name when_condition_true_id -datatype number -pretty_name "#imsld.When_Condition_True#" -column_spec "integer"
+ content::type::attribute::new -content_type imsld_complete_act -attribute_name when_prop_val_is_set_xml -datatype string -pretty_name "[_ imsld.lt_When_property_value_i]" -column_spec "varchar(4000)"
+ # on completion
+ content::type::attribute::new -content_type imsld_on_completion -attribute_name change_property_value_xml -datatype string -pretty_name "[_ imsld.lt_Change_Property_Value_1]" -column_spec "varchar(4000)"
+
# monitor service
content::type::new -content_type imsld_monitor_service -supertype content_revision -pretty_name "#imsld.lt_IMS-LD_Monitor_Servic#" -pretty_plural "#imsld.lt_IMS-LD_Monitor_Servic_1#" -table_name imsld_monitor_services -id_column monitor_id
@@ -504,11 +499,6 @@
content_item 0 {} \
content_item 0 {}
- # On Completion - Change Property Values
- rel_types::new imsld_on_comp_change_pv_rel "On Completion - Change Property Values rel" "On Completion - Change Property Values rels" \
- content_item 0 {} \
- content_item 0 {}
-
# Properties - Conditions
rel_types::new imsld_prop_cond_rel "Property - Condition" "Properties - Conditions" \
content_item 0 {} \
@@ -519,6 +509,11 @@
content_item 0 {} \
content_item 0 {}
+ # Properties - When property value is set
+ rel_types::new imsld_prop_wpv_is_rel "Property - when property value is set" "Property - when property value is set" \
+ content_item 0 {} \
+ content_item 0 {}
+
# Roles - conditions
rel_types::new imsld_role_cond_rel "Role - Condition" "Roles - Conditions" \
content_item 0 {} \
@@ -560,7 +555,11 @@
imsld::rel_type_delete -rel_type imsld_mp_completed_rel
imsld::rel_type_delete -rel_type imsld_gprop_prop_rel
imsld::rel_type_delete -rel_type imsld_gprop_gprop_rel
- imsld::rel_type_delete -rel_type imsld_on_comp_change_pv_rel
+ imsld::rel_type_delete -rel_type imsld_prop_cond_rel
+ imsld::rel_type_delete -rel_type imsld_prop_whct_rel
+ imsld::rel_type_delete -rel_type imsld_prop_wpv_is_rel
+ imsld::rel_type_delete -rel_type imsld_role_cond_rel
+ imsld::rel_type_delete -rel_type imsld_ilm_cond_rel
}
ad_proc -public imsld::uninstall::delete_ext_rels {
@@ -599,16 +598,10 @@
content::type::attribute::delete -content_type imsld_restriction -attribute_name restriction_type
content::type::attribute::delete -content_type imsld_restriction -attribute_name value
- # property values
- content::type::attribute::delete -content_type imsld_property_value -attribute_name property_id
- content::type::attribute::delete -content_type imsld_property_value -attribute_name langstring
- content::type::attribute::delete -content_type imsld_property_value -attribute_name expression_xml
- content::type::attribute::delete -content_type imsld_property_value -attribute_name property_value_ref
-
# complete acts
content::type::attribute::delete -content_type imsld_complete_act -attribute_name time_property_id
- content::type::attribute::delete -content_type imsld_complete_act -attribute_name when_prop_val_is_set_id
content::type::attribute::delete -content_type imsld_complete_act -attribute_name when_condition_true_id
+ content::type::attribute::delete -content_type imsld_complete_act -attribute_name when_prop_val_is_set_xml
# monitor service
content::type::attribute::delete -content_type imsld_monitor_service -attribute_name service_id
@@ -779,6 +772,7 @@
# on completion
content::type::attribute::delete -content_type imsld_on_completion -attribute_name feedback_title
+ content::type::attribute::delete -content_type imsld_on_completion -attribute_name change_property_value_xml
# classes
content::type::attribute::delete -content_type imsld_class -attribute_name method_id
@@ -826,7 +820,6 @@
content::type::delete -content_type imsld_property -drop_table_p t
content::type::delete -content_type imsld_property_groups -drop_table_p t
content::type::delete -content_type imsld_restriction -drop_table_p t
- content::type::delete -content_type imsld_property_value -drop_table_p t
content::type::delete -content_type imsld_monitor_service -drop_table_p t
content::type::delete -content_type imsld_condition -drop_table_p t
content::type::delete -content_type imsld_when_condition_true -drop_table_p t
Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl,v
diff -u -r1.56 -r1.57
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 26 Jul 2006 14:37:27 -0000 1.56
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 20 Sep 2006 08:26:30 -0000 1.57
@@ -2108,12 +2108,15 @@
if { [llength $calculate] } {
imsld::parse::validate_multiplicity -tree $calculate -multiplicity 1 -element_name calculate(property-value) -equal
+ set temporal_doc [dom createDocument calculate]
+ set temporal_node [$temporal_doc documentElement]
+
# Expression
- set expression [$calculate selectNodes "*\[local-name()='expression'\]"]
- if { [llength $expression] } {
- imsld::parse::validate_multiplicity -tree $expression -multiplicity 1 -element_name expression(property-value) -equal
- }
- set expression_xml [$expression asXML]
+ set expression [$calculate childNodes]
+ imsld::parse::validate_multiplicity -tree $expression -multiplicity 1 -element_name expression(property-value) -equal
+ $temporal_node appendChild $expression
+
+ set expression_xml [$temporal_node asXML]
}
}
@@ -2217,7 +2220,7 @@
set user_choice_p f
set complete_act_id ""
set time_in_seconds ""
- set when_prop_value_is_set_id ""
+ set when_prop_value_is_set_xml ""
if { [llength $complete_activity] } {
imsld::parse::validate_multiplicity -tree $complete_activity -multiplicity 1 -element_name complete-activity(learning-activity) -equal
@@ -2241,36 +2244,55 @@
set when_prop_value_is_set [$complete_activity selectNodes "*\[local-name()='when-property-value-is-set'\]"]
if { [llength $when_prop_value_is_set] } {
imsld::parse::validate_multiplicity -tree $when_prop_value_is_set -multiplicity 1 -element_name when-property-valye-is-set(learning-activity) -equal
- set when_prop_value_is_set_list [imsld::parse::parse_and_create_property_value -property_value_node $when_prop_value_is_set \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set when_prop_value_is_set_id [lindex $when_prop_value_is_set_list 0]
- if { !$when_prop_value_is_set_id } {
- # there is an error, return it
- return $when_prop_value_is_set_list
- }
+ # create a node where the when-property-value-is-set will be stored
+ set temporal_doc [dom createDocument when-property-value-is-set]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $when_prop_value_is_set
+ set when_prop_value_is_set_xml [$temporal_node asXML]
}
set complete_act_id [imsld::item_revision_new -attributes [list [list time_in_seconds $time_in_seconds] \
[list user_choice_p $user_choice_p] \
- [list when_prop_val_is_set_id $when_prop_value_is_set_id]] \
+ [list when_prop_val_is_set_xml $when_prop_value_is_set_xml]] \
-content_type imsld_complete_act \
-parent_id $parent_id]
+ if { [llength $when_prop_value_is_set] } {
+ #search properties in expression
+ set property_nodes_list [$when_prop_value_is_set selectNodes {.//*[local-name()='property-ref']}]
+ foreach property $property_nodes_list {
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -imsld_id [db_string get_imsld_id {select imsld_id from imsld_componentsi where item_id = :component_id}]]
+ # map the property with the complete_act_id
+ relation_add imsld_prop_wpv_is_rel $property_id $complete_act_id
+ }
+ }
+
}
# Learning Activity: On Completion
set on_completion [$activity_node selectNodes "*\[local-name()='on-completion'\]"]
set on_completion_id ""
+ set change_property_value_xml ""
if { [llength $on_completion] } {
+ # Learning Activity: On Completion: Change Property Value
+ set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
+ if { [llength $change_property_value_list] } {
+ # create a node where all the change-property-values will be stored
+ set temporal_doc [dom createDocument change-property-values]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $change_property_value_list
+ set change_property_value_xml [$temporal_node asXML]
+ }
set feedback_desc [$on_completion selectNodes "*\[local-name()='feedback-description'\]"]
if { [llength $feedback_desc] } {
imsld::parse::validate_multiplicity -tree $feedback_desc -multiplicity 1 -element_name feedback(learning-activity) -equal
set feedback_title [imsld::parse::get_title -node $feedback_desc -prefix imsld]
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
-content_type imsld_on_completion \
- -attributes [list [list feedback_title $feedback_title]]]
+ -attributes [list [list feedback_title $feedback_title \
+ [change_property_value_xml $change_property_value_xml]]]]
set feedback_items [$feedback_desc selectNodes "*\[local-name()='item'\]"]
foreach feedback_item $feedback_items {
set item_list [imsld::parse::parse_and_create_item -manifest $manifest \
@@ -2288,25 +2310,10 @@
}
} else {
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
- -content_type imsld_on_completion]
+ -content_type imsld_on_completion \
+ -attributes [list [list change_property_value_xml $change_property_value_xml]]]
}
-
- # Learning Activity: On Completion: Change Property Value
- set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
- foreach change_property_value $change_property_value_list {
- set change_prop_value_list [imsld::parse::parse_and_create_property_value -property_value_node $change_property_value \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set change_prop_value_id [lindex $change_prop_value_list 0]
- if { !$change_prop_value_id } {
- # there is an error, return it
- return $change_prop_value_list
- }
- relation_add imsld_on_comp_change_pv_rel $on_completion_id $change_prop_value_id
- }
}
-
# crete learning activity
set learning_activity_id [imsld::item_revision_new -attributes [list [list identifier $identifier] \
[list component_id $component_id] \
@@ -2402,7 +2409,7 @@
set user_choice_p f
set complete_act_id ""
set time_in_seconds ""
- set when_prop_value_is_set_id ""
+ set when_prop_value_is_set_xml ""
if { [llength $complete_activity] } {
imsld::parse::validate_multiplicity -tree $complete_activity -multiplicity 1 -element_name complete-activity(support-activity) -equal
@@ -2426,36 +2433,57 @@
set when_prop_value_is_set [$complete_activity selectNodes "*\[local-name()='when-property-value-is-set'\]"]
if { [llength $when_prop_value_is_set] } {
imsld::parse::validate_multiplicity -tree $when_prop_value_is_set -multiplicity 1 -element_name when-property-valye-is-set(support-activity) -equal
- set when_prop_value_is_set_list [imsld::parse::parse_and_create_property_value -property_value_node $when_prop_value_is_set \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set when_prop_value_is_set_id [lindex $when_prop_value_is_set_list 0]
- if { !$when_prop_value_is_set_id } {
- # there is an error, return it
- return $when_prop_value_is_set_list
- }
+ # create a node where the when-property-value-is-set will be stored
+ set temporal_doc [dom createDocument when-property-value-is-set]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $when_prop_value_is_set
+ set when_prop_value_is_set_xml [$temporal_node asXML]
}
set complete_act_id [imsld::item_revision_new -attributes [list [list time_in_seconds $time_in_seconds] \
[list user_choice_p $user_choice_p] \
- [list when_prop_val_is_set_id $when_prop_value_is_set_id]] \
+ [list when_prop_val_is_set_xml $when_prop_value_is_set_xml]] \
-content_type imsld_complete_act \
-parent_id $parent_id]
+ if { [llength $when_prop_value_is_set] } {
+ #search properties in expression
+ set property_nodes_list [$when_prop_value_is_set selectNodes {.//*[local-name()='property-ref']}]
+ foreach property $property_nodes_list {
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -imsld_id [db_string get_imsld_id {select imsld_id from imsld_componentsi where item_id = :component_id}]]
+ # map the property with the complete_act_id
+ relation_add imsld_prop_wpv_is_rel $property_id $complete_act_id
+ }
+ }
+
}
# Support Activity: On completion
set on_completion [$activity_node selectNodes "*\[local-name()='on-completion'\]"]
set on_completion_id ""
+ set change_property_value_xml ""
if { [llength $on_completion] } {
imsld::parse::validate_multiplicity -tree $on_completion -multiplicity 1 -element_name on-completion(support-activity) -equal
+
+ # Support Activity: On Completion: Change Property Value
+ set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
+ if { [llength $change_property_value_list] } {
+ # create a node where all the change-property-values will be stored
+ set temporal_doc [dom createDocument change-property-values]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $change_property_value_list
+ set change_property_value_xml [$temporal_node asXML]
+ }
+
set feedback_desc [$on_completion selectNodes "*\[local-name()='feedback-description'\]"]
if { [llength $feedback_desc] } {
imsld::parse::validate_multiplicity -tree $feedback_desc -multiplicity 1 -element_name feedback(support-activity) -equal
set feedback_title [imsld::parse::get_title -node $feedback_desc -prefix imsld]
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
-content_type imsld_on_completion \
- -attributes [list [list feedback_title $feedback_title]]]
+ -attributes [list [list feedback_title $feedback_title] \
+ [list change_property_value_xml $change_property_value_xml]]]
set feedback_items [$feedback_desc selectNodes "*\[local-name()='item'\]"]
foreach feedback_item $feedback_items {
set item_list [imsld::parse::parse_and_create_item -manifest $manifest \
@@ -2473,23 +2501,9 @@
}
} else {
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
- -content_type imsld_on_completion]
+ -content_type imsld_on_completion \
+ -attributes [list [list change_property_value_xml $change_property_value_xml]]]
}
-
- # Support Activity: On Completion: Change Property Value
- set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
- foreach change_property_value $change_property_value_list {
- set change_prop_value_list [imsld::parse::parse_and_create_property_value -property_value_node $change_property_value \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set change_prop_value_id [lindex $change_prop_value_list 0]
- if { !$change_prop_value_id } {
- # there is an error, return it
- return $change_prop_value_list
- }
- relation_add imsld_on_comp_change_pv_rel $on_completion_id $change_prop_value_id
- }
}
# crete support activity
@@ -3186,12 +3200,28 @@
# get the info of the act and create it
set identifier [imsld::parse::get_attribute -node $act_node -attr_name identifier]
set title [imsld::parse::get_title -node $act_node -prefix imsld]
+ # get the info of the role part and create it
+ db_1row get_info {
+ select cr4.item_id as component_id,
+ ip.play_id as play_revision_id
+ from imsld_components ic, imsld_methods im, imsld_plays ip,
+ cr_revisions cr1, cr_revisions cr2, cr_revisions cr3, cr_revisions cr4
+ where cr4.revision_id = ic.component_id
+ and content_revision__is_live(ic.component_id) = 't'
+ and ic.imsld_id = cr3.item_id
+ and content_revision__is_live(cr3.revision_id) = 't'
+ and cr3.item_id = im.imsld_id
+ and im.method_id = cr2.revision_id
+ and cr2.item_id = ip.method_id
+ and ip.play_id = cr1.revision_id
+ and cr1.item_id = :play_id
+ }
# Act: Complete Act: Time Limit
set complete_act [$act_node selectNodes "*\[local-name()='complete-act'\]"]
set complete_act_id ""
set time_in_seconds ""
- set when_prop_value_is_set_id ""
+ set when_prop_value_is_set_xml ""
set when_condition_true_id ""
if { [llength $complete_act] } {
imsld::parse::validate_multiplicity -tree $complete_act -multiplicity 1 -element_name complete-act -equal
@@ -3206,15 +3236,12 @@
set when_prop_value_is_set [$complete_act selectNodes "*\[local-name()='when-property-value-is-set'\]"]
if { [llength $when_prop_value_is_set] } {
imsld::parse::validate_multiplicity -tree $when_prop_value_is_set -multiplicity 1 -element_name when-property-valye-is-set(complete-act) -equal
- set when_prop_value_is_set_list [imsld::parse::parse_and_create_property_value -property_value_node $when_prop_value_is_set \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set when_prop_value_is_set_id [lindex $when_prop_value_is_set_list 0]
- if { !$when_prop_value_is_set_id } {
- # there is an error, return it
- return $when_prop_value_is_set_list
- }
+ # create a node where the when-property-value-is-set will be stored
+ set temporal_doc [dom createDocument when-property-value-is-set]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $when_prop_value_is_set
+ set when_prop_value_is_set_xml [$temporal_node asXML]
}
# Act: Complete Act: When Condition True
set when_condition_true [$complete_act selectNodes "*\[local-name()='when-condition-true'\]"]
@@ -3235,44 +3262,71 @@
return [list 0 "[_ imsld.lt_Referenced_role_role_]"]
}
#select all but role-ref that is: select the expression node
+ set temporal_doc [dom createDocument expression]
+ set temporal_node [$temporal_doc documentElement]
set expression [$when_condition_true selectNodes "*\[not(local-name()='role-ref')\]"]
+ $temporal_node appendChild $expression
+
imsld::parse::validate_multiplicity -tree $expression -multiplicity 1 -element_name "[$expression localName](when-condition-true)" -equal
set when_condition_true_id [imsld::item_revision_new -attributes [list [list role_id $role_id] \
- [list expression_xml [$expression asXML]]] \
+ [list expression_xml [$temporal_node asXML]]] \
-content_type imsld_when_condition_true \
-parent_id $parent_id \
-title $title]
#search properties in expression
set property_nodes_list [$expression selectNodes {.//*[local-name()='property-ref']}]
foreach property $property_nodes_list {
-
-
- set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -play_id $play_id]
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -play_id $play_revision_id]
+ # map the property with the condition (when condition true)
relation_add imsld_prop_whct_rel $property_id $when_condition_true_id
}
}
set complete_act_id [imsld::item_revision_new -attributes [list [list time_in_seconds $time_in_seconds] \
[list when_condition_true_id $when_condition_true_id] \
- [list when_prop_val_is_set_id $when_prop_value_is_set_id]] \
+ [list when_prop_val_is_set_xml $when_prop_value_is_set_xml]] \
-content_type imsld_complete_act \
-parent_id $parent_id]
-
+
+ if { [llength $when_prop_value_is_set] } {
+ #search properties in expression
+ set property_nodes_list [$when_prop_value_is_set selectNodes {.//*[local-name()='property-ref']}]
+ foreach property $property_nodes_list {
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -play_id $play_revision_id]
+ # map the property with the complete_act_id
+ relation_add imsld_prop_wpv_is_rel $property_id $complete_act_id
+ }
+ }
+
}
# Act: On Completion
set on_completion [$act_node selectNodes "*\[local-name()='on-completion'\]"]
set on_completion_id ""
+ set change_property_value_xml ""
if { [llength $on_completion] } {
imsld::parse::validate_multiplicity -tree $on_completion -multiplicity 1 -element_name on-completion(complete-act) -equal
+
+ # Act: On Completion: Change Property Value
+ set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
+ if { [llength $change_property_value_list] } {
+ # create a node where all the change-property-values will be stored
+ set temporal_doc [dom createDocument change-property-values]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $change_property_value_list
+ set change_property_value_xml [$temporal_node asXML]
+ }
+
set feedback_desc [$on_completion selectNodes "*\[local-name()='feedback-description'\]"]
if { [llength $feedback_desc] } {
imsld::parse::validate_multiplicity -tree $feedback_desc -multiplicity 1 -element_name feedback(complete-act) -equal
set feedback_title [imsld::parse::get_title -node $feedback_desc -prefix imsld]
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
-content_type imsld_on_completion \
- -attributes [list [list feedback_title $feedback_title]]]
+ -attributes [list [list feedback_title $feedback_title] \
+ [list change_property_value_xml $change_property_value_xml]]]
set feedback_items [$feedback_desc selectNodes "*\[local-name()='item'\]"]
foreach feedback_item $feedback_items {
set item_list [imsld::parse::parse_and_create_item -manifest $manifest \
@@ -3290,23 +3344,9 @@
}
} else {
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
- -content_type imsld_on_completion]
+ -content_type imsld_on_completion \
+ -attributes [list [list change_property_value_xml $change_property_value_xml]]]
}
-
- # Act: On Completion: Change Property Value
- set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
- foreach change_property_value $change_property_value_list {
- set change_prop_value_list [imsld::parse::parse_and_create_property_value -property_value_node $change_property_value \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set change_prop_value_id [lindex $change_prop_value_list 0]
- if { !$change_prop_value_id } {
- # there is an error, return it
- return $change_prop_value_list
- }
- relation_add imsld_on_comp_change_pv_rel $on_completion_id $change_prop_value_id
- }
}
set act_id [imsld::item_revision_new -attributes [list [list play_id $play_id] \
@@ -3378,7 +3418,7 @@
Returns a list with the new play_id (item_id) created if there were no errors, or 0 and an explanation messge if there was an error.
- @param imsld_id IMS-LD identifier which this play belongs to
+ @param method_id method identifier which this play belongs to
@param play_node The play node to parse
@param manifest Manifest tree
@param manifest_id Manifest ID or the manifest being parsed
@@ -3399,7 +3439,7 @@
set complete_act_id ""
set time_in_seconds ""
set when_last_act_completed_p f
- set when_prop_value_is_set_id ""
+ set when_prop_value_is_set_xml ""
if { [llength $complete_play] } {
imsld::parse::validate_multiplicity -tree $complete_play -multiplicity 1 -element_name complete-play -equal
# Play: Complete Play: Time Limit
@@ -3413,15 +3453,12 @@
set when_prop_value_is_set [$complete_play selectNodes "*\[local-name()='when-property-value-is-set'\]"]
if { [llength $when_prop_value_is_set] } {
imsld::parse::validate_multiplicity -tree $when_prop_value_is_set -multiplicity 1 -element_name when-property-valye-is-set(complete-play) -equal
- set when_prop_value_is_set_list [imsld::parse::parse_and_create_property_value -property_value_node $when_prop_value_is_set \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set when_prop_value_is_set_id [lindex $when_prop_value_is_set_list 0]
- if { !$when_prop_value_is_set_id } {
- # there is an error, return it
- return $when_prop_value_is_set_list
- }
+ # create a node where the when-property-value-is-set will be stored
+ set temporal_doc [dom createDocument when-property-value-is-set]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $when_prop_value_is_set
+ set when_prop_value_is_set_xml [$temporal_node asXML]
}
# Play: Complete Play: When Last Act Completed
set when_last_act_completed [$complete_play selectNodes "*\[local-name()='when-last-act-completed'\]"]
@@ -3430,23 +3467,47 @@
}
set complete_act_id [imsld::item_revision_new -attributes [list [list time_in_seconds $time_in_seconds] \
[list when_last_act_completed_p $when_last_act_completed_p] \
- [list when_prop_val_is_set_id $when_prop_value_is_set_id]] \
+ [list when_prop_val_is_set_xml $when_prop_value_is_set_xml]] \
-content_type imsld_complete_act \
-parent_id $parent_id]
+ if { [llength $when_prop_value_is_set] } {
+ #search properties in expression
+ set property_nodes_list [$when_prop_value_is_set selectNodes {.//*[local-name()='property-ref']}]
+ foreach property $property_nodes_list {
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -imsld_id [db_string get_imsld_id {select imsld_id from imsld_methodsi where item_id = :method_id}]]
+ # map the property with the complete_act_id
+ relation_add imsld_prop_wpv_is_rel $property_id $complete_act_id
+ }
+ }
+
}
# Play: On Completion
set on_completion [$play_node selectNodes "*\[local-name()='on-completion'\]"]
set on_completion_id ""
+ set change_property_value_xml ""
if { [llength $on_completion] } {
imsld::parse::validate_multiplicity -tree $on_completion -multiplicity 1 -element_name on-completion(complete-play) -equal
+
+ # Play: On Completion: Change Property Value
+ set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
+ if { [llength $change_property_value_list] } {
+ # create a node where all the change-property-values will be stored
+ set temporal_doc [dom createDocument change-property-values]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $change_property_value_list
+ set change_property_value_xml [$temporal_node asXML]
+ }
+
set feedback_desc [$on_completion selectNodes "*\[local-name()='feedback-description'\]"]
if { [llength $feedback_desc] } {
imsld::parse::validate_multiplicity -tree $feedback_desc -multiplicity 1 -element_name feedback(complete-play) -equal
set feedback_title [imsld::parse::get_title -node $feedback_desc -prefix imsld]
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
-content_type imsld_on_completion \
- -attributes [list [list feedback_title $feedback_title]]]
+ -attributes [list [list feedback_title $feedback_title] \
+ [list change_property_value_xml $change_property_value_xml]]]
set feedback_items [$feedback_desc selectNodes "*\[local-name()='item'\]"]
foreach feedback_item $feedback_items {
set item_list [imsld::parse::parse_and_create_item -manifest $manifest \
@@ -3464,24 +3525,10 @@
}
} else {
set on_completion_id [imsld::item_revision_new -parent_id $parent_id \
- -content_type imsld_on_completion]
+ -content_type imsld_on_completion \
+ -attributes [list [list change_property_value_xml $change_property_value_xml]]]
}
- # Play: On Completion: Change Property Value
- set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
- foreach change_property_value $change_property_value_list {
- set change_prop_value_list [imsld::parse::parse_and_create_property_value -property_value_node $change_property_value \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $parent_id]
- set change_prop_value_id [lindex $change_prop_value_list 0]
- if { !$change_prop_value_id } {
- # there is an error, return it
- return $change_prop_value_list
- }
- relation_add imsld_on_comp_change_pv_rel $on_completion_id $change_prop_value_id
- }
-
}
set play_id [imsld::item_revision_new -attributes [list [list method_id $method_id] \
@@ -3879,7 +3926,7 @@
set complete_unit_of_learning [$method selectNodes "*\[local-name()='complete-unit-of-learning'\]"]
set complete_act_id ""
set time_in_seconds ""
- set when_prop_value_is_set_id ""
+ set when_prop_value_is_set_xml ""
if { [llength $complete_unit_of_learning] } {
imsld::parse::validate_multiplicity -tree $complete_unit_of_learning -multiplicity 1 -element_name complete-unit-of-learning -equal
@@ -3894,28 +3941,48 @@
set when_prop_value_is_set [$complete_unit_of_learning selectNodes "*\[local-name()='when-property-value-is-set'\]"]
if { [llength $when_prop_value_is_set] } {
imsld::parse::validate_multiplicity -tree $when_prop_value_is_set -multiplicity 1 -element_name when-property-valye-is-set(complete-unit-of-learning) -equal
- set when_prop_value_is_set_list [imsld::parse::parse_and_create_property_value -property_value_node $when_prop_value_is_set \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $cr_folder_id]
- set when_prop_value_is_set_id [lindex $when_prop_value_is_set_list 0]
- if { !$when_prop_value_is_set_id } {
- # there is an error, return it
- return $when_prop_value_is_set_list
- }
+ # create a node where the when-property-value-is-set will be stored
+ set temporal_doc [dom createDocument when-property-value-is-set]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $when_prop_value_is_set
+ set when_prop_value_is_set_xml [$temporal_node asXML]
}
set complete_act_id [imsld::item_revision_new -attributes [list [list time_in_seconds $time_in_seconds] \
- [list when_prop_val_is_set_id $when_prop_value_is_set_id]] \
+ [list when_prop_val_is_set_xml $when_prop_value_is_set_xml]] \
-content_type imsld_complete_act \
-parent_id $cr_folder_id]
+ if { [llength $when_prop_value_is_set] } {
+ #search properties in expression
+ set property_nodes_list [$when_prop_value_is_set selectNodes {.//*[local-name()='property-ref']}]
+ foreach property $property_nodes_list {
+ set property_id [imsld::get_property_item_id -identifier [$property getAttribute ref] -imsld_id [db_string get_imsld_id {select imsld_id from imsld_imsldsi where item_id = :imsld_id}]]
+ # map the property with the complete_act_id
+ relation_add imsld_prop_wpv_is_rel $property_id $complete_act_id
+ }
+ }
}
# Method: On Completion
set on_completion [$method selectNodes "*\[local-name()='on-completion'\]"]
set on_completion_id ""
+ set change_property_value_xml ""
if { [llength $on_completion] } {
imsld::parse::validate_multiplicity -tree $on_completion -multiplicity 1 -element_name on-completion(method) -equal
+
+ # Act: On Completion: Change Property Value
+ set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
+ if { [llength $change_property_value_list] } {
+ # create a node where all the change-property-values will be stored
+ set temporal_doc [dom createDocument change-property-values]
+ set temporal_node [$temporal_doc documentElement]
+
+ $temporal_node appendChild $change_property_value_list
+ set change_property_value_xml [$temporal_node asXML]
+ }
+
+
set feedback_desc [$on_completion selectNodes "*\[local-name()='feedback-description'\]"]
if { [llength $feedback_desc] } {
imsld::parse::validate_multiplicity -tree $feedback_desc -multiplicity 1 -element_name feedback(method) -equal
@@ -3943,21 +4010,6 @@
-content_type imsld_on_completion]
}
- # Act: On Completion: Change Property Value
- set change_property_value_list [$on_completion selectNodes "*\[local-name()='change-property-value'\]"]
- foreach change_property_value $change_property_value_list {
- set change_prop_value_list [imsld::parse::parse_and_create_property_value -property_value_node $change_property_value \
- -manifest_id $manifest_id \
- -manifest $manifest \
- -parent_id $cr_folder_id]
- set change_prop_value_id [lindex $change_prop_value_list 0]
- if { !$change_prop_value_id } {
- # there is an error, return it
- return $change_prop_value_list
- }
- relation_add imsld_on_comp_change_pv_rel $on_completion_id $change_prop_value_id
- }
-
}
set method_id [imsld::item_revision_new -parent_id $cr_folder_id \
Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v
diff -u -r1.81 -r1.82
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 26 Jul 2006 14:37:27 -0000 1.81
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 20 Sep 2006 08:26:30 -0000 1.82
@@ -720,9 +720,19 @@
#grant permissions to resources in activity
if { [db_0or1row get_related_on_completion_id ""] } {
+ # process feedback?
if { [db_0or1row get_related_resource_id { *SQL* }] } {
imsld::grant_permissions -resources_activities_list $related_resource -user_id $user_id
}
+ # process change_property_value?
+ if { [db_0or1row get_related_change_prop_val {
+ select change_property_value_xml
+ from imsld_on_completioni
+ where item_id = :related_on_completion
+ and content_revision__is_live(on_completion_id) = 't'
+ }] } {
+ imsld::condition::eval_change_property_value -change_property_value_xml $change_property_value_xml -run_id $run_id
+ }
}
}
if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } {
@@ -3146,10 +3156,10 @@
from imsld_propertiesi ip,
imsld_componentsi ici,
imsld_imsldsi iii
- where ip.component_id=ici.item_id
- and ici.imsld_id=iii.item_id
- and iii.item_id=:imsld_id
- and ip.identifier=:identifier
+ where ip.component_id = ici.item_id
+ and ici.imsld_id = iii.item_id
+ and iii.item_id = :imsld_id
+ and ip.identifier = :identifier
}]
}
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.29 -r1.30
--- openacs-4/packages/imsld/tcl/imsld-procs.xql 26 Jul 2006 14:37:27 -0000 1.29
+++ openacs-4/packages/imsld/tcl/imsld-procs.xql 20 Sep 2006 08:26:30 -0000 1.30
@@ -576,6 +576,17 @@
+
+
+
+ select ar.object_id_two as change_prop_val_id
+ from acs_rels ar
+ where ar.object_id_one = :related_on_completion
+ and ar.rel_type='imsld_on_comp_change_pv_rel'
+
+
+
+
insert into imsld_status_user (
Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 26 Jul 2006 14:37:27 -0000 1.13
+++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 20 Sep 2006 08:26:30 -0000 1.14
@@ -125,6 +125,7 @@
set role_item [lindex $role_item_par 0]
set depth [lindex $role_item_par 1]
+ set depth [expr { [string eq $depth ""] ? 0 : $depth }]
db_1row get_role_name {}
if {![string eq "" $name]} {
Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 26 Jul 2006 14:37:27 -0000 1.10
+++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 20 Sep 2006 08:26:30 -0000 1.11
@@ -169,10 +169,10 @@
from imsld_conditionsi ici,
acs_rels ar,
imsld_propertiesi ipi
- where ipi.property_id=:property_id
- and ipi.item_id=ar.object_id_one
- and ar.rel_type='imsld_prop_cond_rel'
- and ar.object_id_two=ici.item_id
+ where ipi.property_id = :property_id
+ and ipi.item_id = ar.object_id_one
+ and ar.rel_type = 'imsld_prop_cond_rel'
+ and ar.object_id_two = ici.item_id
}]
#property conditions
foreach condition_id $conditions_list {
@@ -185,6 +185,39 @@
$document documentElement condition_node
imsld::condition::execute -run_id $run_id -condition $condition_node
}
+
+ # when-condition-true:
+ # foreach when-condition-true related with the property, evaluate the whole expression
+ # referenced from the table when-condition-true to all the members of the referenced role (in the same table),
+ # and if it's true, set the act (in the table complete-acts) completed
+
+ db_foreach when_condition_true {
+ select ar.object_id_two as when_cond_true_item_id
+ from acs_rels ar,
+ imsld_propertiesi ipi
+ where ipi.property_id = :property_id
+ and ipi.item_id = ar.object_id_one
+ and ar.rel_type = 'imsld_prop_whct_rel'
+ } {
+ imsld::condition::eval_when_condition_true -when_condition_true_item_id $when_cond_true_item_id -run_id $run_id
+ }
+
+ # when-property-vale-is-set:
+ # foreach when-property-value-is-set related with the property, evaluete the expression
+ # and compare it with the referenced property, and if they have the same value, mark the referencer
+ # activity as completed
+
+ db_foreach when_prop_value_is_set {
+ select ar.object_id_two as complete_act_item_id
+ from acs_rels ar,
+ imsld_propertiesi ipi
+ where ipi.property_id = :property_id
+ and ipi.item_id = ar.object_id_one
+ and ar.rel_type = 'imsld_prop_wpv_is_rel'
+ } {
+ imsld::condition::eval_when_prop_value_is_set -complete_act_item_id $complete_act_item_id -run_id $run_id
+ }
+
#role conditions, time conditions...
imsld::condition::execute_time_role_conditions -run_id $run_id
}
Index: openacs-4/packages/imsld/www/imsld-content-serve.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-content-serve.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/imsld/www/imsld-content-serve.tcl 20 Jul 2006 16:26:47 -0000 1.7
+++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 20 Sep 2006 08:26:30 -0000 1.8
@@ -16,7 +16,6 @@
if { [string eq $owner_user_id ""] } {
set owner_user_id [ad_conn user_id]
}
-
# get file info
db_1row get_info {
select f.revision_id,
Index: openacs-4/packages/imsld/www/imsld-frameset.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/Attic/imsld-frameset.adp,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/imsld/www/imsld-frameset.adp 31 May 2006 14:12:00 -0000 1.6
+++ openacs-4/packages/imsld/www/imsld-frameset.adp 20 Sep 2006 08:26:30 -0000 1.7
@@ -10,6 +10,6 @@
-
+