Index: openacs-4/packages/lab-report-central/catalog/lab-report-central.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/catalog/lab-report-central.en_US.ISO-8859-1.xml,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/catalog/lab-report-central.en_US.ISO-8859-1.xml 24 Apr 2006 11:27:03 -0000 1.1 +++ openacs-4/packages/lab-report-central/catalog/lab-report-central.en_US.ISO-8859-1.xml 27 Apr 2006 04:34:33 -0000 1.2 @@ -1,19 +1,22 @@ + Actions: Add Instructor Add instructor to list Add Lab Add Template Add template to list Admin + Attach Template Create Lab Create Report Template Create Template Delete Description Edit Edit Lab + Edit Template Enter lab description. Enter the last day of the lab. Enter name for lab. @@ -22,6 +25,7 @@ Enter a name for the report template. Select "Search" then click on OK to search for a user, otherwise select a user from the list. Select a lab instructor from the list. + Select a lab report template from the list to attach to the lab. If the list is empty, then you will need to create a template first. Instructor Instructors Lab @@ -37,6 +41,7 @@ No labs have been created. No report templates have been created. No templates have been created. + Remove Remove instructor Remove report template. Report Sections @@ -48,7 +53,10 @@ Templates to View + View Instructors + View Report Templates Continue with deleting the instructor? Continue with deleting the lab? Continue with removing the report template? + Continue with removing report template from lab? Index: openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-create.sql 24 Apr 2006 11:27:03 -0000 1.1 +++ openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-create.sql 27 Apr 2006 04:34:33 -0000 1.2 @@ -135,6 +135,17 @@ on delete cascade ); +create table lrc_lab_template_map ( + lab_id integer + constraint lrc_lt_map_lab_id_fk + references lrc_lab (lab_id) + on delete cascade, + template_id integer + constraint lrc_lt_map_template_id_fk + references lrc_template (template_id) + on delete cascade +); + create table lrc_template_section_map ( template_id integer constraint lrc_ts_map_template_id_fk Index: openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-drop.sql 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/sql/postgresql/lab-report-central-drop.sql 27 Apr 2006 04:34:33 -0000 1.2 @@ -60,6 +60,7 @@ drop table lrc_template; drop table lrc_groups; drop table lrc_template_section_map; +drop table lrc_lab_template_map; delete from acs_objects where object_type='lrc_lab'; delete from acs_objects where object_type='lrc_template'; Index: openacs-4/packages/lab-report-central/tcl/lab-report-central-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/tcl/lab-report-central-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/tcl/lab-report-central-procs-postgresql.xql 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/tcl/lab-report-central-procs-postgresql.xql 27 Apr 2006 04:34:33 -0000 1.2 @@ -78,4 +78,11 @@ + + + SELECT t.name, t.template_id + FROM lrc_template t + WHERE t.template_id NOT IN (select template_id from lrc_lab_template_map where lab_id = :lab_id) + + Index: openacs-4/packages/lab-report-central/tcl/lab-report-central-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/tcl/lab-report-central-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/tcl/lab-report-central-procs.tcl 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/tcl/lab-report-central-procs.tcl 27 Apr 2006 04:34:33 -0000 1.2 @@ -33,3 +33,17 @@ } { return [db_string instructor_group {} -default ""] } + +ad_proc -private lab_report_central::unmapped_templates_get_options { + -lab_id +} { + Retrieves an options list of report templates that have not been + mapped to the specified lab_id. + + @param lab_id The ID of a lab. + @return Options list of report templates. +} { + set templates_list [db_list_of_lists templates {}] + + return $templates_list +} Index: openacs-4/packages/lab-report-central/www/attach-template-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/attach-template-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/attach-template-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,21 @@ + + + + postgresql7.4 + + + + SELECT name + FROM lrc_lab + WHERE lab_id = :lab_id + + + + + + INSERT INTO lrc_lab_template_map (lab_id, template_id) + VALUES (:lab_id, :template_id) + + + + Index: openacs-4/packages/lab-report-central/www/attach-template.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/attach-template.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/attach-template.adp 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ +attach_template.name + + Index: openacs-4/packages/lab-report-central/www/attach-template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/attach-template.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/attach-template.tcl 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,46 @@ +ad_page_contract { + Attach a report template to a lab. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-18 + @cvs-id $Id: attach-template.tcl,v 1.1 2006/04/27 04:34:34 ncarroll Exp $ +} { + lab_id:integer + return_url:optional +} + +auth::require_login + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] + +permission::require_permission -party_id $user_id -object_id $package_id \ + -privilege lab_report_central_admin + +if { ![info exists return_url] } { + set return_url [export_vars -url -base lab {lab_id}] +} + +set lab_name [db_string lab_name {} -default ""] + +set page_title [_ lab-report-central.attach_template] +set context [list [list [export_vars -url -base lab {lab_id}] $lab_name] \ + $page_title] + +ad_form -name attach_template -cancel_url $return_url -form { + {lab_id:integer(hidden) {value $lab_id}} + {return_url:text(hidden) {value $return_url}} + {template_id:integer(select) + {label "[_ lab-report-central.template]" } + {help_text "[_ lab-report-central.help_select_template_to_attach]"} + {options "[lab_report_central::unmapped_templates_get_options \ + -lab_id $lab_id]"} + } +} -after_submit { + # Map report template to lab. + db_dml attach_template {} + + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/lab-report-central/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/index.adp 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/index.adp 27 Apr 2006 04:34:34 -0000 1.2 @@ -4,13 +4,19 @@ -
- + + +
+
+
+
  • @labs.year@
  • Index: openacs-4/packages/lab-report-central/www/lab-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/lab-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/lab-postgresql.xql 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/lab-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.2 @@ -15,8 +15,12 @@ - SELECT template_id, name AS template_name, description AS template_desc - FROM lrc_template + SELECT t.template_id, t.name AS template_name, + t.description AS template_desc + FROM lrc_template t, lrc_lab_template_map m + WHERE m.lab_id = :lab_id + AND m.template_id = t.template_id + AND t.package_id = :package_id Index: openacs-4/packages/lab-report-central/www/lab.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/lab.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/lab.adp 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/lab.adp 27 Apr 2006 04:34:34 -0000 1.2 @@ -31,18 +31,17 @@
    -
      +
      • - @rt.name@ + @rt.template_name@ #lab-report-central.view# - #lab-report-central.edit#  - #lab-report-central.delete# + #lab-report-central.remove#
      • Index: openacs-4/packages/lab-report-central/www/lab.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/lab.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/lab.tcl 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/lab.tcl 27 Apr 2006 04:34:34 -0000 1.2 @@ -16,16 +16,20 @@ set page_title $name set context [list $page_title] -set description [template::util::richtext::get_property html_value \ - $description] +if { [info exists description] } { + set description [template::util::richtext::get_property html_value \ + $description] +} else { + set description "" +} db_multirow -extend { view_url edit_url delete_url } rt rt {} { - set view_url "" + set view_url [export_vars -url -base template {template_id}] set edit_url [export_vars -url -base template-ae { lab_id }] set delete_url "" } -set create_url [export_vars -url -base template-ae { lab_id }] +set create_url [export_vars -url -base attach-template { lab_id }] set create_p [permission::permission_p -party_id $user_id \ -object_id $package_id \ Index: openacs-4/packages/lab-report-central/www/template-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-ae-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,25 @@ + + + + postgresql7.4 + + + + UPDATE lrc_template + SET name = :name, + description = :description + WHERE template_id = :template_id + + + + + + UPDATE acs_objects + SET modifying_user = :modifying_user, + modifying_ip = :modifying_ip, + package_id = :package_id + WHERE object_id = :template_id + + + + Index: openacs-4/packages/lab-report-central/www/template-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-ae.adp 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ +template.name + + Index: openacs-4/packages/lab-report-central/www/template-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-ae.tcl 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,64 @@ +ad_page_contract { + Add/Edit a report template. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-18 + @cvs-id $Id: template-ae.tcl,v 1.1 2006/04/27 04:34:34 ncarroll Exp $ +} { + template_id:integer,optional + {return_url "templates"} +} + +auth::require_login + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] +set peeraddr [ad_conn peeraddr] + +permission::require_permission -party_id $user_id -object_id $package_id \ + -privilege lab_report_central_admin + +if { [info exists template_id] } { + set page_title [_ lab-report-central.edit_template] +} else { + set page_title [_ lab-report-central.add_template] +} + +set context [list $page_title] + +ad_form -name template -cancel_url $return_url -form { + {template_id:key(acs_object_id_seq)} + {return_url:text(hidden) {value $return_url}} + {name:text + {html {size 50}} + {label "[_ lab-report-central.name]" } + {help_text "[_ lab-report-central.help_enter_template_name]"} + } + {description:richtext(richtext),optional + {label "[_ lab-report-central.description]" } + {help_text "[_ lab-report-central.help_enter_template_description]"} + {html {cols 48 rows 6}} + {htmlarea_p 0} + {nospell} + } +} -select_query { + SELECT name, description + FROM lrc_template WHERE template_id = :template_id +} -new_data { + + package_instantiate_object \ + -var_list [list [list package_id $package_id] \ + [list name $name] \ + [list description $description]] \ + -form_id template lrc_template + +} -edit_data { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml template_update {} + db_dml object_update {} +} -after_submit { + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/lab-report-central/www/template-del-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-del-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-del-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,12 @@ + + + + postgresql7.4 + + + + SELECT lrc_template__del(:template_id) + + + + Index: openacs-4/packages/lab-report-central/www/template-del.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-del.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-del.tcl 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,27 @@ +ad_page_contract { + Delete the specified report template. + + @param template_id The ID of the report template to delete. + @param return_url Optional url to redirect to when the delete operation + is complete. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-12-04 + @cvs-id $Id: template-del.tcl,v 1.1 2006/04/27 04:34:34 ncarroll Exp $ +} { + template_id:integer + {return_url "templates"} +} + +set user_id [ad_conn user_id] +set package_id [ad_conn package_id] + +permission::require_permission -party_id $user_id -object_id $package_id \ + -privilege lab_report_central_admin + +db_transaction { + db_exec_plsql template_delete {} +} + +ad_returnredirect $return_url +ad_script_abort Index: openacs-4/packages/lab-report-central/www/template-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,15 @@ + + + + postgresql7.4 + + + + SELECT name, description + FROM lrc_template + WHERE template_id = :template_id + AND package_id = :package_id + + + + Index: openacs-4/packages/lab-report-central/www/template.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template.adp 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,22 @@ + +@page_title;noquote@ +@context;noquote@ +[#lab-report-central.admin#] + + + + + +
        + + + + + + + + + +
        #lab-report-central.name#@name;noquote@
        #lab-report-central.description#@description;noquote@ 
        +
        + Index: openacs-4/packages/lab-report-central/www/template.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/template.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/template.tcl 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,39 @@ +ad_page_contract { + Admin page. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-17 + @cvs-id $Id: template.tcl,v 1.1 2006/04/27 04:34:34 ncarroll Exp $ +} { + template_id +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +db_1row template_details {} + +set page_title $name +set context [list [list templates [_ lab-report-central.templates]] \ + $page_title] + +if { [info exists description] } { + set description [template::util::richtext::get_property html_value \ + $description] +} else { + set description "" +} + +set create_p [permission::permission_p -party_id $user_id \ + -object_id $package_id \ + -privilege lab_report_central_admin_create] + +set delete_p [permission::permission_p -party_id $user_id \ + -object_id $package_id \ + -privilege lab_report_central_admin_delete] + +set modify_p [permission::permission_p -party_id $user_id \ + -object_id $package_id \ + -privilege lab_report_central_admin_modify] + +ad_return_template Index: openacs-4/packages/lab-report-central/www/templates-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/templates-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/templates-postgresql.xql 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,14 @@ + + + + postgresql7.4 + + + + SELECT template_id, name, description from lrc_template + WHERE package_id = :package_id + [template::list::orderby_clause -orderby -name "templates"] + + + + Index: openacs-4/packages/lab-report-central/www/templates.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/templates.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/templates.adp 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,5 @@ + +@page_title;noquote@ +@context;noquote@ + + Index: openacs-4/packages/lab-report-central/www/templates.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/templates.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/templates.tcl 27 Apr 2006 04:34:34 -0000 1.1 @@ -0,0 +1,59 @@ +ad_page_contract { + Page for viewing templates. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-17 + @cvs-id $Id: templates.tcl,v 1.1 2006/04/27 04:34:34 ncarroll Exp $ +} { + {orderby "name,asc"} +} + +set page_title "[_ lab-report-central.templates]" +set context [list $page_title] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +permission::require_permission -party_id $user_id -object_id $package_id \ + -privilege lab_report_central_admin + +set elements { + edit { + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -url -base template-ae { template_id }]} + } + name { + label "#lab-report-central.name#" + link_url_eval {[export_vars -url -base template { template_id }]} + } + description { + label "#lab-report-central.description#" + } + delete { + sub_class narrow + display_template { + + } + link_url_eval {[export_vars -url -base template-del { template_id }]} + link_html {title "#lab-report-central.remove_template#" onclick "return confirm(\'[_ lab-report-central.want_to_delete_template]\');"} + } +} + +template::list::create \ + -name templates \ + -actions [list "#lab-report-central.add_template#" [export_vars -base template-ae {}] "#lab-report-central.add_template_to_list#"] \ + -multirow templates \ + -no_data "#lab-report-central.no_templates_created#" \ + -elements $elements \ + -orderby { + name {orderby {lower(name)}} + } + +db_multirow templates get_templates {} { + set description [template::util::richtext::get_property content \ + $description] +} + +ad_return_template Index: openacs-4/packages/lab-report-central/www/admin/instructor-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/admin/instructor-add.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/admin/instructor-add.tcl 24 Apr 2006 11:27:04 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/admin/instructor-add.tcl 27 Apr 2006 04:34:34 -0000 1.2 @@ -30,7 +30,7 @@ group::add_member -group_id [lab_report_central::instructor_group_id] \ -user_id $user - # TODO: Add privileges for new member. + # Add privileges for new member. permission::grant -party_id $user \ -object_id $package_id \ -privilege lab_report_central_admin Index: openacs-4/packages/lab-report-central/www/resources/lab-report-central.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/resources/lab-report-central.css,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report-central/www/resources/lab-report-central.css 24 Apr 2006 11:27:05 -0000 1.1 +++ openacs-4/packages/lab-report-central/www/resources/lab-report-central.css 27 Apr 2006 04:34:34 -0000 1.2 @@ -1,3 +1,25 @@ +/* Action Container */ +#lrc-actions-container { + margin: 0px auto; + width: 500px; +} + +#lrc-actions-container ul { + margin: 0; + padding: 0; + list-style-type: none; + font-family: verdana, arial, sans-serif; +} + +#lrc-actions-container ul li { + float: left; + margin-right: 1em; + color: #686868; + font-size: 18px; + font-weight: bold; +} + + /* Lab Container */ #lrc-lab-container { margin-left: 30px; @@ -98,6 +120,10 @@ } /* Report */ +#lrc-report-container ul.report { + margin-top: 1em; +} + #lrc-report-container ul.report li { color: #000; font-size: 12px;