Index: openacs-4/packages/lab-report/catalog/lab-report.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/catalog/lab-report.en_US.ISO-8859-1.xml,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lab-report/catalog/lab-report.en_US.ISO-8859-1.xml 24 May 2006 12:30:40 -0000 1.3 +++ openacs-4/packages/lab-report/catalog/lab-report.en_US.ISO-8859-1.xml 21 Aug 2006 23:25:11 -0000 1.4 @@ -7,21 +7,29 @@ Author Group Comments Content + Criteria Description Edit + Edit Feedback + Feedback for + Enter any comments. Enter content for this section of your lab report. Select an author from the list. + Select a rating for this criteria. Lab Report Lab reports for Labs New Overview This application requires an author to be set in order to write lab reports. Please inform your site administrator that an author needs to be set for this application. + Rating Report Reports for Resources Search Section Content + Section Feedback View + You do not have permission to provide feedback. Index: openacs-4/packages/lab-report/sql/postgresql/lab-report-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/sql/postgresql/lab-report-create.sql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lab-report/sql/postgresql/lab-report-create.sql 24 May 2006 12:30:40 -0000 1.4 +++ openacs-4/packages/lab-report/sql/postgresql/lab-report-create.sql 21 Aug 2006 23:25:15 -0000 1.5 @@ -49,6 +49,20 @@ null ); + +select acs_object_type__create_type ( + 'lr_section_feedback', + '#lab-report.section_feedback#', + '#lab-report.section_feedback#', + 'acs_object', + 'lr_section_feedback', + 'feedback_id', + null, + 'f', + null, + null +); + -- -- Create tables -- @@ -112,7 +126,34 @@ content text ); +create table lr_section_feedback ( + feedback_id integer + constraint lr_section_feedback_pk + primary key, + feedback_criteria_id integer + constraint lr_section_feedback_criteria_id_fk + references lrc_feedback_criteria (feedback_criteria_id) + on delete cascade, + report_id integer + constraint lr_section_feedback_report_id_fk + references lr_report (report_id) + on delete cascade, + section_id integer + constraint lr_section_feedback_section_id_fk + references lrc_section (section_id) + on delete cascade, + instructor_id integer + constraint lrc_lab_instructor_id_fk + references users(user_id), + rating varchar (5120), + comment text, + package_id integer + constraint lr_section_feedback_package_id_fk + references apm_packages (package_id) + on delete cascade +); + -- -- Create functions -- @@ -241,5 +282,97 @@ end;' language 'plpgsql'; +select define_function_args('lr_section_feedback__new','feedback_id,feedback_criteria_id,report_id,section_id,instructor_id,rating,comment,package_id,creation_date;now,creation_user,creation_ip,context_id'); + +create function lr_section_feedback__new ( + integer, + integer, + integer, + integer, + integer, + varchar, + text, + integer, + timestamptz, + integer, + varchar, + integer +) returns integer as ' +declare + p_feedback_id alias for $1; -- default null + p_feedback_criteria_id alias for $2; + p_report_id alias for $3; + p_section_id alias for $4; + p_instructor_id alias for $5; + p_rating alias for $6; + p_comment alias for $7; + p_package_id alias for $8; + p_creation_date alias for $9; -- default now() + p_creation_user alias for $10; -- default null + p_creation_ip alias for $11; -- default null + p_context_id alias for $12; -- default null + + v_feedback_id lr_section_feedback.feedback_id%TYPE; + v_inst_group_id integer; +begin + + v_feedback_id := acs_object__new ( + p_feedback_id, + ''lr_section_feedback'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + INSERT INTO lr_section_feedback ( + feedback_id, + feedback_criteria_id, + report_id, + section_id, + instructor_id, + rating, + comment, + package_id + ) VALUES ( + v_feedback_id, + p_feedback_criteria_id, + p_report_id, + p_section_id, + p_instructor_id, + p_rating, + p_comment, + p_package_id + ); + + + SELECT group_id into v_inst_group_id + FROM lrc_groups + WHERE magic_name = ''instructors''; + + -- Grant permission to lab instructors on this object. + PERFORM acs_permission__grant_permission( + v_feedback_id, + v_inst_group_id, + ''lab_report_central_read'' + ); + + PERFORM acs_permission__grant_permission( + v_feedback_id, + v_inst_group_id, + ''lab_report_central_write'' + ); + + PERFORM acs_permission__grant_permission( + v_feedback_id, + v_inst_group_id, + ''lab_report_central_admin'' + ); + + return v_feedback_id; + +end;' language 'plpgsql'; + + -- Register service contract implementations. \i lab-report-sc-create.sql \ No newline at end of file Index: openacs-4/packages/lab-report/sql/postgresql/lab-report-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/sql/postgresql/lab-report-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/lab-report/sql/postgresql/lab-report-drop.sql 24 May 2006 12:30:40 -0000 1.1 +++ openacs-4/packages/lab-report/sql/postgresql/lab-report-drop.sql 21 Aug 2006 23:25:15 -0000 1.2 @@ -1,2 +1,83 @@ +-- $Id$ + +-- +-- Drop hierarchy of privileges. +-- +select acs_privilege__remove_child('lab_report_author','lab_report_read'); +select acs_privilege__remove_child('lab_report_author','lab_report_write'); +select acs_privilege__remove_child('read','lab_report_read'); +select acs_privilege__remove_child('write','lab_report_write'); + +-- +-- Drop privileges. +-- +select acs_privilege__drop_privilege('lab_report_author'); +select acs_privilege__drop_privilege('lab_report_write'); +select acs_privilege__drop_privilege('lab_report_read'); + +-- +-- Drop functions +-- +drop function lr_report__new ( + integer, + integer, + integer, + integer, + timestamptz, + integer, + varchar, + integer +); + +drop function lr_section_content__new ( + integer, + integer, + integer, + text, + integer, + integer, + timestamptz, + integer, + varchar, + integer +); + +drop function lr_section_feedback__new ( + integer, + integer, + integer, + integer, + integer, + varchar, + text, + integer, + timestamptz, + integer, + varchar, + integer +); + + +-- +-- Drop tables +-- +drop table lr_author; +drop table lr_author_group; +drop table lr_report; +drop table lr_section_content; +drop table lr_section_feedback; + +delete from acs_objects where object_type='lr_report'; +delete from acs_objects where object_type='lr_section_content'; +delete from acs_objects where object_type='lr_section_feedback'; + +-- +-- Drop object types. +-- +select acs_object_type__drop_type ('lr_report', 'f'); +select acs_object_type__drop_type ('lr_section_content', 'f'); +select acs_object_type__drop_type ('lr_section_feedback', 'f'); + + -- Drop service contract implementations. -\i lab-report-sc-drop.sql \ No newline at end of file +\i lab-report-sc-drop.sql Index: openacs-4/packages/lab-report/tcl/install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/tcl/install-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lab-report/tcl/install-procs.tcl 24 May 2006 12:30:41 -0000 1.2 +++ openacs-4/packages/lab-report/tcl/install-procs.tcl 21 Aug 2006 23:25:15 -0000 1.3 @@ -19,8 +19,6 @@ } { db_transaction { lab_report::install::create_author_group -package_id $package_id - - lab_report::install::grant_gc_create -package_id $package_id } } Index: openacs-4/packages/lab-report/tcl/lab-report-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/tcl/lab-report-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/lab-report/tcl/lab-report-procs.tcl 24 May 2006 12:30:41 -0000 1.2 +++ openacs-4/packages/lab-report/tcl/lab-report-procs.tcl 21 Aug 2006 23:25:15 -0000 1.3 @@ -84,3 +84,15 @@ -object_id $object_id \ -privilege "general_comments_create" } + + +ad_proc -public lab_report::instructor_p { + user_id +} { + Checks if the given user_id is an instructor. + + @param user_id A user_id to check against members of the instructor group. +} { + return [group::member_p -user_id $user_id \ + -group_id [lab_report_central::instructor_group_id]] +} \ No newline at end of file Index: openacs-4/packages/lab-report/www/view-section-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/view-section-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lab-report/www/view-section-postgresql.xql 21 May 2006 08:54:15 -0000 1.3 +++ openacs-4/packages/lab-report/www/view-section-postgresql.xql 21 Aug 2006 23:25:16 -0000 1.4 @@ -38,6 +38,14 @@ + + + SELECT feedback_criteria_id, name AS feedback_criteria_name + FROM lrc_feedback_criteria + WHERE section_id = :section_id + + + SELECT section_id AS nav_section_id, name AS nav_section_name Index: openacs-4/packages/lab-report/www/view-section.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/view-section.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/lab-report/www/view-section.adp 24 May 2006 12:30:41 -0000 1.4 +++ openacs-4/packages/lab-report/www/view-section.adp 21 Aug 2006 23:25:16 -0000 1.5 @@ -48,21 +48,27 @@ @content;noquote@ - #lab-report.edit# + #lab-report.edit# #lab-report.new# - - #lab-report.comments# - - @gc_comments;noquote@ - - @gc_link;noquote@ - + + + #lab-report.feedback# + + + + Your browser does not support IFRAMES, + please consider upgrading your browser. + + + + + Index: openacs-4/packages/lab-report/www/view-section.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/view-section.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/lab-report/www/view-section.tcl 24 May 2006 12:30:41 -0000 1.3 +++ openacs-4/packages/lab-report/www/view-section.tcl 21 Aug 2006 23:25:16 -0000 1.4 @@ -11,6 +11,8 @@ section_id } +auth::require_login + set package_id [ad_conn package_id] set user_id [ad_conn user_id] @@ -52,21 +54,13 @@ set content_created_p 1 db_1row select_content {} - set edit_url [export_vars -url -base edit-section {report_id lab_id section_id template_id content_id}] + set edit_content_url [export_vars -url -base edit-section {report_id lab_id section_id template_id content_id}] set content [template::util::richtext::get_property html_value $content] - # General comments - set return_url [export_vars -url \ - -base "[ad_conn package_url]view-section" \ - { report_id lab_id template_id section_id }] - - set gc_link [general_comments_create_link \ - -object_name "$section_name" \ - -link_attributes {class="button"} \ - $content_id $return_url] - set gc_comments [general_comments_get_comments \ - $content_id $return_url] + db_multirow -extend {iframe_url} feedback select_feedback {} { + set iframe_url [export_vars -url -base "iframe/feedback-view" {report_id lab_id template_id section_id feedback_criteria_id}] + } } # Title and context Index: openacs-4/packages/lab-report/www/iframe/feedback-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-ae-postgresql.xql 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,32 @@ + + + + postgresql7.4 + + + + SELECT name FROM lrc_feedback_criteria + WHERE feedback_criteria_id = :feedback_criteria_id + + + + + + UPDATE lr_section_feedback + SET rating = :rating, + comment = :comment + WHERE feedback_id = :feedback_id + + + + + + UPDATE acs_objects + SET modifying_user = :modifying_user, + modifying_ip = :modifying_ip, + package_id = :package_id + WHERE object_id = :feedback_id + + + + Index: openacs-4/packages/lab-report/www/iframe/feedback-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-ae.adp 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,10 @@ + +@page_title;noquote@ + + + + + + + + Index: openacs-4/packages/lab-report/www/iframe/feedback-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-ae.tcl 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,81 @@ +ad_page_contract { + Add/Edit feedback for a specific lab report section. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-06-01 + @cvs-id $Id: feedback-ae.tcl,v 1.1 2006/08/21 23:25:21 ncarroll Exp $ +} { + report_id:integer,notnull + lab_id:integer,notnull + template_id:integer,notnull + section_id:integer,notnull + feedback_criteria_id:integer,notnull + feedback_id:integer,optional + {return_url "[export_vars -url -base feedback-view {report_id lab_id template_id section_id feedback_criteria_id}]"} +} + +set page_title [_ lab-report.edit_feedback] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +if { ![lab_report::instructor_p $user_id] } { + ad_returnredirect $return_url +} + +set criteria_name [db_string select_criteria_name {} -default ""] + +ad_form -name feedback -cancel_url $return_url -form { + {feedback_id:key(acs_object_id_seq)} + {report_id:text(hidden) {value $report_id}} + {lab_id:text(hidden) {value $lab_id}} + {template_id:text(hidden) {value $template_id}} + {section_id:text(hidden) {value $section_id}} + {feedback_criteria_id:text(hidden) {value $feedback_criteria_id}} + {return_url:text(hidden) {value $return_url}} + {criteria:text(inform) + {label "[_ lab-report.criteria]"} + {value "$criteria_name"} + + } + {rating:text(select),optional + {label "[_ lab-report.rating]" } + {help_text "[_ lab-report.help_select_rating]"} + {options {{None none} {"Needs Work" needs_work} {Satisfactory satisfactory} {Complete complete}}} + } + {comment:richtext(richtext),optional + {html {cols 50 rows 4}} + {htmlarea_p 0} + {nospell} + {label "[_ lab-report.comments]" } + {help_text "[_ lab-report.help_enter_comments]"} + } +} -select_query { + SELECT rating, comment + FROM lr_section_feedback WHERE feedback_id = :feedback_id +} -new_data { + + set instructor_id $user_id + + db_transaction { + set feedback_id [package_instantiate_object \ + -var_list [list [list package_id $package_id] \ + [list object_type lr_section_feedback] \ + [list feedback_criteria_id $feedback_criteria_id] \ + [list report_id $report_id] \ + [list section_id $section_id] \ + [list instructor_id $instructor_id] \ + [list rating $rating] \ + [list comment $comment]] \ + -form_id feedback lr_section_feedback] + } + +} -edit_data { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml feedback_update {} + db_dml object_update {} +} -after_submit { + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/lab-report/www/iframe/feedback-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-view-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-view-postgresql.xql 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,18 @@ + + + + postgresql7.4 + + + + SELECT c.name AS feedback_criteria_name, sf.feedback_id, + sf.rating, sf.comment + FROM lrc_feedback_criteria c LEFT OUTER JOIN lr_section_feedback sf + ON (c.feedback_criteria_id = sf.feedback_criteria_id + AND sf.report_id = :report_id) + WHERE c.section_id = :section_id + AND c.feedback_criteria_id = :feedback_criteria_id + + + + Index: openacs-4/packages/lab-report/www/iframe/feedback-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-view.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-view.adp 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,18 @@ + +@page_title;noquote@ + + + + + + + + + + + @feedback_criteria_name@ + #lab-report.rating#: @rating@ + #lab-report.comments#: @comment;noquote@ + #lab-report.edit# + + Index: openacs-4/packages/lab-report/www/iframe/feedback-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/iframe/feedback-view.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/iframe/feedback-view.tcl 21 Aug 2006 23:25:21 -0000 1.1 @@ -0,0 +1,47 @@ +ad_page_contract { + Page for viewing feedback for a specific lab report section. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-06-01 + @cvs-id $Id: feedback-view.tcl,v 1.1 2006/08/21 23:25:21 ncarroll Exp $ +} { + report_id:integer,notnull + lab_id:integer,notnull + template_id:integer,notnull + section_id:integer,notnull + feedback_criteria_id:integer,notnull +} + +set page_title "[_ lab-report.section_feedback]" +set context [list [list . [_ lab-report.labs]] $page_title] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +# set defaults +set rating "none" +set comment "" + +db_0or1row select_feedback {} + +if { $rating eq "complete" } { + set rating "Complete" +} elseif { $rating eq "needs_work"} { + set rating "Needs Work" +} elseif { $rating eq "satisfactory" } { + set rating "Satisfactory" +} else { + set rating "None" +} + +set comment [template::util::richtext::get_property html_value $comment] + +if { [info exists feedback_id] && $feedback_id ne "" } { + set edit_url [export_vars -url -base feedback-ae {report_id lab_id template_id section_id feedback_criteria_id feedback_id}] +} else { + set edit_url [export_vars -url -base feedback-ae {report_id lab_id template_id section_id feedback_criteria_id}] +} + +# Is the user an instructor? +set instructor_p [lab_report::instructor_p $user_id] + +ad_return_template Index: openacs-4/packages/lab-report/www/resources/iframe-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/resources/iframe-master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/resources/iframe-master.adp 21 Aug 2006 23:25:25 -0000 1.1 @@ -0,0 +1,10 @@ +@doc_type;noquote@ + + + @title;noquote@ + @header_stuff;noquote@ + + + + + Index: openacs-4/packages/lab-report/www/resources/iframe-master.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/resources/iframe-master.css,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/resources/iframe-master.css 21 Aug 2006 23:25:25 -0000 1.1 @@ -0,0 +1,29 @@ +a.button { + font: 85% arial; + border: solid 1px black; + background-color: #e1e1e1; + text-align: center; + padding: 1px; + padding-left: 8px; + padding-right: 8px; + color: black; + text-decoration: none; + white-space: nowrap; +} +a.button:link { + text-decoration: none; + border: solid 1px black; +} +a.button:visited { + text-decoration: none; + border: solid 1px black; +} +a.button:hover { + text-decoration: none; + background-color: #ccc; + border: solid 1px black; +} +a.button:active { + text-decoration: none; + border: solid 1px black; +} Index: openacs-4/packages/lab-report/www/resources/iframe-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/resources/iframe-master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report/www/resources/iframe-master.tcl 21 Aug 2006 23:25:25 -0000 1.1 @@ -0,0 +1,20 @@ +# +# Set basic attributes and provide the logical defaults for variables that +# aren't provided by the slave page. +# +# $Id: iframe-master.tcl,v 1.1 2006/08/21 23:25:25 ncarroll Exp $ +# + +# fall back on defaults + +if { [template::util::is_nil doc_type] } { + set doc_type {} +} + +if { [template::util::is_nil title] } { + set title [ad_conn instance_name] +} + +if { ![info exists header_stuff] } { + set header_stuff {} +} Index: openacs-4/packages/lab-report/www/resources/lab-report.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report/www/resources/lab-report.css,v diff -u -r1.5 -r1.6 --- openacs-4/packages/lab-report/www/resources/lab-report.css 24 May 2006 12:30:41 -0000 1.5 +++ openacs-4/packages/lab-report/www/resources/lab-report.css 21 Aug 2006 23:25:25 -0000 1.6 @@ -257,6 +257,10 @@ margin-right: 2em; } +div#report-container table tr td.content ul li.comments a.edit { + float: right; +} + div#report-container h3 { color: #686868; } @@ -310,3 +314,30 @@ color: #000; background: #CCCCCC; } + + +/* Feedback container */ +#lr-feedback-container { + margin-left: 0.5em; +} + +#lr-feedback-container ul { + margin: 0; + padding: 0; + list-style-type: none; + font-family: verdana, arial, sans-serif; + font-size: small; +} + +#lr-feedback-container ul li.title { + padding-top: 0.5em; + padding-bottom: 0.5em; + font-weight: bold; + color: #686868; +} + +#lr-feedback-container ul li.edit { + padding-top: 2em; + padding-right: 0.5em; + float: right; +} \ No newline at end of file Index: openacs-4/packages/lab-report-central/www/feedback-criteria-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-ae-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-ae-postgresql.xql 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,31 @@ + + + + postgresql7.4 + + + + SELECT name FROM lrc_template WHERE template_id = :template_id + + + + + + UPDATE lrc_feedback_criteria + SET name = :name, + description = :description + WHERE feedback_criteria_id = :feedback_criteria_id + + + + + + UPDATE acs_objects + SET modifying_user = :modifying_user, + modifying_ip = :modifying_ip, + package_id = :package_id + WHERE object_id = :feedback_criteria_id + + + + Index: openacs-4/packages/lab-report-central/www/feedback-criteria-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-ae.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-ae.adp 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,6 @@ + +@page_title;noquote@ +@context;noquote@ +resource.name + + Index: openacs-4/packages/lab-report-central/www/feedback-criteria-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-ae.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-ae.tcl 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,77 @@ +ad_page_contract { + Add/Edit a feedback component. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-08-14 + @cvs-id $Id: feedback-criteria-ae.tcl,v 1.1 2006/08/21 23:26:37 ncarroll Exp $ +} { + template_id:integer + section_id:integer + feedback_criteria_id:integer,optional + {return_url "."} +} + +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 feedback_criteria_id] } { + set page_title [_ lab-report-central.edit_feedback_criterion] +} else { + set page_title [_ lab-report-central.add_feedback_criterion] +} + +set template_name [db_string template_name {} -default ""] + +set context [list [list templates [_ lab-report-central.templates]] \ + [list [export_vars -url -base template {template_id}] $template_name] \ + [list [export_vars -url -base feedback-criteria {template_id section_id}] [_ lab-report-central.feedback_criteria]] \ + $page_title] + +set return_url [export_vars -url -base feedback-criteria {template_id section_id}] + +ad_form -name criterion -cancel_url $return_url -form { + {feedback_criteria_id:key(acs_object_id_seq)} + {template_id:integer(hidden) {value $template_id}} + {section_id:integer(hidden) {value $section_id}} + {return_url:text(hidden) {value $return_url}} + {name:text + {html {size 50}} + {label "[_ lab-report-central.name]" } + {help_text "[_ lab-report-central.help_enter_feedback_criterion_name]"} + } + {description:richtext(richtext),optional + {label "[_ lab-report-central.description]" } + {help_text "[_ lab-report-central.help_enter_feedback_criterion_description]"} + {html {cols 48 rows 6}} + {htmlarea_p 0} + {nospell} + } +} -select_query { + SELECT name, description + FROM lrc_feedback_criteria + WHERE feedback_criteria_id = :feedback_criteria_id +} -new_data { + + package_instantiate_object \ + -var_list [list [list package_id $package_id] \ + [list section_id $section_id] \ + [list name $name] \ + [list description $description]] \ + -form_id criterion lrc_feedback_criteria + +} -edit_data { + set modifying_user [ad_conn user_id] + set modifying_ip [ad_conn peeraddr] + + db_dml criterion_update {} + db_dml object_update {} +} -after_submit { + ad_returnredirect $return_url + ad_script_abort +} Index: openacs-4/packages/lab-report-central/www/feedback-criteria-del-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-del-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-del-postgresql.xql 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,12 @@ + + + + postgresql7.4 + + + + SELECT lrc_feedback_criteria__del(:feedback_criteria_id) + + + + Index: openacs-4/packages/lab-report-central/www/feedback-criteria-del.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-del.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-del.tcl 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,25 @@ +ad_page_contract { + Delete the specified feedback criterion. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-04-30 + @cvs-id $Id: feedback-criteria-del.tcl,v 1.1 2006/08/21 23:26:37 ncarroll Exp $ +} { + section_id:integer + template_id:integer + feedback_criteria_id:integer +} + +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 feedback_criteria_delete {} +} + +ad_returnredirect [export_vars -url -base feedback-criteria \ + {template_id section_id}] +ad_script_abort Index: openacs-4/packages/lab-report-central/www/feedback-criteria-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria-postgresql.xql 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,28 @@ + + + + postgresql7.4 + + + + SELECT s.name AS section_name, s.description AS section_desc, + t.name AS template_name + FROM lrc_section s, lrc_template t + WHERE s.section_id = :section_id + AND s.template_id = t.template_id + AND s.package_id = :package_id + + + + + + SELECT feedback_criteria_id, name AS criteria_name, + description AS criteria_desc + FROM lrc_feedback_criteria + WHERE section_id = :section_id + AND package_id = :package_id + ORDER BY feedback_criteria_id ASC + + + + Index: openacs-4/packages/lab-report-central/www/feedback-criteria.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria.adp 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,37 @@ + +@page_title;noquote@ +@context;noquote@ +[#lab-report-central.admin#] + + + + +#lab-report-central.feedback_criteria_for_this_section# + + +#lab-report-central.notice_currently_no_feedback_criteria# + + + + + + @feedback.criteria_name@ + @feedback.criteria_desc;noquote@ + #lab-report-central.edit_details# + + + + + + + + + + + + + - + + + + + Index: openacs-4/packages/lab-report-central/www/feedback-criteria.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lab-report-central/www/feedback-criteria.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lab-report-central/www/feedback-criteria.tcl 21 Aug 2006 23:26:37 -0000 1.1 @@ -0,0 +1,62 @@ +ad_page_contract { + Page for displaying feedback criteria for a specific section of a template + report. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2006-08-14 + @cvs-id $Id: feedback-criteria.tcl,v 1.1 2006/08/21 23:26:37 ncarroll Exp $ +} { + template_id + section_id +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +db_1row section_details {} + +set page_title [_ lab-report-central.feedback_criteria_for_section_name] +set context [list [list templates [_ lab-report-central.templates]] \ + [list [export_vars -url -base template {template_id}] \ + $template_name] \ + $page_title] + +if { [info exists section_desc] } { + set section_desc [template::util::richtext::get_property html_value \ + $section_desc] +} else { + set section_desc "" +} + +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] + +db_multirow -extend {details_url} feedback select_feedback {} { + if { [info exists criteria_desc] } { + set criteria_desc \ + [template::util::richtext::get_property html_value $criteria_desc] + } else { + set criteria_desc "" + } + + set details_url [export_vars -url -base feedback-criteria-ae \ + {template_id section_id feedback_criteria_id}] +} + +set create_feedback_url [export_vars -url -base feedback-criteria-ae {template_id section_id}] + +# feedback_criteria_id is the last feedback_criteria_id retrieved +# from the db_multirow block above. +set delete_feedback_url [export_vars -url -base feedback-criteria-del {template_id section_id feedback_criteria_id}] +set confirm_msg "[_ lab-report-central.want_to_delete_feedback_component]" + +ad_return_template