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.4 -r1.5 --- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 22 Jun 2006 10:56:53 -0000 1.4 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 29 Jun 2006 09:27:57 -0000 1.5 @@ -112,15 +112,18 @@ 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 + 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 + identifier varchar(100), -- class name or owner identifier run_id integer constraint imsld_pin_rn_fk references imsld_runs, is_visible_p char(1) - check (is_visible_p in ('t','f')) + check (is_visible_p in ('t','f')), -- title for the class + title varchar(100), + with_control_p char(1) + check (with_control_p in ('t','f')) -- class attribute according to the spec ); create index imsld_attri_own_idx on imsld_attribute_instances(owner_id); 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 -r1.2 -r1.3 --- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql 22 Jun 2006 10:56:53 -0000 1.2 +++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql 29 Jun 2006 09:27:57 -0000 1.3 @@ -161,23 +161,27 @@ return 0; end;' language 'plpgsql'; -select define_function_args('imsld_attribute_instance__new','instance_id,owner_id,type,name,run_id,is_visible_p'); +select define_function_args('imsld_attribute_instance__new','instance_id,owner_id,type,identifier,run_id,is_visible_p,title,with_control_p'); create or replace function imsld_attribute_instance__new ( integer, -- instance_id integer, -- owner_id varchar, -- type - varchar, -- name + varchar, -- identifier integer, -- run_id - varchar -- is_visible_p + varchar, -- is_visible_p + varchar, -- title + varchar -- with_control_p ) returns integer as ' declare p_instance_id alias for $1; -- default null p_owner_id alias for $2; p_type alias for $3; - p_name alias for $4; + p_identifier alias for $4; p_run_id alias for $5; p_is_visible_p alias for $6; + p_title alias for $7; + p_with_control_p alias for $8; v_attribute_instance_id integer; @@ -186,8 +190,8 @@ select acs_object_id_seq.nextval into v_attribute_instance_id from dual; - insert into imsld_attribute_instances (instance_id, owner_id, type, name, run_id, is_visible_p) - values (v_attribute_instance_id, p_owner_id, p_type, p_name, p_run_id, p_is_visible_p); + insert into imsld_attribute_instances (instance_id, owner_id, type, identifier, run_id, is_visible_p, title, with_control_p) + values (v_attribute_instance_id, p_owner_id, p_type, p_identifier, p_run_id, p_is_visible_p, p_title, p_with_control_p); return v_attribute_instance_id; end; 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.5 -r1.6 --- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 28 Jun 2006 10:33:18 -0000 1.5 +++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 29 Jun 2006 09:27:57 -0000 1.6 @@ -270,15 +270,95 @@ } foreach executeNode $statement { - switch -- [$executeNode localName] { - {show} {} - {hide} {} + switch -- [$executeNode nodeName] { + {show} { + foreach refNodes [$executeNode childNodes] { + switch -- [$refNodes localName] { + {class} { + set class [$refNodes getAttribute class ""] + set title [$refNodes getAttribute title ""] + set with_control_p [imsld::parse::get_bool_attribute -node $refNodes -attr_name with-control -default "f"] + if { [string eq $class ""] } { + + # NOTE: according to the spec this attribute may be empty... what to do?? + ns_log notice "imsld::statement::execute: class ref is empty" + continue + } + imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title -with_control $with_control -action "show" + } + {environment-ref} { + # the environments doesn't have any isvisible attribute, + # so we have to 'show' all the referenced elements + imsld::runtime::environment::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + {activity-structure-ref} { + imsld::runtime::activity_structure::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + {unit-of-learning-href} { + # NOT IMPLEMENTED: noop + } + {item-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + {learning-activity-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + {support-activity-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + {play-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + } + } + } + } + {hide} { + foreach refNodes [$executeNode childNodes] { + switch -- [$refNodes localName] { + {class} { + set class [$refNodes getAttribute class ""] + set title [$refNodes getAttribute title ""] + set with_control_p [imsld::parse::get_bool_attribute -node $refNodes -attr_name with-control -default "f"] + if { [string eq $class ""] } { + + # NOTE: according to the spec this attribute may be empty... what to do?? + ns_log notice "imsld::statement::execute: class ref is empty" + continue + } + imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title -with_control $with_control -action "hide" + } + {environment-ref} { + # the environments doesn't have any isvisible attribute, + # so we have to 'hide' all the referenced elements + imsld::runtime::environment::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + {activity-structure-ref} { + imsld::runtime::activity_structure::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + {unit-of-learning-href} { + # NOT IMPLEMENTED: noop + } + {item-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + {learning-activity-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + {support-activity-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + {play-ref} { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + } + } + } + } {change-property-value} { - set propertyref [$executeNode selectNodes {*[local-name()='property-ref']}] - set propertyvalue [[$executeNode selectNodes {*[local-name()='property-value']}] nodeValue] - imsld::runtime::property::property_value_set -run_id $run_id -user_id $user_id -identifier [$propertyref getAttribute {ref}] -value $propertyvalue - } - {notification} {} - } + set propertyref [$executeNode selectNodes {*[local-name()='property-ref']}] + set propertyvalue [[$executeNode selectNodes {*[local-name()='property-value']}] nodeValue] + 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-instance-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 20 Jun 2006 19:20:38 -0000 1.4 +++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 29 Jun 2006 09:27:57 -0000 1.5 @@ -172,7 +172,7 @@ where ar.object_id_one = :run_group_id and ar.rel_type = 'imsld_run_users_group_rel' } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row globpers_already_instantiated_p { select 1 from imsld_property_instances where identifier = :identifier @@ -203,7 +203,7 @@ where component_id = :component_item_id and type = 'global' } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row global_already_instantiated_p { select 1 from imsld_property_instances where identifier = :identifier @@ -295,7 +295,7 @@ and ir.component_id = :component_item_id }]] - # 1.1.4. learning objects + # 1.1.4. learning objects (environments) set linear_item_list [concat $linear_item_list [db_list item_in_lo { select ii.imsld_item_id from acs_rels ar, imsld_itemsi ii, imsld_learning_objectsi lo, imsld_environmentsi env @@ -343,14 +343,14 @@ and tree_right((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) or ii.imsld_item_id = :imsld_item_id) } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row info_as_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :imsld_item_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $imsld_item_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $imsld_item_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } } @@ -362,14 +362,14 @@ from imsld_learning_activities la where la.component_id = :component_item_id } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row la_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :activity_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $activity_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $activity_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } @@ -380,14 +380,14 @@ from imsld_support_activities sa where sa.component_id = :component_item_id } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row sa_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :activity_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $activity_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $activity_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } @@ -400,23 +400,23 @@ where lo.environment_id = env.item_id and env.component_id = :component_item_id } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row lo_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :learning_object_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $learning_object_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $learning_object_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } - if { ![string eq "" $class] && ![db_0or1row already_instantiated_p { + if { ![string eq "" $class] && ![db_0or1row lo_env_already_instantiated_p { select 1 from imsld_attribute_instances where run_id = :run_id and type = 'class' - and name = :class + and identifier = :class }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list name $class] [list run_id $run_id] [list is_visible_p "t"]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } @@ -429,23 +429,23 @@ where serv.environment_id = env.item_id and env.component_id = :component_item_id } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row serv_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :service_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $service_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $service_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } - if { ![string eq "" $class] && ![db_0or1row already_instantiated_p { + if { ![string eq "" $class] && ![db_0or1row serv_env_already_instantiated_p { select 1 from imsld_attribute_instances where run_id = :run_id and type = 'class' - and name = :class + and identifier = :class }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list name $class] [list run_id $run_id] [list is_visible_p "t"]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $class] [list run_id $run_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } @@ -457,14 +457,14 @@ where play.method_id = im.item_id and im.imsld_id = :run_imsld_item_id } { - if { ![db_0or1row already_instantiated_p { + if { ![db_0or1row play_already_instantiated_p { select 1 from imsld_attribute_instances where owner_id = :play_id and run_id = :run_id and type = 'isvisible' }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $play_id] [list type "isvisible"] [list name ""] [list run_id $run_id] [list is_visible_p $is_visible_p]] imsld_attribute_instance new] + set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id $play_id] [list type "isvisible"] [list identifier ""] [list run_id $run_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] } } 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.68 -r1.69 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 20 Jun 2006 19:20:38 -0000 1.68 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 29 Jun 2006 09:27:57 -0000 1.69 @@ -1234,7 +1234,7 @@ from imsld_attribute_instances where run_id = :run_id and type = 'class' - and name = :class_name + and identifier = :class_name and is_visible_p = 'f' }]] } 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.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 22 Jun 2006 10:56:54 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 29 Jun 2006 09:27:57 -0000 1.3 @@ -11,6 +11,10 @@ namespace eval imsld {} namespace eval imsld::runtime {} namespace eval imsld::runtime::property {} +namespace eval imsld::runtime::class {} +namespace eval imsld::runtime::isvisible {} +namespace eval imsld::runtime::activity_structure {} +namespace eval imsld::runtime::environment {} ad_proc -public imsld::runtime::property::instance_value_set { -instance_id @@ -164,5 +168,159 @@ } } +ad_proc -public imsld::runtime::class::show_hide { + -run_id + -class + -title + -with_control + -action:required +} { + mark a class as showh or hidden. NOTE: not recursively +} { + if { [string eq $action "show"] } { + set is_visible_p "t" + } else { + set is_visible_p "f" + } + db_dml set_class_shown_hidden { *SQL* } +} +ad_proc -public imsld::runtime::isvisible::show_hide { + -run_id + -identifier + -action_required +} { + mark a isvisible as showh. NOTE: not recursively +} { + if { [string eq $action "show"] } { + set is_visible_p "t" + } else { + set is_visible_p "f" + } + db_dml set_class_shown_hidden { *SQL* } +} + +ad_proc -public imsld::runtime::environment::show_hide { + -run_id + -identifier + -action +} { + mark an environment as showh or hidden. NOTE: not recursively +} { + # according to the spec, the environments doesn't have any isvisible attribute + # so we show the referenced learning objects and services + + db_1row context_info { + select env.environment_id, + env.item_id as environment_item_id, + comp.component_id, + comp.item_id as component_item_id + from imsld_runs ir, imsld_componentsi comp, imsld_environmentsi env, imsld_imsldsi + where ir.run_id = :run_id + and ir.imsld_id = ii.imsld_id + and ii.item_id = comp.imsld_id + and env.identifier = :identifier + and env.component_id = comp.item_id + } + + # 1. show the learning objects + db_foreach learning_object { + select lo.learning_object_id, + lo.identifier as lo_identifier + from imsld_learning_objects lo, imsld_environmentsi env + where lo.environment_id = :environment_item_id + } { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $lo_identifier -action $action + } + + # 2. show the services + db_foreach service { + select serv.service_id, + serv.identifier as serv_identifier + from imsld_services serv + where serv.environment_id = :environment_item_id + } { + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $serv_identifier -action $action + } + +} + +ad_proc -public imsld::runtime::activity_structure::show_hide { + -run_id + -identifier + -action +} { + mark an activity structure as showh or hidden. NOTE: not recursively +} { + # according to the spec, the activity structures doesn't have any isvisible attribute + # so we show the referenced activities, learning infos and environments + + db_1row context_info { + select isa.structure_id, + isa.item as structure_item_id + from imsld_runs ir, imsld_componentsi comp, imsld_activity_structuresi isa, imsld_imsldsi + where ir.run_id = :run_id + and ir.imsld_id = ii.imsld_id + and ii.item_id = comp.imsld_id + and isa.identifier = :identifier + and isa.component_id = comp.item_id + } + + # 1. show the info + db_foreach information { + select ii.imsld_item_id, + ii.identifier as ii_identifier + from acs_rels ar, imsld_itemsi ii + where ar.object_id_one = :structure_item_id + and ar.object_id_two = ii.item_id + } { + imsld::runtime::isvisible::show -run_id $run_id -identifier $ii_identifier -action $action + } + + # 2. show the learning activities + db_foreach learning_activity { + select la.item_id as activity_item_id, + la.identifier as la_identifier + from imsld_learning_activitiesi, acs_rels ar + where ar.object_id_one = :structure_item_id + and ar.object_id_two = la.item_id + } { + imsld::runtime::isvisible::show -run_id $run_id -identifier $la_identifier -action $action + } + + # 3. show the support activities + db_foreach support_activity { + select sa.item_id as activity_item_id, + sa.identifier as sa_identifier + from imsld_support_activitiesi, acs_rels ar + where ar.object_id_one = :structure_item_id + and ar.object_id_two = sa.item_id + } { + imsld::runtime::isvisible::show -run_id $run_id -identifier $sa_identifier -action $action + } + + # 4. show the activity structures + db_foreach structure { + select ias.item_id as structure_item_id, + ias.identifier as structure_identifier + from imsld_activity_structuresi, acs_rels ar + where ar.object_id_one = :structure_item_id + and ar.object_id_two = ias.item_id + } { + imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action + } + + # 5. show the environments + db_foreach structure { + select env.item_id as env_item_id, + env.identifier as env_identifier + from imsld_environmentsi, acs_rels ar + where ar.object_id_one = :structure_item_id + and ar.object_id_two = env.item_id + } { + imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action + } + +} + Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql 22 Jun 2006 10:56:54 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql 29 Jun 2006 09:27:57 -0000 1.3 @@ -28,9 +28,26 @@ - + + update imsld_attribute_instances + set is_visible_p = :is_visible_p, + with_control_p = :with_control_p, + title = :title + where run_id = :run_id + and identifier = :class + and type = 'class' + + + update imsld_attribute_instances + set is_visible_p = is_visible_p + where run_id = :run_id + and identifier = :identifier + and type = 'isvisible' + + +