Index: openacs-4/packages/imsld/imsld.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/imsld.info,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/imsld.info 25 Apr 2007 10:52:29 -0000 1.10 +++ openacs-4/packages/imsld/imsld.info 17 Apr 2008 17:17:53 -0000 1.11 @@ -7,14 +7,14 @@ <initial-install-p>f</initial-install-p> <singleton-p>f</singleton-p> - <version name="1.1d" url="http://openacs.org/repository/download/apm/imsld-1.1d.apm"> + <version name="1.2d" url="http://openacs.org/repository/download/apm/imsld-1.2d.apm"> <owner url="mailto:jopez@galileo.edu">Jose Pablo Escobedo Del Cid</owner> <summary>IMS LD integration with dotLRN.</summary> - <release-date>2006-10-20</release-date> + <release-date>2007-06-25</release-date> <description format="text/html">This package is the implementation of IMS LD in dotLRN. The course admin can create a sequence of activities for the students, as well as decide who does what, when and using what resources.</description> <maturity>0</maturity> - <provides url="imsld" version="1.1d"/> + <provides url="imsld" version="1.2d"/> <requires url="acs-content-repository" version="5.2.2"/> <requires url="acs-kernel" version="5.2.2"/> <requires url="acs-templating" version="5.2.2"/> 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.36 -r1.37 --- openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 30 May 2007 08:36:21 -0000 1.36 +++ openacs-4/packages/imsld/catalog/imsld.en_US.ISO-8859-1.xml 17 Apr 2008 17:17:54 -0000 1.37 @@ -1,20 +1,23 @@ <?xml version="1.0" encoding="ISO-8859-1"?> -<message_catalog package_key="imsld" package_version="1.1d" locale="en_US" charset="ISO-8859-1"> +<message_catalog package_key="imsld" package_version="1.2d" locale="en_US" charset="ISO-8859-1"> - <msg key="1_Local_Properties">1. Local Properties</msg> - <msg key="5_Global_Properties">5. Global Properties</msg> <msg key="_Assigned_users">| Assigned users:</msg> <msg key="_Component">Component Identifier</msg> <msg key="_Creation_Date">| Creation Date:</msg> <msg key="_Status_The_run_is">| Status: The run is</msg> <msg key="Act_Identifier">Act Identifier</msg> <msg key="active">active</msg> + <msg key="Activities">Activities</msg> + <msg key="Activity">Activity</msg> <msg key="Activity_Identifier">Activity Identifier</msg> <msg key="Activity_Name">Activity Name</msg> + <msg key="Activity_report">Activity report</msg> <msg key="Activity_Structures">Activity Structures</msg> <msg key="Activity_Type">Activity Type</msg> <msg key="Acts_in_play_count">Acts in play %count%</msg> + <msg key="Add_Members">Add Members</msg> <msg key="Admin_IMS_LD">Admin IMS LD</msg> + <msg key="Admin_roles">Admin roles</msg> <msg key="Back">Back to admin</msg> <msg key="Calculateexpression">Calculate(expression)</msg> <msg key="Caluclate_Identifier">Caluclate Identifier</msg> @@ -30,9 +33,12 @@ <msg key="Confirm">Confirm</msg> <msg key="Confirm_New_IMS-LD">Confirm: New IMS-LD</msg> <msg key="Confirm_this_changes">Confirm these changes</msg> - <msg key="Context_info">Context info</msg> + <msg key="Context_info">Environment</msg> + <msg key="Create_a_new_group">Create a new group</msg> <msg key="Create_New">Create New?</msg> + <msg key="Create_new">Create new</msg> <msg key="create_new_run">create new run</msg> + <msg key="Create_role_instance">Create role instance</msg> <msg key="Creating_default_Run">Creating default Run...</msg> <msg key="Creating_new_IMS-LD">Creating new IMS-LD...</msg> <msg key="Creation_Date">Creation Date</msg> @@ -50,19 +56,26 @@ <msg key="Error_parsing_file">Error parsing file</msg> <msg key="Existing_href">Existing href</msg> <msg key="Exit">Exit UoL</msg> + <msg key="Exit_Monitor">Exit Monitor</msg> <msg key="Expression">Expression</msg> <msg key="Extra_Activities">Extra Activities</msg> <msg key="Feedbach_Title">Feedbach Title</msg> <msg key="Feedback">Feedback</msg> <msg key="File_name">File name</msg> + <msg key="finish">(finish)</msg> + <msg key="finish_activity">finish activity</msg> <msg key="Finish_Date">Finish Date</msg> <msg key="finished">finished</msg> <msg key="Finished_Date">Finished Date</msg> + <msg key="Global_Properties">Global Properties</msg> <msg key="Go_back">Go back</msg> <msg key="go_back">go back</msg> + <msg key="Go_to_UoL_page">Go to UoL page</msg> <msg key="Group_members">Group members</msg> + <msg key="Group_name">Group name</msg> <msg key="Groups">Groups in role</msg> <msg key="Hide">Hide</msg> + <msg key="Hide_1">panel</msg> <msg key="Href">Href</msg> <msg key="Identifier">Identifier</msg> <msg key="Identifier_Reference">Identifier Reference</msg> @@ -137,26 +150,30 @@ <msg key="li_activity_title_li"><li> %activity_title% </li></msg> <msg key="li_file_name_li"><li> %file_name% </li></msg> <msg key="li_impozzible_li"><li> impozzible </li></msg> - <msg key="lt_2_Local-personal_Prop">2. Local-personal Properties</msg> - <msg key="lt_3_Local-role_Properti">3. Local-role Properties</msg> - <msg key="lt_4_Global-personal_Pro">4. Global-personal Properties</msg> + <msg key="Local_Properties">Local Properties</msg> + <msg key="lt___imsldcreate_new_run">[_ imsld.create_new_run]</msg> <msg key="lt_Activity_Description_">Activity Description Identifier</msg> <msg key="lt_Activity_Structure_Id">Activity Structure Identifier</msg> + <msg key="lt_Add_selected_members_">Add selected members to the group</msg> <msg key="lt_Are_all_the_students_">Are all the students asigned to the proper roles? If you confirm now, no more changes will be acepted later.</msg> <msg key="lt_br___________________"><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.</msg> - <msg key="lt_br____________________1"><br>\ - Go to the UoL <a href=\"%imsld_url%\">$imsld_title</a> (in the <a href=\"%community_url%\">%community_name%</a> community) for further details.</msg> + <msg key="lt_br____________________1"><br> + Go to the Learning Unit <a href=\"%imsld_url%\">$imsld_title</a> (in the <a href=\"%community_url%\">%community_name%</a> community) for further details.</msg> <msg key="lt_br__Warnings_ul_warni"><br /> Warnings: <ul> %warnings% </ul></msg> <msg key="lt_Change_Property_Value">Change Property Value Identifier</msg> <msg key="lt_Change_Property_Value_1">Change Property Value XML</msg> <msg key="lt_community_name_imsld_">%community_name%: %imsld_title%</msg> <msg key="lt_Complete_Act_Identifi">Complete Act Identifier</msg> + <msg key="lt_Confirm_roles_assignm">Confirm roles assignments</msg> <msg key="lt_Could_not_determine_w">Could not determine whit what program uncompress the file %upload_file% has. Aborting</msg> <msg key="lt_Couldnt_determine_if_">Couldn't determine if this is a well formed IMS-LD: %message%</msg> <msg key="lt_Creaginting_new_IMS-L">Creaginting new IMS-LD</msg> - <msg key="lt_Dear_recepient_name_b">Dear %recepient_name% <br> - %sender_name has% triggered this notification. Please do not replay to this email. <br></msg> + <msg key="lt_Create_a_new_instance">Create a new instance of a role</msg> + <msg key="lt_Current_Unit_of_Learn">Current Unit of Learning does not allow creation of multiple instances of this role.</msg> + <msg key="lt_Current_UoL_does_not_">Current UoL does not allow to include them in more than one subroles of the role.</msg> + <msg key="lt_Dear_recepient_name_b">Dear %recepient_name%. <br> + %sender_name% has triggered this notification. Please do not replay to this email. <br></msg> <msg key="lt_Email_Propery_Identif">Email Propery Identifier</msg> <msg key="lt_Environment_Identifie">Environment Identifier</msg> <msg key="lt_Error_creating_folder">Error creating folder</msg> @@ -167,6 +184,7 @@ <msg key="lt_Expression_One_Identi">Expression One Identifier</msg> <msg key="lt_Expression_Two_Identi">Expression Two Identifer</msg> <msg key="lt_Finish_role_managemen">Finish role management</msg> + <msg key="lt_Global-personal_Pro">Global-personal Properties</msg> <msg key="lt_h2Uploading_new_IMS_L"><h2>Uploading new IMS Learning Design</h2></msg> <msg key="lt_If_you_are_not_sure_t">If you are not sure that everything is OK, please</msg> <msg key="lt_Import_IMS-LD_ZIP_Fil">Import IMS-LD ZIP File</msg> @@ -212,8 +230,11 @@ <msg key="lt_Learning_Objectives_I">Learning Objectives ID</msg> <msg key="lt_Learning_Unit_finishe">Learning Unit finished</msg> <msg key="lt_li_desc_no_file_assoc"><li> desc (no file associated) </li></msg> + <msg key="lt_Local-personal_Prop">Local-personal Properties</msg> + <msg key="lt_Local-role_Properti">Local-role Properties</msg> <msg key="lt_manifest_namespace_is">manifest namespace is not imscp</msg> <msg key="lt_Max_number_of_student">Max. number of students per group: %max_persons%</msg> + <msg key="lt_Members_not_allowed_n">Members $not_allowed_name are already members of other subroles of role $parent_role_name.</msg> <msg key="lt_Min_number_of_student">Min. number of students per group: %min_persons%</msg> <msg key="lt_Monitoring_One_Activi">Monitoring One Activity</msg> <msg key="lt_More_than_one_service">More than one service in environment %identifier%. Just one used (the first one)</msg> @@ -223,6 +244,10 @@ <msg key="lt_No_information_found_">No information found in the manifest file</msg> <msg key="lt_No_parent_folder_foun">No parent folder found</msg> <msg key="lt_No_parent_folder_foun_1">No parent folder found for the ims-ld in the community %community_id%. Please report this error to the administrator.</msg> + <msg key="lt_Number_of_members_doe">Number of members does not reach the minimum allowed number of users for this role. + There must be at least %min_persons% members.</msg> + <msg key="lt_Number_of_members_exc">Number of members exceded the allowed number for this role. + You must not select more than $max_persons members.</msg> <msg key="lt_Number_of_Organizatio">Number of Organizations:</msg> <msg key="lt_On_Completion_Identif">On Completion Identifier</msg> <msg key="lt_Organization_Identifi">Organization Identifier</msg> @@ -233,6 +258,7 @@ <msg key="lt_Parent_Role_Identifie">Parent Role Identifier</msg> <msg key="lt_Please_confirm_the_in">Please, confirm the information you are uploading</msg> <msg key="lt_Please_submit_a_value">Please submit a value</msg> + <msg key="lt_Please_wait_for_other">Please wait for other users...</msg> <msg key="lt_Property_String_Ident">Property String Identifier</msg> <msg key="lt_Referenced_activity_s">Referenced activity structure %ref% does not exist</msg> <msg key="lt_Referenced_activity_s_1">Referenced activity structure (%activity_structure_ref_ref%) in role part %identifier% does not exist.</msg> @@ -259,6 +285,7 @@ <msg key="lt_Referenced_support_ac_5">Referenced support activity %support_activity_ref_ref% in role part %identifier% is actually an activity structure.</msg> <msg key="lt_Referenced_support_ac_6">Referenced support activity %support_activity_ref% in role part %identifier% is actually a learning activity.</msg> <msg key="lt_Referenced_support_ac_7">Referenced support activity (%support_activity_ref%) from notification does not exist</msg> + <msg key="lt_Remove_selected_membe">Remove selected members from the group</msg> <msg key="lt_Select_a_role_to_send">Select a role to send the email</msg> <msg key="lt_Select_parent_for_the">Select parent for the new instance</msg> <msg key="lt_Select_role_to_suppor">Select role to support...</msg> @@ -269,6 +296,7 @@ <msg key="lt_Sorry_that_service_ty">Sorry, that service type (%service_type%) hasn't been implemented yet.</msg> <msg key="lt_Sorry_your_browser_do">Sorry, your browser doesn't support JavaScript (or it is disabled). This is needed to access the course.</msg> <msg key="lt_Support_Activity_Iden">Support Activity Identifier</msg> + <msg key="lt_The_course_has_been_f">The course has been finished</msg> <msg key="lt_The_decimal_digits_ca">The decimal digits can't be more than %restriction_value%</msg> <msg key="lt_The_file_filex_href_w">The file %filex_href% was not created, it wasn't found in the manifest</msg> <msg key="lt_The_integer_part_cant">The integer part can't have more than %restriction_value% digits</msg> @@ -320,13 +348,15 @@ <msg key="lt_Unestable_state_reach">Unestable state reached</msg> <msg key="lt_Unstable_state_reache">Unstable state reached when evaluating conditions (An infinite loop was detected). Please, contact the administrator and review the conditions of the UoL.</msg> <msg key="lt_Uploading_and_process">Uploading and processing your course, please wait...</msg> + <msg key="lt_User_does_not_belong_">User does not belong to any role instance</msg> <msg key="lt_username_br__________">%username% <br> %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.</msg> <msg key="lt_Username_Property_Ide">Username Property Identifier</msg> - <msg key="lt_Users_who_have_bat_le">Users who have <b>at least visited</b> the service</msg> - <msg key="lt_Users_who_have_bviewe">Users who have <b>viewed/visited all</b> the referenced resources from the environment</msg> - <msg key="lt_Users_who_have_starte">Users who have started and/or finished this activity</msg> + <msg key="lt_Users_individual_repo">User's individual report</msg> + <msg key="lt_Users_who_have_bat_le">Users who have at least visited the service</msg> + <msg key="lt_Users_who_have_bviewe">Users who have viewed or visited all resources in the learning object</msg> + <msg key="lt_Users_who_have_starte">Users who have started and/or finished activity</msg> <msg key="lt_Valid_types_are_learn">Valid types are learning, support and structure</msg> <msg key="lt_Warning_More_than_one">More than one learning object in environment %identifier%. Just one used (the first one)</msg> <msg key="lt_We_will_continue_auto">We will continue automatically when processing is complete.</msg> @@ -350,12 +380,16 @@ <msg key="Monitor_properties">Monitor properties</msg> <msg key="Monitoring">User</msg> <msg key="Name">Name</msg> + <msg key="navigate">navigate through the content using the links above</msg> <msg key="nbspnbspnbspdone">&nbsp;&nbsp;&nbsp;done</msg> <msg key="New_IMS-LD">New IMS-LD</msg> <msg key="No">information found in the imsmanifest.xml file. Nothing to do.</msg> + <msg key="No_group_selected">No group selected</msg> <msg key="No_IMS_LD">No IMS LD</msg> <msg key="No_info_was_found">No info was found</msg> <msg key="No_properties_found">No properties found.</msg> + <msg key="No_user_selected">No user selected.</msg> + <msg key="No_users">No users</msg> <msg key="None">None</msg> <msg key="None_please_select">None, please select</msg> <msg key="Not_defined">Not defined</msg> @@ -369,6 +403,7 @@ <msg key="Parameter_Identifier">Parameter Identifier</msg> <msg key="Parameters">Parameters</msg> <msg key="Parent">Parent role:</msg> + <msg key="Parent_1">role info</msg> <msg key="Party_Identifier">Party Identifier</msg> <msg key="Path_to_File">Path to File</msg> <msg key="Play_Identifier">Play Identifier</msg> @@ -384,6 +419,7 @@ <msg key="Recipients">Recipients</msg> <msg key="Reference_Identifier">Reference Identifier</msg> <msg key="Reference_Type">Reference Type</msg> + <msg key="Remove_Members">Remove Members</msg> <msg key="Resource_Identifier">Resource Identifier</msg> <msg key="Restriction_Type">Restriction Type</msg> <msg key="Role_Identifier">Role Identifier</msg> @@ -394,17 +430,20 @@ <msg key="Runinfo_Name">Run(UoL) Name:</msg> <msg key="Runs">Runs (IMS-LD instances)</msg> <msg key="Select">select user...</msg> + <msg key="Select_a_group">Select a group...</msg> <msg key="Select_a_role">Select a role...</msg> <msg key="Select_a_role_1">Select a role</msg> <msg key="Select_role">Select role...</msg> <msg key="Self">Self</msg> + <msg key="Send">mail</msg> <msg key="send-mail_service">send-mail service</msg> <msg key="sendmail">sendmail</msg> <msg key="Sendmail_Identifier">Sendmail Identifier</msg> <msg key="Sequence_Used">Sequence Used</msg> <msg key="Service_Identifier">Service Identifier</msg> <msg key="Service_Type">Service Type</msg> <msg key="Show">Show</msg> + <msg key="Show_1">panel</msg> <msg key="since">since</msg> <msg key="Sort">Sort</msg> <msg key="Sort_Order">Sort Order</msg> @@ -414,12 +453,13 @@ <msg key="Status">Status</msg> <msg key="stopped">stopped</msg> <msg key="Structure_Type">Structure Type</msg> + <msg key="Subrole">info</msg> <msg key="Support_Activities">Support Activities</msg> <msg key="Supporting">user: %supported_user_name%</msg> <msg key="The">The selected role has no parent</msg> <msg key="Then_Identifier">Then Identifier</msg> <msg key="There">There are no descendant roles</msg> - <msg key="This">is the list of activities started (and finished) by %member_name%</msg> + <msg key="This">Activity report for user </msg> <msg key="Time_in_Seconds">Time in Seconds</msg> <msg key="Total_Activities">Total Activities</msg> <msg key="Total_Roles">Parent Roles</msg> @@ -431,11 +471,17 @@ <msg key="units-of-learning_Administration">Units of Learning Administration</msg> <msg key="Uploading_IMS_LD">Uploading IMS LD</msg> <msg key="URI">URI</msg> + <msg key="user">user</msg> + <msg key="User_activity_reports">User activity reports</msg> <msg key="User_Choice">User Choice?</msg> + <msg key="Users">Users</msg> + <msg key="users">users</msg> <msg key="Value">Value</msg> <msg key="Version">Version</msg> <msg key="view_file">view file</msg> <msg key="View_members">View members</msg> + <msg key="View_Roles">View Roles</msg> + <msg key="Viewed">Viewed</msg> <msg key="waiting">waiting</msg> <msg key="When_Condition_True">When Condition True</msg> <msg key="With_Control">With Control</msg> Index: openacs-4/packages/imsld/catalog/imsld.es_ES.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/catalog/imsld.es_ES.ISO-8859-1.xml,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/catalog/imsld.es_ES.ISO-8859-1.xml 6 Apr 2006 14:25:02 -0000 1.2 +++ openacs-4/packages/imsld/catalog/imsld.es_ES.ISO-8859-1.xml 17 Apr 2008 17:17:54 -0000 1.3 @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <message_catalog package_key="imsld" package_version="0.1d" locale="es_ES" charset="ISO-8859-1"> - <msg key="Context_info">Informaci�n de Contexto</msg> + <msg key="Context_info">Entorno</msg> <msg key="Material">Material</msg> <msg key="units-of-learning">Unidades de Aprendizaje</msg> - <msg key="units-of-learning_Administration">Administraci�n de Unidades de Aprendizaje</msg> + <msg key="units-of-learning_Administration">Administración de Unidades de Aprendizaje</msg> </message_catalog> 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.14 -r1.15 --- openacs-4/packages/imsld/lib/imsld-chunk.tcl 30 May 2007 08:36:22 -0000 1.14 +++ openacs-4/packages/imsld/lib/imsld-chunk.tcl 17 Apr 2008 17:17:54 -0000 1.15 @@ -6,7 +6,7 @@ [list label "[_ imsld.IMS_LD_Name]" \ orderby_asc {imsld_title asc} \ orderby_desc {imsld_title desc} \ - display_template {<a href="@imsld_runs.imsld_url;noquote@imsld-frameset?run_id=@imsld_runs.run_id@">@imsld_runs.imsld_title@</a>}] \ + display_template {<a href="@imsld_runs.imsld_url;noquote@imsld-frameset?run_id=@imsld_runs.run_id@" title="[_ imsld.Go_to_UoL_page]">@imsld_runs.imsld_title@</a>}] \ user_roles \ [list label "[_ imsld.Roles_in_Run]" \ display_template {@imsld_runs.user_roles;noquote@}] \ 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.3 -r1.4 --- openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql 23 Jan 2007 11:33:48 -0000 1.3 +++ openacs-4/packages/imsld/sql/postgresql/imsld-level-c-create.sql 17 Apr 2008 17:17:54 -0000 1.4 @@ -18,8 +18,7 @@ not null, activity_id integer constraint imsld_notif_act_fk - references cr_items --imsld_learning_activities/imsld_support_activities - not null, + references cr_items, --imsld_learning_activities/imsld_support_activities subject text ); 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.24 -r1.25 --- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 25 Apr 2007 10:52:30 -0000 1.24 +++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 17 Apr 2008 17:18:16 -0000 1.25 @@ -260,7 +260,7 @@ 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 + # mark the learning activity 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 { @@ -302,8 +302,8 @@ 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] + # mark the support activity completed for all the users in the run + set role_part_id_list [imsld::get_role_part_from_activity -activity_type support -leaf_id $activity_item_id] set users_in_run [db_list get_users_in_run { select gmm.member_id @@ -331,7 +331,7 @@ -act_id $act_id \ -role_part_id $role_part_id \ -element_id $activity_id \ - -type learning \ + -type support \ -code_call } } @@ -356,6 +356,7 @@ 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 \ @@ -373,7 +374,7 @@ 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 + # mark the play 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, Index: openacs-4/packages/imsld/tcl/imsld-cr-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-cr-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/tcl/imsld-cr-procs.xql 1 Feb 2006 11:34:48 -0000 1.1 +++ openacs-4/packages/imsld/tcl/imsld-cr-procs.xql 17 Apr 2008 17:18:16 -0000 1.2 @@ -1,14 +1,12 @@ <?xml version="1.0"?> <queryset> - - - <fullquery name="imsld::cr::file_new.file_exists"> - <querytext> - select 1 - from imsld_cp_files icf, cr_items cri - where cri.item_id = :item_id - and cri.live_revision = icf.imsld_file_id - </querytext> - </fullquery> + <fullquery name="imsld::cr::file_new.file_exists"> + <querytext> + select 1 + from imsld_cp_files icf, cr_items cri + where cri.item_id = :item_id + and cri.live_revision = icf.imsld_file_id + </querytext> + </fullquery> </queryset> Index: openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 25 Apr 2007 10:52:30 -0000 1.6 +++ openacs-4/packages/imsld/tcl/imsld-fs-procs.tcl 17 Apr 2008 17:18:16 -0000 1.7 @@ -26,9 +26,14 @@ -edit:boolean -complete_path } { - Creates a file (file or directory) in the fs. If the type is file, the file is created with its attributes, which are: href, file_name, path_to_file and parent_id. + Creates a file (file or directory) in the fs. If the type is file, the file + is created with its attributes, which are: href, file_name, path_to_file + and parent_id. - All the parent dirs (lindex 0) of the corresponding file (path_to_file) that are found in the files_struct_list are created too (if they haven't been created yet). The file structure is the one created with the imsld::parse::get_files_structure proc. + All the parent dirs (lindex 0) of the corresponding file (path_to_file) + that are found in the files_struct_list are created too (if they haven't + been created yet). The file structure is the one created with the + imsld::parse::get_files_structure proc. Returns the file_id of the created file. @@ -186,15 +191,17 @@ -revision_id {-string ""} } { - Create an empty file and stores in the given revision id. - this is helpful for the property of type file (for instance), because when the properties are instantiated, there is no - file associated to them and the fs shows an error message. + Create an empty file and stores in the given revision id. This is helpful + for the property of type file (for instance), because when the properties + are instantiated, there is no file associated to them and the fs shows an + error message. @param revision_id @param string Optional string that will be written into the file } { - set string [expr { [string eq "" $string] ? "[_ imsld.Empty_property_value]" : "$string" }] + set string [expr { [string eq "" $string] ? \ + "[_ imsld.Empty_property_value]" : "$string" }] set tmpfile [ns_mktemp "/tmp/imsld_emtpyXXXXXX"] set file [open $tmpfile a] puts $file "$string" @@ -203,14 +210,21 @@ set mime_type "text/plain" # database_p according to the file storage parameter - set fs_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ - -package_key "file-storage"] - set database_p [parameter::get -parameter "StoreFilesInDatabaseP" -package_id $fs_package_id] + set fs_package_id \ + [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id \ + [dotlrn_community::get_community_id]] \ + -package_key "file-storage"] + set database_p [parameter::get \ + -parameter "StoreFilesInDatabaseP" \ + -package_id $fs_package_id] set content_length [file size $tmpfile] if { !$database_p } { # create the new item - set filename [cr_create_content_file [content::revision::item_id -revision_id $revision_id] $revision_id $tmpfile] + set filename [cr_create_content_file \ + [content::revision::item_id \ + -revision_id $revision_id] \ + $revision_id $tmpfile] db_dml set_file_content { update cr_revisions set content = :filename, @@ -220,16 +234,84 @@ } } else { # create the new item - db_dml lob_content " - update cr_revisions - set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] - where revision_id = :revision_id" -blob_files [list $tmpfile] + db_dml lob_content \ + "update cr_revisions + set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] + where revision_id = :revision_id" -blob_files [list $tmpfile] - # Unfortunately, we can only calculate the file size after the lob is uploaded + # Unfortunately, we can only calculate the file size after the lob is + # uploaded db_dml lob_size { update cr_revisions set content_length = :content_length where revision_id = :revision_id } } -} +} + +ad_proc -public imsld::fs::traverse_zip { + -dir:required + -pattern:required +} { + Function to recursively traverse the files in a ZIP to then detect those + that are not reerenced in a resource, but still need to be in the file + storate. +} { + upvar files_struct_list files_struct_list + # Iterate over all the files in the given directory + foreach fname [glob -nocomplain -tail -types f -directory $dir $pattern] { + # See if the file was already created + if { [imsld::fs::find_file_not_created \ + -file_name $fname \ + -file_list $files_struct_list \ + -path_prefix $dir] } { + # Create the new file + imsld::fs::file_new \ + -path_to_file $fname \ + -type file \ + -complete_path "[ns_urldecode ${dir}/${fname}]" + } + } + + # Recur over the directories + foreach subd [glob -tail -nocomplain -types d -directory $dir $pattern] { + imsld::fs::traverse_zip -dir $dir -pattern "$subd/*" + } +} + +ad_proc -public imsld::fs::find_file_not_created { + -file_name:required + -file_list:required + -path_prefix:required +} { + Procedure to search for a given file name in the given file list. This list + is assumed to have the structure derived from the parsing. It returns a + boolean encoding if the given file_name is in the list with an object_id + equal to zero. The files are supposed to be in the list with the given + path_prefix. + + @param file_name File to search for + @param file_list List of files contained in a UoL + @param path_prefix Prefix present in all the files +} { + while { [llength $file_list] > 0 } { + set dirx [lindex $file_list 0] + foreach content [lindex $dirx 1] { + if { [lsearch -exact [string tolower $content] \ + [string tolower "$path_prefix/$file_name"]] >=0 && \ + [lindex $content 1] eq "file" } { + # If the object_id is zero, the file was found + if { [lindex $content 2] == 0 } { + return 1 + } else { + # In this case, the file is already in the fs + return 0 + } + } + } + # Advance the processing + set file_list [lrange $file_list 1 [ expr [llength $file_list] -1]] + } + return 0 +} + 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.13 -r1.14 --- openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 25 Apr 2007 10:52:30 -0000 1.13 +++ openacs-4/packages/imsld/tcl/imsld-instance-procs.tcl 17 Apr 2008 17:18:16 -0000 1.14 @@ -16,26 +16,42 @@ {-community_id ""} } { @param imsld_id the imsld_id to instantiate - @option community_id the community to which the imsld will be instantiated into + @option community_id the community to which the imsld will be instantiated + into @return the run_id created Instantiates an imsld, i.e. creates the run. - If community_id is given, the run is created for that community (the users associated to the run are the users of the community) + If community_id is given, the run is created for that community (the users + associated to the run are the users of the community) } { # 1. create the run (status = 'waiting') - set run_id [package_exec_plsql -var_list [list [list run_id ""] [list imsld_id $imsld_id] [list status "waiting"]] imsld_run new] + set run_id [package_exec_plsql -var_list [list [list run_id ""] \ + [list imsld_id $imsld_id] \ + [list status "waiting"]] \ + imsld_run new] # 2. create the run group - set group_run_id [package_instantiate_object -creation_user [ad_conn user_id] -creation_ip [ad_conn peeraddr] -package_name imsld_run_users_group -start_with "group" -var_list [list [list group_id ""] [list group_name "IMS-LD Run Group ($run_id)"] [list run_id $run_id]] imsld_run_users_group] + set group_run_id \ + [package_instantiate_object \ + -creation_user [ad_conn user_id] \ + -creation_ip [ad_conn peeraddr] \ + -package_name imsld_run_users_group \ + -start_with "group" \ + -var_list [list [list group_id ""] \ + [list group_name "IMS-LD Run Group ($run_id)"] \ + [list run_id $run_id]]\ + imsld_run_users_group] - # 3. if community_id is not empty, assign the community users to the run - if { ![string eq $community_id ""] } { - foreach user [dotlrn_community::list_users $community_id] { - set user_id [ns_set get $user user_id] - relation_add imsld_run_users_group_rel $group_run_id $user_id - } - } +# jopez: commented out so the users assigned to the run are the ones that the +# user actually assigns to the run... +# # 3. if community_id is not empty, assign the community users to the run +# if { ![string eq $community_id ""] } { +# foreach user [dotlrn_community::list_users $community_id] { +# set user_id [ns_set get $user user_id] +# relation_add imsld_run_users_group_rel $group_run_id $user_id +# } +# } imsld::instance::instantiate_activity_attributes -run_id $run_id return $run_id } @@ -44,7 +60,9 @@ -run_id:required {-community_id ""} } { - set community_id [expr { [empty_string_p $community_id] ? [dotlrn_community::get_community_id] : $community_id }] + set community_id [expr { [empty_string_p $community_id] ? \ + [dotlrn_community::get_community_id] : \ + $community_id }] db_1row get_context_inf { select org.manifest_id @@ -56,51 +74,71 @@ and iis.organization_id = org.item_id } # Gets file-storage root folder_id - set fs_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id $community_id] \ - -package_key "file-storage"] + set fs_package_id \ + [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id $community_id] \ + -package_key "file-storage"] set fs_root_folder_id [fs::get_root_folder -package_id $fs_package_id] - set fs_folder_id [content::item::get_id -item_path "manifest_${manifest_id}" -root_folder_id $fs_root_folder_id -resolve_index f] - set run_folder_id [content::item::get_id -item_path "run_${run_id}" -root_folder_id $fs_root_folder_id -resolve_index f] + set fs_folder_id [content::item::get_id \ + -item_path "manifest_${manifest_id}" \ + -root_folder_id $fs_root_folder_id \ + -resolve_index f] + set run_folder_id [content::item::get_id \ + -item_path "run_${run_id}" \ + -root_folder_id $fs_root_folder_id \ + -resolve_index f] if { [empty_string_p $run_folder_id] } { db_transaction { set folder_name "run_${run_id}" # checks for write permission on the parent folder if { ![empty_string_p $fs_root_folder_id] } { - ad_require_permission $fs_root_folder_id write + permission::require_permission \ + -object_id $fs_root_folder_id \ + -privilege write } # create the root cr dir + set run_folder_id [imsld::cr::folder_new \ + -parent_id $fs_folder_id \ + -folder_name $folder_name \ + -folder_label "Run-${run_id}-Folder"] - set run_folder_id [imsld::cr::folder_new -parent_id $fs_folder_id -folder_name $folder_name -folder_label "Run-${run_id}-Folder"] - # PERMISSIONS FOR FILE-STORAGE # Before we go about anything else, lets just set permissions straight. # Disable folder permissions inheritance permission::toggle_inherit -object_id $run_folder_id # Set read permissions for community/class dotlrn_member_rel - set party_id_member [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_member_rel] - permission::grant -party_id $party_id_member -object_id $run_folder_id -privilege read + set party_id_member [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type dotlrn_member_rel] + permission::grant -party_id $party_id_member \ + -object_id $run_folder_id -privilege read # Set read permissions for community/class dotlrn_admin_rel - set party_id_admin [dotlrn_community::get_rel_segment_id -community_id $community_id -rel_type dotlrn_admin_rel] - permission::grant -party_id $party_id_admin -object_id $run_folder_id -privilege read + set party_id_admin [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type dotlrn_admin_rel] + permission::grant -party_id $party_id_admin \ + -object_id $run_folder_id -privilege read # Set read permissions for *all* other professors within .LRN # (so they can see the content) - set party_id_professor [dotlrn::user::type::get_segment_id -type professor] - permission::grant -party_id $party_id_professor -object_id $run_folder_id -privilege read + set party_id_professor [dotlrn::user::type::get_segment_id \ + -type professor] + permission::grant -party_id $party_id_professor \ + -object_id $run_folder_id -privilege read # Set read permissions for *all* other admins within .LRN # (so they can see the content) set party_id_admins [dotlrn::user::type::get_segment_id -type admin] - permission::grant -party_id $party_id_admins -object_id $run_folder_id -privilege read + permission::grant -party_id $party_id_admins \ + -object_id $run_folder_id -privilege read } # register content types content::folder::register_content_type -folder_id $run_folder_id \ @@ -123,17 +161,23 @@ # There are 5 property types # 1. loc-proerty: same value for every user in the run # 2. locpers-property: different value for every user in the run - # 3. locrole-property: same value for every user in the same rol during the run - # 4. globpers-property: different value for every user (run and ims-ld independent) - # 5. glob-property: one value independent from the run, ims-ld, user or role + # 3. locrole-property: same value for every user in the same rol during the + # run + # 4. globpers-property: different value for every user (run and ims-ld + # independent) + # 5. glob-property: one value independent from the run, ims-ld, user or + # role db_1row context_info { select ic.item_id as component_item_id, ii.imsld_id, ii.item_id as imsld_item_id, rug.group_id as run_group_id, org.manifest_id - from imsld_componentsi ic, imsld_imsldsi ii, imsld_runs ir, imsld_run_users_group_ext rug, + from imsld_componentsi ic, + imsld_imsldsi ii, + imsld_runs ir, + imsld_run_users_group_ext rug, imsld_cp_organizationsi org where ic.imsld_id = ii.item_id and content_revision__is_live(ii.imsld_id) = 't' @@ -143,104 +187,143 @@ and ii.organization_id = org.item_id } - # before we can continue we create the folder where the properties of type file will be stored + # before we can continue we create the folder where the properties of type + # file will be stored set run_folder_id [imsld::instance::create_run_folder -run_id $run_id] - set cr_root_folder_id [imsld::cr::get_root_folder -community_id [dotlrn_community::get_community_id]] - set cr_folder_id [content::item::get_id -item_path "cr_manifest_${manifest_id}" -root_folder_id $cr_root_folder_id -resolve_index f] + set cr_root_folder_id \ + [imsld::cr::get_root_folder \ + -community_id [dotlrn_community::get_community_id]] + set cr_folder_id [content::item::get_id \ + -item_path "cr_manifest_${manifest_id}" \ + -root_folder_id $cr_root_folder_id -resolve_index f] set global_folder_id [imsld::global_folder_id] - # 1. loc-property: We create only one entry in the imsld_property_instances table for each property of this type + # 1. loc-property: We create only one entry in the imsld_property_instances + # table for each property of this type db_foreach loc_property { select property_id, identifier, datatype, initial_value, title, - item_id as property_item_id + coalesce(title,identifier) as item_name from imsld_propertiesi where component_id = :component_item_id and type = 'loc' + and content_revision__is_live(property_id) = 't' } { if { ![db_0or1row loc_already_instantiated_p { select 1 - from imsld_property_instancesi + from imsld_property_instances where property_id = :property_id and identifier = :identifier and run_id = :run_id + and content_revision__is_live(instance_id) = 't' }] } { - set instance_id [imsld::item_revision_new -attributes [list [list run_id $run_id] \ - [list value $initial_value] \ - [list identifier $identifier] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -title $identifier \ - -parent_id [expr [string eq $datatype "file"] ? $run_folder_id : $cr_folder_id]] + set instance_id \ + [imsld::item_revision_new \ + -attributes [list [list run_id $run_id] \ + [list value $initial_value] \ + [list identifier $identifier] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -name $item_name \ + -title $title \ + -parent_id [expr [string eq $datatype "file"] ? \ + $run_folder_id : $cr_folder_id]] if { [string eq $datatype "file"] } { - # initialize the file to an empty one so the fs doesn't generate an error when requesting the file - imsld::fs::empty_file -revision_id [content::item::get_live_revision -item_id $instance_id] + # initialize the file to an empty one so the fs doesn't + # generate an error when requesting the file + imsld::fs::empty_file \ + -revision_id [content::item::get_live_revision \ + -item_id $instance_id] } } } - # 2. locpers-property: Instantiate the property for each user assigned to the run + # 2. locpers-property: Instantiate the property for each user assigned to + # the run foreach property_list [db_list_of_lists locpers_property { select property_id, identifier, datatype, initial_value, title, - item_id as property_item_id + coalesce(title,identifier) from imsld_propertiesi where component_id = :component_item_id and type = 'locpers' + and content_revision__is_live(property_id) = 't' }] { set property_id [lindex $property_list 0] set identifier [lindex $property_list 1] set datatype [lindex $property_list 2] set initial_value [lindex $property_list 3] - set property_item_id [lindex $property_list 4] + set title [lindex $property_list 4] + set item_name [lindex $property_list 5] db_foreach user_in_run { select ar.object_id_two as party_id from acs_rels ar where ar.object_id_one = :run_group_id and ar.rel_type = 'imsld_run_users_group_rel' - } { + } { if { ![db_0or1row locrole_already_instantiated_p { select 1 - from imsld_property_instancesi + from imsld_property_instances where property_id = :property_id and identifier = :identifier and party_id = :party_id and run_id = :run_id + and content_revision__is_live(instance_id) = 't' }] } { - set instance_id [imsld::item_revision_new -attributes [list [list run_id $run_id] \ - [list value $initial_value] \ - [list identifier $identifier] \ - [list party_id $party_id] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -title $identifier \ - -parent_id [expr [string eq $datatype "file"] ? $run_folder_id : $cr_folder_id]] + # Create a folder for each user in the run if needed. + set user_folder_id \ + [content::item::get_id \ + -item_path \ + [imsld::instance::user_folder_name -user_id $party_id] \ + -root_folder_id $run_folder_id] + if { $user_folder_id eq "" } { + set user_folder_id [imsld::instance::create_user_folder \ + -user_id $party_id \ + -parent_folder_id $run_folder_id] + } + set instance_id \ + [imsld::item_revision_new \ + -attributes [list [list run_id $run_id] \ + [list value $initial_value] \ + [list identifier $identifier] \ + [list party_id $party_id] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -name $item_name \ + -title $title \ + -parent_id [expr [string eq $datatype "file"] ? \ + $user_folder_id : $cr_folder_id]] if { [string eq $datatype "file"] } { - # initialize the file to an empty one so the fs doesn't generate an error when requesting the file - imsld::fs::empty_file -revision_id [content::item::get_live_revision -item_id $instance_id] + # initialize the file to an empty one so the fs doesn't + # generate an error when requesting the file + imsld::fs::empty_file \ + -revision_id [content::item::get_live_revision \ + -item_id $instance_id] } } } } - # 3. locrole-property: Instantiate the property for each role associated to the run + # 3. locrole-property: Instantiate the property for each role associated to + # the run db_foreach locrole_property { select property_id, identifier, datatype, initial_value, title, - item_id as property_item_id + coalesce(title,identifier) as item_name from imsld_propertiesi where component_id = :component_item_id and type = 'locrole' + and content_revision__is_live(property_id) = 't' } { db_foreach roles_instances_in_run { select ar1.object_id_two as party_id @@ -255,34 +338,44 @@ } { if { ![db_0or1row locrole_already_instantiated_p { select 1 - from imsld_property_instancesi + from imsld_property_instances where property_id = :property_id and identifier = :identifier and party_id = :party_id and run_id = :run_id + and content_revision__is_live(instance_id) = 't' }] } { - set instance_id [imsld::item_revision_new -attributes [list [list run_id $run_id] \ - [list value $initial_value] \ - [list identifier $identifier] \ - [list party_id $party_id] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -title $identifier \ - -parent_id [expr [string eq $datatype "file"] ? $run_folder_id : $cr_folder_id]] + set instance_id \ + [imsld::item_revision_new \ + -attributes [list [list run_id $run_id] \ + [list value $initial_value] \ + [list identifier $identifier] \ + [list party_id $party_id] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -name $item_name \ + -title $title \ + -parent_id [expr [string eq $datatype "file"] ? \ + $run_folder_id : $cr_folder_id]] if { [string eq $datatype "file"] } { - # initialize the file to an empty one so the fs doesn't generate an error when requesting the file - imsld::fs::empty_file -revision_id [content::item::get_live_revision -item_id $instance_id] + # initialize the file to an empty one so the fs doesn't + # generate an error when requesting the file + imsld::fs::empty_file \ + -revision_id [content::item::get_live_revision \ + -item_id $instance_id] } } } } - # 4. globpers-property: Special case. The table imsld_property_instances must hold only one entrance for these properties. - # Besides, if existng href exists, the value of the property is taken from the URI. Otherwise, if - # global definition is not empty, then the property is defined. - # The global definition is stored in the same row of the property_id, so the initial_value of - # the global_definition is in fact the initial_value of the property + # 4. globpers-property: Special case. The table imsld_property_instances + # must hold only one entrance for these properties. + # Besides, if existng href exists, the value of the property is taken from + # the URI. Otherwise, if global definition is not empty, then the property + # is defined. The global definition is stored in the same row of the + # property_id, so the initial_value of the global_definition is in fact the + # initial_value of the property foreach property_list [db_list_of_lists globpers_property { select property_id, identifier, @@ -291,18 +384,20 @@ existing_href, uri, title, - item_id as property_item_id + coalesce(title,identifier) from imsld_propertiesi where component_id = :component_item_id and type = 'globpers' + and content_revision__is_live(property_id) = 't' }] { set property_id [lindex $property_list 0] set identifier [lindex $property_list 1] set datatype [lindex $property_list 2] set initial_value [lindex $property_list 3] set existing_href [lindex $property_list 4] set uri [lindex $property_list 5] - set property_item_id [lindex $property_list 6] + set title [lindex $property_list 6] + set item_name [lindex $property_list 7] db_foreach user_in_run { select ar.object_id_two as party_id from acs_rels ar @@ -314,32 +409,55 @@ from imsld_property_instances where identifier = :identifier and party_id = :party_id + and content_revision__is_live(instance_id) = 't' }] } { - # not instantiated... is it already defined (existing href)? or must we use the one of the global definition? + # not instantiated... is it already defined (existing href)? or + # must we use the one of the global definition? if { ![string eq $existing_href ""] } { # it is already defined # NOTE: there must be a better way to deal with this, # but by the moment we treat the href as the property value set initial_value $existing_href } - # TODO: the property must be somehow instantiated in the given URI also - set instance_id [imsld::item_revision_new -attributes [list [list value $initial_value] \ - [list identifier $identifier] \ - [list party_id $party_id] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -title $identifier \ - -parent_id [expr [string eq $datatype "file"] ? $global_folder_id : $cr_folder_id]] + + # Create a folder for each user in the run if needed. + set user_folder_id \ + [content::item::get_id \ + -item_path \ + [imsld::instance::user_folder_name -user_id $party_id] \ + -root_folder_id $global_folder_id] + if { $user_folder_id eq "" } { + set user_folder_id [imsld::instance::create_user_folder \ + -user_id $party_id \ + -parent_folder_id $global_folder_id] + } + + # TODO: the property must be somehow instantiated in the given + # URI also + set instance_id \ + [imsld::item_revision_new \ + -attributes [list [list value $initial_value] \ + [list identifier $identifier] \ + [list party_id $party_id] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -name $item_name \ + -title $title \ + -parent_id [expr [string eq $datatype "file"] ? \ + $user_folder_id : $cr_folder_id]] if { [string eq $datatype "file"] } { - # initialize the file to an empty one so the fs doesn't generate an error when requesting the file - imsld::fs::empty_file -revision_id [content::item::get_live_revision -item_id $instance_id] + # initialize the file to an empty one so the fs doesn't + # generate an error when requesting the file + imsld::fs::empty_file \ + -revision_id [content::item::get_live_revision \ + -item_id $instance_id] } } } } - # 5. glob-property: Special case, just like the one above but with the difference that the checking - # is not done for all the users + # 5. glob-property: Special case, just like the one above but with the + # difference that the checking is not done for all the users db_foreach global_property { select property_id, identifier, @@ -348,31 +466,44 @@ existing_href, uri, title, - item_id as property_item_id + coalesce(title,identifier) as item_name from imsld_propertiesi where component_id = :component_item_id and type = 'global' + and content_revision__is_live(property_id) = 't' } { if { ![db_0or1row global_already_instantiated_p { select 1 from imsld_property_instances where identifier = :identifier + and content_revision__is_live(instance_id) = 't' }] } { - # not instantiated... is it already defined (existing href)? or must we use the one of the global definition? + # not instantiated... is it already defined (existing href)? or + # must we use the one of the global definition? if { ![string eq $existing_href ""] } { # it is already defined - # NOTE: there must be a better way to deal with this, but by the moment we treat the href as the property value + # NOTE: there must be a better way to deal with this, but by + # the moment we treat the href as the property value set initial_value $existing_href } - # TODO: the property must be somehow instantiated in the given URI also - set instance_id [imsld::item_revision_new -attributes [list [list value $initial_value] \ - [list identifier $identifier] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -parent_id [expr [string eq $datatype "file"] ? $global_folder_id : $cr_folder_id]] + # TODO: the property must be somehow instantiated in the given URI + # also + set instance_id \ + [imsld::item_revision_new \ + -attributes [list [list value $initial_value] \ + [list identifier $identifier] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -name $item_name \ + -title $title \ + -parent_id [expr [string eq $datatype "file"] ? \ + $global_folder_id : $cr_folder_id]] if { [string eq $datatype "file"] } { - # initialize the file to an empty one so the fs doesn't generate an error when requesting the file - imsld::fs::empty_file -revision_id [content::item::get_live_revision -item_id $instance_id] + # initialize the file to an empty one so the fs doesn't + # generate an error when requesting the file + imsld::fs::empty_file \ + -revision_id [content::item::get_live_revision \ + -item_id $instance_id] } } } @@ -385,16 +516,22 @@ } { @param run_id The run_id we are instantiating - There are some attributes (like isvisible or the class global attributes) which are not properties but - have to be instantiated because the context of those attributes is the context of the run. So anytime a run - is created, those attributes must be initialized according to the values parsed from the manifest, and not - from the possible changed values of a previous run. + There are some attributes (like isvisible or the class global attributes) + which are not properties but have to be instantiated because the context of + those attributes is the context of the run. So anytime a run is created, + those attributes must be initialized according to the values parsed from + the manifest, and not from the possible changed values of a previous run. } { - set involved_roles [imsld::roles::get_list_of_roles -imsld_id [db_string get_imsld_from_run {select imsld_id from imsld_runs where run_id=:run_id}] ] + set involved_roles \ + [imsld::roles::get_list_of_roles \ + -imsld_id [db_string get_imsld_from_run \ + {select imsld_id from imsld_runs where run_id=:run_id}] ] set involved_users [list] foreach role $involved_roles { - set involved_users [concat $involved_users [imsld::roles::get_users_in_role -role_id [lindex $role 0] -run_id $run_id]] + set involved_users [concat $involved_users \ + [imsld::roles::get_users_in_role \ + -role_id [lindex $role 0] -run_id $run_id]] } foreach user_id [lsort -unique $involved_users] { @@ -406,16 +543,20 @@ ii.prerequisite_id as imsld_prerequisite_id, ii.item_id as run_imsld_item_id, rug.group_id as run_group_id - from imsld_componentsi ic, imsld_imsldsi ii, imsld_runs ir, imsld_run_users_group_ext rug + 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 } - # 1. items --> learning objectives, prerequisites, roles, - # learning objects, activity description, information(activity structures) + # 1. items --> learning objectives, prerequisites, roles, learning + # objects, activity description, information(activity structures), # + # feedback # 1.1 learning objectives items set linear_item_list [db_list item_in_imsld_loi { @@ -426,33 +567,42 @@ and lo.learning_objective_id = :imsld_learning_objective_id }] - set linear_item_list [concat $linear_item_list [db_list item_in_activity_loi { - select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_learning_activities ia, imsld_learning_objectivesi lo - where ar.object_id_one = lo.item_id - and ar.object_id_two = ii.item_id - and ia.learning_objective_id = lo.item_id - and ia.component_id = :component_item_id - }]] + set linear_item_list \ + [concat $linear_item_list [db_list item_in_activity_loi { + select ii.imsld_item_id + from acs_rels ar, + imsld_itemsi ii, + imsld_learning_activities ia, + imsld_learning_objectivesi lo + where ar.object_id_one = lo.item_id + and ar.object_id_two = ii.item_id + and ia.learning_objective_id = lo.item_id + and ia.component_id = :component_item_id + }]] # 1.2. prerequisites - set linear_item_list [concat $linear_item_list [db_list item_in_imsld_pre { - select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_prerequisitesi pre - where ar.object_id_one = pre.item_id - and ar.object_id_two = ii.item_id - and pre.prerequisite_id = :imsld_prerequisite_id - }]] + set linear_item_list \ + [concat $linear_item_list [db_list item_in_imsld_pre { + select ii.imsld_item_id + from acs_rels ar, imsld_itemsi ii, imsld_prerequisitesi pre + where ar.object_id_one = pre.item_id + and ar.object_id_two = ii.item_id + and pre.prerequisite_id = :imsld_prerequisite_id + }]] - set linear_item_list [concat $linear_item_list [db_list item_in_activity_pre { - select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_learning_activities ia, imsld_prerequisitesi pre - where ar.object_id_one = pre.item_id - and ar.object_id_two = ii.item_id - and ia.prerequisite_id = pre.item_id - and ia.component_id = :component_item_id - }]] - + set linear_item_list \ + [concat $linear_item_list [db_list item_in_activity_pre { + select ii.imsld_item_id + from acs_rels ar, + imsld_itemsi ii, + imsld_learning_activities ia, + imsld_prerequisitesi pre + where ar.object_id_one = pre.item_id + and ar.object_id_two = ii.item_id + and ia.prerequisite_id = pre.item_id + and ia.component_id = :component_item_id + }]] + # 1.3. roles set linear_item_list [concat $linear_item_list [db_list item_in_role { select ii.imsld_item_id @@ -461,11 +611,14 @@ and ar.object_id_two = ii.item_id and ir.component_id = :component_item_id }]] - + # 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 + from acs_rels ar, + imsld_itemsi ii, + imsld_learning_objectsi lo, + imsld_environmentsi env where ar.object_id_one = lo.item_id and ar.object_id_two = ii.item_id and lo.environment_id = env.item_id @@ -475,7 +628,10 @@ # 1.5. activity description (learning activities) set linear_item_list [concat $linear_item_list [db_list item_in_la_desc { select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_learning_activitiesi la, imsld_activity_descsi ad + from acs_rels ar, + imsld_itemsi ii, + imsld_learning_activitiesi la, + imsld_activity_descsi ad where ar.object_id_one = ad.item_id and ar.object_id_two = ii.item_id and la.activity_description_id = ad.item_id @@ -485,31 +641,53 @@ # 1.6. activity description (support activities) set linear_item_list [concat $linear_item_list [db_list item_in_sa_desc { select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_support_activitiesi sa, imsld_activity_descsi ad + from acs_rels ar, + imsld_itemsi ii, + imsld_support_activitiesi sa, + imsld_activity_descsi ad where ar.object_id_one = ad.item_id and ar.object_id_two = ii.item_id and sa.activity_description_id = ad.item_id and sa.component_id = :component_item_id }]] # 1.7. information(activity structures) - set linear_item_list [concat $linear_item_list [db_list item_in_as_info { - select ii.imsld_item_id - from acs_rels ar, imsld_itemsi ii, imsld_activity_structuresi ast - where ar.object_id_one = ast.item_id - and ar.object_id_two = ii.item_id - and ast.component_id = :component_item_id - }]] + set linear_item_list \ + [concat $linear_item_list [db_list item_in_as_info { + select ii.imsld_item_id + from acs_rels ar, imsld_itemsi ii, + imsld_activity_structuresi ast + where ar.object_id_one = ast.item_id + and ar.object_id_two = ii.item_id + and ast.component_id = :component_item_id + }]] + # 1.8. feedbak (learning activities) + set linear_item_list \ + [concat $linear_item_list [db_list item_in_la_feedback { + select ii.imsld_item_id + from acs_rels ar, imsld_itemsi ii, + imsld_learning_activitiesi la + where ar.object_id_one = la.on_completion_id + and ar.object_id_two = ii.item_id + and ar.rel_type = 'imsld_feedback_rel' + and la.component_id = :component_item_id + }]] + foreach imsld_item_id $linear_item_list { db_foreach nested_associated_items { select ii.imsld_item_id, ii.item_id, coalesce(ii.is_visible_p, 't') as is_visible_p, ii.identifier from imsld_itemsi ii - where (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) + where + (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) } { if { ![db_0or1row info_as_already_instantiated_p { select 1 @@ -519,7 +697,18 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } } @@ -540,7 +729,18 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } @@ -560,7 +760,18 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } @@ -582,17 +793,40 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } - if { ![string eq "" $class] && ![db_0or1row lo_env_already_instantiated_p { - select 1 - from imsld_attribute_instances - where run_id = :run_id - and user_id= :user_id - and type = 'class' - and identifier = :class - }] } { - 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 user_id $user_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + if { ![string eq "" $class] && + ![db_0or1row lo_env_already_instantiated_p { + select 1 + from imsld_attribute_instances + where run_id = :run_id + and user_id= :user_id + and type = 'class' + and identifier = :class + }] } { + 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 user_id $user_id] \ + [list is_visible_p "t"] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } @@ -614,17 +848,40 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } - if { ![string eq "" $class] && ![db_0or1row serv_env_already_instantiated_p { - select 1 - from imsld_attribute_instances - where run_id = :run_id - and user_id = :user_id - and type = 'class' - and identifier = :class - }] } { - 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 user_id $user_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + if { ![string eq "" $class] && + ![db_0or1row serv_env_already_instantiated_p { + select 1 + from imsld_attribute_instances + where run_id = :run_id + and user_id = :user_id + and type = 'class' + and identifier = :class + }] } { + 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 user_id $user_id] \ + [list is_visible_p "t"] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } @@ -645,10 +902,21 @@ and user_id = :user_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 identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p $is_visible_p] [list title ""] [list with_control_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 $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p $is_visible_p] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } - + # 7. classes db_foreach class { select cla.class_id, @@ -663,7 +931,18 @@ and run_id = :run_id and user_id = :user_id }] } { - set instance_id [package_exec_plsql -var_list [list [list instance_id ""] [list owner_id ""] [list type "class"] [list identifier $identifier] [list run_id $run_id] [list user_id $user_id] [list is_visible_p "t"] [list title ""] [list with_control_p ""]] imsld_attribute_instance new] + set instance_id \ + [package_exec_plsql \ + -var_list [list [list instance_id ""] \ + [list owner_id ""] \ + [list type "class"] \ + [list identifier $identifier] \ + [list run_id $run_id] \ + [list user_id $user_id] \ + [list is_visible_p "t"] \ + [list title ""] \ + [list with_control_p ""]] \ + imsld_attribute_instance new] } } } @@ -678,9 +957,113 @@ @return 1 if successful, 0 otherwise } { - return [package_exec_plsql -var_list [list [list run_id $run_id]] imsld_run del] + return [package_exec_plsql -var_list [list [list run_id $run_id]] \ + imsld_run del] } +ad_proc -public imsld::instance::create_user_folder { + -user_id:required + -parent_folder_id:required + {-community_id ""} +} { + Procedure that given a user id, creates inside the + given parent_id one folder with name user_NNNN_folder where + NNNN is the user_id within the platform. This folder is required to + store the values of locpers-property and globpers-property of type file. + Since each user may have an instance of the same file, separating them into + user folders facilitates its later manipulation. All the files submitted + for locpers-property or globpers-property for the same person are found in + one single folder. + As for the "folder_label" it is not given to the imsld::cr::folder_new on + purpose in order for it to reuse folder_name. Navigating through WebDAV in + one of this folders, only shows the folder_name, therefore, this duality + between folder_name and folder_label, has been avoided. + + Returns the item_id of the created folder + + @param user_id user id for which to create the folder + @param parent_folder_id cr_item from which to create the sub-folder +} { + # If the community_id is not given, obtained from the environment + if { [empty_string_p $community_id] } { + set community_id [dotlrn_community::get_community_id] + } + + # Require writing permission in the given parent_folder_id + permission::require_permission \ + -object_id $parent_folder_id \ + -privilege write + + db_transaction { + # First cook up the folder name. + set folder_name [imsld::instance::user_folder_name \ + -user_id $user_id] + + # Create the folder. No folder_label is given, therefore, the + # folder_name is reused. + set user_folder_id [imsld::cr::folder_new \ + -parent_id $parent_folder_id \ + -folder_name $folder_name] + # And now, the permissions. These folders should only be visible to + # the user + # Disable folder permissions inheritance + permission::toggle_inherit -object_id $user_folder_id + + # Set read permissions for the user + permission::grant -party_id $user_id \ + -object_id $user_folder_id -privilege read + + # Set admin permissions for community/class dotlrn_admin_rel + set party_id_admin [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type dotlrn_admin_rel] + permission::grant -party_id $party_id_admin \ + -object_id $user_folder_id \ + -privilege read + + # Set read permissions for *all* other professors within .LRN + # FIXME: This should be restricted to professors members of THIS + # community + set party_id_professor [dotlrn::user::type::get_segment_id \ + -type professor] + permission::grant -party_id $party_id_professor \ + -object_id $user_folder_id \ + -privilege read + + # Set read permissions for *all* other admins within .LRN + set party_id_admins [dotlrn::user::type::get_segment_id -type admin] + permission::grant -party_id $party_id_admins \ + -object_id $user_folder_id -privilege read + + # register content types + content::folder::register_content_type -folder_id $user_folder_id \ + -content_type imsld_property_instance + + # In principle no sub-folders are allowed in this folder. + } + + return $user_folder_id +} + +ad_proc -public imsld::instance::user_folder_name { + -user_id:required +} { + This procedure is to centralize the place where the user folder name is + computed. It is used to create this folder and access it to store + properties of type file. By centralizing here the name creation, when + modified, this is the only place in the code where the change needs to be + reflected. + + Returns the string used for folder identification + + @param user_id the user identifier for the folder name +} { + db_1row user_info { + select username as username from users where user_id=:user_id + } + return ${user_id}_$username +} + # LocalWords: type 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 -r1.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl 25 Apr 2007 10:52:30 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-monitor-procs.tcl 17 Apr 2008 17:18:16 -0000 1.3 @@ -67,30 +67,20 @@ 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 activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" -url {activity_id run_id {type "learning"}}]" \ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] - 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]] + set completed_list [linsert $completed_list \ + $sort_order [$activity_node asList]] } imsld_as_sa_rel { - # add the activiti to the TCL list + # add the activity to the TCL list db_1row get_support_activity_info { select sa.title as activity_title, sa.item_id as activity_item_id, @@ -104,25 +94,14 @@ 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 activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" -url {activity_id run_id {type "support"}}]" \ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] - 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 { @@ -139,25 +118,15 @@ 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 structure_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {{activity_id "$structure_id"} run_id {type "structure"}}]" \ + -run_id $run_id \ + -revision_id $structure_id \ + -type "activity"] - 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 \ @@ -236,25 +205,15 @@ 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 activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {activity_id run_id {type "learning"}}]" \ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] - 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 { @@ -267,25 +226,15 @@ 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 activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {activity_id run_id {type "support"}}]"\ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] - 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 { @@ -298,25 +247,15 @@ 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 structure_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {activity_id run_id {type "structure"}}]" \ + -run_id $run_id \ + -revision_id $structure_id \ + -type "activity"] - 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 \ @@ -357,7 +296,7 @@ set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "properties-frame" -url {run_id {type "loc"}}]" $a_node setAttribute target "content" - set text [$dom_doc createTextNode "[_ imsld.1_Local_Properties]"] + set text [$dom_doc createTextNode "1. [_ imsld.Local_Properties]"] $a_node appendChild $text $local_node appendChild $a_node @@ -370,7 +309,7 @@ set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "properties-frame" -url {run_id {type "locpers"}}]" $a_node setAttribute target "content" - set text [$dom_doc createTextNode "[_ imsld.lt_2_Local-personal_Prop]"] + set text [$dom_doc createTextNode "2. [_ imsld.lt_Local-personal_Prop]"] $a_node appendChild $text $locpers_node appendChild $a_node @@ -379,8 +318,8 @@ # 3. loc-role properties: associated to each role in the run set locrole_node [$dom_doc createElement li] - $locrole_node setAttribute class "liClosed" - set text [$dom_doc createTextNode "[_ imsld.lt_3_Local-role_Properti]"] + $locrole_node setAttribute class "liOpen" + set text [$dom_doc createTextNode "3. [_ imsld.lt_Local-role_Properti]"] $a_node appendChild $text $locrole_node appendChild $text @@ -410,7 +349,7 @@ set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "properties-frame" -url {run_id {type "globpers"}}]" $a_node setAttribute target "content" - set text [$dom_doc createTextNode "[_ imsld.lt_4_Global-personal_Pro]"] + set text [$dom_doc createTextNode "4. [_ imsld.lt_Global-personal_Pro]"] $a_node appendChild $text $globpers_node appendChild $a_node @@ -423,7 +362,7 @@ set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "properties-frame" -url {run_id {type "glob"}}]" $a_node setAttribute target "content" - set text [$dom_doc createTextNode "[_ imsld.5_Global_Properties]"] + set text [$dom_doc createTextNode "5. [_ imsld.Global_Properties]"] $a_node appendChild $text $globpers_node appendChild $a_node @@ -496,23 +435,14 @@ 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 + set activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {activity_id run_id {type "learning"}}]"\ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] $dom_node appendChild $activity_node } @@ -527,25 +457,15 @@ 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 activity_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $activity_title \ + -href "[export_vars -base "activity-frame" \ + -url {activity_id run_id {type "support"}}]"\ + -run_id $run_id \ + -revision_id $activity_id \ + -type "activity"] - 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 } } @@ -560,7 +480,6 @@ } { @param environment_item_id @param run_id - @option resource_mode @param dom_node @param dom_doc @@ -630,25 +549,16 @@ 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 lo_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $lo_title \ + -href "[export_vars -base "activity-frame" \ + -url {run_id learning_object_id {type learning_object}}]"\ + -run_id $run_id \ + -revision_id $learning_object_id \ + -item_id $learning_object_item_id \ + -type "learning_object"] - 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 } } @@ -673,25 +583,15 @@ 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 service_node [imsld::monitor::link_to_visitors_info \ + -dom_doc $dom_doc \ + -title $service_title \ + -href "[export_vars -base "activity-frame" \ + -url {run_id service_id {type service}}]" \ + -run_id $run_id \ + -revision_id $service_id \ + -type "service"] - 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 } @@ -703,9 +603,9 @@ 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 \ + imsld::monitor::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 } @@ -928,3 +828,61 @@ } return $number_of_visitors } + +ad_proc -public imsld::monitor::link_to_visitors_info { + -dom_doc:required + -title:required + -href:required + -run_id:required + -revision_id:required + -type:required + -item_id +} { + @param dom_doc:required + @param href:required + @param run_id:required + @param revision_id:required + @param type:required + @param item_id + + <p> + Adds to the given lo_node a link to the number of users visiting the + activity in activity_id/run_id + </p> +} { + set result [$dom_doc createElement li] + $result setAttribute class "liOpen" + + set a_node [$dom_doc createElement a] + $a_node setAttribute href $href + $a_node setAttribute target "content" + $result appendChild $a_node + + set text [$dom_doc createTextNode "$title "] + $a_node appendChild $text + + if { $type == "learning_object" } { + set visitors [imsld::monitor::number_of_visitors \ + -run_id $run_id \ + -revision_id $revision_id \ + -item_id $item_id \ + -type $type] + } else { + set visitors [imsld::monitor::number_of_visitors \ + -run_id $run_id \ + -revision_id $revision_id \ + -type $type] + } + + if { $visitors > 1 } { + set text [$dom_doc createTextNode "($visitors [_ imsld.users ])"] + } elseif { $visitors > 0 } { + set text [$dom_doc createTextNode "($visitors [_ imsld.user ])"] + } else { + set text [$dom_doc createTextNode "([_ imsld.No_users ])"] + } + + $result appendChild $text + + return $result +} 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.64 -r1.65 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 16 Jan 2008 10:30:40 -0000 1.64 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.tcl 17 Apr 2008 17:18:16 -0000 1.65 @@ -605,10 +605,6 @@ #revoke permissions until first usage of resources if {[info exist acs_object_id]} { permission::set_not_inherit -object_id $acs_object_id - set party_id [db_list get_allowed_parties {}] - foreach parti $party_id { - permission::revoke -party_id $parti -object_id $acs_object_id -privilege "read" - } } set resource_id [imsld::cp::resource_new -manifest_id $manifest_id \ @@ -647,12 +643,6 @@ permission::set_not_inherit -object_id $filex_id - set acs_object_id $filex_id - set party_id_list [db_list get_allowed_parties {}] - foreach party_id $party_id_list { - permission::revoke -party_id $party_id -object_id $filex_id -privilege "read" - } - # map resource with file relation_add -extra_vars $extra_vars imsld_res_files_rel $resource_id $filex_id } @@ -948,13 +938,16 @@ } { Parse a global definition and stores all the information in the database. - Returns a list with the new global_definition_id (item_id, actually a property_id) created if there were no errors, or 0 and an explanation messge if there was an error. + Returns a list with the new global_definition_id (item_id, actually a + property_id) created if there were no errors, or 0 and an explanation + messge if there was an error. @option global_def_node global_def node to parse @param identifier @param existing_href @param component_id Comoponent id of the one which owns the property - @param type Type of the property defined by this global definition, which can be globpers or glob + @param type Type of the property defined by this global definition, which + can be globpers or glob @param manifest Manifest tree @param manifest_id Manifest ID or the manifest being parsed @param parent_id Parent folder ID @@ -963,13 +956,25 @@ upvar files_struct_list files_struct_list if { ![empty_string_p $global_def_node] } { - set uri [imsld::parse::get_attribute -node $global_def_node -attr_name uri] - set title [imsld::parse::get_title -node $global_def_node -prefix imsld] - set datatype [$global_def_node selectNodes "*\[local-name()='datatype'\]" ] - imsld::parse::validate_multiplicity -tree $global_def_node -multiplicity 1 -element_name "global-definition datatype" -equal - set datatype [string tolower [imsld::parse::get_attribute -node $global_def_node -attr_name datatype]] - set initial_value [$global_def_node selectNodes "*\[local-name()='initial-value'\]"] - imsld::parse::validate_multiplicity -tree $initial_value -multiplicity 1 -element_name "global-definition initial-value" -lower_than + set uri [imsld::parse::get_attribute -node $global_def_node \ + -attr_name uri] + set title [imsld::parse::get_title \ + -node $global_def_node -prefix imsld] + set datatype \ + [$global_def_node selectNodes "*\[local-name()='datatype'\]" ] + imsld::parse::validate_multiplicity \ + -tree $global_def_node \ + -multiplicity 1 \ + -element_name "global-definition datatype" -equal + set datatype [string tolower \ + [imsld::parse::get_attribute \ + -node $datatype -attr_name datatype]] + set initial_value [$global_def_node selectNodes \ + "*\[local-name()='initial-value'\]"] + imsld::parse::validate_multiplicity \ + -tree $initial_value \ + -multiplicity 1 \ + -element_name "global-definition initial-value" -lower_than if { [llength $initial_value] } { set initial_value [imsld::parse::get_element_text -node $initial_value] } else { @@ -983,26 +988,31 @@ } - set globpers_property_id [imsld::item_revision_new -attributes [list [list component_id $component_id] \ - [list identifier $identifier] \ - [list existing_href $existing_href] \ - [list uri $uri] \ - [list type $type] \ - [list datatype $datatype] \ - [list initial_value $initial_value]] \ - -content_type imsld_property \ - -title $title \ - -parent_id $parent_id] + set globpers_property_id \ + [imsld::item_revision_new \ + -attributes [list [list component_id $component_id] \ + [list identifier $identifier] \ + [list existing_href $existing_href] \ + [list uri $uri] \ + [list type $type] \ + [list datatype $datatype] \ + [list initial_value $initial_value]] \ + -content_type imsld_property \ + -title $title \ + -parent_id $parent_id] if { ![empty_string_p $global_def_node] } { - set restrictions [$global_def_node selectNodes "*\[local-name()='restriction'\]"] + set restrictions \ + [$global_def_node selectNodes "*\[local-name()='restriction'\]"] foreach restriction $restrictions { - set restriction_list [imsld::parse::parse_and_create_restriction -manifest $manifest \ - -property_id $globpers_property_id \ - -manifest_id $manifest_id \ - -restriction_node $restriction \ - -parent_id $parent_id \ - -tmp_dir $tmp_dir] + set restriction_list \ + [imsld::parse::parse_and_create_restriction \ + -manifest $manifest \ + -property_id $globpers_property_id \ + -manifest_id $manifest_id \ + -restriction_node $restriction \ + -parent_id $parent_id \ + -tmp_dir $tmp_dir] set restriction_id [lindex $restriction_list 0] if { !$restriction_id } { @@ -1230,8 +1240,8 @@ imsld::parse::validate_multiplicity -tree $lrp_datatype -multiplicity 1 -element_name "locrole-property datatype" -equal set lrp_datatype [string tolower [imsld::parse::get_attribute -node $lrp_datatype -attr_name datatype]] - set role_ref [$lrp_datatype selectNodes "*\[local-name()='role-ref'\]"] - imsld::parse::validate_multiplicity -tree $lrp_datatype -multiplicity 1 -element_name "locrole-property role" -equal + set role_ref [$locrole_property selectNodes "*\[local-name()='role-ref'\]"] + imsld::parse::validate_multiplicity -tree $role_ref -multiplicity 1 -element_name "locrole-property role" -equal set ref [imsld::parse::get_attribute -node $role_ref -attr_name ref] if { ![db_0or1row get_role_id { select item_id as role_id @@ -1318,15 +1328,15 @@ foreach glob_property $glob_properties { set g_identifier [imsld::parse::get_attribute -node $glob_property -attr_name identifier] set g_existing [$glob_property selectNodes "*\[local-name()='existing'\]"] - imsld::parse::validate_multiplicity -tree $g_exiting -multiplicity 1 -element_name "existing(glob)" -lower_than + imsld::parse::validate_multiplicity -tree $g_existing -multiplicity 1 -element_name "existing(glob)" -lower_than if { [llength $g_existing] } { - set g_existing_href [imsld::parse::get_attribute -node $g_exiting -attr_name href] + set g_existing_href [imsld::parse::get_attribute -node $g_existing -attr_name href] } else { set g_existing_href "" } set global_def [$glob_property selectNodes "*\[local-name()='global-definition'\]"] - set global_def_list [imsld::parse::parse_and_create_global_def -type glob \ + set global_def_list [imsld::parse::parse_and_create_global_def -type global \ -identifier $g_identifier \ -existing_href $g_existing_href \ -global_def_node $global_def \ @@ -1590,11 +1600,6 @@ #revoke read permissions until first usage if {[info exist acs_object_id]} { permission::set_not_inherit -object_id $acs_object_id - - set party_id [db_list get_allowed_parties {}] - foreach parti $party_id { - permission::revoke -party_id $parti -object_id $acs_object_id -privilege "read" - } } return $acs_object_id } @@ -1649,7 +1654,8 @@ [list parameters $parameters] \ [list service_type send-mail]] \ -content_type imsld_service \ - -parent_id $parent_id] + -parent_id $parent_id \ + -title $title] # create the send mail service set send_mail_id [imsld::item_revision_new -attributes [list [list service_id $service_id] \ [list is_visible_p $is_visible_p] \ @@ -1754,19 +1760,20 @@ [list parameters $parameters] \ [list service_type conference]] \ -content_type imsld_service \ - -parent_id $parent_id] + -parent_id $parent_id \ + -title $title] if { [string eq $conference_type "asynchronous"] } { - set moderator_list [$conference selectNodes "*\[local-name()='moderator'\]"] - if { [llength $moderator_list] } { - set acs_object_id [imsld::parse::parse_and_create_forum -name $title -is_moderated] - - } else { - set acs_object_id [imsld::parse::parse_and_create_forum -name $title] - } + set moderator_list [$conference selectNodes "*\[local-name()='moderator'\]"] + if { [llength $moderator_list] } { + set acs_object_id [imsld::parse::parse_and_create_forum -name $title -is_moderated] + + } else { + set acs_object_id [imsld::parse::parse_and_create_forum -name $title] + } - + set resource_id [imsld::cp::resource_new -manifest_id $manifest_id \ -identifier "forumresource-$service_id" \ -type "forum" \ @@ -1785,7 +1792,7 @@ # map item with resource relation_add imsld_item_res_rel $imsld_item_id $resource_id - + } else { # item set conference_item [$conference selectNodes "*\[local-name()='item'\]"] @@ -1902,7 +1909,8 @@ [list service_type monitor]] \ -title $title \ -content_type imsld_service \ - -parent_id $parent_id] + -parent_id $parent_id \ + -title $title] # monitor: role-ref set role_ref [$monitor_service selectNodes "*\[local-name()='role-ref'\]"] @@ -2707,24 +2715,26 @@ set structure_information [$activity_node selectNodes "*\[local-name()='information'\]"] if { [llength $structure_information] } { # parse the item, create it and map it to the activity structure - set information_item [$structure_information selectNodes "*\[local-name()='item'\]"] - if { ![llength $information_item] } { + set information_item_list [$structure_information selectNodes "*\[local-name()='item'\]"] + if { ![llength $information_item_list] } { return [list 0 "[_ imsld.lt_Information_given_but_1]"] } - set item_list [imsld::parse::parse_and_create_item -manifest $manifest \ - -manifest_id $manifest_id \ - -item_node $information_item \ - -parent_id $parent_id \ - -tmp_dir $tmp_dir] - - set information_id [lindex $item_list 0] - if { !$information_id } { - # an error happened, abort and return the list whit the error - return $item_list - } - # map information item with the activity structure - relation_add imsld_as_info_i_rel $activity_structure_id $information_id + foreach information_item $information_item_list { + set item_list [imsld::parse::parse_and_create_item -manifest $manifest \ + -manifest_id $manifest_id \ + -item_node $information_item \ + -parent_id $parent_id \ + -tmp_dir $tmp_dir] + + set information_id [lindex $item_list 0] + if { !$information_id } { + # an error happened, abort and return the list whit the error + return $item_list + } + # map information item with the activity structure + relation_add imsld_as_info_i_rel $activity_structure_id $information_id + } } # store the order of the activities to display them later in the correct order @@ -3372,11 +3382,13 @@ } } - 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_xml $when_prop_value_is_set_xml]] \ - -content_type imsld_complete_act \ - -parent_id $parent_id] + if { ![string eq "" $time_in_seconds] || ![string eq "" $when_prop_value_is_set_xml] ||![string eq "" $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_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 @@ -4009,13 +4021,13 @@ # get the files structure set files_struct_list [imsld::parse::get_files_structure -tmp_dir $tmp_dir] - # Parser - # XML => DOM document - dom parse [::tDOM::xmlReadFile $xmlfile] document - - # DOM document => DOM root - $document documentElement manifest - + # Parser + # XML => DOM document + dom parse [::tDOM::xmlReadFile $xmlfile] document + + # DOM document => DOM root + $document documentElement manifest + # manifest set manifest_identifier [imsld::parse::get_attribute -node $manifest -attr_name identifier] set manifest_version [imsld::parse::get_attribute -node $manifest -attr_name version] @@ -4355,7 +4367,7 @@ relation_add imsld_feedback_rel $on_completion_id $item_id } } else { - set on_completion_id [imsld::item_revision_new -parent_id $parent_id \ + set on_completion_id [imsld::item_revision_new -parent_id $parent_id \ -content_type imsld_on_completion] } @@ -4566,8 +4578,12 @@ if { ![db_0or1row already_created_p { select 1 from imsld_cp_resources where identifier = :resource_identifier and manifest_id = :manifest_id }] } { - imsld::parse::validate_multiplicity -tree $resource_left -multiplicity 1 -element_name "resources (cp resources)" -equal - set resource_list [imsld::parse::parse_and_create_resource -resource_node $resource_left \ + imsld::parse::validate_multiplicity \ + -tree $resource_left \ + -multiplicity 1 \ + -element_name "resources (cp resources)" -equal + set resource_list [imsld::parse::parse_and_create_resource \ + -resource_node $resource_left \ -manifest $manifest \ -manifest_id $manifest_id \ -parent_id $cr_folder_id \ @@ -4580,6 +4596,13 @@ } } + # At this point files_struct_list contain the list of all the files in the + # UoL. Those that were stored in the FS have an object_id attached to + # them. Those that still have a zero as object_id are files that are not + # referenced as resources by the manifest, but they are in the ZIP, + # therefore, they need to be moved to the FS. + imsld::fs::traverse_zip -dir $tmp_dir -pattern "*" + if { ![empty_string_p $warnings] } { set warnings "[_ imsld.lt_br__Warnings_ul_warni]" } Index: openacs-4/packages/imsld/tcl/imsld-parse-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-parse-procs.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/tcl/imsld-parse-procs.xql 24 Oct 2006 10:09:51 -0000 1.6 +++ openacs-4/packages/imsld/tcl/imsld-parse-procs.xql 17 Apr 2008 17:18:16 -0000 1.7 @@ -13,29 +13,6 @@ </querytext> </fullquery> - <fullquery name="imsld::parse::parse_and_create_forum.get_allowed_parties"> - <querytext> - select aopp.party_id - from acs_object_party_privilege_map aopp, - party_names pn - where aopp.privilege='read' and - aopp.party_id=pn.party_id and - aopp.object_id=:acs_object_id - </querytext> - </fullquery> - - <fullquery name="imsld::parse::parse_and_create_resource.get_allowed_parties"> - <querytext> - select aopp.party_id - from acs_object_party_privilege_map aopp, - party_names pn - where aopp.privilege='read' and - aopp.party_id=pn.party_id and - aopp.object_id=:acs_object_id - </querytext> - </fullquery> - - <fullquery name="imsld::parse::parse_and_create_service.get_component_id"> <querytext> select env.component_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.98 -r1.99 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 16 Jan 2008 10:35:46 -0000 1.98 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 17 Apr 2008 17:18:16 -0000 1.99 @@ -30,12 +30,14 @@ ad_proc -public imsld::object_type_image_path { -object_type } { - returns the path to the image representing the given object_type in the imsld package + returns the path to the image representing the given object_type in the + imsld package } { set community_id [dotlrn_community::get_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_package_id \ + [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id $community_id] \ + -package_key "[imsld::package_key]"] switch $object_type { forums_forum { set image_path "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/forums.png" @@ -382,13 +384,20 @@ ad_proc -public imsld::global_folder_id { {-community_id ""} } { - Returns the global folder id where the global properties of type file are stored. - This folder is a subfolder of the dotlrn root folder and there must be only one in the .LRN installation + Returns the global folder id where the global properties of type file are + stored. + This folder is a subfolder of the dotlrn root folder and there must be only + one in the .LRN installation } { - set community_id [expr { [empty_string_p $community_id] ? [dotlrn_community::get_community_id] : $community_id }] + set community_id [expr { [empty_string_p $community_id] ? \ + [dotlrn_community::get_community_id] : \ + $community_id }] set dotlrn_root_folder_id [dotlrn_fs::get_dotlrn_root_folder_id] - set global_folder_id [content::item::get_id -item_path "imsld_global_folder" -root_folder_id $dotlrn_root_folder_id -resolve_index f] + set global_folder_id [content::item::get_id \ + -item_path "imsld_global_folder" \ + -root_folder_id $dotlrn_root_folder_id \ + -resolve_index f] if { [empty_string_p $global_folder_id] } { db_transaction { @@ -399,11 +408,15 @@ # create the root cr dir - set global_folder_id [imsld::cr::folder_new -parent_id $dotlrn_root_folder_id -folder_name $folder_name -folder_label "IMS-LD"] + set global_folder_id [imsld::cr::folder_new \ + -parent_id $dotlrn_root_folder_id \ + -folder_name $folder_name \ + -folder_label "IMS-LD"] # PERMISSIONS FOR FILE-STORAGE - # Before we go about anything else, lets just set permissions straight. + # Before we go about anything else, lets just set permissions + # straight. # Disable folder permissions inheritance permission::toggle_inherit -object_id $global_folder_id @@ -488,9 +501,9 @@ dom createDocument foo foo_doc set foo_node [$foo_doc documentElement] - if { [string eq $$type "learning"] } { + if { [string eq $type "learning"] } { set resources_activities_list [imsld::process_learning_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] - } elseif { [string eq $$type "support"] } { + } elseif { [string eq $type "support"] } { set resources_activities_list [imsld::process_support_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] } else { set resources_activities_list [imsld::process_activity_structure_as_ul -run_id $run_id -structure_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] @@ -511,6 +524,7 @@ mark the act as finished, as well as all the referenced role_parts } { set user_id [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] + if { [imsld::act_finished_p -run_id $run_id -act_id $act_id -user_id $user_id] } { return } @@ -530,6 +544,7 @@ and content_revision__is_live(rp.role_part_id) = 't' }] { set role_part_id [lindex $referenced_role_part 0] + imsld::mark_role_part_finished -role_part_id $role_part_id \ -act_id $act_id \ -play_id $play_id \ @@ -691,6 +706,7 @@ ad_proc -public imsld::item_revision_new { {-attributes ""} {-item_id ""} + {-name ""} {-title ""} {-package_id ""} {-user_id ""} @@ -701,10 +717,17 @@ -parent_id } { Creates a new revision of a content item, calling the cr functions. - If editing, only a new revision is created, otherwise an item is created too. + If editing, only a new revision is created, otherwise an item is created + too. - @option attributes A list of lists of pairs of additional attributes and their values. + @option attributes A list of lists of pairs of additional attributes and + their values. @option title + @option name When given this parameter is to set the field name of the + newly created item. This field is important for two reasons. First, in the + absence of title in the corresponding cr_revision object, it is the string + shown when the item is a file and is visible in the FS. Second, it is the + ONLY name that appears when browsing the FS through WebDAV. @option package_id @option user_id @option creation_ip @@ -713,16 +736,34 @@ @param parent_id Identifier of the parent folder } { - set user_id [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] - set creation_ip [expr { [string eq "" $creation_ip] ? [ad_conn peeraddr] : $creation_ip }] - set creation_date [expr { [string eq "" $creation_date] ? [dt_sysdate] : $creation_date }] - set package_id [expr { [string eq "" $package_id] ? [ad_conn package_id] : $package_id }] - + set user_id \ + [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] + set creation_ip [expr { [string eq "" $creation_ip] ? \ + [ad_conn peeraddr] : $creation_ip }] + set creation_date [expr { [string eq "" $creation_date] ? \ + [dt_sysdate] : $creation_date }] + set package_id [expr { [string eq "" $package_id] ? \ + [ad_conn package_id] : $package_id }] + if { [string eq $item_id ""] } { # create the item set item_id [db_nextval "acs_object_id_seq"] + + # Decide the name + if { [string eq "" $name] } { + set name "${item_id}_content_type" + } else { + # If the given name collides with another item, it needs to be + # modified as to make it unique (parent_id, name) is what it needs + # to be made unique + if { ![string eq "" [content::item::get_id_by_name \ + -name $name -parent_id $parent_id]] } { + set name "${name}.${item_id}" + } + } + set item_id [content::item::new -item_id $item_id \ - -name "${item_id}_content_type" \ + -name $name \ -content_type $content_type \ -parent_id $parent_id \ -creation_user $user_id \ @@ -775,10 +816,10 @@ } { set user_id [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] - # notifications - # according to the spec: "The implementation should ensure that a user receives one notification only, - # even if the user is a member of several roles targeted by the notification", that's why we use the list - # notified_users_list and check before sending the notification. + # notifications according to the spec: "The implementation should ensure + # that a user receives one notification only, even if the user is a member + # of several roles targeted by the notification", that's why we use the + # list notified_users_list and check before sending the notification. set community_id [dotlrn_community::get_community_id] set community_name [dotlrn_community::get_community_name $community_id] set community_url [ns_conn location][dotlrn_community::get_community_url $community_id] @@ -909,10 +950,12 @@ regexp {finish-component-element-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([0-9]+)-([a-z]+).imsld$} $url match imsld_id run_id play_id act_id role_part_id element_id type } if { ![db_0or1row marked_as_started { *SQL* }] } { - # NOTE: this should not happen... UNLESS the activity is marked as finished automatically + # NOTE: this should not happen... UNLESS the activity is marked as + # finished automatically db_dml mark_element_started { *SQL* } } - # now that we have the necessary info, mark the finished element completed and return + # now that we have the necessary info, mark the finished element completed + # and return db_dml insert_element_entry { *SQL* } switch $type { @@ -1016,50 +1059,109 @@ } } } - + if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } { + # if the activity is referenced from an activity strucutre, that activity structure must be checked + # in order to know if the structure must be also marked as completed foreach referencer_structure_list [db_list_of_lists referencer_structure { *SQL* }] { set structure_id [lindex $referencer_structure_list 0] set structure_item_id [lindex $referencer_structure_list 1] set number_to_select [lindex $referencer_structure_list 2] - # if this activity is part of an activity structure, let's check if the rest of referenced - # activities are finished too, so we can mark finished the activity structure as well - set scturcture_finished_p 1 - set total_completed 0 - db_foreach referenced_activity { - select content_item__get_live_revision(ar.object_id_two) as activity_id - from acs_rels ar - where ar.object_id_one = :structure_item_id - and ar.rel_type in ('imsld_as_la_rel','imsld_as_sa_rel','imsld_as_as_rel') - } { - if { ![db_string completed_p { *SQL* }] } { - # there is at leas one no-completed activity, so we can't mark this activity structure yet - set scturcture_finished_p 0 - } else { - incr total_completed - } + set already_marked_p [db_0or1row not_marked { + select 1 + from imsld_status_user + where user_id = :user_id + and run_id = :run_id + and related_id = :structure_id + and status = 'finished' + }] + if { ![imsld::structure_finished_p -structure_id $structure_id -run_id $run_id -user_id $user_id] || !$already_marked_p } { + # if this activity is part of an activity structure, let's check if the rest of referenced + # activities are finished too, so we can mark finished the activity structure as well + set scturcture_finished_p 1 + set total_completed 0 + db_foreach referenced_activity { + select content_item__get_live_revision(ar.object_id_two) as activity_id + from acs_rels ar + where ar.object_id_one = :structure_item_id + and ar.rel_type in ('imsld_as_la_rel','imsld_as_sa_rel','imsld_as_as_rel') + } { + if { ![db_string completed_p { *SQL* }] } { + # there is at leas one no-completed activity, so we can't mark this activity structure yet + set scturcture_finished_p 0 + continue + } else { + incr total_completed + } + } + # If the structure has the flag number-to-select + if { $scturcture_finished_p && (($number_to_select > 0 && ($total_completed >= $number_to_select)) || !$already_marked_p) } { + 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 $structure_id \ + -type structure \ + -user_id $user_id \ + -code_call + } } - # If the structure has the flag number-to-select - if { $scturcture_finished_p || (![string eq $number_to_select ""] && ($total_completed >= $number_to_select)) } { - 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 $structure_id \ - -type structure \ - -user_id $user_id \ - -code_call - } } } - # we continue with A LOT of validations (in order to support the when-xxx-finished tag of the spec + if { [string eq $type "structure"] } { + # mark as finished all the referenced activities + foreach referenced_activities_list [db_list_of_lists referenced_activities { + select case when ar.rel_type = 'imsld_as_la_rel' + then 'learning' + when ar.rel_type = 'imsld_as_sa_rel' + then 'support' + when ar.rel_type = 'imsld_as_as_rel' + then 'structure' + end as ref_type, + content_item__get_live_revision(ar.object_id_two) as activity_id + from acs_rels ar, imsld_activity_structuresi ias + where ar.object_id_one = ias.item_id + and ias.structure_id = :element_id + and ar.rel_type in ('imsld_as_la_rel','imsld_as_sa_rel','imsld_as_as_rel') + }] { + set ref_type [lindex $referenced_activities_list 0] + set activity_id [lindex $referenced_activities_list 1] + if { ![db_0or1row already_finished_p { + select 1 + from imsld_status_user + where user_id = :user_id + and status = 'finished' + and run_id = :run_id + and related_id = :activity_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 $ref_type \ + -user_id $user_id \ + -code_call + } + } + } + + + + # we continue with A LOT of validations (in order to support the + # when-xxx-finished tag of the spec # -- with xxx in (role_part,act,play)): - # 1. let's see if the finished activity triggers the ending of the role_part - # 2. let's see if the finished role_part triggers the ending of the act which references it. - # 3. let's see if the finished act triggers the ending the play which references it - # 4. let's see if the finished play triggers the ending of the method which references it. + # 1. let's see if the finished activity triggers the ending of the + # role_part + # 2. let's see if the finished role_part triggers the ending of the act + # which references it. + # 3. let's see if the finished act triggers the ending the play which + # references it + # 4. let's see if the finished play triggers the ending of the method which + # references it. set role_part_id_list [imsld::get_role_part_from_activity -activity_type $type -leaf_id [db_string get_item_id { select item_id from cr_revisions where revision_id = :element_id}]] foreach role_part_id $role_part_id_list { db_1row context_info { @@ -1162,6 +1264,7 @@ } } } + imsld::mark_act_finished -act_id $act_id \ -play_id $play_id \ -imsld_id $imsld_id \ @@ -1385,28 +1488,57 @@ set object_id_two [lindex $referenced_activity 0] set rel_type [lindex $referenced_activity 1] switch $rel_type { - imsld_as_la_rel - + imsld_as_la_rel { + set complete_act_id [db_string completion_restriction { + select complete_act_id + from imsld_learning_activities + where activity_id = content_item__get_live_revision(:object_id_two) + } -default ""] + if { (![string eq [db_string finished_p { + select status from imsld_status_user + where related_id = content_item__get_live_revision(:object_id_two) + and user_id = :user_id + and status = 'finished' + and run_id = :run_id + } -default ""] "finished"] && ![string eq $complete_act_id ""]) \ + || (![string eq [db_string started_p { + select status from imsld_status_user + where related_id = content_item__get_live_revision(:object_id_two) + and user_id = :user_id + and status = 'started' + and run_id = :run_id + } -default ""] "started"] && [string eq $complete_act_id ""]) } { + set all_completed 0 + break + } + } imsld_as_sa_rel { - # is the activity finished ? - if { ![db_0or1row completed_p { - select 1 from imsld_status_user + set complete_act_id [db_string completion_restriction { + select complete_act_id + from imsld_support_activities + where activity_id = content_item__get_live_revision(:object_id_two) + } -default ""] + + if { (![string eq [db_string finished_p { + select status from imsld_status_user where related_id = content_item__get_live_revision(:object_id_two) and user_id = :user_id and status = 'finished' and run_id = :run_id - }] } { - set all_completed 0 - } + } -default ""] "finished"] && ![string eq $complete_act_id ""]) \ + || (![string eq [db_string started_p { + select status from imsld_status_user + where related_id = content_item__get_live_revision(:object_id_two) + and user_id = :user_id + and status = 'started' + and run_id = :run_id + } -default ""] "started"] && [string eq $complete_act_id ""]) } { + set all_completed 0 + break + } } imsld_as_as_rel { - # search recursively trough the referenced - db_1row get_activity_structure_info { - select structure_id - from imsld_activity_structuresi - where item_id = :object_id_two - and content_revision__is_live(structure_id) = 't' - } - # is the activity finished ? + # the activity structure must be marked as finished if { ![db_0or1row completed_p { select 1 from imsld_status_user where related_id = :structure_id @@ -1415,15 +1547,13 @@ and run_id = :run_id }] } { set all_completed 0 + break } - if { ![imsld::structure_finished_p -run_id $run_id -structure_id $structure_id -user_id $user_id] } { - set all_completed 0 - } } } } return $all_completed -} +} ad_proc -public imsld::role_part_finished_p { -role_part_id:required @@ -2113,10 +2243,12 @@ set file_url [acs_sc::invoke -contract FtsContentProvider -operation url -impl $object_type -call_args [list $acs_object_id]] 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}]" + $a_node setAttribute title "$object_title" set img_node [$dom_doc createElement img] $img_node setAttribute src "[imsld::object_type_image_path -object_type $object_type]" $img_node setAttribute border "0" $img_node setAttribute alt "$object_title" + $img_node setAttribute title "$object_title" $a_node appendChild $img_node if { $li_mode_p } { set file_node [$dom_doc createElement li] @@ -2140,10 +2272,12 @@ 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}]" + $a_node setAttribute title "$file_name" 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" $img_node setAttribute alt "$file_name" + $img_node setAttribute title "$file_name" $a_node appendChild $img_node if { $li_mode_p } { set file_node [$dom_doc createElement li] @@ -2167,10 +2301,12 @@ set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}" 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}]" + $a_node setAttribute title "$file_name" 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" $img_node setAttribute alt "$file_name" + $img_node setAttribute title "$file_name" $a_node appendChild $img_node if { $li_mode_p } { set file_node [$dom_doc createElement li] @@ -2184,10 +2320,12 @@ db_foreach associated_urls { *SQL* } { 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 "[export_vars -base $url]"} resource_item_id run_id}]" + $a_node setAttribute title "$url" set img_node [$dom_doc createElement img] $img_node setAttribute src "[imsld::object_type_image_path -object_type url]" $img_node setAttribute border "0" $img_node setAttribute alt "$url" + $img_node setAttribute title "$url" $a_node appendChild $img_node if { $li_mode_p } { set file_node [$dom_doc createElement li] @@ -2236,6 +2374,7 @@ -resource_mode $resource_mode \ -dom_node $dom_node \ -dom_doc $dom_doc + } elseif { [db_0or1row is_support { select 1 from imsld_support_activitiesi where item_id = :activity_item_id }] } { @@ -2428,7 +2567,9 @@ } } } - if { [llength $linear_item_list ] > 0 } { $dom_node appendChild $description_node } + if { [llength $linear_item_list ] > 0 } { + $dom_node appendChild $description_node + } # prerequisites set prerequisites_node [$dom_doc createElement div] @@ -2478,7 +2619,7 @@ $feedback_head_node appendChild $text $feedback_node appendChild $feedback_head_node if { [db_0or1row completed_activity { *SQL* }] } { - if { ![string eq "" $on_completion_item_id] } { + if { ![string eq "" $on_completion_item_id] && [db_string is_feedback { *SQL* }] > 0 } { # the feedback is not processed to ckeck if all the activity resources have been finished # so we don't need to store the result imsld::process_feedback_as_ul -on_completion_item_id $on_completion_item_id \ @@ -2678,10 +2819,17 @@ @return A list of lists of the activities referenced from the activity structure } { + set imsld_package_id [ad_conn package_id] # auxiliary list to store the activities set completed_list [list] # get the structure info db_1row structure_info { *SQL* } + + # if any of the referenced activities from the activity structure doesn't have a completion restriction + # and the activity structure is of type "sequence", there wouldn't be a way to advance in the structure, + # so, if this is the case, the structure is treated as of type "selection" + set completion_restriction [imsld::structure_completion_resctriction_p -run_id $run_id -structure_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 { *SQL* }] { # get all the directly referenced activities (from the activity structure) @@ -2696,38 +2844,93 @@ select sort_order from imsld_as_la_rels where rel_id = :rel_id } set completed_p [db_0or1row completed_p { *SQL* }] + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] # show the activity only if: + # 0. the activity is visible # 1. it has been already completed # 2. if the structure-type is "selection" - # 3. if it is the next activity to be done (and structure-type is "sequence") - if { $completed_p || [string eq $complete_act_id ""] || [string eq $structure_type "selection"] || ([string eq $is_visible_p "t"] && [lsearch -exact $next_activity_id_list $activity_id] != -1) } { - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" + # 3. if the activity has no completion restriction + # 4. if it is the next activity to be done (and structure-type is "sequence") - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $activity_node appendChild $a_node + if { $completed_p || [string eq $complete_act_id ""] || [string eq $structure_type "selection"] || (([lsearch -exact $next_activity_id_list $activity_id] != -1) || !$completion_restriction) && [string eq $is_visible_p "t"] } { - set text [$dom_doc createTextNode " "] - $activity_node appendChild $text + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # bold letters + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + } - if { !$completed_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node - } + if { $completed_p } { + if { ![string eq $complete_act_id ""] } { + # the activity is finished + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } else { + + if { [string eq $user_choice_p "t"] } { + + # show the finish button + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $activity_node appendChild $input_node + } elseif { $started_activity_p } { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } set completed_list [linsert $completed_list $sort_order [$activity_node asList]] } } @@ -2737,38 +2940,93 @@ db_1row get_sort_order { select sort_order from imsld_as_sa_rels where rel_id = :rel_id } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] set completed_p [db_0or1row completed_p { *SQL* }] + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] + # show the activity only if: + # 0. the activity is visible # 1. it has been already completed # 2. if the structure-type is "selection" # 3. if it is the next activity to be done (and structure-type is "sequence") - if { $completed_p || [string eq $complete_act_id ""] || [string eq $structure_type "selection"] || ([string eq $is_visible_p "t"] && [lsearch -exact $next_activity_id_list $activity_id] != -1) } { - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $activity_node appendChild $a_node + # 4. if the activity has no completion restriction + if { [string eq $is_visible_p "t"] && ($completed_p || [string eq $complete_act_id ""] || [string eq $structure_type "selection"] || (([lsearch -exact $next_activity_id_list $activity_id] != -1) || !$completion_restriction) && [string eq $is_visible_p "t"] } { - set text [$dom_doc createTextNode " "] - $activity_node appendChild $text - - if { !$completed_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node - } + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # bold letters + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + + } + if { $completed_p } { + if { ![string eq $complete_act_id ""] } { + # the activity is finished + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } else { + if { [string eq $user_choice_p "t"] } { + + # show the finish button + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $activity_node appendChild $input_node + } elseif { $started_activity_p } { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } set completed_list [linsert $completed_list $sort_order [$activity_node asList]] } } @@ -2782,16 +3040,32 @@ db_1row get_sort_order { select sort_order from imsld_as_as_rels where rel_id = :rel_id } - set started_p [db_0or1row as_completed_p { *SQL* }] + set started_p [db_0or1row as_started_p { *SQL* }] + set completed_p [db_0or1row as_completed_p { *SQL* }] + + if { $started_p || [string eq $structure_type "selection"] } { - set structure_node [$dom_doc createElement li] - $structure_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $structure_node appendChild $a_node + if { $completed_p } { + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $structure_node appendChild $a_node + } else { + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $structure_node appendChild $b_node + } set nested_activities_list [imsld::generate_structure_activities_list -imsld_id $imsld_id \ -run_id $run_id \ @@ -2834,6 +3108,7 @@ where run_id = :run_id } # start with the role parts + set imsld_package_id [ad_conn package_id] set user_role_id [db_string current_role { select map.active_role_id as user_role_id @@ -2845,98 +3120,207 @@ and ar.object_id_two = :user_id and iruge.run_id = :run_id }] + set active_acts_list [imsld::active_acts -run_id $run_id -user_id $user_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] 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] + set act_id [lindex $role_part_list 3] + set act_item_id [lindex $role_part_list 4] + set play_id [lindex $role_part_list 5] + switch $type { learning { # add the learning activity to the tree db_1row get_learning_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] set completed_activity_p [db_0or1row already_completed { select 1 from imsld_status_user where related_id = :activity_id and user_id = :user_id and run_id = :run_id and status = 'finished' }] - if { $completed_activity_p || [lsearch -exact $next_activity_id_list $activity_id] != -1 && ([string eq $complete_act_id ""] || [string eq $is_visible_p "t"]) } { - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $activity_node appendChild $a_node + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] + if { $completed_activity_p || ([lsearch -exact $next_activity_id_list $activity_id] != -1) || ([string eq $complete_act_id ""] && [string eq $is_visible_p "t"] && [lsearch -exact $active_acts_list $act_item_id] != -1) } { - set text [$dom_doc createTextNode " "] - $activity_node appendChild $text - - if { !$completed_activity_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node - } + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + # bold letters + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # the activity has been started + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + + } + if { $completed_activity_p } { + + if { ![string eq $complete_act_id ""] } { + # the activity is finished + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } elseif { [string eq $is_visible_p "t"] } { + + if { [string eq $user_choice_p "t"] } { + + # show the finish button + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $activity_node appendChild $input_node + } elseif { $started_activity_p } { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } + $dom_node appendChild $activity_node } } support { # add the support activity to the tree db_1row get_support_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] set completed_activity_p [db_0or1row already_completed { select 1 from imsld_status_user where related_id = :activity_id and user_id = :user_id and run_id = :run_id and status = 'finished' }] - if { $completed_activity_p || [lsearch -exact $next_activity_id_list $activity_id] != -1 && ([string eq $complete_act_id ""] || [string eq $is_visible_p "t"]) } { - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $activity_node appendChild $a_node + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] - set text [$dom_doc createTextNode " "] - $activity_node appendChild $text - - if { !$completed_activity_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node - } + if { $completed_activity_p || ([lsearch -exact $next_activity_id_list $activity_id] != -1) || ([string eq $complete_act_id ""] && [string eq $is_visible_p "t"] && [lsearch -exact $active_acts_list $act_item_id] != -1) } { + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + if { !$started_activity_p && [string eq $is_visible_p "t"] } { + # bold letters + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # bold letters + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + } + if { $completed_activity_p } { + + if { ![string eq $complete_act_id ""] } { + # the activity is finished + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } else { + if { [string eq $user_choice_p "t"] } { + # show the finish button + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $activity_node appendChild $input_node + } elseif { $started_activity_p } { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } $dom_node appendChild $activity_node } } structure { # this is a special case since there are some conditions to check - # in order to determine if the referenced activities have to be shown + # in order to determine if the referenced activities have to be shown. # because of that the proc generate_structure_activities_list is called, # which returns a tcl list in tDOM format. @@ -2946,16 +3330,31 @@ # (if it is the next activity to be done then it should had been marked as started # in the "structure_next_activity" function. which is the case when structure-type is "sequence") db_1row get_activity_structure_info { *SQL* } - set started_p [db_0or1row as_completed_p { *SQL* }] + set started_p [db_0or1row as_started_p { *SQL* }] + set completed_p [db_0or1row as_completed_p { *SQL* }] if { $started_p } { - set structure_node [$dom_doc createElement li] - $structure_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" - $a_node setAttribute target "content" - set text [$dom_doc createTextNode "$activity_title"] - $a_node appendChild $text - $structure_node appendChild $a_node + if { $completed_p } { + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $structure_node appendChild $a_node + } else { + set structure_node [$dom_doc createElement li] + $structure_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $structure_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $structure_node appendChild $b_node + } + set nested_list [imsld::generate_structure_activities_list -imsld_id $imsld_id \ -run_id $run_id \ -structure_item_id $structure_item_id \ @@ -2997,8 +3396,8 @@ # NOTE: the activity will be shown only once, no matter from how many role parts it is referenced set user_role_id [db_string current_role { *SQL* }] + set imsld_package_id [ad_conn package_id] - # get the referenced activities to the role, assigned at runtime (notifications, level C) foreach activity_id [db_list runtime_activities { *SQL* } ] { @@ -3017,71 +3416,367 @@ learning { # add the learning activity to the tree db_1row get_learning_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] set completed_activity_p [db_0or1row la_already_completed { *SQL* }] - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $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 - - if { !$completed_activity_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] + + if { !$started_activity_p } { + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # bold letters + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + } + + + if { $completed_activity_p } { + + if { [string eq $user_choice_p "t"] } { + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } else { + + if { [string eq $user_choice_p "t"] } { + + # show the button to finish the activity + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-learning.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $b_node appendChild $input_node + + } elseif { $started_activity_p } { + + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } } - $dom_node appendChild $activity_node } support { # add the support activity to the tree db_1row get_support_activity_info { *SQL* } + set started_activity_p [db_0or1row already_started { + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] + set user_choice_p [db_string user_choice_p {select user_choice_p from imsld_complete_actsi where item_id = :complete_act_id and content_revision__is_live(complete_act_id) = 't'} -default "f"] set completed_activity_p [db_0or1row sa_already_completed { *SQL* }] - set activity_node [$dom_doc createElement li] - $activity_node setAttribute class "liOpen" - set a_node [$dom_doc createElement a] - $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" - $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 - - if { !$completed_activity_p } { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute style "vertical-align: bottom;" - $input_node setAttribute onclick "window.location=\"finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld\"" - $activity_node appendChild $input_node - } else { - set input_node [$dom_doc createElement input] - $input_node setAttribute type "checkbox" - $input_node setAttribute checked "true" - $input_node setAttribute disabled "true" - $activity_node appendChild $input_node + + if { !$started_activity_p } { + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set b_node [$dom_doc createElement b] + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $a_node setAttribute target "content" + set text [$dom_doc createTextNode "$activity_title"] + $a_node appendChild $text + $b_node appendChild $a_node + $activity_node appendChild $b_node + + set text [$dom_doc createTextNode " "] + $activity_node appendChild $text + } else { + # bold letters + set activity_node [$dom_doc createElement li] + $activity_node setAttribute class "liOpen" + set a_node [$dom_doc createElement a] + $a_node setAttribute href "[imsld::activity_url -activity_id $activity_id -run_id $run_id -user_id $user_id]" + $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 + } + + if { $completed_activity_p } { + + if { [string eq $user_choice_p "t"] } { + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/completed.png" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.finished]" + $img_node setAttribute title "[_ imsld.finished]" + $activity_node appendChild $img_node + + } else { + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } + } else { + if { [string eq $user_choice_p "t"] } { + + # show the button to finish the activity + set b_node [$dom_doc createElement b] + set input_node [$dom_doc createElement a] + $input_node setAttribute href "finish-component-element-${imsld_id}-${run_id}-${play_id}-${act_id}-${role_part_id}-${activity_id}-support.imsld" + $input_node setAttribute class "finish" + $input_node setAttribute title "[_ imsld.finish_activity]" + set text [$dom_doc createTextNode "[_ imsld.finish]"] + $input_node appendChild $text + $b_node appendChild $input_node + $activity_node appendChild $b_node + + } elseif { $started_activity_p } { + + # the activity has been viewed + set img_node [$dom_doc createElement img] + $img_node setAttribute src "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]/resources/viewed.ico" + $img_node setAttribute border "0" + $img_node setAttribute alt "[_ imsld.Viewed]" + $img_node setAttribute title "[_ imsld.Viewed]" + $activity_node appendChild $img_node + } } - $dom_node appendChild $activity_node } } } } +ad_proc -public imsld::structure_completion_resctriction_p { + -run_id:required + -structure_item_id:required +} { + @param run_id + @param structure_item_id + + @return Returns 0 if any of the referenced activities from the structure_id doesn't have a completion restriction +} { + + foreach referenced_activity [db_list_of_lists struct_referenced_activities { + select ar.object_id_two, + ar.rel_type + from acs_rels ar, imsld_activity_structuresi ias + where ar.object_id_one = ias.item_id + and ias.item_id = :structure_item_id + and content_revision__is_live(ias.structure_id) = 't' + 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] + switch $rel_type { + imsld_as_la_rel { + if { [string eq "" [db_string la_completion_restriction { + select complete_act_id + from imsld_learning_activitiesi + where item_id = :object_id_two + and content_revision__is_live(activity_id) = 't' + }]] } { + # no restriction found, break + return 0 + } + } + imsld_as_sa_rel { + if { [string eq "" [db_string sa_completion_restriction { + select complete_act_id + from imsld_support_activitiesi + where item_id = :object_id_two + and content_revision__is_live(activity_id) = 't' + }]] } { + # no restriction found, break + return 0 + } + } + imsld_as_as_rel { + # search recursively trough the referenced activities + return [imsld::structure_completion_resctriction_p -run_id $run_id -structure_item_id $object_id_two] + } + } + } + # every referenced activity has a completion restriction + return 1 +} + +ad_proc -public imsld::active_acts { + -run_id:required + -user_id:required + {-previous_list {}} +} { + @param run_id + @param user + @param previous_list + + @return Returns the list of possible active acts for the user +} { + set active_acts_list [list] + + set all_acts_list [db_list get_acts_in_run { + select iai.act_id + from imsld_runs ir, + imsld_imsldsi iii, + imsld_methodsi imi, + imsld_playsi ipi, + imsld_actsi iai + where ir.run_id=:run_id + and iii.imsld_id=ir.imsld_id + and imi.imsld_id=iii.item_id + and imi.item_id=ipi.method_id + and iai.play_id=ipi.item_id + order by ipi.sort_order, iai.sort_order + }] + set i 0 + set continue 1 + while { $i < [llength $all_acts_list] && $continue == 1 } { + set act_in_run [lindex $all_acts_list $i] + incr i + # let's see if the user participates in the act + if { [imsld::user_participate_p -run_id $run_id -act_id $act_in_run -user_id $user_id] \ + && ![imsld::act_finished_p -run_id $run_id -act_id $act_in_run -user_id $user_id] } { + # let's see if the act doesn't have any completion restriction: + # 1. time-limit + # 2. when-property-is-set + # 3. when-condition-true + # 4. when role-part-is-completed + # 5. any referenced activity structure (which by default have a completion restriction) + set act_in_run_item_id [content::revision::item_id -revision_id $act_in_run] + + # 1. time-limit, 2. when-property-is-set, 3. when-condition-true: all the info is stored via complete_act_id in the acts table + if { ![string eq "" [db_string complete_act_id {select complete_act_id from imsld_acts where act_id = :act_in_run}]] && [lsearch -exact $previous_list $act_in_run_item_id] == -1 } { + # there is a completion restriction, stop here + lappend active_acts_list $act_in_run_item_id + break + } + + # 4. when role-part-is-completed, 5. referenced activity structures + # This is a special case, since if any of the activities referenced by the role part doesn't have a completion restriction + # then the act has to be appended to the list + # Note: The role parts that finish the act are mapped to the act via imsld_act_rp_completed_rel (acs_rels) + + set role_parts_list [db_list related_role_parts { + select item_id + from imsld_role_partsi + where act_id = :act_in_run_item_id + and content_revision__is_live(role_part_id) = 't' + order by sort_order + }] + foreach role_part_item_id $role_parts_list { + # get all the activities in the role part and see if none has any compleion resctriction + + db_1row get_role_part_activity { + select case + when learning_activity_id is not null + then 'learning' + when support_activity_id is not null + then 'support' + when activity_structure_id is not null + then 'structure' + else 'none' + end as type, + learning_activity_id, + support_activity_id, + activity_structure_id + from imsld_role_partsi + where item_id = :role_part_item_id + and content_revision__is_live(role_part_id) = 't' + } + set continue 0 + # check if the referenced activities have been finished + switch $type { + learning { + if { [string eq "" [db_string la_completion_restriction { + select complete_act_id + from imsld_learning_activitiesi + where item_id = :learning_activity_id + and content_revision__is_live(activity_id) = 't' + }]] } { + # activity without restriction found, + # append the act to the list of active acts + set continue 1 + break + } + } + support { + if { [string eq "" [db_string sa_completion_restriction { + select complete_act_id + from imsld_support_activitiesi + where item_id = :support_activity_id + and content_revision__is_live(activity_id) = 't' + }]] } { + # activity without restriction found, + # append the act to the list of active acts + set continue 1 + break + } + } + structure { + # every activity structure has a completion restriction (at leat, every activity must be visited) + # so we can stop here + set continue 0 + break + } + } + } + # if we reached this point, the act must be shown + if { [lsearch -exact $previous_list $act_in_run_item_id] == -1 } { + # add the act to the list only if it wasn't in the list already + lappend active_acts_list $act_in_run_item_id + } + } + } + return [concat $previous_list $active_acts_list] +} + ad_proc -public imsld::get_next_activity_list { -run_id:required {-user_id ""} @@ -3182,6 +3877,7 @@ } continue } + if { ![imsld::act_finished_p -run_id $run_id -act_id $act_id -user_id $user_id] } { if {[imsld::user_participate_p -run_id $run_id -act_id $act_id -user_id $user_id]} { lappend next_act_item_id_list [content::revision::item_id -revision_id $act_id] @@ -3233,6 +3929,9 @@ } } + # append to the list of "active acts" those which don't have any "completion" restrictions + set next_act_item_id_list [imsld::active_acts -run_id $run_id -user_id $user_id -previous_list $next_act_item_id_list] + # 1. for each act in the next_act_id_list # 1.2. for each role_part in the act # 1.2.1 find the next activity referenced by the role_part @@ -3241,7 +3940,6 @@ # 2.2.1.2 if it is an activity structure we have verify which activities are already completed and return the next # activity in the activity structure, handling the case when the next activity is also an activity structure - set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] set next_activity_id_list [list] foreach act_item_id $next_act_item_id_list { @@ -3509,7 +4207,7 @@ set activity_id [lindex $activity_list 0] set activity_item_id [lindex $activity_list 1] set activity_type [lindex $activity_list 2] - + #get info set role_part_id_list [imsld::get_role_part_from_activity -activity_type $activity_type -leaf_id $activity_item_id] set imsld_id [imsld::get_imsld_from_activity -activity_id $activity_id -activity_type $activity_type] @@ -3526,12 +4224,23 @@ switch $activity_type { learning { set first_resources_item_list [imsld::process_learning_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] + set completion_restriction [db_string la_completion_restriction { + select complete_act_id + from imsld_learning_activities + where activity_id = :activity_id + } -default ""] } support { set first_resources_item_list [imsld::process_support_activity_as_ul -run_id $run_id -activity_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] + set completion_restriction [db_string la_completion_restriction { + select complete_act_id + from imsld_support_activities + where activity_id = :activity_id + } -default ""] } structure { set first_resources_item_list [imsld::process_activity_structure_as_ul -run_id $run_id -structure_item_id $activity_item_id -resource_mode "t" -dom_node $foo_node -dom_doc $foo_doc] + set completion_restriction t } } @@ -3561,7 +4270,7 @@ } #if all are finished, tag the activity as finished - if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] } { + if { $all_finished_p && ![db_0or1row already_finished { *SQL* }] && [string eq $completion_restriction ""] } { foreach role_part_id $role_part_id_list { db_1row context_info { select acts.act_id, @@ -3871,5 +4580,6 @@ } } } + ad_register_proc GET /finish-component-element* 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.37 -r1.38 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 25 Apr 2007 10:52:30 -0000 1.37 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 17 Apr 2008 17:18:16 -0000 1.38 @@ -750,7 +750,7 @@ <querytext> select ias.structure_id, ias.item_id as structure_item_id, - ias.number_to_select + coalesce(ias.number_to_select, 0) as number_to_select from acs_rels ar, imsld_activity_structuresi ias, cr_items cri where ar.object_id_one = ias.item_id and ar.object_id_two = cri.item_id @@ -898,7 +898,8 @@ <fullquery name="imsld::structure_next_activity.get_la_info"> <querytext> - select la.activity_id as learning_activity_id + select la.activity_id as learning_activity_id, + complete_act_id from imsld_learning_activitiesi la where la.item_id = :object_id_two and content_revision__is_live(la.activity_id) = 't' @@ -1602,7 +1603,8 @@ la.learning_objective_id as learning_objective_item_id, la.activity_id, la.title as activity_title - from imsld_learning_activitiesi la, imsld_attribute_instances attr + from imsld_attribute_instances attr, + imsld_learning_activitiesi la where la.item_id = :activity_item_id and content_revision__is_live(la.activity_id) = 't' and attr.owner_id = la.activity_id @@ -1668,6 +1670,14 @@ </querytext> </fullquery> + <fullquery name="imsld::process_learning_activity_as_ul.is_feedback"> + <querytext> + + select count(*) from acs_rels where object_id_one = :on_completion_item_id and rel_type = 'imsld_feedback_rel' + + </querytext> + </fullquery> + <fullquery name="imsld::process_learning_activity_as_ul.la_associated_environments"> <querytext> @@ -1896,7 +1906,7 @@ </querytext> </fullquery> - <fullquery name="imsld::generate_structure_activities_list.as_completed_p"> + <fullquery name="imsld::generate_structure_activities_list.as_started_p"> <querytext> select 1 from imsld_status_user @@ -1908,6 +1918,18 @@ </querytext> </fullquery> + <fullquery name="imsld::generate_structure_activities_list.as_completed_p"> + <querytext> + + select 1 from imsld_status_user + where related_id = :structure_id + and user_id = :user_id + and status = 'finish' + and run_id = :run_id + + </querytext> + </fullquery> + <fullquery name="imsld::generate_activities_tree.current_role"> <querytext> @@ -1938,6 +1960,7 @@ 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, + ia.item_id as act_item_id, ip.play_id from imsld_role_partsi rp, imsld_actsi ia, imsld_playsi ip, imsld_imsldsi ii, imsld_attribute_instances attr, imsld_methodsi im,imsld_rolesi iri @@ -2008,7 +2031,7 @@ </querytext> </fullquery> - <fullquery name="imsld::generate_activities_tree.as_completed_p"> + <fullquery name="imsld::generate_activities_tree.as_started_p"> <querytext> select 1 from imsld_status_user @@ -2020,6 +2043,18 @@ </querytext> </fullquery> + <fullquery name="imsld::generate_activities_tree.as_completed_p"> + <querytext> + + select 1 from imsld_status_user + where related_id = :activity_id + and user_id = :user_id + and status = 'finished' + and run_id = :run_id + + </querytext> + </fullquery> + <fullquery name="imsld::generate_runtime_assigned_activities_tree.imsld_info"> <querytext> 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.17 -r1.18 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 16 Jan 2008 10:30:40 -0000 1.17 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 17 Apr 2008 17:18:16 -0000 1.18 @@ -40,21 +40,25 @@ imsld_properties prop where ins.instance_id = :instance_id and ins.property_id = prop.property_id + and content_revision__is_live(ins.instance_id) = 't' } # db_dml update_instance_value { *SQL* } - set instance_item_id [imsld::item_revision_new -attributes [list [list run_id $run_id] \ - [list value $value] \ - [list identifier $identifier] \ - [list party_id $party_id] \ - [list property_id $property_id]] \ - -content_type imsld_property_instance \ - -title $title \ - -item_id $item_id] + set instance_item_id \ + [imsld::item_revision_new -attributes \ + [list [list run_id $run_id] \ + [list value $value] \ + [list identifier $identifier] \ + [list party_id $party_id] \ + [list property_id $property_id]] \ + -content_type imsld_property_instance \ + -title $title \ + -item_id $item_id] if { [string eq "file" $datatype] } { - set instance_id [content::item::get_live_revision -item_id $instance_item_id] + set instance_id \ + [content::item::get_live_revision -item_id $instance_item_id] # Get the filename part of the upload file if { ![regexp {[^//\\]+$} $upload_file file_name] } { @@ -64,10 +68,13 @@ set mime_type [cr_filename_to_mime_type -create $file_name] # database_p according to the file storage parameter - set fs_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ - -package_key "file-storage"] - set database_p [parameter::get -parameter "StoreFilesInDatabaseP" -package_id $fs_package_id] + set fs_package_id \ + [site_node_apm_integration::get_child_package_id \ + -package_id [dotlrn_community::get_package_id \ + [dotlrn_community::get_community_id]] \ + -package_key "file-storage"] + set database_p [parameter::get -parameter \ + "StoreFilesInDatabaseP" -package_id $fs_package_id] set content_length [file size $tmpfile] if { !$database_p } { # create the new item @@ -86,7 +93,8 @@ set lob = [set __lob_id [db_string get_lob_id "select empty_lob()"]] where revision_id = :instance_id" -blob_files [list $tmpfile] - # Unfortunately, we can only calculate the file size after the lob is uploaded + # Unfortunately, we can only calculate the file size after the lob + # is uploaded db_dml lob_size { update cr_revisions set content_length = :content_length @@ -104,26 +112,25 @@ {-property_id ""} {-upload_file ""} {-tmpfile ""} + {-role_instance_id ""} } { - Sets a property to the given value. If some restriction is violated returns 0 and an explanation. + Sets a property to the given value. If some restriction is violated returns + 0 and an explanation. } { upvar recursivity_count recursivity_count - # 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 ""] } { + # context info in case we need to obtain the property_id from the identifier + db_1row context_info { + select ic.item_id as component_item_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 + } db_1row property_info_from_identifier { select type, property_id, @@ -144,16 +151,19 @@ } } - # instance info - set role_instance_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 - } + # instance info there are two places where this proc is called: from + # run-time procs or from the monitor interface if we are inside the monitor + # interface, we know the role_instance_id, otherwise we have to find it out + if { [string eq "" $role_instance_id] && [string eq $type "locrole"] } { + if { ![string eq $role_id ""] } { + # find the role instance we are working on + 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 + util_user_message -message "[_ imsld.lt_User_does_not_belong_]" + ad_script_abort + } + } } db_1row get_property_instance { @@ -248,7 +258,8 @@ # Recursive call only if the property value has changed if { $old_value != $value } { - # There might be infinite recursive loops, so the counter recursivity_count is used to avoid crashing the server + # There might be infinite recursive loops, so the counter + # recursivity_count is used to avoid crashing the server if { ![exists_and_not_null recursivity_count] } { # this is the first recursive call, initialize the variable set recursivity_count 1 @@ -266,14 +277,14 @@ } set conditions_list [db_list get_conditions_from_property { - select ici.condition_id - 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 + select ici.condition_id + 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 }] #property conditions foreach member_id [db_list user_in_run { @@ -300,11 +311,11 @@ } # 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 - # n.b. this won't generate endless loops - + # 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 # n.b. this + # won't generate endless loops foreach when_cond_true_item_id [db_list when_condition_true { select ar.object_id_two as when_cond_true_item_id from acs_rels ar, @@ -317,10 +328,10 @@ } # 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 - # n.b. this won't generate endless loops + # 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 # n.b. this won't generate endless loops foreach complete_act_item_id [db_list when_prop_value_is_set { select ar.object_id_two as complete_act_item_id @@ -330,10 +341,12 @@ 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 + imsld::condition::eval_when_prop_value_is_set \ + -complete_act_item_id $complete_act_item_id -run_id $run_id } - # role conditions, time conditions... the rest of conditions must be evaluated every time a property value changes + # role conditions, time conditions... the rest of conditions must be + # evaluated every time a property value changes imsld::condition::execute_time_role_conditions -run_id $run_id } } @@ -399,8 +412,8 @@ 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 + util_user_message -message "[_ imsld.lt_User_does_not_belong_]" + ad_script_abort } } @@ -602,7 +615,7 @@ select gmm.member_id from group_member_map gmm, imsld_run_users_group_ext iruge, - acs_rels ar1 + 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 Index: openacs-4/packages/imsld/www/activity-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/imsld/www/activity-frame.adp 30 May 2007 08:36:22 -0000 1.15 +++ openacs-4/packages/imsld/www/activity-frame.adp 17 Apr 2008 17:17:54 -0000 1.16 @@ -1,137 +1,37 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<master src="../lib/imsld-master"> + <property name="onload">init_activity()</property> + <property name="header_stuff"> + <script type="text/javascript"> + /* Optional: Temporarily hide the "tabber" class so it does not "flash" + on the page as plain HTML. After tabber runs, the class is changed + to "tabberlive" and it will appear. */ -<script type="text/javascript" src="/resources/imsld/tabber.js"></script> -<script type="text/javascript" src="/resources/imsld/dynamicselect.js"></script> -<link rel="stylesheet" href="/resources/imsld/example.css" TYPE="text/css" MEDIA="screen"> -<link rel="stylesheet" href="/resources/imsld/example-print.css" TYPE="text/css" MEDIA="print"> + document.write('<style type="text/css">.tabber{display:none;}<\/style>'); + </script> + </property> + <property name="imsld_content_frame">1</property> -<script type="text/javascript"> + <if @roles_template_p@ eq 1> + <include src="support-activity-roles" + supported_roles="@supported_roles@" + run_id=@run_id@ + activity_id=@activity_id@ + supported_user_id=@supported_user_id@> + <div class="hide"> + <a href="@activities;noquote@" title="#imsld.Activities#"></a> + </div> + </if> + <else> + @activities;noquote@ + <!-- This message should appear only if there is more than one link! --> + <p class="notice">#imsld.navigate#</p> + </else> -/* Optional: Temporarily hide the "tabber" class so it does not "flash" - on the page as plain HTML. After tabber runs, the class is changed - to "tabberlive" and it will appear. */ + <iframe id="object" name="object"></iframe> -document.write('<style type="text/css">.tabber{display:none;}<\/style>'); -</script> + <script type="text/javascript"> + <if @roles_template_p@ eq 1> + dynamicSelect("supported-roles", "user-roles"); + </if> + </script> -<style type="text/css"> -<!-- -html {margin:13px; border:15px; padding:3px;} -body {margin:3px; border:3px; padding:5px;} ---> -</style> -<SCRIPT> - function confirmValue(myform){ - myform.submit() - } -</SCRIPT> -</head> -<body> - -<span id="addc1" style="position:absolute;top:0px;left:0px;"> -<a href="#" onClick="return _tp(false)" title="Hide panel" class="show-hide-icon_link"><img src="/resources/acs-subsite/stock_left.png" alt="#imsld.Hide#" border="0" align="top"/></a> -</span> -<span id="addc" style="display:none;position:absolute;top:0px;left:0px;"> -<a href="#" onClick="return _tp(true)" title="Show panel" class="show-hide-icon_link"><img src="/resources/acs-subsite/stock_right.png" alt="#imsld.Show#" border="0" align="top"/></a> -</span> - -<if @roles_template_p@ eq 1> - <include src="support-activity-roles" supported_roles="@supported_roles@" run_id=@run_id@ activity_id=@activity_id@ supported_user_id=@supported_user_id@> - -<div style="display:none;"> -<a href="@activities;noquote@"></a> -</div> -</if> -<else> -@activities;noquote@ -</else> - -<iframe id="object" name="object"></iframe> - -</body> -<script type="text/javascript"> -function resizeobject() { -f = document.forms[0]; -o = document.getElementById('object'); -var bodies = document.getElementsByTagName("body"); -var body = bodies[0]; -if (document.documentElement && document.documentElement.currentStyle && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth != 0) -{ -o.width = document.documentElement.clientWidth + 2*parseInt(document.documentElement.currentStyle.borderWidth,10) - o.style.left; -o.height = document.documentElement.clientHeight + 2*parseInt(document.documentElement.currentStyle.borderWidth,10) - o.style.top; -} -else if (document.all && document.body && typeof document.body.clientWidth != "undefined") -{ -o.width = document.body.clientWidth + 2*parseInt(document.body.currentStyle.borderWidth,10) - o.style.left; -o.height = document.body.clientHeight + 2*parseInt(document.body.currentStyle.borderWidth,10) - o.style.top; -} -else if (window.innerWidth) -{ -o.width = window.innerWidth - o.style.left - 30; -o.height = window.innerHeight - o.style.top - 50; -} -else if (document.body && typeof document.body.clientWidth != "undefined") -{ -o.width = document.body.clientWidth - o.style.left; -o.height = document.body.clientHeight - o.style.top; -}; - -} -resizeobject(); -window.onresize = resizeobject; - -function objecturl(url) { -var o = document.getElementById('object'); -o.src = url; -} - -</script> - -<script type="text/javascript"> -var as = document.getElementsByTagName("a"); -for (var i = 0; i < as.length; i++) { - var a = as[i]; - a.setAttribute('target', 'object'); -} -for (var i = 0; i < as.length; i++) { - if (!as[i].getAttribute('href').match(/#/i)) { - document.getElementById('object').src = as[i].getAttribute('href'); - break; - } -} -</script> - -<script type="text/javascript"> -function _tp(a){ - var ab=document.getElementById("addc"); - var ac=document.getElementById("addc1"); - - if (a) { - ai=''; - aj='none'; - parent.document.getElementsByTagName("frameset")[0].cols='30%,*'; - } else { - ai='none'; - aj=''; - parent.document.getElementsByTagName("frameset")[0].cols='0%,*'; - } - - ac.style.display=ai; - ab.style.display=aj; - - return false; -} - - -</script> - -<if @roles_template_p@ not nil> - <script type="text/javascript"> - dynamicSelect("supported-roles", "user-roles"); - </script> -</if> - -</html> 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.16 -r1.17 --- openacs-4/packages/imsld/www/activity-frame.tcl 25 Apr 2007 10:52:30 -0000 1.16 +++ openacs-4/packages/imsld/www/activity-frame.tcl 17 Apr 2008 17:17:54 -0000 1.17 @@ -52,6 +52,167 @@ ) } +set activity_item_id [content::revision::item_id -revision_id $activity_id] + +set referencer_structure_item_id "" + +if { [string eq $activity_type "learning"] } { + if { [string eq "" [db_string completion_restriction {select complete_act_id from imsld_learning_activities where activity_id = :activity_id}]] } { + # the learning activity has been visited and doesn't have any completion restriction. + # if it is referenced from an activity structure, verify if every referenced activity have been visted + db_0or1row referenced_from_structure_p { + select ar.object_id_one as referencer_structure_item_id + from acs_rels ar + where ar.object_id_two = :activity_item_id + } + } +} elseif { [string eq $activity_type "support"] } { + if { [string eq "" [db_string completion_restriction {select complete_act_id from imsld_support_activities where activity_id = :activity_id}]] } { + # the learning activity has been visited and doesn't have any completion restriction. + # if it is referenced from an activity structure, verify if every referenced activity have been visted + db_0or1row referenced_from_structure_p { + select ar.object_id_one as referencer_structure_item_id + from acs_rels ar + where ar.object_id_two = :activity_item_id + } + } +} + +if { ![string eq "" $referencer_structure_item_id] } { + db_1row get_structure_info { + select structure_id, + number_to_select + from imsld_activity_structuresi + where item_id = :referencer_structure_item_id + and content_revision__is_live(structure_id) = 't' + } + + # if the structure hasn't been finished + if { ![db_0or1row already_finished { + select 1 + from imsld_status_user + where related_id = :structure_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] } { + set mark_structure_finished_p 1 + set total_completed 0 + foreach referenced_activity [db_list_of_lists struct_referenced_activities { + select ar.object_id_two, + ar.rel_type + from acs_rels ar + where ar.object_id_one = :referencer_structure_item_id + order by ar.object_id_two + }] { + set object_id_two [lindex $referenced_activity 0] + set rel_type [lindex $referenced_activity 1] + switch $rel_type { + imsld_as_la_rel { + # if the activity doesn't have any completrion restriction + # and it hasn't been started, cancel the completion of the structure + set referenced_activity_id [content::item::get_live_revision -item_id $object_id_two] + set la_completion_restriction [db_string la_completion_restriction { + select complete_act_id + from imsld_learning_activities + where activity_id = :referenced_activity_id + }] + if { ([db_0or1row la_already_started_p { + select 1 + from imsld_status_user + where related_id = :referenced_activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] && [string eq "" $la_completion_restriction]) \ + || [db_0or1row la_already_finished { + select 1 + from imsld_status_user + where related_id = :referenced_activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] } { + # the activity has been visited + incr total_completed + } else { + set mark_structure_finished_p 0 + continue + } + } + imsld_as_sa_rel { + # if the activity doesn't have any completrion restriction + # and it hasn't been started, cancel the completion of the structure + set referenced_activity_id [content::item::get_live_revision -item_id $object_id_two] + if { ([db_0or1row la_already_started_p { + select 1 + from imsld_status_user + where related_id = :referenced_activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'started' + }] && [string eq "" $sa_completion_restriction]) \ + || [db_0or1row la_already_finished { + select 1 + from imsld_status_user + where related_id = :referenced_activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] } { + # the activity has been visited + incr total_completed + } else { + set mark_structure_finished_p 0 + continue + } + } imsld_as_as_rel { + # if the referenced activity structure hasn't been finished, don't finish the activity structure + set structure_id [content::item::get_live_revision -item_id $object_id_two] + if { ![db_0or1row sa_already_finished_p { + select 1 + from imsld_status_user + where related_id = :referenced_activity_id + and user_id = :user_id + and run_id = :run_id + and status = 'finished' + }] } { + set mark_structure_finished_p 0 + continue + } else { + incr total_completed + } + } + } + } + if { $mark_structure_finished_p || (![string eq $number_to_select ""] && ($total_completed >= $number_to_select)) } { + # mark the structure as finished + + set role_part_id_list [imsld::get_role_part_from_activity -activity_type structure -leaf_id $referencer_structure_item_id] + 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 $structure_id \ + -type structure \ + -user_id $user_id \ + -code_call + } + } + } +} + set supported_roles [db_list supported_roles_list { select iri.role_id from imsld_rolesi iri, acs_rels ar, @@ -74,7 +235,6 @@ set activity_item_id [content::revision::item_id -revision_id $activity_id] imsld::process_activity_as_ul -activity_item_id $activity_item_id -run_id $run_id -dom_doc $doc -dom_node $dom_root - if { ![string eq $activity_id ""] && [db_0or1row get_table_name { select case @@ -161,6 +321,5 @@ set activities [export_vars -base "imsld-content-serve" -url { run_id resource_item_id role_id {owner_user_id $supported_user_id} }] } - set page_title {} set context [list] Index: openacs-4/packages/imsld/www/environment-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/environment-frame.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/environment-frame.adp 30 May 2007 08:36:22 -0000 1.6 +++ openacs-4/packages/imsld/www/environment-frame.adp 17 Apr 2008 17:17:54 -0000 1.7 @@ -1,36 +1,19 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <script src="/resources/acs-templating/mktree.js" language="javascript"></script> - <link rel="stylesheet" href="/resources/acs-templating/mktree.css" media="all"> -<style type="text/css"> -ul { -font-family: Verdana, Arial, Helvetica, sans-serif; -font-size: 12px; -font-style: normal; -font-weight: normal; -font-variant: normal; -text-decoration: none; -text-transform: none; -text-indent: 0px; -padding: 0px; -margin: 0px; -} -</style> -</head> -<body> +<master src="../lib/imsld-master"> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + <property name="imsld_include_mktree">1</property> -@environments;noquote@ + <div class="frame-header">@frame_header@</div> -</body> + <if @environments@ not nil>@environments;noquote@</if> -<script type="text/javascript"> -var as = document.getElementsByTagName("a"); -for (var i = 0; i < as.length; i++) { - var a = as[i]; - a.setAttribute('target', 'content'); -} -</script> + <script type="text/javascript"> + var as = document.getElementsByTagName("a"); + for (var i = 0; i < as.length; i++) { + var a = as[i]; + a.setAttribute('target', 'content'); + } + </script> -</html> + + Index: openacs-4/packages/imsld/www/environment-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/environment-frame.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/www/environment-frame.tcl 30 May 2007 08:36:22 -0000 1.9 +++ openacs-4/packages/imsld/www/environment-frame.tcl 17 Apr 2008 17:17:54 -0000 1.10 @@ -11,36 +11,28 @@ set user_id [ad_conn user_id] +set frame_header "[_ imsld.Context_info]" +set page_title $frame_header +set context [list] + dom createDocument ul doc set dom_root [$doc documentElement] -#set environments_node_ul [$doc createElement ul] -set environments_node_li [$doc createElement li] -set text [$doc createTextNode "[_ imsld.Context_info]"] -$environments_node_li appendChild $text -set environments_node [$doc createElement ul] -$environments_node setAttribute class "mktree" -$environments_node setAttribute style "white-space: nowrap;" +# Create the ul element which will hold all the environment info +$dom_root setAttribute class "mktree" +$dom_root setAttribute style "white-space: nowrap;" -# FIX-ME: if the ul is empty, the browser shows the ul incorrectly -set text [$doc createTextNode ""] -$environments_node appendChild $text - +# Create the li nodes for each environment set activity_item_id [content::revision::item_id -revision_id $activity_id] - -imsld::process_activity_environments_as_ul -activity_item_id $activity_item_id \ +imsld::process_activity_environments_as_ul \ + -activity_item_id $activity_item_id \ -run_id $run_id \ - -dom_node $environments_node \ + -dom_node $dom_root \ -dom_doc $doc -$dom_root appendChild $environments_node_li -set environments_node_li [$doc createElement li] -$environments_node_li setAttribute class "liOpen" +# Set the result only if it is not empty +if { [$dom_root hasChildNodes]} { + # Set the result + set environments [$dom_root asXML] +} -$environments_node_li appendChild $environments_node -$dom_root appendChild $environments_node_li - -set environments [$dom_root asXML] - -set page_title {} -set context [list] 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.20 -r1.21 --- openacs-4/packages/imsld/www/imsld-content-serve.tcl 25 Apr 2007 10:52:30 -0000 1.20 +++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 17 Apr 2008 17:17:54 -0000 1.21 @@ -1,7 +1,8 @@ # packages/imsld/www/imsld-content-serve.tcl ad_page_contract { - Process an imsldcontent resource, changing the view and set properties tags with their respective HTML + Process an imsldcontent resource, changing the view and set properties tags + with their respective HTML @creation-date Jun 2006 @author jopez@inv.it.uc3m.s @@ -18,6 +19,22 @@ set owner_user_id [ad_conn user_id] } +# If no role_id is given, take the active role +if { [string eq $role_id ""] } { + #get the user active role + db_1row get_active_role { + select iruns.active_role_id as role_id + from imsld_run_users_group_rels iruns, + acs_rels ar, + imsld_run_users_group_ext iruge + where iruge.run_id=:run_id + and ar.object_id_one=iruge.group_id + and ar.object_id_two=:owner_user_id + and ar.rel_type='imsld_run_users_group_rel' + and ar.rel_id=iruns.rel_id + } +} + # get file info db_1row get_info { select cr.revision_id, @@ -41,7 +58,10 @@ 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 + 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 @@ -51,9 +71,9 @@ # Get file-storage root folder_id set fs_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ + -package_id [dotlrn_community::get_package_id \ + [dotlrn_community::get_community_id]] \ -package_key "file-storage"] -set root_folder_id [fs::get_root_folder -package_id $fs_package_id] # Parser # XML => DOM document @@ -67,12 +87,17 @@ $dom_doc documentElement dom_root # procedure: -# currently we only deliver properties of one user at the same time in one given role +# currently we only deliver properties of one user at the same time in one +# given role # 1. replace the view-property tags with the property title(optional) and value -# 2. replace the view-property-group tags with the properties titles(optional) and value of all the referenced properties -# 3. replace the set-property tags with input fields depending on the property type -# 4. replace the set-groperty-group tags with one input field per each referenced property in the group -# 5. if there was at least one set-property* tag, add a submit button (FIX ME: currently for each set-property* a new form is added) +# 2. replace the view-property-group tags with the properties titles(optional) +# and value of all the referenced properties +# 3. replace the set-property tags with input fields depending on the property +# type +# 4. replace the set-groperty-group tags with one input field per each +# referenced property in the group +# 5. if there was at least one set-property* tag, add a submit button (FIX ME: +# currently for each set-property* a new form is added) # 6. for each class, check the visibility value in the database # 1. view-property nodes @@ -83,8 +108,8 @@ set view [$view_property_node getAttribute view "value"] set property_of [$view_property_node getAttribute property-of "self"] - # get the value, depending on the property type. - # the only different case is when viewing the proprty in the context of the role + # get the value, depending on the property type. the only different case + # is when viewing the proprty in the context of the role set role_instance_id 0 # get property info @@ -96,9 +121,14 @@ and identifier = :identifier } - if { ![string eq $property_of "self"] } { + if { ![string eq $property_of "self"] || + [string eq $type "locrole"] } { # 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 $owner_user_id] + set role_instance_id \ + [imsld::roles::get_user_role_instance \ + -run_id $run_id \ + -role_id $role_id \ + -user_id $owner_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" @@ -110,34 +140,54 @@ select ins.property_id, prop.datatype, coalesce(ins.value, prop.initial_value) as value, - ins.title, + coalesce(ins.title, ins.identifier) as title, content_revision__get_content(cr.revision_id) as content, ins.instance_id, ins.object_id, - ins.parent_id + ins.parent_id, + prop.type as property_type from imsld_property_instancesx ins, cr_revisions cr, - imsld_properties prop + imsld_propertiesi prop where ins.property_id = prop.property_id and prop.property_id = :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 = :owner_user_id) - or (prop.type = 'locrole' and ins.run_id = :run_id and ins.party_id = :role_instance_id) + or (prop.type = 'locpers' and + ins.run_id = :run_id and ins.party_id = :owner_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 = :owner_user_id)) and cr.revision_id = ins.instance_id and content_revision__is_live(ins.instance_id) = 't' } - # prepare replacement - # by the moment, the only different case are the properties of type file + # prepare replacement by the moment, the only different case are the + # properties of type file switch $datatype { file { set a_node "" if { ![string eq "" $content] } { - set folder_path [db_exec_plsql get_folder_path { - select content_item__get_path(:parent_id,:root_folder_id); - }] + # This is incorrect for global properties. It only works for + # local ones because root_folder_id is always obtained for the + # package + if { [string eq $property_type "global"] || + [string eq $property_type "globpers"] } { + # global or globpers properties + set root_folder_id [dotlrn_fs::get_dotlrn_root_folder_id] + set url_prefix \ + [site_node_object_map::get_url \ + -object_id $root_folder_id] + } else { + set root_folder_id \ + [fs::get_root_folder -package_id $fs_package_id] + set url_prefix [apm_package_url_from_id $fs_package_id] + } + + set folder_path \ + [content::item::get_path -item_id $parent_id \ + -root_folder_id $root_folder_id] + db_1row get_fs_file_url { select case @@ -149,7 +199,7 @@ from fs_objects fs where fs.live_revision = :instance_id } - set file_url "[apm_package_url_from_id $fs_package_id]view/${file_url}" + set file_url "${url_prefix}view/${file_url}" set a_node [$dom_doc createElement a] $a_node setAttribute href [export_vars -base "$file_url"] $a_node appendChild [$dom_doc createTextNode "[_ imsld.view_file]"] @@ -223,7 +273,7 @@ select ins.property_id, prop.datatype, coalesce(ins.value, prop.initial_value) as value, - ins.title, + coalesce(ins.title, ins.identifier) as title, content_revision__get_content(cr.revision_id) as content, ins.instance_id, ins.object_id, @@ -326,7 +376,8 @@ # get the value, depending on the property type. # the only different case is when viewing the proprty in the context of the role set role_instance_id 0 - if { ![string eq $property_of "self"] } { + if { ![string eq $property_of "self"] || + [string eq $type "locrole"] } { # 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 $owner_user_id] if { !$role_instance_id } { @@ -341,7 +392,7 @@ prop.datatype, prop.item_id as property_item_id, coalesce(ins.value, prop.initial_value) as value, - ins.title, + coalesce(ins.title, ins.identifier) as title, ins.instance_id from imsld_property_instancesx ins, cr_revisions cr, @@ -443,6 +494,22 @@ $owner_node setAttribute value "$owner_user_id" $form_node appendChild $owner_node + # adding run_id + set run_id_node [$dom_doc createElement "input"] + $run_id_node setAttribute name "run_id" + $run_id_node setAttribute type "hidden" + $run_id_node setAttribute value "$run_id" + $form_node appendChild $run_id_node + + if { [string eq $type "locrole"] } { + # adding role_instance_id + set role_instance_id_node [$dom_doc createElement "input"] + $role_instance_id_node setAttribute name "role_instance_id" + $role_instance_id_node setAttribute type "hidden" + $role_instance_id_node setAttribute value "$role_instance_id" + $form_node appendChild $role_instance_id_node + } + # adding return url set return_url_node [$dom_doc createElement "input"] $return_url_node setAttribute name "return_url" @@ -455,6 +522,7 @@ $submit_node setAttribute type "submit" $submit_node setAttribute value "ok" $form_node appendChild $submit_node + # done... add the form to the root set parent_node [$set_property_node parentNode] # first, replace property node with the form node @@ -589,7 +657,7 @@ prop.item_id as property_item_id, prop.datatype, coalesce(ins.value, prop.initial_value) as value, - ins.title, + coalesce(ins.title, ins.identifier) as title, content_revision__get_content(cr.revision_id) as content, ins.instance_id, ins.object_id, @@ -702,6 +770,13 @@ $owner_node setAttribute value "$owner_user_id" $form_node appendChild $owner_node + # adding run_id + set run_id_node [$dom_doc createElement "input"] + $run_id_node setAttribute name "run_id" + $run_id_node setAttribute type "hidden" + $run_id_node setAttribute value "$run_id" + $form_node appendChild $run_id_node + # adding return url set return_url_node [$dom_doc createElement "input"] $return_url_node setAttribute name "return_url" @@ -714,6 +789,7 @@ $submit_node setAttribute type "submit" $submit_node setAttribute value "ok" $form_node appendChild $submit_node + # finally, replace property node with the form node $parent_node replaceChild $form_node $set_property_group_node # FIXME: tDOME apparently adds automathically the attribute xmlns when replacing a node... @@ -848,18 +924,22 @@ and map.displayable_p = 't' }] -set folder_path [db_exec_plsql get_folder_path {select content_item__get_path(:parent_id,:root_folder_id); }] -set file_url "[apm_package_url_from_id $fs_package_id]view/${folder_path}" +# It doesn't make sense to have a base attribute defined, since there could be +# multiple properties to be shown in the page, and therefore, the base URL is +# not so easy to compute. -set head_node [$dom_root selectNodes {//*[local-name()='head']}] -if {![llength [$head_node selectNodes {/*[local-name()='base']}]]} { - set base_node [$dom_doc createElement "base"] - set base_prefix [ns_conn location] - $base_node setAttribute href "$base_prefix/$file_url/" - $head_node appendChild $base_node -} +# set folder_path [db_exec_plsql get_folder_path {select content_item__get_path(:parent_id,:root_folder_id); }] +# set file_url "[apm_package_url_from_id $fs_package_id]view/${folder_path}" +# set head_node [$dom_root selectNodes {//*[local-name()='head']}] +# if {![llength [$head_node selectNodes {/*[local-name()='base']}]]} { +# set base_node [$dom_doc createElement "base"] +# set base_prefix [ns_conn location] +# $base_node setAttribute href "$base_prefix/$file_url/" +# $head_node appendChild $base_node +# } + set xmloutput {<?xml version="1.0" encoding="UTF-8"?>} append xmloutput [$dom_root asXML] ns_return 200 text/html $xmloutput 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.8 -r1.9 --- openacs-4/packages/imsld/www/imsld-frameset.adp 25 Apr 2007 10:52:30 -0000 1.8 +++ openacs-4/packages/imsld/www/imsld-frameset.adp 17 Apr 2008 17:17:54 -0000 1.9 @@ -1,15 +1,15 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> -<head> + <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>@course_name@</title> -</head> -<frameset cols="30%,*"> + </head> + <frameset id="right-column" cols="30%,*"> <frameset rows="50%,*"> - <frame src="imsld-tree?run_id=@run_id@" name="toc" title="toc"> - <frame src="" name="environment" title="environment"> + <frame src="imsld-tree?run_id=@run_id@" name="toc" title="toc"> + <frame src="" name="environment" title="environment"> </frameset> <frame src="" name="content" title="content"> -</frameset> + </frameset> </html> Index: openacs-4/packages/imsld/www/imsld-sendmail-2.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-sendmail-2.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/imsld-sendmail-2.adp 18 May 2006 11:13:01 -0000 1.1 +++ openacs-4/packages/imsld/www/imsld-sendmail-2.adp 17 Apr 2008 17:17:54 -0000 1.2 @@ -1,5 +1,4 @@ -<master> - +<master src="../lib/imsld-master"> <if @page_title@ not nil> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> 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.4 -r1.5 --- openacs-4/packages/imsld/www/imsld-sendmail.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/imsld-sendmail.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,11 +1,21 @@ - +<master src="../lib/imsld-master"> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> +<property name="header_stuff"> +<style type="text/css"> +ul { + text-indent: 0px; + padding: 10px 10px 5px 10px; + margin: 10px; +} +</style> +</property> + <p><strong>#imsld.lt_Select_a_role_to_send#</strong></p> <ul> <multiple name="all_email_data"> <li> - <a href="@all_email_data.send_mail_url@">@all_email_data.title@</a> + <a href="@all_email_data.send_mail_url@" title="#imsld.Send#">@all_email_data.title@</a> <br> </multiple> 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.15 -r1.16 --- openacs-4/packages/imsld/www/imsld-tree.adp 30 May 2007 08:36:22 -0000 1.15 +++ openacs-4/packages/imsld/www/imsld-tree.adp 17 Apr 2008 17:17:54 -0000 1.16 @@ -1,106 +1,51 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <meta http-equiv="refresh" content="20"> - <script src="/resources/acs-templating/mktree.js" language="javascript"></script> - <link rel="stylesheet" href="/resources/acs-templating/mktree.css" media="all"> +<master src="../lib/imsld-master"> + <property name="imsld_include_mktree">1</property> -<SCRIPT> - function confirmValue(myform){ - myform.submit() - } -</SCRIPT> -<NOSCRIPT> -<br /><br /> -#imsld.lt_Sorry_your_browser_do# -<br /><br /> -</NOSCRIPT> + <div class="float-left"> + <a href="@community_url@" class="button" target="_top" + title="#imsld.Exit#">#imsld.Exit#</a> + </div> -<style type="text/css"> -ul { -font-family: Verdana, Arial, Helvetica, sans-serif; -font-size: 12px; -font-style: normal; -font-weight: normal; -font-variant: normal; -text-decoration: none; -text-transform: none; -text-indent: -15px; -padding: 0px; -margin: 0px; -} -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; -} -</style> -</head> -<body> -<a href="@community_url@" style="display: block; position: fixed;" class="button" target="_top">#imsld.Exit#</a> -<div class="role_menu"> -<form name="choose-role"> -<select name="current_role_id" id="roles_list" onChange="confirmValue(this.form)"> -<multiple name="possible_roles"> - <if @possible_roles.role_id@ eq @user_role_id@> - <option value=@possible_roles.role_id@ selected="selected">@possible_roles.role_name@</option> - </if><else> - <option value=@possible_roles.role_id@>@possible_roles.role_name@</option> - </else> -</multiple> -</select> -<input type="hidden" name="run_id" value=@run_id@ /> -<input type="submit" name="ok" value="OK" /> -</form> -</div> -@html_tree;noquote@ -@aux_html_tree;noquote@ -<if @user_message@ not nil> -@user_message@ -</if> -</body> + <div class="role_menu"> + <if @possible_roles:rowcount@ not nil and + @possible_roles:rowcount@ gt 1> + <include src="../lib/choice-select" &item_select="possible_roles" + select_name="current_role_id" + select_id="roles_list" + selected_item=@user_role_id@ + select_string=@select_string@ + run_id=@run_id@> + </if> + </div> -<script type="text/javascript"> -var as = document.getElementsByTagName("a"); -for (var i = 0; i < as.length; i++) { - var a = as[i]; - for( var x = 0; x < a.attributes.length; x++ ) { - if( a.attributes[x].nodeName.toLowerCase() == 'href' ) { - if ( a.attributes[x].nodeValue.match(/activity-frame/) ) { - var enviromenturl = a.attributes[x].nodeValue.replace(/activity-frame/, "environment-frame"); - a.setAttribute('onClick',"parent.environment.location='" + enviromenturl + "'"); - } + <div class="frame-header">#imsld.Activities#</div> + + <br /> + + @html_tree;noquote@ + + @aux_html_tree;noquote@ + + <if @user_message@ not nil> + @user_message@ + </if> + + <!-- Script needed to show environments in the proper frame --> + <script type="text/javascript"> + var as = document.getElementsByTagName("a"); + for (var i = 0; i < as.length; i++) { + var a = as[i]; + for( var x = 0; x < a.attributes.length; x++ ) { + if( a.attributes[x].nodeName.toLowerCase() == 'href' ) { + if ( a.attributes[x].nodeValue.match(/activity-frame/) ) { + var enviromenturl = a.attributes[x].nodeValue.replace(/activity-frame/, "environment-frame"); + a.setAttribute('onClick',"parent.environment.location='" + enviromenturl + "'"); + } + } + } } - } -} -</script> + </script> -<SCRIPT> - document.forms['choose-role'].elements['ok'].style.display="none" -</SCRIPT> -</html> Index: openacs-4/packages/imsld/www/imsld-tree.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/imsld/www/imsld-tree.tcl 30 May 2007 08:36:22 -0000 1.18 +++ openacs-4/packages/imsld/www/imsld-tree.tcl 17 Apr 2008 17:17:54 -0000 1.19 @@ -25,8 +25,10 @@ # current role information. # the user must have an active role in the run -set possible_user_roles [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] -set possible_user_role_names [imsld::roles::get_roles_names -roles_list $possible_user_roles] +set possible_user_roles [imsld::roles::get_user_roles -user_id $user_id \ + -run_id $run_id] +set possible_user_role_names [imsld::roles::get_roles_names \ + -roles_list $possible_user_roles] # remove added in the previous proc regsub -all " " $possible_user_role_names "" $possible_user_role_names @@ -57,22 +59,23 @@ and iruge.run_id = :run_id and map.active_role_id is not null }] } { - # generate the first option + # no role have been selected, generate the first option set possible_user_roles [linsert $possible_user_roles 0 0] set possible_user_role_names [linsert $possible_user_role_names 0 "[_ imsld.Select_role]"] set user_role_id -1 } -template::multirow create possible_roles role_id role_name +template::multirow create possible_roles item_id item_name foreach role $possible_user_roles { - template::multirow append possible_roles $role [lindex $possible_user_role_names [lsearch -exact $possible_user_roles $role]] + template::multirow append possible_roles \ + $role [lindex $possible_user_role_names \ + [lsearch -exact $possible_user_roles $role]] } set user_message "" set next_activity_id [imsld::get_next_activity_list -run_id $run_id -user_id $user_id] - set remaining_activities [llength [join $next_activity_id]] if {!$remaining_activities} { @@ -84,7 +87,7 @@ where run_id=:run_id } } else { - set user_message "Please wait for other users ..." + set user_message "[_ imsld.lt_Please_wait_for_other]" } } @@ -95,13 +98,12 @@ }] if {[string eq "stopped" $run_status]} { - set user_message "The course has been finished" + set user_message "[_ imsld.lt_The_course_has_been_f]" } dom createDocument ul doc set dom_root [$doc documentElement] $dom_root setAttribute class "mktree" -$dom_root setAttribute style "white-space: nowrap;" set imsld_title_node [$doc createElement li] $imsld_title_node setAttribute class "liOpen" set text [$doc createTextNode "$imsld_title"] @@ -114,7 +116,6 @@ set html_tree "" set aux_html_tree "" } else { - imsld::generate_activities_tree -run_id $run_id \ -user_id $user_id \ -next_activity_id_list $next_activity_id \ @@ -135,7 +136,6 @@ dom createDocument ul aux_doc set aux_dom_root [$aux_doc documentElement] $aux_dom_root setAttribute class "mktree" - $aux_dom_root setAttribute style "white-space: nowrap;" set aux_title_node [$aux_doc createElement li] $aux_title_node setAttribute class "liOpen" set text [$doc createTextNode "[_ imsld.Extra_Activities]"] @@ -156,3 +156,5 @@ } } + +set select_string "[_ imsld.Select_role]" Index: openacs-4/packages/imsld/www/monitor-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/monitor-frame.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/monitor-frame.adp 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/monitor-frame.adp 17 Apr 2008 17:17:54 -0000 1.6 @@ -1,17 +1,5 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> +<master src="../lib/imsld-master"> -<SCRIPT> - function confirmValue(myform){ - myform.submit() - } -</SCRIPT> - -</head> -<body> - #imsld.Monitoring#: @monitoring_user_name@ <if @users_in_role:rowcount@ gt 0> @@ -33,14 +21,12 @@ </form> </if> -<div style="display:none;"> -<a href="@monitor_service_url;noquote@"></a> +<div class="hide"> +<a href="@monitor_service_url;noquote@" title="<# Monitor service #>"></a> </div> <iframe id="object" name="object"></iframe> -</body> - <script type="text/javascript"> function resizeobject() { f = document.forms[0]; @@ -71,4 +57,3 @@ document.forms['choose-user'].elements['ok'].style.display="none" </SCRIPT> -</html> Index: openacs-4/packages/imsld/www/properties-value-set.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/properties-value-set.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/properties-value-set.tcl 25 Apr 2007 10:52:30 -0000 1.4 +++ openacs-4/packages/imsld/www/properties-value-set.tcl 17 Apr 2008 17:17:54 -0000 1.5 @@ -6,6 +6,8 @@ instances_ids:array return_url owner_id + run_id + {role_instance_id ""} } -validate { no_instance { if { [array size instances_ids] == 0 } { @@ -19,24 +21,28 @@ # avoiding hacks db_1row instance_info_id { select ins.property_id, - ins.run_id, prop.datatype from imsld_property_instances ins, imsld_properties prop where ins.instance_id = :instance_id and ins.property_id = prop.property_id + and content_revision__is_live(ins.instance_id) = 't' } if { [string eq "file" $datatype] } { - imsld::runtime::property::property_value_set -run_id $run_id \ + imsld::runtime::property::property_value_set \ + -run_id $run_id \ -user_id $owner_id \ + -role_instance_id $role_instance_id \ -value $instances_ids($instance_id) \ -property_id $property_id \ -upload_file $instances_ids($instance_id) \ -tmpfile $instances_ids(${instance_id}.tmpfile) } else { - imsld::runtime::property::property_value_set -run_id $run_id \ + imsld::runtime::property::property_value_set \ + -run_id $run_id \ -user_id $owner_id \ + -role_instance_id $role_instance_id \ -value $instances_ids($instance_id) \ -property_id $property_id } Index: openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-admin-roles.adp 17 Apr 2008 17:17:54 -0000 1.6 @@ -1,38 +1,57 @@ <master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + <property name="header_stuff"> +<style type="text/css"> +.one-row { + clear:both; + padding-right:20px; +} +.one-element { + float:left; + display:inline; + margin:0px; + padding-right:30px; +} +.roles-confirm { + float:left; + text-indent:-180px; + margin-top:40px; +} +.one-element ul { + text-indent: 0px; +} +</style> + </property> <SCRIPT> function confirmValue(myform){ myform.submit() } </SCRIPT> - -<table border="0"> -<tr> - <td> - <formtemplate id="choose_role"></formtemplate> - </td> - <td> +<div class="one-row"> + <div class="one-element"> + <formtemplate id="choose_role"></formtemplate> + </div> <if @role@ not eq 0> + <div class="one-element"> <include src="imsld-groups"> - </if> - </td> - - <td> - <if @finishable@ not eq 0> + </div> + </if> + <if @finishable@ not eq 0> + <div class="roles-confirm"> <formtemplate id="finish_management"></formtemplate> - </if> - </td> + </div> + </if> +</div> - </tr> +<if @group_instance@ not eq 0> + <include src="imsld-role-members"> +</if> - <if @group_instance@ not eq 0> - <include src="imsld-role-members"> - </if> -</table> - <SCRIPT> document.forms['choose_role'].elements['formbutton:ok'].style.display="none" </SCRIPT> Index: openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl 30 May 2007 08:36:22 -0000 1.7 +++ openacs-4/packages/imsld/www/admin/imsld-admin-roles.tcl 17 Apr 2008 17:17:54 -0000 1.8 @@ -13,6 +13,9 @@ {finishable 0} } +set page_title "[_ imsld.Admin_roles]" +set context "" + #check if the run is waiting if { [db_0or1row get_run_status { select run_id 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.8 -r1.9 --- openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 21 Dec 2006 15:20:47 -0000 1.8 +++ openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 17 Apr 2008 17:17:54 -0000 1.9 @@ -9,9 +9,6 @@ } -# instantiating properties and activity attributes for the run -imsld::instance::instantiate_properties -run_id $run_id -imsld::instance::instantiate_activity_attributes -run_id $run_id # NOTE: we should verify the permissions here set conditions 1 if {$conditions == 1} { @@ -28,8 +25,24 @@ foreach role_id [imsld::roles::get_list_of_roles -imsld_id $imsld_id] { set users_list [concat $users_list [imsld::roles::get_users_in_role -role_id [lindex $role_id 0] -run_id $run_id]] } - + +set group_run_id [db_string get_run_group_id { + select group_id + from imsld_run_users_group_ext + where run_id = :run_id +}] + +# add the users to the run_group foreach user_id $users_list { + relation_add imsld_run_users_group_rel $group_run_id $user_id +} + +# instantiating properties and activity attributes for the run +imsld::instance::instantiate_properties -run_id $run_id +imsld::instance::instantiate_activity_attributes -run_id $run_id + +# execute the conditions +foreach user_id $users_list { imsld::condition::execute_all -run_id $run_id -user_id $user_id } Index: openacs-4/packages/imsld/www/admin/imsld-create-instance.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-create-instance.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/imsld-create-instance.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/imsld-create-instance.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,4 +1,7 @@ <master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + <p>#imsld.lt_Select_parent_for_the#</p> <if @flag@ not nil> <listtemplate name="possible_parents"></listtemplate> Index: openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl 17 Apr 2008 17:17:54 -0000 1.6 @@ -12,6 +12,8 @@ run_id parent_group_id:optional } +set page_title "[_ imsld.Create_role_instance]" +set context "" db_1row get_imsld_role_info {} set number_of_groups [llength [db_list get_related_groups {}]] @@ -20,8 +22,8 @@ if { !([string eq $number_of_groups "0"] || [string eq $create_new_p "t"] ) } { - set mensaje "<p>Current Unit of Learning does not allow creation of multiple instances of this role.</p> - <a href=\"$return_url\">Go back</a>" + set mensaje "<p>[_ imsld.lt_Current_Unit_of_Learn]</p> + <a href=\"$return_url\" title=\"[_ imsld.Go_back]\">[_ imsld.Go_back]</a>" ad_return_complaint 1 $mensaje ad_script_abort } Index: openacs-4/packages/imsld/www/admin/imsld-finish.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-finish.adp,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-finish.adp 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-finish.adp 17 Apr 2008 17:17:54 -0000 1.6 @@ -1,4 +1,6 @@ <master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> <if @warning_flag@ not nil> <p><b>#imsld.lt_Some_warnings_has_bee#</b></p> @@ -10,15 +12,15 @@ <if @error_flag@ not nil> <p><b>#imsld.lt_Some_errors_has_been_#</b></p> <ul>@errors;noquote@</ul> - <a href="@back@">#imsld.Go_back#</a> + <a href="@back@" title="#imsld.Go_back#">#imsld.Go_back#</a> </if> <else> <hr> <p>#imsld.lt_Are_all_the_students_#</p> -<p>#imsld.lt_If_you_are_not_sure_t# <a href="@back@">#imsld.go_back#</a></p> -<p>#imsld.lt_Otherwise_if_everthin# <a href="@confirm@">#imsld.Confirm#</a>.</p> +<p>#imsld.lt_If_you_are_not_sure_t# <a href="@back@" title="#imsld.go_back#">#imsld.go_back#</a></p> +<p>#imsld.lt_Otherwise_if_everthin# <a href="@confirm@" title="#imsld.Confirm#">#imsld.Confirm#</a>.</p> </else> Index: openacs-4/packages/imsld/www/admin/imsld-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-finish.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-finish.tcl 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-finish.tcl 17 Apr 2008 17:17:54 -0000 1.6 @@ -7,8 +7,12 @@ imsld_id run_id } -#aqui tengo que poner la comprobación de que todo sea correcto (errores y warnings) +set page_title "[_ imsld.lt_Confirm_roles_assignm]" +set context "" + +# NOTE(lfuente): here there should be a check of all the input + set roles_list_depth [imsld::roles::get_list_of_roles -imsld_id $imsld_id] Index: openacs-4/packages/imsld/www/admin/imsld-groups.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-groups.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/imsld-groups.adp 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/imsld-groups.adp 17 Apr 2008 17:17:54 -0000 1.4 @@ -1,3 +1,3 @@ -<blockquote><listtemplate name="role_groups"></listtemplate></blockquote> +<listtemplate name="role_groups"></listtemplate> Index: openacs-4/packages/imsld/www/admin/imsld-groups.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-groups.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/admin/imsld-groups.tcl 30 May 2007 08:36:22 -0000 1.6 +++ openacs-4/packages/imsld/www/admin/imsld-groups.tcl 17 Apr 2008 17:17:54 -0000 1.7 @@ -11,33 +11,32 @@ {group_instance 0} role:optional } -set lista [list [list "Select a group..." 0]] +set lista [list [list "[_ imsld.Select_a_group]" 0]] set lista_aux [lindex [db_list_of_lists get_groups_list {}] 0] lappend lista $lista_aux -set actions [list "Create new" [export_vars -base imsld-create-instance {imsld_id run_id role lista}] "Create a new group"] +set actions [list "[_ imsld.Create_new]" [export_vars -base imsld-create-instance {imsld_id run_id role lista}] "[_ imsld.Create_a_new_group]"] template::list::create \ -name role_groups \ -multirow role_groups \ -key role_groups \ + -pass_properties { imsld_id run_id role } \ -actions $actions \ -elements { group_name { - label {Group name} + label {[_ imsld.Group_name]} link_url_col {manage_roles} } delete { label {} - display_template {@role_groups.delete;noquote@} + display_template {<a href="imsld-delete-instance?imsld_id=@imsld_id@&run_id=@run_id@&role=@role@&group_id=@role_groups.group_id@" title="[_ imsld.Delete]"><img src="/resources/acs-subsite/Delete16.gif" width="16" height="16" border="0" alt="[_ imsld.Delete]" title="[_ imsld.Delete]"></a>} } } db_multirow -extend { manage_roles delete } role_groups get_groups_list {} { set manage_roles [export_vars -base imsld-admin-roles {imsld_id run_id role {group_instance $group_id}}] - set delete "<a href=\"[export_vars -base "imsld-delete-instance" { imsld_id run_id role group_id }]\"><img src=\"/resources/acs-subsite/Delete16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"[_ imsld.Delete]\"></a>" - } Index: openacs-4/packages/imsld/www/admin/imsld-new-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-new-2.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/www/admin/imsld-new-2.tcl 16 May 2006 09:24:36 -0000 1.9 +++ openacs-4/packages/imsld/www/admin/imsld-new-2.tcl 17 Apr 2008 17:17:54 -0000 1.10 @@ -28,7 +28,7 @@ -message_1 "[_ imsld.lt_Uploading_and_process]" \ -message_2 "[_ imsld.lt_We_will_continue_auto]" -ns_write "[_ imsld.lt_h2Uploading_new_IMS_L] <blockquote>" +ns_write "[_ imsld.lt_h2Uploading_new_IMS_L]" set community_id [dotlrn_community::get_community_id] # Atempting to create the new IMS LD. @@ -65,9 +65,7 @@ ns_sleep 5 } -ns_write "</blockquote>" - # go to the roles admin page... -ad_progress_bar_end -url [export_vars -base imsld-admin-roles {run_id}] +ad_progress_bar_end -url "index" Index: openacs-4/packages/imsld/www/admin/imsld-new.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-new.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/imsld-new.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/imsld-new.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,7 +1,19 @@ <master> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> - + <property name="header_stuff"> +<style type="text/css"> +td.element_title { + background-color: #e0e0e0; + font-weight: bold; +} +td.element_value { + background-color: #f0f0f0; + font-weight: bold; +} +</style> +</property> + <if @imsld_info:rowcount@ eq 0> #imsld.No# </if> Index: openacs-4/packages/imsld/www/admin/imsld-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-new.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/imsld/www/admin/imsld-new.tcl 30 May 2007 08:36:22 -0000 1.8 +++ openacs-4/packages/imsld/www/admin/imsld-new.tcl 17 Apr 2008 17:17:54 -0000 1.9 @@ -55,11 +55,13 @@ -elements { element_name { label "" - html {valign top style "background-color: #e0e0e0; font-weight: bold;"} + html {valign top} + class {element_title} } info { label "" - html {valign top style "background-color: #f0f0f0; font-weight: bold;"} + html {valign top} + class {element_value} } } Index: openacs-4/packages/imsld/www/admin/imsld-role-add-members.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-add-members.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-role-add-members.tcl 30 May 2007 08:36:22 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-role-add-members.tcl 17 Apr 2008 17:17:54 -0000 1.6 @@ -14,6 +14,9 @@ run_id } +set page_title "[_ imsld.Add_Members]" +set context "" + #only set required variables foreach user $user_id { Index: openacs-4/packages/imsld/www/admin/imsld-role-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-confirm.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/imsld/www/admin/imsld-role-confirm.tcl 30 May 2007 08:36:22 -0000 1.7 +++ openacs-4/packages/imsld/www/admin/imsld-role-confirm.tcl 17 Apr 2008 17:17:54 -0000 1.8 @@ -30,17 +30,15 @@ } if { ![string eq "" $min_persons] && ([llength $members_list] < $min_persons)} { - set mensaje "<p>Number of members does not reach the minimum allowed number of users for this role. - There must be at least $min_persons members.</p> - <a href=\"$return_url\">Go back</a>" + set mensaje "<p>[_ imsld.lt_Number_of_members_doe]</p> + <a href=\"$return_url\" title=\"[_ imsld.Go_back]\">[_ imsld.Go_back]</a>" ad_return_complaint 1 $mensaje ad_script_abort } if {![string eq "" $max_persons] && ([llength $members_list] > $max_persons)} { - set mensaje "<p>Number of members exceded the allowed number for this role. - You must not select more than $max_persons members.</p> - <a href=\"$return_url\">Go back</a>" + set mensaje "<p>[_ imsld.lt_Number_of_members_exc]</p> + <a href=\"$return_url\" title=\"[_ imsld.Go_back]\">[_ imsld.Go_back]</a>" ad_return_complaint 1 $mensaje ad_script_abort } @@ -62,9 +60,9 @@ - set mensaje "<p>Members $not_allowed_name are already members of other subroles of role $parent_role_name.</p> - <p>Current UoL does not allow to include them in more than one subroles of the role.</p> - <a href=\"$return_url\">Go back</a>" + set mensaje "<p>[_ imsld.lt_Members_not_allowed_n]</p> + <p>[_ imsld.lt_Current_UoL_does_not_]</p> + <a href=\"$return_url\" title=\"[_ imsld.Go_back]\">[_ imsld.Go_back]</a>" ad_return_complaint 1 $mensaje ad_script_abort } Index: openacs-4/packages/imsld/www/admin/imsld-role-members.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-members.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/admin/imsld-role-members.adp 30 May 2007 08:36:22 -0000 1.6 +++ openacs-4/packages/imsld/www/admin/imsld-role-members.adp 17 Apr 2008 17:17:54 -0000 1.7 @@ -1,26 +1,26 @@ -<tr> - - <td><h1>@group_title@</h1></td> - <td> - <ul> +<div class="one-row"> + <div class="one-element"> + <h1>@group_title@</h1> + </div> + <div class="one-element"> + <ul> <li>#imsld.lt_Max_number_of_student#</li> <li>#imsld.lt_Min_number_of_student#</li> - </ul> - </td> -</tr> + </ul> + </div> +</div> -<tr> - <td> -<h2>#imsld.Not_members#</h2> -<listtemplate name="asign_not_members"></listtemplate> - </td> - <td> -<h2>#imsld.Group_members#</h2> - <listtemplate name="asign_members"></listtemplate> - </td> - <td> - <formtemplate id="confirm"></formtemplate> <br> - </td> -</tr> +<div class="one-row"> + <div class="one-element"> + <h2>#imsld.Not_members#</h2> + <listtemplate name="asign_not_members"></listtemplate> + </div> + <div class="one-element"> + <h2>#imsld.Group_members#</h2> + <listtemplate name="asign_members"></listtemplate> + </div> + <div class="roles-confirm"> + <formtemplate id="confirm"></formtemplate> + </div> +</div> - Index: openacs-4/packages/imsld/www/admin/imsld-role-members.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-members.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/imsld/www/admin/imsld-role-members.tcl 30 May 2007 08:36:22 -0000 1.10 +++ openacs-4/packages/imsld/www/admin/imsld-role-members.tcl 17 Apr 2008 17:17:54 -0000 1.11 @@ -67,15 +67,14 @@ if {![db_0or1row get_group_name {}]} { - set group_name "No group selected" -# set create_instance_url [export_vars -base imsld-create-instance {{imsld_id $imsld_id} {role $role}}] + set group_name "[_ imsld.No_group_selected]" set create_instance_url imsld-create-instance - set bulk_actions "{Create new instance} $create_instance_url {Create a new instance of a role}" - set bulk_actions_not "{Create new instance} $create_instance_url {Create a new instance of a role}" + set bulk_actions "{Create new instance} $create_instance_url {Create a new instance of a role #>}" + set bulk_actions_not "{Create new instance} $create_instance_url {[_ imsld.lt_Create_a_new_instance]}" set bulk_action_export_vars "{imsld_id} {role} {run_id}" } else { - set bulk_actions "{<------} {imsld-role-remove-members} {Remove selected members from the group}" - set bulk_actions_not "{------->} {imsld-role-add-members} {Add selected members to the group}" + set bulk_actions "{<------} {imsld-role-remove-members} {[_ imsld.lt_Remove_selected_membe]}" + set bulk_actions_not "{------->} {imsld-role-add-members} {[_ imsld.lt_Add_selected_members_]}" set bulk_action_export_vars "{group_instance} {role} {imsld_id} {run_id} {members_list}" } @@ -96,11 +95,6 @@ -bulk_actions "$bulk_actions"\ -bulk_action_export_vars "$bulk_action_export_vars" -#set orderby [template::list::orderby_clause -orderby -name asign_members] -#if {[string equal $orderby ""]} { -# set orderby " order by username asc" -#} - template::list::create \ -name asign_not_members \ -multirow asign_not_members \ Index: openacs-4/packages/imsld/www/admin/imsld-role-members.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-members.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/imsld/www/admin/imsld-role-members.xql 10 Jul 2006 13:45:29 -0000 1.5 +++ openacs-4/packages/imsld/www/admin/imsld-role-members.xql 17 Apr 2008 17:17:54 -0000 1.6 @@ -23,13 +23,11 @@ <querytext> select aua.user_id from acs_users_all aua, - acs_rels ar, - imsld_run_users_group_ext r_map + acs_rels ar where aua.user_id > 0 and aua.user_id not in ([join $members_list ","]) and aua.user_id=ar.object_id_two - and ar.object_id_one = r_map.group_id - and r_map.run_id = :run_id + and ar.object_id_one = :community_id </querytext> </fullquery> Index: openacs-4/packages/imsld/www/admin/imsld-role-remove-members.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-remove-members.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/imsld-role-remove-members.adp 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/imsld-role-remove-members.adp 17 Apr 2008 17:17:54 -0000 1.4 @@ -1,3 +1,5 @@ <master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> @user_id@ Index: openacs-4/packages/imsld/www/admin/imsld-role-remove-members.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-role-remove-members.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/imsld-role-remove-members.tcl 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/imsld-role-remove-members.tcl 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,4 +1,4 @@ -#/packages/imsld/www/admin/imsld-role-add-members.tcl +#/packages/imsld/www/admin/imsld-role-remove-members.tcl ad_page_contract { Remove members from an specified group @@ -13,6 +13,9 @@ imsld_id run_id } +set page_title "[_ imsld.Remove_Members]" +set context "" + #only set required variables set temp_list [list] foreach member $members_list { Index: openacs-4/packages/imsld/www/admin/imsld-view-roles.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-view-roles.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/imsld-view-roles.adp 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/imsld-view-roles.adp 17 Apr 2008 17:17:54 -0000 1.4 @@ -1,4 +1,6 @@ <master> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> <SCRIPT> function confirmValue(myform){ @@ -15,7 +17,7 @@ <if @parent_role_name@ not nil> <ul> - <li><a href=@parent_role_link@>@parent_role_name@</a></li> + <li><a href=@parent_role_link@ title="#imsld.Parent_1#">@parent_role_name@</a></li> </ul> </if> <else> @@ -29,7 +31,7 @@ <h3>#imsld.Descendant#</h3> <ul> <multiple name="subroles_names"> - <li><a href=@subroles_names.rolelink@>@subroles_names.rolename@</a></li> + <li><a href=@subroles_names.rolelink@ title="#imsld.Subrole#">@subroles_names.rolename@</a></li> </multiple> </ul> <if @subroles_names:rowcount@ eq 0> @@ -43,7 +45,7 @@ <h3>#imsld.Groups#</h3> <listtemplate name="group_table"></listtemplate> <br><br> -<a href="index">#imsld.Back#</a> +<a href="index" title="#imsld.Back#">#imsld.Back#</a> <SCRIPT> document.forms['choose_role'].elements['formbutton:ok'].style.display="none" </SCRIPT> Index: openacs-4/packages/imsld/www/admin/imsld-view-roles.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-view-roles.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/imsld-view-roles.tcl 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/imsld-view-roles.tcl 17 Apr 2008 17:17:54 -0000 1.4 @@ -24,6 +24,8 @@ set roles_list [imsld::roles::get_list_of_roles -imsld_id $imsld_id] set roles_list_names [imsld::roles::get_roles_names -roles_list $roles_list] +set page_title "[_ imsld.View_Roles]" +set context "" set lista [list] lappend lista [list "[_ imsld.Select_a_role]" 0] Index: openacs-4/packages/imsld/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/index.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/index.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,12 +1,13 @@ <master> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> + <property name="header_stuff"><link rel="stylesheet" type="text/css" media="all" href="/resources/imsld/imsld.css" /></property> -<p><formtemplate id="upload_file_form"></formtemplate></p> + <p><formtemplate id="upload_file_form"></formtemplate></p> -<h2>#imsld.IMS-LDs_1#</h2> -<blockquote><listtemplate name="imslds"></listtemplate></blockquote> + <h2 class="center">#imsld.IMS-LDs_1#</h2> + <div class="centered-table"><listtemplate name="imslds"></listtemplate></div> -<h2>#imsld.Runs#</h2> -<blockquote><listtemplate name="imsld_runs"></listtemplate></blockquote> + <h2 class="center">#imsld.Runs#</h2> + <div class="centered-table"><listtemplate name="imsld_runs"></listtemplate></div> Index: openacs-4/packages/imsld/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.tcl,v diff -u -r1.16 -r1.17 --- openacs-4/packages/imsld/www/admin/index.tcl 30 May 2007 08:36:22 -0000 1.16 +++ openacs-4/packages/imsld/www/admin/index.tcl 17 Apr 2008 17:17:54 -0000 1.17 @@ -23,7 +23,12 @@ content::item::set_live_revision -revision_id [content::item::get_best_revision -item_id $set_imsld_id_live] } if { ![string eq "" $set_run_id_live] } { - db_dml make_run_live { *SQL* } + # if there are no users assigned to the run, we mark it as waiting, otherwise mark it active + if { ![llength [imsld::runtime::users_in_run -run_id $set_run_id_live]] } { + db_dml make_run_waiting { *SQL* } + } else { + db_dml make_run_live { *SQL* } + } } set package_id [ad_conn package_id] @@ -47,6 +52,7 @@ -name imslds \ -multirow imslds \ -key imsld_id \ + -pass_properties { return_url } \ -orderby_name imsld_orderby \ -orderby { default_value imsld_title } \ -elements { @@ -62,12 +68,19 @@ } create_run { label {} - display_template {@imslds.create_run;noquote@} + display_template {<if @imslds.live_revision@ not nil> + <a href="run-new?run_imsld_id=@imslds.imsld_id@&return_url=@return_url@" title="[_ imsld.lt___imsldcreate_new_run]"> [_ imsld.create_new_run] </a> + </if>} } delete { label {} sub_class narrow - display_template {@imslds.delete_template;noquote@} + display_template {<if @imslds.live_revision@ nil> + <span class="alert">[_ imsld.Deleted]</span> <a href="index?set_imsld_id_live=@imslds.item_id@" title="[_ imsld.Make_it_live]">[_ imsld.Make_it_live]</a> + </if> + <else> + <a href="imsld-delete?imsld_id=@imslds.imsld_id@&return_url=@return_url@" title="[_ imsld.Delete]"><img src="/resources/acs-subsite/Delete16.gif" width="16" height="16" border="0" alt="[_ imsld.Delete]" title="[_ imsld.Delete]"></a> + </else>} link_html { title "[_ imsld.Delete_IMS_LD]" } } } @@ -76,17 +89,8 @@ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] -db_multirow -extend { delete_template create_run } imslds get_imslds { *SQL* } { +db_multirow -extend { delete_template create_run } imslds get_imslds { *SQL* } {} - if { [empty_string_p $live_revision] } { - set delete_template "<span style=\"font-style: italic; color: red; font-size: 9pt;\">[_ imsld.Deleted]</span> <a href=[export_vars -base "index" { {set_imsld_id_live $item_id} }]>[_ imsld.Make_it_live]</a>" - set create_run "" - } else { - set delete_template "<a href=\"[export_vars -base "imsld-delete" { imsld_id return_url }]\"><img src=\"/resources/acs-subsite/Delete16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"<\#_ Delete #>\"></a>" - set create_run "<a href=\"[export_vars -base "run-new" { {run_imsld_id $imsld_id} return_url }]\"> [_ imsld.create_new_run] </a>" - } -} - 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]"] @@ -95,6 +99,7 @@ template::list::create \ -name imsld_runs \ -multirow imsld_runs \ + -pass_properties { return_url } \ -key run_id \ -elements { imsld_title { @@ -115,13 +120,25 @@ orderby_desc {creation_date desc} } manage { - label "" - display_template {@imsld_runs.manage;noquote@} + label {} + display_template {<if @imsld_runs.status@ eq "active" or @imsld_runs.status@ eq "stopped"> + <a href="imsld-view-roles?run_id=@imsld_runs.run_id@" title="[_ imsld.View_members]">[_ imsld.View_members]</a> | <a href="monitor?run_id=@imsld_runs.run_id@" title="[_ imsld.Monitor]">[_ imsld.Monitor]</a> + </if> + <else> + <if @imsld_runs.status@ eq "waiting"> + <a href="imsld-admin-roles?run_id=@imsld_runs.run_id@" title="[_ imsld.Manage_Members]">[_ imsld.Manage_Members]</a> + </if> + </else>} } delete { label {} sub_class narrow - display_template {@imsld_runs.delete_template;noquote@} + display_template {<if @imsld_runs.status@ eq "deleted"> + <span class="alert">[_ imsld.Deleted]</span> <a href="index?set_run_id_live=@imsld_runs.run_id@" title="[_ imsld.Make_it_live]">[_ imsld.Make_it_live]</a> + </if> + <else> + <a href="run-delete?run_id=@imsld_runs.run_id@&return_url=@return_url@" title="[_ imsld.Delte]"><img src="/resources/acs-subsite/Delete16.gif" width="16" height="16" border="0" alt="[_ imsld.Delte]" title="[_ imsld.Delte]"></a> + </else>} link_html { title "[_ imsld.Delete_Run]" } } } \ @@ -134,32 +151,22 @@ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] db_multirow -extend { manage delete_template image_path image_alt image_title } imsld_runs get_runs { *SQL* } { - - set delete_template "<a href=\"[export_vars -base "run-delete" { run_id return_url }]\"><img src=\"/resources/acs-subsite/Delete16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"[_ imsld.Delte]\"></a>" - switch $status { - deleted { - set delete_template "<span style=\"font-style: italic; color: red; font-size: 9pt;\">[_ imsld.Deleted]</span> <a href=[export_vars -base "index" { {set_run_id_live $run_id} }]>[_ imsld.Make_it_live]</a>" - } active { - set delete_template "<a href=\"[export_vars -base "run-delete" { run_id return_url }]\"><img src=\"/resources/acs-subsite/Delete16.gif\" width=\"16\" height=\"16\" border=\"0\" alt=\"[_ imsld.Delete]\"></a>" 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" - set manage "<a href=\"[export_vars -base "imsld-view-roles" { run_id }]\">[_ imsld.View_members]</a> | <a href=\"[export_vars -base "monitor/" { run_id }]\">[_ imsld.Monitor]</a>" } 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" - set create_run "<a href=\"[export_vars -base "index" { {run_imsld_id $imsld_id} return_url }]\"> [_ imsld.create_new_run] </a>" - set manage "<a href=\"[export_vars -base "imsld-admin-roles" { run_id }]\">[_ imsld.Manage_Members]</a>" } 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 manage "<a href=\"[export_vars -base "imsld-view-roles" { run_id }]\">[_ imsld.View_members]</a> | <a href=\"[export_vars -base "monitor/" { run_id }]\">[_ imsld.Monitor]</a>" } } } + Index: openacs-4/packages/imsld/www/admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/index.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/admin/index.xql 16 May 2006 09:24:36 -0000 1.2 +++ openacs-4/packages/imsld/www/admin/index.xql 17 Apr 2008 17:17:54 -0000 1.3 @@ -56,5 +56,15 @@ </querytext> </fullquery> + <fullquery name="make_run_waiting"> + <querytext> + + update imsld_runs + set status = 'waiting' + where run_id = :set_run_id_live + + </querytext> + </fullquery> + </queryset> Index: openacs-4/packages/imsld/www/admin/monitor/activity-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/activity-frame.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/monitor/activity-frame.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/monitor/activity-frame.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,39 +1,12 @@ -<master> +<master src="../../../lib/imsld-master"> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> + <property name="imsld_content_frame">1</property> -<span id="addc1" style="position:absolute;top:0px;left:0px;"> -<a href="#" onClick="return _tp(false)" title="Hide panel" class="show-hide-icon_link"><img src="/resources/acs-subsite/stock_left.png" alt="#imsld.Hide#" border="0" align="top"/></a> -</span> -<span id="addc" style="display:none;position:absolute;top:0px;left:0px;"> -<a href="#" onClick="return _tp(true)" title="Show panel" class="show-hide-icon_link"><img src="/resources/acs-subsite/stock_right.png" alt="#imsld.Show#" border="0" align="top"/></a> -</span> - -@list_header@ -<br /><br /> -<listtemplate name="related_users"></listtemplate> -<br /> - -<script type="text/javascript"> -function _tp(a){ - var ab=document.getElementById("addc"); - var ac=document.getElementById("addc1"); - - if (a) { - ai=''; - aj='none'; - parent.document.getElementsByTagName("frameset")[1].cols='30%,*'; - } else { - ai='none'; - aj=''; - parent.document.getElementsByTagName("frameset")[1].cols='0%,*'; - } - - ac.style.display=ai; - ab.style.display=aj; - - return false; -} - - -</script> + <div class="frame-header">@frame_header@</div> + + <br /> + + <div class="centered-table"> + <listtemplate name="related_users"></listtemplate> + </div> Index: openacs-4/packages/imsld/www/admin/monitor/activity-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/activity-frame.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/monitor/activity-frame.tcl 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/monitor/activity-frame.tcl 17 Apr 2008 17:17:54 -0000 1.4 @@ -23,15 +23,42 @@ set page_title "[_ imsld.lt_Monitoring_One_Activi]" set context [list] -set elements [list user_name \ +set elements [list portrait \ + [list label "" \ + display_template {<img style="height:75px;" + src="/shared/portrait-bits.tcl?user_id=@related_users.user_id@" + alt="No Portrait"/>}] \ + user_name \ [list label "[_ imsld.Name]" \ - display_template {<a href="individual-report-frame?run_id=${run_id}&member_id=@related_users.user_id@">@related_users.user_name@</a>}] \ + display_template {<a href="individual-report-frame?run_id=${run_id}&member_id=@related_users.user_id@" title="[_ imsld.lt_Users_individual_repo]">@related_users.user_name@</a>}] \ email \ [list label "[_ imsld.Email]"]] if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } { + set frame_header "[_ imsld.lt_Users_who_have_starte] " + # status directly recorded in the status table, get the info - set list_header "[_ imsld.lt_Users_who_have_starte]" + if { [string eq $type "structure"] } { + db_1row activity_info { + select title as activity_title + from imsld_activity_structuresi + where structure_id = :activity_id + } + } elseif { [string eq $type "support"] } { + db_1row activity_info { + select title as activity_title + from imsld_support_activitiesi + where activity_id = :activity_id + } + } else { + db_1row activity_info { + select title as activity_title + from imsld_learning_activitiesi + where activity_id = :activity_id + } + } + append frame_header " \"$activity_title\"" + template::multirow create related_users user_id user_name email role start_date finish_date lappend elements start_date \ [list label "[_ imsld.Start_Date]"] @@ -104,18 +131,20 @@ foreach user $users_list { template::multirow append related_users [lindex $user 0] [lindex $user 1] [lindex $user 2] [lindex $user 3] [lindex $user 4] [lindex $user 5] } - } elseif { [string eq $type "learning_object"] } { - # the environment has been viwed (finished) if the user have seen the referenced resources - set list_header "[_ imsld.lt_Users_who_have_bviewe]" + # the environment has been viwed (finished) if the user have seen the + # referenced resources + set frame_header "[_ imsld.lt_Users_who_have_bviewe]" template::multirow create related_users user_name email user_id db_1row lo_info { select item_id as learning_object_item_id, - environment_id as environment_item_id + environment_id as environment_item_id, + title as lo_title from imsld_learning_objectsi where learning_object_id = :learning_object_id } + append frame_header " \"$lo_title\"" set item_list [db_list item_linear_list { select ii.imsld_item_id @@ -154,11 +183,12 @@ } } elseif { [string eq $type "service"] } { - # currently, we support there are three types of services: 1. conference, 2. monitory and 3. send-mail - # the first two types have resources associated whereas the last one doesn't and has to be treated as a separate case + # currently, we support there are three types of services: 1. conference, + # 2. monitory and 3. send-mail the first two types have resources + # associated whereas the last one doesn't and has to be treated as a + # separate case + set frame_header "[_ imsld.lt_Users_who_have_bat_le]" - set list_header "[_ imsld.lt_Users_who_have_bat_le]" - template::multirow create related_users user_name email user_id db_1row service_info { @@ -171,7 +201,7 @@ switch $service_type { conference { - append list_header "[_ imsld.conference]" + append frame_header " [_ imsld.conference]" db_1row conference_info { select conf.conference_id, conf.conference_type, @@ -183,6 +213,7 @@ and cr.item_id = conf.imsld_item_id and content_revision__is_live(cr.live_revision) = 't' } + append frame_header " \"$conf_title\"" set related_resources [db_list conf_resources_list { select cpr.resource_id @@ -208,7 +239,7 @@ template::multirow append related_users [person::name -person_id $user_id] [party::email -party_id $user_id] $user_id } } monitor { - append list_header "[_ imsld.monitor]" + append frame_header "[_ imsld.monitor]" db_1row monitor_info { select ims.title as monitor_service_title, ims.monitor_id, @@ -249,9 +280,9 @@ } send-mail { # 1. get the users associated to the run # 2. get the users IN the run who have sent a bulk-mail message - append list_header "[_ imsld.sendmail]" + append frame_header "[_ imsld.sendmail]" - append list_header "<br />[_ imsld.lt_This_is_a_special_cas]" + append frame_header "<br />[_ imsld.lt_This_is_a_special_cas]" db_foreach user_in_run { select gmm.member_id, Index: openacs-4/packages/imsld/www/admin/monitor/environment-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/environment-frame.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/monitor/environment-frame.adp 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/monitor/environment-frame.adp 17 Apr 2008 17:17:54 -0000 1.4 @@ -1,36 +1,16 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <script src="/resources/acs-templating/mktree.js" language="javascript"></script> - <link rel="stylesheet" href="/resources/acs-templating/mktree.css" media="all"> -<style type="text/css"> -ul { -font-family: Verdana, Arial, Helvetica, sans-serif; -font-size: 12px; -font-style: normal; -font-weight: normal; -font-variant: normal; -text-decoration: none; -text-transform: none; -text-indent: 0px; -padding: 0px; -margin: 0px; -} -</style> -</head> -<body> +<master src="../../../lib/imsld-master"> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + <property name="imsld_include_mktree">1</property> -@environments;noquote@ + <div class="frame-header">@frame_header@</div> -</body> + <if @environments@ not nil>@environments;noquote@</if> -<script type="text/javascript"> -var as = document.getElementsByTagName("a"); -for (var i = 0; i < as.length; i++) { - var a = as[i]; - a.setAttribute('target', 'content'); -} -</script> - -</html> + <script type="text/javascript"> + var as = document.getElementsByTagName("a"); + for (var i = 0; i < as.length; i++) { + var a = as[i]; + a.setAttribute('target', 'content'); + } + </script> Index: openacs-4/packages/imsld/www/admin/monitor/environment-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/environment-frame.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/admin/monitor/environment-frame.tcl 25 Apr 2007 10:52:31 -0000 1.2 +++ openacs-4/packages/imsld/www/admin/monitor/environment-frame.tcl 17 Apr 2008 17:17:54 -0000 1.3 @@ -9,36 +9,28 @@ run_id:integer,notnull } +set frame_header "[_ imsld.Context_info]" +set page_title $frame_header +set context [list] + dom createDocument ul doc set dom_root [$doc documentElement] -#set environments_node_ul [$doc createElement ul] -set environments_node_li [$doc createElement li] -set text [$doc createTextNode "[_ imsld.Context_info]"] -$environments_node_li appendChild $text -set environments_node [$doc createElement ul] -$environments_node setAttribute class "mktree" -$environments_node setAttribute style "white-space: nowrap;" +# Create the ul element which will hold all the environment info +$dom_root setAttribute class "mktree" +$dom_root setAttribute style "white-space: nowrap;" -# FIX-ME: if the ul is empty, the browser shows the ul incorrectly -set text [$doc createTextNode ""] -$environments_node appendChild $text - +# Create the li nodes for each environment set activity_item_id [content::revision::item_id -revision_id $activity_id] - imsld::monitor::activity_environments_tree -activity_item_id $activity_item_id \ -run_id $run_id \ - -dom_node $environments_node \ + -dom_node $dom_root \ -dom_doc $doc -$dom_root appendChild $environments_node_li -set environments_node_li [$doc createElement li] -$environments_node_li setAttribute class "liOpen" +# Set the result only if it is not empty +if { [$dom_root hasChildNodes]} { + # Set the result + set environments [$dom_root asXML] +} -$environments_node_li appendChild $environments_node -$dom_root appendChild $environments_node_li -set environments [$dom_root asXML] - -set page_title {} -set context [list] Index: openacs-4/packages/imsld/www/admin/monitor/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/index.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/imsld/www/admin/monitor/index.adp 25 Apr 2007 10:52:31 -0000 1.2 +++ openacs-4/packages/imsld/www/admin/monitor/index.adp 17 Apr 2008 17:17:54 -0000 1.3 @@ -1,15 +1,16 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> -<head> + <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>@course_name@</title> -</head> -<frameset rows="%30,*"> - <frame src="run-info?run_id=@run_id@" name="run-info" title="run-info"> - <frameset cols="30%,*"> - <frameset rows="60%,*"> - <frame src="monitor-tree?run_id=@run_id@" name="toc" title="toc"> + </head> + + <frameset rows="%20,*"> + <frame src="run-info?run_id=@run_id@" name="run-info" title="run-info"> + <frameset id="right-column" cols="30%,*"> + <frameset rows="70%,*"> + <frame src="monitor-tree?run_id=@run_id@" name="toc" title="toc"> <frame src="" name="environment"> </frameset> <frame src="" name="content" title="content"> Index: openacs-4/packages/imsld/www/admin/monitor/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/index.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/monitor/index.tcl 21 Dec 2006 15:20:47 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/monitor/index.tcl 17 Apr 2008 17:17:54 -0000 1.2 @@ -14,4 +14,9 @@ } -errors { } -set course_name "" +set course_name "[db_string run_name { + select obj.title + from acs_objects obj, imsld_runs ir + where obj.object_id = ir.imsld_id + and ir.run_id = :run_id}]" + Index: openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,37 +1,25 @@ -<master> +<master src="../../../lib/imsld-master"> <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> + <property name="imsld_content_frame">1</property> -<span id="addc1" style="position:absolute;top:0px;left:0px;"> -<a href="#" onClick="return _tp(false)" title="Hide panel" class="show-hide-icon_link"><img src="/resources/acs-subsite/stock_left.png" alt="Hide" border="0" align="top" alt=" #imsld.Hide#"/></a> -</span> + <div class="frame-header"> + <if @item_select:rowcount@ not nil> + <include src="../../../lib/choice-select" &="item_select" + select_name=@select_name@ + select_id=@select_id@ + selected_item=@selected_item@ + select_string=@select_string@ + aux_pre_text=@frame_header@ + aux_post_text=@post_text;noquote@ + run_id=@run_id@> + </if><else>@frame_header;noquote@</else> + </div> -#imsld.This# + <br /> -<br /><br /> - -<listtemplate name="activities"></listtemplate> - -<script type="text/javascript"> -function _tp(a){ - var ab=document.getElementById("addc"); - var ac=document.getElementById("addc1"); - - if (a) { - ai=''; - aj='none'; - parent.document.getElementsByTagName("frameset")[1].cols='30%,*'; - } else { - ai='none'; - aj=''; - parent.document.getElementsByTagName("frameset")[1].cols='0%,*'; - } - - ac.style.display=ai; - ab.style.display=aj; - - return false; -} - - -</script> + <if @member_id@ not nil> + <div class="centered-table"> + <listtemplate name="activities"></listtemplate> + </div> + </if> Index: openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.tcl 30 May 2007 08:36:22 -0000 1.3 +++ openacs-4/packages/imsld/www/admin/monitor/individual-report-frame.tcl 17 Apr 2008 17:17:54 -0000 1.4 @@ -8,16 +8,57 @@ @creation-date Dic 2006 } -query { run_id:integer,notnull - member_id:integer,notnull + {member_id:integer ""} } set page_title "[_ imsld.Individual_Report]" set context [list] -set member_name [party::name -party_id $member_id] +set frame_header "[_ imsld.This]: " +# Fetch the users that are active in the run +set users_in_run [imsld::runtime::users_in_run -run_id $run_id] + +if { [llength $users_in_run] == 1 } { + set member_id [lindex $users_in_run 0] +} + +template::multirow create item_select item_id item_name + +set select_name "member_id" +set select_id "users_in_run" +set post_text "" +set selected_item "" +set select_string "" + +# If no member_id has been given, add the option pull-down menu +if { [string eq "" $member_id] } { + set select_string "[_ imsld.Select]" +} else { + # Set variable portrait_revision if user has portrait + if { [db_0or1row get_member_portrait { + select c.live_revision + from acs_rels a, cr_items c + where a.object_id_two = c.item_id + and a.object_id_one = :member_id + and a.rel_type = 'user_portrait_rel'}]} { + + set post_text "<img style=\"height: 100px; vertical-align: middle\" src=\"/shared/portrait-bits.tcl?user_id=$member_id\" alt=\"Portrait\"/>" + } +} + +foreach user_id_in_run $users_in_run { + template::multirow append item_select $user_id_in_run \ + "[person::name -person_id $user_id_in_run]" + + if { $member_id == $user_id_in_run} { + set selected_item $member_id + } +} + set elements [list user_name \ [list label "[_ imsld.Activity_Name]" \ - display_template {<a href="activity-frame?run_id=$run_id&type=@related_activities.type@&activity_id=@related_activities.related_id@">@related_activities.activity_name@</a>}] \ + display_template \ + {<a href="activity-frame?run_id=$run_id&type=@related_activities.type@&activity_id=@related_activities.related_id@" title="[_ imsld.Activity_report]">@related_activities.activity_name@</a>}] \ type \ [list label "[_ imsld.Activity_Type]"] \ started_time \ @@ -44,20 +85,36 @@ # the elemen exists, replace the list element switch $status { started { - set activities_list [lreplace $activities_list [lsearch -regexp $activities_list $related_id] [lsearch -regexp $activities_list $related_id] \ - [list $related_id \ - [content::item::get_title -item_id [content::revision::item_id -revision_id $related_id]] \ - $type \ - $status_date \ - [lindex [lindex $activities_list [lsearch -regexp $activities_list $related_id]] 4]]] + set activities_list \ + [lreplace $activities_list \ + [lsearch -regexp $activities_list $related_id] \ + [lsearch -regexp $activities_list $related_id] \ + [list $related_id \ + [content::item::get_title \ + -item_id \ + [content::revision::item_id \ + -revision_id $related_id]] \ + $type \ + $status_date \ + [lindex [lindex $activities_list \ + [lsearch -regexp $activities_list \ + $related_id]] 4]]] } finished { - set activities_list [lreplace $activities_list [lsearch -regexp $activities_list $related_id] [lsearch -regexp $activities_list $related_id] \ - [list $related_id \ - [content::item::get_title -item_id [content::revision::item_id -revision_id $related_id]] \ - $type \ - [lindex [lindex $activities_list [lsearch -regexp $activities_list $related_id]] 3] \ - $status_date]] + set activities_list \ + [lreplace $activities_list \ + [lsearch -regexp $activities_list $related_id] \ + [lsearch -regexp $activities_list $related_id] \ + [list $related_id \ + [content::item::get_title \ + -item_id \ + [content::revision::item_id \ + -revision_id $related_id]] \ + $type \ + [lindex [lindex $activities_list \ + [lsearch -regexp $activities_list \ + $related_id]] 3] \ + $status_date]] } } } else { @@ -66,20 +123,24 @@ started { lappend activities_list \ [list $related_id \ - [content::item::get_title -item_id [content::revision::item_id -revision_id $related_id]] \ + [content::item::get_title \ + -item_id [content::revision::item_id \ + -revision_id $related_id]] \ $type \ $status_date \ {}] } finished { lappend activities_list \ [list $related_id \ - [content::item::get_title -item_id [content::revision::item_id -revision_id $related_id]] \ + [content::item::get_title \ + -item_id [content::revision::item_id \ + -revision_id $related_id]] \ $type \ {} \ $status_date] } - } + } } } @@ -93,4 +154,4 @@ -multirow related_activities \ -key related_id \ -no_data "[_ imsld.No_info_was_found]" \ - -elements $elements \ No newline at end of file + -elements $elements Index: openacs-4/packages/imsld/www/admin/monitor/monitor-tree.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/monitor-tree.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/monitor/monitor-tree.adp 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/monitor/monitor-tree.adp 17 Apr 2008 17:17:54 -0000 1.5 @@ -1,80 +1,37 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <script src="/resources/acs-templating/mktree.js" language="javascript"></script> - <link rel="stylesheet" href="/resources/acs-templating/mktree.css" media="all"> +<master src="../../../lib/imsld-master"> + <property name="title">@page_title;noquote@</property> + <property name="context">@context;noquote@</property> + <property name="imsld_include_mktree">1</property> -<SCRIPT> - function confirmValue(myform){ - myform.submit() - } -</SCRIPT> -<NOSCRIPT> -<br /><br /> -#imsld.lt_Sorry_your_browser_do# -<br /><br /> -</NOSCRIPT> + <div class="float-left"> + <a href="@imsld_admin_url@" class="button" target="_top" + title="#imsld.Exit_Monitor#">#imsld.Exit_Monitor#</a> + </div> + <div class="frame-header">#imsld.Activities#</div> + + <br /> -<style type="text/css"> -ul { -font-family: Verdana, Arial, Helvetica, sans-serif; -font-size: 12px; -font-style: normal; -font-weight: normal; -font-variant: normal; -text-decoration: none; -text-transform: none; -text-indent: -15px; -padding: 15px 0px 0px 0px; -margin: 0px; -} -div { - text-align: right; - font-size: 80%; -} -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; -} - -</style> -</head> -<body> -<a href="@imsld_admin_url@" style="display: block; position: fixed;" class="button" target="_top">#imsld.Exit#</a> -<br /> -@properties_tree;noquote@ -@html_tree;noquote@ -@aux_html_tree;noquote@ -</body> - -<script type="text/javascript"> -var as = document.getElementsByTagName("a"); -for (var i = 0; i < as.length; i++) { - var a = as[i]; - for( var x = 0; x < a.attributes.length; x++ ) { - if( a.attributes[x].nodeName.toLowerCase() == 'href' ) { - if ( a.attributes[x].nodeValue.match(/activity-frame/) ) { - var enviromenturl = a.attributes[x].nodeValue.replace(/activity-frame/, "environment-frame"); - a.setAttribute('onClick',"parent.environment.location='" + enviromenturl + "'"); - } + @properties_tree;noquote@ + + @user_activity;noquote@ + + @html_tree;noquote@ + + @aux_html_tree;noquote@ + + <!-- Script needed to show environments in the proper frame --> + <script type="text/javascript"> + var as = document.getElementsByTagName("a"); + for (var i = 0; i < as.length; i++) { + var a = as[i]; + for( var x = 0; x < a.attributes.length; x++ ) { + if( a.attributes[x].nodeName.toLowerCase() == 'href' ) { + if ( a.attributes[x].nodeValue.match(/activity-frame/) ) { + var enviromenturl = a.attributes[x].nodeValue.replace(/activity-frame/, "environment-frame"); + a.setAttribute('onClick',"parent.environment.location='" + enviromenturl + "'"); + } + } + } } - } -} -</script> + </script> -</html> Index: openacs-4/packages/imsld/www/admin/monitor/monitor-tree.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/monitor-tree.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/imsld/www/admin/monitor/monitor-tree.tcl 30 May 2007 08:36:22 -0000 1.4 +++ openacs-4/packages/imsld/www/admin/monitor/monitor-tree.tcl 17 Apr 2008 17:17:54 -0000 1.5 @@ -12,7 +12,8 @@ set cr_root_folder_id [imsld::cr::get_root_folder -community_id $community_id] set user_id [ad_conn user_id] set imsld_package_id [site_node_apm_integration::get_child_package_id \ - -package_id [dotlrn_community::get_package_id $community_id] \ + -package_id [dotlrn_community::get_package_id \ + $community_id] \ -package_key "[imsld::package_key]"] set imsld_admin_url [export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]admin/"] @@ -31,12 +32,12 @@ from imsld_property_instances where run_id = :run_id or run_id is null + and content_revision__is_live(instance_id) = 't' }] } { # there is at least one property dom createDocument ul props_doc set props_dom_root [$props_doc documentElement] $props_dom_root setAttribute class "mktree" - $props_dom_root setAttribute style "white-space: nowrap;" set props_title_node [$props_doc createElement li] $props_title_node setAttribute class "liOpen" set text [$props_doc createTextNode "[_ imsld.Monitor_properties]"] @@ -55,10 +56,28 @@ set properties_tree "" } +# Create the link to the page to monitor user activity dom createDocument ul doc set dom_root [$doc documentElement] $dom_root setAttribute class "mktree" -$dom_root setAttribute style "white-space: nowrap;" + +set li_node [$doc createElement li] +$dom_root appendChild $li_node +$li_node setAttribute class "liBullet" + +set a_node [$doc createElement a] +$a_node setAttribute href \ + "[export_vars -base "individual-report-frame" -url {run_id}]" +$a_node setAttribute target "content" +$a_node appendChild [$doc createTextNode "[_ imsld.User_activity_reports]"] +$li_node appendChild $a_node + +set user_activity [$dom_root asXML] + +# Create the activity tree +dom createDocument ul doc +set dom_root [$doc documentElement] +$dom_root setAttribute class "mktree" set imsld_title_node [$doc createElement li] $imsld_title_node setAttribute class "liOpen" set text [$doc createTextNode "$imsld_title"] @@ -84,7 +103,6 @@ dom createDocument ul aux_doc set aux_dom_root [$aux_doc documentElement] $aux_dom_root setAttribute class "mktree" - $aux_dom_root setAttribute style "white-space: nowrap;" set aux_title_node [$aux_doc createElement li] $aux_title_node setAttribute class "liOpen" set text [$doc createTextNode "[_ imsld.Extra_Activities]"] Index: openacs-4/packages/imsld/www/admin/monitor/properties-frame.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/properties-frame.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/monitor/properties-frame.tcl 25 Apr 2007 10:52:31 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/monitor/properties-frame.tcl 17 Apr 2008 17:17:54 -0000 1.2 @@ -20,172 +20,108 @@ } } -# 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 -} - # Get file-storage root folder_id set fs_package_id [site_node_apm_integration::get_child_package_id \ -package_id [dotlrn_community::get_package_id [dotlrn_community::get_community_id]] \ -package_key "file-storage"] set root_folder_id [fs::get_root_folder -package_id $fs_package_id] -dom createDocument html dom_doc -set dom_root [$dom_doc documentElement] -set head_node [$dom_doc createElement head] -set link_node [$dom_doc createElement link] -$link_node setAttribute rel "stylesheet" -$link_node setAttribute type "text/css" -$link_node setAttribute href "/resources/acs-templating/lists.css" -$link_node setAttribute media "all" -$head_node appendChild $link_node - -set script_node [$dom_doc createElement script] -$script_node appendChild [$dom_doc createTextNode { - function confirmValue(myform){ - myform.submit() - } -}] - -$head_node appendChild $script_node -$dom_root appendChild $head_node - -set body_node [$dom_doc createElement body] - -# prepare final output... a little bit tedious to get it "pretty" -# using the default css of openacs - # if the property type is of type locpers or globpers # we first need to specify which user will be monitorized if { [string eq $type "locpers"] || [string eq $type "globpers"] } { - set form_node [$dom_doc createElement form] - $form_node setAttribute name "choose" - $form_node setAttribute action "" - set select_node [$dom_doc createElement select] - $select_node setAttribute name "user_id" - $select_node setAttribute id "users_in_run" - $select_node setAttribute onChange "confirmValue(this.form)" + # Fetch the users that are active in the run + set users_in_run [imsld::runtime::users_in_run -run_id $run_id] - if { [string eq "" $user_id] } { - set option_node [$dom_doc createElement option] - $option_node setAttribute value "select" - set text [$dom_doc createTextNode "[_ imsld.Select]"] - $option_node appendChild $text - $select_node appendChild $option_node + template::multirow create item_select item_id item_name + + # Add the frame main title depending on the type of property + if { [string eq $type "locpers"] } { + set frame_header "[_ imsld.lt_Local-personal_Prop]: " + } else { + set frame_header "[_ imsld.lt_Global-personal_Pro]: " } - foreach user_id_in_run [imsld::runtime::users_in_run -run_id $run_id] { - set option_node [$dom_doc createElement option] - $option_node setAttribute value $user_id_in_run - set text [$dom_doc createTextNode "[person::name -person_id $user_id_in_run]"] - $option_node appendChild $text + if { [llength $users_in_run] == 1 } { + set user_id [lindex $users_in_run 0] + } + set select_name "user_id" + set select_id "users_in_run" + set post_text "" + set selected_item "" + set select_string "" + + # If no user has been given, add the option pull-down menu + if { [string eq "" $user_id] } { + set select_string "[_ imsld.Select]" + } else { + # Set variable portrait_revision if user has portrait + if { [db_0or1row get_member_portrait { + select c.live_revision + from acs_rels a, cr_items c + where a.object_id_two = c.item_id + and a.object_id_one = :user_id + and a.rel_type = 'user_portrait_rel'}]} { + + set post_text "<img style=\"height: 100px; vertical-align: middle\" src=\"/shared/portrait-bits.tcl?user_id=$user_id\" alt=\"Portrait\"/>" + } + } + + foreach user_id_in_run $users_in_run { + template::multirow append item_select $user_id_in_run \ + "[person::name -person_id $user_id_in_run]" + if { $user_id == $user_id_in_run} { - $option_node setAttribute selected "selected" + set selected_item $user_id } - $select_node appendChild $option_node } - $form_node appendChild $select_node +} elseif { [string eq $type "locrole"] } { + # first, the role instance must be selected + set role_instance_ids [imsld::roles::get_role_instances \ + -role_id $role_id \ + -run_id $run_id] - # adding hidden variables - set run_id_node [$dom_doc createElement "input"] - $run_id_node setAttribute name "run_id" - $run_id_node setAttribute type "hidden" - $run_id_node setAttribute value "$run_id" - $form_node appendChild $run_id_node + template::multirow create item_select item_id item_name - set type_node [$dom_doc createElement "input"] - $type_node setAttribute name "type" - $type_node setAttribute type "hidden" - $type_node setAttribute value "$type" - $form_node appendChild $type_node + set frame_header "[_ imsld.lt_Local-role_Properti]: " + set page_title $frame_header - # adding the submit button - set submit_node [$dom_doc createElement "input"] - $submit_node setAttribute type "submit" - $submit_node setAttribute value "ok" - $submit_node setAttribute name "ok" - $form_node appendChild $submit_node + if { [llength $role_instance_ids] == 1 } { + set role_instance_id [lindex $role_instance_ids 0] + set role_name "[db_string role_instance_name { select acs_group__name(:role_instance_id) }]" + } - # done... add the form to the document - $body_node appendChild $form_node + set select_name "role_instance_id" + set select_id "roles_in_run" + set post_text "" + set selected_item "" + set select_string "" -} elseif { [string eq $type "locrole"] } { - - # first, the role instance must be selected - - set form_node [$dom_doc createElement form] - $form_node setAttribute name "choose" - $form_node setAttribute action "" - set select_node [$dom_doc createElement select] - $select_node setAttribute name "role_instance_id" - $select_node setAttribute id "roles_in_run" - $select_node setAttribute onChange "confirmValue(this.form)" - if { [string eq "" $role_instance_id] } { - set option_node [$dom_doc createElement option] - $option_node setAttribute value "select" - set text [$dom_doc createTextNode "[_ imsld.Select_role]"] - $option_node appendChild $text - $select_node appendChild $option_node + set select_string "[_ imsld.Select_role]" } + + foreach role_instance_id_in_role $role_instance_ids { + template::multirow append item_select $role_instance_id_in_role \ + "[db_string role_instance_name {select + acs_group__name(:role_instance_id_in_role) }]" - foreach role_instance_id_in_role [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id] { - set option_node [$dom_doc createElement option] - $option_node setAttribute value $role_instance_id_in_role - set text [$dom_doc createTextNode "[db_string role_instance_name { select acs_group__name(:role_instance_id_in_role) }]"] - $option_node appendChild $text - if { $role_instance_id == $role_instance_id_in_role } { - $option_node setAttribute selected "selected" + set selected_item $role_instance_id } - $select_node appendChild $option_node } - $form_node appendChild $select_node - # adding hidden variables - set run_id_node [$dom_doc createElement "input"] - $run_id_node setAttribute name "run_id" - $run_id_node setAttribute type "hidden" - $run_id_node setAttribute value "$run_id" - $form_node appendChild $run_id_node +} elseif { [string eq $type "glob"] } { + set frame_header "[_ imsld.Global_Properties]" +} elseif { [string eq $type "loc"] } { + set frame_header "[_ imsld.Local_Properties]" +} - set type_node [$dom_doc createElement "input"] - $type_node setAttribute name "type" - $type_node setAttribute type "hidden" - $type_node setAttribute value "$type" - $form_node appendChild $type_node - - set role_id_node [$dom_doc createElement "input"] - $role_id_node setAttribute name "role_id" - $role_id_node setAttribute type "hidden" - $role_id_node setAttribute value "$role_id" - $form_node appendChild $role_id_node - - # adding the submit button - set submit_node [$dom_doc createElement "input"] - $submit_node setAttribute type "submit" - $submit_node setAttribute value "ok" - $submit_node setAttribute name "ok" - $form_node appendChild $submit_node - - # done... add the form to the document - $body_node appendChild $form_node - -} - -set table_node [$dom_doc createElement table] -$table_node setAttribute class list +# Create the table with the properties +dom createDocument table dom_doc +set table_node [$dom_doc documentElement] +$table_node setAttribute class list-table $table_node setAttribute cellpadding 3 $table_node setAttribute cellspacing 1 @@ -230,7 +166,7 @@ prop.datatype, prop.item_id as property_item_id, coalesce(ins.value, prop.initial_value) as value, - ins.title, + coalesce(ins.title, ins.identifier) as title, ins.instance_id from imsld_property_instancesx ins, cr_revisions cr, @@ -239,6 +175,7 @@ and $where_clause and cr.revision_id = ins.instance_id and content_revision__is_live(ins.instance_id) = 't' + order by title " { # if the property is of type file, we must provide a file-upload field set input_text_node "" @@ -334,6 +271,21 @@ $owner_node setAttribute value "$user_id" $form_node appendChild $owner_node + if { ![string eq "" $role_instance_id] } { + set role_instance_node [$dom_doc createElement "input"] + $role_instance_node setAttribute name "role_instance_id" + $role_instance_node setAttribute type "hidden" + $role_instance_node setAttribute value "$role_instance_id" + $form_node appendChild $role_instance_node + } + + # adding hidden variables + set run_id_node [$dom_doc createElement "input"] + $run_id_node setAttribute name "run_id" + $run_id_node setAttribute type "hidden" + $run_id_node setAttribute value "$run_id" + $form_node appendChild $run_id_node + # adding return url set return_url_node [$dom_doc createElement "input"] $return_url_node setAttribute name "return_url" @@ -346,6 +298,7 @@ $submit_node setAttribute type "submit" $submit_node setAttribute value "ok" $form_node appendChild $submit_node + # done... add the form to the table set td_node [$dom_doc createElement td] $td_node setAttribute class list @@ -366,14 +319,13 @@ $table_node appendChild $tr_node } -$body_node appendChild $table_node -$dom_root appendChild $body_node +# Render table only if user_id or role_instance_id is set +if { ![string eq "" $user_id] || ![string eq "" $role_instance_id] + || [string eq $type "glob"] || [string eq $type "loc"]} { + set table_node [$table_node asXML] +} else { + set table_node "" +} -set script_node [$dom_doc createElement script] -$script_node appendChild [$dom_doc createTextNode {document.forms['choose'].elements['ok'].style.display="none"}] +set page_title $frame_header -$dom_root appendChild $script_node - -set xmloutput {<?xml version="1.0" encoding="UTF-8"?>} -append xmloutput [$dom_root asXML] -ns_return 200 text/html $xmloutput Index: openacs-4/packages/imsld/www/admin/monitor/run-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/run-info.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/monitor/run-info.adp 21 Dec 2006 15:20:47 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/monitor/run-info.adp 17 Apr 2008 17:17:54 -0000 1.2 @@ -1,29 +1,38 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" + "http://www.w3.org/TR/html4/loose.dtd"> <html> -<head> + <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> - <script src="/resources/acs-templating/mktree.js" language="javascript"></script> + <script src="/resources/acs-templating/mktree.js" + language="javascript"></script> <link rel="stylesheet" href="/resources/acs-templating/mktree.css" media="all"> -<style type="text/css"> -p { -font: 10pt/22pt; -font-family:Verdana, Arial, Helvetica, sans-serif; -text-align:center; -font-size: 11px; -color: #ffffff; -margin: 0px; -padding: 0px 0px 0px 0px; -} -body { -margin: 0px; -padding: 0px 0px 0px 0px; -top: 0px; -background-color: #7697B9; -} -</style> -</head> -<body> -<p>#imsld.Runinfo_Name# <i>@imsld_title@</i> #imsld._Assigned_users# <i>@number_of_members@</i> #imsld._Creation_Date# <i>@creation_date@</i> #imsld._Status_The_run_is# <i><b>@status@</b></i> #imsld.since# <i>@status_date@</i></p> -</body> + <link rel="stylesheet" href="/resources/theme-zen/css/main.css" media="all"> + <style type="text/css"> + p { + font-family:Verdana, Arial, Helvetica, sans-serif; + text-align:center; + font-size: 11px; + color: #ffffff; + margin: 0px; + padding: 0px 0px 0px 0px; + } + body { + margin: 0px; + padding: 0px 0px 0px 0px; + top: 0px; + background-color: #0000FF; + } + </style> + </head> + <body> + <p> + #imsld.Runinfo_Name# + <i>@imsld_title@</i> #imsld._Assigned_users# + <i>@number_of_members@</i> #imsld._Creation_Date# + <i>@creation_date@</i> #imsld._Status_The_run_is# + <i><b>@status@</b></i> #imsld.since# + <i>@status_date@</i> + </p> + </body> </html> Index: openacs-4/packages/imsld/www/admin/monitor/run-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/run-info.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/monitor/run-info.tcl 21 Dec 2006 15:20:47 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/monitor/run-info.tcl 17 Apr 2008 17:17:54 -0000 1.2 @@ -33,4 +33,4 @@ where iruge.run_id=:run_id and ar1.object_id_two=iruge.group_id and ar1.object_id_one=gmm.group_id -} \ No newline at end of file +} Index: openacs-4/packages/imsld/www/resources/tabber.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/resources/tabber.js,v diff -u -r1.1 -r1.2 --- openacs-4/packages/imsld/www/resources/tabber.js 5 Apr 2006 18:39:58 -0000 1.1 +++ openacs-4/packages/imsld/www/resources/tabber.js 17 Apr 2008 17:17:55 -0000 1.2 @@ -471,7 +471,6 @@ /* Run tabberAutomaticOnload() unless the "manualStartup" option was specified */ - if (typeof tabberOptions == 'undefined') { tabberAutomaticOnLoad(); @@ -482,4 +481,4 @@ tabberAutomaticOnLoad(tabberOptions); } -} +}