Annotation of loncom/interface/lonparmset.pm, revision 1.25
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.24 www 14: # 16/01/01,02/08,03/20 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.24 www 324: #
325: # Expire sheets
1.25 ! www 326: &Apache::lonnet::expirespread('','','studentcalc');
1.24 www 327: if (($snum==7) || ($snum==4)) {
1.25 ! www 328: &Apache::lonnet::expirespread('','','assesscalc',$symbp{$sresid});
1.24 www 329: } elsif (($snum==8) || ($snum==5)) {
1.25 ! www 330: &Apache::lonnet::expirespread('','','assesscalc',$mapp{$sresid});
1.24 www 331: } else {
1.25 ! www 332: &Apache::lonnet::expirespread('','','assesscalc');
1.24 www 333: }
334:
335: # Store parameter
1.15 www 336: $reply=&Apache::lonnet::critical('put:'.
337: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
338: $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'.
339: $storecontent,
340: $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
1.14 www 341: } else {
342: # ------------------------------------------------------------------ Store User
1.24 www 343: #
344: # Expire sheets
345: &Apache::lonnet::expirespread($uname,$udom,'studentcalc');
346: if ($snum==1) {
347: &Apache::lonnet::expirespread
348: ($uname,$udom,'assesscalc',$symbp{$sresid});
349: } elsif ($snum==2) {
350: &Apache::lonnet::expirespread
351: ($uname,$udom,'assesscalc',$mapp{$sresid});
352: } else {
353: &Apache::lonnet::expirespread($uname,$udom,'assesscalc');
354: }
355:
356: # Store parameter
1.15 www 357: $reply=
358: &Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'.
359: $storecontent,$uhome);
360: }
361:
362: if ($reply=~/^error\:(.*)/) {
1.17 www 363: $message.="<font color=red>Write Error: $1</font>";
1.15 www 364: }
365: # ---------------------------------------------------------------- Done storing
366: }
1.2 www 367: # -------------------------------------------------------------- Get coursedata
368: my $reply=&Apache::lonnet::reply('dump:'.
369: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'.
370: $ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata',
371: $ENV{'course.'.$ENV{'request.course.id'}.'.home'});
372: if ($reply!~/^error\:/) {
373: map {
374: my ($name,$value)=split(/\=/,$_);
1.15 www 375: $courseopt{&Apache::lonnet::unescape($name)}=
376: &Apache::lonnet::unescape($value);
1.2 www 377: } split(/\&/,$reply);
378: }
379: # --------------------------------------------------- Get userdata (if present)
380: if ($uname) {
381: my $reply=
382: &Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);
383: if ($reply!~/^error\:/) {
384: map {
385: my ($name,$value)=split(/\=/,$_);
1.15 www 386: $useropt{&Apache::lonnet::unescape($name)}=
387: &Apache::lonnet::unescape($value);
1.2 www 388: } split(/\&/,$reply);
389: }
390: }
1.14 www 391:
1.2 www 392: # ------------------------------------------------------------------- Sort this
1.17 www 393:
394: @ids=sort {
395: if ($fcat eq '') {
396: $a<=>$b;
397: } else {
398: $outpar[&parmval($fcat,$a,$defp{$a})]<=>
399: $outpar[&parmval($fcat,$b,$defp{$b})];
400: }
401: } @ids;
1.2 www 402: # ------------------------------------------------------------------ Start page
1.1 www 403: $r->content_type('text/html');
404: $r->send_http_header;
1.5 www 405: $r->print(<<ENDHEAD);
406: <html>
407: <head>
408: <title>LON-CAPA Assessment Parameters</title>
409: <script>
1.13 www 410:
1.5 www 411: function pclose() {
412: parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
413: "height=350,width=350,scrollbars=no,menubar=no");
414: parmwin.close();
415: }
416:
417: function pjump(type,dis,value,marker,ret,call) {
1.13 www 418: document.parmform.pres_marker.value='';
1.6 www 419: parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
420: +"&value="+escape(value)+"&marker="+escape(marker)
421: +"&return="+escape(ret)
422: +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
1.5 www 423: "height=350,width=350,scrollbars=no,menubar=no");
424:
425: }
1.13 www 426:
427: function psub() {
428: pclose();
1.18 www 429: if (document.parmform.pres_marker.value!='') {
1.22 www 430: document.parmform.action+='#'+document.parmform.pres_marker.value;
1.23 www 431: var typedef=new Array();
432: typedef=document.parmform.pres_type.value.split('_');
433: if (typedef[0]=='date') {
434: eval('document.parmform.recent_'+
435: document.parmform.pres_type.value+
436: '.value=document.parmform.pres_value.value;');
437: } else {
438: eval('document.parmform.recent_'+typedef[0]+
439: '.value=document.parmform.pres_value.value;');
440: }
1.13 www 441: document.parmform.submit();
442: } else {
443: document.parmform.pres_value.value='';
444: document.parmform.pres_marker.value='';
445: }
446: }
447:
1.5 www 448: </script>
449: </head>
450: <body bgcolor="#FFFFFF" onUnload="pclose()">
451: <h1>Set Assessment Parameters</h1>
1.8 www 452: <form method="post" action="/adm/parmset" name="parmform">
453: <h2>Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h2>
454: <b>
455: Section/Group:
1.12 www 456: <input type="text" value="$csec" size="6" name="csec">
1.8 www 457: <br>
458: For User
1.12 www 459: <input type="text" value="$uname" size="12" name="uname">
460: or ID
461: <input type="text" value="$id" size="12" name="id">
1.8 www 462: at Domain
1.12 www 463: <input type="text" value="$udom" size="6" name="udom">
1.8 www 464: </b>
1.12 www 465: <input type="submit" value="Display">
1.13 www 466: <input type="hidden" value='' name="pres_value">
467: <input type="hidden" value='' name="pres_type">
468: <input type="hidden" value='' name="pres_marker">
1.5 www 469: ENDHEAD
1.23 www 470: map {
471: $r->print('<input type="hidden" value="'.
472: $ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">');
473: } ('tolerance','date_default','date_start','date_end','date_interval',
474: 'int','float','string');
1.17 www 475:
476: $r->print('<h2>'.$message.'</h2><p>Sort list by ');
1.8 www 477: $r->print('<select name="fcat" onChange="this.form.submit();">');
1.16 www 478: $r->print('<option value="">Enclosing Map</option>');
479: map {
480: $r->print('<option value="'.$_.'"');
481: if ($fcat eq $_) { $r->print(' selected'); }
482: $r->print('>'.$allkeys{$_}.'</option>');
483: } keys %allkeys;
1.8 www 484: $r->print('</select>');
1.10 www 485: # ----------------------------------------------------------------- Start Table
486: my $coursespan=$csec?8:5;
1.9 www 487: $r->print(<<ENDTABLEHEAD);
488: <p><table border=2>
1.11 www 489: <tr><td colspan=5></td>
1.10 www 490: <th colspan=$coursespan>Any User</th>
1.9 www 491: ENDTABLEHEAD
1.10 www 492: if ($uname) {
493: $r->print("<th colspan=3 rowspan=2>User $uname at Domain $udom</th>");
494: }
495: $r->print(<<ENDTABLETWO);
1.11 www 496: <th rowspan=3>Parameter in Effect</th></tr><tr><td colspan=5></td>
1.10 www 497: <th colspan=2>Resource Level</th>
498: <th colspan=3>in Course</th>
499: ENDTABLETWO
1.9 www 500: if ($csec) {
1.10 www 501: $r->print("<th colspan=3>in Section/Group $csec</th>");
1.9 www 502: }
1.10 www 503: $r->print(<<ENDTABLEHEADFOUR);
1.11 www 504: </tr><tr><th>Assessment URL and Title</th><th>Type</th>
1.10 www 505: <th>Enclosing Map</th><th>Part No.</th><th>Parameter Name</th>
1.11 www 506: <th>default</th><th>from Enclosing Map</th>
1.10 www 507: <th>general</th><th>for Enclosing Map</th><th>for Resource</th>
508: ENDTABLEHEADFOUR
509: if ($csec) {
510: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
511: }
512: if ($uname) {
513: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
514: }
515: $r->print('</tr><tr>');
1.19 www 516: my $defbgone='';
517: my $defbgtwo='';
1.3 www 518: map {
1.4 www 519: # ------------------------------------------------------ Entry for one resource
1.19 www 520: if ($defbgone eq '"E0E099"') {
521: $defbgone='"E0E0DD"';
522: } else {
523: $defbgone='"E0E099"';
524: }
525: if ($defbgtwo eq '"FFFF99"') {
526: $defbgtwo='"FFFFDD"';
527: } else {
528: $defbgtwo='"FFFF99"';
529: }
1.8 www 530: @outpar=();
1.5 www 531: my $rid=$_;
532: my $thistitle='';
1.16 www 533: my %name= ();
534: my %part= ();
535: my %display=();
536: my %type= ();
537: my %default=();
538: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
539:
1.4 www 540: map {
1.16 www 541: $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
542: $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
543: $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
544: unless ($display{$_}) { $display{$_}=''; }
545: $display{$_}.=' ('.$name{$_}.')';
1.20 www 546: $default{$_}=&Apache::lonnet::metadata($uri,$_);
1.16 www 547: $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
548: $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
549: } split(/\,/,$keyp{$rid});
550:
1.11 www 551: my $totalparms=scalar keys %name;
1.21 www 552: my $isdef=1;
553: unless ($totalparms) { $totalparms=1; $isdef=0; }
1.19 www 554: $r->print('<td bgcolor='.$defbgone.
555: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.16 www 556: join(' / ',split(/\//,$uri)).
557: '</font></tt><p><b>'.
1.5 www 558: $bighash{'title_'.$rid});
559: if ($thistitle) {
560: $r->print(' ('.$thistitle.')');
561: }
1.11 www 562: $r->print('</b></td>');
1.19 www 563: $r->print('<td bgcolor='.$defbgtwo.
564: ' rowspan='.$totalparms.'>'.$typep{$rid}.'</td>');
565: $r->print('<td bgcolor='.$defbgone.
566: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.10 www 567: join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>');
1.21 www 568: if ($isdef) {
1.11 www 569: map {
570: my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_});
571:
1.19 www 572: $r->print("<td bgcolor=".$defbgtwo.
573: ">$part{$_}</td><td bgcolor=".$defbgone.
574: ">$display{$_}</td>");
1.16 www 575: my $thismarker=$_;
576: $thismarker=~s/^parameter\_//;
577: my $mprefix=$rid.'&'.$thismarker.'&';
1.13 www 578:
1.19 www 579: $r->print('<td bgcolor='.
580: (($result==11)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 581: &valout($outpar[11],$type{$_}).'</td>');
1.19 www 582: $r->print('<td bgcolor='.
583: (($result==10)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 584: &valout($outpar[10],$type{$_}).'</td>');
1.13 www 585:
1.19 www 586: $r->print('<td bgcolor='.
587: (($result==9)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 588: &plink($type{$_},$display{$_},$outpar[9],$mprefix.'9',
589: 'parmform.pres','psub').'</td>');
1.19 www 590: $r->print('<td bgcolor='.
591: (($result==8)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 592: &plink($type{$_},$display{$_},$outpar[8],$mprefix.'8',
593: 'parmform.pres','psub').'</td>');
1.19 www 594: $r->print('<td bgcolor='.
595: (($result==7)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 596: &plink($type{$_},$display{$_},$outpar[7],$mprefix.'7',
597: 'parmform.pres','psub').'</td>');
598:
1.9 www 599: if ($csec) {
1.19 www 600: $r->print('<td bgcolor='.
601: (($result==6)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 602: &plink($type{$_},$display{$_},$outpar[6],$mprefix.'6',
603: 'parmform.pres','psub').'</td>');
1.19 www 604: $r->print('<td bgcolor='.
605: (($result==5)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 606: &plink($type{$_},$display{$_},$outpar[5],$mprefix.'5',
607: 'parmform.pres','psub').'</td>');
1.19 www 608: $r->print('<td bgcolor='.
609: (($result==4)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 610: &plink($type{$_},$display{$_},$outpar[4],$mprefix.'4',
611: 'parmform.pres','psub').'</td>');
1.9 www 612: }
1.13 www 613:
1.9 www 614: if ($uname) {
1.19 www 615: $r->print('<td bgcolor='.
616: (($result==3)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 617: &plink($type{$_},$display{$_},$outpar[3],$mprefix.'3',
618: 'parmform.pres','psub').'</td>');
1.19 www 619: $r->print('<td bgcolor='.
620: (($result==2)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 621: &plink($type{$_},$display{$_},$outpar[2],$mprefix.'2',
622: 'parmform.pres','psub').'</td>');
1.19 www 623: $r->print('<td bgcolor='.
624: (($result==1)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 625: &plink($type{$_},$display{$_},$outpar[1],$mprefix.'1',
626: 'parmform.pres','psub').'</td>');
1.9 www 627: }
1.13 www 628:
1.19 www 629: $r->print(
630: '<td bgcolor=#CCCCFF>'.&valout($outpar[$result],$type{$_}).'</td>');
1.5 www 631: $r->print("</tr>\n<tr>");
1.11 www 632: } sort keys %name;
1.21 www 633: } else {
634: $r->print("</tr>\n<tr>");
635: }
1.4 www 636: # -------------------------------------------------- End entry for one resource
1.3 www 637: } @ids;
1.8 www 638: $r->print('</table></form></body></html>');
1.1 www 639: untie(%bighash);
1.2 www 640: untie(%parmhash);
1.1 www 641: }
642: } else {
643: # ----------------------------- Not in a course, or not allowed to modify parms
644: $ENV{'user.error.msg'}=
1.7 www 645: "/adm/parmset:opa:0:0:Cannot modify assessment parameters";
1.1 www 646: return HTTP_NOT_ACCEPTABLE;
647: }
648: return OK;
649: }
650:
651: 1;
652: __END__
653:
654:
655:
656:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>