Index: openacs-4/contrib/packages/survey/survey.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/Attic/survey.info,v diff -u -r1.3.2.1 -r1.3.2.2 --- openacs-4/contrib/packages/survey/survey.info 6 May 2004 06:01:39 -0000 1.3.2.1 +++ openacs-4/contrib/packages/survey/survey.info 2 Sep 2004 15:17:46 -0000 1.3.2.2 @@ -7,15 +7,15 @@ f f - + Dave Bauer Luke Pond Malte Sussdorff New version of survey package for dotLRN/OpenACS 5.0 dotLRN New version of survey package for dotLRN/OpenACS 5.0. This version supports branching and sections, uses ad_form templates but so far is not internationalized. Upgrade scripts are available for Oracle only (at the moment). - + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/lib/respond.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/lib/respond.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/survey/sql/postgresql/survey-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/sql/postgresql/Attic/survey-create.sql,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/survey/sql/postgresql/survey-create.sql 7 Feb 2004 11:25:51 -0000 1.3 +++ openacs-4/contrib/packages/survey/sql/postgresql/survey-create.sql 2 Sep 2004 15:17:47 -0000 1.3.2.1 @@ -11,40 +11,13 @@ -- -- $Id$ --- We don't want these any longer --- select acs_privilege__create_privilege('survey_create_survey', null, null); --- select acs_privilege__create_privilege('survey_modify_survey', null, null); --- select acs_privilege__create_privilege('survey_delete_survey', null, null); --- select acs_privilege__create_privilege('survey_create_question', null, null); --- select acs_privilege__create_privilege('survey_modify_question', null, null); --- select acs_privilege__create_privilege('survey_delete_question', null, null); --- select acs_privilege__create_privilege('survey_take_survey', null, null); --- select acs_privilege__create_privilege('survey_admin_survey', null, null); --- select acs_privilege__create_privilege('survey_create_section', null, null); --- select acs_privilege__create_privilege('survey_modify_section', null, null); --- select acs_privilege__create_privilege('survey_delete_section', null, null); - begin; -- temporarily drop this trigger to avoid a data-change violation -- on acs_privilege_hierarchy_index while updating the child privileges. -- drop trigger acs_priv_hier_ins_del_tr on acs_privilege_hierarchy; --- select acs_privilege__add_child('survey_admin_survey','survey_create_survey'); --- select acs_privilege__add_child('survey_admin_survey','survey_modify_survey'); --- select acs_privilege__add_child('survey_admin_survey','survey_delete_survey'); --- select acs_privilege__add_child('survey_admin_survey','survey_create_question'); --- select acs_privilege__add_child('survey_admin_survey','survey_modify_question'); --- select acs_privilege__add_child('survey_admin_survey','survey_delete_question'); - --- select acs_privilege__add_child('write','survey_take_survey'); --- select acs_privilege__add_child('admin','survey_admin_survey'); - --- select acs_privilege__add_child('survey_admin_survey','survey_create_section'); --- select acs_privilege__add_child('survey_admin_survey','survey_modify_section'); --- select acs_privilege__add_child('survey_admin_survey','survey_delete_section'); - -- -- re-enable the trigger before the last insert to force the -- -- acs_privilege_hierarchy_index table to be updated. @@ -191,6 +164,8 @@ constraint survey_sections_desc_nn not null, description_html_p boolean, + pretty_id varchar(100) constraint survey_sections_pretty_id_un + unique (pretty_id, section_id) sort_key integer default 0 not null, branch_p boolean default FALSE, -- are there any branches dependant from this section? @@ -303,6 +278,8 @@ (summary_type in ('sum','avg','concat')), -- describing the options of radio button set answer_description varchar(100), + pretty_id varchar(100) constraint survey_q_pretty_id_un + unique (pretty_id, section_id), predefined_question_id integer constraint survey_q_pred_q_id_fk references survey_predefined_questions @@ -507,6 +484,7 @@ return v_answers; end' language 'plpgsql'; + \i survey-package-create.sql \i survey-notifications-init.sql Index: openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/sql/postgresql/Attic/survey-package-create.sql,v diff -u -r1.2.2.2 -r1.2.2.3 --- openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql 6 May 2004 06:01:40 -0000 1.2.2.2 +++ openacs-4/contrib/packages/survey/sql/postgresql/survey-package-create.sql 2 Sep 2004 15:17:47 -0000 1.2.2.3 @@ -87,9 +87,48 @@ return v_name; end;' language 'plpgsql'; - -- API for survey_section objects +--Create a new survey with a pretty_id + +create or replace function survey_section__new (integer,integer,varchar,text,boolean,integer,boolean,boolean,boolean,boolean,integer,integer,text) +returns integer as ' +declare + new__section_id alias for $1; -- default null + new__survey_id alias for $2; -- default null + new__name alias for $3; -- default null + new__description alias for $4; -- default null + new__description_html_p alias for $5; -- default f + new__sort_key alias for $6; -- default 0 + new__branch_p alias for $7; -- default f + new__branched_p alias for $8; -- default f + new__block_section_p alias for $9; -- default f + new__page_break_p alias for $10; -- default t + new__creation_user alias for $11; -- default null + new__context_id alias for $12; -- default null + new__pretty_id alias for $13; -- default section_id + v_section_id integer; +begin + v_section_id := acs_object__new ( + new__section_id, + ''survey_section'', + now(), + new__creation_user, + null, + new__context_id + ); + + insert into survey_sections + (section_id, survey_id, name, description, description_html_p, sort_key, branch_p, branched_p, page_break_p, block_section_p, pretty_id) + values + (v_section_id, new__survey_id, new__name, new__description, new__description_html_p, new__sort_key, new__branch_p, new__branched_p, new__page_break_p, new__block_section_p, new__pretty_id); + + return v_section_id; + +end;' language 'plpgsql'; + +--Have the old API default to using the section_id + create or replace function survey_section__new (integer,integer,varchar,text,boolean,integer,boolean,boolean,boolean,boolean,integer,integer) returns integer as ' declare @@ -117,9 +156,9 @@ ); insert into survey_sections - (section_id, survey_id, name, description, description_html_p, sort_key, branch_p, branched_p, page_break_p, block_section_p) + (section_id, survey_id, name, description, description_html_p, sort_key, branch_p, branched_p, page_break_p, block_section_p, pretty_id) values - (v_section_id, new__survey_id, new__name, new__description, new__description_html_p, new__sort_key, new__branch_p, new__branched_p, new__page_break_p, new__block_section_p); + (v_section_id, new__survey_id, new__name, new__description, new__description_html_p, new__sort_key, new__branch_p, new__branched_p, new__page_break_p, new__block_section_p, v_section_id); return v_section_id; @@ -191,7 +230,9 @@ -- API for Survey questions -create or replace function survey_question__new (integer,integer,integer,text,varchar,boolean,boolean,varchar,varchar,varchar,boolean,varchar,varchar,integer,integer,integer) +--API for a question with a pretty_id passed in. + +create or replace function survey_question__new (integer,integer,integer,text,varchar,boolean,boolean,varchar,varchar,varchar,boolean,varchar,varchar,integer,integer,integer,text) returns integer as ' declare new__question_id alias for $1; -- default null @@ -210,6 +251,7 @@ new__predefined_question_id alias for $14; -- default null new__creation_user alias for $15; -- default null new__context_id alias for $16; -- default null + new__pretty_id alias for $17; v_question_id integer; begin v_question_id := acs_object__new ( @@ -225,17 +267,64 @@ (question_id, section_id, sort_order, question_text, abstract_data_type, required_p, active_p, presentation_type, presentation_options, - presentation_alignment, predefined_question_id) + presentation_alignment, predefined_question_id, pretty_id) values (v_question_id, new__section_id, new__sort_order, new__question_text, new__abstract_data_type, new__required_p, new__active_p, new__presentation_type, new__presentation_options, - new__presentation_alignment, new__predefined_question_id); + new__presentation_alignment, new__predefined_question_id, new__pretty_id); return v_question_id; end;' language 'plpgsql'; +--Default the old api to use question_id + +create or replace function survey_question__new (integer,integer,integer,text,varchar,boolean,boolean,varchar,varchar,varchar,boolean,varchar,varchar,integer,integer,integer) +returns integer as ' +declare + new__question_id alias for $1; -- default null + new__section_id alias for $2; -- default null + new__sort_order alias for $3; -- default null + new__question_text alias for $4; -- default null + new__abstract_data_type alias for $5; -- default null + new__required_p alias for $6; -- default t + new__active_p alias for $7; -- default f + new__presentation_type alias for $8; -- default null + new__presentation_options alias for $9; -- default null + new__presentation_alignment alias for $10; -- default ''below'' + new__question_html_p alias for $11; -- default f + new__summary_type alias for $12; + new__answer_description alias for $13; + new__predefined_question_id alias for $14; -- default null + new__creation_user alias for $15; -- default null + new__context_id alias for $16; -- default null + v_question_id integer; +begin + v_question_id := acs_object__new ( + new__question_id, + ''survey_question'', + now(), + new__creation_user, + null, + new__context_id + ); + + insert into survey_questions + (question_id, section_id, sort_order, question_text, + abstract_data_type, required_p, active_p, + presentation_type, presentation_options, + presentation_alignment, predefined_question_id, pretty_id) + values + (v_question_id, new__section_id, new__sort_order, new__question_text, + new__abstract_data_type, new__required_p, new__active_p, + new__presentation_type, new__presentation_options, + new__presentation_alignment, new__predefined_question_id, v_question_id); + + return v_question_id; + +end;' language 'plpgsql'; + create or replace function survey_question__remove (integer) returns integer as ' declare Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/sql/postgresql/upgrade/upgrade-0.5-0.6.sql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/survey/tcl/survey-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/tcl/Attic/survey-procs.tcl,v diff -u -r1.4 -r1.4.2.1 --- openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 12 Mar 2004 06:35:45 -0000 1.4 +++ openacs-4/contrib/packages/survey/tcl/survey-procs.tcl 2 Sep 2004 15:17:47 -0000 1.4.2.1 @@ -112,6 +112,8 @@ if {[file exists $template_filename]} { set section_template [template::util::read_file $template_filename] uplevel [list set section_template($section_info(name)) $section_template] + ns_log notice "CM list set section_template($section_info(name)) $section_template" + # uplevel [set section_template($section_info(name)) $section_template] } # If this is a block section, generate a block question, else add questions one by one @@ -308,7 +310,7 @@ template::element::create $form $element_name \ -widget file \ -label "$question_text" \ - -required_p $required_p \ + -optional $required_p \ -value $user_value } "textbox" { @@ -319,7 +321,7 @@ -label "$question_text" \ -value $user_value \ -html $html \ - -required_p $required_p + -optional $required_p } "textarea" { set html [ad_decode $presentation_options "large" {rows 20 cols 65} "medium" {rows 15 cols 55} {rows 8 cols 35}] @@ -329,7 +331,7 @@ -label "$question_text" \ -value $user_value \ -html $html \ - -required_p $required_p + -optional $required_p } "date" { #set options {format "DD Month YYYY"} @@ -338,7 +340,7 @@ -widget date \ -label "$question_text" \ -value $user_value \ - -required_p $required_p + -optional $required_p } "select" { if { $abstract_data_type == "boolean" } { @@ -366,7 +368,7 @@ -label "$question_text" \ -value $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } "radio" { set widget "text(radio)" @@ -396,7 +398,7 @@ -label "$question_text" \ -value $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } "checkbox" { @@ -412,7 +414,7 @@ -label "$question_text" \ -values $user_value \ -options $options \ - -required_p $required_p + -optional $required_p } } } @@ -981,5 +983,40 @@ ns_conn close } - - +ad_proc -public survey_get_section_page_numbers { + {-survey_id} + {-array} +} { + gets corresponding page numbers for sections + + @author Deds Castillo (deds@i-manila.com.ph) + @creation-date 2004-05-24 +} { + upvar $array survey_section_page_numbers + set page_list [list] + set new_page_p 0 + set current_page 1 + db_foreach get_section_pages { + select section_id, + page_break_p + from survey_sections + where survey_id = :survey_id + order by sort_key + } { + if {$new_page_p} { + incr current_page + set new_page_p 0 + } + if {[string equal $page_break_p t]} { + set new_page_p 1 + } + lappend page_list [list $section_id $current_page] + set survey_section_page_numbers($section_id) $current_page + } + + # get total and assign it to element 0 + lappend page_list [list total $current_page] + set survey_section_page_numbers(total) $current_page + + return $page_list +} Index: openacs-4/contrib/packages/survey/www/process-response.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/Attic/process-response.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/contrib/packages/survey/www/process-response.tcl 12 Mar 2004 12:19:13 -0000 1.7 +++ openacs-4/contrib/packages/survey/www/process-response.tcl 2 Sep 2004 15:17:48 -0000 1.7.2.1 @@ -22,6 +22,7 @@ response_to_question:array,optional,multiple,html response_id:integer,notnull {edit_p "f"} + {element_id ""} } -validate { sections_exist -requires { section_ids } { foreach section_id $section_ids { @@ -337,11 +338,13 @@ # survey_do_notifications -response_id $response_id +if {![empty_string_p $element_id]} { + ee::element::map_response -response_id $response_id -element_id $element_id +} - if {[exists_and_not_null return_url]} { ad_returnredirect "$return_url" - ad_script_abort + ad_script_abort } else { set context_bar [ad_context_bar "[_ survey.lt_Response_Submitted_fo]"] ad_return_template Index: openacs-4/contrib/packages/survey/www/admin/name-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/name-edit.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/name-edit.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/name-edit.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -26,7 +26,7 @@ survey_id:key {name:text(text) {label "[_ survey.Survey_Name_1]"} {html {size 80}} {value $survey_name_unquoted}} - {description:text(textarea) {label "[_ survey.Description_1]"} + {description:text(textarea),optional {label "[_ survey.Description_1]"} {html {rows 10 cols 65}} {value $survey_description}} {description_html_p:text(radio) {label "[_ survey.lt_The_Above_Description]"} Index: openacs-4/contrib/packages/survey/www/admin/one-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/one-postgresql.xql,v diff -u -r1.1 -r1.1.4.1 --- openacs-4/contrib/packages/survey/www/admin/one-postgresql.xql 19 Sep 2003 16:48:04 -0000 1.1 +++ openacs-4/contrib/packages/survey/www/admin/one-postgresql.xql 2 Sep 2004 15:17:48 -0000 1.1.4.1 @@ -6,7 +6,8 @@ select s.name as name, question_id, question_text, presentation_type, sort_order, active_p, required_p, - s.section_id as section_id, branch_p + s.section_id as section_id, branch_p, q.pretty_id as + question_pretty_id, s.pretty_id as section_pretty_id from survey_questions q right outer join survey_sections s on (q.section_id = s.section_id) where survey_id=:survey_id Index: openacs-4/contrib/packages/survey/www/admin/one.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/one.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/one.adp 7 Feb 2004 12:39:50 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/one.adp 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -8,6 +8,8 @@ @survey_info.name;noquote@ #survey.-__Created_by# @survey_info.creator_name@#survey._on_creation_date# +

