Index: openacs-4/packages/xowiki/www/admin/portal-element-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/portal-element-add.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 22 Jan 2018 00:53:45 -0000 1.17 +++ openacs-4/packages/xowiki/www/admin/portal-element-add.tcl 3 Sep 2024 15:37:55 -0000 1.18 @@ -9,18 +9,18 @@ } -parameter { {-portal_id:required} {-page_name:required} - {-referer .} + {-referrer .} } -set page [$package_id get_page_from_item_ref $page_name] +set page [::$package_id get_page_from_item_ref $page_name] if {$page eq ""} { # # If a page with the given name does not exist, return an error. # ad_return_error \ [_ xowiki.portlet_page_does_not_exist_error_short] \ - [_ xowiki.portlet_page_does_not_exist_error_long $page_name] + [_ xowiki.portlet_page_does_not_exist_error_long [list page_name $page_name]] ad_script_abort } else { @@ -31,38 +31,38 @@ # for the time being, we add the portlet on the first page (page 0) set portal_page_id [portal::get_page_id -portal_id $portal_id -sort_key 0] - - if {[xo::dc get_value check_unique_name_on_page { + + if {[::xo::dc get_value -prepare integer,text check_unique_name_on_page { select 1 from portal_element_map - where page_id = :portal_page_id + where page_id = :portal_page_id and pretty_name = :page_title } 0]} { # # The name of the portal element is not unique. # ad_return_error \ - [_ xowiki.portlet_title_exists_error_short] \ - [_ xowiki.portlet_title_exists_error_long $page_title] + [_ xowiki.portlet_title_exists_error_short] \ + [_ xowiki.portlet_title_exists_error_long $page_title] ad_script_abort } else { # # everything ok, add the portal element # - db_transaction { + ::xo::dc transaction { set element_id [portal::add_element \ - -portal_id $portal_id \ - -portlet_name [xowiki_portlet name] \ - -pretty_name $page_title \ - -force_region [parameter::get_from_package_key \ - -parameter "xowiki_portal_content_force_region" \ - -package_key "xowiki-portlet"] - ] + -portal_id $portal_id \ + -portlet_name [xowiki_portlet name] \ + -pretty_name $page_title \ + -force_region [parameter::get_from_package_key \ + -parameter "xowiki_portal_content_force_region" \ + -package_key "xowiki-portlet"] + ] portal::set_element_param $element_id package_id $package_id # in case, someone wants language-specific includelets #regexp {^..:(.*)$} $page_name _ page_name portal::set_element_param $element_id page_name $page_name } - ad_returnredirect $referer + ad_returnredirect $referrer } } ad_script_abort