Index: openacs-4/packages/theme-selva/tcl/selva-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/theme-selva/tcl/selva-procs.tcl,v diff -u -N -r1.16 -r1.17 --- openacs-4/packages/theme-selva/tcl/selva-procs.tcl 19 Jun 2018 13:35:53 -0000 1.16 +++ openacs-4/packages/theme-selva/tcl/selva-procs.tcl 19 Jun 2018 13:45:23 -0000 1.17 @@ -29,60 +29,60 @@ namespace eval selva { ad_proc -public portal_navbar { - + } { - A helper procedure that generates the Navbar, ie the tabs, - for dotlrn. It is called from the selva-master template. + A helper procedure that generates the Navbar, ie the tabs, + for dotlrn. It is called from the selva-master template. } { - set current_url [ad_conn url] + set current_url [ad_conn url] set dotlrn_url [dotlrn::get_url] - # Set up some basic stuff - set community_id [dotlrn_community::get_community_id] + # Set up some basic stuff + set community_id [dotlrn_community::get_community_id] - # Get user information - set sw_admin_p 0 - set user_id [ad_conn user_id] - set untrusted_user_id [ad_conn untrusted_user_id] - if { $untrusted_user_id != 0 } { - set user_name [acs_user::get_element -user_id $untrusted_user_id -element name] - set pvt_home_url [ad_pvt_home] - set pvt_home_name [_ acs-subsite.Your_Account] - set logout_url [ad_get_logout_url] - - # Site-wide admin link - set admin_url {} - - set sw_admin_p [acs_user::site_wide_admin_p -user_id $untrusted_user_id] - - if { $sw_admin_p } { - set admin_url "/acs-admin/" - set locale_admin_url "/acs-lang/admin" - set dotlrn_admin_url "${dotlrn_url}/admin/" - } else { - set subsite_admin_p [permission::permission_p \ - -object_id [subsite::get_element -element object_id] \ - -privilege admin \ - -party_id $untrusted_user_id] - - if { $subsite_admin_p } { - set admin_url "[subsite::get_element -element url]admin/" - } - } - } else { - set login_url [ad_get_login_url -return] - set user_name {} - } - - set navbar "" + } ad_proc -public portal_subnavbar { {-user_id:required} {-link_control_panel:required} {-control_panel_text:required} - {-link_all 0} + {-link_all 0} {-pre_html ""} {-post_html ""} } { A helper procedure that generates the portal subnavbar (the thing with the portal pages on it) for dotlrn. It is called from the dotlrn-master template } { - + set dotlrn_url [dotlrn::get_url] set community_id [dotlrn_community::get_community_id] set control_panel_name control-panel - set control_panel_url "$dotlrn_url/$control_panel_name" - + set control_panel_url "$dotlrn_url/$control_panel_name" + if { $community_id eq "" } { # We are not under a dotlrn community. However we could be # under /dotlrn (i.e. in the user's portal) or anywhere # else on the site set link "[dotlrn::get_url]/" - + if {[dotlrn::user_p -user_id $user_id] && - [ad_get_client_property dotlrn home_tab_selected_p] } { + [ad_get_client_property dotlrn home_tab_selected_p] } { # this user is a dotlrn user, we've selected the home tab, # show their personal portal subnavbar, including the control panel link set portal_id [dotlrn::get_portal_id -user_id $user_id] @@ -198,20 +198,20 @@ # # We are under a dotlrn community. Get the community's portal_id, etc. # - + # some defaults - set text [dotlrn_community::get_community_header_name $community_id] + set text [dotlrn_community::get_community_header_name $community_id] set control_panel_name one-community-admin - # link is important : it sets the options_set value, which will be used later to select the current page + # link is important : it sets the options_set value, which will be used later to select the current page set link [dotlrn_community::get_community_url $community_id] - set control_panel_url "$link/$control_panel_name" + set control_panel_url "$link/$control_panel_name" # figure out what this privs this user has on the community set admin_p [dotlrn::user_can_admin_community_p \ -user_id $user_id \ -community_id $community_id ] - + if {!$admin_p} { # the user can't admin this community, perhaps they are a # humble member instead? @@ -222,9 +222,9 @@ # explicitly turned off set show_control_panel 1 } - + if {$admin_p || $member_p} { - + set portal_id [dotlrn_community::get_portal_id \ -community_id $community_id ] @@ -236,38 +236,35 @@ } } - #AG: This code belongs in the portal package, near portal::subnavbar. For display reasons we need to do this - #as a ul instead of a table, which portal::subnavbar returns. Obviously we shouldn't be letting display-level - #stuff decide where we put our code, but first we'll need to mod the portal package accordingly. + #AG: This code belongs in the portal package, near portal::subnavbar. For display reasons we need to do this + #as a ul instead of a table, which portal::subnavbar returns. Obviously we shouldn't be letting display-level + #stuff decide where we put our code, but first we'll need to mod the portal package accordingly. - if { [catch {set page_num [ad_get_client_property dotlrn page_num]}] || $page_num eq "" || ![string is integer $page_num] } { - set page_num [ns_queryget page_num] - #Strip out extra anchors and other crud. - #page_num will be empty_string for special pages like - #My Space and Control Panel - regsub -all {[^0-9]} $page_num {} page_num - } - - set subnavbar "" } - }