+ @@ -141,7 +143,10 @@ - + + + + - + -
#survey.Send_bulk_mail# #survey.lt_regarding_this_survey#
Report CreationManage Report
@@ -161,6 +166,7 @@ @sections.name@ + (@sections.section_pretty_id@) EditDelete @sections.branch_text;noquote@ @@ -182,9 +188,11 @@
@sections.rownum@. @sections.rownum@. (@sections.question_pretty_id@) Edit + +Edit + #survey.inactive# Copy Add New Index: openacs-4/contrib/packages/survey/www/admin/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/one.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/one.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/one.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -113,5 +113,4 @@ } } - ad_return_template Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/process-response.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-add-2.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/question-add-2.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -57,6 +57,10 @@ {required_p:text(hidden) {value $required_p}} {active_p:text(hidden) {value $active_p}} {type:text(hidden) {value $type}} + {pretty_id:text {label "Variable name"} + {help_text "This will be the name of the variable when creating reports. No spaces or special characers."} + {value $question_id} + } } Index: openacs-4/contrib/packages/survey/www/admin/question-add-3-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-add-3-postgresql.xql,v diff -u -r1.1 -r1.1.4.1 --- openacs-4/contrib/packages/survey/www/admin/question-add-3-postgresql.xql 19 Sep 2003 16:48:04 -0000 1.1 +++ openacs-4/contrib/packages/survey/www/admin/question-add-3-postgresql.xql 2 Sep 2004 15:17:48 -0000 1.1.4.1 @@ -28,7 +28,8 @@ :answer_description, NULL, :user_id, - :section_id + :section_id, + :pretty_id ) Index: openacs-4/contrib/packages/survey/www/admin/question-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-add-3.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/question-add-3.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/question-add-3.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -36,6 +36,7 @@ {scores:multiple,array,integer ""} {n_variables:integer ""} {variable_id_list ""} + {pretty_id ""} } # Variables that will be used later... Index: openacs-4/contrib/packages/survey/www/admin/question-modify.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-modify.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/survey/www/admin/question-modify.tcl 14 Feb 2004 19:57:59 -0000 1.3 +++ openacs-4/contrib/packages/survey/www/admin/question-modify.tcl 2 Sep 2004 15:17:48 -0000 1.3.2.1 @@ -43,10 +43,14 @@ {warning:text(inform) {label "[_ survey.Warning]"} {value "[_ survey.lt_There_isare_n_respons]"}} } } + ad_form -extend -name modify_question -export {sort_order} -form { {question_number:text(inform) {label "[_ survey.Modify_Question__]"}} {survey_name:text(inform) {label "[_ survey.From_1]"} {value $survey_name}} {question_text:text(textarea) {label "[_ survey.Question]"} {html {rows 5 cols 70}}} + {pretty_id:text {label "Variable name"} + {help_text "This will be the name of the variable when creating reports. No spaces or special characers."} + } } if {$allow_question_deactivation == 1} { Index: openacs-4/contrib/packages/survey/www/admin/question-modify.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/question-modify.xql,v diff -u -r1.2 -r1.2.4.1 --- openacs-4/contrib/packages/survey/www/admin/question-modify.xql 23 Oct 2003 06:22:26 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/question-modify.xql 2 Sep 2004 15:17:48 -0000 1.2.4.1 @@ -45,7 +45,8 @@ presentation_options, sort_order as question_number, required_p, - sort_order + sort_order, + pretty_id from survey_questions where question_id = :question_id Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/question-swap.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/report-postgres.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/report.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/report.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/respond.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/contrib/packages/survey/www/admin/respond.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/contrib/packages/survey/www/admin/responses.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/responses.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/responses.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/responses.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -75,9 +75,9 @@ set n_responses [db_string survey_number_responses {} ] if { $n_responses == 1 } { - set response_sentence "[_ survey.lt_There_has_been_1_resp]" + set response_sentence "[_ survey.lt_There_has_been_1_resp] $n_responses" } else { - set response_sentence "[_ survey.lt_There_have_been_n_res]" + set response_sentence "[_ survey.lt_There_have_been_n_res] $n_responses" } set context_bar [ad_context_bar [list "one?[export_url_vars survey_id]" $survey_info(name)] "Responses"] Index: openacs-4/contrib/packages/survey/www/admin/section-add-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-add-2-postgresql.xql,v diff -u -r1.1 -r1.1.4.1 --- openacs-4/contrib/packages/survey/www/admin/section-add-2-postgresql.xql 19 Sep 2003 16:48:04 -0000 1.1 +++ openacs-4/contrib/packages/survey/www/admin/section-add-2-postgresql.xql 2 Sep 2004 15:17:48 -0000 1.1.4.1 @@ -26,7 +26,8 @@ FALSE, :page_break_p, :user_id, - :survey_id + :survey_id, + :pretty_id ); Index: openacs-4/contrib/packages/survey/www/admin/section-add-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-add-2.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/section-add-2.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/section-add-2.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -21,6 +21,7 @@ name:notnull branch_p:boolean,notnull page_break_p:boolean,notnull + {pretty_id "$section_id"} } -validate { first_section_not_branch -requires {branch_p:notnull} { if {$branch_p=="t" && $after==0} { Index: openacs-4/contrib/packages/survey/www/admin/section-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-add.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/section-add.tcl 14 Feb 2004 19:57:59 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/section-add.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -24,6 +24,10 @@ {section_id:text(hidden) {value $next_section_id}} {survey_id:text(hidden) {value $survey_id}} {name:text(text) {label "[_ survey.Section_Name]"} {html {size 30}}} + {pretty_id:text {label "Variable name"} + {help_text "This will be the name of the variable when creating reports. No spaces or special characers."} + {value $next_section_id} + } {description:text(textarea) {label "[_ survey.Description_1]"} {html {rows 5 cols 70}}} {description_html_p:text(radio) {label "[_ survey.lt_The_above_description]"} {options {{HTML t} {"[_ survey.Plain_text]" f}}} {value f}} {branch_p:text(radio) {label "[_ survey.Branch]"} {options {{Yes t} {No f}}} {value f}} Index: openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-edit-2.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl 14 Feb 2004 19:57:59 -0000 1.3 +++ openacs-4/contrib/packages/survey/www/admin/section-edit-2.tcl 2 Sep 2004 15:17:48 -0000 1.3.2.1 @@ -20,6 +20,7 @@ {block_section_p:boolean "f"} page_break_p:boolean,notnull {answer_descriptions:trim ""} + {pretty_id "$section_id"} } -validate { first_section_not_branch -requires {branch_p:notnull} { if {$branch_p=="t" && $after==0} { Index: openacs-4/contrib/packages/survey/www/admin/section-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/section-edit.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/contrib/packages/survey/www/admin/section-edit.tcl 14 Feb 2004 19:57:59 -0000 1.3 +++ openacs-4/contrib/packages/survey/www/admin/section-edit.tcl 2 Sep 2004 15:17:48 -0000 1.3.2.1 @@ -29,8 +29,15 @@ lappend poslist [list $secname $secsortkey] } +if { ![exists_and_not_null pretty_id] } { + set pretty_id $section_id +} + ad_form -extend -name modify_section -form { {name:text(text) {label "[_ survey.Section_Name]"} {html {size 30}} {value $name}} + {pretty_id:text {label "Variable name"} {value $pretty_id } + {help_text "This will be the name of the variable when creating reports. No spaces or special characers."} + } {description:text(textarea) {label "[_ survey.Description_1]"} {html {rows 5 cols 70}} {value $description}} {description_html_p:text(radio) {label "[_ survey.lt_The_above_description]"} {options {{HTML t} {"[_ survey.Plain_text]" f}}} {value $description_html_p}} {branch_p:text(radio) {label "[_ survey.Branch]"} {options {{Yes t} {No f}}} {value $branch_p}} Index: openacs-4/contrib/packages/survey/www/admin/send-mail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/send-mail.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/send-mail.tcl 15 Feb 2004 13:56:12 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/send-mail.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -55,7 +55,9 @@ } else { ad_form -name send-mail -form { {to:text(radio) {options { - {"[_ survey.lt_Everyone_who_has_alre_1]"} + {"[_ survey.lt_Everyone_who_has_alre_1]" "responded"}}} + {label "[_ survey.Send_mail_to]"} + {value ""} } } } @@ -67,32 +69,32 @@ {package_id:text(hidden) {value $package_id}} } -on_submit { -set query "" + set query "" -if {$dotlrn_installed_p} { - switch $to { + if {$dotlrn_installed_p} { + switch $to { all { - set query [db_map dotlrn_all] - } + set query [db_map dotlrn_all] + } responded { set query [db_map dotlrn_responded] - } - + } + not_responded { set query [db_map dotlrn_not_responded] } - } + } } else { set query [db_map responded] } - - bulk_mail::new \ - -package_id $package_id \ - -from_addr $sender_email \ - -subject $subject \ - -message $message \ - -query $query + + bulk_mail::new \ + -package_id $package_id \ + -from_addr $sender_email \ + -subject $subject \ + -message $message \ + -query $query ad_returnredirect "one?survey_id=$survey_id" ad_script_abort } Index: openacs-4/contrib/packages/survey/www/admin/survey-create.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/survey-create.adp,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/survey-create.adp 7 Feb 2004 12:39:50 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/survey-create.adp 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -2,6 +2,7 @@ #survey.survey_admin_create_survey# @context_bar;noquote@ +

