Index: openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl 26 Apr 2005 21:47:05 -0000 1.9 +++ openacs-4/packages/evaluation-portlet/tcl/evaluation-portlet-procs.tcl 8 Aug 2006 21:26:44 -0000 1.10 @@ -33,7 +33,7 @@ ad_proc -public evaluation_assignments_portlet::get_pretty_name { } { - return "#evaluation-portlet.Assignments_#" + return "#evaluation-portlet.Assignments#" } @@ -99,35 +99,7 @@ -template_src "evaluation-assignments-portlet" } -ad_proc -private evaluation_assignments_portlet::register_portal_datasource_impl {} { - Create the service contracts needed by the evaluation assignments portlet. -} { - set spec { - name "evaluation_assignments_portlet" - contract_name "portal_datasource" - owner "evaluation-portlet" - aliases { - GetMyName evaluation_assignments_portlet::get_my_name - GetPrettyName evaluation_assignments_portlet::get_pretty_name - Link evaluation_assignments_portlet::link - AddSelfToPage evaluation_assignments_portlet::add_self_to_page - Show evaluation_assignments_portlet::show - Edit evaluation_assignments_portlet::edit - RemoveSelfFromPage evaluation_assignments_portlet::remove_self_from_page - } - } - - acs_sc::impl::new_from_spec -spec $spec -} -ad_proc -private evaluation_assignments_portlet::unregister_implementations {} { - Unregister service contract implementations -} { - acs_sc::impl::delete \ - -contract_name "portal_datasource" \ - -impl_name "evaluation_assignments_portlet" -} - # # evaluation evaluations namespace # @@ -174,6 +146,7 @@ @return element_id The new element's id } { + return [portal::add_element_parameters \ -portal_id $portal_id \ -portlet_name [get_my_name] \ @@ -203,6 +176,8 @@ -value $package_id } + + ad_proc -public evaluation_evaluations_portlet::show { cf } { @@ -212,39 +187,6 @@ -template_src "evaluation-evaluations-portlet" } -ad_proc -private evaluation_evaluations_portlet::register_portal_datasource_impl {} { - Create the service contracts needed by the evaluation evaluations portlet. -} { - set spec { - name "evaluation_evaluations_portlet" - contract_name "portal_datasource" - owner "evaluation-portlet" - aliases { - GetMyName evaluation_evaluations_portlet::get_my_name - GetPrettyName evaluation_evaluations_portlet::get_pretty_name - Link evaluation_evaluations_portlet::link - AddSelfToPage evaluation_evaluations_portlet::add_self_to_page - Show evaluation_evaluations_portlet::show - Edit evaluation_evaluations_portlet::edit - RemoveSelfFromPage evaluation_evaluations_portlet::remove_self_from_page - } - } - - acs_sc::impl::new_from_spec -spec $spec -} - -ad_proc -private evaluation_evaluations_portlet::unregister_implementations {} { - Unregister service contract implementations -} { - acs_sc::impl::delete \ - -contract_name "portal_datasource" \ - -impl_name "evaluation_evaluations_portlet" -} - -# -# evaluation admin namespace -# - ad_proc -private evaluation_admin_portlet::get_my_name {} { return "evaluation_admin_portlet" } @@ -313,6 +255,12 @@ } + + +# +# evaluation assignments namespace +# + ad_proc -private evaluation_admin_portlet::get_my_name {} { return "evaluation_admin_portlet" } @@ -381,6 +329,218 @@ } +ad_proc -private evaluation_assignments_portlet::after_install {} { + Create the datasources needed by the evaluation assignments portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_assignments_portlet" \ + -description "#evaluation-portlet.lt_Evaluation_Assignment#"] + + 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 evaluation_assignments_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the evaluation assignments portlet. +} { + set spec { + name "evaluation_assignments_portlet" + contract_name "portal_datasource" + owner "evaluation-portlet" + aliases { + GetMyName evaluation_assignments_portlet::get_my_name + GetPrettyName evaluation_assignments_portlet::get_pretty_name + Link evaluation_assignments_portlet::link + AddSelfToPage evaluation_assignments_portlet::add_self_to_page + Show evaluation_assignments_portlet::show + Edit evaluation_assignments_portlet::edit + RemoveSelfFromPage evaluation_assignments_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + +ad_proc -private evaluation_evaluations_portlet::after_install {} { + Create the datasources needed by the evaluation evaluations portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_evaluations_portlet" \ + -description "#evaluation-portlet.lt_Evaluation_Evaluation#"] + + 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 evaluation_evaluations_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the evaluation evaluations portlet. +} { + set spec { + name "evaluation_evaluations_portlet" + contract_name "portal_datasource" + owner "evaluation-portlet" + aliases { + GetMyName evaluation_evaluations_portlet::get_my_name + GetPrettyName evaluation_evaluations_portlet::get_pretty_name + Link evaluation_evaluations_portlet::link + AddSelfToPage evaluation_evaluations_portlet::add_self_to_page + Show evaluation_evaluations_portlet::show + Edit evaluation_evaluations_portlet::edit + RemoveSelfFromPage evaluation_evaluations_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + + +ad_proc -private evaluation_admin_portlet::after_install {} { + Create the datasources needed by the evaluation portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "evaluation_admin_portlet" \ + -description "#evaluation-portlet.lt_Evaluation_Admin_Port#"] + + 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 evaluation_admin_portlet::register_portal_datasource_impl {} { Create the service contracts needed by the evaluation admin portlet. } { @@ -402,16 +562,6 @@ acs_sc::impl::new_from_spec -spec $spec } -ad_proc -private evaluation_admin_portlet::unregister_implementations {} { - Unregister service contract implementations -} { - acs_sc::impl::delete \ - -contract_name "portal_datasource" \ - -impl_name "evaluation_admin_portlet" -} - -# unistall procs - ad_proc -private evaluation_assignments_portlet::uninstall {} { Evaluation Portlet package uninstall proc } { @@ -435,3 +585,39 @@ set ds_id [portal::get_datasource_id evaluation_admin_portlet] db_exec_plsql delete_admin_ds { *SQL* } } + +ad_proc -private evaluation_assignments_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_assignments_portlet" +} + +ad_proc -private evaluation_evaluations_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_evaluations_portlet" +} + +ad_proc -private evaluation_admin_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "evaluation_admin_portlet" +} +ad_proc -private evaluation_evaluations_portlet::get_package_id_from_key { + {-package_key:required} +} { + Gets the package_id of the evaluation instance related to the evaluation portlet for this community +} { + set community_id [dotlrn_community::get_community_id] + set package_id [db_string get_package_id {} -default 0] + return $package_id +} + + +