--- loncom/interface/loncommon.pm 2009/05/11 14:13:51 1.809 +++ loncom/interface/loncommon.pm 2009/05/18 16:29:55 1.821 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.809 2009/05/11 14:13:51 bisitz Exp $ +# $Id: loncommon.pm,v 1.821 2009/05/18 16:29:55 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -4144,35 +4144,24 @@ Returns: value of designparamter $which ############################################## sub designparm { my ($which,$domain)=@_; - if ($env{'browser.blackwhite'} eq 'on') { - if ($which=~/\.(font|alink|vlink|link|textcol)$/) { - return '#000000'; - } - if ($which=~/\.(pgbg|sidebg|bgcol)$/) { - return '#FFFFFF'; - } - if ($which=~/\.tabbg$/) { - return '#CCCCCC'; - } - } if (exists($env{'environment.color.'.$which})) { - return $env{'environment.color.'.$which}; + return $env{'environment.color.'.$which}; } $domain=&determinedomain($domain); my %domdesign = &get_domainconf($domain); my $output; if ($domdesign{$domain.'.'.$which} ne '') { - $output = $domdesign{$domain.'.'.$which}; + $output = $domdesign{$domain.'.'.$which}; } else { $output = $defaultdesign{$which}; } if (($which =~ /^(student|coordinator|author|admin)\.img$/) || ($which =~ /login\.(img|logo|domlogo|login)/)) { if ($output =~ m{^/(adm|res)/}) { - if ($output =~ m{^/res/}) { - my $local_name = &Apache::lonnet::filelocation('',$output); - &Apache::lonnet::repcopy($local_name); - } + if ($output =~ m{^/res/}) { + my $local_name = &Apache::lonnet::filelocation('',$output); + &Apache::lonnet::repcopy($local_name); + } $output = &lonhttpdurl($output); } } @@ -4215,13 +4204,11 @@ Inputs: in the title box that appears, this text is not auto translated like the $title is -=item * $notopbar, if true, keep the 'what is this' info but remove the - navigational links +=item * $no_nav_bar, if true, keep the 'what is this' info but remove the + navigational links =item * $bgcolor, used to override the bgcolor on a webpage to a specific value -=item * $notitle, if true keep the nav controls, but remove the title bar - =item * $no_inline_link, if true and in remote mode, don't show the 'Switch To Inline Menu' link @@ -4242,7 +4229,7 @@ other decorations will be returned. sub bodytag { my ($title,$function,$addentries,$bodyonly,$domain,$forcereg,$customtitle, - $notopbar,$bgcolor,$notitle,$no_inline_link,$args)=@_; + $no_nav_bar,$bgcolor,$no_inline_link,$args)=@_; if (!$args->{'no_auto_mt_title'}) { $title = &mt($title); } @@ -4360,18 +4347,15 @@ ENDROLE .&Apache::lonmenu::constspaceform(); } - my $titletable; - if (!$notitle) { - $titletable = - ''. - "".$roleinfo. - '
$titleinfo $dc_info
'; - } - if ($notopbar) { + my $titletable = '' + ."".$roleinfo + .'
$titleinfo $dc_info
'; + + if ($no_nav_bar) { $bodytag .= $titletable; } else { - $bodytag .= qq|
$name ($role)
- $realm$dc_info
|; + $bodytag .= qq|
$name ($role)
+ $realm $dc_info
|; if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::menubuttons($forcereg,$forcereg, $titletable); @@ -4397,9 +4381,6 @@ ENDROLE my $menu= ($no_inline_link?'' :'
'.&mt('Switch to Inline Menu Mode').''); # - if ($notitle) { - return $bodytag; - } return(< @@ -4452,15 +4433,6 @@ sub make_attr_string { $attr_ref->{'style'}=$style.'; font-size: x-large;'; } - if ($env{'browser.blackwhite'} eq 'on') { - delete($attr_ref->{'font'}); - delete($attr_ref->{'link'}); - delete($attr_ref->{'alink'}); - delete($attr_ref->{'vlink'}); - delete($attr_ref->{'bgcolor'}); - delete($attr_ref->{'background'}); - } - my $attr_string; foreach my $attr (keys(%$attr_ref)) { $attr_string .= " $attr=\"".$attr_ref->{$attr}.'" '; @@ -4577,20 +4549,6 @@ a:focus { background: yellow } -table.thinborder, -table.thinborder tr th { - border-style: solid; - border-width: 1px; - border-color: $lg_border_color; - background: $tabbg; -} - -table.thinborder tr td { - border-style: solid; - border-width: 1px; - border-color: $lg_border_color; -} - form, .inline { display: inline; } @@ -4648,20 +4606,11 @@ div.LC_confirm_box .LC_success img { vertical-align: middle; } -.LC_unknown { - color: yellow; -} - .LC_icon { border: none; vertical-align: middle; } -.LC_indexer_icon { - border: none; - height: 22px; -} - .LC_docs_spacer { width: 25px; height: 1px; @@ -4725,6 +4674,7 @@ table#LC_title_bar a { } table#LC_title_bar { + clear: both; /*display: none;*/ } @@ -4740,6 +4690,7 @@ table#LC_title_bar.LC_with_remote { font-family: $sans; border-collapse: collapse; padding: 0; + margin: 0; } table.LC_docs_path { @@ -4763,15 +4714,15 @@ table#LC_title_bar .LC_title_bar_who { margin: 0; } -table#LC_title_bar .LC_title_bar_name { +table#LC_title_bar div.LC_title_bar_name { margin: 0; } -table#LC_title_bar .LC_title_bar_role { +table#LC_title_bar div.LC_title_bar_role { margin: 0; } -table#LC_title_bar .LC_title_bar_realm { +table#LC_title_bar div.LC_title_bar_realm { margin: 0; } @@ -4848,6 +4799,16 @@ table#LC_mainmenu td.LC_mainmenu_column font-size: 70%; } +#LC_head_subbox { + clear:both; + background: $sidebg; + border-bottom: 1px solid #999999; + height: 32px; + line-height: 32px; + margin: 0 0 10px; + padding: 0; +} + .LC_fontsize_medium { font-size: 85%; } @@ -4890,11 +4851,6 @@ td.LC_menubuttons_text { font-weight: bold; } -.LC_dropadd_labeltext { - font-family: $sans; - text-align: right; -} - .LC_preferences_labeltext { font-family: $sans; text-align: right; @@ -5819,7 +5775,7 @@ ul.LC_TabContent li:hover a { } h1 { - padding:5px 10px 5px 20px; + padding: 0; line-height:130%; } @@ -5872,12 +5828,12 @@ dl,ul,div,fieldset { /* overflow: hidden; */ } -#head_userinfo { +#LC_nav_bar { float: left; margin: 0; } -#head_userinfo em{ +#LC_nav_bar em{ font-weight: bold; font-style: normal; } @@ -5997,25 +5953,16 @@ ul.LC_TabContentBigger li a { ol#LC_MenuBreadcrumbs, ol#LC_PathBreadcrumbs, ul.LC_CourseBreadcrumbs { - border-top: solid 1px RGB(255, 255, 255); - height: 20px; - line-height: 20px; - vertical-align: bottom; - margin: 0 0 30px 0; padding-left: 10px; + margin: 0; list-style-position: inside; - background: url(/adm/lonIcons/lightGreyBG.png) repeat-x left top; } ol#LC_MenuBreadcrumbs li, ol#LC_PathBreadcrumbs li, ul.LC_CourseBreadcrumbs li { -/* - background: url(/adm/lonIcons/arrow_white.png) no-repeat left center; -*/ display: inline; padding: 0 0 0 10px; -/* vertical-align: bottom; */ overflow:hidden; } @@ -6495,7 +6442,7 @@ $args - additional optional args support only_body -> is true will set &bodytag() onlybodytag arg on - no_nav_bar -> is true will set &bodytag() notopbar arg on + no_nav_bar -> is true will set &bodytag() no_nav_bar arg on add_entries -> additional attributes to add to the domain -> force to color decorate a page for a specific domain @@ -6514,7 +6461,6 @@ $args - additional optional args support is not auto translated like the $title is frameset -> if true will start with a rather than - no_title -> if true the title bar won't be shown skip_phases -> hash ref of head -> skip the generation body -> skip all generation @@ -6563,7 +6509,7 @@ sub start_page { $args->{'only_body'}, $args->{'domain'}, $args->{'force_register'}, $args->{'body_title'}, $args->{'no_nav_bar'}, $args->{'bgcolor'}, - $args->{'no_title'}, $args->{'no_inline_link'}, + $args->{'no_inline_link'}, $args); } } @@ -6575,7 +6521,15 @@ sub start_page { $result = &html_encode($result); } - #Breadcrumbs + # Preparation for new and consistent functionlist at top of screen + # if ($args->{'functionlist'}) { + # $result .= &build_functionlist(); + #} + + # Don't add anything more if only_body wanted + return $result if $args->{'only_body'}; + + #Breadcrumbs if (exists($args->{'bread_crumbs'}) or exists($args->{'bread_crumbs_component'})) { &Apache::lonhtmlcommon::clear_breadcrumbs(); #if any br links exists, add them to the breadcrumbs @@ -6819,7 +6773,10 @@ Returns either 'student','coordinator',' ############################################### sub get_users_function { - my $function = 'student'; + my $function = 'norole'; + if ($env{'request.role'}=~/^(st)/) { + $function='student'; + } if ($env{'request.role'}=~/^(cc|in|ta|ep)/) { $function='coordinator'; } @@ -6837,6 +6794,38 @@ sub get_users_function { =pod +=item * &show_course() + +Used by lonmenu.pm and lonroles.pm to determine whether to use the word +'Courses' or 'Roles' in inline navigation and on screen displaying user's roles. + +Inputs: +None + +Outputs: +Scalar: 1 if 'Course' to be used, 0 otherwise. + +=cut + +############################################### +sub show_course { + my $course = !$env{'user.adv'}; + if (!$env{'user.adv'}) { + foreach my $env (keys(%env)) { + next if ($env !~ m/^user\.priv\./); + if ($env !~ m/^user\.priv\.(?:st|cm)/) { + $course = 0; + last; + } + } + } + return $course; +} + +############################################### + +=pod + =item * &check_user_status() Determines current status of supplied role for a @@ -10255,7 +10244,23 @@ sub escape_url { return join('/',@urlslices).'/'.$lastitem; } -# -------------------------------------------------------- Initliaze user login +sub compare_arrays { + my ($arrayref1,$arrayref2) = @_; + my (@difference,%count); + @difference = (); + %count = (); + if ((ref($arrayref1) eq 'ARRAY') && (ref($arrayref2) eq 'ARRAY')) { + foreach my $element (@{$arrayref1}, @{$arrayref2}) { $count{$element}++; } + foreach my $element (keys(%count)) { + if ($count{$element} == 1) { + push(@difference,$element); + } + } + } + return @difference; +} + +# -------------------------------------------------------- Initialize user login sub init_user_environment { my ($r, $username, $domain, $authhost, $form, $args) = @_; my $lonids=$Apache::lonnet::perlvar{'lonIDsDir'}; @@ -10309,19 +10314,6 @@ sub init_user_environment { my ($httpbrowser,$clientbrowser,$clientversion,$clientmathml, $clientunicode,$clientos) = &decode_user_agent($r); -# -------------------------------------- Any accessibility options to remember? - if (($form->{'interface'}) && ($form->{'remember'} eq 'true')) { - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite') { - if ($form->{$option} eq 'true') { - &Apache::lonnet::put('environment',{$option => 'on'}, - $domain,$username); - } else { - &Apache::lonnet::del('environment',[$option], - $domain,$username); - } - } - } # ------------------------------------------------------------- Get environment my %userenv = &Apache::lonnet::dump('environment',$domain,$username); @@ -10339,10 +10331,8 @@ sub init_user_environment { if ($userenv{'texengine'} eq 'ttm') { $clientmathml=1; } # --------------- Do not trust query string to be put directly into environment - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite', - 'interface','localpath','localres') { - $form->{$option}=~s/[\n\r\=]//gs; + foreach my $option ('interface','localpath','localres') { + $form->{$option}=~s/[\n\r\=]//gs; } # --------------------------------------------------------- Write first profile @@ -10376,13 +10366,6 @@ sub init_user_environment { $form->{'interface'}=~s/\W//gs; $initial_env{"browser.interface"} = $form->{'interface'}; $env{'browser.interface'}=$form->{'interface'}; - foreach my $option ('imagesuppress','appletsuppress', - 'embedsuppress','fontenhance','blackwhite') { - if (($form->{$option} eq 'true') || - ($userenv{$option} eq 'on')) { - $initial_env{"browser.$option"} = "on"; - } - } } foreach my $tool ('aboutme','blog','portfolio') {