version 1.692, 2008/11/04 21:06:41
|
version 1.692.2.10, 2008/12/25 04:45:35
|
Line 677 sub select_datelocale {
|
Line 677 sub select_datelocale {
|
if ($id ne '') { |
if ($id ne '') { |
my $en_terr = $locale->{'en_territory'}; |
my $en_terr = $locale->{'en_territory'}; |
my $native_terr = $locale->{'native_territory'}; |
my $native_terr = $locale->{'native_territory'}; |
my @languages = &preferred_languages(); |
my @languages = &Apache::lonlocal::preferred_languages(); |
if (grep(/^en$/,@languages) || !@languages) { |
if (grep(/^en$/,@languages) || !@languages) { |
if ($en_terr ne '') { |
if ($en_terr ne '') { |
$locale_names{$id} = '('.$en_terr.')'; |
$locale_names{$id} = '('.$en_terr.')'; |
Line 2717 sub flush_email_cache {
|
Line 2717 sub flush_email_cache {
|
&Apache::lonnet::devalidate_cache_new('emailscache',$id); |
&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 |
# ------------------------------------------------------------------ Screenname |
|
|
=pod |
=pod |
Line 2998 sub fileextensions {
|
Line 3034 sub fileextensions {
|
|
|
sub display_languages { |
sub display_languages { |
my %languages=(); |
my %languages=(); |
foreach my $lang (&preferred_languages()) { |
foreach my $lang (&Apache::lonlocal::preferred_languages()) { |
$languages{$lang}=1; |
$languages{$lang}=1; |
} |
} |
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); |
&get_unprocessed_cgi($ENV{'QUERY_STRING'},['displaylanguage']); |
Line 3010 sub display_languages {
|
Line 3046 sub display_languages {
|
return %languages; |
return %languages; |
} |
} |
|
|
sub preferred_languages { |
|
my @languages=(); |
|
if (($env{'request.role.adv'}) && ($env{'form.languages'})) { |
|
@languages=(@languages,split(/\s*(\,|\;|\:)\s*/,$env{'form.languages'})); |
|
} |
|
if ($env{'course.'.$env{'request.course.id'}.'.languages'}) { |
|
@languages=(@languages,split(/\s*(\,|\;|\:)\s*/, |
|
$env{'course.'.$env{'request.course.id'}.'.languages'})); |
|
} |
|
|
|
if ($env{'environment.languages'}) { |
|
@languages=(@languages, |
|
split(/\s*(\,|\;|\:)\s*/,$env{'environment.languages'})); |
|
} |
|
my $browser=$ENV{'HTTP_ACCEPT_LANGUAGE'}; |
|
if ($browser) { |
|
my @browser = |
|
map { (split(/\s*;\s*/,$_))[0] } (split(/\s*,\s*/,$browser)); |
|
push(@languages,@browser); |
|
} |
|
|
|
foreach my $domtype ($env{'user.domain'},$env{'request.role.domain'}, |
|
$Apache::lonnet::perlvar{'lonDefDomain'}) { |
|
if ($domtype ne '') { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($domtype); |
|
if ($domdefs{'lang_def'} ne '') { |
|
push(@languages,$domdefs{'lang_def'}); |
|
} |
|
} |
|
} |
|
return &get_genlanguages(@languages); |
|
} |
|
|
|
sub get_genlanguages { |
|
my (@languages) = @_; |
|
# turn "en-ca" into "en-ca,en" |
|
my @genlanguages; |
|
foreach my $lang (@languages) { |
|
unless ($lang=~/\w/) { next; } |
|
push(@genlanguages,$lang); |
|
if ($lang=~/(\-|\_)/) { |
|
push(@genlanguages,(split(/(\-|\_)/,$lang))[0]); |
|
} |
|
} |
|
#uniqueify the languages list |
|
my %count; |
|
@genlanguages = map { $count{$_}++ == 0 ? $_ : () } @genlanguages; |
|
return @genlanguages; |
|
} |
|
|
|
sub languages { |
sub languages { |
my ($possible_langs) = @_; |
my ($possible_langs) = @_; |
my @preferred_langs = &preferred_languages(); |
my @preferred_langs = &Apache::lonlocal::preferred_languages(); |
if (!ref($possible_langs)) { |
if (!ref($possible_langs)) { |
if( wantarray ) { |
if( wantarray ) { |
return @preferred_langs; |
return @preferred_langs; |
Line 3221 sub relative_to_absolute {
|
Line 3207 sub relative_to_absolute {
|
} |
} |
$thisdir=~s-/[^/]*$--; |
$thisdir=~s-/[^/]*$--; |
foreach my $link (@rlinks) { |
foreach my $link (@rlinks) { |
unless (($link=~/^http:\/\//i) || |
unless (($link=~/^https?\:\/\//i) || |
($link=~/^\//) || |
($link=~/^\//) || |
($link=~/^javascript:/i) || |
($link=~/^javascript:/i) || |
($link=~/^mailto:/i) || |
($link=~/^mailto:/i) || |
Line 3930 sub get_domainconf {
|
Line 3916 sub get_domainconf {
|
if (ref($domconfig{'login'}) eq 'HASH') { |
if (ref($domconfig{'login'}) eq 'HASH') { |
if (keys(%{$domconfig{'login'}})) { |
if (keys(%{$domconfig{'login'}})) { |
foreach my $key (keys(%{$domconfig{'login'}})) { |
foreach my $key (keys(%{$domconfig{'login'}})) { |
$designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; |
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}; |
|
} |
} |
} |
} else { |
} else { |
$legacy{'login'} = 1; |
$legacy{'login'} = 1; |
Line 4641 table#LC_mainmenu td.LC_mainmenu_column
|
Line 4634 table#LC_mainmenu td.LC_mainmenu_column
|
.LC_menubuttons_link { |
.LC_menubuttons_link { |
text-decoration: none; |
text-decoration: none; |
} |
} |
#2008--9-5: new menu style sheet.Changed category |
/*2008--9-5: new menu style sheet.Changed category*/ |
.LC_menubuttons_category { |
.LC_menubuttons_category { |
color: $font; |
color: $font; |
background: $pgbg; |
background: $pgbg; |
Line 4712 td.LC_menubuttons_img {
|
Line 4705 td.LC_menubuttons_img {
|
font-size: smaller; |
font-size: smaller; |
} |
} |
|
|
|
.LC_mail_functions { |
|
font-weight: bold; |
|
} |
|
|
table.LC_aboutme_port { |
table.LC_aboutme_port { |
border: 0px; |
border: 0px; |
border-collapse: collapse; |
border-collapse: collapse; |
Line 4744 table.LC_prior_tries tr th {
|
Line 4741 table.LC_prior_tries tr th {
|
background-color: $data_table_head; |
background-color: $data_table_head; |
font-size: smaller; |
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_data_table tr.LC_odd_row > td, |
table.LC_aboutme_port tr td { |
table.LC_aboutme_port tr td { |
background-color: $data_table_light; |
background-color: $data_table_light; |
Line 5520 fieldset#LC_mainmenu_fieldset {
|
Line 5522 fieldset#LC_mainmenu_fieldset {
|
margin:0px 10px 10px 0px; |
margin:0px 10px 10px 0px; |
|
|
} |
} |
|
|
|
div.LC_createcourse { |
|
margin: 10px 10px 10px 10px; |
|
} |
|
|
END |
END |
} |
} |
|
|
Line 6550 sub default_quota {
|
Line 6557 sub default_quota {
|
if ($inststatus ne '') { |
if ($inststatus ne '') { |
my @statuses = split(/:/,$inststatus); |
my @statuses = split(/:/,$inststatus); |
foreach my $item (@statuses) { |
foreach my $item (@statuses) { |
if ($quotahash{'quotas'}{$item} ne '') { |
if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { |
if ($defquota eq '') { |
if ($quotahash{'quotas'}{'defaultquota'}{$item} ne '') { |
$defquota = $quotahash{'quotas'}{$item}; |
if ($defquota eq '') { |
$settingstatus = $item; |
$defquota = $quotahash{'quotas'}{'defaultquota'}{$item}; |
} elsif ($quotahash{'quotas'}{$item} > $defquota) { |
$settingstatus = $item; |
$defquota = $quotahash{'quotas'}{$item}; |
} elsif ($quotahash{'quotas'}{'defaultquota'}{$item} > $defquota) { |
$settingstatus = $item; |
$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 ($defquota eq '') { |
if ($defquota eq '') { |
$defquota = $quotahash{'quotas'}{'default'}; |
if (ref($quotahash{'quotas'}{'defaultquota'}) eq 'HASH') { |
|
$defquota = $quotahash{'quotas'}{'defaultquota'}{'default'}; |
|
} else { |
|
$defquota = $quotahash{'quotas'}{'default'}; |
|
} |
$settingstatus = 'default'; |
$settingstatus = 'default'; |
} |
} |
} else { |
} else { |
Line 9043 sub construct_course {
|
Line 9066 sub construct_course {
|
'policy.email', |
'policy.email', |
'comment.email', |
'comment.email', |
'pch.users.denied', |
'pch.users.denied', |
'plc.users.denied'], |
'plc.users.denied', |
|
'hidefromcat', |
|
'categories'], |
$$crsudom,$$crsunum); |
$$crsudom,$$crsunum); |
} |
} |
|
|
Line 9501 sub init_user_environment {
|
Line 9526 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"; |
$env{'user.environment'} = "$lonids/$cookie.id"; |
|
|
if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id", |
if (tie(my %disk_env,'GDBM_File',"$lonids/$cookie.id", |
Line 9539 sub _add_to_env {
|
Line 9569 sub _add_to_env {
|
# --- Get the symbolic name of a problem and the url |
# --- Get the symbolic name of a problem and the url |
sub get_symb { |
sub get_symb { |
my ($request,$silent) = @_; |
my ($request,$silent) = @_; |
(my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
(my $url=$env{'form.url'}) =~ s-^https?\://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; |
my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); |
my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); |
if ($symb eq '') { |
if ($symb eq '') { |
if (!$silent) { |
if (!$silent) { |