Annotation of loncom/interface/lonparmset.pm, revision 1.110
1.1 www 1: # The LearningOnline Network with CAPA
2: # Handler to set parameters for assessments
3: #
1.110 ! sakharuk 4: # $Id: lonparmset.pm,v 1.109 2003/06/23 21:42:07 albertel Exp $
1.40 albertel 5: #
6: # Copyright Michigan State University Board of Trustees
7: #
8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
9: #
10: # LON-CAPA is free software; you can redistribute it and/or modify
11: # it under the terms of the GNU General Public License as published by
12: # the Free Software Foundation; either version 2 of the License, or
13: # (at your option) any later version.
14: #
15: # LON-CAPA is distributed in the hope that it will be useful,
16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18: # GNU General Public License for more details.
19: #
20: # You should have received a copy of the GNU General Public License
21: # along with LON-CAPA; if not, write to the Free Software
22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23: #
24: # /home/httpd/html/adm/gpl.txt
25: #
26: # http://www.lon-capa.org/
27: #
1.59 matthew 28: ###################################################################
29: ###################################################################
30:
31: =pod
32:
33: =head1 NAME
34:
35: lonparmset - Handler to set parameters for assessments and course
36:
37: =head1 SYNOPSIS
38:
39: lonparmset provides an interface to setting course parameters.
40:
41: =head1 DESCRIPTION
42:
43: This module sets coursewide and assessment parameters.
44:
45: =head1 INTERNAL SUBROUTINES
46:
47: =over 4
48:
49: =cut
50:
51: ###################################################################
52: ###################################################################
1.1 www 53:
54: package Apache::lonparmset;
55:
56: use strict;
57: use Apache::lonnet;
58: use Apache::Constants qw(:common :http REDIRECT);
1.88 matthew 59: use Apache::lonhtmlcommon();
1.36 albertel 60: use Apache::loncommon;
1.1 www 61: use GDBM_File;
1.57 albertel 62: use Apache::lonhomework;
63: use Apache::lonxml;
1.4 www 64:
1.1 www 65:
1.2 www 66: my %courseopt;
67: my %useropt;
68: my %parmhash;
69:
1.3 www 70: my @ids;
71: my %symbp;
1.10 www 72: my %mapp;
1.3 www 73: my %typep;
1.16 www 74: my %keyp;
1.2 www 75:
1.82 www 76: my %maptitles;
77:
1.2 www 78: my $uname;
79: my $udom;
80: my $uhome;
81: my $csec;
1.57 albertel 82: my $coursename;
1.2 www 83:
1.59 matthew 84: ##################################################
85: ##################################################
86:
87: =pod
88:
89: =item parmval
90:
91: Figure out a cascading parameter.
92:
1.71 albertel 93: Inputs: $what - a parameter spec (incluse part info and name I.E. 0.weight)
94: $id - a bighash Id number
95: $def - the resource's default value 'stupid emacs
96:
97: Returns: A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 11 possible levels
98:
99: 11- resource default
100: 10- map default
101: 9 - General Course
1.82 www 102: 8 - Map or Folder level in course
1.71 albertel 103: 7 - resource level in course
104: 6 - General for section
1.82 www 105: 5 - Map or Folder level for section
1.71 albertel 106: 4 - resource level in section
107: 3 - General for specific student
1.82 www 108: 2 - Map or Folder level for specific student
1.71 albertel 109: 1 - resource level for specific student
1.2 www 110:
1.59 matthew 111: =cut
112:
113: ##################################################
114: ##################################################
1.2 www 115: sub parmval {
1.11 www 116: my ($what,$id,$def)=@_;
1.8 www 117: my $result='';
1.44 albertel 118: my @outpar=();
1.2 www 119: # ----------------------------------------------------- Cascading lookup scheme
1.10 www 120:
1.43 albertel 121: my $symbparm=$symbp{$id}.'.'.$what;
122: my $mapparm=$mapp{$id}.'___(all).'.$what;
1.10 www 123:
1.43 albertel 124: my $seclevel=$ENV{'request.course.id'}.'.['.$csec.'].'.$what;
125: my $seclevelr=$ENV{'request.course.id'}.'.['.$csec.'].'.$symbparm;
126: my $seclevelm=$ENV{'request.course.id'}.'.['.$csec.'].'.$mapparm;
127:
128: my $courselevel=$ENV{'request.course.id'}.'.'.$what;
129: my $courselevelr=$ENV{'request.course.id'}.'.'.$symbparm;
130: my $courselevelm=$ENV{'request.course.id'}.'.'.$mapparm;
1.2 www 131:
1.11 www 132: # -------------------------------------------------------- first, check default
133:
1.43 albertel 134: if ($def) { $outpar[11]=$def; $result=11; }
1.11 www 135:
136: # ----------------------------------------------------- second, check map parms
137:
1.43 albertel 138: my $thisparm=$parmhash{$symbparm};
139: if ($thisparm) { $outpar[10]=$thisparm; $result=10; }
1.11 www 140:
141: # --------------------------------------------------------- third, check course
142:
1.71 albertel 143: if (defined($courseopt{$courselevel})) {
1.43 albertel 144: $outpar[9]=$courseopt{$courselevel};
145: $result=9;
146: }
1.11 www 147:
1.71 albertel 148: if (defined($courseopt{$courselevelm})) {
1.43 albertel 149: $outpar[8]=$courseopt{$courselevelm};
150: $result=8;
151: }
1.11 www 152:
1.71 albertel 153: if (defined($courseopt{$courselevelr})) {
1.43 albertel 154: $outpar[7]=$courseopt{$courselevelr};
155: $result=7;
156: }
1.11 www 157:
1.71 albertel 158: if (defined($csec)) {
159: if (defined($courseopt{$seclevel})) {
1.43 albertel 160: $outpar[6]=$courseopt{$seclevel};
161: $result=6;
162: }
1.71 albertel 163: if (defined($courseopt{$seclevelm})) {
1.43 albertel 164: $outpar[5]=$courseopt{$seclevelm};
165: $result=5;
166: }
167:
1.71 albertel 168: if (defined($courseopt{$seclevelr})) {
1.43 albertel 169: $outpar[4]=$courseopt{$seclevelr};
170: $result=4;
171: }
172: }
1.11 www 173:
174: # ---------------------------------------------------------- fourth, check user
175:
1.71 albertel 176: if (defined($uname)) {
177: if (defined($useropt{$courselevel})) {
1.43 albertel 178: $outpar[3]=$useropt{$courselevel};
179: $result=3;
180: }
1.10 www 181:
1.71 albertel 182: if (defined($useropt{$courselevelm})) {
1.43 albertel 183: $outpar[2]=$useropt{$courselevelm};
184: $result=2;
185: }
1.2 www 186:
1.71 albertel 187: if (defined($useropt{$courselevelr})) {
1.43 albertel 188: $outpar[1]=$useropt{$courselevelr};
189: $result=1;
190: }
191: }
1.44 albertel 192: return ($result,@outpar);
1.2 www 193: }
194:
1.59 matthew 195: ##################################################
196: ##################################################
197:
198: =pod
199:
200: =item valout
201:
202: Format a value for output.
203:
204: Inputs: $value, $type
205:
206: Returns: $value, formatted for output. If $type indicates it is a date,
207: localtime($value) is returned.
1.9 www 208:
1.59 matthew 209: =cut
210:
211: ##################################################
212: ##################################################
1.9 www 213: sub valout {
214: my ($value,$type)=@_;
1.59 matthew 215: my $result = '';
216: # Values of zero are valid.
217: if (! $value && $value ne '0') {
1.71 albertel 218: $result = ' ';
1.59 matthew 219: } else {
1.66 www 220: if ($type eq 'date_interval') {
221: my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
222: $year=$year-70;
223: $mday--;
224: if ($year) {
225: $result.=$year.' yrs ';
226: }
227: if ($mon) {
228: $result.=$mon.' mths ';
229: }
230: if ($mday) {
231: $result.=$mday.' days ';
232: }
233: if ($hour) {
234: $result.=$hour.' hrs ';
235: }
236: if ($min) {
237: $result.=$min.' mins ';
238: }
239: if ($sec) {
240: $result.=$sec.' secs ';
241: }
242: $result=~s/\s+$//;
243: } elsif ($type=~/^date/) {
1.59 matthew 244: $result = localtime($value);
245: } else {
246: $result = $value;
247: }
248: }
249: return $result;
1.9 www 250: }
251:
1.59 matthew 252: ##################################################
253: ##################################################
254:
255: =pod
1.5 www 256:
1.59 matthew 257: =item plink
258:
259: Produces a link anchor.
260:
261: Inputs: $type,$dis,$value,$marker,$return,$call
262:
263: Returns: scalar with html code for a link which will envoke the
264: javascript function 'pjump'.
265:
266: =cut
267:
268: ##################################################
269: ##################################################
1.5 www 270: sub plink {
271: my ($type,$dis,$value,$marker,$return,$call)=@_;
1.23 www 272: my $winvalue=$value;
273: unless ($winvalue) {
274: if ($type=~/^date/) {
275: $winvalue=$ENV{'form.recent_'.$type};
276: } else {
277: $winvalue=$ENV{'form.recent_'.(split(/\_/,$type))[0]};
278: }
279: }
280: return
1.43 albertel 281: '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
282: .$marker."','".$return."','".$call."'".');">'.
283: &valout($value,$type).'</a><a name="'.$marker.'"></a>';
1.5 www 284: }
285:
1.44 albertel 286:
287: sub startpage {
1.99 albertel 288: my ($r,$id,$udom,$csec,$uname,$have_assesments)=@_;
289:
1.98 www 290: my $bodytag=&Apache::loncommon::bodytag('Set Course Parameters','',
291: 'onUnload="pclose()"');
1.81 www 292: my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
293: &Apache::loncommon::selectstudent_link('parmform','uname','udom');
294: my $selscript=&Apache::loncommon::studentbrowser_javascript();
1.88 matthew 295: my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
1.44 albertel 296: $r->print(<<ENDHEAD);
297: <html>
298: <head>
299: <title>LON-CAPA Course Parameters</title>
300: <script>
301:
302: function pclose() {
303: parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
304: "height=350,width=350,scrollbars=no,menubar=no");
305: parmwin.close();
306: }
307:
1.88 matthew 308: $pjump_def
1.44 albertel 309:
310: function psub() {
311: pclose();
312: if (document.parmform.pres_marker.value!='') {
313: document.parmform.action+='#'+document.parmform.pres_marker.value;
314: var typedef=new Array();
315: typedef=document.parmform.pres_type.value.split('_');
316: if (document.parmform.pres_type.value!='') {
317: if (typedef[0]=='date') {
318: eval('document.parmform.recent_'+
319: document.parmform.pres_type.value+
320: '.value=document.parmform.pres_value.value;');
321: } else {
322: eval('document.parmform.recent_'+typedef[0]+
323: '.value=document.parmform.pres_value.value;');
324: }
325: }
326: document.parmform.submit();
327: } else {
328: document.parmform.pres_value.value='';
329: document.parmform.pres_marker.value='';
330: }
331: }
332:
1.57 albertel 333: function openWindow(url, wdwName, w, h, toolbar,scrollbar) {
334: var options = "width=" + w + ",height=" + h + ",";
335: options += "resizable=yes,scrollbars="+scrollbar+",status=no,";
336: options += "menubar=no,toolbar="+toolbar+",location=no,directories=no";
337: var newWin = window.open(url, wdwName, options);
338: newWin.focus();
339: }
1.44 albertel 340: </script>
1.81 www 341: $selscript
1.44 albertel 342: </head>
1.64 www 343: $bodytag
1.91 bowersj2 344:
1.44 albertel 345: <form method="post" action="/adm/parmset" name="envform">
346: <h3>Course Environment</h3>
347: <input type="submit" name="crsenv" value="Set Course Environment">
348: </form>
1.101 www 349: <hr />
1.44 albertel 350: <form method="post" action="/adm/parmset" name="parmform">
351: <h3>Course Assessments</h3>
1.101 www 352:
353: <a href="/adm/helper/parameter.helper">Use Assignment Parameter Helper</a>, a
354: simpler interface to set open, due, or answer open dates for problems or
355: sequences.<br /> <br />
1.99 albertel 356: ENDHEAD
357:
358: if (!$have_assesments) {
359: $r->print('<font color="red">There are no assesment parameters in this course to set.</font><br />');
360: } else {
361: $r->print(<<ENDHEAD);
1.44 albertel 362: <b>
363: Section/Group:
364: <input type="text" value="$csec" size="6" name="csec">
365: <br>
366: For User
367: <input type="text" value="$uname" size="12" name="uname">
368: or ID
369: <input type="text" value="$id" size="12" name="id">
370: at Domain
1.81 www 371: $chooseopt
1.44 albertel 372: </b>
373: <input type="hidden" value='' name="pres_value">
374: <input type="hidden" value='' name="pres_type">
375: <input type="hidden" value='' name="pres_marker">
376: ENDHEAD
1.99 albertel 377: }
1.44 albertel 378: }
379:
380: sub print_row {
1.66 www 381: my ($r,$which,$part,$name,$rid,$default,$defaulttype,$display,$defbgone,
1.57 albertel 382: $defbgtwo,$parmlev)=@_;
1.66 www 383: # get the values for the parameter in cascading order
384: # empty levels will remain empty
1.44 albertel 385: my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which},
386: $rid,$$default{$which});
1.66 www 387: # get the type for the parameters
388: # problem: these may not be set for all levels
389: my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'.
390: $$name{$which}.'.type',
391: $rid,$$defaulttype{$which});
392: # cascade down manually
393: my $cascadetype=$defaulttype;
394: for (my $i=$#typeoutpar;$i>0;$i--) {
395: if ($typeoutpar[$i]) {
396: $cascadetype=$typeoutpar[$i];
397: } else {
398: $typeoutpar[$i]=$cascadetype;
399: }
400: }
401:
1.57 albertel 402: my $parm=$$display{$which};
403:
404: if ($parmlev eq 'full' || $parmlev eq 'brief') {
405: $r->print('<td bgcolor='.$defbgtwo.' align="center">'
406: .$$part{$which}.'</td>');
407: } else {
408: $parm=~s|\[.*\]\s||g;
409: }
410:
411: $r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>');
412:
1.44 albertel 413: my $thismarker=$which;
414: $thismarker=~s/^parameter\_//;
415: my $mprefix=$rid.'&'.$thismarker.'&';
416:
1.57 albertel 417: if ($parmlev eq 'general') {
418:
419: if ($uname) {
1.66 www 420: &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 421: } elsif ($csec) {
1.66 www 422: &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 423: } else {
1.66 www 424: &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 425: }
426: } elsif ($parmlev eq 'map') {
427:
428: if ($uname) {
1.66 www 429: &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 430: } elsif ($csec) {
1.66 www 431: &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 432: } else {
1.66 www 433: &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 434: }
435: } else {
436:
1.66 www 437: &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 438:
439: if ($parmlev eq 'brief') {
440:
1.66 www 441: &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 442:
443: if ($csec) {
1.66 www 444: &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 445: }
446: if ($uname) {
1.66 www 447: &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 448: }
449: } else {
450:
1.66 www 451: &print_td($r,10,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
452: &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
453: &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
454: &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 455:
456: if ($csec) {
1.66 www 457: &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
458: &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
459: &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 460: }
461: if ($uname) {
1.66 www 462: &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
463: &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
464: &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
1.57 albertel 465: }
466: } # end of $brief if/else
467: } # end of $parmlev if/else
468:
469: if ($parmlev eq 'full' || $parmlev eq 'brief') {
1.59 matthew 470: $r->print('<td bgcolor=#CCCCFF align="center">'.
1.66 www 471: &valout($outpar[$result],$typeoutpar[$result]).'</td>');
1.59 matthew 472: }
1.44 albertel 473: my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
1.57 albertel 474: '.'.$$name{$which},$symbp{$rid});
1.70 albertel 475: # this doesn't seem to work, and I don't think is correct
476: # my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}.
477: # '.'.$$name{$which}.'.type',$symbp{$rid});
478: # this seems to work
479: my $sessionvaltype=$typeoutpar[$result];
1.72 albertel 480: if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
1.57 albertel 481: $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.
1.66 www 482: &valout($sessionval,$sessionvaltype).' '.
1.57 albertel 483: '</font></td>');
1.44 albertel 484: $r->print('</tr>');
1.57 albertel 485: $r->print("\n");
1.44 albertel 486: }
1.59 matthew 487:
1.44 albertel 488: sub print_td {
1.66 www 489: my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
1.57 albertel 490: $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).
491: ' align="center">'.
1.66 www 492: &plink($$typeoutpar[$which],$$display{$value},$$outpar[$which],
1.57 albertel 493: $mprefix."$which",'parmform.pres','psub').'</td>'."\n");
494: }
495:
496: sub get_env_multiple {
497: my ($name) = @_;
498: my @values;
499: if (defined($ENV{$name})) {
500: # exists is it an array
501: if (ref($ENV{$name})) {
502: @values=@{ $ENV{$name} };
503: } else {
504: $values[0]=$ENV{$name};
505: }
506: }
507: return(@values);
1.44 albertel 508: }
509:
1.63 bowersj2 510: =pod
511:
512: =item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
513:
514: Input: See list below:
515:
516: =over 4
517:
518: =item B<ids>: An array that will contain all of the ids in the course.
519:
520: =item B<typep>: hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
521:
522: =item B<keyp>: hash, id->key list, will contain a comma seperated list of the meta-data keys available for the given id
523:
524: =item B<allparms>: hash, name of parameter->display value (what is the display value?)
525:
526: =item B<allparts>: hash, part identification->text representation of part, where the text representation is "[Part $part]"
527:
528: =item B<allkeys>: hash, full key to part->display value (what's display value?)
529:
530: =item B<allmaps>: hash, ???
531:
532: =item B<fcat>: ???
533:
534: =item B<defp>: hash, ???
535:
536: =item B<mapp>: ??
537:
538: =item B<symbp>: hash, id->full sym?
539:
540: =back
541:
542: =cut
543:
544: sub extractResourceInformation {
545: my $bighash = shift;
546: my $ids = shift;
547: my $typep = shift;
548: my $keyp = shift;
549: my $allparms = shift;
550: my $allparts = shift;
551: my $allkeys = shift;
552: my $allmaps = shift;
553: my $fcat = shift;
554: my $defp = shift;
555: my $mapp = shift;
556: my $symbp = shift;
1.82 www 557: my $maptitles=shift;
1.63 bowersj2 558:
559: foreach (keys %$bighash) {
560: if ($_=~/^src\_(\d+)\.(\d+)$/) {
561: my $mapid=$1;
562: my $resid=$2;
563: my $id=$mapid.'.'.$resid;
564: my $srcf=$$bighash{$_};
565: if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
566: $$ids[$#$ids+1]=$id;
567: $$typep{$id}=$1;
568: $$keyp{$id}='';
1.65 albertel 569: foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
1.63 bowersj2 570: if ($_=~/^parameter\_(.*)/) {
571: my $key=$_;
572: my $allkey=$1;
573: $allkey=~s/\_/\./g;
574: my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
575: my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
576: my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
577: my $parmdis = $display;
578: $parmdis =~ s|(\[Part.*$)||g;
579: my $partkey = $part;
580: $partkey =~ tr|_|.|;
581: $$allparms{$name} = $parmdis;
582: $$allparts{$part} = "[Part $part]";
583: $$allkeys{$allkey}=$display;
584: if ($allkey eq $fcat) {
585: $$defp{$id}= &Apache::lonnet::metadata($srcf,$key);
586: }
587: if ($$keyp{$id}) {
588: $$keyp{$id}.=','.$key;
589: } else {
590: $$keyp{$id}=$key;
591: }
592: }
593: }
594: $$mapp{$id}=
595: &Apache::lonnet::declutter($$bighash{'map_id_'.$mapid});
596: $$mapp{$mapid}=$$mapp{$id};
597: $$allmaps{$mapid}=$$mapp{$id};
1.82 www 598: $$maptitles{$mapid}=
599: $$bighash{'title_'.$$bighash{'ids_'.&Apache::lonnet::clutter($$mapp{$id})}};
600: $$maptitles{$$mapp{$id}}=$$maptitles{$mapid};
1.63 bowersj2 601: $$symbp{$id}=$$mapp{$id}.
602: '___'.$resid.'___'.
603: &Apache::lonnet::declutter($srcf);
604: $$symbp{$mapid}=$$mapp{$id}.'___(all)';
605: }
606: }
607: }
608: }
609:
1.59 matthew 610: ##################################################
611: ##################################################
612:
613: =pod
614:
615: =item assessparms
616:
617: Show assessment data and parameters. This is a large routine that should
618: be simplified and shortened... someday.
619:
620: Inputs: $r
621:
622: Returns: nothing
623:
1.63 bowersj2 624: Variables used (guessed by Jeremy):
625:
626: =over 4
627:
628: =item B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
629:
630: =item B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
631:
632: =item B<allmaps>:
633:
634: =back
635:
1.59 matthew 636: =cut
637:
638: ##################################################
639: ##################################################
1.30 www 640: sub assessparms {
1.1 www 641:
1.43 albertel 642: my $r=shift;
1.2 www 643: # -------------------------------------------------------- Variable declaration
1.43 albertel 644: my %allkeys;
645: my %allmaps;
1.57 albertel 646: my %alllevs;
647:
648: $alllevs{'Resource Level'}='full';
649: # $alllevs{'Resource Level [BRIEF]'}='brief';
650: $alllevs{'Map Level'}='map';
651: $alllevs{'Course Level'}='general';
652:
653: my %allparms;
654: my %allparts;
655:
1.43 albertel 656: my %defp;
657: %courseopt=();
658: %useropt=();
1.44 albertel 659: my %bighash=();
1.43 albertel 660:
661: @ids=();
662: %symbp=();
663: %typep=();
664:
665: my $message='';
666:
667: $csec=$ENV{'form.csec'};
668: $udom=$ENV{'form.udom'};
669: unless ($udom) { $udom=$r->dir_config('lonDefDomain'); }
670:
1.57 albertel 671: my @pscat=&get_env_multiple('form.pscat');
1.43 albertel 672: my $pschp=$ENV{'form.pschp'};
1.57 albertel 673: my @psprt=&get_env_multiple('form.psprt');
1.76 www 674: if (!@psprt) { $psprt[0]='0'; }
1.57 albertel 675: my $showoptions=$ENV{'form.showoptions'};
676:
1.43 albertel 677: my $pssymb='';
1.57 albertel 678: my $parmlev='';
679: my $prevvisit=$ENV{'form.prevvisit'};
680:
681: # unless ($parmlev==$ENV{'form.parmlev'}) {
682: # $parmlev = 'full';
683: # }
684:
685: unless ($ENV{'form.parmlev'}) {
686: $parmlev = 'map';
687: } else {
688: $parmlev = $ENV{'form.parmlev'};
689: }
1.26 www 690:
1.29 www 691: # ----------------------------------------------- Was this started from grades?
692:
1.43 albertel 693: if (($ENV{'form.command'} eq 'set') && ($ENV{'form.url'})
694: && (!$ENV{'form.dis'})) {
695: my $url=$ENV{'form.url'};
696: $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
697: $pssymb=&Apache::lonnet::symbread($url);
1.92 albertel 698: if (!@pscat) { @pscat=('all'); }
1.43 albertel 699: $pschp='';
1.57 albertel 700: $parmlev = 'full';
1.43 albertel 701: } elsif ($ENV{'form.symb'}) {
702: $pssymb=$ENV{'form.symb'};
1.92 albertel 703: if (!@pscat) { @pscat=('all'); }
1.43 albertel 704: $pschp='';
1.57 albertel 705: $parmlev = 'full';
1.43 albertel 706: } else {
707: $ENV{'form.url'}='';
708: }
709:
710: my $id=$ENV{'form.id'};
711: if (($id) && ($udom)) {
712: $uname=(&Apache::lonnet::idget($udom,$id))[1];
713: if ($uname) {
714: $id='';
715: } else {
716: $message=
717: "<font color=red>Unknown ID '$id' at domain '$udom'</font>";
718: }
719: } else {
720: $uname=$ENV{'form.uname'};
721: }
722: unless ($udom) { $uname=''; }
723: $uhome='';
724: if ($uname) {
725: $uhome=&Apache::lonnet::homeserver($uname,$udom);
726: if ($uhome eq 'no_host') {
727: $message=
728: "<font color=red>Unknown user '$uname' at domain '$udom'</font>";
729: $uname='';
1.12 www 730: } else {
1.103 albertel 731: $csec=&Apache::lonnet::getsection($udom,$uname,
732: $ENV{'request.course.id'});
1.43 albertel 733: if ($csec eq '-1') {
734: $message="<font color=red>".
1.45 matthew 735: "User '$uname' at domain '$udom' not ".
736: "in this course</font>";
1.43 albertel 737: $uname='';
738: $csec=$ENV{'form.csec'};
739: } else {
740: my %name=&Apache::lonnet::userenvironment($udom,$uname,
741: ('firstname','middlename','lastname','generation','id'));
742: $message="\n<p>\nFull Name: ".
743: $name{'firstname'}.' '.$name{'middlename'}.' '
744: .$name{'lastname'}.' '.$name{'generation'}.
745: "<br>\nID: ".$name{'id'}.'<p>';
746: }
1.12 www 747: }
1.43 albertel 748: }
1.2 www 749:
1.43 albertel 750: unless ($csec) { $csec=''; }
1.12 www 751:
1.44 albertel 752: my $fcat=$ENV{'form.fcat'};
1.43 albertel 753: unless ($fcat) { $fcat=''; }
1.2 www 754:
755: # ------------------------------------------------------------------- Tie hashs
1.44 albertel 756: if (!(tie(%bighash,'GDBM_File',$ENV{'request.course.fn'}.'.db',
1.58 albertel 757: &GDBM_READER(),0640))) {
1.44 albertel 758: $r->print("Unable to access course data. (File $ENV{'request.course.fn'}.db not tieable)");
759: return ;
760: }
761: if (!(tie(%parmhash,'GDBM_File',
1.58 albertel 762: $ENV{'request.course.fn'}.'_parms.db',&GDBM_READER(),0640))) {
1.44 albertel 763: $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)");
764: return ;
765: }
1.63 bowersj2 766:
1.14 www 767: # --------------------------------------------------------- Get all assessments
1.82 www 768: extractResourceInformation(\%bighash, \@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allkeys, \%allmaps, $fcat, \%defp, \%mapp, \%symbp,\%maptitles);
1.63 bowersj2 769:
1.57 albertel 770: $mapp{'0.0'} = '';
771: $symbp{'0.0'} = '';
1.99 albertel 772:
1.14 www 773: # ---------------------------------------------------------- Anything to store?
1.44 albertel 774: if ($ENV{'form.pres_marker'}) {
775: my ($sresid,$spnam,$snum)=split(/\&/,$ENV{'form.pres_marker'});
776: $spnam=~s/\_([^\_]+)$/\.$1/;
1.15 www 777: # ---------------------------------------------------------- Construct prefixes
1.14 www 778:
1.44 albertel 779: my $symbparm=$symbp{$sresid}.'.'.$spnam;
780: my $mapparm=$mapp{$sresid}.'___(all).'.$spnam;
781:
782: my $seclevel=$ENV{'request.course.id'}.'.['.$csec.'].'.$spnam;
783: my $seclevelr=$ENV{'request.course.id'}.'.['.$csec.'].'.$symbparm;
784: my $seclevelm=$ENV{'request.course.id'}.'.['.$csec.'].'.$mapparm;
785:
786: my $courselevel=$ENV{'request.course.id'}.'.'.$spnam;
787: my $courselevelr=$ENV{'request.course.id'}.'.'.$symbparm;
788: my $courselevelm=$ENV{'request.course.id'}.'.'.$mapparm;
789:
790: my $storeunder='';
791: if (($snum==9) || ($snum==3)) { $storeunder=$courselevel; }
792: if (($snum==8) || ($snum==2)) { $storeunder=$courselevelm; }
793: if (($snum==7) || ($snum==1)) { $storeunder=$courselevelr; }
794: if ($snum==6) { $storeunder=$seclevel; }
795: if ($snum==5) { $storeunder=$seclevelm; }
796: if ($snum==4) { $storeunder=$seclevelr; }
797:
1.79 albertel 798: my $delete;
799: if ($ENV{'form.pres_value'} eq '') { $delete=1;}
1.66 www 800: my %storecontent = ($storeunder => $ENV{'form.pres_value'},
801: $storeunder.'.type' => $ENV{'form.pres_type'});
1.44 albertel 802: my $reply='';
803: if ($snum>3) {
1.14 www 804: # ---------------------------------------------------------------- Store Course
1.24 www 805: #
806: # Expire sheets
1.44 albertel 807: &Apache::lonnet::expirespread('','','studentcalc');
808: if (($snum==7) || ($snum==4)) {
809: &Apache::lonnet::expirespread('','','assesscalc',$symbp{$sresid});
810: } elsif (($snum==8) || ($snum==5)) {
811: &Apache::lonnet::expirespread('','','assesscalc',$mapp{$sresid});
812: } else {
813: &Apache::lonnet::expirespread('','','assesscalc');
814: }
1.24 www 815: # Store parameter
1.79 albertel 816: if ($delete) {
817: $reply=&Apache::lonnet::del
818: ('resourcedata',[keys(%storecontent)],
819: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
820: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
821: } else {
822: $reply=&Apache::lonnet::cput
823: ('resourcedata',\%storecontent,
824: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
825: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
826: }
1.44 albertel 827: } else {
1.14 www 828: # ------------------------------------------------------------------ Store User
1.24 www 829: #
830: # Expire sheets
1.44 albertel 831: &Apache::lonnet::expirespread($uname,$udom,'studentcalc');
832: if ($snum==1) {
833: &Apache::lonnet::expirespread
834: ($uname,$udom,'assesscalc',$symbp{$sresid});
835: } elsif ($snum==2) {
836: &Apache::lonnet::expirespread
837: ($uname,$udom,'assesscalc',$mapp{$sresid});
838: } else {
839: &Apache::lonnet::expirespread($uname,$udom,'assesscalc');
840: }
1.24 www 841: # Store parameter
1.79 albertel 842: if ($delete) {
843: $reply=&Apache::lonnet::del
844: ('resourcedata',[keys(%storecontent)],$udom,$uname);
845: } else {
846: $reply=&Apache::lonnet::cput
847: ('resourcedata',\%storecontent,$udom,$uname);
848: }
1.44 albertel 849: }
1.15 www 850:
1.44 albertel 851: if ($reply=~/^error\:(.*)/) {
852: $message.="<font color=red>Write Error: $1</font>";
853: }
1.68 www 854: # ---------------------------------------------------------------- Done storing
1.80 www 855: $message.='<h3>Changes can take up to 10 minutes before being active for all students</h3>';
1.68 www 856: }
1.67 www 857: # --------------------------------------------- Devalidate cache for this child
1.109 albertel 858: &Apache::lonnet::devalidatecourseresdata(
1.67 www 859: $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
860: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'});
1.109 albertel 861: &Apache::lonnet::clear_EXT_cache_status();
1.2 www 862: # -------------------------------------------------------------- Get coursedata
1.45 matthew 863: %courseopt = &Apache::lonnet::dump
864: ('resourcedata',
865: $ENV{'course.'.$ENV{'request.course.id'}.'.domain'},
866: $ENV{'course.'.$ENV{'request.course.id'}.'.num'});
1.44 albertel 867: # --------------------------------------------------- Get userdata (if present)
868: if ($uname) {
1.45 matthew 869: %useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname);
1.44 albertel 870: }
1.14 www 871:
1.2 www 872: # ------------------------------------------------------------------- Sort this
1.17 www 873:
1.44 albertel 874: @ids=sort {
875: if ($fcat eq '') {
876: $a<=>$b;
877: } else {
878: my ($result,@outpar)=&parmval($fcat,$a,$defp{$a});
879: my $aparm=$outpar[$result];
880: ($result,@outpar)=&parmval($fcat,$b,$defp{$b});
881: my $bparm=$outpar[$result];
882: 1*$aparm<=>1*$bparm;
883: }
884: } @ids;
1.57 albertel 885: #----------------------------------------------- if all selected, fill in array
886: if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);}
887: if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
1.2 www 888: # ------------------------------------------------------------------ Start page
1.63 bowersj2 889:
1.99 albertel 890: my $have_assesments=1;
891: if (scalar(keys(%allkeys)) eq 0) { $have_assesments=0; }
892:
893: &startpage($r,$id,$udom,$csec,$uname,$have_assesments);
894:
895: if (!$have_assesments) { return ''; }
1.44 albertel 896: # if ($ENV{'form.url'}) {
897: # $r->print('<input type="hidden" value="'.$ENV{'form.url'}.
898: # '" name="url"><input type="hidden" name="command" value="set">');
899: # }
1.57 albertel 900: $r->print('<input type="hidden" value="true" name="prevvisit">');
901:
1.44 albertel 902: foreach ('tolerance','date_default','date_start','date_end',
903: 'date_interval','int','float','string') {
904: $r->print('<input type="hidden" value="'.
905: $ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">');
906: }
907:
1.57 albertel 908: $r->print('<h2>'.$message.'</h2><table>');
909:
910: my $submitmessage;
1.44 albertel 911: if (!$pssymb) {
1.101 www 912: $r->print('<tr><td>Select Parameter Level</td><td colspan="2">');
1.57 albertel 913: $r->print('<select name="parmlev">');
914: foreach (reverse sort keys %alllevs) {
915: $r->print('<option value="'.$alllevs{$_}.'"');
916: if ($parmlev eq $alllevs{$_}) {
917: $r->print(' selected');
918: }
919: $r->print('>'.$_.'</option>');
920: }
921: $r->print("</select></td>\n");
922:
1.101 www 923: $r->print('</tr>');
1.57 albertel 924:
1.82 www 925: $r->print('<tr><td>Select Enclosing Map or Folder</td>');
1.57 albertel 926: $r->print('<td colspan="2"><select name="pschp">');
1.82 www 927: $r->print('<option value="all">All Maps or Folders</option>');
1.57 albertel 928: foreach (sort {$allmaps{$a} cmp $allmaps{$b}} keys %allmaps) {
929: $r->print('<option value="'.$_.'"');
930: if (($pschp eq $_)) { $r->print(' selected'); }
1.82 www 931: $r->print('>'.$maptitles{$_}.($allmaps{$_}!~/^uploaded/?' ['.$allmaps{$_}.']':'').'</option>');
1.57 albertel 932: }
933: $r->print("</select></td></tr>\n");
1.44 albertel 934: } else {
1.57 albertel 935: my ($map,$id,$resource)=split(/___/,$pssymb);
936: $r->print("<tr><td>Specific Resource</td><td>$resource</td>");
937: $r->print('<td><input type="submit" name="dis" value="'.$submitmessage.'"></td>');
938: $r->print('</tr>');
939: $r->print('<input type="hidden" value="'.$pssymb.'" name="symb">');
940: }
941:
942: $r->print('<tr><td colspan="3"><hr /><input type="checkbox"');
943: if ($showoptions eq 'show') {$r->print(" checked ");}
1.101 www 944: $r->print(' name="showoptions" value="show">Show More Options<hr /></td></tr>');
1.57 albertel 945: # $r->print("<tr><td>Show: $showoptions</td></tr>");
946: # $r->print("<tr><td>pscat: @pscat</td></tr>");
947: # $r->print("<tr><td>psprt: @psprt</td></tr>");
948: # $r->print("<tr><td>fcat: $fcat</td></tr>");
949:
950: if ($showoptions eq 'show') {
951: my $tempkey;
952:
953: $r->print('<tr><td colspan="3" align="center">Select Parameters to View</td></tr>');
954:
955: $r->print('<tr><td colspan="2"><table>');
956: $r->print('<tr><td><input type="checkbox" name="pscat" value="all"');
957: $r->print(' checked') unless (@pscat);
958: $r->print('>All Parameters</td>');
959:
960: my $cnt=0;
961: foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} }
962: keys %allparms ) {
963: ++$cnt;
964: $r->print('</tr><tr>') unless ($cnt%2);
965: $r->print('<td><input type="checkbox" name="pscat" ');
966: $r->print('value="'.$tempkey.'"');
967: if ($pscat[0] eq "all" || grep $_ eq $tempkey, @pscat) {
968: $r->print(' checked');
969: }
970: $r->print('>'.$allparms{$tempkey}.'</td>');
971: }
972: $r->print('</tr></table>');
973:
974: # $r->print('<tr><td>Select Parts</td><td>');
975: $r->print('<td><select multiple name="psprt" size="5">');
976: $r->print('<option value="all"');
977: $r->print(' selected') unless (@psprt);
978: $r->print('>All Parts</option>');
1.76 www 979: my %temphash=();
980: foreach (@psprt) { $temphash{$_}=1; }
1.57 albertel 981: foreach $tempkey (sort keys %allparts) {
982: unless ($tempkey =~ /\./) {
983: $r->print('<option value="'.$tempkey.'"');
1.76 www 984: if ($psprt[0] eq "all" || $temphash{$tempkey}) {
1.57 albertel 985: $r->print(' selected');
986: }
987: $r->print('>'.$allparts{$tempkey}.'</option>');
988: }
989: }
990: $r->print('</select></td></tr><tr><td colspan="3"><hr /></td></tr>');
991:
992: $r->print('<tr><td>Sort list by</td><td>');
993: $r->print('<select name="fcat">');
1.82 www 994: $r->print('<option value="">Enclosing Map or Folder</option>');
1.57 albertel 995: foreach (sort keys %allkeys) {
996: $r->print('<option value="'.$_.'"');
997: if ($fcat eq $_) { $r->print(' selected'); }
998: $r->print('>'.$allkeys{$_}.'</option>');
999: }
1000: $r->print('</select></td>');
1001:
1002: $r->print('</tr><tr><td colspan="3"><hr /></td></tr>');
1003:
1004: } else { # hide options - include any necessary extras here
1005:
1006: $r->print('<input type="hidden" name="fcat" value="'.$fcat.'">'."\n");
1007:
1008: unless (@pscat) {
1009: foreach (keys %allparms ) {
1010: $r->print('<input type="hidden" name="pscat" value="'.$_.'">'."\n");
1011: }
1012: } else {
1013: foreach (@pscat) {
1014: $r->print('<input type="hidden" name="pscat" value="'.$_.'">'."\n");
1015: }
1016: }
1017:
1018: unless (@psprt) {
1019: foreach (keys %allparts ) {
1020: $r->print('<input type="hidden" name="psprt" value="'.$_.'">'."\n");
1021: }
1022: } else {
1023: foreach (@psprt) {
1024: $r->print('<input type="hidden" name="psprt" value="'.$_.'">'."\n");
1025: }
1026: }
1027:
1.44 albertel 1028: }
1.101 www 1029: $r->print('</table><br />');
1030: if (($prevvisit) || ($pschp) || ($pssymb)) {
1031: $submitmessage = "Update Course Assessment Parameter Display";
1032: } else {
1033: $submitmessage = "Set Course Assessment Parameters";
1034: }
1035: $r->print('<input type="submit" name="dis" value="'.$submitmessage.'">');
1.57 albertel 1036:
1.76 www 1037: # my @temp_psprt;
1038: # foreach my $t (@psprt) {
1039: # push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts));
1040: # }
1.57 albertel 1041:
1.76 www 1042: # @psprt = @temp_psprt;
1.57 albertel 1043:
1044: my @temp_pscat;
1045: map {
1046: my $cat = $_;
1047: push(@temp_pscat, map { $_.'.'.$cat } @psprt);
1048: } @pscat;
1049:
1050: @pscat = @temp_pscat;
1051:
1052: if (($prevvisit) || ($pschp) || ($pssymb)) {
1.10 www 1053: # ----------------------------------------------------------------- Start Table
1.57 albertel 1054: my @catmarker=map { tr|.|_|; 'parameter_'.$_; } @pscat;
1055: my $csuname=$ENV{'user.name'};
1056: my $csudom=$ENV{'user.domain'};
1057:
1058: if ($parmlev eq 'full' || $parmlev eq 'brief') {
1059: my $coursespan=$csec?8:5;
1060: $r->print('<p><table border=2>');
1061: $r->print('<tr><td colspan=5></td>');
1062: $r->print('<th colspan='.($coursespan).'>Any User</th>');
1063: if ($uname) {
1064: $r->print("<th colspan=3 rowspan=2>");
1065: $r->print("User $uname at Domain $udom</th>");
1066: }
1067: $r->print(<<ENDTABLETWO);
1.33 www 1068: <th rowspan=3>Parameter in Effect</th>
1069: <th rowspan=3>Current Session Value<br>($csuname at $csudom)</th>
1.57 albertel 1070: </tr><tr><td colspan=5></td><th colspan=2>Resource Level</th>
1.10 www 1071: <th colspan=3>in Course</th>
1072: ENDTABLETWO
1.57 albertel 1073: if ($csec) {
1074: $r->print("<th colspan=3>in Section/Group $csec</th>");
1075: }
1076: $r->print(<<ENDTABLEHEADFOUR);
1.11 www 1077: </tr><tr><th>Assessment URL and Title</th><th>Type</th>
1.102 albertel 1078: <th>Enclosing Map or Folder</th><th>Part</th><th>Parameter Name</th>
1.82 www 1079: <th>default</th><th>from Enclosing Map or Folder</th>
1080: <th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th>
1.10 www 1081: ENDTABLEHEADFOUR
1.57 albertel 1082:
1083: if ($csec) {
1.82 www 1084: $r->print('<th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th>');
1.57 albertel 1085: }
1086:
1087: if ($uname) {
1.82 www 1088: $r->print('<th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th>');
1.57 albertel 1089: }
1090:
1091: $r->print('</tr>');
1092:
1093: my $defbgone='';
1094: my $defbgtwo='';
1095:
1096: foreach (@ids) {
1097:
1098: my $rid=$_;
1099: my ($inmapid)=($rid=~/\.(\d+)$/);
1100:
1101: if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid}) ||
1102: ($pssymb eq $symbp{$rid})) {
1.4 www 1103: # ------------------------------------------------------ Entry for one resource
1.57 albertel 1104: if ($defbgone eq '"E0E099"') {
1105: $defbgone='"E0E0DD"';
1106: } else {
1107: $defbgone='"E0E099"';
1108: }
1109: if ($defbgtwo eq '"FFFF99"') {
1110: $defbgtwo='"FFFFDD"';
1111: } else {
1112: $defbgtwo='"FFFF99"';
1113: }
1114: my $thistitle='';
1115: my %name= ();
1116: undef %name;
1117: my %part= ();
1118: my %display=();
1119: my %type= ();
1120: my %default=();
1121: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
1122:
1123: foreach (split(/\,/,$keyp{$rid})) {
1124: my $tempkeyp = $_;
1125: if (grep $_ eq $tempkeyp, @catmarker) {
1126: $part{$_}=&Apache::lonnet::metadata($uri,$_.'.part');
1127: $name{$_}=&Apache::lonnet::metadata($uri,$_.'.name');
1128: $display{$_}=&Apache::lonnet::metadata($uri,$_.'.display');
1129: unless ($display{$_}) { $display{$_}=''; }
1130: $display{$_}.=' ('.$name{$_}.')';
1131: $default{$_}=&Apache::lonnet::metadata($uri,$_);
1132: $type{$_}=&Apache::lonnet::metadata($uri,$_.'.type');
1133: $thistitle=&Apache::lonnet::metadata($uri,$_.'.title');
1134: }
1135: }
1136: my $totalparms=scalar keys %name;
1137: if ($totalparms>0) {
1138: my $firstrow=1;
1139:
1140: $r->print('<tr><td bgcolor='.$defbgone.
1141: ' rowspan='.$totalparms.
1142: '><tt><font size=-1>'.
1143: join(' / ',split(/\//,$uri)).
1144: '</font></tt><p><b>'.
1145: "<a href=\"javascript:openWindow('/res/".$uri.
1146: "', 'metadatafile', '450', '500', 'no', 'yes')\";".
1147: " TARGET=_self>$bighash{'title_'.$rid}");
1148:
1149: if ($thistitle) {
1150: $r->print(' ('.$thistitle.')');
1151: }
1152: $r->print('</a></b></td>');
1153: $r->print('<td bgcolor='.$defbgtwo.
1154: ' rowspan='.$totalparms.'>'.$typep{$rid}.
1155: '</td>');
1156:
1157: $r->print('<td bgcolor='.$defbgone.
1158: ' rowspan='.$totalparms.
1159: '><tt><font size=-1>');
1160:
1161: $r->print(' / res / ');
1162: $r->print(join(' / ', split(/\//,$mapp{$rid})));
1163:
1164: $r->print('</font></tt></td>');
1165:
1166: foreach (sort keys %name) {
1167: unless ($firstrow) {
1168: $r->print('<tr>');
1169: } else {
1170: undef $firstrow;
1171: }
1172:
1173: &print_row($r,$_,\%part,\%name,$rid,\%default,
1174: \%type,\%display,$defbgone,$defbgtwo,
1175: $parmlev);
1176: }
1177: }
1178: }
1179: } # end foreach ids
1.43 albertel 1180: # -------------------------------------------------- End entry for one resource
1.57 albertel 1181: $r->print('</table>');
1182: } # end of brief/full
1183: #--------------------------------------------------- Entry for parm level map
1184: if ($parmlev eq 'map') {
1185: my $defbgone = '"E0E099"';
1186: my $defbgtwo = '"FFFF99"';
1187:
1188: my %maplist;
1189:
1190: if ($pschp eq 'all') {
1191: %maplist = %allmaps;
1192: } else {
1193: %maplist = ($pschp => $mapp{$pschp});
1194: }
1195:
1196: #-------------------------------------------- for each map, gather information
1197: my $mapid;
1.60 albertel 1198: foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
1199: my $maptitle = $maplist{$mapid};
1.57 albertel 1200:
1201: #----------------------- loop through ids and get all parameter types for map
1202: #----------------------------------------- and associated information
1203: my %name = ();
1204: my %part = ();
1205: my %display = ();
1206: my %type = ();
1207: my %default = ();
1208: my $map = 0;
1209:
1210: # $r->print("Catmarker: @catmarker<br />\n");
1211:
1212: foreach (@ids) {
1213: ($map)=(/([\d]*?)\./);
1214: my $rid = $_;
1215:
1216: # $r->print("$mapid:$map: $rid <br /> \n");
1217:
1218: if ($map eq $mapid) {
1219: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
1220: # $r->print("Keys: $keyp{$rid} <br />\n");
1221:
1222: #--------------------------------------------------------------------
1223: # @catmarker contains list of all possible parameters including part #s
1224: # $fullkeyp contains the full part/id # for the extraction of proper parameters
1225: # $tempkeyp contains part 0 only (no ids - ie, subparts)
1226: # When storing information, store as part 0
1227: # When requesting information, request from full part
1228: #-------------------------------------------------------------------
1229: foreach (split(/\,/,$keyp{$rid})) {
1230: my $tempkeyp = $_;
1231: my $fullkeyp = $tempkeyp;
1.73 albertel 1232: $tempkeyp =~ s/_\w+_/_0_/;
1.57 albertel 1233:
1234: if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
1235: $part{$tempkeyp}="0";
1236: $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
1237: $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
1238: unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
1239: $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
1.73 albertel 1240: $display{$tempkeyp} =~ s/_\w+_/_0_/;
1.57 albertel 1241: $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
1242: $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
1243: }
1244: } # end loop through keys
1245: }
1246: } # end loop through ids
1247:
1248: #---------------------------------------------------- print header information
1.82 www 1249: my $foldermap=($maptitle=~/^uploaded/?'Folder':'Map');
1250: my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
1.57 albertel 1251: $r->print(<<ENDMAPONE);
1252: <center><h4>
1.82 www 1253: <font color="red">Set Defaults for All Resources in $foldermap<br />
1254: <i>$showtitle</i><br />
1.57 albertel 1255: Specifically for
1256: ENDMAPONE
1257: if ($uname) {
1258: my %name=&Apache::lonnet::userenvironment($udom,$uname,
1259: ('firstname','middlename','lastname','generation', 'id'));
1260: my $person=$name{'firstname'}.' '.$name{'middlename'}.' '
1261: .$name{'lastname'}.' '.$name{'generation'};
1262: $r->print("User <i>$uname \($person\) </i> in \n");
1263: } else {
1264: $r->print("<i>all</i> users in \n");
1265: }
1266:
1267: if ($csec) {$r->print("Section <i>$csec</i> of \n")};
1268:
1269: $r->print("<i>$coursename</i><br />");
1270: $r->print("</font></h4>\n");
1271: #---------------------------------------------------------------- print table
1272: $r->print('<p><table border="2">');
1273: $r->print('<tr><th>Parameter Name</th>');
1274: $r->print('<th>Default Value</th>');
1275: $r->print('<th>Parameter in Effect</th></tr>');
1276:
1277: foreach (sort keys %name) {
1278: &print_row($r,$_,\%part,\%name,$mapid,\%default,
1279: \%type,\%display,$defbgone,$defbgtwo,
1280: $parmlev);
1281: # $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n");
1282: }
1283: $r->print("</table></center>");
1284: } # end each map
1285: } # end of $parmlev eq map
1286: #--------------------------------- Entry for parm level general (Course level)
1287: if ($parmlev eq 'general') {
1288: my $defbgone = '"E0E099"';
1289: my $defbgtwo = '"FFFF99"';
1290:
1291: #-------------------------------------------- for each map, gather information
1292: my $mapid="0.0";
1293: #----------------------- loop through ids and get all parameter types for map
1294: #----------------------------------------- and associated information
1295: my %name = ();
1296: my %part = ();
1297: my %display = ();
1298: my %type = ();
1299: my %default = ();
1300:
1301: foreach (@ids) {
1302: my $rid = $_;
1303:
1304: my $uri=&Apache::lonnet::declutter($bighash{'src_'.$rid});
1305:
1306: #--------------------------------------------------------------------
1307: # @catmarker contains list of all possible parameters including part #s
1308: # $fullkeyp contains the full part/id # for the extraction of proper parameters
1309: # $tempkeyp contains part 0 only (no ids - ie, subparts)
1310: # When storing information, store as part 0
1311: # When requesting information, request from full part
1312: #-------------------------------------------------------------------
1313: foreach (split(/\,/,$keyp{$rid})) {
1314: my $tempkeyp = $_;
1315: my $fullkeyp = $tempkeyp;
1.73 albertel 1316: $tempkeyp =~ s/_\w+_/_0_/;
1.57 albertel 1317: if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
1318: $part{$tempkeyp}="0";
1319: $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
1320: $display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
1321: unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
1322: $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
1.73 albertel 1323: $display{$tempkeyp} =~ s/_\w+_/_0_/;
1.57 albertel 1324: $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
1325: $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
1326: }
1327: } # end loop through keys
1328: } # end loop through ids
1329:
1330: #---------------------------------------------------- print header information
1331: $r->print(<<ENDMAPONE);
1332: <center><h4>
1333: <font color="red">Set Defaults for All Resources in Course
1334: <i>$coursename</i><br />
1335: ENDMAPONE
1336: if ($uname) {
1337: my %name=&Apache::lonnet::userenvironment($udom,$uname,
1338: ('firstname','middlename','lastname','generation', 'id'));
1339: my $person=$name{'firstname'}.' '.$name{'middlename'}.' '
1340: .$name{'lastname'}.' '.$name{'generation'};
1341: $r->print(" User <i>$uname \($person\) </i> \n");
1342: } else {
1343: $r->print("<i>ALL</i> USERS \n");
1344: }
1345:
1346: if ($csec) {$r->print("Section <i>$csec</i>\n")};
1347: $r->print("</font></h4>\n");
1348: #---------------------------------------------------------------- print table
1349: $r->print('<p><table border="2">');
1350: $r->print('<tr><th>Parameter Name</th>');
1351: $r->print('<th>Default Value</th>');
1352: $r->print('<th>Parameter in Effect</th></tr>');
1353:
1354: foreach (sort keys %name) {
1355: &print_row($r,$_,\%part,\%name,$mapid,\%default,
1356: \%type,\%display,$defbgone,$defbgtwo,$parmlev);
1357: # $r->print("<tr><td>resource.$part{$_}.$name{$_},$symbp{$mapid}</td></tr>\n");
1358: }
1359: $r->print("</table></center>");
1360: } # end of $parmlev eq general
1.43 albertel 1361: }
1.44 albertel 1362: $r->print('</form></body></html>');
1363: untie(%bighash);
1364: untie(%parmhash);
1.57 albertel 1365: } # end sub assessparms
1.30 www 1366:
1.59 matthew 1367:
1368: ##################################################
1369: ##################################################
1370:
1371: =pod
1372:
1373: =item crsenv
1374:
1.105 matthew 1375: Show and set course data and parameters. This is a large routine that should
1.59 matthew 1376: be simplified and shortened... someday.
1377:
1378: Inputs: $r
1379:
1380: Returns: nothing
1381:
1382: =cut
1383:
1384: ##################################################
1385: ##################################################
1.30 www 1386: sub crsenv {
1387: my $r=shift;
1388: my $setoutput='';
1.64 www 1389: my $bodytag=&Apache::loncommon::bodytag(
1390: 'Set Course Environment Parameters');
1.45 matthew 1391: my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
1392: my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
1.105 matthew 1393:
1394: #
1395: # Go through list of changes
1.38 harris41 1396: foreach (keys %ENV) {
1.105 matthew 1397: next if ($_!~/^form\.(.+)\_setparmval$/);
1398: my $name = $1;
1399: my $value = $ENV{'form.'.$name.'_value'};
1400: if ($name eq 'newp') {
1401: $name = $ENV{'form.newp_name'};
1402: }
1403: if ($name eq 'url') {
1404: $value=~s/^\/res\///;
1405: my $bkuptime=time;
1406: my @tmp = &Apache::lonnet::get
1407: ('environment',['url'],$dom,$crs);
1408: $setoutput.='Backing up previous URL: '.
1409: &Apache::lonnet::put
1410: ('environment',
1411: {'top level map backup '.$bkuptime => $tmp[1] },
1412: $dom,$crs).
1413: '<br>';
1414: }
1415: #
1416: # Deal with modified default spreadsheets
1417: if ($name =~ /^spreadsheet_default_(classcalc|
1418: studentcalc|
1419: assesscalc)$/x) {
1420: my $sheettype = $1;
1421: if ($sheettype eq 'classcalc') {
1422: # no need to do anything since viewing the sheet will
1423: # cause it to be updated.
1424: } elsif ($sheettype eq 'studentcalc') {
1425: # expire all the student spreadsheets
1426: &Apache::lonnet::expirespread('','','studentcalc');
1427: } else {
1428: # expire all the assessment spreadsheets
1429: # this includes non-default spreadsheets, but better to
1430: # be safe than sorry.
1431: &Apache::lonnet::expirespread('','','assesscalc');
1432: # expire all the student spreadsheets
1433: &Apache::lonnet::expirespread('','','studentcalc');
1.30 www 1434: }
1.105 matthew 1435: }
1436: #
1.107 matthew 1437: # Deal with the enrollment dates
1438: if ($name =~ /^default_enrollment_(start|end)_date$/) {
1439: $value=&Apache::lonhtmlcommon::get_date_from_form($name.'_value');
1440: }
1441: #
1.105 matthew 1442: # Let the user know we made the changes
1443: if ($name) {
1444: my $put_result = &Apache::lonnet::put('environment',
1445: {$name=>$value},$dom,$crs);
1446: if ($put_result eq 'ok') {
1447: $setoutput.='Set <b>'.$name.'</b> to <b>'.$value.'</b>.<br />';
1448: } else {
1449: $setoutput.='Unable to set <b>'.$name.'</b> to '.
1450: '<b>'.$value.'</b> due to '.$put_result.'.<br />';
1.30 www 1451: }
1452: }
1.38 harris41 1453: }
1.108 www 1454: # ------------------------- Re-init course environment entries for this session
1455:
1456: &Apache::lonnet::coursedescription($ENV{'request.course.id'});
1.105 matthew 1457:
1.30 www 1458: # -------------------------------------------------------- Get parameters again
1.45 matthew 1459:
1460: my %values=&Apache::lonnet::dump('environment',$dom,$crs);
1.30 www 1461: my $output='';
1.45 matthew 1462: if (! exists($values{'con_lost'})) {
1.30 www 1463: my %descriptions=
1.47 matthew 1464: ('url' => '<b>Top Level Map</b> '.
1.46 matthew 1465: '<a href="javascript:openbrowser'.
1.47 matthew 1466: "('envform','url','sequence')\">".
1.100 www 1467: 'Select Map</a><br /><font color=red> '.
1.45 matthew 1468: 'Modification may make assessment data '.
1469: 'inaccessible</font>',
1470: 'description' => '<b>Course Description</b>',
1.75 albertel 1471: 'courseid' => '<b>Course ID or number</b><br />'.
1.45 matthew 1472: '(internal, optional)',
1.52 www 1473: 'default_xml_style' => '<b>Default XML Style File</b> '.
1474: '<a href="javascript:openbrowser'.
1475: "('envform','default_xml_style'".
1.100 www 1476: ",'sty')\">Select Style File</a><br>",
1.74 www 1477: 'question.email' => '<b>Feedback Addresses for Resource Content '.
1.75 albertel 1478: 'Questions</b><br />(<tt>user:domain,'.
1.74 www 1479: 'user:domain(section;section;...;*;...),...</tt>)',
1.75 albertel 1480: 'comment.email' => '<b>Feedback Addresses for Course Content Comments</b><br />'.
1.74 www 1481: '(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
1.45 matthew 1482: 'policy.email' => '<b>Feedback Addresses for Course Policy</b>'.
1.75 albertel 1483: '<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)',
1484: 'hideemptyrows' => '<b>Hide Empty Rows in Spreadsheets</b><br />'.
1.45 matthew 1485: '("<tt>yes</tt>" for default hiding)',
1.75 albertel 1486: 'pageseparators' => '<b>Visibly Separate Items on Pages</b><br />'.
1.93 bowersj2 1487: '("<tt>yes</tt>" for visible separation, '.
1488: 'changes will not show until next login)',
1.45 matthew 1489: 'pch.roles.denied'=> '<b>Disallow Resource Discussion for '.
1.75 albertel 1490: 'Roles</b><br />"<tt>st</tt>": '.
1.61 albertel 1491: 'student, "<tt>ta</tt>": '.
1492: 'TA, "<tt>in</tt>": '.
1.75 albertel 1493: 'instructor;<br /><tt>role,role,...</tt>) '.
1.61 albertel 1494: Apache::loncommon::help_open_topic("Course_Disable_Discussion"),
1.53 www 1495: 'pch.users.denied' =>
1.75 albertel 1496: '<b>Disallow Resource Discussion for Users</b><br />'.
1.53 www 1497: '(<tt>user:domain,user:domain,...</tt>)',
1.49 matthew 1498: 'spreadsheet_default_classcalc'
1.52 www 1499: => '<b>Default Course Spreadsheet</b> '.
1.50 matthew 1500: '<a href="javascript:openbrowser'.
1501: "('envform','spreadsheet_default_classcalc'".
1.100 www 1502: ",'spreadsheet')\">Select Spreadsheet File</a><br />",
1.49 matthew 1503: 'spreadsheet_default_studentcalc'
1.52 www 1504: => '<b>Default Student Spreadsheet</b> '.
1.50 matthew 1505: '<a href="javascript:openbrowser'.
1506: "('envform','spreadsheet_default_calc'".
1.100 www 1507: ",'spreadsheet')\">Select Spreadsheet File</a><br />",
1.49 matthew 1508: 'spreadsheet_default_assesscalc'
1.52 www 1509: => '<b>Default Assessment Spreadsheet</b> '.
1.50 matthew 1510: '<a href="javascript:openbrowser'.
1511: "('envform','spreadsheet_default_assesscalc'".
1.100 www 1512: ",'spreadsheet')\">Select Spreadsheet File</a><br />",
1.75 albertel 1513: 'allow_limited_html_in_feedback'
1514: => '<b>Allow limited HTML in discussion posts</b><br />'.
1.108 www 1515: '(Set value to "<tt>yes</tt>" to allow)',
1.89 albertel 1516: 'rndseed'
1.90 albertel 1517: => '<b>Randomization algorithm used</b> <br />'.
1.89 albertel 1518: '<font color="red">Modifying this will make problems '.
1.94 sakharuk 1519: 'have different numbers and answers</font>',
1.110 ! sakharuk 1520: 'problem_split'
1.104 matthew 1521: => '<b>Allow problems to be split over pages</b><br />'.
1.110 ! sakharuk 1522: ' ("<tt>yes</tt>" if allowed, anything else if not)',,
! 1523: 'anonimous_quiz'
! 1524: => '<b>Anonimous quiz/exam</b><br />'.
! 1525: ' (<tt><b>yes</b> to avoid print students names </tt>)',
1.108 www 1526: 'default_enrollment_start_date' => '<b>Default beginning date '.
1527: 'when enrolling students</b>',
1528: 'default_enrollment_end_date' => '<b>Default ending date '.
1529: 'when enrolling students</b>',
1530: 'languages' => '<b>Languages used</b>'
1.107 matthew 1531: );
1532: my @Display_Order = ('url','description','courseid',
1533: 'default_xml_style','pageseparators',
1534: 'question.email','comment.email','policy.email',
1535: 'pch.roles.denied','pch.users.denied',
1536: 'allow_limited_html_in_feedback',
1.108 www 1537: 'languages',
1.107 matthew 1538: 'rndseed',
1539: 'problem_stream_switch',
1540: 'spreadsheet_default_classcalc',
1541: 'spreadsheet_default_studentcalc',
1542: 'spreadsheet_default_assesscalc',
1543: 'hideemptyrows',
1544: 'default_enrollment_start_date',
1545: 'default_enrollment_end_date',
1546: );
1547: foreach my $parameter (sort(keys(%values))) {
1548: if (! $descriptions{$parameter}) {
1549: $descriptions{$parameter}=$parameter;
1550: push(@Display_Order,$parameter);
1.43 albertel 1551: }
1552: }
1.107 matthew 1553: foreach my $parameter (@Display_Order) {
1554: my $description = $descriptions{$parameter};
1.51 matthew 1555: # onchange is javascript to automatically check the 'Set' button.
1.69 www 1556: my $onchange = 'onFocus="javascript:window.document.forms'.
1.107 matthew 1557: "['envform'].elements['".$parameter."_setparmval']".
1.51 matthew 1558: '.checked=true;"';
1.107 matthew 1559: $output .= '<tr><td>'.$description.'</td>';
1560: if ($parameter =~ /^default_enrollment_(start|end)_date$/) {
1561: $output .= '<td>'.
1562: &Apache::lonhtmlcommon::date_setter('envform',
1563: $parameter.'_value',
1564: $values{$parameter},
1565: $onchange).
1566: '</td>';
1567: } else {
1568: $output .= '<td>'.
1569: &Apache::lonhtmlcommon::textbox($parameter.'_value',
1570: $values{$parameter},
1571: 40,$onchange).'</td>';
1572: }
1573: $output .= '<td>'.
1574: &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
1575: '</td>';
1576: $output .= "</tr>\n";
1.51 matthew 1577: }
1.69 www 1578: my $onchange = 'onFocus="javascript:window.document.forms'.
1.51 matthew 1579: '[\'envform\'].elements[\'newp_setparmval\']'.
1580: '.checked=true;"';
1581: $output.='<tr><td><i>Create New Environment Variable</i><br />'.
1582: '<input type="text" size=40 name="newp_name" '.
1583: $onchange.' /></td><td>'.
1584: '<input type="text" size=40 name="newp_value" '.
1585: $onchange.' /></td><td>'.
1586: '<input type="checkbox" name="newp_setparmval" /></td></tr>';
1.43 albertel 1587: }
1.30 www 1588: $r->print(<<ENDENV);
1589: <html>
1.46 matthew 1590: <script type="text/javascript" language="Javascript" >
1591: var editbrowser;
1.47 matthew 1592: function openbrowser(formname,elementname,only,omit) {
1.46 matthew 1593: var url = '/res/?';
1594: if (editbrowser == null) {
1595: url += 'launch=1&';
1596: }
1597: url += 'catalogmode=interactive&';
1598: url += 'mode=parmset&';
1599: url += 'form=' + formname + '&';
1.47 matthew 1600: if (only != null) {
1601: url += 'only=' + only + '&';
1602: }
1603: if (omit != null) {
1604: url += 'omit=' + omit + '&';
1605: }
1.46 matthew 1606: url += 'element=' + elementname + '';
1607: var title = 'Browser';
1608: var options = 'scrollbars=1,resizable=1,menubar=0';
1609: options += ',width=700,height=600';
1610: editbrowser = open(url,title,options,'1');
1611: editbrowser.focus();
1612: }
1613: </script>
1.30 www 1614: <head>
1615: <title>LON-CAPA Course Environment</title>
1616: </head>
1.64 www 1617: $bodytag
1.30 www 1618: <form method="post" action="/adm/parmset" name="envform">
1619: $setoutput
1620: <p>
1621: <table border=2>
1622: <tr><th>Parameter</th><th>Value</th><th>Set?</th></tr>
1623: $output
1624: </table>
1625: <input type="submit" name="crsenv" value="Set Course Environment">
1626: </form>
1627: </body>
1628: </html>
1629: ENDENV
1630: }
1631:
1.59 matthew 1632: ##################################################
1633: ##################################################
1.30 www 1634:
1.59 matthew 1635: =pod
1636:
1.83 bowersj2 1637: =item * handler
1.59 matthew 1638:
1639: Main handler. Calls &assessparms and &crsenv subroutines.
1640:
1641: =cut
1642:
1643: ##################################################
1644: ##################################################
1.85 bowersj2 1645: use Data::Dumper;
1.30 www 1646: sub handler {
1.43 albertel 1647: my $r=shift;
1.30 www 1648:
1.43 albertel 1649: if ($r->header_only) {
1650: $r->content_type('text/html');
1651: $r->send_http_header;
1652: return OK;
1653: }
1654: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
1.83 bowersj2 1655:
1.30 www 1656: # ----------------------------------------------------- Needs to be in a course
1657:
1.43 albertel 1658: if (($ENV{'request.course.id'}) &&
1659: (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {
1.106 www 1660:
1661: $r->content_type('text/html');
1662: $r->send_http_header;
1.57 albertel 1663:
1664: $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
1.30 www 1665:
1.43 albertel 1666: unless (($ENV{'form.crsenv'}) || (!$ENV{'request.course.fn'})) {
1.30 www 1667: # --------------------------------------------------------- Bring up assessment
1.43 albertel 1668: &assessparms($r);
1.30 www 1669: # ---------------------------------------------- This is for course environment
1.43 albertel 1670: } else {
1671: &crsenv($r);
1672: }
1673: } else {
1.1 www 1674: # ----------------------------- Not in a course, or not allowed to modify parms
1.43 albertel 1675: $ENV{'user.error.msg'}=
1676: "/adm/parmset:opa:0:0:Cannot modify assessment parameters";
1677: return HTTP_NOT_ACCEPTABLE;
1678: }
1679: return OK;
1.1 www 1680: }
1681:
1682: 1;
1683: __END__
1684:
1.59 matthew 1685: =pod
1.38 harris41 1686:
1687: =back
1688:
1689: =cut
1.1 www 1690:
1691:
1692:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>