--- loncom/interface/lonparmset.pm 2000/11/25 19:57:17 1.12 +++ loncom/interface/lonparmset.pm 2001/12/19 17:17:46 1.40 @@ -1,23 +1,55 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # +# $Id: lonparmset.pm,v 1.40 2001/12/19 17:17:46 albertel Exp $ +# +# Copyright Michigan State University Board of Trustees +# +# This file is part of the LearningOnline Network with CAPA (LON-CAPA). +# +# LON-CAPA is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# LON-CAPA is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with LON-CAPA; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# /home/httpd/html/adm/gpl.txt +# +# http://www.lon-capa.org/ +# # (Handler to resolve ambiguous file locations # # (TeX Content Handler # +# YEAR=2000 # 05/29/00,05/30,10/11 Gerd Kortemeyer) # # 10/11,10/12,10/16 Gerd Kortemeyer) # -# 11/20,11/21,11/22,11/23,11/24,11/25 Gerd Kortemeyer +# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, +# 12/08,12/12, +# YEAR=2001 +# 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 +# 12/17 Scott Harrison +# +### package Apache::lonparmset; use strict; use Apache::lonnet; use Apache::Constants qw(:common :http REDIRECT); +use Apache::loncommon; use GDBM_File; -use Apache::lonmeta; my %courseopt; @@ -31,6 +63,11 @@ my @ids; my %symbp; my %mapp; my %typep; +my %keyp; +my %defp; + +my %allkeys; +my %allmaps; my $uname; my $udom; @@ -53,13 +90,13 @@ sub parmval { my $seclevel= $ENV{'request.course.id'}.'.['. - $ENV{'request.course.sec'}.'].'.$what; + $csec.'].'.$what; my $seclevelr= $ENV{'request.course.id'}.'.['. - $ENV{'request.course.sec'}.'].'.$symbparm; + $csec.'].'.$symbparm; my $seclevelm= $ENV{'request.course.id'}.'.['. - $ENV{'request.course.sec'}.'].'.$mapparm; + $csec.'].'.$mapparm; my $courselevel= $ENV{'request.course.id'}.'.'.$what; @@ -121,16 +158,6 @@ sub parmval { return $result; } -# ---------------------------------------------------------------- Sort routine - -sub bycat { - if ($fcat eq '') { - $a<=>$b; - } else { - &parmval('0.'.$fcat,$a)<=>&parmval('0.'.$fcat,$b); - } -} - # ------------------------------------------------------------ Output for value sub valout { @@ -143,26 +170,23 @@ sub valout { sub plink { my ($type,$dis,$value,$marker,$return,$call)=@_; - return ''. - &valout($value,$type).''; + &valout($value,$type).''; } -# ================================================================ Main Handler +sub assessparms { -sub handler { - my $r=shift; - - if ($r->header_only) { - $r->content_type('text/html'); - $r->send_http_header; - return OK; - } - -# ----------------------------------------------------- Needs to be in a course - - if (($ENV{'request.course.fn'}) && - (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { + my $r=shift; # -------------------------------------------------------- Variable declaration %courseopt=(); @@ -177,6 +201,29 @@ sub handler { $csec=$ENV{'form.csec'}; $udom=$ENV{'form.udom'}; + unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } + + my $pscat=$ENV{'form.pscat'}; + my $pschp=$ENV{'form.pschp'}; + my $pssymb=''; + +# ----------------------------------------------- Was this started from grades? + + if (($ENV{'form.command'} eq 'set') && ($ENV{'form.url'}) + && (!$ENV{'form.dis'})) { + my $url=$ENV{'form.url'}; + $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + $pssymb=&Apache::lonnet::symbread($url); + $pscat='all'; + $pschp=''; + } elsif ($ENV{'form.symb'}) { + $pssymb=$ENV{'form.symb'}; + $pscat='all'; + $pschp=''; + } else { + $ENV{'form.url'}=''; + } + my $id=$ENV{'form.id'}; if (($id) && ($udom)) { $uname=(&Apache::lonnet::idget($udom,$id))[1]; @@ -184,7 +231,7 @@ sub handler { $id=''; } else { $message= - "

Unknown ID '$id' at domain '$udom'

"; + "Unknown ID '$id' at domain '$udom'"; } } else { $uname=$ENV{'form.uname'}; @@ -196,21 +243,21 @@ sub handler { if ($uhome eq 'no_host') { $message= - "

Unknown user '$uname' at domain '$udom'

