Index: openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/Attic/dotlrn-communities-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-package-create.sql 29 Mar 2002 20:03:01 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/dotlrn-communities-package-create.sql 3 Apr 2002 00:33:12 -0000 1.2 @@ -164,6 +164,10 @@ party_id in parties.party_id%TYPE ) return char; + function has_subcomm_p ( + community_id in dotlrn_communities.community_id%TYPE + ) return char; + function url ( community_id in dotlrn_communities.community_id%TYPE ) return varchar2; @@ -314,6 +318,24 @@ when no_data_found then return ''; end; + + function has_subcomm_p ( + community_id in dotlrn_communities.community_id%TYPE + ) return char + is + v_rv char(1); + begin + + select decode(count(*), 0, 'f', 't') into v_rv + from dual where exists ( + select 'x' + from dotlrn_communities + where parent_community_id = community_id + ); + + return v_rv; + end; + end; / show errors Index: openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql,v diff -u -r1.13 -r1.14 --- openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 29 Mar 2002 19:38:25 -0000 1.13 +++ openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 3 Apr 2002 00:33:12 -0000 1.14 @@ -73,7 +73,7 @@ - + select site_node.url(node_id) from site_nodes Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.95 -r1.96 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 2 Apr 2002 20:19:55 -0000 1.95 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 3 Apr 2002 00:33:12 -0000 1.96 @@ -325,6 +325,14 @@ } { This gets the relative URL for a package_id. } { + return [util_memoize "dotlrn_community::get_url_from_package_id_memoized -package_id $package_id"] + } + + ad_proc -public get_url_from_package_id_memoized { + {-package_id ""} + } { + Memoizing helper + } { return [db_string select_node_url {} -default ""] } Index: openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl,v diff -u -r1.40 -r1.41 --- openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 29 Mar 2002 19:14:45 -0000 1.40 +++ openacs-4/packages/dotlrn/tcl/dotlrn-procs.tcl 3 Apr 2002 00:33:12 -0000 1.41 @@ -273,6 +273,7 @@ } ad_proc -public render_page { + {-workspace_p ""} {-hide_links_p "f"} {-user_id ""} {-render_style "individual"} @@ -285,7 +286,7 @@ set user_id [ad_conn user_id] } - set theme_id [get_user_theme $user_id] + set theme_id [get_user_theme $user_id] return [portal::render -page_num $page_num -hide_links_p $hide_links_p -render_style $render_style $portal_id $theme_id ] } Index: openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/site-nodes-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl 29 Mar 2002 19:14:45 -0000 1.10 +++ openacs-4/packages/dotlrn/tcl/site-nodes-procs.tcl 3 Apr 2002 00:33:12 -0000 1.11 @@ -100,10 +100,18 @@ } { get the name of the parent of this instance } { - return [db_string select_parent_name_by_id {}] + return [util_memoize "site_nodes::get_parent_name_memoized -instance_id $instance_id"] } + ad_proc -public get_parent_name_memoized { + {-instance_id ""} + } { + memoizing helper + } { + return [db_string select_parent_name_by_id {} -default ""] + } + # site_nodes_list procs ad_proc -public get_site_nodes_list { Index: openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/site-nodes-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql 29 Mar 2002 19:38:25 -0000 1.5 +++ openacs-4/packages/dotlrn/tcl/site-nodes-procs.xql 3 Apr 2002 00:33:12 -0000 1.6 @@ -1,7 +1,7 @@ - + select instance_name from apm_packages Index: openacs-4/packages/dotlrn/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/index.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/dotlrn/www/index.tcl 2 Apr 2002 20:19:55 -0000 1.27 +++ openacs-4/packages/dotlrn/www/index.tcl 3 Apr 2002 00:33:12 -0000 1.28 @@ -41,9 +41,12 @@ # Make sure user is logged in set user_id [ad_maybe_redirect_for_registration] -# set admin_p [dotlrn::admin_p] - # Permission dotLRN +if {![dotlrn::user_p -user_id $user_id]} { + ad_returnredirect "index-not-a-user" + ad_script_abort +} + if {![dotlrn::user_can_browse_p]} { # Figure out if the user is a member of a community set communities [dotlrn_community::get_all_communities_by_user $user_id] @@ -56,7 +59,10 @@ # If just one community if {[llength $communities] == 1} { - ad_returnredirect [dotlrn_community::get_url_from_package_id -package_id [lindex [lindex $communities 0] 4]] + ad_returnredirect \ + [dotlrn_community::get_url_from_package_id \ + -package_id [lindex [lindex $communities 0] 4] + ] ad_script_abort } @@ -65,14 +71,15 @@ return } -# Get the page set portal_id [dotlrn::get_workspace_portal_id $user_id] -if {[empty_string_p $portal_id]} { - ad_returnredirect "index-not-a-user" - ad_script_abort -} +# O glorious portal page! +set rendered_page \ + [dotlrn::render_page \ + -user_id $user_id \ + -page_num $page_num \ + -hide_links_p "t" \ + $portal_id + ] -set rendered_page [dotlrn::render_page -user_id $user_id -page_num $page_num -hide_links_p "t" $portal_id ] - ad_return_template