version 1.69, 2002/09/07 18:48:26
|
version 1.79, 2002/11/21 22:32:53
|
Line 87 my $coursename;
|
Line 87 my $coursename;
|
|
|
Figure out a cascading parameter. |
Figure out a cascading parameter. |
|
|
Inputs: $what $id $def |
Inputs: $what - a parameter spec (incluse part info and name I.E. 0.weight) |
|
$id - a bighash Id number |
Returns: I am not entirely sure. |
$def - the resource's default value 'stupid emacs |
|
|
|
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 |
|
|
|
11- resource default |
|
10- map default |
|
9 - General Course |
|
8 - Map level in course |
|
7 - resource level in course |
|
6 - General for section |
|
5 - Map level for section |
|
4 - resource level in section |
|
3 - General for specific student |
|
2 - Map level for specific student |
|
1 - resource level for specific student |
|
|
=cut |
=cut |
|
|
Line 123 sub parmval {
|
Line 137 sub parmval {
|
|
|
# --------------------------------------------------------- third, check course |
# --------------------------------------------------------- third, check course |
|
|
if ($courseopt{$courselevel}) { |
if (defined($courseopt{$courselevel})) { |
$outpar[9]=$courseopt{$courselevel}; |
$outpar[9]=$courseopt{$courselevel}; |
$result=9; |
$result=9; |
} |
} |
|
|
if ($courseopt{$courselevelm}) { |
if (defined($courseopt{$courselevelm})) { |
$outpar[8]=$courseopt{$courselevelm}; |
$outpar[8]=$courseopt{$courselevelm}; |
$result=8; |
$result=8; |
} |
} |
|
|
if ($courseopt{$courselevelr}) { |
if (defined($courseopt{$courselevelr})) { |
$outpar[7]=$courseopt{$courselevelr}; |
$outpar[7]=$courseopt{$courselevelr}; |
$result=7; |
$result=7; |
} |
} |
|
|
if ($csec) { |
if (defined($csec)) { |
if ($courseopt{$seclevel}) { |
if (defined($courseopt{$seclevel})) { |
$outpar[6]=$courseopt{$seclevel}; |
$outpar[6]=$courseopt{$seclevel}; |
$result=6; |
$result=6; |
} |
} |
if ($courseopt{$seclevelm}) { |
if (defined($courseopt{$seclevelm})) { |
$outpar[5]=$courseopt{$seclevelm}; |
$outpar[5]=$courseopt{$seclevelm}; |
$result=5; |
$result=5; |
} |
} |
|
|
if ($courseopt{$seclevelr}) { |
if (defined($courseopt{$seclevelr})) { |
$outpar[4]=$courseopt{$seclevelr}; |
$outpar[4]=$courseopt{$seclevelr}; |
$result=4; |
$result=4; |
} |
} |
Line 156 sub parmval {
|
Line 170 sub parmval {
|
|
|
# ---------------------------------------------------------- fourth, check user |
# ---------------------------------------------------------- fourth, check user |
|
|
if ($uname) { |
if (defined($uname)) { |
if ($useropt{$courselevel}) { |
if (defined($useropt{$courselevel})) { |
$outpar[3]=$useropt{$courselevel}; |
$outpar[3]=$useropt{$courselevel}; |
$result=3; |
$result=3; |
} |
} |
|
|
if ($useropt{$courselevelm}) { |
if (defined($useropt{$courselevelm})) { |
$outpar[2]=$useropt{$courselevelm}; |
$outpar[2]=$useropt{$courselevelm}; |
$result=2; |
$result=2; |
} |
} |
|
|
if ($useropt{$courselevelr}) { |
if (defined($useropt{$courselevelr})) { |
$outpar[1]=$useropt{$courselevelr}; |
$outpar[1]=$useropt{$courselevelr}; |
$result=1; |
$result=1; |
} |
} |
} |
} |
|
|
return ($result,@outpar); |
return ($result,@outpar); |
} |
} |
|
|
Line 199 sub valout {
|
Line 212 sub valout {
|
my $result = ''; |
my $result = ''; |
# Values of zero are valid. |
# Values of zero are valid. |
if (! $value && $value ne '0') { |
if (! $value && $value ne '0') { |
$result = ' '; |
$result = ' '; |
} else { |
} else { |
if ($type eq 'date_interval') { |
if ($type eq 'date_interval') { |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value); |
Line 449 sub print_row {
|
Line 462 sub print_row {
|
} |
} |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
'.'.$$name{$which},$symbp{$rid}); |
'.'.$$name{$which},$symbp{$rid}); |
my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
# this doesn't seem to work, and I don't think is correct |
'.'.$$name{$which}.'.type',$symbp{$rid}); |
# my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}. |
|
# '.'.$$name{$which}.'.type',$symbp{$rid}); |
|
# this seems to work |
|
my $sessionvaltype=$typeoutpar[$result]; |
|
if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; } |
$r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'. |
$r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'. |
&valout($sessionval,$sessionvaltype).' '. |
&valout($sessionval,$sessionvaltype).' '. |
'</font></td>'); |
'</font></td>'); |
Line 640 sub assessparms {
|
Line 657 sub assessparms {
|
my @pscat=&get_env_multiple('form.pscat'); |
my @pscat=&get_env_multiple('form.pscat'); |
my $pschp=$ENV{'form.pschp'}; |
my $pschp=$ENV{'form.pschp'}; |
my @psprt=&get_env_multiple('form.psprt'); |
my @psprt=&get_env_multiple('form.psprt'); |
|
if (!@psprt) { $psprt[0]='0'; } |
my $showoptions=$ENV{'form.showoptions'}; |
my $showoptions=$ENV{'form.showoptions'}; |
|
|
my $pssymb=''; |
my $pssymb=''; |
Line 762 sub assessparms {
|
Line 780 sub assessparms {
|
if ($snum==5) { $storeunder=$seclevelm; } |
if ($snum==5) { $storeunder=$seclevelm; } |
if ($snum==4) { $storeunder=$seclevelr; } |
if ($snum==4) { $storeunder=$seclevelr; } |
|
|
|
my $delete; |
|
if ($ENV{'form.pres_value'} eq '') { $delete=1;} |
my %storecontent = ($storeunder => $ENV{'form.pres_value'}, |
my %storecontent = ($storeunder => $ENV{'form.pres_value'}, |
$storeunder.'.type' => $ENV{'form.pres_type'}); |
$storeunder.'.type' => $ENV{'form.pres_type'}); |
my $reply=''; |
my $reply=''; |
Line 778 sub assessparms {
|
Line 798 sub assessparms {
|
&Apache::lonnet::expirespread('','','assesscalc'); |
&Apache::lonnet::expirespread('','','assesscalc'); |
} |
} |
# Store parameter |
# Store parameter |
$reply=&Apache::lonnet::cput |
if ($delete) { |
('resourcedata',\%storecontent, |
$reply=&Apache::lonnet::del |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
('resourcedata',[keys(%storecontent)], |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
} else { |
|
$reply=&Apache::lonnet::cput |
|
('resourcedata',\%storecontent, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}, |
|
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}); |
|
} |
} else { |
} else { |
# ------------------------------------------------------------------ Store User |
# ------------------------------------------------------------------ Store User |
# |
# |
Line 797 sub assessparms {
|
Line 824 sub assessparms {
|
&Apache::lonnet::expirespread($uname,$udom,'assesscalc'); |
&Apache::lonnet::expirespread($uname,$udom,'assesscalc'); |
} |
} |
# Store parameter |
# Store parameter |
$reply=&Apache::lonnet::cput |
if ($delete) { |
('resourcedata',\%storecontent,$udom,$uname); |
$reply=&Apache::lonnet::del |
|
('resourcedata',[keys(%storecontent)],$udom,$uname); |
|
} else { |
|
$reply=&Apache::lonnet::cput |
|
('resourcedata',\%storecontent,$udom,$uname); |
|
} |
} |
} |
|
|
if ($reply=~/^error\:(.*)/) { |
if ($reply=~/^error\:(.*)/) { |
Line 913 sub assessparms {
|
Line 945 sub assessparms {
|
$r->print('>All Parameters</td>'); |
$r->print('>All Parameters</td>'); |
|
|
my $cnt=0; |
my $cnt=0; |
|
|
foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} } |
foreach $tempkey (sort { $allparms{$a} cmp $allparms{$b} } |
keys %allparms ) { |
keys %allparms ) { |
++$cnt; |
++$cnt; |
Line 932 sub assessparms {
|
Line 963 sub assessparms {
|
$r->print('<option value="all"'); |
$r->print('<option value="all"'); |
$r->print(' selected') unless (@psprt); |
$r->print(' selected') unless (@psprt); |
$r->print('>All Parts</option>'); |
$r->print('>All Parts</option>'); |
|
my %temphash=(); |
|
foreach (@psprt) { $temphash{$_}=1; } |
foreach $tempkey (sort keys %allparts) { |
foreach $tempkey (sort keys %allparts) { |
unless ($tempkey =~ /\./) { |
unless ($tempkey =~ /\./) { |
$r->print('<option value="'.$tempkey.'"'); |
$r->print('<option value="'.$tempkey.'"'); |
if ($psprt[0] eq "all" || grep $_ == $tempkey, @psprt) { |
if ($psprt[0] eq "all" || $temphash{$tempkey}) { |
$r->print(' selected'); |
$r->print(' selected'); |
} |
} |
$r->print('>'.$allparts{$tempkey}.'</option>'); |
$r->print('>'.$allparts{$tempkey}.'</option>'); |
Line 982 sub assessparms {
|
Line 1015 sub assessparms {
|
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
|
|
my @temp_psprt; |
# my @temp_psprt; |
foreach my $t (@psprt) { |
# foreach my $t (@psprt) { |
push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts)); |
# push(@temp_psprt, grep {eval (/^$t\./ || ($_ == $t))} (keys %allparts)); |
} |
# } |
|
|
@psprt = @temp_psprt; |
# @psprt = @temp_psprt; |
|
|
my @temp_pscat; |
my @temp_pscat; |
map { |
map { |
Line 1179 ENDTABLEHEADFOUR
|
Line 1212 ENDTABLEHEADFOUR
|
foreach (split(/\,/,$keyp{$rid})) { |
foreach (split(/\,/,$keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_[\d_]+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
|
|
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
Line 1187 ENDTABLEHEADFOUR
|
Line 1220 ENDTABLEHEADFOUR
|
$display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
$display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_[\d_]+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
} |
} |
Line 1261 ENDMAPONE
|
Line 1294 ENDMAPONE
|
foreach (split(/\,/,$keyp{$rid})) { |
foreach (split(/\,/,$keyp{$rid})) { |
my $tempkeyp = $_; |
my $tempkeyp = $_; |
my $fullkeyp = $tempkeyp; |
my $fullkeyp = $tempkeyp; |
$tempkeyp =~ s/_[\d_]+_/_0_/; |
$tempkeyp =~ s/_\w+_/_0_/; |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) { |
$part{$tempkeyp}="0"; |
$part{$tempkeyp}="0"; |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name'); |
$display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
$display{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.display'); |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; } |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp}.=' ('.$name{$tempkeyp}.')'; |
$display{$tempkeyp} =~ s/_[\d_]+_/_0_/; |
$display{$tempkeyp} =~ s/_\w+_/_0_/; |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
$type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type'); |
} |
} |
Line 1358 sub crsenv {
|
Line 1391 sub crsenv {
|
$dom,$crs). |
$dom,$crs). |
'<br>'; |
'<br>'; |
} |
} |
|
if ($name =~ /^spreadsheet_default_(classcalc| |
|
studentcalc| |
|
assesscalc)$/x) { |
|
my $sheettype = $1; |
|
if ($sheettype eq 'classcalc') { |
|
# no need to do anything since viewing the sheet will |
|
# cause it to be updated. |
|
} elsif ($sheettype eq 'studentcalc') { |
|
# expire all the student spreadsheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
} else { |
|
# expire all the default assessment spreadsheets |
|
} |
|
} |
|
|
if ($name) { |
if ($name) { |
$setoutput.='Setting <tt>'.$name.'</tt> to <tt>'. |
$setoutput.='Setting <tt>'.$name.'</tt> to <tt>'. |
$value.'</tt>: '. |
$value.'</tt>: '. |
Line 1376 sub crsenv {
|
Line 1424 sub crsenv {
|
('url' => '<b>Top Level Map</b> '. |
('url' => '<b>Top Level Map</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','url','sequence')\">". |
"('envform','url','sequence')\">". |
'Browse</a><br><font color=red> '. |
'Browse</a><br /><font color=red> '. |
'Modification may make assessment data '. |
'Modification may make assessment data '. |
'inaccessible</font>', |
'inaccessible</font>', |
'description' => '<b>Course Description</b>', |
'description' => '<b>Course Description</b>', |
'courseid' => '<b>Course ID or number</b><br>'. |
'courseid' => '<b>Course ID or number</b><br />'. |
'(internal, optional)', |
'(internal, optional)', |
'default_xml_style' => '<b>Default XML Style File</b> '. |
'default_xml_style' => '<b>Default XML Style File</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','default_xml_style'". |
"('envform','default_xml_style'". |
",'sty')\">Browse</a><br>", |
",'sty')\">Browse</a><br>", |
'question.email' => '<b>Feedback Addresses for Content '. |
'question.email' => '<b>Feedback Addresses for Resource Content '. |
'Questions</b><br>(<tt>user:domain,'. |
'Questions</b><br />(<tt>user:domain,'. |
'user:domain,...</tt>)', |
'user:domain(section;section;...;*;...),...</tt>)', |
'comment.email' => '<b>Feedback Addresses for Comments</b><br>'. |
'comment.email' => '<b>Feedback Addresses for Course Content Comments</b><br />'. |
'(<tt>user:domain,user:domain,...</tt>)', |
'(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'policy.email' => '<b>Feedback Addresses for Course Policy</b>'. |
'policy.email' => '<b>Feedback Addresses for Course Policy</b>'. |
'<br>(<tt>user:domain,user:domain,...</tt>)', |
'<br />(<tt>user:domain,user:domain(section;section;...;*;...),...</tt>)', |
'hideemptyrows' => '<b>Hide Empty Rows in Spreadsheets</b><br>'. |
'hideemptyrows' => '<b>Hide Empty Rows in Spreadsheets</b><br />'. |
'("<tt>yes</tt>" for default hiding)', |
'("<tt>yes</tt>" for default hiding)', |
'pageseparators' => '<b>Visibly Separate Items on Pages</b><br>'. |
'pageseparators' => '<b>Visibly Separate Items on Pages</b><br />'. |
'("<tt>yes</tt>" for visible separation)', |
'("<tt>yes</tt>" for visible separation)', |
'pch.roles.denied'=> '<b>Disallow Resource Discussion for '. |
'pch.roles.denied'=> '<b>Disallow Resource Discussion for '. |
'Roles</b><br>"<tt>st</tt>": '. |
'Roles</b><br />"<tt>st</tt>": '. |
'student, "<tt>ta</tt>": '. |
'student, "<tt>ta</tt>": '. |
'TA, "<tt>in</tt>": '. |
'TA, "<tt>in</tt>": '. |
'instructor;<br><tt>role,role,...</tt>) '. |
'instructor;<br /><tt>role,role,...</tt>) '. |
Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
Apache::loncommon::help_open_topic("Course_Disable_Discussion"), |
'pch.users.denied' => |
'pch.users.denied' => |
'<b>Disallow Resource Discussion for Users</b><br>'. |
'<b>Disallow Resource Discussion for Users</b><br />'. |
'(<tt>user:domain,user:domain,...</tt>)', |
'(<tt>user:domain,user:domain,...</tt>)', |
'spreadsheet_default_classcalc' |
'spreadsheet_default_classcalc' |
=> '<b>Default Course Spreadsheet</b> '. |
=> '<b>Default Course Spreadsheet</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','spreadsheet_default_classcalc'". |
"('envform','spreadsheet_default_classcalc'". |
",'spreadsheet')\">Browse</a><br>", |
",'spreadsheet')\">Browse</a><br />", |
'spreadsheet_default_studentcalc' |
'spreadsheet_default_studentcalc' |
=> '<b>Default Student Spreadsheet</b> '. |
=> '<b>Default Student Spreadsheet</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','spreadsheet_default_calc'". |
"('envform','spreadsheet_default_calc'". |
",'spreadsheet')\">Browse</a><br>", |
",'spreadsheet')\">Browse</a><br />", |
'spreadsheet_default_assesscalc' |
'spreadsheet_default_assesscalc' |
=> '<b>Default Assessment Spreadsheet</b> '. |
=> '<b>Default Assessment Spreadsheet</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','spreadsheet_default_assesscalc'". |
"('envform','spreadsheet_default_assesscalc'". |
",'spreadsheet')\">Browse</a><br>", |
",'spreadsheet')\">Browse</a><br />", |
|
'allow_limited_html_in_feedback' |
|
=> '<b>Allow limited HTML in discussion posts</b><br />'. |
|
'(Set value to yes to allow)' |
); |
); |
foreach (keys(%values)) { |
foreach (keys(%values)) { |
unless ($descriptions{$_}) { |
unless ($descriptions{$_}) { |