--- loncom/interface/lonprintout.pm 2019/02/05 19:03:38 1.627.2.23.2.1
+++ loncom/interface/lonprintout.pm 2019/07/31 20:10:26 1.627.2.28
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Printout
#
-# $Id: lonprintout.pm,v 1.627.2.23.2.1 2019/02/05 19:03:38 raeburn Exp $
+# $Id: lonprintout.pm,v 1.627.2.28 2019/07/31 20:10:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -157,7 +157,7 @@ sub create_incomplete_folder_selstud_hel
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_PEOPLE_SEQ',
'Select problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'CHOOSE_STUDENTS_INCOMPLETE',
$map,
@@ -206,7 +206,7 @@ sub create_incomplete_course_helper {
my $resource_chooser = &generate_resource_chooser('INCOMPLETE_PROBLEMS_COURSE_RESOURCES',
'Select problem(s) to print',
- 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1"',
+ 'multichoice = "1" suppressEmptySequences="0" addstatus="1" closeallpagtes="1" modallink="1"',
'RESOURCES',
'INCOMPLETE_PROBLEMS_COURSE_STUDENTS',
'',
@@ -252,7 +252,7 @@ sub create_incomplete_folder_helper {
my $resource_chooser = &generate_resource_chooser('CHOOSE_INCOMPLETE_SEQ',
'Select problem(s) to print',
- 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1"',
+ 'multichoice="1", toponly ="1", addstatus="1", closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -306,7 +306,8 @@ CHOOSE_STUDENTS
# this_state - State name of the chooser.
# prompt_text - Text to use to prompt user.
# resource_options - Resource tag options e.g.
-# "multichoice='1', toponly='1', addstatus='1'"
+# "multichoice='1', toponly='1', addstatus='1',
+# modallink='1'"
# that control the selection and appearance of the
# resource selector.
# variable - Name of the variable to hold the choice
@@ -847,8 +848,8 @@ sub set_font_size {
if ($font_size ne '') {
$text =~ s/\\begin\{document}/\\begin{document}{\\$font_size/;
+ $text =~ s/\\end\{document}/}\\end{document}/;
}
- $text =~ s/\\end\{document}/}\\end{document}/;
return $text;
@@ -1237,7 +1238,7 @@ sub is_valid_alpha_code {
sub is_code_valid {
my ($code_value, $code_option) = @_;
my ($code_type, $code_length) = ('letter', 6); # defaults.
- my @lines = &Apache::lonnet::get_scantronformat_file();
+ my @lines = &Apache::grades::get_scantronformat_file();
foreach my $line (@lines) {
next if (($line =~ /^\#/) || ($line eq ''));
my ($name, $type, $length) = (split(/:/, $line))[0,2,4];
@@ -3236,7 +3237,7 @@ ENDPART
my $single_code = $helper->{'VARS'}->{'SINGLE_CODE'};
my $selected_code = $helper->{'VARS'}->{'CODE_SELECTED_FROM_LIST'};
my $code_option=$helper->{'VARS'}->{'CODE_OPTION'};
- my @lines = &Apache::lonnet::get_scantronformat_file();
+ my @lines = &Apache::grades::get_scantronformat_file();
my ($code_type,$code_length,$bubbles_per_row)=('letter',6,10);
foreach my $line (@lines) {
chomp($line);
@@ -3454,12 +3455,35 @@ ENDPART
$URLback=$helper->{'VARS'}->{'filename'};
} elsif ($helper->{VARS}{'symb'}) {
my ($map, $id, $url) = &Apache::lonnet::decode_symb($helper->{VARS}{'symb'});
+ my $cdom =$env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $cnum =$env{'course.'.$env{'request.course.id'}.'.num'};
+ my ($anchor,$usehttp);
$url = &Apache::lonnet::clutter($url);
+ if (($ENV{'SERVER_PORT'} == 443) && ($env{'request.course.id'}) &&
+ (($url =~ m{^\Q/public/$cdom/$cnum/syllabus\E($|\?)}) ||
+ ($url =~ m{^\Q/adm/wrapper/ext/\E(?!https:)}))) {
+ unless (&Apache::lonnet::uses_sts()) {
+ $usehttp = 1;
+ }
+ }
if ($env{'request.enc'}) {
$url = &Apache::lonenc::encrypted($url);
}
if ($url ne '') {
- $URLback = $url.(($url =~ /\?/) ? '&':'?').'symb='.$helper->{VARS}{'symb'};
+ my $symb = $helper->{VARS}{'symb'};
+ if ($url =~ m{^\Q/adm/wrapper/ext/\E}) {
+ my $link = $url;
+ ($link,$anchor) = ($url =~ /^([^\#]+)(?:|(\#[^\#]+))$/);
+ if ($anchor) {
+ ($symb) = ($helper->{VARS}{'symb'} =~ /^([^\#]+)/);
+ }
+ $url = $link;
+ }
+ $URLback = $url;
+ if ($usehttp) {
+ $URLback .= (($URLback =~ /\?/) ? '&':'?').'usehttp=1';
+ }
+ $URLback .= (($URLback =~ /\?/) ? '&':'?').'symb='.&escape($symb.$anchor);
}
}
#
@@ -4062,6 +4086,7 @@ sub printHelper {
}
if ($env{'form.url'}) {
$helper->{VARS}->{'symb'} = &Apache::lonnet::symbread($helper->{VARS}->{'postdata'});
+
}
if ($helper->{VARS}->{'symb'} ne '') {
$helper->{VARS}->{'symb'}=
@@ -4103,7 +4128,7 @@ sub printHelper {
my $navmap = Apache::lonnavmaps::navmap->new();
if (ref($navmap)) {
my $res = $navmap->getBySymb($symb);
- if (ref($res)) {
+ if (ref($res)) {
$res_printable = $res->resprintable(); #printability in course context
($res_printstartdate, $res_printenddate) = &get_print_dates($res);
($course_open, $course_close) = &course_print_dates($res);
@@ -4230,7 +4255,7 @@ sub printHelper {
}
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' toponly='1' addstatus='1' closeallpages='1'",
+ "multichoice='1' toponly='1' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
$url,
@@ -4240,7 +4265,7 @@ sub printHelper {
$helperFragment .= &generate_resource_chooser('CHOOSE_RESOURCES_PAGE',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$url,
@@ -4305,7 +4330,7 @@ sub printHelper {
'CHOOSE_PROBLEMS_HTML'];
my $helperFragment = &generate_resource_chooser('CHOOSE_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4314,7 +4339,7 @@ sub printHelper {
$start_new_option);
$helperFragment .= &generate_resource_chooser('CHOOSE_PROBLEMS_HTML',
'Select Resource(s) to print',
- 'multichoice="1" toponly="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" toponly="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
$map,
@@ -4362,7 +4387,7 @@ ALL_PROBLEMS
&Apache::lonxml::xmlparse($r, 'helper',
&generate_resource_chooser('ALL_PROBLEMS',
'Select Problem(s) to print',
- 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PAGESIZE',
'',
@@ -4371,7 +4396,7 @@ ALL_PROBLEMS
$start_new_option) .
&generate_resource_chooser('ALL_RESOURCES',
'Select Resource(s) to print',
- " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1'",
+ " toponly='0' multichoice='1' suppressEmptySequences='0' addstatus='1' closeallpages='1' modallink='1'",
'RESOURCES',
'PAGESIZE',
'',
@@ -4379,7 +4404,7 @@ ALL_PROBLEMS
$start_new_option) .
&generate_resource_chooser('ALL_PROBLEMS_STUDENTS',
'Select Problem(s) to print',
- 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1"',
+ 'toponly="0" multichoice="1" suppressEmptySequences="0" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'STUDENTS1',
'',
@@ -4423,7 +4448,7 @@ ALL_PROBLEMS
#
my $resource_selector= &generate_resource_chooser('SELECT_PROBLEMS',
'Select resources to print',
- 'multichoice="1" addstatus="1" closeallpages="1"',
+ 'multichoice="1" addstatus="1" closeallpages="1" modallink="1"',
'RESOURCES',
'PRINT_FORMATTING',
$map,
@@ -4434,7 +4459,7 @@ ALL_PROBLEMS
'PRINT_FORMATTING').
&generate_resource_chooser('CHOOSE_STUDENTS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4501,7 +4526,7 @@ ALL_PROBLEMS
}
- my @lines = &Apache::lonnet::get_scantronformat_file();
+ my @lines = &Apache::grades::get_scantronformat_file();
my $codechoice='';
foreach my $line (@lines) {
my ($name,$description,$code_type,$code_length)=
@@ -4532,7 +4557,7 @@ ALL_PROBLEMS
$namechoice) .
&generate_resource_chooser('SELECT_PROBLEMS_PAGE',
'Select Problem(s) to print',
- "multichoice='1' addstatus='1' closeallpages ='1'",
+ "multichoice='1' addstatus='1' closeallpages ='1' modallink='1'",
'RESOURCES',
'PRINT_FORMATTING',
$url,
@@ -4556,7 +4581,7 @@ ALL_PROBLEMS
PRINT_FORMATTING
Select resources for the assignment
+ closeallpages="1" modallink="1">
return $isNotMap;
$map
return $symbFilter;
@@ -4701,7 +4726,7 @@ CHOOSE_FROM_SUBDIR
(mark desired resources then click "next" button)
+ closeallpages="1" modallink="1">
PAGESIZE
return $isNotMap
return '$escapedSequenceName';
@@ -4806,7 +4831,7 @@ CHOOSE_FROM_ANY_SEQUENCE
my $xmlfrag = << "FONT_SELECTION";
-
+
return 'normalsize';