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