Index: openacs-4/packages/assessment-portlet/assessment-portlet.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/assessment-portlet.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/assessment-portlet.info 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+
+ Assessment Portlet
+ Assessments Portlets
+ f
+ t
+
+
+ Jose Pablo Escobedo Del Cid
+ 2004-06-12
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/assessment-portlet/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/tcl/apm-callback-procs.tcl 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,31 @@
+ad_library {
+ Procedures for initializing service contracts etc. for the
+ assessment portlet package. Should only be executed
+ once upon installation.
+
+ @creation-date Sept 2004
+ @author jopez@galileo.edu
+ @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2004/10/25 18:33:14 eduardop Exp $
+}
+
+namespace eval apm::assessment_portlet {}
+namespace eval apm::assessment_admin_portlet {}
+
+ad_proc -public apm::assessment_portlet::after_install {} {
+ Create the datasources needed by the assessment portlets.
+} {
+ assessment_portlet::after_install
+ assessment_admin_portlet::after_install
+}
+
+ad_proc -public apm::assessment_portlet::before_uninstall {} {
+ Assessment Portlet package uninstall proc
+} {
+
+ db_transaction {
+ assessment_portlet::uninstall
+ assessment_admin_portlet::uninstall
+ }
+}
+
+
Index: openacs-4/packages/assessment-portlet/tcl/assessment-portlet-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/tcl/assessment-portlet-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/tcl/assessment-portlet-procs.tcl 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,354 @@
+ad_library {
+
+ Procedures to support the assessment portlets
+
+ @creation-date Sept 2004
+ @author jopez@galileo.edu
+ @cvs_id $Id: assessment-portlet-procs.tcl,v 1.1 2004/10/25 18:33:14 eduardop Exp $
+
+}
+
+namespace eval assessment_portlet {}
+namespace eval assessment_admin_portlet {}
+
+
+#
+# assessment namespace
+#
+
+ad_proc -private assessment_portlet::get_my_name {
+} {
+ return "assessment_portlet"
+}
+
+
+
+ad_proc -private assessment_portlet::my_package_key {
+} {
+ return "assessment-portlet"
+}
+
+
+
+ad_proc -public assessment_portlet::get_pretty_name {
+} {
+ return "Assessment"
+}
+
+
+
+ad_proc -public assessment_portlet::link {
+} {
+ return ""
+}
+
+
+
+ad_proc -public assessment_portlet::add_self_to_page {
+ {-portal_id:required}
+ {-package_id:required}
+ {-param_action:required}
+ {-force_region ""}
+ {-page_name "" }
+} {
+ Adds a assessment PE to the given portal.
+
+ @param portal_id The page to add self to
+ @param package_id The community with the folder
+
+ @return element_id The new element's id
+} {
+ return [portal::add_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -value $package_id \
+ -force_region $force_region \
+ -page_name $page_name \
+ -pretty_name [get_pretty_name] \
+ -param_action $param_action
+ ]
+}
+
+
+
+ad_proc -public assessment_portlet::remove_self_from_page {
+ {-portal_id:required}
+ {-package_id:required}
+} {
+ Removes a assessment PE from the given page or the package_id of the
+ assessment package from the portlet if there are others remaining
+
+ @param portal_id The page to remove self from
+ @param package_id
+} {
+ portal::remove_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -value $package_id
+}
+
+
+
+ad_proc -public assessment_portlet::show {
+ cf
+} {
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "assessment-portlet"
+}
+
+#
+# assessment admin namespace
+#
+
+ad_proc -private assessment_admin_portlet::get_my_name {} {
+ return "assessment_admin_portlet"
+}
+
+
+ad_proc -public assessment_admin_portlet::get_pretty_name {} {
+ return "Assessment Administration"
+}
+
+
+
+ad_proc -private assessment_admin_portlet::my_package_key {} {
+ return "assessment-portlet"
+}
+
+
+
+ad_proc -public assessment_admin_portlet::link {} {
+ return ""
+}
+
+
+
+ad_proc -public assessment_admin_portlet::add_self_to_page {
+ {-portal_id:required}
+ {-page_name ""}
+ {-package_id:required}
+} {
+ Adds a assessment admin PE to the given portal
+
+ @param portal_id The page to add self to
+ @param package_id The package_id of the assessment package
+
+ @return element_id The new element's id
+} {
+ return [portal::add_element_parameters \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name] \
+ -key package_id \
+ -value $package_id
+ ]
+}
+
+ad_proc -public assessment_admin_portlet::remove_self_from_page {
+ {-portal_id:required}
+} {
+ Removes a assessment admin PE from the given page
+} {
+ portal::remove_element \
+ -portal_id $portal_id \
+ -portlet_name [get_my_name]
+}
+
+
+ad_proc -public assessment_admin_portlet::show {
+ cf
+} {
+ portal::show_proc_helper \
+ -package_key [my_package_key] \
+ -config_list $cf \
+ -template_src "assessment-admin-portlet"
+}
+
+ad_proc -private assessment_portlet::after_install {} {
+ Create the datasources needed by the assessment portlet.
+} {
+
+ db_transaction {
+ set ds_id [portal::datasource::new \
+ -name "assessment_portlet" \
+ -description "Assessments Portlet"]
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key shadeable_p \
+ -value t
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key hideable_p \
+ -value t
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key user_editable_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key shaded_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key link_hideable_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p f \
+ -key package_id \
+ -value ""
+
+ register_portal_datasource_impl
+
+ }
+}
+
+ad_proc -private assessment_portlet::register_portal_datasource_impl {} {
+ Create the service contracts needed by the assessment portlet.
+} {
+ set spec {
+ name "assessment_portlet"
+ contract_name "portal_datasource"
+ owner "assessment-portlet"
+ aliases {
+ GetMyName assessment_portlet::get_my_name
+ GetPrettyName assessment_portlet::get_pretty_name
+ Link assessment_portlet::link
+ AddSelfToPage assessment_portlet::add_self_to_page
+ Show assessment_portlet::show
+ Edit assessment_portlet::edit
+ RemoveSelfFromPage assessment_portlet::remove_self_from_page
+ }
+ }
+
+ acs_sc::impl::new_from_spec -spec $spec
+}
+
+ad_proc -private assessment_admin_portlet::after_install {} {
+ Create the datasources needed by the assessment portlet.
+} {
+
+ db_transaction {
+ set ds_id [portal::datasource::new \
+ -name "assessment_admin_portlet" \
+ -description "Assessment Admin Portlet"]
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key shadeable_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key hideable_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key user_editable_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key shaded_p \
+ -value f
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p t \
+ -key link_hideable_p \
+ -value t
+
+ portal::datasource::set_def_param \
+ -datasource_id $ds_id \
+ -config_required_p t \
+ -configured_p f \
+ -key package_id \
+ -value ""
+
+ register_portal_datasource_impl
+ }
+
+}
+
+
+
+ad_proc -private assessment_admin_portlet::register_portal_datasource_impl {} {
+ Create the service contracts needed by the assessment admin portlet.
+} {
+ set spec {
+ name "assessment_admin_portlet"
+ contract_name "portal_datasource"
+ owner "assessment-portlet"
+ aliases {
+ GetMyName assessment_admin_portlet::get_my_name
+ GetPrettyName assessment_admin_portlet::get_pretty_name
+ Link assessment_admin_portlet::link
+ AddSelfToPage assessment_admin_portlet::add_self_to_page
+ Show assessment_admin_portlet::show
+ Edit assessment_admin_portlet::edit
+ RemoveSelfFromPage assessment_admin_portlet::remove_self_from_page
+ }
+ }
+
+ acs_sc::impl::new_from_spec -spec $spec
+}
+
+ad_proc -private assessment_portlet::uninstall {} {
+ Assessment Portlet package uninstall proc
+} {
+ unregister_implementations
+ set ds_id [portal::get_datasource_id assessment_portlet]
+ db_exec_plsql delete_assessments_ds { *SQL* }
+}
+
+ad_proc -private assessment_admin_portlet::uninstall {} {
+ Assessment Portlet package uninstall proc
+} {
+ unregister_implementations
+ set ds_id [portal::get_datasource_id assessment_admin_portlet]
+ db_exec_plsql delete_admin_ds { *SQL* }
+}
+
+ad_proc -private assessment_portlet::unregister_implementations {} {
+ Unregister service contract implementations
+} {
+ acs_sc::impl::delete \
+ -contract_name "portal_datasource" \
+ -impl_name "assessment_portlet"
+}
+
+ad_proc -private assessment_admin_portlet::unregister_implementations {} {
+ Unregister service contract implementations
+} {
+ acs_sc::impl::delete \
+ -contract_name "portal_datasource" \
+ -impl_name "assessment_admin_portlet"
+}
Index: openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.adp 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,4 @@
+
+
Index: openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-admin-portlet.tcl 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,26 @@
+# /assessment-portlet/www/assessment-admin-portlet.tcl
+
+ad_page_contract {
+ The display logic for the assessment admin portlet
+
+ @author jopez@galileo.edu
+ @creation-date 2004-10-06
+ @cvs_id $Id: assessment-admin-portlet.tcl,v 1.1 2004/10/25 18:33:14 eduardop Exp $
+} -properties {
+
+}
+
+array set config $cf
+set user_id [ad_conn user_id]
+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 assessment for admin purpose"
+}
+
+set package_id [lindex $list_of_package_ids 0]
+
+set url [lindex [site_node::get_url_from_object_id -object_id $package_id] 0]
+
+ad_return_template
Index: openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-portlet-postgresql.xql 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,21 @@
+
+
+
+postgresql7.1
+
+
+
+
+ select eg.grade_plural_name,
+ eg.grade_id,
+ eg.grade_item_id
+ from evaluation_grades eg, acs_objects ao, cr_items cri
+ where cri.live_revision = eg.grade_id
+ and eg.grade_item_id = ao.object_id
+ and ao.context_id in ([join $list_of_package_ids ,])
+ order by grade_plural_name desc
+
+
+
+
+
Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-portlet.adp 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,10 @@
+
+
+ assessment portlet content
+
+
+
+
+
+
+
Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-portlet.tcl 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,62 @@
+# /assessment-portlet/www/assessment-portlet.tcl
+
+ad_page_contract {
+ The display logic for the assessment portlet
+
+ @author jopez@galileo.edu
+ @creation-date Oct 2004
+ @cvs_id $Id: assessment-portlet.tcl,v 1.1 2004/10/25 18:33:14 eduardop Exp $
+} {
+ {page_num 0}
+} -properties {
+}
+
+set user_id [ad_conn user_id]
+
+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]
+ns_log notice " ----- [join $list_of_package_ids ","] \n\n\n\n"
+
+set admin_p 0
+array set package_admin_p [list]
+foreach package_id $config(package_id) {
+ set package_admin_p($package_id) [permission::permission_p -object_id $package_id -privilege admin]
+ if { $package_admin_p($package_id) } {
+ set admin_p 1
+ }
+}
+
+set base_url "[ad_conn package_url]assessment/"
+
+template::list::create \
+ -name assessments \
+ -multirow assessments \
+ -pass_properties { base_url } \
+ -key assessment_id \
+ -elements {
+ title {
+ label {Assessment}
+ link_url_eval {[export_vars -base "$base_url" {assessment_id}]}
+ link_html { title {description} }
+
+ }
+ session {
+ label {assessment.Sessions}
+ link_url_eval {[export_vars -base "$base_url" {assessment_id}]}
+ }
+ } \
+ -main_class {
+ narrow
+ }
+
+db_multirow -extend { session } assessments asssessment_id_name_definition {} {
+ set session {Sessions}
+}
+
+ad_return_template
+
+
+
Index: openacs-4/packages/assessment-portlet/www/assessment-portlet.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/assessment-portlet/www/Attic/assessment-portlet.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/assessment-portlet/www/assessment-portlet.xql 25 Oct 2004 18:33:14 -0000 1.1
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ select asa.assessment_id, cri.name, crr.title, crr.description
+ from as_assessments asa, cr_items cri, cr_revisions crr, cr_folders crf
+ where crr.revision_id = asa.assessment_id
+ and crr.item_id = cri.item_id
+ and cri.parent_id = crf.folder_id
+ and crf.package_id in ([join $list_of_package_ids ", "])
+ order by lower(cri.name)
+
+
+
+
Index: openacs-4/packages/dotlrn-assessment/dotlrn-assessment.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-assessment/dotlrn-assessment.info,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-assessment/dotlrn-assessment.info 25 Oct 2004 18:31:59 -0000 1.1
@@ -0,0 +1,27 @@
+
+
+
+
+ dotLRN Assessment Applet
+ dotLRN Assessment Applets
+ f
+ t
+
+
+ Jose Pablo Escobedo Del Cid
+ 2004-10-19
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-assessment/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-assessment/tcl/apm-callback-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-assessment/tcl/apm-callback-procs.tcl 25 Oct 2004 18:32:00 -0000 1.1
@@ -0,0 +1,58 @@
+ad_library {
+ Procedures for registering implementations for the
+ dotlrn assessment package.
+
+ @creation-date 2004-10-20
+ @author jopez@galileo.edu
+ @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2004/10/25 18:32:00 eduardop Exp $
+}
+
+namespace eval dotlrn_assessment {}
+
+ad_proc -public dotlrn_assessment::install {} {
+ dotLRN Assessment package install proc
+} {
+ register_portal_datasource_impl
+}
+
+ad_proc -public dotlrn_assessment::uninstall {} {
+ dotLRN Assessment package uninstall proc
+} {
+ unregister_portal_datasource_impl
+}
+
+ad_proc -public dotlrn_assessment::register_portal_datasource_impl {} {
+ Register the service contract implementation for the dotlrn_applet service contract
+} {
+ set spec {
+ name "dotlrn_assessment"
+ contract_name "dotlrn_applet"
+ owner "dotlrn-assessment"
+ aliases {
+ GetPrettyName dotlrn_assessment::get_pretty_name
+ AddApplet dotlrn_assessment::add_applet
+ RemoveApplet dotlrn_assessment::remove_applet
+ AddAppletToCommunity dotlrn_assessment::add_applet_to_community
+ RemoveAppletFromCommunity dotlrn_assessment::remove_applet_from_community
+ AddUser dotlrn_assessment::add_user
+ RemoveUser dotlrn_assessment::remove_user
+ AddUserToCommunity dotlrn_assessment::add_user_to_community
+ RemoveUserFromCommunity dotlrn_assessment::remove_user_from_community
+ AddPortlet dotlrn_assessment::add_portlet
+ RemovePortlet dotlrn_assessment::remove_portlet
+ Clone dotlrn_assessment::clone
+ ChangeEventHandler dotlrn_assessment::change_event_handler
+ }
+ }
+
+ acs_sc::impl::new_from_spec -spec $spec
+}
+
+ad_proc -public dotlrn_assessment::unregister_portal_datasource_impl {} {
+ Unregister service contract implementations
+} {
+ acs_sc::impl::delete \
+ -contract_name "dotlrn_applet" \
+ -impl_name "dotlrn_assessment"
+}
+
Index: openacs-4/packages/dotlrn-assessment/tcl/dotlrn-assessment-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-assessment/tcl/Attic/dotlrn-assessment-procs-postgresql.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-assessment/tcl/dotlrn-assessment-procs-postgresql.xql 25 Oct 2004 18:32:00 -0000 1.1
@@ -0,0 +1,32 @@
+
+
+
+postgresql7.1
+
+
+
+ select assessment__clone (
+ :old_package_id,
+ :new_package_id
+ );
+
+
+
+
+
+
+ delete from dotlrn_community_applets where applet_id = :applet_id
+
+
+
+
+
+
+
+ delete from dotlrn_applets where applet_id = :applet_id
+
+
+
+
+
+
Index: openacs-4/packages/dotlrn-assessment/tcl/dotlrn-assessment-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-assessment/tcl/dotlrn-assessment-procs.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/dotlrn-assessment/tcl/dotlrn-assessment-procs.tcl 25 Oct 2004 18:32:00 -0000 1.1
@@ -0,0 +1,198 @@
+ad_library {
+
+ Procs to set up the dotLRN assessment applet
+
+ @author jopez@galileo.edu
+ @cvs_id $Id: dotlrn-assessment-procs.tcl,v 1.1 2004/10/25 18:32:00 eduardop Exp $
+}
+
+namespace eval dotlrn_assessment {}
+
+ad_proc -public dotlrn_assessment::applet_key {} {
+ What's my applet key?
+} {
+ return dotlrn_assessment
+}
+
+ad_proc -public dotlrn_assessment::package_key {} {
+ What package do I deal with?
+} {
+ return "assessment"
+}
+
+ad_proc -public dotlrn_assessment::my_package_key {} {
+ What package do I deal with?
+} {
+ return "dotlrn-assessment"
+}
+
+ad_proc -public dotlrn_assessment::get_pretty_name {} {
+ returns the pretty name
+} {
+ return "Assessment Applet"
+}
+
+ad_proc -public dotlrn_assessment::add_applet {} {
+ One time init - must be repeatable!
+} {
+ dotlrn_applet::add_applet_to_dotlrn -applet_key [applet_key] -package_key [my_package_key]
+}
+
+ad_proc -public dotlrn_assessment::remove_applet {} {
+ One time destroy.
+} {
+ set applet_id [dotlrn_applet::get_applet_id_from_key [my_package_key]]
+ db_exec_plsql delete_applet_from_communities { *SQL* }
+ db_exec_plsql delete_applet { *SQL* }
+}
+
+ad_proc -public dotlrn_assessment::add_applet_to_community {
+ community_id
+} {
+ Add the assessment applet to a specifc dotlrn community
+} {
+ set portal_id [dotlrn_community::get_portal_id -community_id $community_id]
+
+ # create the assessment package instance
+ set package_id [dotlrn::instantiate_and_mount $community_id [package_key]]
+
+ # set up the admin portal
+ set admin_portal_id [dotlrn_community::get_admin_portal_id \
+ -community_id $community_id
+ ]
+
+ assessment_admin_portlet::add_self_to_page \
+ -portal_id $admin_portal_id \
+ -package_id $package_id
+
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ add_portlet_helper $portal_id $args
+
+ return $package_id
+}
+
+ad_proc -public dotlrn_assessment::remove_applet_from_community {
+ community_id
+} {
+ remove the applet from the community
+} {
+ ad_return_complaint 1 "[applet_key] remove_applet_from_community not implimented!"
+}
+
+ad_proc -public dotlrn_assessment::add_user {
+ user_id
+} {
+ one time user-specifuc init
+} {
+ # noop
+}
+
+ad_proc -public dotlrn_assessment::remove_user {
+ user_id
+} {
+} {
+ ad_return_complaint 1 "[applet_key] remove_user not implimented!"
+}
+
+ad_proc -public dotlrn_assessment::add_user_to_community {
+ community_id
+ user_id
+} {
+ Add a user to a specifc dotlrn community
+} {
+ set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+ # use "append" here since we want to aggregate
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+ ns_set put $args param_action append
+ add_portlet_helper $portal_id $args
+}
+
+ad_proc -public dotlrn_assessment::remove_user_from_community {
+ community_id
+ user_id
+} {
+ Remove a user from a community
+} {
+ set package_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key [applet_key]]
+ set portal_id [dotlrn::get_portal_id -user_id $user_id]
+
+ set args [ns_set create]
+ ns_set put $args package_id $package_id
+
+ remove_portlet $portal_id $args
+}
+
+ad_proc -public dotlrn_assessment::add_portlet {
+ portal_id
+} {
+ A helper proc to add the underlying portlet to the given portal.
+
+ @param portal_id
+} {
+ # simple, no type specific stuff, just set some dummy values
+
+ set args [ns_set create]
+ ns_set put $args package_id 0
+ ns_set put $args param_action overwrite
+ add_portlet_helper $portal_id $args
+}
+
+ad_proc -public dotlrn_assessment::add_portlet_helper {
+ portal_id
+ args
+} {
+ A helper proc to add the underlying portlet to the given portal.
+
+ @param portal_id
+ @param args an ns_set
+} {
+ assessment_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]
+}
+
+ad_proc -public dotlrn_assessment::remove_portlet {
+ portal_id
+ args
+} {
+ A helper proc to remove the underlying portlet from the given portal.
+
+ @param portal_id
+ @param args A list of key-value pairs (possibly user_id, community_id, and more)
+} {
+ assessment_portlet::remove_self_from_page \
+ -portal_id $portal_id \
+ -package_id [ns_set get $args package_id]
+}
+
+ad_proc -public dotlrn_assessment::clone {
+ old_community_id
+ new_community_id
+} {
+ Clone this applet's content from the old community to the new one
+} {
+ ns_log notice "Cloning: [applet_key]"
+ set new_package_id [add_applet_to_community $new_community_id]
+ set old_package_id [dotlrn_community::get_applet_package_id \
+ -community_id $old_community_id \
+ -applet_key [applet_key]
+ ]
+
+ db_exec_plsql call_assessment_clone {}
+ return $new_package_id
+}
+
+ad_proc -public dotlrn_assessment::change_event_handler {
+ community_id
+ event
+ old_value
+ new_value
+} {
+ listens for the following events:
+} {
+}