Index: openacs-4/packages/dotlrn/www/master.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/Attic/master.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/dotlrn/www/master.tcl	23 Jan 2002 07:41:04 -0000	1.10
+++ openacs-4/packages/dotlrn/www/master.tcl	25 Jan 2002 19:59:50 -0000	1.11
@@ -2,15 +2,33 @@
 # sloan specifc master
 #
 
-# if we have a portal_id show navbar
 set user_id [ad_verify_and_get_user_id]
 
+#
+# here's a bunch of stuff that an adp _may_ set to alter
+# this templates behavior
+#
+
+if {[exists_and_not_null portal_id]} {
+    set have_portal_id 1
+} else {
+    set have_portal_id 0 
+}
+
+if {[exists_and_not_null no_navbar_p]} {
+    set show_navbar_p 0
+} else {
+    set show_navbar_p 1 
+}
+
 if {![info exists link_all]} {
     set link_all 0
 }
 
 if {![info exists return_url]} {
-    set return_url ""
+    set link [ad_conn -get extra_url]
+} else {
+    set link $return_url
 }
 
 if {![info exists show_control_panel]} {
@@ -21,6 +39,11 @@
     set link_control_panel 1
 }
 
+if {![info exists control_panel_text]} {
+    set control_panel_text "Control Panel"
+}
+
+
 db_0or1row pvt_home_user_info {
     select first_names, last_name
     from cc_users
@@ -32,56 +55,75 @@
 
 if {[ad_parameter community_level_p] == 1} {
     # in a community
+
+    # The header text is the name of the community
     set text [dotlrn_community::get_community_name [dotlrn_community::get_community_id]]
-    
-    if {[info exists portal_id] && ![empty_string_p $portal_id] && ![exists_and_not_null no_navbar_p]} {
-        set navbar "<table border=0 cellpadding=5><tr>"
-        
-        append navbar [portal::list_pages -link_all $link_all -return_url $return_url -portal_id $portal_id -link "switch-page" -pre_html "<td><font face=arial,helvetica size=-1 color=black><b><center>" -separator "</center></td> <td><font face=arial,helvetica size=-1 color=black><b><center>" -post_html "</a></center></td>"]
+
+#    ad_return_complaint 1 "foobar $have_portal_id, $show_navbar_p, $link_control_panel, $show_control_panel"
+
+    if { $have_portal_id && $show_navbar_p } {
         if {$show_control_panel} {
             if {$link_control_panel} {
-                append navbar "<td><font face=arial,helvetica size=-1 color=black><b><center><a href=one-community-admin>Group Admin</a></center></td></tr></table>"
+                set extra_td_html "<font face=arial,helvetica size=-1><b> <a href=one-community-admin> $control_panel_text</a></b></font>"
             } else {
-                append navbar "<td><font face=arial,helvetica size=-1 color=black><b><center>Group Admin</center></td></tr></table>"
+                set extra_td_html "<font face=arial,helvetica size=-1><b> $control_panel_text</b></font>"
             }
         } else {
-            append navbar "</tr></table>"
+            # don't show control panel
+            set extra_td_html ""
         }
+            
+            set navbar [portal::navbar \
+                    -portal_id $portal_id \
+                    -link_all $link_all \
+                    -link $link \
+                    -pre_html "<font face=arial,helvetica size=-1><b>" \
+                    -post_html "</b></font>" \
+                    -extra_td_html $extra_td_html \
+                    -table_html_args "border=0 cellpadding=5"]
     } else {
         set navbar ""
         set portal_id ""
     }
-    
 } elseif {[ad_parameter community_type_level_p] == 1} {
     # in a community type
-    set text [dotlrn_community::get_community_type_name [dotlrn_community::get_community_type]]
+    set text \
+            [dotlrn_community::get_community_type_name [dotlrn_community::get_community_type]]
     
-    if {[info exists portal_id] && ![empty_string_p $portal_id] && ![exists_and_not_null no_navbar_p]} {
-        set navbar "<table border=0 cellpadding=5><tr>"
+    if {$have_portal_id && $show_navbar_p} {
         
-        append navbar [portal::list_pages -link_all $link_all -return_url $return_url -portal_id $portal_id -link "switch-page" -pre_html "<td><font face=arial,helvetica size=-1 color=black><b><center>" -separator "</center></td> <td><font face=arial,helvetica size=-1 color=black><b><center>" -post_html "</a></center></td>"]
-        
-        append navbar "</tr></table>"
-        
+           set navbar [portal::navbar \
+                   -portal_id $portal_id \
+                   -link_all $link_all \
+                   -link $link \
+                   -pre_html "<font face=arial,helvetica size=-1><b>" \
+                   -post_html "</b></font>" \
+                   -extra_td_html $extra_td_html \
+                   -table_html_args "border=0 cellpadding=5"]
     } else {
         set navbar ""
         set portal_id ""
     }
-    
+ 
 } else {
     # under /dotlrn
     set text $full_name
-    if {[info exists portal_id] && ![empty_string_p $portal_id] && ![exists_and_not_null no_navbar_p]} {
-        set navbar "<table border=0 cellpadding=5><tr>"
-        
-        append navbar [portal::list_pages -return_url $return_url -portal_id $portal_id -link_all $link_all -link "switch-page" -pre_html "\n<td><font face=arial,helvetica size=-1 color=black><b> <center>" -separator " </center></td>\n<td><font face=arial,helvetica size=-1 color=black><b> <center>" -post_html "</a></center></td>\n"]
-        
+    
+    if {$have_portal_id && $show_navbar_p} {
         if {$link_control_panel} {
-            append navbar "<td><font face=arial,helvetica size=-1 color=black><b><center><a href=preferences>Control Panel</a></center></td></tr></table>"
+            set extra_td_html "<font face=arial,helvetica size=-1><b> <a href=preferences>Control Panel</a></b></font>"
         } else {
-            append navbar "<td><font face=arial,helvetica size=-1 color=black><b><center>Control Panel</center></td></tr></table>"
+            set extra_td_html "<font face=arial,helvetica size=-1><b> Control Panel</b></font>"
         }
-        
+
+        set navbar [portal::navbar \
+                -portal_id $portal_id \
+                -link_all $link_all \
+                -link $link \
+                -pre_html "<font face=arial,helvetica size=-1><b>" \
+                -post_html "</b></font>" \
+                -extra_td_html $extra_td_html  \
+                -table_html_args "border=0 cellpadding=5 cellspacing=2"]
     } else {
         set navbar ""
         set portal_id ""