Index: openacs-4/packages/dotlrn-survey/dotlrn-survey.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/dotlrn-survey.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/dotlrn-survey.info 14 May 2003 21:06:34 -0000 1.1 @@ -0,0 +1,40 @@ + + + + + dotLRN Survey + dotLRN Surveys + f + t + + + + oracle + postgresql + + dave bauer + dotLRN applet for Survey package + dotLRN applet for Survey package + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/dotlrn-survey/sql/oracle/dotlrn-survey-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/sql/oracle/dotlrn-survey-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/sql/oracle/dotlrn-survey-create.sql 14 May 2003 21:06:34 -0000 1.1 @@ -0,0 +1,247 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- The survey applet for dotLRN +-- +-- @author Ben Adida (ben@openforce.net) +-- @creation-date 2002-05-29 +-- @version $Id: dotlrn-survey-create.sql,v 1.1 2003/05/14 21:06:34 donb Exp $ +-- + +declare + foo integer; +begin + + foo := acs_sc_impl.new( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_owner_name => 'dotlrn_survey' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'GetPrettyName', + impl_alias => 'dotlrn_survey::get_pretty_name', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'AddApplet', + impl_alias => 'dotlrn_survey::add_applet', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'RemoveApplet', + impl_alias => 'dotlrn_survey::remove_applet', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'AddAppletToCommunity', + impl_alias => 'dotlrn_survey::add_applet_to_community', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'RemoveAppletFromCommunity', + impl_alias => 'dotlrn_survey::remove_applet_from_community', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'AddUser', + impl_alias => 'dotlrn_survey::add_user', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'RemoveUser', + impl_alias => 'dotlrn_survey::remove_user', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'AddUserToCommunity', + impl_alias => 'dotlrn_survey::add_user_to_community', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'RemoveUserFromCommunity', + impl_alias => 'dotlrn_survey::remove_user_from_community', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'AddPortlet', + impl_alias => 'dotlrn_survey::add_portlet', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'RemovePortlet', + impl_alias => 'dotlrn_survey::remove_portlet', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'Clone', + impl_alias => 'dotlrn_survey::clone', + impl_pl => 'TCL' + ); + + foo := acs_sc_impl.new_alias( + impl_contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey', + impl_operation_name => 'ChangeEventHandler', + impl_alias => 'dotlrn_survey::change_event_handler', + impl_pl => 'TCL' + ); + + acs_sc_binding.new( + contract_name => 'dotlrn_applet', + impl_name => 'dotlrn_survey' + ); + +end; +/ +show errors + +create or replace package dotlrn_survey +as + procedure clone ( + old_package_id in apm_packages.package_id%TYPE default null, + new_package_id in apm_packages.package_id%TYPE default null); + +end dotlrn_survey; +/ +show errors + +create or replace package body dotlrn_survey +as + procedure clone ( + old_package_id in apm_packages.package_id%TYPE default null, + new_package_id in apm_packages.package_id%TYPE default null + ) + as + + v_survey_id surveys.survey_id%TYPE; + v_section_id survey_sections.section_id%TYPE; + v_question_id survey_questions.question_id%TYPE; + v_choice_id survey_question_choices.choice_id%TYPE; + + begin + + for one_survey in (select s.*, o.creation_user + from surveys s, acs_objects o + where package_id=old_package_id + and o.object_id=s.survey_id) + loop + v_survey_id := survey.new( + name => one_survey.name, + description => one_survey.description, + description_html_p => one_survey.description_html_p, + enabled_p => one_survey.enabled_p, + single_response_p => one_survey.single_response_p, + editable_p => one_survey.editable_p, + single_section_p => one_survey.single_section_p, + type => one_survey.type, + display_type => one_survey.display_type, + package_id => new_package_id, + context_id => new_package_id, + creation_user => one_survey.creation_user + ); + + for one_section in (select * + from survey_sections + where survey_id=one_survey.survey_id) + loop + v_section_id := survey_section.new ( + survey_id => v_survey_id, + name => one_section.name, + description => one_section.description, + description_html_p => one_section.description_html_p, + context_id => v_survey_id + ); + + for one_question in (select * + from survey_questions + where section_id=one_section.section_id) + loop + v_question_id := survey_question.new ( + section_id => v_section_id, + sort_order => one_question.sort_order, + question_text => one_question.question_text, + abstract_data_type => one_question.abstract_data_type, + required_p => one_question.required_p, + active_p => one_question.active_p, + presentation_type => one_question.presentation_type, + presentation_options => one_question.presentation_options, + presentation_alignment => one_question.presentation_alignment, + context_id => v_section_id + ); + + for q_choice in (select * + from survey_question_choices + where question_id=one_question.question_id) + loop + select survey_choice_id_sequence.nextval into v_choice_id from dual; + insert into survey_question_choices + (choice_id, question_id, label, numeric_value, sort_order) + values + (v_choice_id, + v_question_id, + q_choice.label, + q_choice.numeric_value, + q_choice.sort_order); + end loop; + end loop; + end loop; + end loop; + + end clone; + +end dotlrn_survey; +/ +show errors + + + Index: openacs-4/packages/dotlrn-survey/sql/postgresql/dotlrn-survey-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/sql/postgresql/dotlrn-survey-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/sql/postgresql/dotlrn-survey-create.sql 14 May 2003 21:06:34 -0000 1.1 @@ -0,0 +1,154 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- The survey applet for dotLRN +-- +-- @author Ben Adida (ben@openforce.net) +-- @creation-date 2002-05-29 +-- @version $Id: dotlrn-survey-create.sql,v 1.1 2003/05/14 21:06:34 donb Exp $ +-- +-- ported to postgres by mohan pakkurti (mohan@pakkurti.com) +-- 2002-07-12 +-- + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + foo := acs_sc_impl__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''dotlrn_survey'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''GetPrettyName'', + ''dotlrn_survey::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''AddApplet'', + ''dotlrn_survey::add_applet'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''RemoveApplet'', + ''dotlrn_survey::remove_applet'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''AddAppletToCommunity'', + ''dotlrn_survey::add_applet_to_community'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''RemoveAppletFromCommunity'', + ''dotlrn_survey::remove_applet_from_community'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''AddUser'', + ''dotlrn_survey::add_user'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''RemoveUser'', + ''dotlrn_survey::remove_user'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''AddUserToCommunity'', + ''dotlrn_survey::add_user_to_community'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''RemoveUserFromCommunity'', + ''dotlrn_survey::remove_user_from_community'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''AddPortlet'', + ''dotlrn_survey::add_portlet'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''RemovePortlet'', + ''dotlrn_survey::remove_portlet'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''Clone'', + ''dotlrn_survey::clone'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''dotlrn_applet'', + ''dotlrn_survey'', + ''ChangeEventHandler'', + ''dotlrn_survey::change_event_handler'', + ''TCL'' + ); + + perform acs_sc_binding__new ( + ''dotlrn_applet'', + ''dotlrn_survey'' + ); + + return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); Index: openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs-oracle.xql 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,16 @@ + + + oracle8.1.6 + + + +begin + dotlrn_survey.clone( + :old_package_id, + :new_package_id + ); +end; + + + + Index: openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/tcl/dotlrn-survey-procs.tcl 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,358 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procs to set up the dotLRN Survey applet + + @author Ben Adida (ben@openforce.net) + @author yon (yon@openforce.net) + @author Arjun Sanyal (arjun@openforce.net) + @creation-date 2002-05-29 + @version $Id: dotlrn-survey-procs.tcl,v 1.1 2003/05/14 21:06:35 donb Exp $ + +} + +namespace eval dotlrn_survey { + + ad_proc -public applet_key { + } { + What's my applet key? + } { + return dotlrn_survey + } + + ad_proc -public my_package_key { + } { + What's my package key? + } { + return "dotlrn-survey" + } + + ad_proc -public package_key { + } { + What package does this applet deal with? + } { + return survey + } + + ad_proc -public get_pretty_name { + } { + return the pretty name of this applet. + } { + return Survey + } + + ad_proc -public add_applet { + } { + Add the survey applet to dotlrn - for one-time init + Must be repeatable! + } { + if {![dotlrn_applet::applet_exists_p -applet_key [applet_key]]} { + + db_transaction { + dotlrn_applet::mount \ + -package_key [my_package_key] \ + -url survey \ + -pretty_name [get_pretty_name] + + dotlrn_applet::add_applet_to_dotlrn \ + -applet_key [applet_key] \ + -package_key [my_package_key] + } + + } + } + + ad_proc -public remove_applet { + } { + remove the applet from dotlrn + } { + ad_return_complaint 1 "[applet_key] remove_applet not implemented!" + } + + ad_proc -public add_applet_to_community { + community_id + } { + Add the survey applet to a dotlrn community + } { + # Create and Mount the survey package + set package_id [dotlrn::instantiate_and_mount \ + -mount_point survey \ + $community_id \ + [package_key] \ + ] + + # mount attachments under survey, if available + # attachments requires that dotlrn-fs is already mounted + # if {[apm_package_registered_p attachments] && [dotlrn_community::applet_active_p -community_id $community_id -applet_key [dotlrn_fs::applet_key]]} { + +# set attachments_node_id [site_node::new \ +# -name [attachments::get_url] \ +# -parent_id [site_node::get_node_id_from_object_id -object_id $package_id] +# ] + +# site_node::mount \ +# -node_id $attachments_node_id \ +# -object_id [apm_package_id_from_key attachments] + +# set fs_package_id [dotlrn_community::get_applet_package_id \ +# -community_id $community_id \ +# -applet_key [dotlrn_fs::applet_key] \ +# ] + +# # map the fs root folder to the package_id of the new survey pkg +# attachments::map_root_folder \ +# -package_id $package_id \ +# -folder_id [fs::get_root_folder -package_id $fs_package_id] + +# } + +# set auto_create_survey_p [parameter::get_from_package_key \ +# -package_key [my_package_key] \ +# -parameter auto_create_survey_p \ +# ] + +# set auto_create_survey_name [parameter::get_from_package_key \ +# -package_key [my_package_key] \ +# -parameter auto_create_survey_name \ +# ] + +# if {[string equal $auto_create_survey_p t]} { +# survey::new \ +# -name $auto_create_survey_name \ +# -package_id $package_id +# } + + # Set up permissions for basic members (Admins inherit no problem) + set members [dotlrn_community::get_rel_segment_id \ + -community_id $community_id \ + -rel_type dotlrn_member_rel \ + ] + + permission::grant -party_id $members -object_id $package_id -privilege survey_take_survey + + # set up the admin portlet + set admin_portal_id [dotlrn_community::get_admin_portal_id \ + -community_id $community_id \ + ] + + survey_admin_portlet::add_self_to_page \ + -portal_id $admin_portal_id \ + -package_id $package_id + + # set up the bboard portlet for this community + set portal_id [dotlrn_community::get_portal_id \ + -community_id $community_id \ + ] + + # add the portlet to the comm's portal using add_portlet_helper + set args [ns_set create] + ns_set put $args package_id $package_id + ns_set put $args display_group_name_p f + ns_set put $args param_action overwrite + + dotlrn_survey::add_portlet_helper $portal_id $args + + return $package_id + } + + ad_proc -public remove_applet_from_community { + community_id + } { + remove the applet from the given community + } { + ad_return_complaint 1 "[applet_key] remove_applet_from_community not implemented!" + } + + ad_proc -public add_user { + user_id + } { + Called when the user is initially added as a dotlrn user. + For one-time init stuff. + } { + } + + ad_proc -public remove_user { + user_id + } { + called when a user is removed from dotlrn. + } { + } + + ad_proc -public add_user_to_community { + community_id + user_id + } { + Add a user to a specific dotlrn community + } { + set portal_id [dotlrn::get_portal_id -user_id $user_id] + set package_id [dotlrn_community::get_applet_package_id \ + -community_id $community_id \ + -applet_key [applet_key] \ + ] + set args [ns_set create] + ns_set put $args package_id $package_id + ns_set put $args param_action append + + # don't use the cached version + dotlrn_survey::add_portlet_helper \ + [dotlrn::get_portal_id_not_cached -user_id $user_id] \ + $args + + dotlrn_survey::add_portlet_helper $portal_id $args + + # Set up notifications for all the surveys +# foreach survey [survey::list_survey -package_id $package_id] { +# set survey_id [ns_set get $survey survey_id] + +# notification::request::new \ +# -type_id [notification::type::get_type_id -short_name survey_survey_notif] \ +# -user_id $user_id \ +# -object_id $survey_id \ +# -interval_id [notification::get_interval_id -name instant] \ +# -delivery_method_id [notification::get_delivery_method_id -name email] +# } +# } + + ad_proc -public remove_user_from_community { + community_id + user_id + } { + Remove a user from a community + } { + set portal_id [dotlrn::get_portal_id -user_id $user_id] + set package_id [dotlrn_community::get_applet_package_id \ + -community_id $community_id \ + -applet_key [applet_key] \ + ] + + set args [ns_set create] + ns_set put $args package_id $package_id + + remove_portlet $portal_id $args + +# foreach survey [survey::list_survey -package_id $package_id] { +# set survey_id [ns_set get $survey survey_id] + +# notification::request::delete \ +# -request_id [notification::request::get_request_id \ +# -type_id [notification::type::get_type_id -short_name survey_survey_notif] \ +# -user_id $user_id \ +# -object_id $survey_id \ +# ] +# } + } + + ad_proc -public add_portlet { + portal_id + } { + A helper proc to set up default params for templates. + + @param portal_id + } { + set args [ns_set create] + ns_set put $args package_id 0 + ns_set put $args display_group_name_p f + ns_set put $args param_action overwrite + + set type [dotlrn::get_type_from_portal_id -portal_id $portal_id] + + if {[string equal $type user]} { + # portal_id is a user portal template + ns_set put $args display_group_name_p t + } + + add_portlet_helper $portal_id $args + } + + ad_proc -public add_portlet_helper { + portal_id + args + } { + This does the call to add the portlet to the given portal. + Params for the portlet are set by the calllers. + + @param portal_id + @param args An ns_set of params + } { + survey_portlet::add_self_to_page \ + -portal_id $portal_id \ + -package_id [ns_set get $args package_id] \ + -param_action [ns_set get $args param_action] \ + -display_group_name_p [ns_set get $args display_group_name_p] + } + + ad_proc -public remove_portlet { + portal_id + args + } { + A helper proc to remove the underlying portlet from the given portal. + + @param portal_id + @param args An ns_set of args + } { + set package_id [ns_set get $args package_id] + survey_portlet::remove_self_from_page $portal_id $package_id + } + + ad_proc -public clone { + old_community_id + new_community_id + } { + Clone this applet's content from the old community to the new one + } { + + set new_package_id [dotlrn_survey::add_applet_to_community $new_community_id] + set old_package_id [dotlrn_community::get_applet_package_id -community_id $old_community_id -applet_key dotlrn_survey] + db_exec_plsql clone_survey_package {} + return $new_package_id + } + + + + ad_proc -public change_event_handler { + community_id + event + old_value + new_value + } { + listens for the following events: rename + } { + switch $event { + rename { + handle_rename -community_id $community_id -old_value $old_value -new_value $new_value + } + } + } + + ad_proc -private handle_rename { + {-community_id:required} + {-old_value:required} + {-new_value:required} + } { + what to do with survey when the name of the community changes + } { + set package_id [dotlrn_community::get_applet_package_id \ + -community_id $community_id \ + -applet_key [applet_key] \ + ] + set name "$old_value Survey" + + + } + +} Index: openacs-4/packages/dotlrn-survey/www/user-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/www/user-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/www/user-oracle.xql 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,7 @@ + + + + oracle8.1.6 + + + Index: openacs-4/packages/dotlrn-survey/www/user-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/www/user-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/www/user-postgresql.xql 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,6 @@ + + + + postgresql7.2.1 + + Index: openacs-4/packages/dotlrn-survey/www/user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/www/user.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/www/user.adp 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,98 @@ +% +Survey: Responseg history for @user.full_name@ +@context_bar@ + +

+ Response history for + + + +

+ +

+

+@dimensional_chunk@ +
+

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SurveySubjectPosted
@surveys.survey_name@@surveys.subject@@surveys.posting_date@
+ No Postings. +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
@surveys.survey_name@

SubjectPosted
@surveys.subject@@surveys.posting_date@
+
+ +
+ +
+ +
Index: openacs-4/packages/dotlrn-survey/www/user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-survey/www/user.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn-survey/www/user.tcl 14 May 2003 21:06:35 -0000 1.1 @@ -0,0 +1,33 @@ +ad_page_contract { + + Posting History for a User + + @author Ben Adida (ben@openforce) + @creation-date 2002-05-29 + @version $Id: user.tcl,v 1.1 2003/05/14 21:06:35 donb Exp $ + +} { + user_id:integer,notnull + {view "date"} +} + +# choosing the view +set dimensional_list { + { + view "View:" date { + {date "by Date" {}} + {forum "by Forum" {}} + } + } +} + +db_multirow surveys select_surveys {} + +# Get user information +oacs::user::get -user_id $user_id -array user + +set dimensional_chunk [ad_dimensional $dimensional_list] + +set context_bar {{Respose History}} + +ad_return_template Index: openacs-4/packages/survey-portlet/survey-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/survey-portlet.info,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/survey-portlet.info 14 May 2003 21:06:59 -0000 1.1 @@ -0,0 +1,44 @@ + + + + + Survey Portlet + Survey Portlets + f + t + + + + oracle + postgresql + + dave bauer + Survey package portlet for new-portal + Survey package portlet for new-portal + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/survey-portlet/sql/oracle/survey-admin-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/oracle/survey-admin-portlet-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/oracle/survey-admin-portlet-create.sql 14 May 2003 21:06:59 -0000 1.1 @@ -0,0 +1,197 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlet/sql/survey-portlets-create.sql +-- + +-- Creates survey datasources for portal portlets + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-admin-portlet-create.sql,v 1.1 2003/05/14 21:06:59 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource.new( + name => 'survey_admin_portlet', + description => 'Displays the survey_admin' + ); + + -- 4 defaults procs + + -- shadeable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shadeable_p', + value => 'f' +); + + -- shaded_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shaded_p', + value => 'f' +); + + -- hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'hideable_p', + value => 't' +); + + -- user_editable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'user_editable_p', + value => 'f' +); + + -- link_hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'link_hideable_p', + value => 't' +); + + + -- survey_admin-specific procs + + -- package_id must be configured + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 'f', + key => 'package_id', + value => '' +); + + +end; +/ +show errors + + +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl.new ( + 'portal_datasource', + 'survey_admin_portlet', + 'survey_admin_portlet' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'GetMyName', + 'survey_admin_portlet::get_my_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'GetPrettyName', + 'survey_admin_portlet::get_pretty_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'Link', + 'survey_admin_portlet::link', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'AddSelfToPage', + 'survey_admin_portlet::add_self_to_page', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'Show', + 'survey_admin_portlet::show', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'Edit', + 'survey_admin_portlet::edit', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_admin_portlet', + 'RemoveSelfFromPage', + 'survey_admin_portlet::remove_self_from_page', + 'TCL' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- Add the binding + acs_sc_binding.new ( + contract_name => 'portal_datasource', + impl_name => 'survey_admin_portlet' + ); +end; +/ +show errors + Index: openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-create.sql 14 May 2003 21:06:59 -0000 1.1 @@ -0,0 +1,200 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlet/sql/survey-portlets-create.sql +-- + +-- Creates survey datasources for portal portlets + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-portlet-create.sql,v 1.1 2003/05/14 21:06:59 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +-- @survey-portlet-sc-create.sql + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource.new( + name => 'survey_portlet', + description => 'Displays the survey' + ); + + -- 4 defaults procs + + -- shadeable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shadeable_p', + value => 't' +); + + -- shaded_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'shaded_p', + value => 'f' +); + + -- hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'hideable_p', + value => 't' +); + + -- user_editable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'user_editable_p', + value => 'f' +); + + -- link_hideable_p + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 't', + key => 'link_hideable_p', + value => 't' +); + + + -- survey-specific procs + + -- package_id must be configured + portal_datasource.set_def_param ( + datasource_id => ds_id, + config_required_p => 't', + configured_p => 'f', + key => 'package_id', + value => '' +); + +end; +/ +show errors + + +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl.new ( + 'portal_datasource', + 'survey_portlet', + 'survey_portlet' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'GetMyName', + 'survey_portlet::get_my_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'GetPrettyName', + 'survey_portlet::get_pretty_name', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'Link', + 'survey_portlet::link', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'AddSelfToPage', + 'survey_portlet::add_self_to_page', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'Show', + 'survey_portlet::show', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'Edit', + 'survey_portlet::edit', + 'TCL' + ); + + foo := acs_sc_impl.new_alias ( + 'portal_datasource', + 'survey_portlet', + 'RemoveSelfFromPage', + 'survey_portlet::remove_self_from_page', + 'TCL' + ); + +end; +/ +show errors + +declare + foo integer; +begin + + -- Add the binding + acs_sc_binding.new ( + contract_name => 'portal_datasource', + impl_name => 'survey_portlet' + ); +end; +/ +show errors + +@survey-admin-portlet-create.sql + Index: openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/oracle/survey-portlet-drop.sql 14 May 2003 21:06:59 -0000 1.1 @@ -0,0 +1,118 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlets/sql/survey-portlets-drop.sql +-- + +-- Drops survey datasources for portal portlets + +-- Copyright (C) 2001 Openforce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-portlet-drop.sql,v 1.1 2003/05/14 21:06:59 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + + begin + select datasource_id into ds_id + from portal_datasources + where name = 'survey-portlet'; + exception when no_data_found then + ds_id := null; + end; + + if ds_id is not null then + portal_datasource.delete(ds_id); + end if; + +end; +/ +show errors; + + + +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'GetMyName' + ); + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'GetPrettyName' + ); + + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'Link' + ); + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'AddSelfToPage' + ); + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'Show' + ); + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'Edit' + ); + + foo := acs_sc_impl.delete_alias ( + 'portal_datasource', + 'survey_portlet', + 'RemoveSelfFromPage' + ); + + -- Drop the binding + acs_sc_binding.delete ( + contract_name => 'portal_datasource', + impl_name => 'survey_portlet' + ); + + -- drop the impl + foo := acs_sc_impl.delete ( + 'portal_datasource', + 'survey_portlet' + ); +end; +/ +show errors + + Index: openacs-4/packages/survey-portlet/sql/postgresql/survey-admin-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/postgresql/survey-admin-portlet-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/postgresql/survey-admin-portlet-create.sql 14 May 2003 21:06:59 -0000 1.1 @@ -0,0 +1,214 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlet/sql/survey-portlets-create.sql +-- + +-- Creates survey datasources for portal portlets + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-admin-portlet-create.sql,v 1.1 2003/05/14 21:06:59 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +-- ported to postgres by mohan pakkurti (mohan@pakkurti.com) +-- 2002-07-12 + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource__new( + ''survey_admin_portlet'', + ''Displays the survey_admin'' + ); + + -- 4 defaults procs + + -- shadeable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''f'' +); + + -- shaded_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' +); + + -- hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''t'' +); + + -- user_editable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''f'' +); + + -- link_hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' +); + + + -- survey_admin-specific procs + + -- package_id must be configured + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''package_id'', + '''' +); + +return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''survey_admin_portlet'' + ); + +return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''GetMyName'', + ''survey_admin_portlet::get_my_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''GetPrettyName'', + ''survey_admin_portlet::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''Link'', + ''survey_admin_portlet::link'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''AddSelfToPage'', + ''survey_admin_portlet::add_self_to_page'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''Show'', + ''survey_admin_portlet::show'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''Edit'', + ''survey_admin_portlet::edit'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_admin_portlet'', + ''RemoveSelfFromPage'', + ''survey_admin_portlet::remove_self_from_page'', + ''TCL'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''survey_admin_portlet'' + ); +return 0; +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + + Index: openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-create.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-create.sql 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,227 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlet/sql/survey-portlets-create.sql +-- + +-- Creates survey datasources for portal portlets + +-- Copyright (C) 2001 OpenForce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-portlet-create.sql,v 1.1 2003/05/14 21:07:00 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +-- ported to postgres by mohan pakkurti (mohan@pakkurti.com) +-- 2002-07-12 + +-- \i survey-portlet-sc-create.sql + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + ds_id := portal_datasource__new ( + ''survey_portlet'', + ''Displays the survey'' + ); + + -- 4 defaults procs + + -- shadeable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shadeable_p'', + ''t'' + ); + + -- shaded_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''shaded_p'', + ''f'' + ); + + -- hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''hideable_p'', + ''t'' + ); + + -- user_editable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''user_editable_p'', + ''f'' + ); + + -- link_hideable_p + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''t'', + ''link_hideable_p'', + ''t'' + ); + + + -- survey-specific procs + + -- package_id must be configured + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''package_id'', + '''' + ); + + -- do we show the community name or not? + perform portal_datasource__set_def_param ( + ds_id, + ''t'', + ''f'', + ''display_group_name_p'', + ''t'' + ); +return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + -- create the implementation + foo := acs_sc_impl__new ( + ''portal_datasource'', + ''survey_portlet'', + ''survey_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''GetMyName'', + ''survey_portlet::get_my_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''GetPrettyName'', + ''survey_portlet::get_pretty_name'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''Link'', + ''survey_portlet::link'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''AddSelfToPage'', + ''survey_portlet::add_self_to_page'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''Show'', + ''survey_portlet::show'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''Edit'', + ''survey_portlet::edit'', + ''TCL'' + ); + + foo := acs_sc_impl_alias__new ( + ''portal_datasource'', + ''survey_portlet'', + ''RemoveSelfFromPage'', + ''survey_portlet::remove_self_from_page'', + ''TCL'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +create function inline_0() +returns integer as ' +declare + foo integer; +begin + + -- Add the binding + perform acs_sc_binding__new ( + ''portal_datasource'', + ''survey_portlet'' + ); + + return 0; + +end;' language 'plpgsql'; +select inline_0(); +drop function inline_0(); + +\i survey-admin-portlet-create.sql + Index: openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-drop.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/sql/postgresql/survey-portlet-drop.sql 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,131 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +-- +-- packages/survey-portlets/sql/survey-portlets-drop.sql +-- + +-- Drops survey datasources for portal portlets + +-- Copyright (C) 2001 Openforce, Inc. +-- @author Arjun Sanyal (arjun@openforce.net) +-- @creation-date 2001-30-09 + +-- $Id: survey-portlet-drop.sql,v 1.1 2003/05/14 21:07:00 donb Exp $ + +-- This is free software distributed under the terms of the GNU Public +-- License version 2 or higher. Full text of the license is available +-- from the GNU Project: http://www.fsf.org/copyleft/gpl.html + +-- ported to postgres by mohan pakkurti (mohan@pakkurti.com) +-- 2002-07-12 + + +create function inline_0() +returns integer as ' +declare + ds_id portal_datasources.datasource_id%TYPE; +begin + +-- begin + select datasource_id into ds_id + from portal_datasources + where name = ''survey-portlet''; +-- exception when no_data_found then +-- ds_id := null; +-- end; + + if ds_id is not null then + portal_datasource__delete(ds_id); + end if; + +return 0; + +end;' language 'plpgsql'; + +select inline_0(); +drop function inline_0(); + + +create function inline_1() +returns integer as ' +declare + foo integer; +begin + + -- add all the hooks + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''GetMyName'' + ); + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''GetPrettyName'' + ); + + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''Link'' + ); + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''AddSelfToPage'' + ); + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''Show'' + ); + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''Edit'' + ); + + foo := acs_sc_impl_alias__delete ( + ''portal_datasource'', + ''survey_portlet'', + ''RemoveSelfFromPage'' + ); + + -- Drop the binding + perform acs_sc_binding__delete ( + ''portal_datasource'', + ''survey_portlet'' + ); + + -- drop the impl + foo := acs_sc_impl__delete ( + ''portal_datasource'', + ''survey_portlet'' + ); + + return 0; +end;' language 'plpgsql'; + +select inline_1(); +drop function inline_1(); + + Index: openacs-4/packages/survey-portlet/tcl/survey-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/tcl/survey-admin-portlet-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/tcl/survey-admin-portlet-procs.tcl 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,92 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procedures to supports survey admin portlets + + @creation-date September 30 2001 + @author arjun@openforce.net + @version $Id: survey-admin-portlet-procs.tcl,v 1.1 2003/05/14 21:07:00 donb Exp $ +} + +namespace eval survey_admin_portlet { + + ad_proc -private get_my_name { + } { + return "survey_admin_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "Survey Administration" + } + + ad_proc -private my_package_key { + } { + return "survey-portlet" + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + } { + Adds a survey admin PE to the admin portal + + @return new element_id + } { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -pretty_name [get_pretty_name] \ + -key package_id \ + -value $package_id + ] + } + + ad_proc -public remove_self_from_page { + {-portal_id:required} + } { + Removes the survey admin PE from the portal + } { + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] + } + + ad_proc -public show { + cf + } { + } { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "survey-admin-portlet" + } + + ad_proc -public edit { + cf + } { + } { + return "" + } + +} Index: openacs-4/packages/survey-portlet/tcl/survey-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/tcl/survey-portlet-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/tcl/survey-portlet-procs.tcl 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,95 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_library { + + Procedures to supports survey portlets + + @creation-date September 30 2001 + @author arjun@openforce.net + @version $Id: survey-portlet-procs.tcl,v 1.1 2003/05/14 21:07:00 donb Exp $ + +} + +namespace eval survey_portlet { + + ad_proc -private get_my_name { + } { + return "survey_portlet" + } + + ad_proc -public get_pretty_name { + } { + return "Survey" + } + + ad_proc -private my_package_key { + } { + return "survey-portlet" + } + + ad_proc -public link { + } { + return "" + } + + ad_proc -public add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-display_group_name_p:required} + {-param_action:required} + } { + Adds a survey PE to the given portal or appends the given survey package_id + to the survey PE that already on the portal + } { + return [portal::add_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -pretty_name [get_pretty_name] \ + -value $package_id \ + -force_region [parameter::get_from_package_key \ + -package_key [my_package_key] \ + -parameter "survey_portlet_region"] \ + -extra_params [list "display_group_name_p" $display_group_name_p] \ + -param_action $param_action + ] + } + + + ad_proc -public remove_self_from_page { + portal_id + package_id + } { + Removes a survey PE from the given page or just the given survey's package_id + } { + portal::remove_element_parameters \ + -portal_id $portal_id \ + -portlet_name [get_my_name] \ + -value $package_id + } + + ad_proc -public show { + cf + } { + } { + # no return call required with the helper proc + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "survey-portlet" + } + +} Index: openacs-4/packages/survey-portlet/www/survey-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-admin-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-admin-portlet.adp 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,32 @@ +<% + + # + # Copyright (C) 2001, 2002 OpenForce, Inc. + # + # This file is part of dotLRN. + # + # dotLRN is free software; you can redistribute it and/or modify it under the + # terms of the GNU General Public License as published by the Free Software + # Foundation; either version 2 of the License, or (at your option) any later + # version. + # + # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY + # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + # details. + # + +%> + + Index: openacs-4/packages/survey-portlet/www/survey-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-admin-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-admin-portlet.tcl 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,52 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +ad_page_contract { + The display logic for the survey admin portlet + + @author Ben Adida (ben@openforce) + @cvs_id $Id: survey-admin-portlet.tcl,v 1.1 2003/05/14 21:07:00 donb Exp $ +} -properties { + +} + +array set config $cf + +set list_of_package_ids $config(package_id) + +if {[llength $list_of_package_ids] > 1} { + # We have a problem! + return -code error "There should be only one instance of survey for admin purposes" +} + +set package_id [lindex $list_of_package_ids 0] + +db_multirow surveys select_surveys { + select survey_id, name, enabled_p + from surveys + where package_id = :package_id +} + +set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0] + +set package_id [ad_conn package_id] +set default_name [db_string select_package_name { + select instance_name from apm_packages where package_id= :package_id +}] + +set encoded_default_name [ns_urlencode $default_name] + +ad_return_template Index: openacs-4/packages/survey-portlet/www/survey-portlet-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-portlet-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-portlet-oracle.xql 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,25 @@ + + + + + + + +select s.survey_id, s.name, s.editable_p, s.single_response_p, + s.package_id, + acs_object.name(apm_package.parent_id(s.package_id)) as parent_name, + (select site_node.url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = s.package_id) as url, + (select count(*) from survey_responses_latest srl where srl.survey_id=s.survey_id and initial_user_id=:user_id) as response_count + from surveys s + where s.package_id in ([join $list_of_package_ids ,]) + and s.enabled_p='t' + order by +parent_name, +upper(s.name) + + + + + \ No newline at end of file Index: openacs-4/packages/survey-portlet/www/survey-portlet-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-portlet-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-portlet-postgresql.xql 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,25 @@ + + + + + + + +select s.survey_id, s.name, s.editable_p, s.single_response_p, + s.package_id, + acs_object__name(apm_package__parent_id(s.package_id)) as parent_name, + (select site_node__url(site_nodes.node_id) + from site_nodes + where site_nodes.object_id = s.package_id) as url, + (select count(*) from survey_responses_latest srl where srl.survey_id=s.survey_id and initial_user_id=:user_id) as response_count + from surveys s + where s.package_id in ([join $list_of_package_ids ,]) + and s.enabled_p='t' + order by +parent_name, +upper(s.name) + + + + + Index: openacs-4/packages/survey-portlet/www/survey-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-portlet.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-portlet.adp 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,45 @@ +<% + + # + # Copyright (C) 2001, 2002 OpenForce, Inc. + # + # This file is part of dotLRN. + # + # dotLRN is free software; you can redistribute it and/or modify it under the + # terms of the GNU General Public License as published by the Free Software + # Foundation; either version 2 of the License, or (at your option) any later + # version. + # + # dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY + # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + # details. + # + +%> + + + + + + +@surveys.parent_name@ + +
view/edit previous responses for surveys in this group

+
+
+ +
  • No unanswered surveys
  • +
    + +
    +
    Index: openacs-4/packages/survey-portlet/www/survey-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/survey-portlet/www/survey-portlet.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/survey-portlet/www/survey-portlet.tcl 14 May 2003 21:07:00 -0000 1.1 @@ -0,0 +1,27 @@ +# +# Copyright (C) 2001, 2002 OpenForce, Inc. +# +# This file is part of dotLRN. +# +# dotLRN is free software; you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation; either version 2 of the License, or (at your option) any later +# version. +# +# dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# + +array set config $cf + +set shaded_p $config(shaded_p) +set list_of_package_ids $config(package_id) + +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] +set can_read_private_data_p [acs_privacy::user_can_read_private_data_p -object_id [ad_conn package_id]] +set user_id [ad_conn user_id] +db_multirow surveys select_surveys {} + +