"; + "Unknown user '$uname' at domain '$udom'"; $uname=''; } else { $csec=&Apache::lonnet::usection( $udom,$uname,$ENV{'request.course.id'}); if ($csec eq '-1') { - $message="

". - "User '$uname' at domain '$udom' not in this course

"; + $message="". + "User '$uname' at domain '$udom' not in this course"; $uname=''; $csec=$ENV{'form.csec'}; } else { my %name=&Apache::lonnet::userenvironment($udom,$uname, ('firstname','middlename','lastname','generation','id')); $message="\n

\nFull Name: ". - $name{'firstname'}.' '.$name{'middlename'} + $name{'firstname'}.' '.$name{'middlename'}.' ' .$name{'lastname'}.' '.$name{'generation'}. "
\nID: ".$name{'id'}.'

'; } @@ -228,55 +275,183 @@ sub handler { (tie(%parmhash,'GDBM_File', $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) { +# --------------------------------------------------------- Get all assessments + undef %allkeys; + undef %allmaps; + undef %defp; + foreach (keys %bighash) { + if ($_=~/^src\_(\d+)\.(\d+)$/) { + my $mapid=$1; + my $resid=$2; + my $id=$mapid.'.'.$resid; + my $srcf=$bighash{$_}; + if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) { + $ids[$#ids+1]=$id; + $typep{$id}=$1; + $keyp{$id}=''; + foreach (split(/\,/, + &Apache::lonnet::metadata($srcf,'keys'))) { + if ($_=~/^parameter\_(.*)/) { + my $key=$_; + my $allkey=$1; + $allkey=~s/\_/\./; + my $display= + &Apache::lonnet::metadata($srcf,$key.'.display'); + unless ($display) { + $display= + &Apache::lonnet::metadata($srcf,$key.'.name'); + } + $allkeys{$allkey}=$display; + if ($allkey eq $fcat) { + $defp{$id}= + &Apache::lonnet::metadata($srcf,$key); + } + if ($keyp{$id}) { + $keyp{$id}.=','.$key; + } else { + $keyp{$id}=$key; + } + } + } + $mapp{$id}= + &Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); + $allmaps{$mapid}=$mapp{$id}; + $symbp{$id}=$mapp{$id}. + '___'.$resid.'___'. + &Apache::lonnet::declutter($srcf); + } + } + } +# ---------------------------------------------------------- Anything to store? + if ($ENV{'form.pres_marker'}) { + my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'}); + $spnam=~s/\_([^\_]+)$/\.$1/; +# ---------------------------------------------------------- Construct prefixes + + my $symbparm=$symbp{$sresid}.'.'.$spnam; + my $mapparm=$mapp{$sresid}.'___(all).'.$spnam; + + my $seclevel= + $ENV{'request.course.id'}.'.['. + $csec.'].'.$spnam; + my $seclevelr= + $ENV{'request.course.id'}.'.['. + $csec.'].'.$symbparm; + my $seclevelm= + $ENV{'request.course.id'}.'.['. + $csec.'].'.$mapparm; + + my $courselevel= + $ENV{'request.course.id'}.'.'.$spnam; + my $courselevelr= + $ENV{'request.course.id'}.'.'.$symbparm; + my $courselevelm= + $ENV{'request.course.id'}.'.'.$mapparm; + + my $storeunder=''; + if (($snum==9) || ($snum==3)) { $storeunder=$courselevel; } + if (($snum==8) || ($snum==2)) { $storeunder=$courselevelm; } + if (($snum==7) || ($snum==1)) { $storeunder=$courselevelr; } + if ($snum==6) { $storeunder=$seclevel; } + if ($snum==5) { $storeunder=$seclevelm; } + if ($snum==4) { $storeunder=$seclevelr; } + $storeunder=&Apache::lonnet::escape($storeunder); + + my $storecontent= + $storeunder.'='.&Apache::lonnet::escape($ENV{'form.pres_value'}).'&'. + $storeunder.'.type='.&Apache::lonnet::escape($ENV{'form.pres_type'}); + + my $reply=''; + if ($snum>3) { +# ---------------------------------------------------------------- Store Course +# +# Expire sheets + &Apache::lonnet::expirespread('','','studentcalc'); + if (($snum==7) || ($snum==4)) { + &Apache::lonnet::expirespread('','','assesscalc',$symbp{$sresid}); + } elsif (($snum==8) || ($snum==5)) { + &Apache::lonnet::expirespread('','','assesscalc',$mapp{$sresid}); + } else { + &Apache::lonnet::expirespread('','','assesscalc'); + } + +# Store parameter + $reply=&Apache::lonnet::critical('put:'. + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. + $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'. + $storecontent, + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}); + } else { +# ------------------------------------------------------------------ Store User +# +# Expire sheets + &Apache::lonnet::expirespread($uname,$udom,'studentcalc'); + if ($snum==1) { + &Apache::lonnet::expirespread + ($uname,$udom,'assesscalc',$symbp{$sresid}); + } elsif ($snum==2) { + &Apache::lonnet::expirespread + ($uname,$udom,'assesscalc',$mapp{$sresid}); + } else { + &Apache::lonnet::expirespread($uname,$udom,'assesscalc'); + } + +# Store parameter + $reply= + &Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'. + $storecontent,$uhome); + } + + if ($reply=~/^error\:(.*)/) { + $message.="Write Error: $1"; + } +# ---------------------------------------------------------------- Done storing + } # -------------------------------------------------------------- Get coursedata my $reply=&Apache::lonnet::reply('dump:'. $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata', $ENV{'course.'.$ENV{'request.course.id'}.'.home'}); if ($reply!~/^error\:/) { - map { + foreach (split(/\&/,$reply)) { my ($name,$value)=split(/\=/,$_); - $courseopt{unescape($name)}=unescape($value); - } split(/\&/,$reply); + $courseopt{&Apache::lonnet::unescape($name)}= + &Apache::lonnet::unescape($value); + } } # --------------------------------------------------- Get userdata (if present) if ($uname) { my $reply= &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome); if ($reply!~/^error\:/) { - map { + foreach (split(/\&/,$reply)) { my ($name,$value)=split(/\=/,$_); - $useropt{unescape($name)}=unescape($value); - } split(/\&/,$reply); + $useropt{&Apache::lonnet::unescape($name)}= + &Apache::lonnet::unescape($value); + } } } -# --------------------------------------------------------- Get all assessments - map { - if ($_=~/^src\_(\d+)\.(\d+)$/) { - my $mapid=$1; - my $resid=$2; - my $id=$mapid.'.'.$resid; - if ($bighash{$_}=~/\.(problem|exam|quiz|assess|survey|form)$/) { - $ids[$#ids+1]=$id; - $typep{$id}=$1; - $mapp{$id}= - &Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); - $symbp{$id}=$mapp{$id}. - '___'.$resid.'___'. - &Apache::lonnet::declutter($bighash{$_}); - } - } - } keys %bighash; + # ------------------------------------------------------------------- Sort this - @ids=sort bycat @ids; + + @ids=sort { + if ($fcat eq '') { + $a<=>$b; + } else { + 1*$outpar[&parmval($fcat,$a,$defp{$a})]<=> + 1*$outpar[&parmval($fcat,$b,$defp{$b})]; + } + } @ids; + # ------------------------------------------------------------------ Start page $r->content_type('text/html'); $r->send_http_header; $r->print(< -LON-CAPA Assessment Parameters +LON-CAPA Course Parameters -

