Annotation of loncom/interface/lonparmset.pm, revision 1.27
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.26 www 14: # 16/01/01,02/08,03/20,03/23 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 {
404: $outpar[&parmval($fcat,$a,$defp{$a})]<=>
405: $outpar[&parmval($fcat,$b,$defp{$b})];
406: }
407: } @ids;
1.2 www 408: # ------------------------------------------------------------------ Start page
1.1 www 409: $r->content_type('text/html');
410: $r->send_http_header;
1.5 www 411: $r->print(<<ENDHEAD);
412: <html>
413: <head>
414: <title>LON-CAPA Assessment Parameters</title>
415: <script>
1.13 www 416:
1.5 www 417: function pclose() {
418: parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
419: "height=350,width=350,scrollbars=no,menubar=no");
420: parmwin.close();
421: }
422:
423: function pjump(type,dis,value,marker,ret,call) {
1.13 www 424: document.parmform.pres_marker.value='';
1.6 www 425: parmwin=window.open("/adm/rat/parameter.html?type="+escape(type)
426: +"&value="+escape(value)+"&marker="+escape(marker)
427: +"&return="+escape(ret)
428: +"&call="+escape(call)+"&name="+escape(dis),"LONCAPAparms",
1.5 www 429: "height=350,width=350,scrollbars=no,menubar=no");
430:
431: }
1.13 www 432:
433: function psub() {
434: pclose();
1.18 www 435: if (document.parmform.pres_marker.value!='') {
1.22 www 436: document.parmform.action+='#'+document.parmform.pres_marker.value;
1.23 www 437: var typedef=new Array();
438: typedef=document.parmform.pres_type.value.split('_');
1.27 ! www 439: if (document.parmform.pres_type.value!='') {
1.23 www 440: if (typedef[0]=='date') {
441: eval('document.parmform.recent_'+
442: document.parmform.pres_type.value+
443: '.value=document.parmform.pres_value.value;');
444: } else {
445: eval('document.parmform.recent_'+typedef[0]+
446: '.value=document.parmform.pres_value.value;');
447: }
1.27 ! www 448: }
1.13 www 449: document.parmform.submit();
450: } else {
451: document.parmform.pres_value.value='';
452: document.parmform.pres_marker.value='';
453: }
454: }
455:
1.5 www 456: </script>
457: </head>
458: <body bgcolor="#FFFFFF" onUnload="pclose()">
459: <h1>Set Assessment Parameters</h1>
1.8 www 460: <form method="post" action="/adm/parmset" name="parmform">
461: <h2>Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h2>
462: <b>
463: Section/Group:
1.12 www 464: <input type="text" value="$csec" size="6" name="csec">
1.8 www 465: <br>
466: For User
1.12 www 467: <input type="text" value="$uname" size="12" name="uname">
468: or ID
469: <input type="text" value="$id" size="12" name="id">
1.8 www 470: at Domain
1.12 www 471: <input type="text" value="$udom" size="6" name="udom">
1.8 www 472: </b>
1.13 www 473: <input type="hidden" value='' name="pres_value">
474: <input type="hidden" value='' name="pres_type">
475: <input type="hidden" value='' name="pres_marker">
1.5 www 476: ENDHEAD
1.23 www 477: map {
478: $r->print('<input type="hidden" value="'.
479: $ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">');
480: } ('tolerance','date_default','date_start','date_end','date_interval',
481: 'int','float','string');
1.17 www 482:
1.26 www 483: $r->print('<h2>'.$message.'</h2><table><tr><td>Sort list by</td><td>');
484: $r->print('<select name="fcat">');
1.16 www 485: $r->print('<option value="">Enclosing Map</option>');
486: map {
487: $r->print('<option value="'.$_.'"');
488: if ($fcat eq $_) { $r->print(' selected'); }
489: $r->print('>'.$allkeys{$_}.'</option>');
490: } keys %allkeys;
1.26 www 491: $r->print(
492: '</select></tr><tr><td>Select Enclosing Map</td><td><select name=pschp>');
493: $r->print('<option value=all>All Maps</option>');
494: map {
495: $r->print('<option value="'.$_.'"');
496: if ($pschp eq $_) { $r->print(' selected'); }
497: $r->print('>'.$allmaps{$_}.'</option>');
498: } keys %allmaps;
499: $r->print(
500: '</select></td></tr><tr><td>Select Parameter</td><td><select name=pscat>');
501: $r->print('<option value=all>All Parameters</option>');
502: map {
503: $r->print('<option value="'.$_.'"');
504: if ($pscat eq $_) { $r->print(' selected'); }
505: $r->print('>'.$allkeys{$_}.'</option>');
506: } keys %allkeys;
507: $r->print(
508: '</select></td></tr></table><br><input type="submit" value="Display">');
509: if (($pscat) || ($pschp)) {
1.10 www 510: # ----------------------------------------------------------------- Start Table
1.26 www 511: my $catmarker='parameter_'.$pscat;
512: $catmarker=~s/\./\_/g;
1.10 www 513: my $coursespan=$csec?8:5;
1.9 www 514: $r->print(<<ENDTABLEHEAD);
515: <p><table border=2>
1.11 www 516: <tr><td colspan=5></td>
1.10 www 517: <th colspan=$coursespan>Any User</th>
1.9 www 518: ENDTABLEHEAD
1.10 www 519: if ($uname) {
520: $r->print("<th colspan=3 rowspan=2>User $uname at Domain $udom</th>");
521: }
522: $r->print(<<ENDTABLETWO);
1.11 www 523: <th rowspan=3>Parameter in Effect</th></tr><tr><td colspan=5></td>
1.10 www 524: <th colspan=2>Resource Level</th>
525: <th colspan=3>in Course</th>
526: ENDTABLETWO
1.9 www 527: if ($csec) {
1.10 www 528: $r->print("<th colspan=3>in Section/Group $csec</th>");
1.9 www 529: }
1.10 www 530: $r->print(<<ENDTABLEHEADFOUR);
1.11 www 531: </tr><tr><th>Assessment URL and Title</th><th>Type</th>
1.10 www 532: <th>Enclosing Map</th><th>Part No.</th><th>Parameter Name</th>
1.11 www 533: <th>default</th><th>from Enclosing Map</th>
1.10 www 534: <th>general</th><th>for Enclosing Map</th><th>for Resource</th>
535: ENDTABLEHEADFOUR
536: if ($csec) {
537: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
538: }
539: if ($uname) {
540: $r->print('<th>general</th><th>for Enclosing Map</th><th>for Resource</th>');
541: }
542: $r->print('</tr><tr>');
1.19 www 543: my $defbgone='';
544: my $defbgtwo='';
1.3 www 545: map {
1.26 www 546: my $rid=$_;
547: if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})) {
1.4 www 548: # ------------------------------------------------------ Entry for one resource
1.19 www 549: if ($defbgone eq '"E0E099"') {
550: $defbgone='"E0E0DD"';
551: } else {
552: $defbgone='"E0E099"';
553: }
554: if ($defbgtwo eq '"FFFF99"') {
555: $defbgtwo='"FFFFDD"';
556: } else {
557: $defbgtwo='"FFFF99"';
558: }
1.8 www 559: @outpar=();
1.5 www 560: my $thistitle='';
1.16 www 561: my %name= ();
562: my %part= ();
563: my %display=();
564: my %type= ();
565: my %default=();
566: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
567:
1.4 www 568: map {
1.16 www 569: $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
570: $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
571: $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
572: unless ($display{$_}) { $display{$_}=''; }
573: $display{$_}.=' ('.$name{$_}.')';
1.20 www 574: $default{$_}=&Apache::lonnet::metadata($uri,$_);
1.16 www 575: $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
576: $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
577: } split(/\,/,$keyp{$rid});
578:
1.11 www 579: my $totalparms=scalar keys %name;
1.21 www 580: my $isdef=1;
581: unless ($totalparms) { $totalparms=1; $isdef=0; }
1.26 www 582: if ($pscat ne 'all') { $totalparms=1; }
1.19 www 583: $r->print('<td bgcolor='.$defbgone.
584: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.16 www 585: join(' / ',split(/\//,$uri)).
586: '</font></tt><p><b>'.
1.5 www 587: $bighash{'title_'.$rid});
588: if ($thistitle) {
589: $r->print(' ('.$thistitle.')');
590: }
1.11 www 591: $r->print('</b></td>');
1.19 www 592: $r->print('<td bgcolor='.$defbgtwo.
593: ' rowspan='.$totalparms.'>'.$typep{$rid}.'</td>');
594: $r->print('<td bgcolor='.$defbgone.
595: ' rowspan='.$totalparms.'><tt><font size=-1>'.
1.10 www 596: join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>');
1.21 www 597: if ($isdef) {
1.11 www 598: map {
1.26 www 599: if (($_ eq $catmarker) || ($pscat eq 'all')) {
1.11 www 600: my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_});
601:
1.19 www 602: $r->print("<td bgcolor=".$defbgtwo.
603: ">$part{$_}</td><td bgcolor=".$defbgone.
604: ">$display{$_}</td>");
1.16 www 605: my $thismarker=$_;
606: $thismarker=~s/^parameter\_//;
607: my $mprefix=$rid.'&'.$thismarker.'&';
1.13 www 608:
1.19 www 609: $r->print('<td bgcolor='.
610: (($result==11)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 611: &valout($outpar[11],$type{$_}).'</td>');
1.19 www 612: $r->print('<td bgcolor='.
613: (($result==10)?'"#AAFFAA"':'#FFDDDD').'>'.
1.12 www 614: &valout($outpar[10],$type{$_}).'</td>');
1.13 www 615:
1.19 www 616: $r->print('<td bgcolor='.
617: (($result==9)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 618: &plink($type{$_},$display{$_},$outpar[9],$mprefix.'9',
619: 'parmform.pres','psub').'</td>');
1.19 www 620: $r->print('<td bgcolor='.
621: (($result==8)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 622: &plink($type{$_},$display{$_},$outpar[8],$mprefix.'8',
623: 'parmform.pres','psub').'</td>');
1.19 www 624: $r->print('<td bgcolor='.
625: (($result==7)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 626: &plink($type{$_},$display{$_},$outpar[7],$mprefix.'7',
627: 'parmform.pres','psub').'</td>');
628:
1.9 www 629: if ($csec) {
1.19 www 630: $r->print('<td bgcolor='.
631: (($result==6)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 632: &plink($type{$_},$display{$_},$outpar[6],$mprefix.'6',
633: 'parmform.pres','psub').'</td>');
1.19 www 634: $r->print('<td bgcolor='.
635: (($result==5)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 636: &plink($type{$_},$display{$_},$outpar[5],$mprefix.'5',
637: 'parmform.pres','psub').'</td>');
1.19 www 638: $r->print('<td bgcolor='.
639: (($result==4)?'"#AAFFAA"':$defbgtwo).'>'.
1.13 www 640: &plink($type{$_},$display{$_},$outpar[4],$mprefix.'4',
641: 'parmform.pres','psub').'</td>');
1.9 www 642: }
1.13 www 643:
1.9 www 644: if ($uname) {
1.19 www 645: $r->print('<td bgcolor='.
646: (($result==3)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 647: &plink($type{$_},$display{$_},$outpar[3],$mprefix.'3',
648: 'parmform.pres','psub').'</td>');
1.19 www 649: $r->print('<td bgcolor='.
650: (($result==2)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 651: &plink($type{$_},$display{$_},$outpar[2],$mprefix.'2',
652: 'parmform.pres','psub').'</td>');
1.19 www 653: $r->print('<td bgcolor='.
654: (($result==1)?'"#AAFFAA"':$defbgone).'>'.
1.13 www 655: &plink($type{$_},$display{$_},$outpar[1],$mprefix.'1',
656: 'parmform.pres','psub').'</td>');
1.9 www 657: }
1.19 www 658: $r->print(
659: '<td bgcolor=#CCCCFF>'.&valout($outpar[$result],$type{$_}).'</td>');
1.5 www 660: $r->print("</tr>\n<tr>");
1.26 www 661: }
1.11 www 662: } sort keys %name;
1.21 www 663: } else {
1.26 www 664: $r->print("</tr>\n<tr>");
1.21 www 665: }
1.4 www 666: # -------------------------------------------------- End entry for one resource
1.26 www 667: }
1.3 www 668: } @ids;
1.26 www 669: $r->print('</table>');
670: }
671: $r->print('</form></body></html>');
1.1 www 672: untie(%bighash);
1.2 www 673: untie(%parmhash);
1.1 www 674: }
675: } else {
676: # ----------------------------- Not in a course, or not allowed to modify parms
677: $ENV{'user.error.msg'}=
1.7 www 678: "/adm/parmset:opa:0:0:Cannot modify assessment parameters";
1.1 www 679: return HTTP_NOT_ACCEPTABLE;
680: }
681: return OK;
682: }
683:
684: 1;
685: __END__
686:
687:
688:
689:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>