Index: openacs-4/packages/xowiki-portlet/tcl/xowiki-admin-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki-portlet/tcl/xowiki-admin-portlet-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/xowiki-portlet/tcl/xowiki-admin-portlet-procs.tcl 30 Apr 2018 09:14:23 -0000 1.4 +++ openacs-4/packages/xowiki-portlet/tcl/xowiki-admin-portlet-procs.tcl 3 Sep 2024 15:38:00 -0000 1.5 @@ -1,21 +1,21 @@ ad_library { Procedures to supports xowiki admin portlets. - + @creation-date 2008-02-26 @author Gustaf Neumann @cvs-id $Id$ } # -# This is the first approach to make the portlet-procs +# This is the first approach to make the portlet-procs # -# (a) in an oo-style (the object below contains everything +# (a) in an oo-style (the object below contains everything # for the management of the portlet) and -# (b) independent from the database layer +# (b) independent from the database layer # (supposed to work under postgres and Oracle) # # In the next steps, it would make sense to define a ::dotlrn::Portlet -# class, which provides some of the common behaviour defined here... +# class, which provides some of the common behavior defined here... # Object xowiki_admin_portlet xowiki_admin_portlet proc name {} { @@ -24,7 +24,7 @@ xowiki_admin_portlet proc pretty_name {} { return [parameter::get_from_package_key \ - -package_key [my package_key] \ + -package_key [:package_key] \ -parameter xowiki_admin_portlet_pretty_name] } @@ -40,11 +40,11 @@ {-portal_id:required} {-package_id:required} } { - Adds a xowiki admin PE to the given portal + Adds an xowiki admin PE to the given portal } { return [portal::add_element_parameters \ -portal_id $portal_id \ - -portlet_name [my name] \ + -portlet_name [:name] \ -key package_id \ -value $package_id \ ] @@ -59,7 +59,7 @@ # This is easy since there's one and only one instace_id portal::remove_element \ -portal_id $portal_id \ - -portlet_name [my name] + -portlet_name [:name] } xowiki_admin_portlet ad_proc show { @@ -68,133 +68,119 @@ Display the xowiki admin PE } { portal::show_proc_helper \ - -package_key [my package_key] \ + -package_key [:package_key] \ -config_list $cf \ -template_src "xowiki-admin-portlet" } xowiki_admin_portlet proc install {} { - my log "--portlet calling [self proc]" - set name [my name] - db_transaction { + :log "--portlet calling [self proc]" + set name [:name] + ::xo::dc transaction { # # create the datasource # - set ds_id [::xo::db::sql::portal_datasource new -name $name \ - -css_dir "" \ + set ds_id [portal::datasource::new \ + -name $name \ -description "Displays the admin interface for the xowiki data portlets"] - + # default configuration - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p t \ -key "shadeable_p" -value f - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p t \ -key "shaded_p" -value f - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p t \ -key "hideable_p" -value t - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p t \ -key "user_editable_p" -value f - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p t \ -key "link_hideable_p" -value t - + # xowiki-admin-specific procs - + # package_id must be configured - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ + portal::datasource::set_def_param -datasource_id $ds_id \ -config_required_p t -configured_p f \ -key "package_id" -value "" - - + + # # service contract managemet # # create the implementation - ::xo::db::sql::acs_sc_impl new \ - -impl_contract_name "portal_datasource" -impl_name $name \ - -impl_pretty_name "" -impl_owner_name $name - + acs_sc::impl::new \ + -contract_name "portal_datasource" -name $name \ + -pretty_name "" -owner $name + # add the operations foreach {operation call} { - GetMyName "xowiki_admin_portlet name" - GetPrettyName "xowiki_admin_portlet pretty_name" - Link "xowiki_admin_portlet link" - AddSelfToPage "xowiki_admin_portlet add_self_to_page" - Show "xowiki_admin_portlet show" - Edit "xowiki_admin_portlet edit" - RemoveSelfFromPage "xowiki_admin_portlet remove_self_from_page" + GetMyName "xowiki_admin_portlet name" + GetPrettyName "xowiki_admin_portlet pretty_name" + Link "xowiki_admin_portlet link" + AddSelfToPage "xowiki_admin_portlet add_self_to_page" + Show "xowiki_admin_portlet show" + Edit "xowiki_admin_portlet edit" + RemoveSelfFromPage "xowiki_admin_portlet remove_self_from_page" } { - ::xo::db::sql::acs_sc_impl_alias new \ - -impl_contract_name "portal_datasource" -impl_name $name \ - -impl_operation_name $operation -impl_alias $call \ - -impl_pl "TCL" + acs_sc::impl::alias::new \ + -contract_name "portal_datasource" -impl_name $name \ + -operation $operation -alias $call \ + -language TCL } - + # Add the binding - ::xo::db::sql::acs_sc_binding new \ + acs_sc::impl::binding::new \ -contract_name "portal_datasource" -impl_name $name } - my log "--portlet end of [self proc]" + :log "--portlet end of [self proc]" } xowiki_admin_portlet proc uninstall {} { - my log "--portlet calling [self proc]" + :log "--portlet calling [self proc]" # # completely identical to "xowiki_portlet uninstall" # - set name [my name] - db_transaction { + set name [:name] + ::xo::dc transaction { - # + # # get the datasource # - set ds_id [db_string dbqd..get_ds_id { + set ds_id [::xo::dc get_value get_ds_id { select datasource_id from portal_datasources where name = :name - } -default "0"] - + } 0] + if {$ds_id != 0} { # # drop the datasource # - ::xo::db::sql::portal_datasource delete -datasource_id $ds_id + portal::datasource::delete -name $name # } else { ns_log notice "No datasource id found for $name" } - # drop the operations # - foreach operation { - GetMyName GetPrettyName Link AddSelfToPage - Show Edit RemoveSelfFromPage - } { - ::xo::db::sql::acs_sc_impl_alias delete \ - -impl_contract_name "portal_datasource" -impl_name $name \ - -impl_operation_name $operation - } - # - # drop the binding - # - ::xo::db::sql::acs_sc_binding delete \ - -contract_name "portal_datasource" -impl_name $name - # # drop the implementation # - ::xo::db::sql::acs_sc_impl delete \ - -impl_contract_name "portal_datasource" -impl_name $name - } - my log "--portlet end of [self proc]" + acs_sc::impl::delete \ + -contract_name "portal_datasource" -impl_name $name + } + :log "--portlet end of [self proc]" } - - - +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: