--- loncom/interface/lonprintout.pm 2003/03/03 20:26:08 1.125 +++ loncom/interface/lonprintout.pm 2003/03/03 20:58:18 1.126 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.125 2003/03/03 20:26:08 albertel Exp $ +# $Id: lonprintout.pm,v 1.126 2003/03/03 20:58:18 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -370,6 +370,7 @@ ENDDISHEADER $sdom,$sname); my $section=&Apache::lonnet::usection ($sdom,$sname,$ENV{'request.course.id'}); + if ($section == -1) { $section = ''; } $r->print( '
'. $reply{'firstname'}.' '. @@ -607,7 +608,7 @@ ENDPART foreach my $person (@students) { my $current_output = ''; my ($usersection,$username,$userdomain) = split /:/,$person; - my $fullname = &Apache::grades::get_fullname($username,$userdomain); + my $fullname = &get_name($username,$userdomain); #goes through all resources, checks if they are available for current student, and produces output foreach my $curresline (@master_seq) { my ($curres,$symb) = split /&&/, $curresline; @@ -1104,6 +1105,16 @@ sub character_chart { } +sub get_name { + my ($uname,$udom)=@_; + if (!defined($uname)) { $uname=$ENV{'user.name'}; } + if (!defined($udom)) { $uname=$ENV{'user.domain'}; } + my $plainname=&Apache::loncommon::plainname($uname,$udom); + if ($plainname=~/^\s*$/) { $plainname=$uname; } + return &Apache::lonxml::latex_special_symbols($plainname,undef,undef, + 'header'); +} + sub page_format_transformation { my ($papersize,$layout,$numberofcolumns,$choice,$text,$assignment) = @_; my ($textwidth,$textheight,$oddoffset,$evenoffset); @@ -1113,14 +1124,17 @@ sub page_format_transformation { } else { ($textwidth,$textheight,$oddoffset,$evenoffset) = ($ENV{'form.width'},$ENV{'form.height'},$ENV{'form.leftmargin'},$ENV{'form.leftmargin'}); } - my $firstname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.firstname'}),'','','header'); - my $lastname = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'environment.lastname'}),'','','header'); + my $name = &get_name(); + if ($name =~ /^\s*$/) { + $name=&Apache::lonxml::latex_special_symbols($ENV{'user.name'},undef, + undef,'header'); + } my $courseidinfo = &Apache::lonxml::latex_special_symbols(&Apache::lonnet::unescape($ENV{'course.'.$ENV{'request.course.id'}.'.description'}),'','','header'); if ($layout eq 'CBI') { - $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$firstname $lastname}} \\hfill $courseidinfo} \\vskip 5 mm /; + $text =~ s/\\begin{document}/\\setlength{\\oddsidemargin}{$oddoffset}\\setlength{\\evensidemargin}{$evenoffset}\\setlength{\\topmargin}{200pt}\\setlength{\\textwidth}{$textwidth}\\setlength{\\textheight}{$textheight}\\setlength{\\parindent}{20pt}\\setlength{\\marginparwidth}{90pt}\\setlength{\\textfloatsep}{8pt plus 2\.0pt minus 4\.0pt}\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm} \\begin{document}\\setcounter{page}{1}\\noindent\\parbox{\\minipagewidth}{\\noindent\\fbox{\\textbf{$name}} \\hfill $courseidinfo} \\vskip 5 mm /; } elsif ($layout eq 'CAPA') { if ($choice ne 'All class print') { - $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$firstname $lastname} - $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/; + $text =~ s/\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\usepackage{fancyhdr}\\pagestyle{fancy}\\rhead{}\\chead{}\\lhead{\\textbf{$name} - $courseidinfo \\hfill \\thepage \\\\ \\textit{$assignment}}\\begin{document}\\voffset=-0\.8 cm\\setcounter{page}{1}/; } else { $text =~ s/\\pagestyle{fancy}\\rhead{}\\chead{}\s*\\begin{document}/\\textheight $textheight\\oddsidemargin = $evenoffset\\evensidemargin = $evenoffset\\textwidth= $textwidth\\newlength{\\minipagewidth}\\setlength{\\minipagewidth}{\\textwidth\/\$number_of_columns-0\.2cm}\\renewcommand{\\ref}{\\keephidden\}\\pagestyle{fancy}\\rhead{}\\chead{}\\begin{document}\\voffset=-0\.8cm\\setcounter{page}{1} \\vskip 5 mm /;