Index: openacs-4/packages/dotlrn/www/one-community-portal-configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/one-community-portal-configure.tcl,v diff -u -r1.6 -r1.6.6.1 --- openacs-4/packages/dotlrn/www/one-community-portal-configure.tcl 29 Jun 2003 23:30:49 -0000 1.6 +++ openacs-4/packages/dotlrn/www/one-community-portal-configure.tcl 29 Jun 2004 19:34:48 -0000 1.6.6.1 @@ -27,10 +27,41 @@ {referer "one-community-admin"} } +set community_id [dotlrn_community::get_community_id] + dotlrn::require_user_admin_community \ -user_id [ad_conn user_id] \ - -community_id [dotlrn_community::get_community_id] + -community_id $community_id +set portal_id [dotlrn_community::get_portal_id] + +# we are in a community +set community_name [dotlrn_community::get_community_name $community_id] + +set default_portal_p [db_string default_portal_p { + select count(*) from dotlrn_portal_types_map where portal_id = :portal_id +}] + + +if {$default_portal_p == 1} { + # Create comm's portal page + set portal_id [portal::create \ + -template_id $portal_id \ + -name "$community_name Portal" \ + -context_id $community_id \ + [ad_conn user_id] \ + ] + + db_exec_plsql update_commuity_portal_id { + update dotlrn_communities_all + set portal_id = :portal_id + where community_id = :community_id + } + + util_memoize_flush "dotlrn_community::get_portal_id_not_cached -community_id $community_id" +} + + set rendered_page [portal::configure \ -allow_theme_change_p 0 \ [dotlrn_community::get_portal_id] \