Annotation of loncom/interface/lonparmset.pm, revision 1.23
1.1 www 1: # The LearningOnline Network with CAPA
2: # Handler to set parameters for assessments
3: #
4: # (Handler to resolve ambiguous file locations
5: #
6: # (TeX Content Handler
7: #
8: # 05/29/00,05/30,10/11 Gerd Kortemeyer)
9: #
10: # 10/11,10/12,10/16 Gerd Kortemeyer)
11: #
1.20 www 12: # 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,
1.21 www 13: # 12/08,12/12,
1.22 www 14: # 16/01/01,02/08 Gerd Kortemeyer
1.1 www 15:
16: package Apache::lonparmset;
17:
18: use strict;
19: use Apache::lonnet;
20: use Apache::Constants qw(:common :http REDIRECT);
21: use GDBM_File;
1.4 www 22:
1.1 www 23:
1.2 www 24: my %courseopt;
25: my %useropt;
26: my %bighash;
27: my %parmhash;
28:
1.8 www 29: my @outpar;
30:
1.3 www 31: my @ids;
32: my %symbp;
1.10 www 33: my %mapp;
1.3 www 34: my %typep;
1.16 www 35: my %keyp;
1.17 www 36: my %defp;
1.16 www 37:
38: my %allkeys;
1.2 www 39:
40: my $uname;
41: my $udom;
42: my $uhome;
43:
44: my $csec;
45:
1.3 www 46: my $fcat;
47:
1.2 www 48: # -------------------------------------------- Figure out a cascading parameter
49:
50: sub parmval {
1.11 www 51: my ($what,$id,$def)=@_;
1.8 www 52: my $result='';
1.11 www 53: @outpar=();
1.2 www 54: # ----------------------------------------------------- Cascading lookup scheme
1.10 www 55:
1.3 www 56: my $symbparm=$symbp{$id}.'.'.$what;
1.10 www 57: my $mapparm=$mapp{$id}.'___(all).'.$what;
58:
1.2 www 59: my $seclevel=
1.10 www 60: $ENV{'request.course.id'}.'.['.
1.14 www 61: $csec.'].'.$what;
1.10 www 62: my $seclevelr=
63: $ENV{'request.course.id'}.'.['.
1.14 www 64: $csec.'].'.$symbparm;
1.10 www 65: my $seclevelm=
66: $ENV{'request.course.id'}.'.['.
1.14 www 67: $csec.'].'.$mapparm;
1.10 www 68:
1.2 www 69: my $courselevel=
70: $ENV{'request.course.id'}.'.'.$what;
1.10 www 71: my $courselevelr=
72: $ENV{'request.course.id'}.'.'.$symbparm;
73: my $courselevelm=
74: $ENV{'request.course.id'}.'.'.$mapparm;
1.2 www 75:
1.11 www 76: # -------------------------------------------------------- first, check default
77:
78: if ($def) { $outpar[11]=$def;
79: $result=11; }
80:
81: # ----------------------------------------------------- second, check map parms
82:
83: my $thisparm=$parmhash{$symbparm};
84: if ($thisparm) { $outpar[10]=$thisparm;
85: $result=10; }
86:
87: # --------------------------------------------------------- third, check course
88:
89: if ($courseopt{$courselevel}) { $outpar[9]=$courseopt{$courselevel};
90: $result=9; }
91:
92: if ($courseopt{$courselevelm}) { $outpar[8]=$courseopt{$courselevelm};
93: $result=8; }
94:
95: if ($courseopt{$courselevelr}) { $outpar[7]=$courseopt{$courselevelr};
96: $result=7; }
97:
98: if ($csec) {
99:
100: if ($courseopt{$seclevel}) { $outpar[6]=$courseopt{$seclevel};
101: $result=6; }
102:
103: if ($courseopt{$seclevelm}) { $outpar[5]=$courseopt{$seclevelm};
104: $result=5; }
105:
106: if ($courseopt{$seclevelr}) { $outpar[4]=$courseopt{$seclevelr};
107: $result=4; }
108:
109: }
110:
111: # ---------------------------------------------------------- fourth, check user
1.8 www 112:
113: if ($uname) {
1.11 www 114:
1.10 www 115: if ($useropt{$courselevel}) { $outpar[3]=$useropt{$courselevel};
116: $result=3; }
117:
1.11 www 118: if ($useropt{$courselevelm}) { $outpar[2]=$useropt{$courselevelm};
119: $result=2; }
1.2 www 120:
1.11 www 121: if ($useropt{$courselevelr}) { $outpar[1]=$useropt{$courselevelr};
122: $result=1; }
1.10 www 123:
1.11 www 124: }
1.2 www 125:
1.8 www 126: return $result;
1.2 www 127: }
128:
1.9 www 129: # ------------------------------------------------------------ Output for value
130:
131: sub valout {
132: my ($value,$type)=@_;
133: return
134: ($value?(($type=~/^date/)?localtime($value):$value):' ');
135: }
136:
1.5 www 137: # -------------------------------------------------------- Produces link anchor
138:
139: sub plink {
140: my ($type,$dis,$value,$marker,$return,$call)=@_;
1.23 ! www 141: my $winvalue=$value;
! 142: unless ($winvalue) {
! 143: if ($type=~/^date/) {
! 144: $winvalue=$ENV{'form.recent_'.$type};
! 145: } else {
! 146: $winvalue=$ENV{'form.recent_'.(split(/\_/,$type))[0]};
! 147: }
! 148: }
! 149: return
! 150: '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
1.8 www 151: .$marker."','".$return."','".$call."'".');">'.
1.22 www 152: &valout($value,$type).'</a><a name="'.$marker.'"></a>';
1.5 www 153: }
154:
1.1 www 155: # ================================================================ Main Handler
156:
157: sub handler {
158: my $r=shift;
159:
160: if ($r->header_only) {
161: $r->content_type('text/html');
162: $r->send_http_header;
163: return OK;
164: }
165:
166: # ----------------------------------------------------- Needs to be in a course
167:
168: if (($ENV{'request.course.fn'}) &&
169: (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {
1.2 www 170: # -------------------------------------------------------- Variable declaration
171:
172: %courseopt=();
173: %useropt=();
174: %bighash=();
175:
1.3 www 176: @ids=();
177: %symbp=();
178: %typep=();
1.2 www 179:
1.12 www 180: my $message='';
181:
182: $csec=$ENV{'form.csec'};
1.2 www 183: $udom=$ENV{'form.udom'};
1.17 www 184: unless ($udom) { $udom=$r->dir_config('lonDefDomain'); }
185:
1.12 www 186: my $id=$ENV{'form.id'};
187: if (($id) && ($udom)) {
188: $uname=(&Apache::lonnet::idget($udom,$id))[1];
189: if ($uname) {
190: $id='';
191: } else {
192: $message=
1.17 www 193: "<font color=red>Unknown ID '$id' at domain '$udom'</font>";
1.12 www 194: }
195: } else {
196: $uname=$ENV{'form.uname'};
197: }
1.2 www 198: unless ($udom) { $uname=''; }
199: $uhome='';
200: if ($uname) {
201: $uhome=&Apache::lonnet::homeserver($uname,$udom);
1.12 www 202:
203: if ($uhome eq 'no_host') {
1.3 www 204: $message=
1.17 www 205: "<font color=red>Unknown user '$uname' at domain '$udom'</font>";
1.3 www 206: $uname='';
1.12 www 207: } else {
208: $csec=&Apache::lonnet::usection(
209: $udom,$uname,$ENV{'request.course.id'});
210: if ($csec eq '-1') {
1.17 www 211: $message="<font color=red>".
212: "User '$uname' at domain '$udom' not in this course</font>";
1.12 www 213: $uname='';
214: $csec=$ENV{'form.csec'};
215: } else {
216: my %name=&Apache::lonnet::userenvironment($udom,$uname,
217: ('firstname','middlename','lastname','generation','id'));
218: $message="\n<p>\nFull Name: ".
219: $name{'firstname'}.' '.$name{'middlename'}
220: .$name{'lastname'}.' '.$name{'generation'}.
221: "<br>\nID: ".$name{'id'}.'<p>';
222: }
223: }
1.3 www 224: }
1.2 www 225:
1.3 www 226: unless ($csec) { $csec=''; }
1.12 www 227:
1.3 www 228: $fcat=$ENV{'form.fcat'};
229: unless ($fcat) { $fcat=''; }
1.2 www 230:
231: # ------------------------------------------------------------------- Tie hashs
232: if ((tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
233: &GDBM_READER,0640)) &&
234: (tie(%parmhash,'GDBM_File',
235: $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) {
236:
1.14 www 237: # --------------------------------------------------------- Get all assessments
1.16 www 238: %allkeys=();
1.17 www 239: %defp=();
1.14 www 240: map {
241: if ($_=~/^src\_(\d+)\.(\d+)$/) {
242: my $mapid=$1;
243: my $resid=$2;
244: my $id=$mapid.'.'.$resid;
1.16 www 245: my $srcf=$bighash{$_};
246: if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
1.14 www 247: $ids[$#ids+1]=$id;
248: $typep{$id}=$1;
1.16 www 249: $keyp{$id}='';
250: map {
251: if ($_=~/^parameter\_(.*)/) {
252: my $key=$_;
253: my $allkey=$1;
1.17 www 254: $allkey=~s/\_/\./;
1.16 www 255: my $display=
256: &Apache::lonnet::metadata($srcf,$key.'.display');
257: unless ($display) {
258: $display=
259: &Apache::lonnet::metadata($srcf,$key.'.name');
260: }
261: $allkeys{$allkey}=$display;
1.17 www 262: if ($allkey eq $fcat) {
263: $defp{$id}=
1.20 www 264: &Apache::lonnet::metadata($srcf,$key);
1.17 www 265: }
1.16 www 266: if ($keyp{$id}) {
267: $keyp{$id}.=','.$key;
268: } else {
269: $keyp{$id}=$key;
270: }
271: }
272: } split(/\,/,
273: &Apache::lonnet::metadata($srcf,'keys'));
1.14 www 274: $mapp{$id}=
275: &Apache::lonnet::declutter($bighash{'map_id_'.$mapid});
276: $symbp{$id}=$mapp{$id}.
277: '___'.$resid.'___'.
1.16 www 278: &Apache::lonnet::declutter($srcf);
1.14 www 279: }
280: }
281: } keys %bighash;
282: # ---------------------------------------------------------- Anything to store?
283: if ($ENV{'form.pres_marker'}) {
284: my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'});
1.15 www 285: $spnam=~s/\_/\./;
286: # ---------------------------------------------------------- Construct prefixes
1.14 www 287:
288: my $symbparm=$symbp{$sresid}.'.'.$spnam;
289: my $mapparm=$mapp{$sresid}.'___(all).'.$spnam;
290:
291: my $seclevel=
292: $ENV{'request.course.id'}.'.['.
293: $csec.'].'.$spnam;
294: my $seclevelr=
295: $ENV{'request.course.id'}.'.['.
296: $csec.'].'.$symbparm;
297: my $seclevelm=
298: $ENV{'request.course.id'}.'.['.
299: $csec.'].'.$mapparm;
300:
301: my $courselevel=
302: $ENV{'request.course.id'}.'.'.$spnam;
303: my $courselevelr=
304: $ENV{'request.course.id'}.'.'.$symbparm;
305: my $courselevelm=
306: $ENV{'request.course.id'}.'.'.$mapparm;
307:
308: my $storeunder='';
309: if (($snum==9) || ($snum==3)) { $storeunder=$courselevel; }
310: if (($snum==8) || ($snum==2)) { $storeunder=$courselevelm; }
311: if (($snum==7) || ($snum==1)) { $storeunder=$courselevelr; }
312: if ($snum==6) { $storeunder=$seclevel; }
313: if ($snum==5) { $storeunder=$seclevelm; }
314: if ($snum==4) { $storeunder=$seclevelr; }
1.15 www 315: $storeunder=&Apache::lonnet::escape($storeunder);
316:
317: my $storecontent=
318: $storeunder.'='.&Apache::lonnet::escape($ENV{'form.pres_value'}).'&'.
319: $storeunder.'.type='.&Apache::lonnet::escape($ENV{'form.pres_type'});
1.14 www 320:
1.15 www 321: my $reply='';
1.14 www 322: if ($snum>3) {
323: # ---------------------------------------------------------------- Store Course
1.15 www 324: $reply=&Apache::lonnet::critical('put:'.
325: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
326: $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'.
327: $storecontent,
328: $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
1.14 www 329: } else {
330: # ------------------------------------------------------------------ Store User
1.15 www 331: $reply=
332: &Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'.
333: $storecontent,$uhome);
334: }
335:
336: if ($reply=~/^error\:(.*)/) {
1.17 www 337: $message.="<font color=red>Write Error: $1</font>";
1.15 www 338: }
339: # ---------------------------------------------------------------- Done storing
340: }
1.2 www 341: # -------------------------------------------------------------- Get coursedata
342: my $reply=&Apache::lonnet::reply('dump:'.
343: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
344: $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata',
345: $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
346: if ($reply!~/^error\:/) {
347: map {
348: my ($name,$value)=split(/\=/,$_);
1.15 www 349: $courseopt{&Apache::lonnet::unescape($name)}=
350: &Apache::lonnet::unescape($value);
1.2 www 351: } split(/\&/,$reply);
352: }
353: # --------------------------------------------------- Get userdata (if present)
354: if ($uname) {
355: my $reply=
356: &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);
357: if ($reply!~/^error\:/) {
358: map {
359: my ($name,$value)=split(/\=/,$_);
1.15 www 360: $useropt{&Apache::lonnet::unescape($name)}=
361: &Apache::lonnet::unescape($value);
1.2 www 362: } split(/\&/,$reply);
363: }
364: }
1.14 www 365:
1.2 www 366: # ------------------------------------------------------------------- Sort this
1.17 www 367:
368: @ids=sort {
369: if ($fcat eq '') {
370: $a<=>$b;
371: } else {
372: $outpar[&parmval($fcat,$a,$defp{$a})]<=>
373: $outpar[&parmval($fcat,$b,$defp{$b})];
374: }
375: } @ids;
1.2 www 376: # ------------------------------------------------------------------ Start page
1.1 www 377: $r->content_type('text/html');
378: $r->send_http_header;
1.5 www 379: $r->print(<<ENDHEAD);
380: <html>
381: <head>
382: <title>LON-CAPA Assessment Parameters</title>
383: <script>
1.13 www 384:
1.5 www 385: function pclose() {
386: parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
387: "height=350,width=350,scrollbars=no,menubar=no");
388: parmwin.close();
389: }
390:
391: function pjump(type,dis,value,marker,ret,call) {
1.13 www 392: document.parmform.pres_marker.value='';
1.6 www 393: parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
394: +"&value="+escape(value)+"&marker="+escape(marker)
395: +"&return="+escape(ret)
396: +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
1.5 www 397: "height=350,width=350,scrollbars=no,menubar=no");
398:
399: }
1.13 www 400:
401: function psub() {
402: pclose();
1.18 www 403: if (document.parmform.pres_marker.value!='') {
1.22 www 404: document.parmform.action+='#'+document.parmform.pres_marker.value;
1.23 ! www 405: var typedef=new Array();
! 406: typedef=document.parmform.pres_type.value.split('_');
! 407: if (typedef[0]=='date') {
! 408: eval('document.parmform.recent_'+
! 409: document.parmform.pres_type.value+
! 410: '.value=document.parmform.pres_value.value;');
! 411: } else {
! 412: eval('document.parmform.recent_'+typedef[0]+
! 413: '.value=document.parmform.pres_value.value;');
! 414: }
1.13 www 415: document.parmform.submit();
416: } else {
417: document.parmform.pres_value.value='';
418: document.parmform.pres_marker.value='';
419: }
420: }
421:
1.5 www 422: </script>
423: </head>
424: <body bgcolor="#FFFFFF" onUnload="pclose()">
425: <h1>Set Assessment Parameters</h1>
1.8 www 426: <form method="post" action="/adm/parmset" name="parmform">
427: <h2>Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h2>
428: <b>
429: Section/Group:
1.12 www 430: <input type="text" value="$csec" size="6" name="csec">
1.8 www 431: <br>
432: For User
1.12 www 433: <input type="text" value="$uname" size="12" name="uname">
434: or ID
435: <input type="text" value="$id" size="12" name="id">
1.8 www 436: at Domain
1.12 www 437: <input type="text" value="$udom" size="6" name="udom">
1.8 www 438: </b>
1.12 www 439: <input type="submit" value="Display">
1.13 www 440: <input type="hidden" value='' name="pres_value">
441: <input type="hidden" value='' name="pres_type">
442: <input type="hidden" value='' name="pres_marker">
1.5 www 443: ENDHEAD
1.23 ! www 444: map {
! 445: $r->print('<input type="hidden" value="'.
! 446: $ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">');
! 447: } ('tolerance','date_default','date_start','date_end','date_interval',
! 448: 'int','float','string');
1.17 www 449:
450: $r->print('<h2>'.$message.'</h2><p>Sort list by ');
1.8 www 451: $r->print('<select name="fcat" onChange="this.form.submit();">');
1.16 www 452: $r->print('<option value="">Enclosing Map</option>');
453: map {
454: $r->print('<option value="'.$_.'"');
455: if ($fcat eq $_) { $r->print(' selected'); }
456: $r->print('>'.$allkeys{$_}.'</option>');
457: } keys %allkeys;
1.8 www 458: $r->print('</select>');
1.10 www 459: # ----------------------------------------------------------------- Start Table
460: my $coursespan=$csec?8:5;
1.9 www 461: $r->print(<<ENDTABLEHEAD);
462: <p><table border=2>
1.11 www 463: <tr><td colspan=5></td>
1.10 www 464: <th colspan=$coursespan>Any User</th>
1.9 www 465: ENDTABLEHEAD
1.10 www 466: if ($uname) {
467: $r->print("<th colspan=3 rowspan=2>User $uname at Domain $udom</th>");
468: }
469: $r->print(<<ENDTABLETWO);
1.11 www 470: <th rowspan=3>Parameter in Effect</th></tr><tr><td colspan=5></td>
1.10 www 471: <th colspan=2>Resource Level</th>
472: <th colspan=3>in Course</th>
473: ENDTABLETWO
1.9 www 474: if ($csec) {
1.10 www 475: $r->print("<th colspan=3>in Section/Group $csec</th>");
1.9 www 476: }
1.10 www 477: $r->print(<<ENDTABLEHEADFOUR);
1.11 www 478: </tr><tr><th>Assessment URL and Title</th><th>Type</th>
1.10 www 479: <th>Enclosing Map</th><th>Part No.</th><th>Parameter Name</th>
1.11 www 480: <th>default</th><th>from Enclosing Map</th>
1.10 www 481: <th>general</th><th>for Enclosing Map</th><th>for Resource</th>
482: ENDTABLEHEADFOUR
483: if ($csec) {
484: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
485: }
486: if ($uname) {
487: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
488: }
489: $r->print('</tr><tr>');
1.19 www 490: my $defbgone='';
491: my $defbgtwo='';
1.3 www 492: map {
1.4 www 493: # ------------------------------------------------------ Entry for one resource
1.19 www 494: if ($defbgone eq '"E0E099"') {
495: $defbgone='"E0E0DD"';
496: } else {
497: $defbgone='"E0E099"';
498: }
499: if ($defbgtwo eq '"FFFF99"') {
500: $defbgtwo='"FFFFDD"';
501: } else {
502: $defbgtwo='"FFFF99"';
503: }
1.8 www 504: @outpar=();
1.5 www 505: my $rid=$_;
506: my $thistitle='';
1.16 www 507: my %name= ();
508: my %part= ();
509: my %display=();
510: my %type= ();
511: my %default=();
512: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
513:
1.4 www 514: map {
1.16 www 515: $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
516: $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
517: $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
518: unless ($display{$_}) { $display{$_}=''; }
519: $display{$_}.=' ('.$name{$_}.')';
1.20 www 520: $default{$_}=&Apache::lonnet::metadata($uri,$_);
1.16 www 521: $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
522: $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
523: } split(/\,/,$keyp{$rid});
524:
1.11 www 525: my $totalparms=scalar keys %name;
1.21 www 526: my $isdef=1;
527: unless ($totalparms) { $totalparms=1; $isdef=0; }
1.19 www 528: $r->print('<td bgcolor='.$defbgone.
529: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.16 www 530: join(' / ',split(/\//,$uri)).
531: '</font></tt><p><b>'.
1.5 www 532: $bighash{'title_'.$rid});
533: if ($thistitle) {
534: $r->print(' ('.$thistitle.')');
535: }
1.11 www 536: $r->print('</b></td>');
1.19 www 537: $r->print('<td bgcolor='.$defbgtwo.
538: ' rowspan='.$totalparms.'>'.$typep{$rid}.'</td>');
539: $r->print('<td bgcolor='.$defbgone.
540: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.10 www 541: join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>');
1.21 www 542: if ($isdef) {
1.11 www 543: map {
544: my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_});
545:
1.19 www 546: $r->print("<td bgcolor=".$defbgtwo.
547: ">$part{$_}</td><td bgcolor=".$defbgone.
548: ">$display{$_}</td>");
1.16 www 549: my $thismarker=$_;
550: $thismarker=~s/^parameter\_//;
551: my $mprefix=$rid.'&'.$thismarker.'&';
1.13 www 552:
1.19 www 553: $r->print('<td bgcolor='.
554: (($result==11)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 555: &valout($outpar[11],$type{$_}).'</td>');
1.19 www 556: $r->print('<td bgcolor='.
557: (($result==10)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 558: &valout($outpar[10],$type{$_}).'</td>');
1.13 www 559:
1.19 www 560: $r->print('<td bgcolor='.
561: (($result==9)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 562: &plink($type{$_},$display{$_},$outpar[9],$mprefix.'9',
563: 'parmform.pres','psub').'</td>');
1.19 www 564: $r->print('<td bgcolor='.
565: (($result==8)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 566: &plink($type{$_},$display{$_},$outpar[8],$mprefix.'8',
567: 'parmform.pres','psub').'</td>');
1.19 www 568: $r->print('<td bgcolor='.
569: (($result==7)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 570: &plink($type{$_},$display{$_},$outpar[7],$mprefix.'7',
571: 'parmform.pres','psub').'</td>');
572:
1.9 www 573: if ($csec) {
1.19 www 574: $r->print('<td bgcolor='.
575: (($result==6)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 576: &plink($type{$_},$display{$_},$outpar[6],$mprefix.'6',
577: 'parmform.pres','psub').'</td>');
1.19 www 578: $r->print('<td bgcolor='.
579: (($result==5)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 580: &plink($type{$_},$display{$_},$outpar[5],$mprefix.'5',
581: 'parmform.pres','psub').'</td>');
1.19 www 582: $r->print('<td bgcolor='.
583: (($result==4)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 584: &plink($type{$_},$display{$_},$outpar[4],$mprefix.'4',
585: 'parmform.pres','psub').'</td>');
1.9 www 586: }
1.13 www 587:
1.9 www 588: if ($uname) {
1.19 www 589: $r->print('<td bgcolor='.
590: (($result==3)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 591: &plink($type{$_},$display{$_},$outpar[3],$mprefix.'3',
592: 'parmform.pres','psub').'</td>');
1.19 www 593: $r->print('<td bgcolor='.
594: (($result==2)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 595: &plink($type{$_},$display{$_},$outpar[2],$mprefix.'2',
596: 'parmform.pres','psub').'</td>');
1.19 www 597: $r->print('<td bgcolor='.
598: (($result==1)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 599: &plink($type{$_},$display{$_},$outpar[1],$mprefix.'1',
600: 'parmform.pres','psub').'</td>');
1.9 www 601: }
1.13 www 602:
1.19 www 603: $r->print(
604: '<td bgcolor=#CCCCFF>'.&valout($outpar[$result],$type{$_}).'</td>');
1.5 www 605: $r->print("</tr>\n<tr>");
1.11 www 606: } sort keys %name;
1.21 www 607: } else {
608: $r->print("</tr>\n<tr>");
609: }
1.4 www 610: # -------------------------------------------------- End entry for one resource
1.3 www 611: } @ids;
1.8 www 612: $r->print('</table></form></body></html>');
1.1 www 613: untie(%bighash);
1.2 www 614: untie(%parmhash);
1.1 www 615: }
616: } else {
617: # ----------------------------- Not in a course, or not allowed to modify parms
618: $ENV{'user.error.msg'}=
1.7 www 619: "/adm/parmset:opa:0:0:Cannot modify assessment parameters";
1.1 www 620: return HTTP_NOT_ACCEPTABLE;
621: }
622: return OK;
623: }
624:
625: 1;
626: __END__
627:
628:
629:
630:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>