--- loncom/interface/lonprintout.pm 2002/09/10 20:14:35 1.59 +++ loncom/interface/lonprintout.pm 2002/09/11 20:18:08 1.61 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.59 2002/09/10 20:14:35 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.61 2002/09/11 20:18:08 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -49,6 +49,10 @@ use Apache::grades; use Apache::edit; use Apache::File(); use POSIX qw(strftime); +use GDBM_File; + + +my %hash; sub headerform { @@ -67,27 +71,27 @@ ENDHEADER sub menu_for_output { my $r = shift; - my $symbolic = &Apache::lonnet::symbread($ENV{'form.postdata'}); -# $symbolic =~ m/([^_]+)_/; -# my $primary_sequence = '/res/'.$1; + my ($title_for_single_resource,$title_for_sequence) = &details_for_menu; + if ($title_for_single_resource ne '') {$title_for_single_resource = '"'.$title_for_single_resource.'"';} + if ($title_for_sequence ne '') {$title_for_sequence = '"'.$title_for_sequence.'"';} $r->print(<What do you want to print? Make a choice.
- Current document + Current document $title_for_single_resource (you will print what you see on the screen)
ENDMENUOUT1 if ((not $ENV{'request.role'}=~m/^au\./) and (not $ENV{'request.role'}=~m/^ca\./)) { $r->print(< All problems from the primary sequence
- The whole primary sequence (problems plus all html and xml files)
+ All problems from the primary sequence $title_for_sequence
+ The whole primary sequence $title_for_sequence (problems plus all html and xml files)
ENDMENUOUT2 } if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { $r->print(< All problems from the top level sequence

- Print assignment (all problems from the primary sequence) for group of students

+ Print assignment $title_for_sequence (all problems from the primary sequence) for group of students

ENDMENUOUT6 } my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); @@ -186,8 +190,8 @@ sub problem_choice_menu { } } -  - +  +

ENDMENUOUT1 my $i; @@ -249,10 +253,10 @@ ENDMENUOUT1 } } -  - +  +   - +

ENDDISHEADER my $i = 0; @@ -362,16 +366,13 @@ ENDPART #-- open and analyses the primary sequence my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence); my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file); - my @master_seq = &content_map($sequencefilecontents); + my @master_seq = &coming_from_hash($primary_sequence); #-- produce an output string for (my $i=0;$i<=$#master_seq;$i++) { - $_ = $master_seq[$i]; - m/\"(.*)\"/; - $_ = $1; - my $urlp = $1; + my $urlp = $master_seq[$i]; if ($choice eq 'Standard LaTeX output for the primary sequence') { $selectionmade = 2; - if ($urlp =~ m/\.(problem|exam|quiz|assess|survey|form|library)/) { + if ($urlp =~ m/\.(problem|exam|quiz|assess|survey|form|library)/) { my %moreenv; $moreenv{'form.grade_target'}='tex'; &Apache::lonnet::appenv(%moreenv); @@ -470,7 +471,7 @@ ENDPART my $sequence_file=&Apache::lonnet::filelocation("",$primary_sequence); my $sequencefilecontents=&Apache::lonnet::getfile($sequence_file); my @master_seq = &content_map($sequencefilecontents); - #loop over students + #loop over students foreach my $person (@students) { my $current_output = ''; my ($usersection,$username,$userdomain) = split /:/,$person; @@ -591,6 +592,26 @@ $r->print(<send_http_header; $r->print(&Apache::loncommon::bodytag("Printing")); + if ($ENV{'request.course.id'}) { + my $fn=$ENV{'request.course.fn'}; + tie(%hash,'GDBM_File',"$fn.db",&GDBM_READER(),0640); + } + #-- start form &headerform($r); #-- menu for output @@ -1038,11 +1076,13 @@ sub handler { #-- core part if ($ENV{'form.phase'} eq 'four') { &output_data($r); - } + } + untie %hash; return OK; - + } + 1; __END__