version 1.35, 2001/09/21 19:59:49
|
version 1.39, 2001/12/18 21:19:55
|
Line 5
|
Line 5
|
# |
# |
# (TeX Content Handler |
# (TeX Content Handler |
# |
# |
|
# YEAR=2000 |
# 05/29/00,05/30,10/11 Gerd Kortemeyer) |
# 05/29/00,05/30,10/11 Gerd Kortemeyer) |
# |
# |
# 10/11,10/12,10/16 Gerd Kortemeyer) |
# 10/11,10/12,10/16 Gerd Kortemeyer) |
# |
# |
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, |
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, |
# 12/08,12/12, |
# 12/08,12/12, |
|
# YEAR=2001 |
# 16/01/01,02/08,03/20,03/23,03/24,03/26,05/09, |
# 16/01/01,02/08,03/20,03/23,03/24,03/26,05/09, |
# 07/05,07/06,08/08,08/09,09/01,09/21 Gerd Kortemeyer |
# 07/05,07/06,08/08,08/09,09/01,09/21 Gerd Kortemeyer |
|
# 12/17 Scott Harrison |
|
# |
|
### |
|
|
package Apache::lonparmset; |
package Apache::lonparmset; |
|
|
use strict; |
use strict; |
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::Constants qw(:common :http REDIRECT); |
use Apache::Constants qw(:common :http REDIRECT); |
|
use Apache::loncommon; |
use GDBM_File; |
use GDBM_File; |
|
|
|
|
Line 186 sub assessparms {
|
Line 192 sub assessparms {
|
$pssymb=&Apache::lonnet::symbread($url); |
$pssymb=&Apache::lonnet::symbread($url); |
$pscat='all'; |
$pscat='all'; |
$pschp=''; |
$pschp=''; |
|
} elsif ($ENV{'form.symb'}) { |
|
$pssymb=$ENV{'form.symb'}; |
|
$pscat='all'; |
|
$pschp=''; |
} else { |
} else { |
$ENV{'form.url'}=''; |
$ENV{'form.url'}=''; |
} |
} |
Line 245 sub assessparms {
|
Line 255 sub assessparms {
|
undef %allkeys; |
undef %allkeys; |
undef %allmaps; |
undef %allmaps; |
undef %defp; |
undef %defp; |
map { |
foreach (keys %bighash) { |
if ($_=~/^src\_(\d+)\.(\d+)$/) { |
if ($_=~/^src\_(\d+)\.(\d+)$/) { |
my $mapid=$1; |
my $mapid=$1; |
my $resid=$2; |
my $resid=$2; |
Line 255 sub assessparms {
|
Line 265 sub assessparms {
|
$ids[$#ids+1]=$id; |
$ids[$#ids+1]=$id; |
$typep{$id}=$1; |
$typep{$id}=$1; |
$keyp{$id}=''; |
$keyp{$id}=''; |
map { |
foreach (split(/\,/, |
|
&Apache::lonnet::metadata($srcf,'keys'))) { |
if ($_=~/^parameter\_(.*)/) { |
if ($_=~/^parameter\_(.*)/) { |
my $key=$_; |
my $key=$_; |
my $allkey=$1; |
my $allkey=$1; |
Line 277 sub assessparms {
|
Line 288 sub assessparms {
|
$keyp{$id}=$key; |
$keyp{$id}=$key; |
} |
} |
} |
} |
} split(/\,/, |
} |
&Apache::lonnet::metadata($srcf,'keys')); |
|
$mapp{$id}= |
$mapp{$id}= |
&Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); |
&Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); |
$allmaps{$mapid}=$mapp{$id}; |
$allmaps{$mapid}=$mapp{$id}; |
Line 287 sub assessparms {
|
Line 297 sub assessparms {
|
&Apache::lonnet::declutter($srcf); |
&Apache::lonnet::declutter($srcf); |
} |
} |
} |
} |
} keys %bighash; |
} |
# ---------------------------------------------------------- Anything to store? |
# ---------------------------------------------------------- Anything to store? |
if ($ENV{'form.pres_marker'}) { |
if ($ENV{'form.pres_marker'}) { |
my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'}); |
my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'}); |
Line 379 sub assessparms {
|
Line 389 sub assessparms {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata', |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata', |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}); |
if ($reply!~/^error\:/) { |
if ($reply!~/^error\:/) { |
map { |
foreach (split(/\&/,$reply)) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
$courseopt{&Apache::lonnet::unescape($name)}= |
$courseopt{&Apache::lonnet::unescape($name)}= |
&Apache::lonnet::unescape($value); |
&Apache::lonnet::unescape($value); |
} split(/\&/,$reply); |
} |
} |
} |
# --------------------------------------------------- Get userdata (if present) |
# --------------------------------------------------- Get userdata (if present) |
if ($uname) { |
if ($uname) { |
my $reply= |
my $reply= |
&Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome); |
&Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome); |
if ($reply!~/^error\:/) { |
if ($reply!~/^error\:/) { |
map { |
foreach (split(/\&/,$reply)) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
$useropt{&Apache::lonnet::unescape($name)}= |
$useropt{&Apache::lonnet::unescape($name)}= |
&Apache::lonnet::unescape($value); |
&Apache::lonnet::unescape($value); |
} split(/\&/,$reply); |
} |
} |
} |
} |
} |
|
|
Line 487 ENDHEAD
|
Line 497 ENDHEAD
|
$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">'); |
} |
} |
map { |
foreach ('tolerance','date_default','date_start','date_end', |
|
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
$ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
} ('tolerance','date_default','date_start','date_end','date_interval', |
} |
'int','float','string'); |
|
|
|
$r->print('<h2>'.$message.'</h2><table><tr><td>Sort list by</td><td>'); |
$r->print('<h2>'.$message.'</h2><table><tr><td>Sort list by</td><td>'); |
$r->print('<select name="fcat">'); |
$r->print('<select name="fcat">'); |
$r->print('<option value="">Enclosing Map</option>'); |
$r->print('<option value="">Enclosing Map</option>'); |
map { |
foreach (reverse sort keys %allkeys) { |
$r->print('<option value="'.$_.'"'); |
$r->print('<option value="'.$_.'"'); |
if ($fcat eq $_) { $r->print(' selected'); } |
if ($fcat eq $_) { $r->print(' selected'); } |
$r->print('>'.$allkeys{$_}.'</option>'); |
$r->print('>'.$allkeys{$_}.'</option>'); |
} reverse sort keys %allkeys; |
} |
$r->print( |
$r->print( |
'</select></tr><tr><td>Select Enclosing Map</td><td><select name=pschp>'); |
'</select></tr><tr><td>Select Enclosing Map</td><td><select name=pschp>'); |
$r->print('<option value=all>All Maps</option>'); |
$r->print('<option value=all>All Maps</option>'); |
map { |
foreach (keys %allmaps) { |
$r->print('<option value="'.$_.'"'); |
$r->print('<option value="'.$_.'"'); |
if (($pssymb=~/^$allmaps{$_}/) || |
if (($pssymb=~/^$allmaps{$_}/) || |
($pschp eq $_)) { $r->print(' selected'); } |
($pschp eq $_)) { $r->print(' selected'); } |
$r->print('>'.$allmaps{$_}.'</option>'); |
$r->print('>'.$allmaps{$_}.'</option>'); |
} keys %allmaps; |
} |
$r->print( |
$r->print( |
'</select></td></tr><tr><td>Select Parameter</td><td><select name=pscat>'); |
'</select></td></tr><tr><td>Select Parameter</td><td><select name=pscat>'); |
$r->print('<option value=all>All Parameters</option>'); |
$r->print('<option value=all>All Parameters</option>'); |
map { |
foreach (reverse sort keys %allkeys) { |
$r->print('<option value="'.$_.'"'); |
$r->print('<option value="'.$_.'"'); |
if ($pscat eq $_) { $r->print(' selected'); } |
if ($pscat eq $_) { $r->print(' selected'); } |
$r->print('>'.$allkeys{$_}.'</option>'); |
$r->print('>'.$allkeys{$_}.'</option>'); |
} reverse sort keys %allkeys; |
} |
$r->print( |
$r->print( |
'</select></td></tr></table><br><input name=dis type="submit" value="Display">' |
'</select></td></tr></table><br><input name=dis type="submit" value="Display">' |
); |
); |
Line 561 ENDTABLEHEADFOUR
|
Line 571 ENDTABLEHEADFOUR
|
$r->print('</tr>'); |
$r->print('</tr>'); |
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
map { |
foreach (@ids) { |
my $rid=$_; |
my $rid=$_; |
my ($inmapid)=($rid=~/\.(\d+)$/); |
my ($inmapid)=($rid=~/\.(\d+)$/); |
if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) || |
if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) || |
Line 588 ENDTABLEHEADFOUR
|
Line 598 ENDTABLEHEADFOUR
|
my %default=(); |
my %default=(); |
my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); |
my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); |
|
|
map { |
foreach (split(/\,/,$keyp{$rid})) { |
if (($_ eq $catmarker) || ($pscat eq 'all')) { |
if (($_ eq $catmarker) || ($pscat eq 'all')) { |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
$name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); |
Line 599 ENDTABLEHEADFOUR
|
Line 609 ENDTABLEHEADFOUR
|
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
} |
} |
} split(/\,/,$keyp{$rid}); |
} |
|
|
my $totalparms=scalar keys %name; |
my $totalparms=scalar keys %name; |
if ($totalparms>0) { |
if ($totalparms>0) { |
Line 618 ENDTABLEHEADFOUR
|
Line 628 ENDTABLEHEADFOUR
|
$r->print('<td bgcolor='.$defbgone. |
$r->print('<td bgcolor='.$defbgone. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>'); |
join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>'); |
map { |
foreach (sort keys %name) { |
my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); |
my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); |
unless ($firstrow) { |
unless ($firstrow) { |
$r->print('<tr>'); |
$r->print('<tr>'); |
Line 691 ENDTABLEHEADFOUR
|
Line 701 ENDTABLEHEADFOUR
|
'<td bgcolor=#999999><font color=#FFFFFF>'.$sessionval.' '. |
'<td bgcolor=#999999><font color=#FFFFFF>'.$sessionval.' '. |
'</font></td>'); |
'</font></td>'); |
$r->print("</tr>"); |
$r->print("</tr>"); |
} sort keys %name; |
} |
} |
} |
# -------------------------------------------------- End entry for one resource |
# -------------------------------------------------- End entry for one resource |
} |
} |
} @ids; |
} |
$r->print('</table>'); |
$r->print('</table>'); |
} |
} |
$r->print('</form></body></html>'); |
$r->print('</form></body></html>'); |
Line 708 sub crsenv {
|
Line 718 sub crsenv {
|
my $r=shift; |
my $r=shift; |
my $setoutput=''; |
my $setoutput=''; |
# -------------------------------------------------- Go through list of changes |
# -------------------------------------------------- Go through list of changes |
map { |
foreach (keys %ENV) { |
if ($_=~/^form\.(.+)\_setparmval$/) { |
if ($_=~/^form\.(.+)\_setparmval$/) { |
my $name=$1; |
my $name=$1; |
my $value=$ENV{'form.'.$name.'_value'}; |
my $value=$ENV{'form.'.$name.'_value'}; |
Line 746 sub crsenv {
|
Line 756 sub crsenv {
|
'<br>'; |
'<br>'; |
} |
} |
} |
} |
} keys %ENV; |
} |
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
my $rep=&Apache::lonnet::reply |
my $rep=&Apache::lonnet::reply |
('dump:'.$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. |
('dump:'.$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. |
Line 769 sub crsenv {
|
Line 779 sub crsenv {
|
'(<tt>user:domain,user:domain,...</tt>)' |
'(<tt>user:domain,user:domain,...</tt>)' |
); |
); |
|
|
map { |
foreach (split(/\&/,$rep)) { |
my ($name,$value)=split(/\=/,$_); |
my ($name,$value)=split(/\=/,$_); |
$name=&Apache::lonnet::unescape($name); |
$name=&Apache::lonnet::unescape($name); |
$values{$name}=&Apache::lonnet::unescape($value); |
$values{$name}=&Apache::lonnet::unescape($value); |
unless ($descriptions{$name}) { |
unless ($descriptions{$name}) { |
$descriptions{$name}=$name; |
$descriptions{$name}=$name; |
} |
} |
} split(/\&/,$rep); |
} |
map { |
foreach (sort keys %descriptions) { |
$output.='<tr><td>'.$descriptions{$_}.'</td><td><input name="'. |
$output.='<tr><td>'.$descriptions{$_}.'</td><td><input name="'. |
$_.'_value" size=40 value="'. |
$_.'_value" size=40 value="'. |
$values{$_}. |
$values{$_}. |
'"></td><td><input type=checkbox name="'.$_. |
'"></td><td><input type=checkbox name="'.$_. |
'_setparmval"></td></tr>'; |
'_setparmval"></td></tr>'; |
} keys %descriptions; |
} |
$output.='<tr><td><i>Create New Environment Variable</i><br>'. |
$output.='<tr><td><i>Create New Environment Variable</i><br>'. |
'<input type="text" size=40 name="newp_name"></td><td>'. |
'<input type="text" size=40 name="newp_name"></td><td>'. |
'<input type="text" size=40 name="newp_value"></td><td>'. |
'<input type="text" size=40 name="newp_value"></td><td>'. |
Line 822 sub handler {
|
Line 832 sub handler {
|
$r->send_http_header; |
$r->send_http_header; |
return OK; |
return OK; |
} |
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); |
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
|
|
if (($ENV{'request.course.id'}) && |
if (($ENV{'request.course.id'}) && |
Line 848 sub handler {
|
Line 858 sub handler {
|
__END__ |
__END__ |
|
|
|
|
|
=head1 NAME |
|
|
|
Apache::lonparmset - Handler to set parameters for assessments |
|
|
|
=head1 SYNOPSIS |
|
|
|
Invoked by /etc/httpd/conf/srm.conf: |
|
|
|
<Location /adm/parmset> |
|
PerlAccessHandler Apache::lonacc |
|
SetHandler perl-script |
|
PerlHandler Apache::lonparmset |
|
ErrorDocument 403 /adm/login |
|
ErrorDocument 406 /adm/roles |
|
ErrorDocument 500 /adm/errorhandler |
|
</Location> |
|
|
|
=head1 INTRODUCTION |
|
|
|
This module sets assessment parameters. |
|
|
|
This is part of the LearningOnline Network with CAPA project |
|
described at http://www.lon-capa.org. |
|
|
|
=head1 HANDLER SUBROUTINE |
|
|
|
This routine is called by Apache and mod_perl. |
|
|
|
=over 4 |
|
|
|
=item * |
|
|
|
need to be in course |
|
|
|
=item * |
|
|
|
bring up assessment screen or course environment |
|
|
|
=back |
|
|
|
=head1 OTHER SUBROUTINES |
|
|
|
=over 4 |
|
|
|
=item * |
|
|
|
parmval() : figure out a cascading parameter |
|
|
|
=item * |
|
|
|
valout() : output for value |
|
|
|
=item * |
|
|
|
plink() : produces link anchor |
|
|
|
=item * |
|
|
|
assessparms() : show assess data and parameters |
|
|
|
=item * |
|
|
|
crsenv() : for the course environment |
|
|
|
=back |
|
|
|
=cut |
|
|
|
|
|
|