Index: openacs-4/packages/xowiki-portlet/tcl/xowiki-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki-portlet/tcl/xowiki-portlet-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki-portlet/tcl/xowiki-portlet-procs.tcl 24 Apr 2008 08:38:30 -0000 1.3 +++ openacs-4/packages/xowiki-portlet/tcl/xowiki-portlet-procs.tcl 3 Sep 2024 15:38:00 -0000 1.4 @@ -1,21 +1,21 @@ ad_library { Procedures to supports xowiki 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_portlet @@ -56,9 +56,10 @@ } xowiki_portlet ad_proc show {cf} { + Show the portlet } { portal::show_proc_helper \ - -package_key [my package_key] \ + -package_key [:package_key] \ -config_list $cf \ -template_src "xowiki-portlet" } @@ -67,130 +68,114 @@ # install # xowiki_portlet proc install {} { - my log "--portlet calling [self proc]" - set name [my name] + :log "--portlet calling [self proc]" + set name [:name] # # create the datasource # - db_transaction { - set ds_id [::xo::db::sql::portal_datasource new -name $name \ - -css_dir "" \ + ::xo::dc transaction { + set ds_id [portal::datasource::new \ + -name $name \ -description "Displays an xowiki page as a portlet"] - + # 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 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 "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-specific 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 f \ -key "package_id" -value "" - - ::xo::db::sql::portal_datasource set_def_param -datasource_id $ds_id \ - -config_required_p t -configured_p f \ - -key "page_name" -value "" - + + portal::datasource::set_def_param -datasource_id $ds_id \ + -config_required_p t -configured_p f \ + -key "page_name" -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_portlet name" - GetPrettyName "xowiki_portlet pretty_name" - Link "xowiki_portlet link" - AddSelfToPage "xowiki_portlet add_self_to_page" - Show "xowiki_portlet show" - Edit "xowiki_portlet edit" - RemoveSelfFromPage "xowiki_portlet remove_self_from_page" + GetMyName "xowiki_portlet name" + GetPrettyName "xowiki_portlet pretty_name" + Link "xowiki_portlet link" + AddSelfToPage "xowiki_portlet add_self_to_page" + Show "xowiki_portlet show" + Edit "xowiki_portlet edit" + RemoveSelfFromPage "xowiki_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]" } # # uninstall # xowiki_portlet proc uninstall {} { - my log "--portlet calling [self proc]" + :log "--portlet calling [self proc]" # # completely identical to "xowiki_admin_portlet uninstall" # - set name [my name] + set name [:name] - db_transaction { - # + ::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 + acs_sc::impl::delete \ + -contract_name "portal_datasource" -impl_name $name } - my log "--portlet end of [self proc]" + :log "--portlet end of [self proc]" } ::xowiki_portlet proc after-install {} { @@ -201,4 +186,10 @@ ::xowiki_portlet proc before-uninstall {} { ::xowiki_portlet uninstall ::xowiki_admin_portlet uninstall -} \ No newline at end of file +} + +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: