Index: openacs-4/packages/curriculum-central/tcl/uos-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/uos-procs.tcl,v diff -u -r1.33 -r1.34 --- openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 2 Jun 2006 11:55:58 -0000 1.33 +++ openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 3 Jun 2006 09:47:07 -0000 1.34 @@ -891,16 +891,15 @@ ad_proc -public curriculum_central::uos::update_assess { -assess_id:required - -assess_method_ids + -uos_id:required {-user_id ""} {-creation_ip ""} } { Updates the assessment component for a Unit of Study. This update proc creates a new assessment revision. @param assess_id The ID of the assessment object to update. - @param assess_method_ids List of IDs that need to be mapped to the set - of assessment methods. + @param uos_id Unit of Study ID. @param user_id The ID of the user that updated the Unit of Study. @param creation_ip The IP of the user that made the update. @@ -917,11 +916,16 @@ # Set the default value for revision_id. set revision_id "" db_transaction { + # Retrieve assessment info for Unit of Study. + curriculum_central::uos::get_assessment \ + -uos_id $uos_id \ + -array uos_assess + set revision_id [db_exec_plsql update_assess {}] # Foreach assess_method_id map to the newly created revision_id # retrieved above. - foreach assess_method_id $assess_method_ids { + foreach assess_method_id $uos_assess(assess_method_ids) { db_exec_plsql map_assess_to_revision {} } } Index: openacs-4/packages/curriculum-central/www/coordinate/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/index.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/curriculum-central/www/coordinate/index.adp 2 Jun 2006 12:01:41 -0000 1.15 +++ openacs-4/packages/curriculum-central/www/coordinate/index.adp 3 Jun 2006 09:50:32 -0000 1.16 @@ -2,11 +2,6 @@ <property name="title">@page_title;noquote@</property> <property name="context">@context;noquote@</property> -<h3>Things to delete</h3> -<ul> -<li><a href="assess-methods">#curriculum-central.manage_your_list_of_assessment_methods#</a></li> -</ul> - <if @stream_coordinator_p@> <h3>#curriculum-central.department_level_administration#</h3> <ul> Index: openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl,v diff -u -r1.21 -r1.22 --- openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 2 Jun 2006 11:56:58 -0000 1.21 +++ openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 3 Jun 2006 09:49:27 -0000 1.22 @@ -30,9 +30,32 @@ set enabled_action_id [form get_action uos] set action_id "" +# Set some variables to determine edit mode. +# Required for iframes. +set edit_tl_p 0 +set edit_assn_p 0 + if { $enabled_action_id ne "" } { - workflow::case::enabled_action_get -enabled_action_id $enabled_action_id -array enabled_action + workflow::case::enabled_action_get \ + -enabled_action_id $enabled_action_id \ + -array enabled_action + set action_id $enabled_action(action_id) + + workflow::action::get \ + -action_id $enabled_action(action_id) \ + -array action_info + + # If the current action is edit_tl, then set the + # teaching and learning edit flag to true. + if { $action_info(short_name) eq "edit_tl"} { + set edit_tl_p 1 + } + # If the current action is edit_assessment, then set the + # assessment edit flag to true. + if { $action_info(short_name) eq "edit_assessment"} { + set edit_assn_p 1 + } } # Buttons @@ -242,24 +265,6 @@ -uos_id $uos_id \ -array uos_tl -set edit_tl_p 0 -if { $enabled_action_id ne "" } { - # Retrieve some workflow information - workflow::case::enabled_action_get \ - -enabled_action_id $enabled_action_id \ - -array enabled_action_info - - workflow::action::get \ - -action_id $enabled_action_info(action_id) \ - -array action_info - - # If the current action is edit_assessment, then set the - # grade descriptor fields as editable. - if { $action_info(short_name) eq "edit_tl"} { - set edit_tl_p 1 - } -} - set tl_methods_url [export_vars -url -base "iframe/tl-methods-view" {uos_id {edit_p $edit_tl_p}}] # Add widgets for Teaching and Learning. @@ -412,24 +417,27 @@ -uos_id $uos_id \ -array uos_assess +set assess_view_url [export_vars -url -base "iframe/assess-view" \ + {uos_id {edit_p $edit_assn_p}}] + # Add widgets for Assessment ad_form -extend -name uos -form { {assess_id:integer(hidden),optional {value $uos_assess(assess_id)} } - {assess_method_ids:text(multiselect),multiple,optional + {assess_method_ids:text(inform) {label "[_ curriculum-central.assessment_methods]"} - {options [curriculum_central::uos::assess_method_get_options]} - {html {size 5}} - {values $uos_assess(assess_method_ids)} + {label "[_ curriculum-central.assessment_methods]"} {mode display} - {help_text "[_ curriculum-central.help_assess_method_ids]"} + {after_html + { + <iframe src="$assess_view_url" width="600px" height="380" marginwidth="0" marginheight="0"> + Your browser does not support IFRAMES, + please consider upgrading your browser. + </iframe> + } + } } - {assess_total:text(inform) - {label "[_ curriculum-central.current_assessment_total]"} - {value "[curriculum_central::uos::get_assessment_total -assess_id $uos_assess(assess_id)]%"} - {mode display} - } } @@ -590,7 +598,8 @@ curriculum_central::uos::update_assess \ -assess_id $assess_id \ - -assess_method_ids $assess_method_ids + -uos_id $uos_id +# -assess_method_ids $assess_method_ids # For Grade Descriptor fields Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae-postgresql.xql 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,56 @@ +<?xml version="1.0"?> + +<queryset> + <rdbms><type>postgresql</type><version>7.4</version></rdbms> + + <fullquery name="uos_code"> + <querytext> + SELECT n.uos_code + FROM cc_uos_name n, cc_uos u + WHERE u.uos_name_id = n.name_id + AND u.uos_id = :uos_id + </querytext> + </fullquery> + + <fullquery name="latest_am"> + <querytext> + SELECT s.latest_revision_id + FROM cc_uos u, cc_uos_revisions r, cr_items i, cc_uos_assess s + WHERE u.uos_id = :uos_id + AND i.item_id = u.uos_id + AND r.uos_revision_id = i.latest_revision + AND s.parent_uos_id = :uos_id + </querytext> + </fullquery> + + <fullquery name="map_am_to_revision"> + <querytext> + SELECT cc_uos_assess_method__map ( + :latest_revision_id, + :method_id + ); + </querytext> + </fullquery> + + <fullquery name="am_update"> + <querytext> + UPDATE cc_uos_assess_method + SET name = :name, + identifier = :identifier, + description = :description, + weighting = :weighting + WHERE method_id = :method_id + </querytext> + </fullquery> + + <fullquery name="object_update"> + <querytext> + UPDATE acs_objects + SET modifying_user = :modifying_user, + modifying_ip = :modifying_ip, + package_id = :package_id + WHERE object_id = :method_id + </querytext> + </fullquery> + +</queryset> Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.adp 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,10 @@ +<master src="../../resources/iframe-master"> +<property name="title">@page_title;noquote@</property> +<property name="header_stuff"> +<link rel="stylesheet" type="text/css" href="/resources/acs-templating/forms.css" media="all" /> +<link rel="stylesheet" type="text/css" href="/resources/acs-templating/forms.css" media="all" /> +<link rel="stylesheet" type="text/css" href="/resources/acs-templating/lists.css" media="all" /> +</property> + + +<formtemplate id="assess_method"></formtemplate> Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-ae.tcl 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,76 @@ +ad_page_contract { + Add/Edit an assessment method for a specific UoS. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-06-01 + @cvs-id $Id: assess-ae.tcl,v 1.1 2006/06/03 09:49:27 ncarroll Exp $ +} { + uos_id:integer + method_id:integer,optional + {return_url "[export_vars -url -base assess-view {uos_id {edit_p 1}}]"} +} + +auth::require_login + +if { [info exists method_id] } { + set page_title [_ curriculum-central.edit_assess_method] +} else { + set page_title [_ curriculum-central.add_assess_method] +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set uos_code [db_string uos_code {} -default ""] + +ad_form -name assess_method -cancel_url $return_url -form { + {method_id:key(acs_object_id_seq)} + {uos_id:text(hidden) {value $uos_id}} + {return_url:text(hidden) {value $return_url}} + {identifier:text(hidden) {value $uos_code}} + {name:text + {html {size 25}} + {label "[_ curriculum-central.name]" } + {help_text "[_ curriculum-central.help_enter_type_of_assess_method]"} + } + {weighting:integer + {html {size 3}} + {label "[_ curriculum-central.weighting]" } + {help_text "[_ curriculum-central.help_enter_assess_weighting]"} + } + {description:text(textarea) + {html {cols 40 rows 10}} + {label "[_ curriculum-central.description]" } + {help_text "[_ curriculum-central.help_enter_assess_description]"} + } +} -select_query { + SELECT name, weighting, description, identifier + FROM cc_uos_assess_method WHERE method_id = :method_id +} -new_data { + + db_transaction { + set method_id [package_instantiate_object \ + -var_list [list [list package_id $package_id] \ + [list object_type cc_uos_assess_method] \ + [list name $name] \ + [list identifier $identifier] \ + [list description $description] \ + [list weighting $weighting]] \ + -form_id assess_method cc_uos_assess_method] + + # Retrieve the latest assessment methods version. + db_1row latest_am {} + # Map the method_id to the latest assessment methods version. + db_exec_plsql map_am_to_revision {} + } + +} -edit_data { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml am_update {} + db_dml object_update {} +} -after_submit { + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del-postgresql.xql 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,19 @@ +<?xml version="1.0"?> + +<queryset> + <rdbms><type>postgresql</type><version>7.4</version></rdbms> + + <fullquery name="am_delete"> + <querytext> + SELECT cc_uos_assess_method__del(:method_id) + </querytext> + </fullquery> + + <fullquery name="am_map_update"> + <querytext> + UPDATE cc_uos_assess_method_map SET method_id = NULL + WHERE method_id = :method_id + </querytext> + </fullquery> + +</queryset> Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-del.tcl 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,21 @@ +ad_page_contract { + Deletes an assessment method. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-06-01 + @cvs-id $Id: assess-del.tcl,v 1.1 2006/06/03 09:49:27 ncarroll Exp $ +} { + method_id:integer + uos_id:integer + {return_url "[export_vars -url -base assess-view {uos_id {edit_p 1}}]"} +} + +set package_id [ad_conn package_id] + +db_transaction { + db_dml am_map_update {} + db_exec_plsql am_delete {} +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view-postgresql.xql 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,29 @@ +<?xml version="1.0"?> + +<queryset> + <rdbms><type>postgresql</type><version>7.4</version></rdbms> + + <fullquery name="latest_am"> + <querytext> + SELECT s.assess_id, s.latest_revision_id + FROM cc_uos u, cc_uos_revisions r, cr_items i, cc_uos_assess s + WHERE u.uos_id = :uos_id + AND i.item_id = u.uos_id + AND r.uos_revision_id = i.latest_revision + AND s.parent_uos_id = :uos_id + </querytext> + </fullquery> + + <fullquery name="get_methods"> + <querytext> + SELECT a.method_id, a.name, a.description, a.weighting + FROM cc_uos_assess_method a, acs_objects o, cc_uos_assess_method_map m + WHERE o.package_id = :package_id + AND a.method_id = o.object_id + AND m.assess_revision_id = :latest_revision_id + AND a.method_id = m.method_id + [template::list::orderby_clause -orderby -name "methods"] + </querytext> + </fullquery> + +</queryset> Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.adp 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,13 @@ +<master src="../../resources/iframe-master"> +<property name="title">@page_title;noquote@</property> +<property name="header_stuff"> +<link rel="stylesheet" type="text/css" href="/resources/acs-templating/forms.css" media="all" /> +<link rel="stylesheet" type="text/css" href="/resources/acs-templating/lists.css" media="all" /> +<link rel="stylesheet" type="text/css" href="/resources/curriculum-central/iframe-master.css" media="all" /> +</property> + +<listtemplate name="methods"></listtemplate> + +<p> +<center><b>#curriculum-central.current_assessment_total#: @total;noquote@%</b></center> +</p> Index: openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/iframe/assess-view.tcl 3 Jun 2006 09:49:27 -0000 1.1 @@ -0,0 +1,95 @@ +ad_page_contract { + Page for listing assessment methods for a specific UoS. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-06-01 + @cvs-id $Id: assess-view.tcl,v 1.1 2006/06/03 09:49:27 ncarroll Exp $ +} { + uos_id:integer,notnull + edit_p:integer,notnull + {orderby "name,asc"} +} + +auth::require_login + +set page_title "[_ curriculum-central.assess_methods]" +set context [list [list . [_ curriculum-central.coordinate]] $page_title] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +if { $edit_p } { + set elements { + edit { + sub_class narrow + display_template { + <img src="/shared/images/Edit16.gif" height="16" width="16" border="0"> + } + link_url_eval {[export_vars -url -base assess-ae { uos_id method_id }]} + link_html {title "#curriculum-central.edit_assess_method#"} + } + name { + label "#curriculum-central.name#" + } + weighting { + label "#curriculum-central.weighting#" + } + description { + label "#curriculum-central.description#" + html {width "100%"} + } + delete { + sub_class narrow + display_template { + <img src="/shared/images/Delete16.gif" height="16" width="16" border="0"> + } + link_url_eval {[export_vars -base assess-del { uos_id method_id }]} + link_html {title "#curriculum-central.delete_assess_method#" onclick "return confirm(\'[_ curriculum-central.want_to_delete_assess_method]\');"} + } + } + + template::list::create \ + -name methods \ + -actions [list "#curriculum-central.add_assess_method#" [export_vars -base assess-ae { uos_id }] "#curriculum-central.add_assess_method_to_list#"] \ + -multirow methods \ + -no_data "#curriculum-central.no_assess_methods_created#" \ + -elements $elements \ + -orderby { + name {orderby {lower(a.name)}} + } \ + -filters {uos_id {} edit_p {}} \ + -pass_properties {uos_id} +} else { + set elements { + name { + label "#curriculum-central.name#" + } + weighting { + label "#curriculum-central.weighting#" + } + description { + label "#curriculum-central.description#" + html {width "100%"} + } + } + + template::list::create \ + -name methods \ + -multirow methods \ + -no_data "#curriculum-central.no_assess_methods_created#" \ + -elements $elements \ + -orderby { + name {orderby {lower(a.name)}} + } \ + -filters {uos_id {} edit_p {}} \ + -pass_properties {uos_id} +} + +set latest_revision_id "" +db_0or1row latest_am {} + +set total 0 +db_multirow methods get_methods {} { + set total [expr $total + $weighting] +} + +ad_return_template