| |
40 |
40 |
set community_id [dotlrn_community::get_community_id] |
| |
41 |
41 |
|
| |
42 |
42 |
# Get user information |
| |
43 |
43 |
set sw_admin_p 0 |
| |
44 |
44 |
set user_id [ad_conn user_id] |
| |
45 |
45 |
set untrusted_user_id [ad_conn untrusted_user_id] |
| |
46 |
46 |
if { $untrusted_user_id != 0 } { |
| |
47 |
47 |
set user_name [person::name -person_id $untrusted_user_id] |
| |
48 |
48 |
set pvt_home_url [ad_pvt_home] |
| |
49 |
49 |
set pvt_home_name [_ acs-subsite.Your_Account] |
| |
50 |
50 |
set logout_url [ad_get_logout_url] |
| |
51 |
51 |
|
| |
52 |
52 |
# Site-wide admin link |
| |
53 |
53 |
set admin_url {} |
| |
54 |
54 |
|
| |
55 |
55 |
set sw_admin_p [acs_user::site_wide_admin_p -user_id $untrusted_user_id] |
| |
56 |
56 |
|
| |
57 |
57 |
if { $sw_admin_p } { |
| |
58 |
58 |
set admin_url "/acs-admin/" |
| |
59 |
59 |
set locale_admin_url "/acs-lang/admin" |
| |
60 |
|
set dotlrn_admin_url "/dotlrn/admin" |
| |
|
60 |
set dotlrn_admin_url "/dotlrn/admin/" |
| |
61 |
61 |
} else { |
| |
62 |
62 |
set subsite_admin_p [permission::permission_p \ |
| |
63 |
63 |
-object_id [subsite::get_element -element object_id] \ |
| |
64 |
64 |
-privilege admin \ |
| |
65 |
65 |
-party_id $untrusted_user_id] |
| |
66 |
66 |
|
| |
67 |
67 |
if { $subsite_admin_p } { |
| |
68 |
68 |
set admin_url "[subsite::get_element -element url]admin/" |
| |
69 |
69 |
} |
| |
70 |
70 |
} |
| |
71 |
71 |
} else { |
| |
72 |
72 |
set login_url [ad_get_login_url -return] |
| |
73 |
73 |
set user_name {} |
| |
74 |
74 |
} |
| |
75 |
75 |
|
| |
76 |
76 |
set navbar "<ul>" |
| |
77 |
77 |
|
| |
78 |
78 |
set tabs_list [list] |
| |
79 |
79 |
|
| |
80 |
80 |
if { [exists_and_not_null community_id] } { |
| |
81 |
81 |
set type [dotlrn_community::get_community_type_from_community_id $community_id] |
| |
82 |
|
if { $type eq "dotlrn_community" || $type eq "dotlrn_club" || $type eq "dotlrn_pers_community" } { |
| |
|
82 |
if { $type eq "dotlrn_community" || $type eq "dotlrn_pers_community" } { |
| |
|
83 |
set community_message_key "#dotlrn.subcommunities_pretty_name#" |
| |
|
84 |
} elseif { $type eq "dotlrn_club" } { |
| |
83 |
85 |
set community_message_key "#dotlrn.clubs_pretty_name#" |
| |
84 |
86 |
} else { |
| |
85 |
87 |
set community_message_key "#dotlrn.dotlrn_class_instance_pretty_name#" |
| |
86 |
88 |
} |
| |
87 |
89 |
lappend tabs_list [list "$current_url" $community_message_key] |
| |
88 |
90 |
} |
| |
89 |
91 |
|
| |
90 |
92 |
foreach {url name} [parameter::get_from_package_key -package_key "theme-selva" -parameter "AdditionalNavbarTabs" -default ""] { |
| |
91 |
93 |
lappend tabs_list [list "$url" "$name"] |
| |
92 |
94 |
} |
| |
93 |
95 |
|
| |
94 |
96 |
if { $sw_admin_p } { |
| |
95 |
97 |
lappend tabs_list [list "$dotlrn_admin_url" "#dotlrn.Administration_Cockpit#"] |
| |
96 |
98 |
} |
| |
97 |
99 |
|
| |
98 |
100 |
ns_log Debug "TABS" $tabs_list |
| |
99 |
101 |
foreach tab_entry $tabs_list { |
| |
100 |
102 |
set url [lindex $tab_entry 0] |
| |
101 |
103 |
set name [lindex $tab_entry 1] |
| |
102 |
104 |
ns_log Debug "URL:: $url" |
| |
|
105 |
ns_log Debug "CURRENT URL:: $current_url" |
| |
103 |
106 |
ns_log Debug "NAME:: $name" |
| |
104 |
107 |
# if url is /dotlrn or /dotlrn/index we highlight the "Home" tab, otherwise we highlight the tab with the current_url, if there is one, i.e. we are not in a community |
| |
105 |
|
if { $url == $current_url || ($url == "/dotlrn/" && $current_url == "/dotlrn/index")} { |
| |
|
108 |
if { $url eq $current_url || ($url eq "/dotlrn/" && $current_url eq "/dotlrn/index")} { |
| |
106 |
109 |
append navbar "\n<li class=\"active\"><a href=\"$url\">" |
| |
107 |
110 |
#if {$picture != "null" } { append navbar "<img src=\"$picture\" alt=\"$picture\">" } |
| |
108 |
111 |
append navbar "[lang::util::localize $name]</a></li>" |
| |
109 |
112 |
} else { |
| |
110 |
113 |
append navbar "\n<li><a href=\"$url\">[lang::util::localize $name]</a></li>" |
| |
111 |
114 |
} |
| |
112 |
115 |
|
| |
113 |
116 |
} |
| |
114 |
117 |
|
| |
115 |
118 |
append navbar "\n</ul>" |
| |
116 |
119 |
|
| |
117 |
120 |
} |
| |
118 |
121 |
|
| |
119 |
122 |
ad_proc -public portal_subnavbar { |
| |
120 |
123 |
{-user_id:required} |
| |
121 |
124 |
{-link_control_panel:required} |
| |
122 |
125 |
{-control_panel_text:required} |
| |
123 |
126 |
{-link_all 0} |
| |
124 |
127 |
{-pre_html ""} |
| |
125 |
128 |
{-post_html ""} |