Index: openacs-4/packages/curriculum-central/curriculum-central.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/curriculum-central.info,v diff -u -r1.4 -r1.5 --- openacs-4/packages/curriculum-central/curriculum-central.info 3 Jan 2006 03:23:27 -0000 1.4 +++ openacs-4/packages/curriculum-central/curriculum-central.info 3 Jan 2006 12:53:51 -0000 1.5 @@ -7,14 +7,14 @@ f f - + Nick Carroll An application for managing the subjects comprising a course of study in a School or University. WEG Curriculum Central is an application for managing subjects comprising a course of study in a School or University. The application will allow academic staff to collaborate on course syllabus and rubrics, which can then be conveyed to students using course maps. 0 - + Index: openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml,v diff -u -r1.17 -r1.18 --- openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 3 Jan 2006 03:23:27 -0000 1.17 +++ openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 3 Jan 2006 12:53:51 -0000 1.18 @@ -2,7 +2,27 @@ UoS + Formal Contact Hours + Total number of hours of attendance for lecture, tutorial, lab, etc. + Informal Study Hours + Informal study hours required to master concepts. + Student Commitment to UoS + Students are expected to commit to this UoS by... + Feedback Expected by Students + Students can expect feedback for this UoS in the nature of... + Feedback Provided by Students + Students can provide feedback for this UoS by... + Select the lecturer for this Unit of Study. + What are the aims and objectives for this Unit of Study? + What are the learning outcomes for this Unit of Study? + What are the subjects or topics that will be taught in this course? + Relevance of the concepts taught in this Unit of Study with respect to the degree stream and/or discipline/industry. + The URL of the Unit of Study website where students can read the course content online, or interact with web-based learning activities. + UoS Workload + For future reference, enter a short review of changes that were made. + Select one or more teaching and learning approaches that are used in this Unit of Study. To select more than one item from the list, hold down the Shirt key whilst selecting an item. If an item doesn't appear in the list, then click <a href="tl-method-ae">here</a> to add it (Note: clicking on the link will redirect you to another page). View Details + View All Add T&L Approach Edit T&L Approach Add T&L approach to list @@ -19,7 +39,7 @@ Edit T&L Method Edit T&L Edited T&L - T&L Arrangements and Requirements + Teaching & Learning Arrangements and Requirements Teaching and Learning Approach UoS Teaching and Learning UoS Teaching and Learning Revision Index: openacs-4/packages/curriculum-central/sql/postgresql/uos-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/sql/postgresql/uos-create.sql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/curriculum-central/sql/postgresql/uos-create.sql 3 Jan 2006 03:23:27 -0000 1.6 +++ openacs-4/packages/curriculum-central/sql/postgresql/uos-create.sql 3 Jan 2006 12:53:52 -0000 1.7 @@ -311,3 +311,6 @@ -- UoS Teaching and Learning \i uos-tl-create.sql + +-- UoS Workload +\i uos-workload-create.sql Index: openacs-4/packages/curriculum-central/sql/postgresql/uos-workload-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/sql/postgresql/uos-workload-create.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/sql/postgresql/uos-workload-create.sql 3 Jan 2006 12:53:52 -0000 1.1 @@ -0,0 +1,280 @@ +-- +-- packages/curriculum-central/sql/postgresql/uos-workload-create.sql +-- +-- @author Nick Carroll (nick.c@rroll.net) +-- @creation-date 2005-11-16 +-- @cvs-id $Id: uos-workload-create.sql,v 1.1 2006/01/03 12:53:52 ncarroll Exp $ +-- +-- + + +create function inline_0 () +returns integer as' +begin + PERFORM acs_object_type__create_type ( + ''cc_uos_workload'', -- object_type + ''#curriculum-central.uos_workload#'', -- pretty_name + ''#curriculum-central.uos_workload#'', -- pretty_plural + ''acs_object'', -- supertype + ''cc_uos_workload'', -- table_name + ''workload_id'', -- id_column + null, -- package_name + ''f'', -- abstract_p + null, -- type_extension_table + null -- name_method + ); + + return 0; +end;' language 'plpgsql'; + +select inline_0 (); +drop function inline_0 (); + + +-- Register UoS workload as a child type of Uos. +select content_type__register_child_type ( + 'cc_uos', -- parent_type + 'cc_uos_workload', -- child_type + 'generic', -- relation_tag + 0, -- min_n + null -- max_n +); + + +-- content_item subtype +create table cc_uos_workload ( + workload_id integer + constraint cc_uos_workload_workload_id_fk + references cr_items(item_id) + on delete cascade + constraint cc_uos_workload_workload_id_pk + primary key, + parent_uos_id integer, + live_revision_id integer, + latest_revision_id integer +); + + +-- Create the UoS workload content_revision +create table cc_uos_workload_revisions ( + workload_revision_id integer + constraint cc_uos_workload_rev_pk + primary key + constraint cc_uos_workload_rev_fk + references cr_revisions(revision_id) + on delete cascade, + formal_contact_hrs varchar(128), + informal_study_hrs varchar(128), + student_commitment text, + expected_feedback text, + student_feedback text +); + +-- Create the UoS revision content type. +select content_type__create_type ( + 'cc_uos_workload_revision', + 'content_revision', + '#curriculum-central.uos_workload_revision#', + '#curriculum-central.uos_workload_revisions#', + 'cc_uos_workload_revisions', + 'workload_revision_id', + 'content_revision.revision_name' +); + +-- Register UoS workload revision as a child type of uos_revision. +select content_type__register_child_type ( + 'cc_uos_revision', -- parent_type + 'cc_uos_workload_revision', -- child_type + 'generic', -- relation_tag + 0, -- min_n + null -- max_n +); + +select define_function_args('cc_uos_workload__new', 'workload_id,parent_uos_id,formal_contact_hrs,informal_study_hrs,student_commitment,expected_feedback,student_feedback,creation_user,creation_ip,context_id,item_subtype;cc_uos_workload,content_type;cc_uos_workload_revision,object_type,package_id'); + +create function cc_uos_workload__new( + integer, -- workload_id + integer, -- parent_uos_id + varchar, -- formal_contact_hrs + varchar, -- informal_study_hrs + text, -- student_commitment + text, -- expected_feedback + text, -- student_feedback + integer, -- creation_user + varchar, -- creation_ip + integer, -- context_id + varchar, -- item_subtype + varchar, -- content_type + varchar, -- object_type + integer -- package_id +) returns integer as' +declare + + p_workload_id alias for $1; + p_parent_uos_id alias for $2; + p_formal_contact_hrs alias for $3; + p_informal_study_hrs alias for $4; + p_student_commitment alias for $5; + p_expected_feedback alias for $6; + p_student_feedback alias for $7; + p_creation_user alias for $8; + p_creation_ip alias for $9; + p_context_id alias for $10; + p_item_subtype alias for $11; + p_content_type alias for $12; + p_object_type alias for $13; + p_package_id alias for $14; + + v_workload_id cc_uos_workload.workload_id%TYPE; + v_folder_id integer; + v_revision_id integer; + v_name varchar; + v_rel_id integer; +begin + -- get the content folder for this instance + select folder_id into v_folder_id + from cc_curriculum + where curriculum_id = p_package_id; + + -- Create a unique name + -- There should only be one workload content item for each + -- parent UoS. + v_name := ''uos_workload_for_'' || p_parent_uos_id; + + -- create the content item + v_workload_id := content_item__new ( + v_name, -- name + v_folder_Id, -- parent_id + p_workload_id, -- item_id + null, -- locale + now(), -- creation_date + p_creation_user, -- creation_user + v_folder_id, -- context_id + p_creation_ip, -- creation_ip + p_item_subtype, -- item_subtype + p_content_type, -- content_type + null, -- title + null, -- description + null, -- mime_type + null, -- nls_language + null, -- data + p_package_id + ); + + -- create the initial revision + v_revision_id := cc_uos_workload_revision__new ( + null, -- workload_revision_id + v_workload_id, -- workload_id + p_formal_contact_hrs, -- formal_contact_hrs + p_informal_study_hrs, -- informal_study_hrs + p_student_commitment, -- student_commitment + p_expected_feedback, -- expected_feedback + p_student_feedback, -- student_feedback + now(), -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + -- create the item type row + insert into cc_uos_workload (workload_id, parent_uos_id, + latest_revision_id) + VALUES (v_workload_id, p_parent_uos_id, v_revision_id); + + + -- associate the UoS workload with the parent UoS + v_rel_id := acs_object__new( + NULL, + ''cr_item_child_rel'', + current_timestamp, + p_creation_user, + p_creation_ip, + p_package_id + ); + + insert into cr_child_rels ( + rel_id, parent_id, child_id, relation_tag + ) values ( + v_rel_id, p_parent_uos_id, v_workload_id, ''cc_uos_workload'' + ); + + return v_workload_id; + +end; +' language plpgsql; + + +select define_function_args('cc_uos_workload__delete', 'workload_id'); + +create function cc_uos_workload__delete (integer) +returns integer as ' +declare + p_workload_id alias for $1; +begin + + perform content_item__delete(p_workload_id); + + return 0; + +end; +' language 'plpgsql'; + + +create or replace function cc_uos_workload_revision__new ( + integer, -- workload_revision_id + integer, -- workload_id + varchar, -- formal_contact_hrs + varchar, -- informal_study_hrs + text, -- student_commitment + text, -- expected_feedback + text, -- student_feedback + timestamptz, -- creation_date + integer, -- creation_user + varchar -- creation_ip +) returns int +as ' +declare + p_workload_revision_id alias for $1; + p_workload_id alias for $2; + p_formal_contact_hrs alias for $3; + p_informal_study_hrs alias for $4; + p_student_commitment alias for $5; + p_expected_feedback alias for $6; + p_student_feedback alias for $7; + p_creation_date alias for $8; + p_creation_user alias for $9; + p_creation_ip alias for $10; + + v_revision_id integer; + v_title varchar; +begin + + -- create the initial revision + v_revision_id := content_revision__new ( + ''#curriculum-central.uos_workload#'', -- title + null, -- description + current_timestamp, -- publish_date + null, -- mime_type + null, -- nls_language + null, -- new_data + p_workload_id, -- item_id + p_workload_revision_id, -- revision_id + p_creation_date, -- creation_date + p_creation_user, -- creation_user + p_creation_ip -- creation_ip + ); + + -- Insert into the uos-specific revision table + INSERT into cc_uos_workload_revisions + (workload_revision_id, formal_contact_hrs, informal_study_hrs, + student_commitment, expected_feedback, student_feedback) + VALUES + (v_revision_id, p_formal_contact_hrs, p_informal_study_hrs, + p_student_commitment, p_expected_feedback, p_student_feedback); + + -- Update the latest revision id in cc_uos_workload + UPDATE cc_uos_workload SET latest_revision_id = v_revision_id + WHERE workload_id = p_workload_id; + + return v_revision_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl 3 Jan 2006 03:23:27 -0000 1.5 +++ openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl 3 Jan 2006 12:53:52 -0000 1.6 @@ -45,6 +45,11 @@ -content_type "cc_uos_detail_revision" \ -include_subtypes "t" + content::folder::register_content_type \ + -folder_id $folder_id \ + -content_type "cc_uos_workload_revision" \ + -include_subtypes "t" + set keyword_id [content::keyword::new -heading "$instance_name"] # Inserts into cc_curriculum Index: openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql 3 Jan 2006 03:23:27 -0000 1.8 +++ openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql 3 Jan 2006 12:53:52 -0000 1.9 @@ -39,6 +39,20 @@ + + + SELECT w.workload_id, wr.formal_contact_hrs, wr.informal_study_hrs, + wr.student_commitment, wr.expected_feedback, wr.student_feedback + FROM cc_uos u, cc_uos_revisions r, cr_items i, + cc_uos_workload_revisions wr, cc_uos_workload w + WHERE u.uos_id = :uos_id + AND i.item_id = u.uos_id + AND r.uos_revision_id = i.latest_revision + AND w.parent_uos_id = :uos_id + AND wr.workload_revision_id = w.latest_revision_id + + + SELECT method_id FROM cc_uos_tl_method_map @@ -152,6 +166,23 @@ + + + SELECT cc_uos_workload_revision__new ( + null, + :workload_id, + :formal_contact_hrs, + :informal_study_hrs, + :student_commitment, + :expected_feedback, + :student_feedback, + now(), + :user_id, + :creation_ip + ); + + + SELECT cc_uos_tl_method__map ( @@ -197,6 +228,16 @@ + + + SELECT i.latest_revision AS latest_workload_revision + FROM cr_items i, cr_child_rels c + WHERE c.relation_tag = 'cc_uos_workload' + AND c.parent_id = :object_id + AND i.item_id = c.child_id + + + UPDATE cc_uos SET live_revision_id = :latest_revision @@ -218,6 +259,13 @@ + + + UPDATE cc_uos_workload SET live_revision_id = :latest_workload_revision + WHERE parent_uos_id = :object_id + + + (select * from cc_users u, cc_staff s where u.user_id = s.staff_id) 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.12 -r1.13 --- openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 3 Jan 2006 03:23:27 -0000 1.12 +++ openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 3 Jan 2006 12:53:52 -0000 1.13 @@ -137,6 +137,11 @@ privileges { write } edit_fields { tl_approach_ids + formal_contact_hrs + informal_study_hrs + student_commitment + expected_feedback + student_feedback } assigned_states { open } } @@ -393,6 +398,13 @@ [list object_type "cc_uos_tl"]] \ "cc_uos_tl"] + # Initiate cc_uos_workload + set tl_id [package_instantiate_object \ + -var_list [list [list parent_uos_id $uos_id] \ + [list package_id $package_id] \ + [list object_type "cc_uos_workload"]] \ + "cc_uos_workload"] + return $uos_id } @@ -534,7 +546,7 @@ Updates the details for a Unit of Study. This update proc creates a new details revision of the given Unit of Study. - @param uos_id The ID of the Unit of Study to update. + @param detail_id The ID of the Unit of Study to update. @param lecturer_id The ID of the selected lecturer. @param objectives Unit of Study objectives. @param learning_outcomes Unit of Study learning outcomes. @@ -605,6 +617,49 @@ } +ad_proc -public curriculum_central::uos::update_workload { + -workload_id:required + {-formal_contact_hrs ""} + {-informal_study_hrs ""} + {-student_commitment ""} + {-expected_feedback ""} + {-student_feedback ""} + {-user_id ""} + {-creation_ip ""} +} { + Updates the workload for a Unit of Study. This update proc creates + a new workload revision for the given Unit of Study. + + @param workload_id The ID of the Unit of Study to update. + @param formal_contact_hrs Formal contact hours. + @param informal_study_hrs Informal study hours required to master concepts. + @param student_commitment Students are expected to commit to this UoS by... + @param expected_feedback Students can expect feedback for this UoS in the + nature of... + @param student_feedback Students can provide feedback for this UoS by... + @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. + + @return revision_id Returns the ID of the newly created revision for + convenience, otherwise the empty string if unsuccessful. +} { + if { $user_id eq "" } { + set user_id [ad_conn user_id] + } + if { $creation_ip eq "" } { + set creation_ip [ad_conn peeraddr] + } + + # Set the default value for revision_id. + set revision_id "" + db_transaction { + set revision_id [db_exec_plsql update_workload {}] + } + + return $revision_id +} + + ad_proc -public curriculum_central::uos::get_details { {-uos_id:required} {-array:required} @@ -666,6 +721,35 @@ } +ad_proc -public curriculum_central::uos::get_workload { + {-uos_id:required} + {-array:required} +} { + Get the workload fields for a Unit of Study. + + @param uos_id The ID of the Unit of Study for which we return + workload fields for. + @param array A predefined array for returning fields in. Values include + workload_id, formal_contact_hrs, informal_study_hrs, student_commitment, + expected_feedback, student_feedback. + + @return Array containing all valid fields for the cc_uos_workload table. +} { + # Select the info into the upvar'ed Tcl array + upvar $array row + + if { ![db_0or1row latest_workload {} -column_array row] } { + # Set default values + set row(workload_id) "" + set row(formal_contact_hrs) "" + set row(informal_study_hrs) "" + set row(student_commitment) "" + set row(expected_feedback) "" + set row(student_feedback) "" + } +} + + ad_proc curriculum_central::uos::tl_method_get_options { {-package_id ""} } { @@ -880,4 +964,9 @@ db_1row get_latest_tl_revision {} content::item::set_live_revision -revision_id $latest_tl_revision db_dml set_live_tl_revision {} + + # Do the same for cc_uos_workload + db_1row get_latest_workload_revision {} + content::item::set_live_revision -revision_id $latest_workload_revision + db_dml set_live_workload_revision {} } 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.5 -r1.6 --- openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 3 Jan 2006 03:23:28 -0000 1.5 +++ openacs-4/packages/curriculum-central/www/coordinate/uos-edit.tcl 3 Jan 2006 12:53:52 -0000 1.6 @@ -116,36 +116,42 @@ {options [curriculum_central::staff_get_options] } {value $uos_details(lecturer_id)} {mode display} + {help_text "[_ curriculum-central.help_lecturer_id]"} } - {objectives:text,optional + {objectives:text(textarea),optional {label "[_ curriculum-central.aims_and_objectives]"} - {html {size 50}} + {html {cols 50 rows 4}} {value $uos_details(objectives)} {mode display} + {help_text "[_ curriculum-central.help_objectives]"} } - {learning_outcomes:text,optional + {learning_outcomes:text(textarea),optional {label "[_ curriculum-central.learning_outcomes]"} - {html {size 50}} + {html {cols 50 rows 4}} {value $uos_details(learning_outcomes)} {mode display} + {help_text "[_ curriculum-central.help_learning_outcomes]"} } - {syllabus:text,optional + {syllabus:text(textarea),optional {label "[_ curriculum-central.syllabus]"} - {html {size 50}} + {html {cols 50 rows 4}} {value $uos_details(syllabus)} {mode display} + {help_text "[_ curriculum-central.help_syllabus]"} } - {relevance:text,optional + {relevance:text(textarea),optional {label "[_ curriculum-central.relevance]"} - {html {size 50}} + {html {cols 50 rows 4}} {value $uos_details(relevance)} {mode display} + {help_text "[_ curriculum-central.help_relevance]"} } {online_course_content:text,optional {label "[_ curriculum-central.online_course_content]"} {html {size 50}} {value $uos_details(online_course_content)} {mode display} + {help_text "[_ curriculum-central.help_online_course_content]"} } } @@ -168,10 +174,59 @@ {html {size 5}} {values $uos_tl(tl_approach_ids)} {mode display} - {after_html "[_ curriculum-central.view_details]"} + {after_html "[_ curriculum-central.view_all]"} + {help_text "[_ curriculum-central.help_tl_approach_ids]"} } } +# Retrieve workflow info for Unit of Study. +curriculum_central::uos::get_workload \ + -uos_id $uos_id \ + -array uos_workload + +# Add widgets for workload. +ad_form -extend -name uos -form { + {workload_id:integer(hidden),optional + {value $uos_workload(workload_id)} + } + {formal_contact_hrs:text(textarea),optional + {label "[_ curriculum-central.formal_contact_hrs]"} + {html {cols 50 rows 4}} + {value $uos_workload(formal_contact_hrs)} + {mode display} + {help_text "[_ curriculum-central.help_formal_contact_hrs]"} + } + {informal_study_hrs:text(textarea),optional + {label "[_ curriculum-central.informal_study_hrs]"} + {html {cols 50 rows 4}} + {value $uos_workload(informal_study_hrs)} + {mode display} + {help_text "[_ curriculum-central.help_informal_study_hrs]"} + } + {student_commitment:text(textarea),optional + {label "[_ curriculum-central.student_commitment]"} + {html {cols 50 rows 4}} + {value $uos_workload(student_commitment)} + {mode display} + {help_text "[_ curriculum-central.help_student_commitment]"} + } + {expected_feedback:text(textarea),optional + {label "[_ curriculum-central.expected_feedback]"} + {html {cols 50 rows 4}} + {value $uos_workload(expected_feedback)} + {mode display} + {help_text "[_ curriculum-central.help_expected_feedback]"} + } + {student_feedback:text(textarea),optional + {label "[_ curriculum-central.student_feedback]"} + {html {cols 50 rows 4}} + {value $uos_workload(student_feedback)} + {mode display} + {help_text "[_ curriculum-central.help_student_feedback]"} + } +} + + # Add history section template::form::section uos [_ curriculum-central.history] @@ -180,6 +235,7 @@ {activity_log:richtext(richtext) {label "#curriculum-central.activity_log#"} {html {cols 50 rows 13}} + {help_text "[_ curriculum-central.help_activity_log]"} } {return_url:text(hidden) {value $return_url} @@ -242,11 +298,18 @@ -online_course_content $online_course_content } elseif { $action_info(short_name) eq "edit_tl"} { - ns_log Warning "NC: Update TL..." curriculum_central::uos::update_tl \ -tl_id $tl_id \ -tl_approach_ids $tl_approach_ids + + curriculum_central::uos::update_workload \ + -workload_id $workload_id \ + -formal_contact_hrs $formal_contact_hrs \ + -informal_study_hrs $informal_study_hrs \ + -student_commitment $student_commitment \ + -expected_feedback $expected_feedback \ + -student_feedback $student_feedback } # Do a general edit update.