Index: openacs-4/contrib/packages/portal/portal.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/portal.info,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/portal/portal.info 14 Mar 2004 01:16:29 -0000 1.9 +++ openacs-4/contrib/packages/portal/portal.info 17 Mar 2004 02:15:51 -0000 1.10 @@ -23,17 +23,18 @@ - - - - - - - - - - - + + + + + + + + + + + Index: openacs-4/contrib/packages/portal/lib/configure-subsite-integration.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-subsite-integration.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-subsite-integration.adp 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,7 @@ +The portal package can replace the standard acs-subsite user interface. +

If you choose to +replace the parent acs-subsite's index page with the portal index page, the only pages to visible +to the visiting user will be those protal pages you created earlier. +

If you choose to replace the parent acs-subsite's master template, both portal pages and +the pages normally displayed by the acs-subsite "tabbed" master template will be shown. + Index: openacs-4/contrib/packages/portal/lib/configure-subsite-integration.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/configure-subsite-integration.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/configure-subsite-integration.tcl 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,41 @@ +ad_page_contract { + Configure the portal package's interaction with the subsite package in the 'ole + look and feel department. +} { +} + +ad_form -name configure-subsite-integration -form { + {ReplaceSubsiteMasterTemplate:boolean(radio) + {options {{Yes 1} {No 0}}} + {label "Replace parent subsite master template?"} + } + {PortalIndexPage:boolean(radio) + {options {{Yes 1} {No 0}}} + {label "Should the parent subsite serve the portal package as its index page?"} + } +} -on_request { + set ReplaceSubsiteMasterTemplate 0 + set PortalIndexPage 0 + ad_set_form_values ReplaceSubsiteMasterTemplate PortalIndexPage +} -validate { + {PortalIndexPage + { !($ReplaceSubsiteMasterTemplate && $PortalIndexPage) } + "You can only say \"Yes\" to one of these options." + } +} -on_submit { + if { $ReplaceSubsiteMasterTemplate } { + parameter::set_value \ + -parameter DefaultMaster \ + -package_id [ad_conn subsite_id] \ + -value /packages/portal/lib/master + } + if { $PortalIndexPage } { + parameter::set_value \ + -parameter IndexRedirectUrl \ + -package_id [ad_conn subsite_id] \ + -value [ad_conn package_url] + } + template::wizard::forward +} + +template::wizard::submit configure-subsite-integration -buttons {back next} Index: openacs-4/contrib/packages/portal/lib/plain-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/plain-master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/plain-master.adp 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,46 @@ + + + @title;noquote@ + + + @signatory;noquote@ + + + @focus;noquote@ + + + @header_stuff;noquote@ + + + + +