Index: openacs-4/contrib/packages/survey/www/admin/survey-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/survey/www/admin/Attic/survey-create.tcl,v diff -u -r1.2 -r1.2.2.1 --- openacs-4/contrib/packages/survey/www/admin/survey-create.tcl 15 Feb 2004 13:56:12 -0000 1.2 +++ openacs-4/contrib/packages/survey/www/admin/survey-create.tcl 2 Sep 2004 15:17:48 -0000 1.2.2.1 @@ -17,6 +17,7 @@ {description:html ""} {variable_names ""} {type "general"} + {category_id 0} } set package_id [ad_conn package_id] @@ -34,14 +35,30 @@ survey_id:key {display_type:text(hidden) {value $display_type}} {name:text(text) {label "[_ survey.Survey_Name_1]"} {html {size 55}}} - {description:text(textarea) {label "[_ survey.Description_1]"} {html {rows 10 cols 40}}} + {description:text(textarea) {label "[_ survey.Description_1]"} {html {rows 10 cols 40}} + {help_text "This is used as introductory text before the questions"} {value $description} + } {desc_html:text(radio) {label "[_ survey.lt_The_Above_Description]"} {options {{"[_ survey.Preformatted_Text]" "pre"} {"[_ survey.HTML]" "html"} {"[_ survey.Plain_Text]" "plain"}}} {value "plain"} } {public_p:text(radio) {label "[_ survey.Public]"} {options {{Yes t} {No f}}} {value t}} -} -validate { +} + +if {$category_id} { + set category_name [category::get_name $category_id] + ad_form -extend -name create_survey -form { + {category:text(inform) {label "Associate with element type"} {value $category_name}} + } +} + +ad_form -extend -name create_survey -form { + {category_id:text(hidden) {value $category_id}} +} + +ad_form -extend -name create_survey \ + -validate { {name {[string length $name] <= 4000} "[_ survey.lt_Survey_Name_must_be_4]" } {name {[string length $name] > 0} @@ -85,6 +102,11 @@ # section_id is null to create a new section # we might want to specify a section_id later for # multiple section surveys + # DEDS: look for a category + if {$category_id} { + category::map_object -remove_old -object_id $survey_id [list $category_id] + } + set section_id "" set section_id [db_exec_plsql create_section ""] }