Index: openacs-4/packages/dotlrn/www/dotlrn-master.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/dotlrn-master.tcl,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/dotlrn/www/dotlrn-master.tcl 9 Aug 2002 18:39:26 -0000 1.9 +++ openacs-4/packages/dotlrn/www/dotlrn-master.tcl 17 Oct 2002 12:29:16 -0000 1.9.2.1 @@ -1,4 +1,3 @@ -# # Copyright (C) 2001, 2002 MIT # # This file is part of dotLRN. @@ -13,135 +12,232 @@ # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # +# +# /www/dotlrn-default-master.tcl +# +# This is the "default-master" template for dotlrn sites. +# +# Instructions: +# +# 1. Put this file and it's .adp file into the server's /www directory. +# That's the one with the "default-master" tcl and adp files. You don't +# have to edit or remove the "default-master" files, since they will be +# ignored by the next step. +# +# 2. Change the "Main Site"'s "DefaultMaster" parameter +# from "/www/default-master" to "/www/dotlrn-default-master" +# at http://yoursite.com/admin/site-map +# +# This tells OpenACS to to use these files instead of the "default-master" +# +# 3. Edit these files to chage the look of the site including the banner +# at the top of the page, the title of the pages, the fonts of the portlets, etc. +# +# WARNING: All current portlet themes (table, deco, nada, etc) depend on some +# of the CSS defined below. Be carefull when you edit the CSS below, +# and check how themes use it. +# +# +# Author: Arjun Sanyal (arjun@openforce.net), yon@openforce.net +# +# $Id$ -ad_page_contract { - Q: What is this file? +set user_id [ad_get_user_id] +set community_id [dotlrn_community::get_community_id] +set dotlrn_url [dotlrn::get_url] - A: This is the master template for dotlrn. It sets up the navbar and - dynamically generates a CSS file for the dotlrn banner color, font, header - image, and the portal themes. +#Scope Related graphics/css parameters - Q: How do I use this file? +# Set everything for user level scope as default then modify it later as we refine the scope. +set scope_name "user" +set scope_main_color "#003366" +set scope_header_color "#6DB2C9" +set scope_highlight_text "white" +set scope_z_dark "#C9D7DC" +set scope_z_light "#EAF0F2" +set scope_light_border "#DDEBF5" +set help_url "[dotlrn::get_url]/control-panel" +set header_font "Arial, Helvetica, sans-serif" +set header_font_size "medium" +set header_font_color "black" +set header_logo_item_id "" +set header_img_url "$dotlrn_url/graphics/logo" +set header_img_alt_text "Header Logo" - A: This template is meant to replace your OpenACS default-master template. - - To do this change the "Main Site"'s "DefaultMaster" parameter - from "/www/default-master" to "/packages/dotlrn/www/dotlrn-master" - at http://yoursite.com/admin/site-map +set extra_spaces "" +set td_align "align=\"center\" valign=\"top\"" - Q: Do I have to replace my site's default-master template with this - one for dotlrn to work? - A: Yes +if {[dotlrn::user_p -user_id $user_id]} { + set portal_id [dotlrn::get_portal_id -user_id $user_id] +} - Q: How do I customize the banner, images, CSS, etc? +if {![empty_string_p $community_id]} { + set have_comm_id_p 1 +} else { + set have_comm_id_p 0 +} - A: You can change the default banner and generated CSS by editing this template - and the associated ADP. +if {[exists_and_not_null portal_id]} { + set have_portal_id_p 1 +} else { + set have_portal_id_p 0 +} - WARNING: Some portal themes depend on the CSS generated below. Be careful when - you edit the CSS below and check that the portal theme has not broken. +# navbar vars +set show_navbar_p 1 +if {[exists_and_not_null no_navbar_p] && $no_navbar_p} { + set show_navbar_p 0 +} - @author arjun (arjun@openforce.net) - @version $Id$ - +if {![info exists link_all]} { + set link_all 0 } -# -# Set up some basic vars -# -set user_id [ad_get_user_id] -set dotlrn_url [dotlrn::get_url] -set dotlrn_graphics_url "/graphics" - -# -# Get passed in properties -# - -# title - if passed in appends it to the default title -set default_title "dotLRN" - -if {![info exists title]} { - set title $default_title +if {![info exists return_url]} { + set link [ad_conn -get extra_url] } else { - set title "$default_title : $title" + set link $return_url } -# no_navbar_p - a property to turn off the navbar, not currently used -if {![info exists no_navbar_p]} { - set no_navbar_p 0 -} -# link_control_panel - a special property used by "control-panel" pages if {![info exists link_control_panel]} { set link_control_panel 1 } -# -# navbar generation -# -if {!$no_navbar_p} { +if {![info exists control_panel_text]} { + set control_panel_text "Control Panel" +} + +if {$have_comm_id_p} { + # get this comm's info + set portal_id [dotlrn_community::get_portal_id -community_id $community_id] + set text [dotlrn_community::get_community_header_name $community_id] + set link [dotlrn_community::get_community_url $community_id] + set admin_p [dotlrn::user_can_admin_community_p -user_id $user_id -community_id $community_id] + + if {[empty_string_p $portal_id] && !$admin_p } { + # not a member yet + set portal_id [dotlrn_community::get_non_member_portal_id -community_id $community_id] + } + + if { $have_portal_id_p && $show_navbar_p } { + set make_navbar_p 1 + + } else { + set make_navbar_p 0 + set portal_id "" + } +} elseif {[parameter::get -parameter community_type_level_p] == 1} { + set extra_td_html "" + set link_all 1 + set link [dotlrn::get_url] + # in a community type + set text \ + [dotlrn_community::get_community_type_name [dotlrn_community::get_community_type]] + + if {$have_portal_id_p && $show_navbar_p} { + set make_navbar_p 1 + } else { + set make_navbar_p 0 + set portal_id "" + } +} else { + # we could be anywhere (maybe under /dotlrn, maybe not) + set link "[dotlrn::get_url]/" + set community_id "" + set text "" + set make_navbar_p 1 + if {$have_portal_id_p && $show_navbar_p} { + } else { + set make_navbar_p 0 + set portal_id "" + } +} + +if { $make_navbar_p } { + if {$link_control_panel} { + set link_control_panel 1 + } else { + set link_control_panel 0 + } + set extra_spaces "" set navbar [dotlrn::portal_navbar \ -user_id $user_id \ -link_control_panel $link_control_panel \ - -control_panel_text "Control Panel" + -control_panel_text "Control Panel" \ + -pre_html "$extra_spaces" \ + -post_html $extra_spaces \ + -link_all $link_all ] } else { set navbar "
" } +# Set up some basic stuff +set user_id [ad_get_user_id] +set full_name "[dotlrn::get_user_name $user_id]" -# the ColorHack and FontHack and LogoHack! -set color_hack "#cc0000" -set color_hack_name "red" -set header_font "" -set header_font_size "medium" -set header_font_color "black" -set header_logo_item_id "" -set header_img_url "$dotlrn_graphics_url/dotlrn.gif" -set header_img_alt_text "Header Logo" +if {![exists_and_not_null title]} { + set title "SloanSpace" +} - -# gets the package_id for the passed in dotlrn instace, -# if the community_id is invalid, returns the pacakge_id of the -# main dotlrn instance ??? -set community_id [dotlrn_community::get_community_id] -set package_id [dotlrn_community::get_package_id $community_id] - -if {[empty_string_p [dotlrn_community::get_parent_community_id -package_id $package_id]]} { +if {[empty_string_p [dotlrn_community::get_parent_community_id -package_id [ad_conn package_id]]]} { set parent_comm_p 0 } else { set parent_comm_p 1 } -# in a community or just under one in a mounted package like /calendar -if {[parameter::get -package_id $package_id -parameter community_level_p] == 1 || $parent_comm_p } { - set community_id [dotlrn_community::get_community_id] - - # color hack +set community_id [dotlrn_community::get_community_id] + +if {![empty_string_p $community_id]} { + # in a community or just under one in a mounted package like /calendar + set comm_type [dotlrn_community::get_community_type_from_community_id $community_id] + if {[dotlrn_community::subcommunity_p -community_id $community_id]} { - set color_hack "#663366" - set color_hack_name "purple" + #The colors for a subgroup are set by the parent group with a few overwritten. + set comm_type [dotlrn_community::get_community_type_from_community_id [dotlrn_community::get_parent_id -community_id $community_id]] + } + + if {$comm_type == "dotlrn_club"} { + #community colors + set scope_name "comm" + set scope_main_color "#CC6633" + set scope_header_color "#F48F5C" + set scope_z_dark "#FFDDB0" + set scope_z_light "#FFF2E2" + set scope_light_border "#E7B59C" + if {[dotlrn_community::subcommunity_p -community_id $community_id]} { + set scope_z_dark "#FFDDB0" + set scope_z_light "#FFF2E2" + } } else { - set comm_type \ - [dotlrn_community::get_community_type_from_community_id $community_id] - if {$comm_type == "dotlrn_club"} { - set color_hack "#006666" - set color_hack_name "green" - } else { - set color_hack "#6699cc" - set color_hack_name "blue" - } + set scope_name "course" + set scope_main_color "#6C9A83" + set scope_header_color $scope_main_color + set scope_z_dark "#CDDED5" + set scope_z_light "#E6EEEA" + set scope_light_border "#D0DFD9" + if {[dotlrn_community::subcommunity_p -community_id $community_id]} { + set scope_z_dark "#D0DFD9" + set scope_z_light "#ECF3F0" + } } + + set header_img_url "$header_img_url-$scope_name.gif" # font hack - set header_font [dotlrn_community::get_attribute \ + set community_header_font [dotlrn_community::get_attribute \ -community_id $community_id \ -attribute_name header_font ] - append header_font ", " + if {![empty_string_p $community_header_font]} { + set header_font "$community_header_font,$header_font" + } + + set header_font_size [dotlrn_community::get_attribute \ -community_id $community_id \ -attribute_name header_font_size @@ -160,9 +256,11 @@ if {![empty_string_p $header_logo_item_id]} { - set header_img_url "community-image?revision_id=$header_logo_item_id" - } - + # Need filename + set header_img_url "[dotlrn_community::get_community_url $community_id]/file-storage/download/?version_id=$header_logo_item_id" + } + + set header_logo_alt_text [dotlrn_community::get_attribute \ -community_id $community_id \ -attribute_name header_logo_alt_text @@ -175,101 +273,272 @@ # The header text is the name of the community set text [dotlrn_community::get_community_header_name $community_id] -} elseif {[parameter::get -package_id $package_id -parameter community_type_level_p] == 1} { +} elseif {[parameter::get -parameter community_type_level_p] == 1} { # in a community type set text \ [dotlrn_community::get_community_type_name [dotlrn_community::get_community_type]] } else { # under /dotlrn - set text "[dotlrn::get_user_name $user_id]" + set header_img_url "$header_img_url-$scope_name.gif" + set text $full_name } - -# WARNING: read note at the top of the file before altering the CSS below +# This style sheet should be moved over to an external file for performance set header_stuff " - + " # Developer-support support @@ -284,5 +553,3 @@ } else { set ds_link {} } - -ad_return_template