+
+
+ + +
+ @navbar.name@ +
+
+ + + +
+ +
+ @application@ +
+
+
+
+
+
+ + + + + Index: openacs-4/contrib/packages/portal/lib/plain-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/plain-master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/plain-master.tcl 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,44 @@ +if { ![info exists header_stuff] } { + set header_stuff {} +} + +# Where to find the stylesheet +set css_url "/resources/acs-subsite/group-master.css" + +# See if we're visiting a portal instance or an application mounted under a +# portal instance. If so, build the portal navbar. + +set package_id [site_node::closest_ancestor_package \ + -node_id [ad_conn node_id] \ + -package_key portal \ + -include_self] + +if { ![string equal $package_id ""] } { + + set user_portal_id [portal::get_user_portal_id -package_id $package_id] + set which_navbar [parameter::get -package_id $package_id -parameter NavbarClass] + set portal_url [site_node::get_url_from_object_id -object_id $package_id] + + db_multirow -unclobber -extend {url} navbar select_user_navbar {} { + set url [export_vars -base $portal_url {portal_id page_num}] + } + + if { [permission::permission_p \ + -object_id [portal::get_admin_portal_id -package_id $package_id] \ + -privilege admin] } { + db_multirow -unclobber -append -extend {url} navbar select_admin_navbar {} { + set url [export_vars -base $portal_url {portal_id page_num}] + } + } + + array set site_node [site_node::get_from_url \ + -url [ad_conn package_url] \ + -exact] + + if { $site_node(object_id) != $package_id } { + set application $site_node(instance_name) + } + +} + +ad_return_template Index: openacs-4/contrib/packages/portal/lib/plain-master.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/plain-master.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/plain-master.xql 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,23 @@ + + + + + + + select name, sort_key as page_num, portal_id + from portal_pages + where portal_id = :user_portal_id + order by sort_key + + + + + + + select name, 0 as page_num, portal_id + from portals + where owner_id = :package_id + + + + Index: openacs-4/contrib/packages/portal/lib/render-portal.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/Attic/render-portal.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-portal.adp 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/contrib/packages/portal/lib/render-portal.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/Attic/render-portal.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/render-portal.tcl 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,21 @@ + +# Check to see if we're serving the admin portal +if { $portal_id == [portal::get_admin_portal_id] } { + permission::require_permission -privilege admin -object_id $portal_id + set edit_p 0 + set render_style all-in-one +} elseif { $portal_id == [portal::get_user_portal_id] } { + set edit_p [permission::permission_p -object_id $portal_id -privilege write] + set render_style individual +} else { + permission::require_permission -privilege read -object_id $portal_id + set edit_p [permission::permission_p -object_id $portal_id -privilege write] + set render_style individual +} + +array set portal [portal::get_render_data \ + -portal_id $portal_id \ + -render_style $render_style \ + -page_num $page_num] + +ad_return_template Index: openacs-4/contrib/packages/portal/lib/tabbed-master.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/tabbed-master.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/tabbed-master.adp 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,107 @@ + + + @title;noquote@ + + + @signatory;noquote@ + + + @focus;noquote@ + + + @header_stuff;noquote@ + + + +
+ @subsite_name@ + @subsite_name@ +
+ + + + + + + + Index: openacs-4/contrib/packages/portal/lib/tabbed-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/tabbed-master.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/tabbed-master.tcl 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,60 @@ +# Expects properties: +# title +# focus +# header_stuff +# section +# subnavbar_link + +ns_log Notice "Huh? starting master ..." + +if { ![info exists section] } { + set section {} +} + +if { ![info exists header_stuff] } { + set header_stuff {} +} + +if { ![info exists subnavbar_link] } { + set subnavbar_link {} +} + +set subsite_id [ad_conn subsite_id] +db_1row select_package_id {} + +ns_log Notice "Huh? package_id: $package_id" +set user_portal_id [portal::get_user_portal_id -package_id $package_id] +if { ![info exists portal_id] } { + set portal_id $user_portal_id +} + +db_multirow -unclobber -extend {url} navbar select_user_navbar {} { + set url [export_vars -base index {page_num page_num}] +} + +if { [permission::permission_p \ + -object_id [portal::get_admin_portal_id -package_id $package_id] \ + -privilege admin] } { + db_multirow -unclobber -append -extend {url} navbar select_admin_navbar {} { + set url [export_vars -base index {portal_id page_num}] + } +} +ns_log Notice "Huh? done with portal part of master ..." + +# This will set 'sections' and 'subsections' multirows +subsite_integration::define_pageflow -section $section +subsite_integration::get_section_info -array section_info + +# Find the subsite we belong to +set subsite_url [site_node_closest_ancestor_package_url] +array set subsite_sitenode [site_node::get -url $subsite_url] +set subsite_node_id $subsite_sitenode(node_id) +set subsite_name $subsite_sitenode(instance_name) + +# Where to find the stylesheet +set css_url "/resources/acs-subsite/group-master.css" + +if { [string equal [ad_conn url] $subsite_url] } { + set subsite_url {} +} +ns_log Notice "Huh? done with master ..." Index: openacs-4/contrib/packages/portal/lib/tabbed-master.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/lib/tabbed-master.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/lib/tabbed-master.xql 17 Mar 2004 02:15:52 -0000 1.1 @@ -0,0 +1,23 @@ + + + + + + + select name, sort_key as page_num, portal_id + from portal_pages + where portal_id = :user_portal_id + order by sort_key + + + + + + + select name, 0 as page_num, portal_id + from portals + where owner_id = :package_id + + + + Index: openacs-4/contrib/packages/portal/tcl/portal-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/portal-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 14 Mar 2004 03:38:27 -0000 1.20 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.tcl 17 Mar 2004 02:15:53 -0000 1.21 @@ -73,7 +73,7 @@ } if { [string equal $theme_name ""] } { - set theme_name [parameter::get -parameter default_theme_name] + set theme_name [parameter::get -parameter DefaultThemeName] } db_transaction { @@ -141,18 +141,53 @@ return [array get portal] } - ad_proc -public get_portal_id { - {-owner_id:required} + ad_proc -public get_user_portal_id { + -package_id } { - Get the portal_id for a party. I (DRB) am not going to bother caching this - for the time being ... + Get the portal_id for a user. I (DRB) am not going to bother caching this + for the time being ... we'll nsv this later. + + @param package_id The package_id of the portal instance (defaults to ad_conn package_id) + @return The portal_id for the user or the master template portal_id if personal + portals are not enabled. } { - set package_id [ad_conn package_id] - if {[db_0or1row select_portal_id {}]} { - return $portal_id + + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + + if { [parameter::get -package_id $package_id -parameter CreatePrivatePortals] } { + set owner_id [ad_conn user_id] } else { - return "" + set owner_id 0 } + + if {![db_0or1row select_portal_id {}]} { + + if { ![portal::initialized -package_id $package_id] } { + if { [permission::permission_p -object_id $package_id -privilege admin] } { + ad_returnredirect admin + ad_script_abort + } else { + ad_return_exception_template -params {{custom_message "The portal package hasn't been configured yet."}} /packages/acs-subsite/www/shared/report-error + } + } + + # At this point we know we're supposed to create a personal portal + + db_1row select_user_name {} + + set master_template_id [portal::get_master_template_id -package_id $package_id] + + set portal_id [portal::new \ + -owner_id :owner_id \ + -name "Portal for $user_name" \ + -template_id $master_template_id \ + -context_id [ad_conn package_id] \ + -initialize_elements] + + } + return $portal_id } ad_proc -public set_values { @@ -209,12 +244,19 @@ } ad_proc -public get_master_template_id { + -package_id } { Get the master template id, i.e. the portal used to create all other portals. + @param package_id The package_id of the portal instance (defaults to ad_conn package_id) @return The portal_id of the master portal template. + } { - set package_id [ad_conn package_id] + + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + if { [db_0or1row get_master_template_id {}] } { return $master_template_id } else { @@ -223,12 +265,19 @@ } ad_proc -public get_admin_portal_id { + -package_id } { Get the admin portal id. + @param package_id The package_id of the portal instance (defaults to ad_conn package_id) @return The portal_id of the admin portal. + } { - set package_id [ad_conn package_id] + + if { ![info exists package_id] } { + set package_id [ad_conn package_id] + } + if { [db_0or1row get_admin_portal_id {}] } { return $admin_portal_id } else { @@ -674,10 +723,12 @@ } ad_proc -public initialized { + -package_id } { + @param package_id The package_id of this portal instance (default ad_conn package_id) @return True if we've already initialized this instance of the portal package. } { - return [expr {![string equal [get_master_template_id] ""]}] + return [expr {![string equal [get_master_template_id -package_id $package_id] ""]}] } ad_proc -public initialize { @@ -701,7 +752,7 @@ # create the admin template portal::new \ - -name "Administration" \ + -name "Portal Administration" \ -owner_id [ad_conn package_id] \ -theme_name blank \ -owner_privileges {} Index: openacs-4/contrib/packages/portal/tcl/portal-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/portal-procs.xql,v diff -u -r1.9 -r1.10 --- openacs-4/contrib/packages/portal/tcl/portal-procs.xql 12 Mar 2004 04:54:04 -0000 1.9 +++ openacs-4/contrib/packages/portal/tcl/portal-procs.xql 17 Mar 2004 02:15:53 -0000 1.10 @@ -28,7 +28,7 @@ - + select portal_id from portals @@ -37,6 +37,14 @@ + + + select first_names || ' ' || last_name as user_name + from persons + where person_id = :owner_id + + + update portals Index: openacs-4/contrib/packages/portal/tcl/subsite-integration-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/Attic/subsite-integration-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/tcl/subsite-integration-procs.tcl 17 Mar 2004 02:15:53 -0000 1.1 @@ -0,0 +1,281 @@ +# /packages/subsite/tcl/subsite-procs.tcl + +ad_library { + + Procs to integrate portal with tabbed subsite navigation + + @author Don Baccus (dhogaza@pacifier.com) + @creation-date 2001-02-01 + @cvs-id $Id: subsite-integration-procs.tcl,v 1.1 2004/03/17 02:15:53 donb Exp $ + +} + +namespace eval subsite_integration { +} + +ad_proc subsite_integration::define_pageflow { + {-sections_multirow "sections"} + {-subsections_multirow "subsections"} + {-section ""} +} { + Defines the page flow of the subsite +} { + set pageflow [get_pageflow_struct] +ns_log Notice "Huh? pageflow: $pageflow" + + # TODO: add an image + # TODO: add link_p/selected_p for subsections + + set base_url [subsite::get_element -element url] + + template::multirow create $sections_multirow name label title url selected_p link_p + + template::multirow create $subsections_multirow name label title url selected_p link_p + + foreach { section_name section_spec } $pageflow { + array set section_a { + label {} + url {} + title {} + subsections {} + folder {} + selected_patterns {} + } + + array set section_a $section_spec + set section_a(name) $section_name + + set selected_p [add_section_row \ + -array section_a \ + -base_url $base_url \ + -multirow $sections_multirow] + + if { $selected_p } { + foreach { subsection_name subsection_spec } $section_a(subsections) { + array set subsection_a { + label {} + title {} + folder {} + url {} + selected_patterns {} + } + array set subsection_a $subsection_spec + set subsection_a(name) $subsection_name + set subsection_a(folder) [file join $section_a(folder) $subsection_a(folder)] + + add_section_row \ + -array subsection_a \ + -base_url $base_url \ + -multirow $subsections_multirow + } + } + } +} + + +ad_proc subsite_integration::add_section_row { + {-array:required} + {-base_url:required} + {-multirow:required} + {-section {}} +} { + upvar $array info + + # the folder index page is called . + if { [string equal $info(url) ""] || [string equal $info(url) "index"] || \ + [string match "*/" $info(url)] || [string match "*/index" $info(url)] } { + set info(url) "[string range $info(url) 0 [string last / $info(url)]]." + } + + if { [ad_conn node_id] == [site_node_closest_ancestor_package "acs-subsite"] } { + set current_url [ad_conn extra_url] + } else { + # Need to prepend the path from the subsite to this package + set current_url [string range [ad_conn url] [string length $base_url] end] + } + if { [empty_string_p $current_url] || [string equal $current_url "index"] || \ + [string match "*/" $current_url] || [string match "*/index" $current_url] } { + set current_url "[string range $current_url 0 [string last / $current_url]]." + } + + set info(url) [file join $info(folder) $info(url)] + + # Default to not selected + set selected_p 0 + + if { [string equal $current_url $info(url)] || [string equal $info(name) $section] } { + set selected_p 1 + } else { + foreach pattern $info(selected_patterns) { + set full_pattern [file join $info(folder) $pattern] + if { [string match $full_pattern $current_url] } { + set selected_p 1 + break + } + } + } + + set link_p [expr ![string equal $current_url $info(url)]] + + template::multirow append $multirow \ + $info(name) \ + $info(label) \ + $info(title) \ + [file join $base_url $info(url)] \ + $selected_p \ + $link_p + + return $selected_p +} + +ad_proc -public subsite_integration::get_section_info { + {-array "section_info"} + {-sections_multirow "sections"} +} { + upvar $array row + # Find the label of the selected section + + array set row { + label {} + url {} + } + + template::multirow foreach $sections_multirow { + if { [template::util::is_true $selected_p] } { + set row(label) $label + set row(url) $url + break + } + } +} + +ad_proc subsite_integration::get_pageflow_struct {} { + # This is where the page flow structure is defined + set subsections [list] + lappend subsections home { + label "Home" + url "" + } + + + set pageflow [list] + + set subsite_url [subsite::get_element -element url] + set subsite_id [ad_conn subsite_id] + array set subsite_sitenode [site_node::get -url $subsite_url] + set subsite_node_id $subsite_sitenode(node_id) + + set index_redirect_url [parameter::get -parameter "IndexRedirectUrl" -package_id $subsite_id] + + set child_urls [lsort -ascii [site_node::get_children -node_id $subsite_node_id -package_type apm_application]] + + if { [empty_string_p $index_redirect_url] } { + lappend pageflow home { + label "Home" + folder "" + url "" + selected_patterns { + "" + "subsites" + } + } + } else { + # See if the redirect-url to a package inside this subsite + for { set i 0 } { $i < [llength $child_urls] } { incr i } { + array set child_node [site_node::get_from_url -exact -url [lindex $child_urls $i]] +ns_log Notice "Huh? index_redirect_url: $index_redirect_url child_node: $child_node(url)" + if { [string equal $index_redirect_url "$child_node(url)"] } { + lappend pageflow $child_node(name) [list \ + label "Home" \ + folder $child_node(name) \ + url {} \ + selected_patterns *] + set child_urls [lreplace $child_urls $i $i] + break + } + } + } + + + set user_id [ad_conn user_id] + set admin_p [permission::permission_p -object_id \ + [site_node_closest_ancestor_package "acs-subsite"] -privilege admin -party_id [ad_conn untrusted_user_id]] + set show_member_list_to [parameter::get -parameter "ShowMembersListTo" -package_id $subsite_id -default 2] + + if { $admin_p || ($user_id != 0 && $show_member_list_to == 1) || \ + $show_member_list_to == 0 } { + lappend pageflow members { + label "Members" + folder "members" + selected_patterns {*} + } + } + + + foreach child_url $child_urls { + array set child_node [site_node::get_from_url -exact -url $child_url] + if { [string equal portal $child_node(name)] } { + } else { + lappend pageflow $child_node(name) [list \ + label $child_node(instance_name) \ + folder $child_node(name) \ + url {} \ + selected_patterns *] + } + } + + if { $admin_p } { + lappend pageflow admin { + label "Administration" + url "admin/configure" + selected_patterns { + admin/* + shared/parameters + } + subsections { + configuration { + label "Configuration" + url "admin/configure" + } + applications { + label "Applications" + folder "admin/applications" + url "" + selected_patterns { + * + } + } + subsite_add { + label "New Subsite" + url "admin/subsite-add" + } + permissions { + label "Permissions" + url "admin/permissions" + selected_patterns { + permissions* + } + } + parameters { + label "Parameters" + url "shared/parameters" + } + advanced { + label "Advanced" + url "admin/." + selected_patterns { + site-map/* + groups/* + group-types/* + rel-segments/* + rel-types/* + host-node-map/* + object-types/* + } + } + } + } + } + + return $pageflow +} Index: openacs-4/contrib/packages/portal/tcl/subsite-integration-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/tcl/Attic/subsite-integration-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/contrib/packages/portal/tcl/subsite-integration-procs.xql 17 Mar 2004 02:15:53 -0000 1.1 @@ -0,0 +1,3 @@ + + + Index: openacs-4/contrib/packages/portal/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.adp,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/index.adp 14 Mar 2004 01:19:10 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/index.adp 17 Mar 2004 02:15:53 -0000 1.2 @@ -1,23 +1,12 @@ - + + + + + + -
-
-
- - -
- @navbar.name@ -
-
- - - -
-
-
-
-
+@page_num@ +@portal_id@ +@user_portal_id@ - + Index: openacs-4/contrib/packages/portal/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/www/index.tcl 14 Mar 2004 03:38:28 -0000 1.2 +++ openacs-4/contrib/packages/portal/www/index.tcl 17 Mar 2004 02:15:53 -0000 1.3 @@ -10,101 +10,14 @@ } { {page_num:integer,optional 0} - portal_id:integer,optional + {portal_id:integer,optional ""} } -# If specified, the portal_id might be the admin portal_id, or the user or -# default portal_id. That makes the code below slightly convoluted. The -# notion is that we always need the user portal_id available for the navbar -# even if we're serving the admin portal_id. - -set package_id [ad_conn package_id] - -# Assume that this instance of portal has been configured and that we're going to -# serve a page ... - -if { [parameter::get -parameter create_private_portals_p] } { - set owner_id [ad_conn user_id] -} else { - set owner_id 0 +set master_template [parameter::get -parameter MasterTemplate] +set user_portal_id [portal::get_user_portal_id] +if { [string equal $portal_id ""] } { + set portal_id $user_portal_id } -set user_portal_id [portal::get_portal_id -owner_id $owner_id] -if { ![info exists portal_id] } { - - if { [string equal $user_portal_id ""] } { - - # Make sure we've been initalized - if { ![portal::initialized] } { - if { [permission::permission_p -object_id $package_id -privilege admin] } { - ad_returnredirect admin - ad_script_abort - } else { - ad_return_exception_template -params {{custom_message "The portal package hasn't been configured yet."}} /packages/acs-subsite/www/shared/report-error - } - } - - # At this point we know we're supposed to create a personal portal - - db_1row select_user_name {} - - set master_template_id [portal::get_master_template_id] - - set portal_id [portal::new \ - -owner_id :owner_id \ - -name "Portal for $user_name" \ - -template_id $master_template_id \ - -context_id [ad_conn package_id] \ - -initialize_elements] - - } else { - set portal_id $user_portal_id - } -} - -# We should investigate improving performance by avoiding the read and write checks -# at some future point. We could sign the portal_id param, ensuring it's been set -# from within the portals package. The request processor has verified that the -# user can read this portal instance. As long as administrators don't muck -# with permissions directly and let the portals package manage them, we know -# that: - -# 1. Users can read and write (edit) their own portal -# 2. Everyone can read the master template portal -# 3. Only admins can edit the master template portal -# 4. Only admins can read the admin portal - -# Check to see if we're serving the admin portal -if { $portal_id == $user_portal_id} { - permission::require_permission -privilege read -object_id $portal_id - set admin_p [permission::permission_p -object_id $portal_id -privilege admin] - set edit_p [permission::permission_p -object_id $portal_id -privilege write] - set render_style individual -} else { - # Gotta be an admin to use the admin portal, and it's not configurable so - # we set edit_0 - permission::require_permission -privilege admin -object_id $portal_id - set admin_p 1 - set edit_p 0 - set render_style all-in-one -} - -array set portal [portal::get_render_data \ - -portal_id $portal_id \ - -render_style $render_style \ - -page_num $page_num] - -db_multirow -unclobber -extend {url} navbar select_user_navbar {} { - set url [export_vars -base index {portal_id page_num}] -} - -if { $admin_p } { - db_multirow -unclobber -append -extend {url} navbar select_admin_navbar {} { - set url [export_vars -base index {portal_id page_num}] - } -} - -set which_navbar [parameter::get -parameter navbar_class] - ad_return_template Index: openacs-4/contrib/packages/portal/www/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/index.xql,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/portal/www/index.xql 14 Mar 2004 01:19:10 -0000 1.1 +++ openacs-4/contrib/packages/portal/www/index.xql 17 Mar 2004 02:15:53 -0000 1.2 @@ -2,14 +2,6 @@ - - - select first_names || ' ' || last_name as user_name - from persons - where person_id = :owner_id - - - select name, sort_key as page_num, portal_id Index: openacs-4/contrib/packages/portal/www/admin/configure.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/portal/www/admin/configure.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/contrib/packages/portal/www/admin/configure.tcl 13 Mar 2004 00:40:27 -0000 1.2 +++ openacs-4/contrib/packages/portal/www/admin/configure.tcl 17 Mar 2004 02:15:53 -0000 1.3 @@ -17,9 +17,9 @@ 1 -label "Welcome to the Portal Configuration Wizard" -url /packages/portal/lib/configure-help 2 -label "Configure Private Portals" -url /packages/portal/lib/configure-private-portals 3 -label "Configure User Control Over Appearance" -url /packages/portal/lib/configure-configurability - 4 -label "Configure User \"My Account\" and \"Configure\" Pages" -url /packages/portal/lib/configure-extra-user-pages - 5 -label "Add Applications" -url /packages/portal/lib/add-applications - 6 -label "Configure Master Portal Template Layout" -url /packages/portal/lib/portal-configure + 4 -label "Add Applications" -url /packages/portal/lib/add-applications + 5 -label "Configure Master Portal Template Layout" -url /packages/portal/lib/portal-configure + 6 -label "Configure Subsite Integration" -url /packages/portal/lib/configure-subsite-integration 100 -label "Congratulations! Configuration Is Complete" -url /packages/portal/lib/configure-finish }