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.3 -r1.4
--- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 20 Jun 2006 19:20:38 -0000 1.3
+++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-create.sql 22 Jun 2006 10:56:53 -0000 1.4
@@ -8,17 +8,22 @@
--
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)
+ 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),
+ creation_date timestamptz
+ not null,
+ status_date timestamptz
+ default current_timestamp
+ not null
);
create index imsld_run_imsld_idx on imsld_runs(imsld_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.1 -r1.2
--- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql 16 May 2006 09:24:35 -0000 1.1
+++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-package-create.sql 22 Jun 2006 10:56:53 -0000 1.2
@@ -100,8 +100,8 @@
null
);
- insert into imsld_runs (run_id, imsld_id, status)
- values (v_run_id, p_imsld_id, p_status);
+ insert into imsld_runs (run_id, imsld_id, status, creation_date, status_date)
+ values (v_run_id, p_imsld_id, p_status, now(), now());
return v_run_id;
end;
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.43 -r1.44
--- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 21 Jun 2006 14:45:08 -0000 1.43
+++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 22 Jun 2006 10:56:54 -0000 1.44
@@ -2093,8 +2093,8 @@
}
set langstring ""
- set calculate_id ""
- set expression_id ""
+ set calculate ""
+ set expression_xml ""
# Property Value
set property_value [$property_value_node child all imsld:property-value]
@@ -2120,12 +2120,13 @@
if { [llength $expression] } {
imsld::parse::validate_multiplicity -tree $expression -multiplicity 1 -element_name expression(property-value) -equal
}
+ set expression_xml [$expression asXML]
}
}
set property_value_id [imsld::item_revision_new -attributes [list [list property_id $property_id] \
[list langstring $langstring] \
- [list expression_xml [$expression asXML]] \
+ [list expression_xml $expression_xml] \
[list property_value_ref $property_id]] \
-content_type imsld_property_value \
-parent_id $parent_id]
@@ -3564,8 +3565,6 @@
}
-}
-
ad_proc -public imsld::parse::parse_and_create_calculate {
-calculate_node
-manifest
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.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 20 Jun 2006 19:20:38 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 22 Jun 2006 10:56:54 -0000 1.2
@@ -9,6 +9,7 @@
}
namespace eval imsld {}
+namespace eval imsld::runtime {}
namespace eval imsld::runtime::property {}
ad_proc -public imsld::runtime::property::instance_value_set {
@@ -18,3 +19,150 @@
db_dml update_instance_value { *SQL* }
}
+ad_proc -public imsld::runtime::property::property_value_set {
+ -run_id
+ -user_id
+ -value
+ {-identifier ""}
+ {-property_id ""}
+} {
+ # context info
+ db_1row context_info {
+ select ic.item_id as component_item_id,
+ ii.imsld_id,
+ rug.group_id as run_group_id
+ from imsld_componentsi ic, imsld_imsldsi ii, imsld_runs ir, imsld_run_users_group_ext rug
+ where ic.imsld_id = ii.item_id
+ and content_revision__is_live(ii.imsld_id) = 't'
+ and ii.imsld_id = ir.imsld_id
+ and rug.run_id = ir.run_id
+ and ir.run_id = :run_id
+ }
+
+ # property info
+ if { [string eq $property_id ""] } {
+ db_1row property_info_from_identifier {
+ select type,
+ property_id,
+ role_id
+ from imsld_properties
+ where component_id = :component_item_id
+ and identifier = :identifier
+ }
+ } else {
+ db_1row property_info_from_id {
+ select type,
+ identifier,
+ role_id
+ from imsld_properties
+ where property_id = :property_id
+ }
+ }
+
+ # instance info
+ if { ![string eq $role_id ""] } {
+ # find the role instance which the user belongs to
+ set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $user_id]
+ if { !$role_instance_id } {
+ # runtime error... the user doesn't belong to any role instance
+ ns_log notice "User does not belong to any role instance"
+ continue
+ }
+ }
+
+ db_1row get_property_instance {
+ select ins.instance_id
+ from imsld_propertiesi prop,
+ imsld_property_instances ins
+ where prop.property_id = ins.property_id
+ and ((prop.type = 'global')
+ or (prop.type = 'loc' and ins.run_id = :run_id)
+ or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :user_id)
+ or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id)
+ or (prop.type = 'globpers' and ins.party_id = :user_id))
+ and prop.property_id = :property_id
+ }
+ imsld::runtime::property::instance_value_set -instance_id $instance_id -value $value
+}
+
+ad_proc -public imsld::runtime::time_uol_started {
+ -run_id
+} {
+ return [db_string date_time { *SQL* }]
+}
+
+ad_proc -public imsld::runtime::date_time_activity_started {
+ -run_id
+ -user_id
+ -activity_id
+} {
+ return [db_string date_time { *SQL* }]
+}
+
+ad_proc -public imsld::runtime::property::property_value_get {
+ -run_id
+ -user_id
+ {-identifier ""}
+ {-property_id ""}
+} {
+ # context info
+ db_1row context_info {
+ select ic.item_id as component_item_id,
+ ii.imsld_id,
+ rug.group_id as run_group_id
+ from imsld_componentsi ic, imsld_imsldsi ii, imsld_runs ir, imsld_run_users_group_ext rug
+ where ic.imsld_id = ii.item_id
+ and content_revision__is_live(ii.imsld_id) = 't'
+ and ii.imsld_id = ir.imsld_id
+ and rug.run_id = ir.run_id
+ and ir.run_id = :run_id
+ }
+
+ # property info
+ if { [string eq $property_id ""] } {
+ db_1row property_info_from_identifier {
+ select type,
+ property_id,
+ role_id
+ from imsld_properties
+ where component_id = :component_item_id
+ and identifier = :identifier
+ }
+ } else {
+ db_1row property_info_from_id {
+ select type,
+ identifier,
+ role_id
+ from imsld_properties
+ where property_id = :property_id
+ }
+ }
+
+ if { ![string eq $role_id ""] } {
+ # find the role instance which the user belongs to
+ set role_instance_id [imsld::roles::get_user_role_instance -run_id $run_id -role_id $role_id -user_id $user_id]
+ if { !$role_instance_id } {
+ # runtime error... the user doesn't belong to any role instance
+ ns_log notice "User does not belong to any role instance"
+ continue
+ }
+ }
+
+ db_1row get_property_value {
+ select ins.property_id,
+ prop.datatype,
+ coalesce(ins.value, prop.initial_value) as value
+ from imsld_propertiesi prop,
+ imsld_property_instances ins
+ where prop.property_id = ins.property_id
+ and ((prop.type = 'global')
+ or (prop.type = 'loc' and ins.run_id = :run_id)
+ or (prop.type = 'locpers' and ins.run_id = :run_id and ins.party_id = :user_id)
+ or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id)
+ or (prop.type = 'globpers' and ins.party_id = :user_id))
+ and prop.property_id = :property_id
+ }
+}
+
+
+
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.1 -r1.2
--- openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql 20 Jun 2006 19:20:38 -0000 1.1
+++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.xql 22 Jun 2006 10:56:54 -0000 1.2
@@ -9,4 +9,28 @@
+
+
+ select status_date
+ from imsld_runs
+ where run_id = :run_id
+ and status = 'started'
+
+
+
+
+
+ select status_date
+ from imsld_status_user
+ where run_id = :run_id
+ and user_id = :user_id
+ and status = 'started'
+
+
+
+
+
+
+
+
Index: openacs-4/packages/imsld/www/activity-frame.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.tcl,v
diff -u -r1.7 -r1.8
--- openacs-4/packages/imsld/www/activity-frame.tcl 20 Jun 2006 19:20:38 -0000 1.7
+++ openacs-4/packages/imsld/www/activity-frame.tcl 22 Jun 2006 10:56:54 -0000 1.8
@@ -1,3 +1,5 @@
+# packages/imsld/www/activity-frameset.tcl
+
ad_page_contract {
This is the frame that contains the associated URLs of an activity
@@ -10,7 +12,41 @@
}
set user_id [ad_conn user_id]
+db_1row context_info {
+ select r.imsld_id,
+ case
+ when exists (select 1 from imsld_learning_activities where activity_id = :activity_id)
+ then 'learning'
+ when exists (select 1 from imsld_support_activities where activity_id = :activity_id)
+ then 'support'
+ when exists (select 1 from imsld_activity_structures where structure_id = :activity_id)
+ then 'structure'
+ end as activity_type
+ from imsld_runs r
+ where run_id = :run_id
+}
+# make sure the activity is marked as started for this user
+db_dml mark_activity_started {
+ insert into imsld_status_user (imsld_id,
+ run_id,
+ related_id,
+ user_id,
+ type,
+ status_date,
+ status)
+ (
+ select :imsld_id,
+ :run_id,
+ :activity_id,
+ :user_id,
+ :activity_type,
+ now(),
+ 'started'
+ where not exists (select 1 from imsld_status_user where run_id = :run_id and user_id = :user_id and related_id = :activity_id and status = 'started')
+ )
+}
+
set supported_roles [db_list supported_roles_list { select iri.role_id
from imsld_rolesi iri,
acs_rels ar,
Index: openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 7 Jun 2006 10:48:18 -0000 1.2
+++ openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 22 Jun 2006 10:56:54 -0000 1.3
@@ -13,10 +13,14 @@
imsld::instance::instantiate_properties -run_id $run_id
imsld::instance::instantiate_activity_attributes -run_id $run_id
-#ojo!!!! poner aqu� tema de permisos!!!
+# NOTE: we should verify the permissions here
set conditions 1
if {$conditions == 1} {
- db_dml set_run_active { update imsld_runs set status='active' where run_id=:run_id and imsld_id=:imsld_id}
+ db_dml set_run_active {
+ update imsld_runs set status = 'active',
+ status_date = now()
+ where run_id=:run_id and imsld_id=:imsld_id
+ }
}
ad_returnredirect ..