Index: openacs-4/packages/new-portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.tcl,v diff -u -r1.145 -r1.146 --- openacs-4/packages/new-portal/tcl/portal-procs.tcl 31 May 2002 06:36:47 -0000 1.145 +++ openacs-4/packages/new-portal/tcl/portal-procs.tcl 31 May 2002 08:30:31 -0000 1.146 @@ -226,15 +226,16 @@ portal_id } { Get the name of this portal - - @param portal_id - @return the name of the portal or null string } { - ad_require_permission $portal_id portal_read_portal + return [util_memoize "portal::get_name_not_cached -portal_id $portal_id"] + } - if {[portal::exists_p $portal_id]} { - return [db_string get_name_select {}] - } + ad_proc -private get_name_not_cached { + {-portal_id:required} + } { + Memoizing helper + } { + return [db_string get_name_select {} -default ""] } ad_proc -public render { @@ -388,7 +389,7 @@ # get the themes, template::multirow is not working here set theme_count 0 - set theme_data "
" + set theme_data "
" db_1row current_theme_select {} @@ -444,18 +445,10 @@ # get the portal. db_1row portal_select {} -column_array portal - - # get the numer of elements in this region - set element_count [db_string portal_element_count_select " - select count(*) - from portal_element_map - where page_id = :page_id"] - - + set layout_id $portal(layout_id) + # fake some elements for the in the template - set layout_id [get_layout_id -page_id $page_id $portal_id] - - db_foreach get_regions {} { + foreach region [get_layout_region_list -layout_id $portal(layout_id)] { lappend fake_element_ids($region) $portal_id } @@ -473,6 +466,14 @@ " + set element_count [db_string portal_element_count_select { + select 1 + from dual + where exists (select 1 + from portal_element_map + where page_id = :page_id) + } -default 0] + if {$element_count == 0} { append template " $page_name_chunk @@ -985,7 +986,7 @@ set layout_id [get_layout_id -page_id $page_id $portal_id] # get the regions in this layout - db_foreach get_regions {} { + foreach region [get_layout_region_list -layout_id $layout_id] { lappend region_list $region } @@ -1203,6 +1204,38 @@ db_dml update {} } + ad_proc -private hideable_p { + {-element_id:required} + } { + Check if an element is hideable + } { + return [util_memoize "portal::hideable_p_not_cached -element_id $element_id"] + } + + ad_proc -private hideable_p_not_cached { + {-element_id:required} + } { + Check if an element is hideable + } { + return [db_string select_hideable_p {}] + } + + ad_proc -private hidden_elements_list { + {-portal_id:required} + } { + Returns a list of "hidden" element avaliable to a portal + } { + return [util_memoize "portal::hidden_elements_list_not_cached -portal_id $portal_id"] + } + + ad_proc -private hidden_elements_list_not_cached { + {-portal_id:required} + } { + Memoizing helper + } { + return [db_list_of_lists select_hidden_elements {}] + } + ad_proc -private set_element_param { element_id key @@ -1659,9 +1692,31 @@ ad_proc -private get_layout_region_count { {-layout_id:required} } { + return [util_memoize "portal::get_layout_region_count_not_cached -layout_id $layout_id"] + } + + ad_proc -private get_layout_region_count_not_cached { + {-layout_id:required} + } { return [db_string select_region_count {}] } + ad_proc -private get_layout_region_list { + {-layout_id:required} + } { + Get a list of the regions that a layout supports + } { + return [util_memoize "portal::get_layout_region_list_not_cached -layout_id $layout_id"] + } + + ad_proc -private get_layout_region_list_not_cached { + {-layout_id:required} + } { + Memoizing helper + } { + return [db_list select_region_list {}] + } + ad_proc -private get_layout_id { {-page_num ""} {-page_id ""} Index: openacs-4/packages/new-portal/tcl/portal-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/tcl/portal-procs.xql,v diff -u -r1.30 -r1.31 --- openacs-4/packages/new-portal/tcl/portal-procs.xql 31 May 2002 06:36:47 -0000 1.30 +++ openacs-4/packages/new-portal/tcl/portal-procs.xql 31 May 2002 08:30:31 -0000 1.31 @@ -25,7 +25,7 @@ - + select name from portals where portal_id = :portal_id @@ -82,7 +82,10 @@ - select p.name, p.portal_id, pl.filename as template, pp.pretty_name as page_name + select p.name, p.portal_id, + pl.filename as template, + pp.pretty_name as page_name, + pp.layout_id as layout_id from portals p, portal_layouts pl, portal_pages pp where pp.portal_id = :portal_id and pp.page_id = :page_id @@ -91,14 +94,6 @@ - - - select region - from portal_supported_regions - where layout_id = :layout_id - - - update portal_element_map @@ -323,20 +318,12 @@ - -select pretty_name, sort_key as page_num from portal_pages where -portal_id = :portal_id -order by sort_key - - - - - select region - from portal_supported_regions - where layout_id = :layout_id + select pretty_name, sort_key as page_num from portal_pages where + portal_id = :portal_id + order by sort_key - + @@ -469,6 +456,23 @@ + + + select value from portal_element_parameters where element_id = :element_id and key = 'hideable_p' + + + + + + select element_id, pem.pretty_name + from portal_element_map pem, portal_pages pp + where pp.portal_id = :portal_id + and pp.page_id = pem.page_id + and pem.state = 'hidden' + order by name + + + update portal_element_parameters set value = :value @@ -668,14 +672,22 @@ - - + + df select count(*) as region_count from portal_supported_regions where layout_id = :layout_id + + + select region + from portal_supported_regions + where layout_id = :layout_id + + + select layout_id from portal_pages where portal_id = :portal_id and sort_key = :page_num Index: openacs-4/packages/new-portal/www/place-element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/www/place-element.tcl,v diff -u -r1.33 -r1.34 --- openacs-4/packages/new-portal/www/place-element.tcl 31 May 2002 06:36:47 -0000 1.33 +++ openacs-4/packages/new-portal/www/place-element.tcl 31 May 2002 08:30:31 -0000 1.34 @@ -47,7 +47,7 @@ $name \ $sort_key \ $state \ - [portal::get_element_param $element_id "hideable_p"] \ + [portal::hideable_p -element_id $element_id] \ $page_id incr region_count @@ -60,9 +60,9 @@ append show_html "