Index: openacs-4/packages/imsld-portlet/imsld-portlet.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/imsld-portlet.info,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/imsld-portlet.info 27 Sep 2005 11:22:46 -0000 1.1 @@ -0,0 +1,26 @@ + + + + + IMS LD Portlet + IMS LD Portlets + f + t + + + Eduardo PĂ©rez Ureta + 2005-09-27 + + + + + + + + + + + + + + Index: openacs-4/packages/imsld-portlet/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/tcl/apm-callback-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/tcl/apm-callback-procs.tcl 27 Sep 2005 11:22:46 -0000 1.1 @@ -0,0 +1,29 @@ +ad_library { + Procedures for initializing service contracts etc. for the + imsld portlet package. Should only be executed + once upon installation. + + @creation-date 2005-09-27 + @author eperez@it.uc3m.es + @cvs-id $Id: apm-callback-procs.tcl,v 1.1 2005/09/27 11:22:46 eduardop Exp $ +} + +namespace eval apm::imsld_portlet {} +namespace eval apm::imsld_admin_portlet {} + +ad_proc -public apm::imsld_portlet::after_install {} { + Create the datasources needed by the imsld portlets. +} { + imsld_portlet::after_install + imsld_admin_portlet::after_install +} + +ad_proc -public apm::imsld_portlet::before_uninstall {} { + IMS LD Portlet package uninstall proc +} { + + db_transaction { + imsld_portlet::uninstall + imsld_admin_portlet::uninstall + } +} Index: openacs-4/packages/imsld-portlet/tcl/imsld-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/tcl/imsld-portlet-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/tcl/imsld-portlet-procs.tcl 27 Sep 2005 11:22:46 -0000 1.1 @@ -0,0 +1,354 @@ +ad_library { + + Procedures to support the imsld portlets + + @creation-date 2005-09-27 + @author eperez@it.uc3m.es + @cvs_id $Id: imsld-portlet-procs.tcl,v 1.1 2005/09/27 11:22:46 eduardop Exp $ + +} + +namespace eval imsld_portlet {} +namespace eval imsld_admin_portlet {} + + +# +# imsld namespace +# + +ad_proc -private imsld_portlet::get_my_name { +} { + return "imsld_portlet" +} + + + +ad_proc -private imsld_portlet::my_package_key { +} { + return "imsld-portlet" +} + + + +ad_proc -public imsld_portlet::get_pretty_name { +} { + return "#imsld.imsld#" +} + + + +ad_proc -public imsld_portlet::link { +} { + return "" +} + + + +ad_proc -public imsld_portlet::add_self_to_page { + {-portal_id:required} + {-package_id:required} + {-param_action:required} + {-force_region ""} + {-page_name "" } +} { + Adds a imsld 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 imsld_portlet::remove_self_from_page { + {-portal_id:required} + {-package_id:required} +} { + Removes a imsld PE from the given page or the package_id of the + imsld 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 imsld_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "imsld-portlet" +} + +# +# imsld admin namespace +# + +ad_proc -private imsld_admin_portlet::get_my_name {} { + return "imsld_admin_portlet" +} + + +ad_proc -public imsld_admin_portlet::get_pretty_name {} { + return "#imsld.imsld_Administration#" +} + + + +ad_proc -private imsld_admin_portlet::my_package_key {} { + return "imsld-portlet" +} + + + +ad_proc -public imsld_admin_portlet::link {} { + return "" +} + + + +ad_proc -public imsld_admin_portlet::add_self_to_page { + {-portal_id:required} + {-page_name ""} + {-package_id:required} +} { + Adds a imsld admin PE to the given portal + + @param portal_id The page to add self to + @param package_id The package_id of the imsld 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 imsld_admin_portlet::remove_self_from_page { + {-portal_id:required} +} { + Removes a imsld admin PE from the given page +} { + portal::remove_element \ + -portal_id $portal_id \ + -portlet_name [get_my_name] +} + + +ad_proc -public imsld_admin_portlet::show { + cf +} { + portal::show_proc_helper \ + -package_key [my_package_key] \ + -config_list $cf \ + -template_src "imsld-admin-portlet" +} + +ad_proc -private imsld_portlet::after_install {} { + Create the datasources needed by the imsld portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "imsld_portlet" \ + -description "IMS LD 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 imsld_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the imsld portlet. +} { + set spec { + name "imsld_portlet" + contract_name "portal_datasource" + owner "imsld-portlet" + aliases { + GetMyName imsld_portlet::get_my_name + GetPrettyName imsld_portlet::get_pretty_name + Link imsld_portlet::link + AddSelfToPage imsld_portlet::add_self_to_page + Show imsld_portlet::show + Edit imsld_portlet::edit + RemoveSelfFromPage imsld_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + +ad_proc -private imsld_admin_portlet::after_install {} { + Create the datasources needed by the imsld portlet. +} { + + db_transaction { + set ds_id [portal::datasource::new \ + -name "imsld_admin_portlet" \ + -description "IMS LD 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 imsld_admin_portlet::register_portal_datasource_impl {} { + Create the service contracts needed by the imsld admin portlet. +} { + set spec { + name "imsld_admin_portlet" + contract_name "portal_datasource" + owner "imsld-portlet" + aliases { + GetMyName imsld_admin_portlet::get_my_name + GetPrettyName imsld_admin_portlet::get_pretty_name + Link imsld_admin_portlet::link + AddSelfToPage imsld_admin_portlet::add_self_to_page + Show imsld_admin_portlet::show + Edit imsld_admin_portlet::edit + RemoveSelfFromPage imsld_admin_portlet::remove_self_from_page + } + } + + acs_sc::impl::new_from_spec -spec $spec +} + +ad_proc -private imsld_portlet::uninstall {} { + IMS LD Portlet package uninstall proc +} { + unregister_implementations + set ds_id [portal::get_datasource_id imsld_portlet] + db_exec_plsql delete_imsld_ds { *SQL* } +} + +ad_proc -private imsld_admin_portlet::uninstall {} { + IMS LD Portlet package uninstall proc +} { + unregister_implementations + set ds_id [portal::get_datasource_id imsld_admin_portlet] + db_exec_plsql delete_admin_ds { *SQL* } +} + +ad_proc -private imsld_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "imsld_portlet" +} + +ad_proc -private imsld_admin_portlet::unregister_implementations {} { + Unregister service contract implementations +} { + acs_sc::impl::delete \ + -contract_name "portal_datasource" \ + -impl_name "imsld_admin_portlet" +} Index: openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.adp 27 Sep 2005 11:22:47 -0000 1.1 @@ -0,0 +1,3 @@ + Index: openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/www/imsld-admin-portlet.tcl 27 Sep 2005 11:22:47 -0000 1.1 @@ -0,0 +1,26 @@ +# /imsld-portlet/www/imsld-admin-portlet.tcl + +ad_page_contract { + The display logic for the imsld admin portlet + + @author eperez@it.uc3m.es + @creation-date 2005-09-27 + @cvs_id $Id: imsld-admin-portlet.tcl,v 1.1 2005/09/27 11:22:47 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 "[_ imsld-portlet.error_one_imsld] " +} + +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/imsld-portlet/www/imsld-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/www/imsld-portlet.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/www/imsld-portlet.adp 27 Sep 2005 11:22:47 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + +   + Index: openacs-4/packages/imsld-portlet/www/imsld-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld-portlet/www/imsld-portlet.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/imsld-portlet/www/imsld-portlet.tcl 27 Sep 2005 11:22:47 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + + The logic for the imsld portlet. + + @author eperez@it.uc3m.es + @creation-date 2005-09-27 + @cvs-id $Id: imsld-portlet.tcl,v 1.1 2005/09/27 11:22:47 eduardop Exp $ + +} -query { +} + +array set config $cf + +set shaded_p $config(shaded_p) +set list_of_package_ids [lsort $config(package_id)] +set one_instance_p [ad_decode [llength $list_of_package_ids] 1 1 0] + +ad_return_template