version 1.1018, 2011/08/15 15:58:28
|
version 1.1028.2.1, 2011/12/26 13:47:18
|
Line 154 sub ssi_with_retries {
|
Line 154 sub ssi_with_retries {
|
# ----------------------------------------------- Filetypes/Languages/Copyright |
# ----------------------------------------------- Filetypes/Languages/Copyright |
my %language; |
my %language; |
my %supported_language; |
my %supported_language; |
|
my %latex_language; # Language name LaTeX uses for selecting hyphenation. |
my %cprtag; |
my %cprtag; |
my %scprtag; |
my %scprtag; |
my %fe; my %fd; my %fm; |
my %fe; my %fd; my %fm; |
Line 186 BEGIN {
|
Line 187 BEGIN {
|
while (my $line = <$fh>) { |
while (my $line = <$fh>) { |
next if ($line=~/^\#/); |
next if ($line=~/^\#/); |
chomp($line); |
chomp($line); |
my ($key,$two,$country,$three,$enc,$val,$sup)=(split(/\t/,$line)); |
my ($key,$two,$country,$three,$enc,$val,$sup,$latex)=(split(/\t/,$line)); |
$language{$key}=$val.' - '.$enc; |
$language{$key}=$val.' - '.$enc; |
if ($sup) { |
if ($sup) { |
$supported_language{$key}=$sup; |
$supported_language{$key}=$sup; |
} |
} |
|
if ($latex) { |
|
$latex_language{$two} = $latex; |
|
} |
} |
} |
close($fh); |
close($fh); |
} |
} |
Line 847 sub selectcourse_link {
|
Line 851 sub selectcourse_link {
|
} elsif ($selecttype eq 'Course/Community') { |
} elsif ($selecttype eq 'Course/Community') { |
$linktext = &mt('Select Course/Community'); |
$linktext = &mt('Select Course/Community'); |
$type = ''; |
$type = ''; |
|
} elsif ($selecttype eq 'Select') { |
|
$linktext = &mt('Select'); |
|
$type = ''; |
} |
} |
return '<span class="LC_nobreak">' |
return '<span class="LC_nobreak">' |
."<a href='" |
."<a href='" |
Line 3227 sub languagedescription {
|
Line 3234 sub languagedescription {
|
($supported_language{$code}?' ('.&mt('interface available').')':''); |
($supported_language{$code}?' ('.&mt('interface available').')':''); |
} |
} |
|
|
|
=pod |
|
|
|
=item * &plainlanguagedescription |
|
|
|
Returns both the plain language description (e.g. 'Creoles and Pidgins, English-based (Other)') |
|
and the language character encoding (e.g. ISO) separated by a ' - ' string. |
|
|
|
=cut |
|
|
sub plainlanguagedescription { |
sub plainlanguagedescription { |
my $code=shift; |
my $code=shift; |
return $language{$code}; |
return $language{$code}; |
} |
} |
|
|
|
=pod |
|
|
|
=item * &supportedlanguagecode |
|
|
|
Returns the supported language code (e.g. sptutf maps to pt) given a language |
|
code. |
|
|
|
=cut |
|
|
sub supportedlanguagecode { |
sub supportedlanguagecode { |
my $code=shift; |
my $code=shift; |
return $supported_language{$code}; |
return $supported_language{$code}; |
Line 3239 sub supportedlanguagecode {
|
Line 3264 sub supportedlanguagecode {
|
|
|
=pod |
=pod |
|
|
|
=item * &latexlanguage() |
|
|
|
Given a language key code returns the correspondnig language to use |
|
to select the correct hyphenation on LaTeX printouts. This is undef if there |
|
is no supported hyphenation for the language code. |
|
|
|
=cut |
|
|
|
sub latexlanguage { |
|
my $code = shift; |
|
return $latex_language{$code}; |
|
} |
|
|
|
=pod |
|
|
=item * ©rightids() |
=item * ©rightids() |
|
|
returns list of all copyrights |
returns list of all copyrights |
Line 4443 sub get_legacy_domconf {
|
Line 4483 sub get_legacy_domconf {
|
close($fh); |
close($fh); |
} |
} |
} |
} |
if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') { |
if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/lonDomLogos/'.$udom.'.gif') { |
$legacyhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif"; |
$legacyhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif"; |
} |
} |
return %legacyhash; |
return %legacyhash; |
Line 4529 sub designparm {
|
Line 4569 sub designparm {
|
|
|
=item * &authorspace() |
=item * &authorspace() |
|
|
Inputs: ./. |
Inputs: $url (usually will be undef). |
|
|
Returns: Path to the Construction Space of the current user's |
Returns: Path to Construction Space containing the resource or |
accessed author space |
directory being viewed (or for which action is being taken). |
The author space will be that of the current user |
If $url is provided, and begins /priv/<domain>/<uname> |
when accessing the own author space |
the path will be that portion of the $context argument. |
and that of the co-author/assistent co-author |
Otherwise the path will be for the author space of the current |
when accessing the co-author's/assistent co-author's |
user when the current role is author, or for that of the |
space |
co-author/assistant co-author space when the current role |
|
is co-author or assistant co-author. |
|
|
=cut |
=cut |
|
|
sub authorspace { |
sub authorspace { |
|
my ($url) = @_; |
|
if ($url ne '') { |
|
if ($url =~ m{^(/priv/$match_domain/$match_username/)}) { |
|
return $1; |
|
} |
|
} |
my $caname = ''; |
my $caname = ''; |
if ($env{'request.role'} =~ /^ca|^aa/) { |
my $cadom = ''; |
(undef,$caname) = |
if ($env{'request.role'} =~ /^(?:ca|aa)/) { |
|
($cadom,$caname) = |
($env{'request.role'}=~/($match_domain)\/($match_username)$/); |
($env{'request.role'}=~/($match_domain)\/($match_username)$/); |
} else { |
} elsif ($env{'request.role'} =~ m{^au\./($match_domain)/}) { |
$caname = $env{'user.name'}; |
$caname = $env{'user.name'}; |
|
$cadom = $env{'user.domain'}; |
|
} |
|
if (($caname ne '') && ($cadom ne '')) { |
|
return "/priv/$cadom/$caname/"; |
} |
} |
return '/priv/'.$caname.'/'; |
return; |
} |
} |
|
|
############################################## |
############################################## |
Line 4577 sub head_subbox {
|
Line 4629 sub head_subbox {
|
|
|
=item * &CSTR_pageheader() |
=item * &CSTR_pageheader() |
|
|
Inputs: ./. |
Input: (optional) filename from which breadcrumb trail is built. |
|
In most cases no input as needed, as $env{'request.filename'} |
|
is appropriate for use in building the breadcrumb trail. |
|
|
Returns: HTML div with CSTR path and recent box |
Returns: HTML div with CSTR path and recent box |
To be included on Construction Space pages |
To be included on Construction Space pages |
Line 4585 Returns: HTML div with CSTR path and rec
|
Line 4639 Returns: HTML div with CSTR path and rec
|
=cut |
=cut |
|
|
sub CSTR_pageheader { |
sub CSTR_pageheader { |
# this is for resources; directories have customtitle, and crumbs |
my ($trailfile) = @_; |
# and select recent are created in lonpubdir.pm |
if ($trailfile eq '') { |
my ($uname,$thisdisfn)= |
$trailfile = $env{'request.filename'}; |
($env{'request.filename'} =~ m|^/home/([^/]+)/public_html/(.*)|); |
} |
my $formaction='/priv/'.$uname.'/'.$thisdisfn; |
|
$formaction=~s/\/+/\//g; |
# this is for resources; directories have customtitle, and crumbs |
|
# and select recent are created in lonpubdir.pm |
|
|
|
my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'}; |
|
my ($udom,$uname,$thisdisfn)= |
|
($trailfile =~ m{^\Q$londocroot\E/priv/([^/]+)/([^/]+)/(.*)$}); |
|
my $formaction = "/priv/$udom/$uname/$thisdisfn"; |
|
$formaction =~ s{/+}{/}g; |
|
|
my $parentpath = ''; |
my $parentpath = ''; |
my $lastitem = ''; |
my $lastitem = ''; |
Line 4607 sub CSTR_pageheader {
|
Line 4668 sub CSTR_pageheader {
|
.'<b>'.&mt('Construction Space:').'</b> ' |
.'<b>'.&mt('Construction Space:').'</b> ' |
.'<form name="dirs" method="post" action="'.$formaction |
.'<form name="dirs" method="post" action="'.$formaction |
.'" target="_top">' #FIXME lonpubdir: target="_parent" |
.'" target="_top">' #FIXME lonpubdir: target="_parent" |
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv',undef,undef); |
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv/'.$udom,undef,undef); |
|
|
if ($lastitem) { |
if ($lastitem) { |
$output .= |
$output .= |
Line 6225 ul.LC_TabContent {
|
Line 6286 ul.LC_TabContent {
|
background: $sidebg; |
background: $sidebg; |
border-bottom: solid 1px $lg_border_color; |
border-bottom: solid 1px $lg_border_color; |
list-style:none; |
list-style:none; |
margin: 0 -10px; |
margin: -1px -10px 0 -10px; |
padding: 0; |
padding: 0; |
} |
} |
|
|
Line 6248 ul.LC_TabContent li {
|
Line 6309 ul.LC_TabContent li {
|
padding: 0 16px 0 10px; |
padding: 0 16px 0 10px; |
background-color:$tabbg; |
background-color:$tabbg; |
border-bottom:solid 1px $lg_border_color; |
border-bottom:solid 1px $lg_border_color; |
border-right: solid 1px $font; |
border-left: solid 1px $font; |
} |
} |
|
|
ul.LC_TabContent .right { |
ul.LC_TabContent .right { |
Line 6347 ul.LC_TabContentBigger li.active b {
|
Line 6408 ul.LC_TabContentBigger li.active b {
|
|
|
ul.LC_CourseBreadcrumbs { |
ul.LC_CourseBreadcrumbs { |
background: $sidebg; |
background: $sidebg; |
line-height: 32px; |
height: 2em; |
padding-left: 10px; |
padding-left: 10px; |
margin: 0 0 10px 0; |
margin: 0; |
list-style-position: inside; |
list-style-position: inside; |
|
|
} |
} |
|
|
ol#LC_MenuBreadcrumbs, |
ol#LC_MenuBreadcrumbs, |
Line 6393 ol#LC_PathBreadcrumbs li a {
|
Line 6453 ol#LC_PathBreadcrumbs li a {
|
padding: 0 10px 10px 10px; |
padding: 0 10px 10px 10px; |
} |
} |
|
|
|
.LC_DocsBox { |
|
border: solid 1px $lg_border_color; |
|
padding: 0 0 10px 10px; |
|
} |
|
|
.LC_AboutMe_Image { |
.LC_AboutMe_Image { |
float:left; |
float:left; |
margin-right:10px; |
margin-right:10px; |
Line 6944 sub start_scrollbox {
|
Line 7009 sub start_scrollbox {
|
unless ($outerwidth) { $outerwidth='520px'; } |
unless ($outerwidth) { $outerwidth='520px'; } |
unless ($width) { $width='500px'; } |
unless ($width) { $width='500px'; } |
unless ($height) { $height='200px'; } |
unless ($height) { $height='200px'; } |
my $div_id; |
my ($table_id,$div_id); |
if ($id ne '') { |
if ($id ne '') { |
$div_id = " id='$id'"; |
$table_id = " id='table_$id'"; |
|
$div_id = " id='div_$id'"; |
} |
} |
return "<table style='width: $outerwidth; border: 1px solid black;'><tr><td style='width: $width;' bgcolor='#FFFFFF'><div style='overflow:auto; width:$width; height: $height;'$div_id>"; |
return "<table style='width: $outerwidth; border: 1px solid none;'$table_id><tr><td style='width: $width;' bgcolor='#FFFFFF'><div style='overflow:auto; width:$width; height: $height;'$div_id>"; |
} |
} |
|
|
sub end_scrollbox { |
sub end_scrollbox { |
Line 7116 sub get_users_function {
|
Line 7182 sub get_users_function {
|
$function='admin'; |
$function='admin'; |
} |
} |
if (($env{'request.role'}=~/^(au|ca|aa)/) || |
if (($env{'request.role'}=~/^(au|ca|aa)/) || |
($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) { |
($ENV{'REQUEST_URI'}=~ m{/^(/priv)})) { |
$function='author'; |
$function='author'; |
} |
} |
return $function; |
return $function; |
Line 8440 sub ask_for_embedded_content {
|
Line 8506 sub ask_for_embedded_content {
|
$getpropath = 1; |
$getpropath = 1; |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank') || |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank') || |
($actionurl eq '/adm/imsimport')) { |
($actionurl eq '/adm/imsimport')) { |
($uname,my $rest) = ($args->{'current_path'} =~ m{/priv/($match_username)/?(.*)$}); |
my ($udom,$uname,$rest) = ($args->{'current_path'} =~ m{/priv/($match_domain)/($match_username)/?(.*)$}); |
$url = '/home/'.$uname.'/public_html/'; |
$url = $Apache::lonnet::perlvar{'lonDocRoot'}."/priv/$udom/$uname/"; |
$toplevel = $url; |
$toplevel = $url; |
if ($rest ne '') { |
if ($rest ne '') { |
$url .= $rest; |
$url .= $rest; |
Line 8491 sub ask_for_embedded_content {
|
Line 8557 sub ask_for_embedded_content {
|
foreach my $path (keys(%subdependencies)) { |
foreach my $path (keys(%subdependencies)) { |
my %currsubfile; |
my %currsubfile; |
if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) { |
if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) { |
my @subdir_list = &Apache::lonnet::dirlist($url.$path,$udom,$uname,$getpropath); |
my ($sublistref,$listerror) = |
foreach my $line (@subdir_list) { |
&Apache::lonnet::dirlist($url.$path,$udom,$uname,$getpropath); |
my ($file_name,$rest) = split(/\&/,$line,2); |
if (ref($sublistref) eq 'ARRAY') { |
$currsubfile{$file_name} = 1; |
foreach my $line (@{$sublistref}) { |
|
my ($file_name,$rest) = split(/\&/,$line,2); |
|
$currsubfile{$file_name} = 1; |
|
} |
} |
} |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) { |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) { |
if (opendir(my $dir,$url.'/'.$path)) { |
if (opendir(my $dir,$url.'/'.$path)) { |
Line 8517 sub ask_for_embedded_content {
|
Line 8586 sub ask_for_embedded_content {
|
} |
} |
my %currfile; |
my %currfile; |
if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) { |
if (($actionurl eq '/adm/portfolio') || ($actionurl eq '/adm/coursegrp_portfolio')) { |
my @dir_list = &Apache::lonnet::dirlist($url,$udom,$uname,$getpropath); |
my ($dirlistref,$listerror) = |
foreach my $line (@dir_list) { |
&Apache::lonnet::dirlist($url,$udom,$uname,$getpropath); |
my ($file_name,$rest) = split(/\&/,$line,2); |
if (ref($dirlistref) eq 'ARRAY') { |
$currfile{$file_name} = 1; |
foreach my $line (@{$dirlistref}) { |
|
my ($file_name,$rest) = split(/\&/,$line,2); |
|
$currfile{$file_name} = 1; |
|
} |
} |
} |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) { |
} elsif (($actionurl eq '/adm/upload') || ($actionurl eq '/adm/testbank')) { |
if (opendir(my $dir,$url)) { |
if (opendir(my $dir,$url)) { |
Line 8799 sub upload_embedded {
|
Line 8871 sub upload_embedded {
|
my $fullpath = $dir_root.$dirpath.'/'.$path; |
my $fullpath = $dir_root.$dirpath.'/'.$path; |
my $dest = $fullpath.$fname; |
my $dest = $fullpath.$fname; |
my $url = $url_root.$dirpath.'/'.$path.$fname; |
my $url = $url_root.$dirpath.'/'.$path.$fname; |
my @parts=split(/\//,$fullpath); |
my @parts=split(/\//,"$dirpath/$path"); |
my $count; |
my $count; |
my $filepath = $dir_root; |
my $filepath = $dir_root; |
for ($count=4;$count<=$#parts;$count++) { |
foreach my $subdir (@parts) { |
$filepath .= "/$parts[$count]"; |
$filepath .= "/$subdir"; |
if ((-e $filepath)!=1) { |
if (!-e $filepath) { |
mkdir($filepath,0770); |
mkdir($filepath,0770); |
} |
} |
} |
} |
Line 8923 sub modify_html_refs {
|
Line 8995 sub modify_html_refs {
|
} elsif ($context eq 'coursedoc') { |
} elsif ($context eq 'coursedoc') { |
$container = $env{'form.primaryurl'}; |
$container = $env{'form.primaryurl'}; |
} else { |
} else { |
$container = $env{'form.filename'}; |
$container = $Apache::lonnet::perlvar{'lonDocRoot'}.$env{'form.filename'}; |
$container =~ s{^/priv/(\Q$uname\E)/(.*)}{/home/$1/public_html/$2}; |
|
} |
} |
my (%allfiles,%codebase,$output,$content); |
my (%allfiles,%codebase,$output,$content); |
my @changes = &get_env_multiple('form.namechange'); |
my @changes = &get_env_multiple('form.namechange'); |
Line 9040 sub check_for_upload {
|
Line 9111 sub check_for_upload {
|
} |
} |
$filesize = $filesize/1000; #express in k (1024?) |
$filesize = $filesize/1000; #express in k (1024?) |
my $getpropath = 1; |
my $getpropath = 1; |
my @dir_list = &Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname, |
my ($dirlistref,$listerror) = |
$getpropath); |
&Apache::lonnet::dirlist($portfolio_root.$path,$udom,$uname,$getpropath); |
my $found_file = 0; |
my $found_file = 0; |
my $locked_file = 0; |
my $locked_file = 0; |
my @lockers; |
my @lockers; |
Line 9049 sub check_for_upload {
|
Line 9120 sub check_for_upload {
|
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
$navmap = Apache::lonnavmaps::navmap->new(); |
$navmap = Apache::lonnavmaps::navmap->new(); |
} |
} |
foreach my $line (@dir_list) { |
if (ref($dirlistref) eq 'ARRAY') { |
my ($file_name,$rest)=split(/\&/,$line,2); |
foreach my $line (@{$dirlistref}) { |
if ($file_name eq $fname){ |
my ($file_name,$rest)=split(/\&/,$line,2); |
$file_name = $path.$file_name; |
if ($file_name eq $fname){ |
if ($group ne '') { |
$file_name = $path.$file_name; |
$file_name = $group.$file_name; |
if ($group ne '') { |
} |
$file_name = $group.$file_name; |
$found_file = 1; |
} |
if (&Apache::lonnet::is_locked($file_name,$udom,$uname,\@lockers) eq 'true') { |
$found_file = 1; |
foreach my $lock (@lockers) { |
if (&Apache::lonnet::is_locked($file_name,$udom,$uname,\@lockers) eq 'true') { |
if (ref($lock) eq 'ARRAY') { |
foreach my $lock (@lockers) { |
my ($symb,$crsid) = @{$lock}; |
if (ref($lock) eq 'ARRAY') { |
if ($crsid eq $env{'request.course.id'}) { |
my ($symb,$crsid) = @{$lock}; |
if (ref($navmap)) { |
if ($crsid eq $env{'request.course.id'}) { |
my $res = $navmap->getBySymb($symb); |
if (ref($navmap)) { |
foreach my $part (@{$res->parts()}) { |
my $res = $navmap->getBySymb($symb); |
my ($slot_status,$slot_time,$slot_name)=$res->check_for_slot($part); |
foreach my $part (@{$res->parts()}) { |
unless (($slot_status == $res->RESERVED) || |
my ($slot_status,$slot_time,$slot_name)=$res->check_for_slot($part); |
($slot_status == $res->RESERVED_LOCATION)) { |
unless (($slot_status == $res->RESERVED) || |
$locked_file = 1; |
($slot_status == $res->RESERVED_LOCATION)) { |
|
$locked_file = 1; |
|
} |
} |
} |
|
} else { |
|
$locked_file = 1; |
} |
} |
} else { |
} else { |
$locked_file = 1; |
$locked_file = 1; |
} |
} |
} else { |
|
$locked_file = 1; |
|
} |
} |
} |
} |
} |
} else { |
} else { |
my @info = split(/\&/,$rest); |
my @info = split(/\&/,$rest); |
my $currsize = $info[6]/1000; |
my $currsize = $info[6]/1000; |
if ($currsize < $filesize) { |
if ($currsize < $filesize) { |
my $extra = $filesize - $currsize; |
my $extra = $filesize - $currsize; |
if (($current_disk_usage + $extra) > $disk_quota) { |
if (($current_disk_usage + $extra) > $disk_quota) { |
my $msg = '<span class="LC_error">'. |
my $msg = '<span class="LC_error">'. |
&mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded if existing (smaller) file with same name (size = [_3] kilobytes) is replaced.', |
&mt('Unable to upload [_1]. (size = [_2] kilobytes). Disk quota will be exceeded if existing (smaller) file with same name (size = [_3] kilobytes) is replaced.', |
'<span class="LC_filename">'.$fname.'</span>',$filesize,$currsize).'</span>'. |
'<span class="LC_filename">'.$fname.'</span>',$filesize,$currsize).'</span>'. |
'<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.', |
'<br />'.&mt('Disk quota is [_1] kilobytes. Your current disk usage is [_2] kilobytes.', |
$disk_quota,$current_disk_usage); |
$disk_quota,$current_disk_usage); |
return ('will_exceed_quota',$msg); |
return ('will_exceed_quota',$msg); |
} |
} |
} |
} |
} |
} |
} |