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.32 -r1.33 --- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 3 Nov 2006 14:39:02 -0000 1.32 +++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 21 Dec 2006 15:20:47 -0000 1.33 @@ -1,11 +1,16 @@ + | Assigned users: Component Identifier + | Creation Date: + | Status: The run is Act Identifier active Activity Identifier + Activity Name Activity Structures + Activity Type Acts in play %count% Admin IMS LD Back to admin @@ -18,7 +23,9 @@ Complete Acts Component Identifier Condition + conference Conference Type + Confirm Confirm: New IMS-LD Context info Create New? @@ -33,14 +40,21 @@ Descendant roles: Description Else Identifier + Email Error parsing file Existing href + Exit UoL Expression Extra Activities Feedbach Title Feedback File name + Finish Date finished + Finished Date + Go back + go back + Group members Groups in role Href Identifier @@ -101,6 +115,7 @@ IMS-LDs IMS Learning Designs Unit of Learning Name + Individual Report Information Initial Value Is shared? @@ -117,6 +132,7 @@ <li> impozzible </li> Activity Description Identifier Activity Structure Identifier + Are all the students asigned to the proper roles? If you confirm now, no more changes will be acepted later. <br>\ Go to the activity <a href=\"%activity_url%\">%activity_title%</a> (of the UoL <a href=\"%imsld_url%\">%imsld_title%</a> in the community <a href=\"$community_url\">%community_name%</a>) for further details. <br>\ @@ -141,6 +157,7 @@ Expression One Identifier Expression Two Identifer <h2>Uploading new IMS Learning Design</h2> + If you are not sure that everything is OK, please Import IMS-LD ZIP File IMS-LD Activity Description IMS-LD Activity Descriptions @@ -182,6 +199,9 @@ Learning Unit finished <li> desc (no file associated) </li> manifest namespace is not imscp + Max. number of students per group: %max_persons% + Min. number of students per group: %min_persons% + Monitoring One Activity More than one service in environment %identifier%. Just one used (the first one) More than one validation tried at the same time No imsmanifest.xml found @@ -193,6 +213,7 @@ On Completion Identifier Organization Identifier organizations tag not found in imsmanifest.xml + Otherwise, if everthing is OK and you are sure, please Parent Item Identifier Parent Manifest Identifier Parent Role Identifier @@ -222,7 +243,13 @@ Referenced support activity (%support_activity_ref_ref%) in role part %identifie% does not exist. Referenced support activity %support_activity_ref_ref% in role part %identifier% is actually an activity structure. Referenced support activity %support_activity_ref% in role part %identifier% is actually a learning activity. + Select a role to send the email + Select parent for the new instance + Select role to support... + Select user to support... Service type %service_type% not implemented + Some errors has been found + Some warnings has been found Sorry, that service type (%service_type%) hasn't been implemented yet. Support Activity Identifier The decimal digits can't be more than %restriction_value% @@ -266,6 +293,7 @@ There was an error generating the tmp_dir to unzip the file. There was an error parsing the manifest. Please correct it and try again. <br /><code>%errmsg%</code> There was an error trying to delete the dir %dir%. + This is a special case and we can only list the users who have sent an email since the run became active and that are associated with the run. Time Limit Identifier Time Property Identifier <ul> Completed Activities <br /> @@ -275,12 +303,16 @@ %sender_name% has triggered this notification. Please do not replay to this email. <br><br> Go to the UoL: <a href=\"%imsld_url%\">%imsld_title%</a> (in the community: <a href=\"%community_url%\">%community_name%</a> community) for further details. Username Property Identifier + Users who have <b>at least visited</b> the service + Users who have <b>viewed/visited all</b> the referenced resources from the environment + Users who have started and/or finished this activity Valid types are learning, support and structure More than one learning object in environment %identifier%. Just one used (the first one) We will continue automatically when processing is complete. When Last Act Completed? When Property Value is Set Identifier When property value is set XML + You must provide an activity_id, service_id or learning_object_id... Mail Data (make it live) Manage Members @@ -292,14 +324,19 @@ Method Identifier Min Persons Moderator_Identifier + Monitor + monitor User + Name &nbsp;&nbsp;&nbsp;done New IMS-LD information found in the imsmanifest.xml file. Nothing to do. No IMS LD + No info was found None None, please select Not defined + Not members Notification Notification Subject Notifications @@ -328,20 +365,25 @@ Role Type Role(s) in Run Run (IMS-LD) Name + Run(UoL) Name: Runs (IMS-LD instances) select user... Select a role... Select a role Select role... Self send-mail service + sendmail Sendmail Identifier Sequence Used Service Identifier Service Type + since Sort Sort Order Staff Roles + Start Date + Started Date Status stopped Structure Type @@ -350,6 +392,7 @@ The selected role has no parent Then Identifier There are no descendant roles + is the list of activities started (and finished) by %member_name% Time in Seconds Total Activities Parent Roles Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql 24 Oct 2006 10:09:50 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql 21 Dec 2006 15:20:47 -0000 1.2 @@ -44,3 +44,24 @@ comment on table imsld_notifications_history is ' Table used to keep track of the notifications'; +create sequence t_imsld_rar_seq; +create view imsld_rar_seq as +select nextval('t_imsld_rar_seq') as nextval; + +create table imsld_runtime_activities_rels ( + rel_id integer + constraint imsld_rar_rels_pk + primary key, + run_id integer + constraint imsld_rar_run_fk + references imsld_runs, + role_id integer + constraint imsld_rar_role_fk + references cr_revisions, + activity_id integer + constraint imsld_rar_act_fk + references cr_revisions +); + +comment on table imsld_runtime_activities_rels is ' +This table stores the relationships between run time assigned activities and roles.'; Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql 24 Oct 2006 10:09:50 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-c-drop.sql 21 Dec 2006 15:20:47 -0000 1.2 @@ -8,3 +8,7 @@ drop table imsld_notifications cascade; drop table imsld_notifications_history cascade; + +drop table imsld_runtime_activities_rels cascade; + +drop sequence imsld_rar_seq; Index: openacs-4/packages/imsld/sql/postgresql/upgrade/upgrade-0.01d-1.0d.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/upgrade/Attic/upgrade-0.01d-1.0d.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/sql/postgresql/upgrade/upgrade-0.01d-1.0d.sql 3 Nov 2006 14:40:39 -0000 1.1 +++ openacs-4/packages/imsld/sql/postgresql/upgrade/upgrade-0.01d-1.0d.sql 21 Dec 2006 15:20:47 -0000 1.2 @@ -1,34 +1,56 @@ +-- upgrade script from 0.01d to 1.0d +create function inline_0 () +returns integer as' +declare + sel_rec record; +begin + for sel_rec in select serv.username_property_id, serv.email_property_id, data.data_id + from imsld_send_mail_data data, imsld_send_mail_servicesi serv + where data.send_mail_id = serv.item_id + and content_revision__is_live(serv.mail_id) = ''t'' + loop + update imsld_send_mail_data + set email_property_id = sel_rec.email_property_id, + username_property_id = sel_rec.username_property_id + where data_id = sel_rec.data_id; + end loop; +return 0; +end;' language 'plpgsql'; +select inline_0 (); +drop function inline_0 (); ---create function inline_0 () ---returns integer as' ---declare --- sel_rec record; ---begin --- for sel_rec in select serv.username_property_id, serv.email_property_id, data.data_id --- from imsld_send_mail_data data, imsld_send_mail_servicesi serv --- where data.send_mail_id = serv.item_id --- and content_revision__is_live(serv.mail_id) = ''t'' --- loop --- update imsld_send_mail_data --- set email_property_id = sel_rec.email_property_id, --- username_property_id = sel_rec.username_property_id --- where data_id = sel_rec.data_id; --- end loop; ---return 0; ---end;' language 'plpgsql'; ---select inline_0 (); ---drop function inline_0 (); +drop index imsld_sm_data_sm_id_idx; +alter table imsld_send_mail_data drop column send_mail_id cascade; +select content_type__drop_attribute('imsld_send_mail_data','send_mail_id','f'); ---drop index imsld_sm_data_sm_id_idx; ---alter table imsld_send_mail_data drop column send_mail_id cascade; ---select content_type__drop_attribute('imsld_send_mail_data','send_mail_id','f'); +alter table imsld_send_mail_services drop column email_property_id cascade; +select content_type__drop_attribute('imsld_send_mail_service','email_property_id','f'); ---alter table imsld_send_mail_services drop column email_property_id cascade; ---select content_type__drop_attribute('imsld_send_mail_service','email_property_id','f'); +alter table imsld_send_mail_services drop column username_property_id cascade; +select content_type__drop_attribute('imsld_send_mail_service','username_property_id','f'); ---alter table imsld_send_mail_services drop column username_property_id cascade; ---select content_type__drop_attribute('imsld_send_mail_service','username_property_id','f'); +create sequence t_imsld_rar_seq; +create view imsld_rar_seq as +select nextval('t_imsld_rar_seq') as nextval; +create table imsld_runtime_activities_rels ( + rel_id integer + constraint imsld_rar_rels_pk + primary key, + run_id integer + constraint imsld_rar_run_fk + references imsld_runs, + role_id integer + constraint imsld_rar_role_fk + references cr_revisions, + activity_id integer + constraint imsld_rar_act_fk + references cr_revisions +); + +comment on table imsld_runtime_activities_rels is ' +This table stores the relationships between run time assigned activities and roles.'; + \i ../imsld-level-c-create.sql 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.40 -r1.41 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 19 Dec 2006 10:36:07 -0000 1.40 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 21 Dec 2006 15:20:47 -0000 1.41 @@ -552,14 +552,6 @@ rel_types::new imsld_send_mail_serv_data_rel "Send Mail Service - Email Data" "Send Mail Service - Email Datas" \ content_item 0 {} \ content_item 0 {} - - # Level C, notifications: Runtime assigned activities - # Notifications may set to TRUE the visibility attribute of ANY activity for a given role, - # and by any we mean that the activity does not have to be assigned to a role part associated with that role. - # Therefore we crate this rel type where we map the role with the runtime assigned activities - rel_types::new imsld_run_time_activities_rel "Role - Activity" "Role - Activities" \ - content_revision 0 {} \ - content_revision 0 {} } ad_proc -public imsld::install::after_upgrade { @@ -590,16 +582,7 @@ content_item 0 {} \ content_item 0 {} - # Level C, notifications: Runtime assigned activities - # Notifications may set to TRUE the visibility attribute of ANY activity for a given role, - # and by any we mean that the activity does not have to be assigned to a role part associated with that role. - # Therefore we crate this rel type where we map the role with the runtime assigned activities - rel_types::new imsld_run_time_activities_rel "Role - Activity" "Role - Activities" \ - content_revision 0 {} \ - content_revision 0 {} - # special case: add the new attributes, new rel and migrate the existing data - content::type::attribute::new -content_type imsld_send_mail_data -attribute_name email_property_id -datatype number -pretty_name "#imsld.lt_Email_Propery_Identif#" -column_spec "integer" content::type::attribute::new -content_type imsld_send_mail_data -attribute_name username_property_id -datatype number -pretty_name "#imsld.lt_Username_Property_Ide#" -column_spec "integer" @@ -684,7 +667,6 @@ imsld::rel_type_delete -rel_type imsld_on_comp_notif_rel imsld::rel_type_delete -rel_type imsld_notif_email_rel imsld::rel_type_delete -rel_type imsld_send_mail_serv_data_rel - imsld::rel_type_delete -rel_type imsld_run_time_activities_rel } ad_proc -public imsld::uninstall::delete_ext_rels { Index: openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl 21 Dec 2006 15:20:47 -0000 1.1 @@ -0,0 +1,833 @@ +# /packages/imsld/tcl/imsld-monitor-procs.tcl + +ad_library { + Procedures in the imsld::monitor namespace. + + @creation-date Nov 2006 + @author jopez@inv.it.uc3m.es + @cvs-id $Id: imsld-monitor-procs.tcl,v 1.1 2006/12/21 15:20:47 josee Exp $ +} + +namespace eval imsld::monitor {} + +ad_proc -public imsld::monitor::structure_activities_list { + -imsld_id + -run_id + -structure_item_id + -role_part_id + -play_id + -act_id + -dom_node + -dom_doc +} { + @param imsld_id + @param run_id + @param structure_item_id + @param role_part_id + @param play_id + @param act_id + + @return A list of lists of the activities referenced from the activity structure +} { + # auxiliary list to store the activities + set completed_list [list] + # get the structure info + db_1row structure_info { + select structure_id, + structure_type + from imsld_activity_structuresi + where item_id = :structure_item_id + } + # get the referenced activities which are referenced from the structure + foreach referenced_activity [db_list_of_lists struct_referenced_activities { + select ar.object_id_two, + ar.rel_type, + ar.rel_id + from acs_rels ar, imsld_activity_structuresi ias + where ar.object_id_one = ias.item_id + and ias.structure_id = :structure_id + order by ar.object_id_two + }] { + # get all the directly referenced activities (from the activity structure) + set object_id_two [lindex $referenced_activity 0] + set rel_type [lindex $referenced_activity 1] + set rel_id [lindex $referenced_activity 2] + switch $rel_type { + imsld_as_la_rel { + # add the activiti to the TCL list + db_1row get_learning_activity_info { + select la.title as activity_title, + la.item_id as activity_item_id, + la.activity_id, + la.complete_act_id + from imsld_learning_activitiesi la + where la.item_id = :object_id_two + and content_revision__is_live(la.activity_id) = 't' + } + db_1row get_sort_order { + select sort_order from imsld_as_la_rels where rel_id = :rel_id + } + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + set completed_list [linsert $completed_list $sort_order [$activity_node asList]] + } + imsld_as_sa_rel { + # add the activiti to the TCL list + db_1row get_support_activity_info { + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + sa.complete_act_id + from imsld_support_activitiesi sa + where sa.item_id = :object_id_two + and content_revision__is_live(sa.activity_id) = 't' + } + db_1row get_sort_order { + select sort_order from imsld_as_sa_rels where rel_id = :rel_id + } + + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + set completed_list [linsert $completed_list $sort_order [$activity_node asList]] + } + imsld_as_as_rel { + db_1row get_activity_structure_info { + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where item_id = :object_id_two + and content_revision__is_live(structure_id) = 't' + } + db_1row get_sort_order { + select sort_order from imsld_as_as_rels where rel_id = :rel_id + } + + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "structure"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $structure_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $structure_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "structure"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $structure_id -type "activity"])"] + $info_node appendChild $text + $structure_node appendChild $info_node + + set nested_activities_list [imsld::monitor::structure_activities_list -imsld_id $imsld_id \ + -run_id $run_id \ + -structure_item_id $structure_item_id \ + -role_part_id $role_part_id \ + -play_id $play_id \ + -act_id $act_id \ + -dom_node $structure_node \ + -dom_doc $dom_doc] + set ul_node [$dom_doc createElement ul] + foreach nested_activity $nested_activities_list { + $ul_node appendFromList $nested_activity + } + $structure_node appendChild $ul_node + set completed_list [linsert $completed_list $sort_order [$structure_node asList]] + } + } + } + return $completed_list +} + +ad_proc -public imsld::monitor::activities_tree { + -run_id:required + -dom_node + -dom_doc +} { + @param run_id + @param dom_node + @param dom_doc + + @return A list of lists of all the activities in the run +} { + db_1row imsld_info { + select imsld_id + from imsld_runs + where run_id = :run_id + } + + # get the referenced role parts + foreach role_part_list [db_list_of_lists referenced_role_parts { + select case + when rp.learning_activity_id is not null + then 'learning' + when rp.support_activity_id is not null + then 'support' + when rp.activity_structure_id is not null + then 'structure' + else 'none' + end as type, + content_item__get_live_revision(coalesce(rp.learning_activity_id,rp.support_activity_id,rp.activity_structure_id)) as activity_id, + rp.role_part_id, + ia.act_id, + ip.play_id + from imsld_role_partsi rp, imsld_actsi ia, imsld_playsi ip, imsld_imsldsi ii, + imsld_methodsi im + where rp.act_id = ia.item_id + and ia.play_id = ip.item_id + and ip.method_id = im.item_id + and im.imsld_id = ii.item_id + and ii.imsld_id = :imsld_id + and content_revision__is_live(rp.role_part_id) = 't' + order by ip.sort_order, ia.sort_order, rp.sort_order + }] { + set type [lindex $role_part_list 0] + set activity_id [lindex $role_part_list 1] + set role_part_id [lindex $role_part_list 2] + set act_id [lindex $role_part_list 3] + set play_id [lindex $role_part_list 4] + switch $type { + learning { + # add the learning activity to the tree + db_1row get_learning_activity_info { + select la.title as activity_title, + la.item_id as activity_item_id, + la.activity_id, + la.complete_act_id + from imsld_learning_activitiesi la + where activity_id = :activity_id + } + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + $dom_node appendChild $activity_node + } + support { + # add the support activity to the tree + db_1row get_support_activity_info { + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + sa.complete_act_id + from imsld_support_activitiesi sa + where sa.activity_id = :activity_id + } + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + $dom_node appendChild $activity_node + } + structure { + db_1row get_activity_structure_info { + select title as activity_title, + item_id as structure_item_id, + structure_id, + structure_type + from imsld_activity_structuresi + where structure_id = :activity_id + } + + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "structure"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $structure_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $structure_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "structure"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $structure_id -type "activity"])"] + $info_node appendChild $text + $structure_node appendChild $info_node + + set nested_list [imsld::monitor::structure_activities_list -imsld_id $imsld_id \ + -run_id $run_id \ + -structure_item_id $structure_item_id \ + -role_part_id $role_part_id \ + -play_id $play_id \ + -act_id $act_id \ + -dom_doc $dom_doc \ + -dom_node $dom_node] + # the nested finished activities are returned as a tcl list in tDOM format + $structure_node appendFromList [list ul [list] [concat [list] $nested_list]] + $dom_node appendChild $structure_node + } + } + } +} + +ad_proc -public imsld::monitor::runtime_assigned_activities_tree { + -run_id:required + -dom_node + -dom_doc +} { + @param run_id + @param dom_node + @param dom_doc + + @return A list of lists of the activities +} { + # context info + db_1row imsld_info { + select imsld_id + from imsld_runs + where run_id = :run_id + } + + # 1. get any related activities to the rurn with the rel imsld_run_time_activities_rel + # 2. get the info of those activities (role_part_id, act_id, play_id) and generate the list + # NOTE: the activity will be shown only once, no matter from how many role parts it is referenced + + # get the referenced activities to the run, assigned at runtime (notifications, level C) + + foreach activity_id [db_list runtime_activities { + select distinct(activity_id) as activity_id + from imsld_runtime_activities_rels + where run_id = :run_id + } ] { + # get the activity_type + if { [db_0or1row learning_activity_p { + select 1 + from imsld_learning_activities + where activity_id = :activity_id + }] } { + set activity_type learning + } else { + set activity_type support + } + set role_part_id [imsld::get_role_part_from_activity -activity_type $activity_type -leaf_id [content::revision::item_id -revision_id $activity_id]] + + # role_part context info + db_1row role_part_context { + select ia.act_id, + ip.play_id + from imsld_role_parts rp, + imsld_actsi ia, + imsld_playsi ip + where rp.act_id = ia.item_id + and ia.play_id = ip.item_id + and rp.role_part_id = :role_part_id + and content_revision__is_live(ip.play_id) = 't' + } + + switch $activity_type { + learning { + # add the learning activity to the tree + db_1row get_learning_activity_info { + select la.title as activity_title, + la.item_id as activity_item_id, + la.activity_id, + la.complete_act_id + from imsld_learning_activitiesi la + where activity_id = :activity_id + } + + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + $dom_node appendChild $activity_node + } + support { + # add the support activity to the tree + db_1row get_support_activity_info { + select sa.title as activity_title, + sa.item_id as activity_item_id, + sa.activity_id, + sa.complete_act_id + from imsld_support_activitiesi sa + where sa.activity_id = :activity_id + } + + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $activity_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $activity_id -type "activity"])"] + $info_node appendChild $text + $activity_node appendChild $info_node + + $dom_node appendChild $activity_node + } + } + } +} + +ad_proc -public imsld::monitor::environment_as_ul { + -environment_item_id:required + -run_id:required + -dom_node:required + -dom_doc:required +} { + @param environment_item_id + @param run_id + @option resource_mode + @param dom_node + @param dom_doc + + @return a html list (in a dom tree) of the associated resources, files and environments referenced from the given environment. +} { + # get environment info + db_1row environment_info { + select env.title as environment_title, + env.environment_id + from imsld_environmentsi env + where env.item_id = :environment_item_id + and content_revision__is_live(env.environment_id) = 't' + } + + set environment_node_li [$dom_doc createElement li] + $environment_node_li setAttribute class "liOpen" + set text [$dom_doc createTextNode "$environment_title"] + $environment_node_li appendChild $text + set environment_node [$dom_doc createElement ul] + # FIX-ME: if the ul is empty, the browser shows the ul incorrectly + set text [$dom_doc createTextNode ""] + $environment_node appendChild $text + + foreach learning_objects_list [db_list_of_lists get_learning_object_info { + select lo.item_id as learning_object_item_id, + lo.learning_object_id, + lo.identifier, + coalesce(lo.title,lo.identifier) as lo_title, + lo.class + from imsld_learning_objectsi lo + where lo.environment_id = :environment_item_id + and content_revision__is_live(lo.learning_object_id) = 't' + order by lo.creation_date + }] { + set learning_object_item_id [lindex $learning_objects_list 0] + set learning_object_id [lindex $learning_objects_list 1] + set identifier [lindex $learning_objects_list 2] + set lo_title [lindex $learning_objects_list 3] + set class_name [lindex $learning_objects_list 4] + + # learning object item. get the files associated + set linear_item_list [db_list_of_lists item_linear_list { + select ii.imsld_item_id + from imsld_items ii, + cr_items cr, + acs_rels ar + where ar.object_id_one = :learning_object_item_id + and ar.object_id_two = cr.item_id + and cr.live_revision = ii.imsld_item_id + }] + foreach imsld_item_id $linear_item_list { + foreach environments_list [db_list_of_lists env_nested_associated_items { + select cpr.resource_id, + cr2.item_id as resource_item_id, + cpr.type as resource_type + from imsld_cp_resources cpr, imsld_items ii, + acs_rels ar, cr_items cr1, cr_items cr2 + where ar.object_id_one = cr1.item_id + and ar.object_id_two = cr2.item_id + and cr1.live_revision = ii.imsld_item_id + and cr2.live_revision = cpr.resource_id + and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + 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) + }] { + set resource_id [lindex $environments_list 0] + set resource_item_id [lindex $environments_list 1] + set resource_type [lindex $environments_list 2] + + set lo_node [$dom_doc createElement li] + $lo_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {run_id learning_object_id {type learning_object}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$lo_title"] + $a_node appendChild $text + $lo_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $lo_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {run_id learning_object_id {type learning_object}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $learning_object_id -item_id $learning_object_item_id -type "learning_object"])"] + $info_node appendChild $text + $lo_node appendChild $info_node + + $environment_node appendChild $lo_node + } + } + } + + # services + foreach services_list [db_list_of_lists get_service_info { + select ise.service_id, + ise.item_id as service_item_id, + ise.identifier, + ise.service_type, + ise.title as service_title, + ise.class + from imsld_servicesi ise + where ise.environment_id = :environment_item_id + and content_revision__is_live(ise.service_id) = 't' + }] { + set service_id [lindex $services_list 0] + set service_item_id [lindex $services_list 1] + set identifier [lindex $services_list 2] + set service_type [lindex $services_list 3] + set service_title [expr { [string eq [lindex $services_list 4] ""] ? $environment_title : [lindex $services_list 4] }] + set class_name [lindex $services_list 5] + + set service_node [$dom_doc createElement li] + $service_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[export_vars -base "activity-frame" -url {run_id service_id {type service}}]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$service_title"] + $a_node appendChild $text + $service_node appendChild $a_node + + set text [$dom_doc createTextNode " "] + $service_node appendChild $text + + set info_node [$dom_doc createElement a] + $info_node setAttribute href "[export_vars -base "activity-frame" -url {run_id service_id {type service}}]" + $info_node setAttribute target "content" + set text [$dom_doc createTextNode "([imsld::monitor::number_of_visitors -run_id $run_id -revision_id $service_id -type "service"])"] + $info_node appendChild $text + $service_node appendChild $info_node + + $environment_node appendChild $service_node + + } + + # environments + foreach nested_environment_item_id [db_list nested_environment { + select ar.object_id_two as nested_environment_item_id + from acs_rels ar + where ar.object_id_one = :environment_item_id + and ar.rel_type = 'imsld_env_env_rel' + }] { + imsld::monitor::process_environment_as_ul -environment_item_id $nested_environment_item_id \ + -run_id $run_id \ + -resource_mode $resource_mode \ + -dom_node $environment_node \ + -dom_doc $dom_doc + } + $environment_node_li appendChild $environment_node + $dom_node appendChild $environment_node_li +} + +ad_proc -public imsld::monitor::activity_environments_tree { + -activity_item_id:required + -run_id:required + -dom_node + -dom_doc +} { + @param activity_item_id + @param run_id + @param rel_type + @param dom_node + @param dom_doc + + @return The html list (using tdom) of resources (learning objects and services) associated to the activity's environment(s) +} { + # get the rel_type + if { [db_0or1row is_imsld { + select 1 from imsld_imsldsi where item_id = :activity_item_id + }] } { + return "" + } elseif { [db_0or1row is_learning { + select 1 from imsld_learning_activitiesi where item_id = :activity_item_id + }] } { + set rel_type imsld_la_env_rel + } elseif { [db_0or1row is_support { + select 1 from imsld_support_activitiesi where item_id = :activity_item_id + }] } { + set rel_type imsld_sa_env_rel + } elseif { [db_0or1row is_structure { + select 1 from imsld_activity_structuresi where item_id = :activity_item_id + }] } { + set rel_type imsld_as_env_rel + } else { + return -code error "IMSLD::imsld::monitor::activity_environments_tree: Invalid call" + } + # get environments + set environments_list [list] + set associated_environments_list [db_list la_associated_environments { + select ar.object_id_two as environment_item_id + from acs_rels ar + where ar.object_id_one = :activity_item_id + and ar.rel_type = :rel_type + order by ar.object_id_two + }] + foreach environment_item_id $associated_environments_list { + imsld::monitor::environment_as_ul -environment_item_id $environment_item_id \ + -run_id $run_id \ + -dom_node $dom_node \ + -dom_doc $dom_doc + } +} + +ad_proc -public imsld::monitor::number_of_visitors { + -run_id:required + -revision_id:required + -item_id + -type +} { + @param revision_id + @param item_id + @param type + + @return The number of visitors of the activity/environment +} { + set number_of_visitors 0 + + switch $type { + activity { + set number_of_visitors [db_string visitors_count { + select count(distinct(user_id)) + from imsld_status_user + where status = 'started' + and run_id = :run_id + and related_id = :revision_id + } -default 0] + } + learning_object { + set item_list [db_list item_linear_list { + select ii.imsld_item_id + from imsld_items ii, + cr_items cr, + acs_rels ar + where ar.object_id_one = :item_id + and ar.object_id_two = cr.item_id + and cr.live_revision = ii.imsld_item_id}] + + foreach imsld_item_id $item_list { + lappend related_resources [db_list resources_list { + select cpr.resource_id + from imsld_cp_resources cpr, imsld_items ii, + acs_rels ar, cr_items cr1, cr_items cr2 + where ar.object_id_one = cr1.item_id + and ar.object_id_two = cr2.item_id + and cr1.live_revision = ii.imsld_item_id + and cr2.live_revision = cpr.resource_id + and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + 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)}] + } + + foreach resource_id $related_resources { + incr number_of_visitors [db_string get_visitors { + select count(distinct(stat.user_id)) + from imsld_status_user stat + where stat.run_id = :run_id + and related_id = :resource_id + and stat.status = 'finished' + }] + } + } + service { + + db_1row service_info { + select service_type, + item_id as service_item_id + from imsld_servicesi + where service_id = :revision_id + } + + switch $service_type { + conference { + db_1row conference_info { + select conf.conference_id, + conf.imsld_item_id as imsld_item_item_id, + cr.live_revision as imsld_item_id, + conf.title as conf_title + from imsld_conference_servicesi conf, cr_items cr + where conf.service_id = :service_item_id + and cr.item_id = conf.imsld_item_id + and content_revision__is_live(cr.live_revision) = 't' + } + + set related_resources [db_list conf_resources_list { + select cpr.resource_id + from imsld_cp_resourcesi cpr, imsld_itemsi ii, + acs_rels ar + where ar.object_id_one = ii.item_id + and ar.object_id_two = cpr.item_id + and content_revision__is_live(cpr.resource_id) = 't' + and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + 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) + }] + set resources_count [llength $related_resources] + + set number_of_visitors [llength [db_list count_visitors " + select count(user_id) + from imsld_status_user + where related_id in ([join $related_resources ","]) + and status = 'finished' + and run_id = :run_id + group by user_id + having count(*) = [llength $related_resources] + "]] + + } monitor { + db_1row monitor_info { + select ims.monitor_id, + ims.item_id as monitor_item_id, + cr.live_revision as imsld_item_id + from imsld_monitor_servicesi ims, cr_items cr + where ims.service_id = :service_item_id + and cr.item_id = ims.imsld_item_id + and content_revision__is_live(cr.live_revision) = 't' + } + + set related_resources [db_list conf_resources_list { + select cpr.resource_id + from imsld_cp_resourcesi cpr, imsld_itemsi ii, + acs_rels ar + where ar.object_id_one = ii.item_id + and ar.object_id_two = cpr.item_id + and content_revision__is_live(cpr.resource_id) = 't' + and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) + 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) + }] + + set number_of_visitors [llength [db_list count_visitors " + select count(user_id) + from imsld_status_user + where related_id in ([join $related_resources ","]) + and status = 'finished' + and run_id = :run_id + group by user_id + having count(*) = [llength $related_resources] + "]] + + } send-mail { + # 1. get the users associated to the run + # 2. get the users IN the run who have sent a bulk-mail message + + # NOTE: The bulk mail package has a bug when storing the send_date (it's stored in YYYY-MM-DD format, withot the hour) + # that's why we have to do a little trick with the dates when comparing them, even though it's not 100% accurate + set number_of_visitors [db_string count_visitors { + select count(distinct(gmm.member_id)) + from group_member_map gmm, + imsld_run_users_group_ext iruge, + acs_rels ar1, + imsld_runs ir, + acs_objects ao, + bulk_mail_messages bm + where iruge.run_id=:run_id + and iruge.run_id = ir.run_id + and ar1.object_id_two=iruge.group_id + and ar1.object_id_one=gmm.group_id + and ao.object_id = bm.bulk_mail_id + and ao.creation_user = gmm.member_id + and to_date(bm.send_date,'YYYY-MM-DD') >= to_date(ir.creation_date,'YYYY-MM-DD') + } -default 0] + } + } + } + } + return $number_of_visitors +} 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.92 -r1.93 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 21 Dec 2006 12:08:36 -0000 1.92 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 21 Dec 2006 15:20:47 -0000 1.93 @@ -9,6 +9,7 @@ } namespace eval imsld {} +namespace eval imsld::map {} ad_proc -public imsld::safe_url_name { -name:required @@ -61,6 +62,34 @@ return $image_path } +ad_proc -public imsld::map::role_to_activity { + -run_id + -activity_id + -role_id +} { + @param run_id + @param activity_id + @param role_id + + @return The rel_id created +} { + if { [db_0or1row existing_rel { + select rel_id + from imsld_runtime_activities_rels + where run_id = :run_id + and activity_id = :activity_id + and role_id = :role_id + }] } { + return $rel_id + } + + set rel_id [db_nextval acs_object_id_seq] + db_dml insert_mapping { + insert into imsld_runtime_activities_rels (rel_id, run_id, activity_id, role_id) + select imsld_rar_seq.nextval, :run_id, :activity_id, :role_id from dual + } +} + ad_proc -public imsld::get_role_part_from_activity { -activity_type -leaf_id @@ -750,7 +779,11 @@ # add the activity to the rel imsld_run_time_activities_rel if { ![string eq "" $activity_id] && ![db_0or1row already_mapped { *SQL* }] } { # map the activity to the role - relation_add imsld_run_time_activities_rel $role_id $activity_id + # NOTE: this mappnig couldn't be done using acs_rels becuase we could map more than once the same activity with the same role, + # with differnet context info (run_id), but that's not taken into account when creating the acs rel even tough if when creating the rel + # we indicate that the rel info is stored in other table.... + + imsld::map::role_to_activity -run_id $run_id -activity_id $activity_id -role_id $role_id } # send a notification (email) to each user in the role foreach recipient_user_id [imsld::roles::get_users_in_role -role_id $role_id -run_id $run_id] { @@ -1641,8 +1674,8 @@ imsld::process_resource_as_ul -resource_item_id $resource_item_id \ -run_id $run_id \ -dom_node $dom_node \ - -dom_doc $dom_doc - + -dom_doc $dom_doc \ + -li_mode # replace the image with the conference name set img_nodes [$dom_node selectNodes {.//img}] foreach img_node $img_nodes { @@ -1655,40 +1688,41 @@ ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]" } } - send-mail { # FIX ME: Currently only one send-mail-data is supported set resource_item_list [list] db_1row get_send_mail_info { *SQL* } - set send_mail_node_li [$dom_doc createElement li] set a_node [$dom_doc createElement a] - - $a_node setAttribute href "[export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/imsld-sendmail" {{send_mail_id $sendmail_id} {run_id $run_id}}]" + $a_node setAttribute href [export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/imsld-sendmail" {{send_mail_id $sendmail_id} {run_id $run_id}}] set service_title [$dom_doc createTextNode "$send_mail_title"] $a_node setAttribute target "content" $a_node appendChild $service_title $send_mail_node_li appendChild $a_node $dom_node appendChild $send_mail_node_li } - monitor { set resource_item_list [list] + set imsld_package_id [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ + -package_key "[imsld::package_key]"] db_1row monitor_service_info { *SQL* } db_foreach monitor_associated_items { *SQL* } { + lappend resource_item_list $resource_item_id + set monitor_node_li [$dom_doc createElement li] + set a_node [$dom_doc createElement a] + set file_url [export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/monitor-frame" { monitor_id }] + $a_node setAttribute href [export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}] + $a_node setAttribute target "content" + set service_title [$dom_doc createTextNode "$monitor_service_title"] + $a_node appendChild $service_title + $monitor_node_li appendChild $a_node + $dom_node appendChild $monitor_node_li + } if_no_rows { + ns_log debug "No monitor info" } - - set monitor_node_li [$dom_doc createElement li] - set a_node [$dom_doc createElement a] - - $a_node setAttribute href "[export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/monitor-frame" { monitor_id run_id }]" - set service_title [$dom_doc createTextNode "$monitor_service_title"] - $a_node setAttribute target "content" - $a_node appendChild $service_title - $monitor_node_li appendChild $a_node - $dom_node appendChild $monitor_node_li } default { @@ -1816,9 +1850,9 @@ foreach nested_environment_item_id [db_list nested_environment { *SQL* }] { set one_nested_environment_list [imsld::process_environment_as_ul -environment_item_id $nested_environment_item_id \ -run_id $run_id \ - -resource_mode $resource_mode \ - -dom_node $environment_node \ - -dom_doc $dom_doc] + -resource_mode $resource_mode \ + -dom_node $environment_node \ + -dom_doc $dom_doc] # the title is stored in [lindex $one_nested_environment_list 0], but is not returned for displaying porpouses set nested_environment_list [concat $nested_environment_list \ [lindex $one_nested_environment_list 1] \ @@ -1934,7 +1968,7 @@ set one_prerequisite_ul [imsld::process_resource_as_ul -resource_item_id $resource_item_id \ -run_id $run_id \ -dom_doc $dom_doc \ - -dom_node $dom_node] + -dom_node $dom_node } if_no_rows { ns_log notice "[_ imsld.lt_li_desc_no_file_assoc]" } @@ -2055,10 +2089,11 @@ set parent_id [lindex $file_list 3] # get the fs file path set folder_path [db_exec_plsql get_folder_path { *SQL* }] - set fs_file_url [db_1row get_fs_file_url { *SQL* }] + db_1row get_fs_file_url { *SQL* } + set fs_file_url $file_url set file_url "imsld-content-serve" set a_node [$dom_doc createElement a] - $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id resource_id $resource_id}]" + $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" {file_url $file_url resource_item_id $resource_item_id run_id $run_id}]" set img_node [$dom_doc createElement img] $img_node setAttribute src "[imsld::object_type_image_path -object_type file-storage]" $img_node setAttribute border "0" @@ -2312,7 +2347,6 @@ @option resource_mode default f @param dom_node @param dom_doc - @return The list (activity_name, list of associated urls, using tdom) of the activity in the IMS-LD. } { @@ -2765,6 +2799,7 @@ and ar.object_id_two = :user_id and iruge.run_id = :run_id }] + # get the referenced role parts foreach role_part_list [db_list_of_lists referenced_role_parts { *SQL* }] { set type [lindex $role_part_list 0] @@ -3364,7 +3399,7 @@ select serv.environment_id as environment_item_id from imsld_conference_servicesi ecs, imsld_servicesi serv - where ecs.item_id = :object_id_one + where ecs.imsld_item_id = :object_id_one and ecs.service_id = serv.item_id }] } { set activities_list [concat $activities_list [imsld::get_activity_from_environment -environment_item_id $environment_item_id]] @@ -3416,8 +3451,6 @@ @author Luis de la Fuente Valent�n (lfuente@it.uc3m.es) } { - - #look for the asociated activities set activities_list [imsld::get_activity_from_resource -resource_id $resource_id] # process each activity @@ -3469,7 +3502,7 @@ select 1 from imsld_status_user stat, imsld_cp_resourcesi icr where icr.item_id = :res_id - and icr.resource_id = stat.completed_id + and icr.resource_id = stat.related_id and user_id = :user_id and run_id = :run_id and status = 'finished' @@ -3791,4 +3824,4 @@ } } ad_register_proc GET /finish-component-element* imsld::finish_component_element -ad_register_proc POST /finish-component-elementx* imsld::finish_component_element +ad_register_proc POST /finish-component-element* imsld::finish_component_element Index: openacs-4/packages/imsld/tcl/imsld-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v diff -u -r1.35 -r1.36 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 3 Nov 2006 14:39:02 -0000 1.35 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 21 Dec 2006 15:20:47 -0000 1.36 @@ -534,10 +534,10 @@ select 1 - from acs_rels - where object_id_one = :role_id - and object_id_two = :activity_id - and rel_type = 'imsld_run_time_activities_rel' + from imsld_runtime_activities_rels + where role_id = :role_id + and activity_id = :activity_id + and run_id = :run_id @@ -1169,15 +1169,13 @@ cpr.item_id as resource_item_id, cpr.type as resource_type from imsld_cp_resourcesi cpr, imsld_itemsi ii, - acs_rels ar, imsld_res_files_rels map + acs_rels ar where ar.object_id_one = ii.item_id and ar.object_id_two = cpr.item_id and content_revision__is_live(cpr.resource_id) = 't' and (imsld_tree_sortkey between tree_left((select imsld_tree_sortkey from imsld_items where imsld_item_id = :imsld_item_id)) 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) - and ar.rel_id = map.rel_id - and map.displayable_p = 't' @@ -1496,6 +1494,7 @@ select identifier, + resource_id, type as resource_type, title as resource_title, acs_object_id @@ -2047,10 +2046,10 @@ - select ar.object_id_two as activity_id - from acs_rels ar - where ar.object_id_one = :user_role_id - and ar.rel_type = 'imsld_run_time_activities_rel' + select activity_id + from imsld_runtime_activities_rels + where role_id = :user_role_id + and run_id = :run_id @@ -2516,6 +2515,7 @@ where related_id = :resource_id and status = 'finished' and run_id = :run_id + and user_id = :user_id 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.13 -r1.14 --- openacs-4/packages/imsld/www/activity-frame.tcl 24 Oct 2006 10:09:51 -0000 1.13 +++ openacs-4/packages/imsld/www/activity-frame.tcl 21 Dec 2006 15:20:47 -0000 1.14 @@ -127,7 +127,7 @@ set objectives_list [list] } set resources_list [concat $resources_list [concat $prerequisites_list $objectives_list]] - imsld::grant_permissions -resources_activities_list $resources_list -user_id $user_id + imsld::grant_permissions -resources_activities_list $resources_list -user_id $user_id -run_id $run_id } set activities [$dom_root asXML] Index: openacs-4/packages/imsld/www/imsld-finish-resource.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-finish-resource.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/www/imsld-finish-resource.tcl 20 Sep 2006 15:04:05 -0000 1.9 +++ openacs-4/packages/imsld/www/imsld-finish-resource.tcl 21 Dec 2006 15:20:47 -0000 1.10 @@ -5,7 +5,6 @@ file_url resource_item_id run_id - resource_id:optional owner_user_id:optional } @@ -23,7 +22,38 @@ }] } { imsld::grant_permissions -resources_activities_list $resource_id -user_id [ad_conn user_id] imsld::finish_resource -resource_id $resource_id -run_id $run_id +} else { + # mark the resource as finished just for monitoring purposes + db_1row context_info { + select imsld_id + from imsld_runs + where run_id = :run_id + } + set user_id [ad_conn user_id] + set resource_id [content::item::get_live_revision -item_id $resource_item_id] + db_dml insert_completed_resource { + insert into imsld_status_user ( + imsld_id, + run_id, + related_id, + user_id, + type, + status_date, + status + ) + ( + select :imsld_id, + :run_id, + :resource_id, + :user_id, + 'resource', + now(), + 'finished' + where not exists (select 1 from imsld_status_user where run_id = :run_id and user_id = :user_id and related_id = :resource_id and status = 'finished') + ) + } } + if { ![regexp {http://} $file_url] } { ad_returnredirect "[export_vars -base "$file_url" -url { file_url run_id resource_id resource_item_id owner_user_id }]" } Index: openacs-4/packages/imsld/www/imsld-sendmail-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-sendmail-2.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/imsld-sendmail-2.tcl 19 May 2006 17:26:02 -0000 1.2 +++ openacs-4/packages/imsld/www/imsld-sendmail-2.tcl 21 Dec 2006 15:20:47 -0000 1.3 @@ -9,13 +9,13 @@ set users_list [lindex $users_list 0] if {[string eq $recipients all-in-role]} { - #todos los miembros del role: calcula destinatarios, redirige y punto + #all the role members: get the receipients, redirects and that's it ad_returnredirect [export_vars -base ../spam {{recipients:multiple $users_list} {referer one-community-admin}}] ad_script_abort } else { - #se puede seleccionar los miembros. hay que hacer un template::list + #chosse among members the receiptients. use a template::list set page_title "Role members" set context {} set bulk_actions "{Compose mail} {../spam} {Send mail to selected members}" Index: openacs-4/packages/imsld/www/imsld-sendmail.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-sendmail.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/imsld-sendmail.adp 18 May 2006 11:13:01 -0000 1.1 +++ openacs-4/packages/imsld/www/imsld-sendmail.adp 21 Dec 2006 15:20:47 -0000 1.2 @@ -1,7 +1,7 @@ @page_title;noquote@ @context;noquote@ -

Select a role to send the email

+

#imsld.lt_Select_a_role_to_send#

+ Index: openacs-4/packages/imsld/www/imsld-tree.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.adp,v diff -u -r1.11 -r1.12 --- openacs-4/packages/imsld/www/imsld-tree.adp 24 Oct 2006 10:09:51 -0000 1.11 +++ openacs-4/packages/imsld/www/imsld-tree.adp 21 Dec 2006 15:20:47 -0000 1.12 @@ -25,14 +25,37 @@ padding: 0px; margin: 0px; } -div { +div.role_menu { text-align: right; font-size: 80%; + padding: 0px; + margin: 0px; + top: 0px; + right: 0px; } +a.button { + text-align: center; + border: 3px outset #00b; + background-color: #007; + color: #fff; + font-weight: bold; + font-size: 10px; + text-decoration: none; + padding: 0px; + margin: 0px; + top: 0px; + left: 0px; +} +a.button:hover { + color: #fff; + background-color: #00d; + border: 3px inset #00b; +} -
+#imsld.Exit# +
- + @@ -14,7 +14,7 @@