--- loncom/interface/lonprintout.pm 2002/04/12 13:45:48 1.22 +++ loncom/interface/lonprintout.pm 2002/09/16 14:20:33 1.65 @@ -1,7 +1,7 @@ # The LearningOnline Network # Printout # -# $Id: lonprintout.pm,v 1.22 2002/04/12 13:45:48 sakharuk Exp $ +# $Id: lonprintout.pm,v 1.65 2002/09/16 14:20:33 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,11 +43,17 @@ use strict; use Apache::Constants qw(:common :http); use Apache::lonxml; use Apache::lonnet; +use Apache::loncommon; use Apache::inputtags; +use Apache::grades; use Apache::edit; use Apache::File(); +use POSIX qw(strftime); +use GDBM_File; +my %hash; + sub headerform { my $r = shift; @@ -58,26 +64,263 @@ sub headerform {
-

What do you want to print? Make a choice.


ENDHEADER + if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { + $r->print(<Path to current document: $ENV{'form.postdata'}

+ENDHEADER1 +} } sub menu_for_output { my $r = shift; - $r->print(<print(<What do you want to print? Make a choice.
- Current document -(you will print what you see on the screen)
- All problems from the primary sequence
- The whole primary sequence (problems plus all html and xml files)
- All problems from the top level sequence
+ Current document $title_for_single_resource +(prints what you just saw on the screen)
+ENDMENUOUT1 + if ((not $ENV{'request.role'}=~m/^au\./) and (not $ENV{'request.role'}=~m/^ca\./)) { + $r->print(< All problems from $title_for_sequence
+ All problems plus any html/xml files from $title_for_sequence
+ENDMENUOUT2 + } + if ($ENV{'request.role'}=~m/^cc\./ or $ENV{'request.role'}=~m/^in\./ or $ENV{'request.role'}=~m/^ta\./) { + $r->print(< All problems in this course (warning: this may be time consuming)
+
+ All problems from $title_for_sequence for selected students

+ENDMENUOUT6 + } + my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); + $subdirtoprint =~ s/\/[^\/]+$//; + if (&Apache::lonnet::allowed('bre',$subdirtoprint) eq 'F') { + $r->print(< Problems from current subdirectory $subdir_to_print
+ENDMENUOUT4 + } + $r->print(<



And what page format do you prefer?

- CBI
- CAPA
+ + + + + + + +
+ Landscape
+ Portrait
+
  + Number of columns: + + Paper size (format [width x height]): +
+
+ENDMENUOUT5 +} + + +sub problem_choice_menu { + my $r = shift; + my $subdirtoprint = &Apache::lonnet::filelocation("",$ENV{'form.url'}); + $subdirtoprint =~ s/\/[^\/]+$//; + my @list_of_files = (); + if ($ENV{'request.role'}=~m/^au\./ or $ENV{'request.role'}=~m/^ca\./) { + $subdirtoprint =~ s/^[^~]*~(\w+)\//\/home\/$1\/public_html\//; + } else { + $subdirtoprint =~ s/.*(\/res\/)/$1/; + } + my @content_directory = (); + if ($ENV{'request.role'}=~m/^au\./ or $ENV{'request.role'}=~m/^ca\./) { + @content_directory = &Apache::lonnet::dirlist($subdirtoprint,$ENV{'user.domain'}, $ENV{'user.name'},''); + } else { + @content_directory = &Apache::lonnet::dirlist($subdirtoprint); + } + for (my $iy=0;$iy<=$#content_directory;$iy++) { + my @tempo_array = split(/&/,$content_directory[$iy]); + if ($tempo_array[0] =~ m/^[^\.]+\.(problem|exam|quiz|assess|survey|form|library)$/) { + push(@list_of_files,$tempo_array[0]); + } + } + $subdirtoprint =~ s/\/$//; + for (my $i=0;$i<=$#list_of_files;$i++) { + $list_of_files[$i] = $subdirtoprint.'/'.$list_of_files[$i]; + } + $r->print(< + + + +

Mark problems which you want to print

+ +  + +

+ENDMENUOUT1 + my $i; + foreach my $file (@list_of_files) { + $r->print('
'. + $file); + $i++; + } + $r->print(< + + + +ENDMENUOUT2 +} + + +sub additional_class_menu { + my $r = shift; + $r->print(< + + + +

Mark students which assignments you want to print

+ENDMENUOUT1 + my %courselist=&Apache::lonnet::dump( + 'classlist', + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}); + my $now=time; + $r->print(< + function checkall() { + for (i=0; i +  + +  + +

+ENDDISHEADER + my $i = 0; + foreach (sort keys %courselist) { + my ($end,$start)=split(/\:/,$courselist{$_}); + my $active=1; + if (($end) && ($now>$end)) { $active=0; } + if ($active) { + my ($sname,$sdom)=split(/\:/,$_); + my %reply=&Apache::lonnet::get('environment', + ['firstname','middlename','lastname','generation'], + $sdom,$sname); + my $section=&Apache::lonnet::usection + ($sdom,$sname,$ENV{'request.course.id'}); + $r->print( + '
'. + $reply{'firstname'}.' '. + $reply{'middlename'}.' '. + $reply{'lastname'}.' '. + $reply{'generation'}. + ' ('.$_.') '.$section); + $i++; + } + } + $r->print(< + + + +ENDMENUOUT2 +} + + +sub additional_print_menu { + my $r = shift; + my $what_to_print = ''; + for (my $i=0; $i<$ENV{'form.numberofstudents'};$i++) { + $what_to_print .= ''; + } + for (my $i=0; $i<$ENV{'form.numberofproblems'};$i++) { + $what_to_print .= ''; + } + $r->print(< + + + + + +Define page layout parameters:
+Width:
+Height:
+Left margin:
+ + @@ -85,8 +328,6 @@ ENDMENUOUT } - - sub output_data { my $r = shift; $r->print(<',$first_comment); + substr($result,$first_comment,$end_comment-$first_comment+3) = ''; + $first_comment = index($result,'