version 1.504, 2007/07/25 19:15:29
|
version 1.509, 2007/09/08 23:41:49
|
Line 2222 sub init_perm {
|
Line 2222 sub init_perm {
|
} |
} |
} |
} |
|
|
|
sub get_randomly_ordered_warning { |
|
my ($helper,$map) = @_; |
|
|
|
my $message; |
|
|
|
my $postdata = $env{'form.postdata'} || $helper->{VARS}{'postdata'}; |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
my $res = $navmap->getResourceByUrl($map); |
|
if ($res) { |
|
my $func = |
|
sub { return ($_[0]->is_map() && $_[0]->randomorder); }; |
|
my @matches = $navmap->retrieveResources($res, $func,1,1,1); |
|
if (@matches) { |
|
$message = "Some of the items below are in folders set to be randomly ordered. However, when printing the contents of these folders, they will be printed in the original order for all students, not the randomized order."; |
|
} |
|
} |
|
if ($message) { |
|
return '<message type="warning">'.$message.'</message>'; |
|
} |
|
return; |
|
} |
|
|
sub printHelper { |
sub printHelper { |
my $r = shift; |
my $r = shift; |
|
|
Line 2448 HELPERFRAGMENT
|
Line 2470 HELPERFRAGMENT
|
if ($perm{'pfo'} && !$is_published && |
if ($perm{'pfo'} && !$is_published && |
($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { |
($helper->{VARS}->{'postdata'}=~/\/res\// || $helper->{VARS}->{'postdata'}=~/\/(syllabus|smppg|aboutme|bulletinboard)$/)) { |
|
|
push @{$printChoices}, ['Selected <b>Problems</b> from <b>entire course</b>', 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, [&mtn('Selected <b>Problems</b> from <b>entire course</b>'), 'all_problems', 'ALL_PROBLEMS']; |
push @{$printChoices}, ['Selected <b>Resources</b> from <b>entire course</b>', 'all_resources', 'ALL_RESOURCES']; |
push @{$printChoices}, [&mtn('Selected <b>Resources</b> from <b>entire course</b>'), 'all_resources', 'ALL_RESOURCES']; |
&Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS); |
&Apache::lonxml::xmlparse($r, 'helper', <<ALL_PROBLEMS); |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
<state name="ALL_PROBLEMS" title="Select Problem(s) to print"> |
<resource variable="RESOURCES" toponly='0' multichoice="1" |
<resource variable="RESOURCES" toponly='0' multichoice="1" |
Line 2477 ALL_PROBLEMS
|
Line 2499 ALL_PROBLEMS
|
push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>CODEd assignments</b>",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1']; |
push @{$printChoices}, [&mt("Selected <b>Problems</b> from folder <b><i>[_1]</i></b> for <b>CODEd assignments</b>",$sequenceTitle), 'problems_for_anon', 'CHOOSE_ANON1']; |
} |
} |
|
|
|
my $randomly_ordered_warning = |
|
&get_randomly_ordered_warning($helper,$map); |
|
|
# resource_selector will hold a few states that: |
# resource_selector will hold a few states that: |
# - Allow resources to be selected for printing. |
# - Allow resources to be selected for printing. |
# - Determine pagination between assignments. |
# - Determine pagination between assignments. |
Line 2488 ALL_PROBLEMS
|
Line 2513 ALL_PROBLEMS
|
# |
# |
my $resource_selector=<<RESOURCE_SELECTOR; |
my $resource_selector=<<RESOURCE_SELECTOR; |
<state name="SELECT_PROBLEMS" title="Select resources to print"> |
<state name="SELECT_PROBLEMS" title="Select resources to print"> |
|
$randomly_ordered_warning |
|
|
<nextstate>PRINT_FORMATTING</nextstate> |
<nextstate>PRINT_FORMATTING</nextstate> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
Line 2655 CHOOSE_ANON1
|
Line 2682 CHOOSE_ANON1
|
|
|
$resource_selector=<<RESOURCE_SELECTOR; |
$resource_selector=<<RESOURCE_SELECTOR; |
<state name="SELECT_RESOURCES" title="Select Resources"> |
<state name="SELECT_RESOURCES" title="Select Resources"> |
|
$randomly_ordered_warning |
|
|
<nextstate>PRINT_FORMATTING</nextstate> |
<nextstate>PRINT_FORMATTING</nextstate> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<message><br /><big><i><b>Select resources for the assignment</b></i></big><br /></message> |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
<resource variable="RESOURCES" multichoice="1" addstatus="1" |
Line 2794 CHOOSE_FROM_SUBDIR
|
Line 2823 CHOOSE_FROM_SUBDIR
|
# Allow the user to select any sequence in the course, feed it to |
# Allow the user to select any sequence in the course, feed it to |
# another resource selector for that sequence |
# another resource selector for that sequence |
if (!$helper->{VARS}->{'construction'} && !$is_published) { |
if (!$helper->{VARS}->{'construction'} && !$is_published) { |
push @$printChoices, ["Selected <b>Resources</b> from <b>selected folder</b> in course", |
push @$printChoices, [&mtn("Selected <b>Resources</b> from <b>selected folder</b> in course"), |
'select_sequences', 'CHOOSE_SEQUENCE']; |
'select_sequences', 'CHOOSE_SEQUENCE']; |
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'}; |
my $escapedSequenceName = $helper->{VARS}->{'SEQUENCE'}; |
#Escape apostrophes and backslashes for Perl |
#Escape apostrophes and backslashes for Perl |
Line 2885 CHOOSE_FROM_ANY_SEQUENCE
|
Line 2914 CHOOSE_FROM_ANY_SEQUENCE
|
Apache::lonhelper::dropdown->new(); |
Apache::lonhelper::dropdown->new(); |
|
|
addMessage("</td></tr><tr><td align='right'>". |
addMessage("</td></tr><tr><td align='right'>". |
'<label="TABLE_CONTENTS_forminput">'. |
'<label for="TABLE_CONTENTS_forminput">'. |
&mt('Print Table of Contents'). |
&mt('Print Table of Contents'). |
"</label>: </td><td>"); |
"</label>: </td><td>"); |
$paramHash = Apache::lonhelper::getParamHash(); |
$paramHash = Apache::lonhelper::getParamHash(); |
Line 2934 CHOOSE_FROM_ANY_SEQUENCE
|
Line 2963 CHOOSE_FROM_ANY_SEQUENCE
|
} |
} |
|
|
if ($helper->{'VARS'}->{'construction'}) { |
if ($helper->{'VARS'}->{'construction'}) { |
my $stylevalue=$env{'construct.style'}; |
my $stylevalue='$Apache::lonnet::env{"construct.style"}'; |
my $randseedtext=&mt("Use random seed"); |
my $randseedtext=&mt("Use random seed"); |
my $stylefiletext=&mt("Use style file"); |
my $stylefiletext=&mt("Use style file"); |
|
my $selectfiletext=&mt("Select style file"); |
|
|
my $xmlfrag .= <<"RNDSEED"; |
my $xmlfrag .= <<"RNDSEED"; |
<message><tr><td align='right'> |
<message><tr><td align='right'> |
Line 2952 CHOOSE_FROM_ANY_SEQUENCE
|
Line 2982 CHOOSE_FROM_ANY_SEQUENCE
|
</td><td></message> |
</td><td></message> |
<string variable="style_file" size="40"> |
<string variable="style_file" size="40"> |
<defaultvalue> |
<defaultvalue> |
return $env{'construct.style'}; |
return $stylevalue; |
</defaultvalue> |
</defaultvalue> |
</string><message> <a href="javascript:openbrowser('helpform','style_file_forminput','sty')">Select style file</a> </td><tr><td></message> |
</string><message> <a href="javascript:openbrowser('helpform','style_file_forminput','sty')">$selectfiletext</a> </td></tr><tr><td></td><td align="left"></message> |
<choices allowempty="1" multichoice="true" variable="showallfoils"> |
<choices allowempty="1" multichoice="true" variable="showallfoils"> |
<choice computer="1">Show all foils?</choice> |
<choice computer="1">Show all foils</choice> |
</choices> |
</choices> |
<message></td></tr></message> |
<message></td></tr></message> |
RNDSEED |
RNDSEED |
Line 3065 sub render {
|
Line 3095 sub render {
|
my $PageLayout=&mt('Page layout'); |
my $PageLayout=&mt('Page layout'); |
my $NumberOfColumns=&mt('Number of columns'); |
my $NumberOfColumns=&mt('Number of columns'); |
my $PaperType=&mt('Paper type'); |
my $PaperType=&mt('Paper type'); |
|
my $landscape=&mt('Landscape'); |
|
my $portrait=&mt('Portrait'); |
$result .= <<STATEHTML; |
$result .= <<STATEHTML; |
|
|
<hr width="33%" /> |
<hr width="33%" /> |
Line 3076 sub render {
|
Line 3108 sub render {
|
</tr> |
</tr> |
<tr> |
<tr> |
<td> |
<td> |
<label><input type="radio" name="${var}.layout" value="L" /> Landscape </label><br /> |
<label><input type="radio" name="${var}.layout" value="L" /> $landscape </label><br /> |
<label><input type="radio" name="${var}.layout" value="P" checked='1' /> Portrait </label> |
<label><input type="radio" name="${var}.layout" value="P" checked='1' /> $portrait </label> |
</td> |
</td> |
<td align="center"> |
<td align="center"> |
<select name="${var}.cols"> |
<select name="${var}.cols"> |
Line 3233 sub render {
|
Line 3265 sub render {
|
} else { |
} else { |
$size{'margin'} += 2.54; |
$size{'margin'} += 2.54; |
} |
} |
$result .= <<ELEMENTHTML; |
my %text = ('format' => 'How should each column be formatted?', |
|
'width' => 'Width:', |
|
'height' => 'Height:', |
|
'margin' => 'Left Margin:',); |
|
%text = &Apache::lonlocal::texthash(%text); |
|
|
|
$result .= <<ELEMENTHTML; |
|
|
<p>How should each column be formatted?</p> |
<p>$text{'format'}</p> |
|
|
<table cellpadding='3'> |
<table cellpadding='3'> |
<tr> |
<tr> |
<td align='right'><b>Width</b>:</td> |
<td align='right'><b>$text{'width'}</b></td> |
<td align='left'><input type='text' name='$var.width' value="$size{'width'}" size='4' /></td> |
<td align='left'><input type='text' name='$var.width' value="$size{'width'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.widthunit'> |
<select name='$var.widthunit'> |
Line 3250 sub render {
|
Line 3286 sub render {
|
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td align='right'><b>Height</b>:</td> |
<td align='right'><b>$text{'height'}</b></td> |
<td align='left'><input type='text' name="$var.height" value="$size{'height'}" size='4' /></td> |
<td align='left'><input type='text' name="$var.height" value="$size{'height'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.heightunit'> |
<select name='$var.heightunit'> |
Line 3259 sub render {
|
Line 3295 sub render {
|
</td> |
</td> |
</tr> |
</tr> |
<tr> |
<tr> |
<td align='right'><b>Left margin</b>:</td> |
<td align='right'><b>$text{'margin'}</b></td> |
<td align='left'><input type='text' name='$var.lmargin' value="$size{'margin'}" size='4' /></td> |
<td align='left'><input type='text' name='$var.lmargin' value="$size{'margin'}" size='4' /></td> |
<td align='left'> |
<td align='left'> |
<select name='$var.lmarginunit'> |
<select name='$var.lmarginunit'> |