version 1.100, 2003/06/16 13:51:46
|
version 1.113, 2003/06/30 20:24:26
|
Line 342 $selscript
|
Line 342 $selscript
|
</head> |
</head> |
$bodytag |
$bodytag |
|
|
<a href="/adm/helper/parameter.helper">Use Assignment Parameter Helper</a>, a |
|
simpler interface to set open, due, or answer open dates for problems or sequences. |
|
|
|
<form method="post" action="/adm/parmset" name="envform"> |
<form method="post" action="/adm/parmset" name="envform"> |
<h3>Course Environment</h3> |
<h3>Course Environment</h3> |
<input type="submit" name="crsenv" value="Set Course Environment"> |
<input type="submit" name="crsenv" value="Set Course Environment"> |
</form> |
</form> |
|
<hr /> |
<form method="post" action="/adm/parmset" name="parmform"> |
<form method="post" action="/adm/parmset" name="parmform"> |
<h3>Course Assessments</h3> |
<h3>Course Assessments</h3> |
|
|
|
<a href="/adm/helper/parameter.helper">Use Assignment Parameter Helper</a>, a |
|
simpler interface to set open, due, or answer open dates for problems or |
|
sequences.<br /> <br /> |
ENDHEAD |
ENDHEAD |
|
|
if (!$have_assesments) { |
if (!$have_assesments) { |
Line 726 sub assessparms {
|
Line 728 sub assessparms {
|
"<font color=red>Unknown user '$uname' at domain '$udom'</font>"; |
"<font color=red>Unknown user '$uname' at domain '$udom'</font>"; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::usection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$ENV{'request.course.id'}); |
$ENV{'request.course.id'}); |
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message="<font color=red>". |
$message="<font color=red>". |
"User '$uname' at domain '$udom' not ". |
"User '$uname' at domain '$udom' not ". |
Line 853 sub assessparms {
|
Line 855 sub assessparms {
|
$message.='<h3>Changes can take up to 10 minutes before being active for all students</h3>'; |
$message.='<h3>Changes can take up to 10 minutes before being active for all students</h3>'; |
} |
} |
# --------------------------------------------- Devalidate cache for this child |
# --------------------------------------------- Devalidate cache for this child |
&Apache::lonnet::devalidatecourseresdata( |
&Apache::lonnet::devalidatecourseresdata( |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}, |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}); |
|
&Apache::lonnet::clear_EXT_cache_status(); |
# -------------------------------------------------------------- Get coursedata |
# -------------------------------------------------------------- Get coursedata |
%courseopt = &Apache::lonnet::dump |
%courseopt = &Apache::lonnet::dump |
('resourcedata', |
('resourcedata', |
Line 889 sub assessparms {
|
Line 892 sub assessparms {
|
|
|
&startpage($r,$id,$udom,$csec,$uname,$have_assesments); |
&startpage($r,$id,$udom,$csec,$uname,$have_assesments); |
|
|
if (!$have_assesments) { return ''; } |
if (!$have_assesments) { |
|
untie(%bighash); |
|
untie(%parmhash); |
|
return ''; |
|
} |
# if ($ENV{'form.url'}) { |
# if ($ENV{'form.url'}) { |
# $r->print('<input type="hidden" value="'.$ENV{'form.url'}. |
# $r->print('<input type="hidden" value="'.$ENV{'form.url'}. |
# '" name="url"><input type="hidden" name="command" value="set">'); |
# '" name="url"><input type="hidden" name="command" value="set">'); |
Line 904 sub assessparms {
|
Line 911 sub assessparms {
|
|
|
$r->print('<h2>'.$message.'</h2><table>'); |
$r->print('<h2>'.$message.'</h2><table>'); |
|
|
$r->print('<tr><td><hr /></td></tr>'); |
|
|
|
my $submitmessage; |
my $submitmessage; |
if (($prevvisit) || ($pschp) || ($pssymb)) { |
|
$submitmessage = "Update Display"; |
|
} else { |
|
$submitmessage = "Display"; |
|
} |
|
if (!$pssymb) { |
if (!$pssymb) { |
$r->print('<tr><td>Select Parameter Level</td><td>'); |
$r->print('<tr><td>Select Parameter Level</td><td colspan="2">'); |
$r->print('<select name="parmlev">'); |
$r->print('<select name="parmlev">'); |
foreach (reverse sort keys %alllevs) { |
foreach (reverse sort keys %alllevs) { |
$r->print('<option value="'.$alllevs{$_}.'"'); |
$r->print('<option value="'.$alllevs{$_}.'"'); |
Line 923 sub assessparms {
|
Line 923 sub assessparms {
|
$r->print('>'.$_.'</option>'); |
$r->print('>'.$_.'</option>'); |
} |
} |
$r->print("</select></td>\n"); |
$r->print("</select></td>\n"); |
|
|
$r->print('<td><input type="submit" name="dis" value="'.$submitmessage.'"></td>'); |
|
|
|
$r->print('</tr><tr><td><hr /></td>'); |
$r->print('</tr>'); |
|
|
$r->print('<tr><td>Select Enclosing Map or Folder</td>'); |
$r->print('<tr><td>Select Enclosing Map or Folder</td>'); |
$r->print('<td colspan="2"><select name="pschp">'); |
$r->print('<td colspan="2"><select name="pschp">'); |
Line 947 sub assessparms {
|
Line 945 sub assessparms {
|
|
|
$r->print('<tr><td colspan="3"><hr /><input type="checkbox"'); |
$r->print('<tr><td colspan="3"><hr /><input type="checkbox"'); |
if ($showoptions eq 'show') {$r->print(" checked ");} |
if ($showoptions eq 'show') {$r->print(" checked ");} |
$r->print(' name="showoptions" value="show" onclick="form.submit();">Show More Options<hr /></td></tr>'); |
$r->print(' name="showoptions" value="show">Show More Options<hr /></td></tr>'); |
# $r->print("<tr><td>Show: $showoptions</td></tr>"); |
# $r->print("<tr><td>Show: $showoptions</td></tr>"); |
# $r->print("<tr><td>pscat: @pscat</td></tr>"); |
# $r->print("<tr><td>pscat: @pscat</td></tr>"); |
# $r->print("<tr><td>psprt: @psprt</td></tr>"); |
# $r->print("<tr><td>psprt: @psprt</td></tr>"); |
Line 1032 sub assessparms {
|
Line 1030 sub assessparms {
|
} |
} |
|
|
} |
} |
$r->print('</table>'); |
$r->print('</table><br />'); |
|
if (($prevvisit) || ($pschp) || ($pssymb)) { |
|
$submitmessage = "Update Course Assessment Parameter Display"; |
|
} else { |
|
$submitmessage = "Set Course Assessment Parameters"; |
|
} |
|
$r->print('<input type="submit" name="dis" value="'.$submitmessage.'">'); |
|
|
# my @temp_psprt; |
# my @temp_psprt; |
# foreach my $t (@psprt) { |
# foreach my $t (@psprt) { |
Line 1075 ENDTABLETWO
|
Line 1079 ENDTABLETWO
|
} |
} |
$r->print(<<ENDTABLEHEADFOUR); |
$r->print(<<ENDTABLEHEADFOUR); |
</tr><tr><th>Assessment URL and Title</th><th>Type</th> |
</tr><tr><th>Assessment URL and Title</th><th>Type</th> |
<th>Enclosing Map or Folder</th><th>Part No.</th><th>Parameter Name</th> |
<th>Enclosing Map or Folder</th><th>Part</th><th>Parameter Name</th> |
<th>default</th><th>from Enclosing Map or Folder</th> |
<th>default</th><th>from Enclosing Map or Folder</th> |
<th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th> |
<th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th> |
ENDTABLEHEADFOUR |
ENDTABLEHEADFOUR |
Line 1372 ENDMAPONE
|
Line 1376 ENDMAPONE
|
|
|
=item crsenv |
=item crsenv |
|
|
Show course data and parameters. This is a large routine that should |
Show and set course data and parameters. This is a large routine that should |
be simplified and shortened... someday. |
be simplified and shortened... someday. |
|
|
Inputs: $r |
Inputs: $r |
Line 1390 sub crsenv {
|
Line 1394 sub crsenv {
|
'Set Course Environment Parameters'); |
'Set Course Environment Parameters'); |
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}; |
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'}; |
# -------------------------------------------------- Go through list of changes |
|
|
# |
|
# Go through list of changes |
foreach (keys %ENV) { |
foreach (keys %ENV) { |
if ($_=~/^form\.(.+)\_setparmval$/) { |
next if ($_!~/^form\.(.+)\_setparmval$/); |
my $name=$1; |
my $name = $1; |
my $value=$ENV{'form.'.$name.'_value'}; |
my $value = $ENV{'form.'.$name.'_value'}; |
if ($name eq 'newp') { |
if ($name eq 'newp') { |
$name=$ENV{'form.newp_name'}; |
$name = $ENV{'form.newp_name'}; |
} |
} |
if ($name eq 'url') { |
if ($name eq 'url') { |
$value=~s/^\/res\///; |
$value=~s/^\/res\///; |
my $bkuptime=time; |
my $bkuptime=time; |
my @tmp = &Apache::lonnet::get |
my @tmp = &Apache::lonnet::get |
('environment',['url'],$dom,$crs); |
('environment',['url'],$dom,$crs); |
$setoutput.='Backing up previous URL: '. |
$setoutput.='Backing up previous URL: '. |
&Apache::lonnet::put |
&Apache::lonnet::put |
('environment', |
('environment', |
{'top level map backup '.$bkuptime => $tmp[1] }, |
{'top level map backup '.$bkuptime => $tmp[1] }, |
$dom,$crs). |
$dom,$crs). |
'<br>'; |
'<br>'; |
|
} |
|
# |
|
# Deal with modified default spreadsheets |
|
if ($name =~ /^spreadsheet_default_(classcalc| |
|
studentcalc| |
|
assesscalc)$/x) { |
|
my $sheettype = $1; |
|
if ($sheettype eq 'classcalc') { |
|
# no need to do anything since viewing the sheet will |
|
# cause it to be updated. |
|
} elsif ($sheettype eq 'studentcalc') { |
|
# expire all the student spreadsheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} else { |
|
# expire all the assessment spreadsheets |
|
# this includes non-default spreadsheets, but better to |
|
# be safe than sorry. |
|
&Apache::lonnet::expirespread('','','assesscalc'); |
|
# expire all the student spreadsheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
} |
} |
if ($name =~ /^spreadsheet_default_(classcalc| |
} |
studentcalc| |
# |
assesscalc)$/x) { |
# Deal with the enrollment dates |
my $sheettype = $1; |
if ($name =~ /^default_enrollment_(start|end)_date$/) { |
if ($sheettype eq 'classcalc') { |
$value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value'); |
# no need to do anything since viewing the sheet will |
} |
# cause it to be updated. |
# |
} elsif ($sheettype eq 'studentcalc') { |
# Let the user know we made the changes |
# expire all the student spreadsheets |
if ($name) { |
&Apache::lonnet::expirespread('','','studentcalc'); |
my $put_result = &Apache::lonnet::put('environment', |
} else { |
{$name=>$value},$dom,$crs); |
# expire all the default assessment spreadsheets |
if ($put_result eq 'ok') { |
} |
$setoutput.='Set <b>'.$name.'</b> to <b>'.$value.'</b>.<br />'; |
|
} else { |
|
$setoutput.='Unable to set <b>'.$name.'</b> to '. |
|
'<b>'.$value.'</b> due to '.$put_result.'.<br />'; |
} |
} |
|
|
if ($name) { |
|
$setoutput.='Setting <tt>'.$name.'</tt> to <tt>'. |
|
$value.'</tt>: '. |
|
&Apache::lonnet::put |
|
('environment',{$name=>$value},$dom,$crs). |
|
'<br>'; |
|
} |
|
} |
} |
} |
} |
|
# ------------------------- Re-init course environment entries for this session |
|
|
|
&Apache::lonnet::coursedescription($ENV{'request.course.id'}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
|
|
my %values=&Apache::lonnet::dump('environment',$dom,$crs); |
my %values=&Apache::lonnet::dump('environment',$dom,$crs); |
Line 1491 sub crsenv {
|
Line 1516 sub crsenv {
|
",'spreadsheet')\">Select Spreadsheet File</a><br />", |
",'spreadsheet')\">Select Spreadsheet File</a><br />", |
'allow_limited_html_in_feedback' |
'allow_limited_html_in_feedback' |
=> '<b>Allow limited HTML in discussion posts</b><br />'. |
=> '<b>Allow limited HTML in discussion posts</b><br />'. |
'(Set value to yes to allow)', |
'(Set value to "<tt>yes</tt>" to allow)', |
'rndseed' |
'rndseed' |
=> '<b>Randomization algorithm used</b> <br />'. |
=> '<b>Randomization algorithm used</b> <br />'. |
'<font color="red">Modifying this will make problems '. |
'<font color="red">Modifying this will make problems '. |
'have different numbers and answers</font>', |
'have different numbers and answers</font>', |
'problem_stream_switch' |
'problem_stream_switch' |
=> '<b>Allow problems to be splitted over pages</b><br />'. |
=> '<b>Allow problems to be split over pages</b><br />'. |
' (<tt><b>yes</b> if allow anything else if not</tt>)' |
' ("<tt>yes</tt>" if allowed, anything else if not)',, |
); |
'anonymous_quiz' |
foreach (keys(%values)) { |
=> '<b>Anonimous quiz/exam</b><br />'. |
unless ($descriptions{$_}) { |
' (<tt><b>yes</b> to avoid print students names </tt>)', |
$descriptions{$_}=$_; |
'default_enrollment_start_date' => '<b>Default beginning date '. |
|
'when enrolling students</b>', |
|
'default_enrollment_end_date' => '<b>Default ending date '. |
|
'when enrolling students</b>', |
|
'languages' => '<b>Languages used</b>' |
|
); |
|
my @Display_Order = ('url','description','courseid', |
|
'default_xml_style','pageseparators', |
|
'question.email','comment.email','policy.email', |
|
'pch.roles.denied','pch.users.denied', |
|
'allow_limited_html_in_feedback', |
|
'languages', |
|
'rndseed', |
|
'problem_stream_switch', |
|
'spreadsheet_default_classcalc', |
|
'spreadsheet_default_studentcalc', |
|
'spreadsheet_default_assesscalc', |
|
'hideemptyrows', |
|
'default_enrollment_start_date', |
|
'default_enrollment_end_date', |
|
); |
|
foreach my $parameter (sort(keys(%values))) { |
|
if (! $descriptions{$parameter}) { |
|
$descriptions{$parameter}=$parameter; |
|
push(@Display_Order,$parameter); |
} |
} |
} |
} |
foreach (sort keys %descriptions) { |
foreach my $parameter (@Display_Order) { |
|
my $description = $descriptions{$parameter}; |
# onchange is javascript to automatically check the 'Set' button. |
# onchange is javascript to automatically check the 'Set' button. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
'[\'envform\'].elements[\''.$_.'_setparmval\']'. |
"['envform'].elements['".$parameter."_setparmval']". |
'.checked=true;"'; |
'.checked=true;"'; |
$output.='<tr><td>'.$descriptions{$_}.'</td>'. |
$output .= '<tr><td>'.$description.'</td>'; |
'<td><input name="'.$_.'_value" size=40 '. |
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
'value="'.$values{$_}.'" '.$onchange.' /></td>'. |
$output .= '<td>'. |
'<td><input type=checkbox name="'.$_.'_setparmval"></td>'. |
&Apache::lonhtmlcommon::date_setter('envform', |
'</tr>'."\n"; |
$parameter.'_value', |
|
$values{$parameter}, |
|
$onchange). |
|
'</td>'; |
|
} else { |
|
$output .= '<td>'. |
|
&Apache::lonhtmlcommon::textbox($parameter.'_value', |
|
$values{$parameter}, |
|
40,$onchange).'</td>'; |
|
} |
|
$output .= '<td>'. |
|
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
|
'</td>'; |
|
$output .= "</tr>\n"; |
} |
} |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
Line 1594 sub handler {
|
Line 1657 sub handler {
|
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
|
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
|
|
if (($ENV{'request.course.id'}) && |
if (($ENV{'request.course.id'}) && |
(&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { |
(&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { |
|
|
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
|
$coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
$coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; |
|
|