--- loncom/interface/lonprintout.pm 2009/07/23 10:53:03 1.559
+++ loncom/interface/lonprintout.pm 2009/08/17 10:48:28 1.560.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.559 2009/07/23 10:53:03 foxr Exp $
+# $Id: lonprintout.pm,v 1.560.2.1 2009/08/17 10:48:28 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1962,6 +1962,8 @@ ENDPART
$helper->{'VARS'}->{'symb'});
}
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_in_page') or
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_resources_in_page') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems') or
($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_resources') or # BUGBUG
@@ -1970,9 +1972,13 @@ ENDPART
#-- produce an output string
- if ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') {
+ if (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems') or
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_in_page') ) {
$selectionmade = 2;
- } elsif ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') {
+ } elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_problems_pages') or
+ ($helper->{'VARS'}->{'PRINT_TYPE'} eq 'map_resources_in_page'))
+ {
+ &Apache::lonnet::logthis("Selectionmade => 3");
$selectionmade = 3;
} elsif (($helper->{'VARS'}->{'PRINT_TYPE'} eq 'all_problems')
) {
@@ -2016,7 +2022,7 @@ ENDPART
$urlp=&Apache::lonnet::clutter($urlp);
$form{'symb'}=$master_seq[$i];
-
+ &Apache::lonnet::logthis("Element $i Sequence $sequence Middle $middle_thingy URLP $urlp");
my $assignment=&Apache::lonxml::latex_special_symbols(&Apache::lonnet::gettitle($sequence),'header'); #title of the assignment which contains this problem
if ($selectionmade==7) {$helper->{VARS}->{'assignment'}=$assignment;}
@@ -2024,11 +2030,13 @@ ENDPART
my $texversion='';
if ($urlp!~m|^/adm/|
&& $urlp=~/\.(problem|exam|quiz|assess|survey|form|library|page|xml|html|htm|xhtml|xhtm)$/) {
+ &Apache::lonnet::logthis("Problem");
$resources_printed .= $urlp.':';
&Apache::lonxml::remember_problem_counter();
$texversion.=&ssi_with_retries($urlp, $ssi_retry_count, %form);
+ &Apache::lonnet::logthis("texversion so far: $texversion");
if ($urlp=~/\.page$/) {
-
+ &Apache::lonnet::("Special page actions");
($texversion,my $number_of_columns_page) = &page_cleanup($texversion);
if ($number_of_columns_page > $number_of_columns) {$number_of_columns=$number_of_columns_page;}
$texversion =~ s/\\end{document}\d*/\\end{document}/;
@@ -2050,6 +2058,7 @@ ENDPART
$texversion=~s/(\\keephidden{ENDOFPROBLEM})/$answer$1/;
} else {
if ($urlp=~/\.(problem|exam|quiz|assess|survey|form|library)$/) {
+ &Apache::lonnet::logthis("problem printing");
$texversion=&print_latex_header($helper->{'VARS'}->{'LATEX_TYPE'});
$texversion =~ s/\\begin{document}//;
my $title = &Apache::lonnet::gettitle($master_seq[$i]);
@@ -2095,6 +2104,7 @@ ENDPART
}
}
$result .= $texversion;
+ &Apache::lonnet::logthis("About to set rem header true with $result");
$flag_latex_header_remove = 'YES';
} elsif ($urlp=~/\/(smppg|syllabus|aboutme|bulletinboard)$/) {
$form{'latex_type'}=$helper->{'VARS'}->{'LATEX_TYPE'};
@@ -2927,6 +2937,8 @@ sub printHelper {
$subdir = substr($helper->{VARS}->{'filename'},
0, rindex($helper->{VARS}->{'filename'}, '/') + 1);
} else {
+ # From course space:
+
if ($symb ne '') {
($map, $id, $url) = &Apache::lonnet::decode_symb($symb);
$helper->{VARS}->{'postdata'} =
@@ -2934,9 +2946,9 @@ sub printHelper {
} else {
$url = $helper->{VARS}->{'postdata'};
$is_published=1; # From resource space.
+ &Apache::lonnet::logthis("Resource url $url");
}
$url = &Apache::lonnet::clutter($url);
-
if (!$resourceTitle) { # if the resource doesn't have a title, use the filename
my $postdata = $helper->{VARS}->{'postdata'};
$resourceTitle = substr($postdata, rindex($postdata, '/') + 1);
@@ -2995,15 +3007,73 @@ sub printHelper {
"before selected').
"' variable='FINISHPAGE' />";
}
+ # some debugging:
+ {
+ my $varspostdata = $helper->{VARS}->{'postdata'};
+ my $varsassignment = $helper->{VARS}->{'assignment'};
+ my $debugnavmap = Apache::lonnavmaps::navmap->new();
+ my @dbgresources = $debugnavmap->retrieveResources($url);
+ if(defined($dbgresources[0])) {
+ my $debugispage = $dbgresources[0]->is_page();
+ my $debugtitle = $dbgresources[0]->title();
+ my $resourcesymb = $dbgresources[0]->symb();
+ my ($pagemap, $pageid, $pageurl) = &Apache::lonnet::decode_symb($symb);
+ &Apache::lonnet::logthis("post: $varspostdata ass: $varsassignment is page: $debugispage");
+ if ($debugispage) {
+ push @{$printChoices},
+ [&mt('Selected [_1]Problems[_2] from page [_3]', '', '', ''.$debugtitle.''),
+ 'map_problems_in_page',
+ 'CHOOSE_PROBLEMS_PAGE'];
+ push @{$printChoices},
+ [&mt('Selected [_1]Resources[_2] from page [_3]', '', '', ''.$debugtitle.''),
+ 'map_resources_in_page',
+ 'CHOOSE_RESOURCES_PAGE'];
+ }
+ &Apache::lonnet::logthis("Pushing problems/resources from folder. $debugtitle");
+ &Apache::lonnet::logthis("Map url: $url");
+ &Apache::lonnet::logthis("Decoded symb: pagemap $pagemap id: $pageid url: $pageurl");
+ my $helperFragment = <
+
+ PAGESIZE
+ return $isProblem;
+ $pagemap
+ return $symbFilter;
+ $start_new_option
+
+
+
+
+
+ PAGESIZE
+ return $isNotMap;
+ $url
+ return $symbFilter;
+ $start_new_option
+
+
+HELPERFRAGMENT
+
+ &Apache::lonxml::xmlparse($r, 'helper', $helperFragment);
+
+ }
+ }
if (($helper->{'VARS'}->{'construction'} ne '1' ) &&
$helper->{VARS}->{'postdata'} &&
$helper->{VARS}->{'assignment'}) {
# Allow problems from sequence
- push @{$printChoices}, [&mt('Selected [_1]Problems[_2] from folder [_3]','','',''.$sequenceTitle.''), 'map_problems', 'CHOOSE_PROBLEMS'];
+ push @{$printChoices},
+ [&mt('Selected [_1]Problems[_2] from folder [_3]','','',''.$sequenceTitle.''),
+ 'map_problems',
+ 'CHOOSE_PROBLEMS'];
# Allow all resources from sequence
- push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3]','','',''.$sequenceTitle.''), 'map_problems_pages', 'CHOOSE_PROBLEMS_HTML'];
-
+ push @{$printChoices}, [&mt('Selected [_1]Resources[_2] from folder [_3]','','',''.$sequenceTitle.''),
+ 'map_problems_pages',
+ 'CHOOSE_PROBLEMS_HTML'];
+ &Apache::lonnet::logthis("Map url : $map");
my $helperFragment = <
Select sorting order of printout
+
+
Sort by section then student
Sort by students across sections.
@@ -4009,7 +4081,7 @@ sub preprocess {
($papersize) = split(/ /, $papersize);
- $laystyle = &map_laystyle($laystyle);
+ $laystyle = &Apache::lonprintout::map_laystyle($laystyle);
# Figure out some good defaults for the print out and set them: