version 1.486, 2006/10/16 10:32:46
|
version 1.492, 2006/11/20 11:01:50
|
Line 38 use Apache::grades;
|
Line 38 use Apache::grades;
|
use Apache::edit; |
use Apache::edit; |
use Apache::File(); |
use Apache::File(); |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
use Apache::lonratedt; |
use LONCAPA::map(); |
use POSIX qw(strftime); |
use POSIX qw(strftime); |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Carp; |
use Carp; |
use lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
use LONCAPA; |
|
|
my %perm; |
my %perm; |
Line 61 my $resources_printed;
|
Line 60 my $resources_printed;
|
# |
# |
sub printf_style_subst { |
sub printf_style_subst { |
my ($item, $format_string, $repl) = @_; |
my ($item, $format_string, $repl) = @_; |
|
my $result = ""; |
while ($format_string =~ /%\d*$item/) { |
while ($format_string =~ /(%)(\d*)\Q$item\E/g ) { |
my $start = $-[0]; |
my $fmt = $1; |
my $end = $+[0]; |
my $size = $2; |
my $len = $end - $start; |
|
|
|
# see if we need to truncate: |
|
|
|
my $subst = $repl; |
my $subst = $repl; |
my $fmt = substr($format_string, $start, $len); |
|
my $size = $fmt; |
|
$size =~ s/%(\d*)$item/$1/; |
|
if ($size ne "") { |
if ($size ne "") { |
$subst = substr($subst, 0, $size); |
$subst = substr($subst, 0, $size); |
} |
|
$format_string =~ s/%(\d*)$item/$subst/; |
# Here's a nice edge case.. supose the end of the |
|
# substring is a \. In that case may have just |
|
# chopped off a TeX escape... in that case, we append |
|
# " " for the trailing character, and let the field |
|
# spill over a bit (sigh). |
|
# We don't just chop off the last character in order to deal |
|
# with one last pathology, and that would be if substr had |
|
# trimmed us to e.g. \\\ |
|
|
|
|
|
if ($subst =~ /\\$/) { |
|
$subst .= " "; |
|
} |
|
} |
|
my $item_pos = pos($format_string); |
|
$result .= substr($format_string, 0, $item_pos - length($size) -2) . $subst; |
|
$format_string = substr($format_string, pos($format_string)); |
} |
} |
|
|
return $format_string; |
# Put the residual format string into the result: |
|
|
|
$result .= $format_string; |
|
|
|
return $result; |
} |
} |
|
|
|
|
Line 135 sub format_page_header {
|
Line 146 sub format_page_header {
|
$format = &printf_style_subst("a", $format, $assignment); |
$format = &printf_style_subst("a", $format, $assignment); |
$format = &printf_style_subst("c", $format, $course); |
$format = &printf_style_subst("c", $format, $course); |
$format = &printf_style_subst("n", $format, $student); |
$format = &printf_style_subst("n", $format, $student); |
|
|
|
# If the user put %'s in the format string, they must be escaped |
|
# to \% else LaTeX will think they are comments and terminate |
|
# the line.. which is bad!!! |
|
|
|
|
} |
} |
|
|
|
|
Line 158 sub num_to_letters {
|
Line 175 sub num_to_letters {
|
sub letters_to_num { |
sub letters_to_num { |
my ($letters) = @_; |
my ($letters) = @_; |
my @letters = split('', uc($letters)); |
my @letters = split('', uc($letters)); |
my %substitution; |
my %substitution; |
my $digit = 0; |
my $digit = 0; |
foreach my $letter ('A'..'J') { |
foreach my $letter ('A'..'J') { |
$substitution{$letter} = $digit; |
$substitution{$letter} = $digit; |
Line 1148 sub print_construction_sequence {
|
Line 1165 sub print_construction_sequence {
|
if ($helper->{'VARS'}->{'curseed'}) { |
if ($helper->{'VARS'}->{'curseed'}) { |
$rndseed=$helper->{'VARS'}->{'curseed'}; |
$rndseed=$helper->{'VARS'}->{'curseed'}; |
} |
} |
my $errtext=&Apache::lonratedt::mapread($currentURL); |
my $errtext=&LONCAPA::map::mapread($currentURL); |
# |
# |
# These make this all support recursing for subsequences. |
# These make this all support recursing for subsequences. |
# |
# |
my @order = @Apache::lonratedt::order; |
my @order = @LONCAPA::map::order; |
my @resources = @Apache::lonratedt::resources; |
my @resources = @LONCAPA::map::resources; |
for (my $member=0;$member<=$#order;$member++) { |
for (my $member=0;$member<=$#order;$member++) { |
$resources[$order[$member]]=~/^([^:]*):([^:]*):/; |
$resources[$order[$member]]=~/^([^:]*):([^:]*):/; |
my $urlp=$2; |
my $urlp=$2; |
Line 1962 sub print_resources {
|
Line 1979 sub print_resources {
|
my $printed = ''; |
my $printed = ''; |
my ($username,$userdomain,$usersection) = split /:/,$person; |
my ($username,$userdomain,$usersection) = split /:/,$person; |
my $fullname = &get_name($username,$userdomain); |
my $fullname = &get_name($username,$userdomain); |
my $namepostfix; |
my $namepostfix = "\\\\"; # Both anon and not anon should get the same vspace. |
if ($person =~ 'anon') { |
if ($person =~ 'anon') { |
$namepostfix="\\\\Name: "; |
$namepostfix .="Name: "; |
$fullname = "CODE - ".$moreenv->{'CODE'}; |
$fullname = "CODE - ".$moreenv->{'CODE'}; |
} |
} |
# Fullname may have special latex characters that need \ prefixing: |
# Fullname may have special latex characters that need \ prefixing: |