Set Assessment Parameters

-
+

Set Course Parameters

+

Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}

+

Course Environment

+ +
+
+

Course Assessments

Section/Group: @@ -308,21 +513,55 @@ or ID at Domain - + + + ENDHEAD - - $r->print($message.'

Sort list by '); - $r->print(''); + } + foreach ('tolerance','date_default','date_start','date_end', + 'date_interval','int','float','string') { + $r->print(''); + } + + $r->print('

'.$message.'

Sort list by'); + $r->print(''); + $r->print( + '
Select Enclosing Map
Select Parameter

' + ); + if (($pscat) || ($pschp) || ($pssymb)) { # ----------------------------------------------------------------- Start Table + my $catmarker='parameter_'.$pscat; + $catmarker=~s/\./\_/g; my $coursespan=$csec?8:5; + my $csuname=$ENV{'user.name'}; + my $csudom=$ENV{'user.domain'}; $r->print(< @@ -332,7 +571,9 @@ ENDTABLEHEAD $r->print(""); } $r->print(<Parameter in Effect + + + ENDTABLETWO @@ -351,89 +592,283 @@ ENDTABLEHEADFOUR if ($uname) { $r->print(''); } - $r->print(''); - map { + $r->print(''); + my $defbgone=''; + my $defbgtwo=''; + foreach (@ids) { + my $rid=$_; + my ($inmapid)=($rid=~/\.(\d+)$/); + if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) || + ($pssymb eq $mapp{$rid}.'___'.$inmapid.'___'. + &Apache::lonnet::declutter($bighash{'src_'.$rid}))) { # ------------------------------------------------------ Entry for one resource + if ($defbgone eq '"E0E099"') { + $defbgone='"E0E0DD"'; + } else { + $defbgone='"E0E099"'; + } + if ($defbgtwo eq '"FFFF99"') { + $defbgtwo='"FFFFDD"'; + } else { + $defbgtwo='"FFFF99"'; + } @outpar=(); - my $rid=$_; my $thistitle=''; - my %name= ('0_deadline' => 'deadline'); - my %part= ('0_deadline' => '0'); - my %display=('0_deadline' => 'Deadline'); - my %type= ('0_deadline' => 'date_end'); - my %default=('0_deadline' => time); - my %metadata=&Apache::lonmeta::unpackagemeta( -&Apache::lonnet::getfile('/home/httpd/html/'.$bighash{'src_'.$rid}.'.meta'),1); - map { - if ($_=~/^parameter\_(\d+)\_(\w+)$/) { - my $hashid=$1.'_'.$2; - $part{$hashid}=$1; - $name{$hashid}=$2; - my $tdef; - ($tdef,$display{$hashid})= - split(/\_\_dis\_\_/,$metadata{$_}); - ($type{$hashid},$default{$hashid})=split(/\:/,$tdef); - unless ($display{$hashid}) { - $display{$hashid}=$name{$hashid}; - } - } - if ($_ eq 'title') { - $thistitle=$metadata{$_}; - } - } keys %metadata; + my %name= (); + undef %name; + my %part= (); + my %display=(); + my %type= (); + my %default=(); + my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid}); + + foreach (split(/\,/,$keyp{$rid})) { + if (($_ eq $catmarker) || ($pscat eq 'all')) { + $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part'); + $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name'); + $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display'); + unless ($display{$_}) { $display{$_}=''; } + $display{$_}.=' ('.$name{$_}.')'; + $default{$_}=&Apache::lonnet::metadata($uri,$_); + $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); + $thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); + } + } + my $totalparms=scalar keys %name; - $r->print(''); - $r->print(''); - $r->print(''); + $r->print(''); - map { - + foreach (sort keys %name) { my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); + unless ($firstrow) { + $r->print(''); + } else { + $firstrow=0; + } + $r->print(""); + my $thismarker=$_; + $thismarker=~s/^parameter\_//; + my $mprefix=$rid.'&'.$thismarker.'&'; - $r->print(""); - my $mprefix=$rid.'&'.$_.'&'; - $r->print(''. + $r->print(''); - $r->print(''. + $r->print(''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[9],$mprefix.'9').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[8],$mprefix.'8').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[7],$mprefix.'7').''); + + $r->print(''); + $r->print(''); + $r->print(''); + if ($csec) { - $r->print(''. - &plink($type{$_},$display{$_},$outpar[6],$mprefix.'6').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[5],$mprefix.'5').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[4],$mprefix.'4').''); + $r->print(''); + $r->print(''); + $r->print(''); } + if ($uname) { - $r->print(''. - &plink($type{$_},$display{$_},$outpar[3],$mprefix.'3').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[2],$mprefix.'2').''); - $r->print(''. - &plink($type{$_},$display{$_},$outpar[1],$mprefix.'1').''); + $r->print(''); + $r->print(''); + $r->print(''); } - $r->print(''); - $r->print("\n"); - } sort keys %name; + $r->print( + ''); + my $sessionval=&Apache::lonnet::EXT('resource.'.$part{$_}. + '.'.$name{$_},$mapp{$rid}.'___'.$inmapid.'___'.$uri); + if (($type{$_}=~/^date/) && ($sessionval)) + { $sessionval=localtime($sessionval); } + $r->print( + ''); + $r->print(""); + } + } # -------------------------------------------------- End entry for one resource - } @ids; - $r->print('
User $uname at Domain $udom
Parameter in EffectCurrent Session Value
($csuname at $csudom)
Resource Level in Coursegeneralfor Enclosing Mapfor Resource
'. - join(' / ',split(/\//,&Apache::lonnet::declutter($bighash{'src_'.$rid}))). - '

'. + if ($totalparms>0) { + my $firstrow=1; + $r->print('

'. + join(' / ',split(/\//,$uri)). + '

'. $bighash{'title_'.$rid}); if ($thistitle) { $r->print(' ('.$thistitle.')'); } $r->print('

'.$typep{$rid}.''. + $r->print(''.$typep{$rid}.''. join(' / ',split(/\//,$mapp{$rid})).'
$part{$_}$display{$_}$part{$_}$display{$_}'. &valout($outpar[11],$type{$_}).''. &valout($outpar[10],$type{$_}).''. + &plink($type{$_},$display{$_},$outpar[9],$mprefix.'9', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[8],$mprefix.'8', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[7],$mprefix.'7', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[6],$mprefix.'6', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[5],$mprefix.'5', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[4],$mprefix.'4', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[3],$mprefix.'3', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[2],$mprefix.'2', + 'parmform.pres','psub').''. + &plink($type{$_},$display{$_},$outpar[1],$mprefix.'1', + 'parmform.pres','psub').''.&valout($outpar[$result],$type{$_}).'
'.&valout($outpar[$result],$type{$_}).''.$sessionval.' '. + '
'); + } + } + $r->print(''); + } + $r->print(''); untie(%bighash); untie(%parmhash); } +} + +sub crsenv { + my $r=shift; + my $setoutput=''; +# -------------------------------------------------- Go through list of changes + foreach (keys %ENV) { + if ($_=~/^form\.(.+)\_setparmval$/) { + my $name=$1; + my $value=$ENV{'form.'.$name.'_value'}; + if ($name eq 'newp') { + $name=$ENV{'form.newp_name'}; + } + if ($name eq 'url') { + $value=~s/^\/res\///; + $setoutput.='Backing up previous URL: '. + &Apache::lonnet::reply('put:'. + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. + ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}. + ':environment:'. + &Apache::lonnet::escape('top level map backup '. + time).'='. + &Apache::lonnet::reply('get:'. + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. + ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}. + ':environment:url', + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}), + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}). + '
'; + + } + if ($name) { + $setoutput.='Setting '.$name.' to '. + $value.': '. + &Apache::lonnet::reply('put:'. + $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. + ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}. + ':environment:'. + &Apache::lonnet::escape($name).'='. + &Apache::lonnet::escape($value), + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}). + '
'; + } + } + } +# -------------------------------------------------------- Get parameters again + my $rep=&Apache::lonnet::reply + ('dump:'.$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}. + ':'.$ENV{'course.'.$ENV{'request.course.id'}.'.num'}. + ':environment', + $ENV{'course.'.$ENV{'request.course.id'}.'.home'}); + my $output=''; + if ($rep ne 'con_lost') { + my %values; + my %descriptions= + ('url' => 'Top Level Map
'. + 'Modification may make assessment data inaccessible', + 'description' => 'Course Description', + 'courseid' => 'Course ID or number
(internal, optional)', + 'question.email' => 'Feedback Addresses for Content Questions
'. + '(user:domain,user:domain,...)', + 'comment.email' => 'Feedback Addresses for Comments
'. + '(user:domain,user:domain,...)', + 'policy.email' => 'Feedback Addresses for Course Policy
'. + '(user:domain,user:domain,...)' + ); + + foreach (split(/\&/,$rep)) { + my ($name,$value)=split(/\=/,$_); + $name=&Apache::lonnet::unescape($name); + $values{$name}=&Apache::lonnet::unescape($value); + unless ($descriptions{$name}) { + $descriptions{$name}=$name; + } + } + foreach (sort keys %descriptions) { + $output.=''.$descriptions{$_}.''; + } + $output.='Create New Environment Variable
'. + ''. + ''. + ''; + } + $r->print(< + +LON-CAPA Course Environment + + +

Set Course Parameters

+
+

Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}

