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