--- loncom/interface/loncommon.pm 2009/01/12 04:39:30 1.692.2.12 +++ loncom/interface/loncommon.pm 2009/05/19 00:16:11 1.692.4.1 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.692.2.12 2009/01/12 04:39:30 raeburn Exp $ +# $Id: loncommon.pm,v 1.692.4.1 2009/05/19 00:16:11 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -943,30 +943,24 @@ ENDTEMPLATE # This is a quicky function for Latex cheatsheet editing, since it # appears in at least four places sub helpLatexCheatsheet { - my ($topic,$text,$not_author) = @_; - my $out; + my $other = shift; my $addOther = ''; - if ($topic) { - $addOther = Apache::loncommon::help_open_topic($topic,$text, - undef, undef, 600). - ''; - } - $out = ''; - unless ($not_author) { - $out .= ''; - } - $out .= '
'. - $addOther. - &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'), - undef,undef,600). - ''. - &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'), - undef,undef,600). - ''. - &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'), - undef,undef,600). - '
'; - return $out; + if ($other) { + $addOther = Apache::loncommon::help_open_topic($other, shift, + undef, undef, 600) . + ''; + } + return '
'. + $addOther . + &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'), + undef,undef,600) + .''. + &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'), + undef,undef,600) + .''. + &Apache::loncommon::help_open_topic("Authoring_Output_Tags",&mt('Output Tags'), + undef,undef,600) + .'
'; } sub general_help { @@ -2723,42 +2717,6 @@ sub flush_email_cache { &Apache::lonnet::devalidate_cache_new('emailscache',$id); } -# -------------------------------------------------------------------- getlangs - -=pod - -=item * &getlangs($uname,$udom) - -Gets a user's language preference and returns it as a hash with key: -language. - -=cut - -sub getlangs { - my ($uname,$udom) = @_; - if (!$udom) { $udom =$env{'user.domain'}; } - if (!$uname) { $uname=$env{'user.name'}; } - my $id=$uname.':'.$udom; - my ($langs,$cached)=&Apache::lonnet::is_cached_new('userlangs',$id); - if ($cached) { - return %{$langs}; - } else { - my %loadlangs=&Apache::lonnet::get('environment',['languages'], - $udom,$uname); - &Apache::lonnet::do_cache_new('userlangs',$id,\%loadlangs); - return %loadlangs; - } -} - -sub flush_langs_cache { - my ($uname,$udom)=@_; - if (!$udom) { $udom =$env{'user.domain'}; } - if (!$uname) { $uname=$env{'user.name'}; } - return if ($udom eq 'public' && $uname eq 'public'); - my $id=$uname.':'.$udom; - &Apache::lonnet::devalidate_cache_new('userlangs',$id); -} - # ------------------------------------------------------------------ Screenname =pod @@ -3213,7 +3171,7 @@ sub relative_to_absolute { } $thisdir=~s-/[^/]*$--; foreach my $link (@rlinks) { - unless (($link=~/^https?\:\/\//i) || + unless (($link=~/^http:\/\//i) || ($link=~/^\//) || ($link=~/^javascript:/i) || ($link=~/^mailto:/i) || @@ -3922,14 +3880,7 @@ sub get_domainconf { if (ref($domconfig{'login'}) eq 'HASH') { if (keys(%{$domconfig{'login'}})) { foreach my $key (keys(%{$domconfig{'login'}})) { - if (ref($domconfig{'login'}{$key}) eq 'HASH') { - foreach my $img (keys(%{$domconfig{'login'}{$key}})) { - $designhash{$udom.'.login.'.$key.'_'.$img} = - $domconfig{'login'}{$key}{$img}; - } - } else { - $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; - } + $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; } } else { $legacy{'login'} = 1; @@ -4640,7 +4591,7 @@ table#LC_mainmenu td.LC_mainmenu_column .LC_menubuttons_link { text-decoration: none; } -/*2008--9-5: new menu style sheet.Changed category*/ +#2008--9-5: new menu style sheet.Changed category .LC_menubuttons_category { color: $font; background: $pgbg; @@ -4711,10 +4662,6 @@ td.LC_menubuttons_img { font-size: smaller; } -.LC_mail_functions { - font-weight: bold; -} - table.LC_aboutme_port { border: 0px; border-collapse: collapse; @@ -4747,11 +4694,6 @@ table.LC_prior_tries tr th { background-color: $data_table_head; font-size: smaller; } -table.LC_data_table tr.LC_info_row > td { - background-color: #CCC; - font-weight: bold; - text-align: left; -} table.LC_data_table tr.LC_odd_row > td, table.LC_aboutme_port tr td { background-color: $data_table_light; @@ -5528,11 +5470,6 @@ fieldset#LC_mainmenu_fieldset { margin:0px 10px 10px 0px; } - -div.LC_createcourse { - margin: 10px 10px 10px 10px; -} - END } @@ -6563,35 +6500,19 @@ sub default_quota { if ($inststatus ne '') { my @statuses = split(/:/,$inststatus); foreach my $item (@statuses) { - if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { - if ($quotahash{'quotas'}{'defaultquota'}{$item} ne '') { - if ($defquota eq '') { - $defquota = $quotahash{'quotas'}{'defaultquota'}{$item}; - $settingstatus = $item; - } elsif ($quotahash{'quotas'}{'defaultquota'}{$item} > $defquota) { - $defquota = $quotahash{'quotas'}{'defaultquota'}{$item}; - $settingstatus = $item; - } - } - } else { - if ($quotahash{'quotas'}{$item} ne '') { - if ($defquota eq '') { - $defquota = $quotahash{'quotas'}{$item}; - $settingstatus = $item; - } elsif ($quotahash{'quotas'}{$item} > $defquota) { - $defquota = $quotahash{'quotas'}{$item}; - $settingstatus = $item; - } + if ($quotahash{'quotas'}{$item} ne '') { + if ($defquota eq '') { + $defquota = $quotahash{'quotas'}{$item}; + $settingstatus = $item; + } elsif ($quotahash{'quotas'}{$item} > $defquota) { + $defquota = $quotahash{'quotas'}{$item}; + $settingstatus = $item; } } } } if ($defquota eq '') { - if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { - $defquota = $quotahash{'quotas'}{'defaultquota'}{'default'}; - } else { - $defquota = $quotahash{'quotas'}{'default'}; - } + $defquota = $quotahash{'quotas'}{'default'}; $settingstatus = 'default'; } } else { @@ -9072,9 +8993,7 @@ sub construct_course { 'policy.email', 'comment.email', 'pch.users.denied', - 'plc.users.denied', - 'hidefromcat', - 'categories'], + 'plc.users.denied'], $$crsudom,$$crsunum); } @@ -9532,11 +9451,6 @@ sub init_user_environment { } } - foreach my $tool ('aboutme','blog','portfolio') { - $userenv{'availabletools.'.$tool} = - &Apache::lonnet::usertools_access($username,$domain,$tool,'reload'); - } - $env{'user.environment'} = "$lonids/$cookie.id"; if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id", @@ -9575,7 +9489,7 @@ sub _add_to_env { # --- Get the symbolic name of a problem and the url sub get_symb { my ($request,$silent) = @_; - (my $url=$env{'form.url'}) =~ s-^https?\://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); if ($symb eq '') { if (!$silent) { @@ -9602,13 +9516,11 @@ sub get_annotation { } sub clean_symb { - my ($symb,$delete_enc) = @_; + my ($symb) = @_; &Apache::lonenc::check_decrypt(\$symb); my $enc = $env{'request.enc'}; - if ($delete_enc) { - delete($env{'request.enc'}); - } + delete($env{'request.enc'}); return ($symb,$enc); }