+

Course Environment

+$setoutput +

+ + +$output +
ParameterValueSet?
+ +

+ + +ENDENV +} + +# ================================================================ Main Handler + +sub handler { + my $r=shift; + + if ($r->header_only) { + $r->content_type('text/html'); + $r->send_http_header; + return OK; + } + &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); +# ----------------------------------------------------- Needs to be in a course + + if (($ENV{'request.course.id'}) && + (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) { + + unless (($ENV{'form.crsenv'}) || (!$ENV{'request.course.fn'})) { +# --------------------------------------------------------- Bring up assessment + &assessparms($r); +# ---------------------------------------------- This is for course environment + } else { + &crsenv($r); + } } else { # ----------------------------- Not in a course, or not allowed to modify parms $ENV{'user.error.msg'}= @@ -447,5 +882,73 @@ ENDTABLEHEADFOUR __END__ +=head1 NAME + +Apache::lonparmset - Handler to set parameters for assessments + +=head1 SYNOPSIS + +Invoked by /etc/httpd/conf/srm.conf: + + + PerlAccessHandler Apache::lonacc + SetHandler perl-script + PerlHandler Apache::lonparmset + ErrorDocument 403 /adm/login + ErrorDocument 406 /adm/roles + ErrorDocument 500 /adm/errorhandler + + +=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 +