version 1.19, 2000/12/08 17:16:37
|
version 1.26, 2001/03/23 23:04:32
|
Line 9
|
Line 9
|
# |
# |
# 10/11,10/12,10/16 Gerd Kortemeyer) |
# 10/11,10/12,10/16 Gerd Kortemeyer) |
# |
# |
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28,12/08 Gerd Kortemeyer |
# 11/20,11/21,11/22,11/23,11/24,11/25,11/27,11/28, |
|
# 12/08,12/12, |
|
# 16/01/01,02/08,03/20,03/23 Gerd Kortemeyer |
|
|
package Apache::lonparmset; |
package Apache::lonparmset; |
|
|
Line 34 my %keyp;
|
Line 36 my %keyp;
|
my %defp; |
my %defp; |
|
|
my %allkeys; |
my %allkeys; |
|
my %allmaps; |
|
|
my $uname; |
my $uname; |
my $udom; |
my $udom; |
Line 136 sub valout {
|
Line 139 sub valout {
|
|
|
sub plink { |
sub plink { |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
my ($type,$dis,$value,$marker,$return,$call)=@_; |
return '<a href="javascript:pjump('."'".$type."','".$dis."','".$value."','" |
my $winvalue=$value; |
|
unless ($winvalue) { |
|
if ($type=~/^date/) { |
|
$winvalue=$ENV{'form.recent_'.$type}; |
|
} else { |
|
$winvalue=$ENV{'form.recent_'.(split(/\_/,$type))[0]}; |
|
} |
|
} |
|
return |
|
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."'".');">'. |
.$marker."','".$return."','".$call."'".');">'. |
&valout($value,$type).'</a>'; |
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
} |
} |
|
|
# ================================================================ Main Handler |
# ================================================================ Main Handler |
Line 172 sub handler {
|
Line 184 sub handler {
|
$udom=$ENV{'form.udom'}; |
$udom=$ENV{'form.udom'}; |
unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } |
unless ($udom) { $udom=$r->dir_config('lonDefDomain'); } |
|
|
|
my $pscat=$ENV{'form.pscat'}; |
|
my $pschp=$ENV{'form.pschp'}; |
|
|
my $id=$ENV{'form.id'}; |
my $id=$ENV{'form.id'}; |
if (($id) && ($udom)) { |
if (($id) && ($udom)) { |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
$uname=(&Apache::lonnet::idget($udom,$id))[1]; |
Line 224 sub handler {
|
Line 239 sub handler {
|
$ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) { |
$ENV{'request.course.fn'}.'_parms.db',&GDBM_READER,0640))) { |
|
|
# --------------------------------------------------------- Get all assessments |
# --------------------------------------------------------- Get all assessments |
%allkeys=(); |
undef %allkeys; |
%defp=(); |
undef %allmaps; |
|
undef %defp; |
map { |
map { |
if ($_=~/^src\_(\d+)\.(\d+)$/) { |
if ($_=~/^src\_(\d+)\.(\d+)$/) { |
my $mapid=$1; |
my $mapid=$1; |
Line 250 sub handler {
|
Line 266 sub handler {
|
$allkeys{$allkey}=$display; |
$allkeys{$allkey}=$display; |
if ($allkey eq $fcat) { |
if ($allkey eq $fcat) { |
$defp{$id}= |
$defp{$id}= |
&Apache::lonnet::metadata($srcf,$key.'.default'); |
&Apache::lonnet::metadata($srcf,$key); |
} |
} |
if ($keyp{$id}) { |
if ($keyp{$id}) { |
$keyp{$id}.=','.$key; |
$keyp{$id}.=','.$key; |
Line 262 sub handler {
|
Line 278 sub handler {
|
&Apache::lonnet::metadata($srcf,'keys')); |
&Apache::lonnet::metadata($srcf,'keys')); |
$mapp{$id}= |
$mapp{$id}= |
&Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); |
&Apache::lonnet::declutter($bighash{'map_id_'.$mapid}); |
|
$allmaps{$mapid}=$mapp{$id}; |
$symbp{$id}=$mapp{$id}. |
$symbp{$id}=$mapp{$id}. |
'___'.$resid.'___'. |
'___'.$resid.'___'. |
&Apache::lonnet::declutter($srcf); |
&Apache::lonnet::declutter($srcf); |
Line 310 sub handler {
|
Line 327 sub handler {
|
my $reply=''; |
my $reply=''; |
if ($snum>3) { |
if ($snum>3) { |
# ---------------------------------------------------------------- Store Course |
# ---------------------------------------------------------------- Store Course |
|
# |
|
# Expire sheets |
|
&Apache::lonnet::expirespread('','','studentcalc'); |
|
if (($snum==7) || ($snum==4)) { |
|
&Apache::lonnet::expirespread('','','assesscalc',$symbp{$sresid}); |
|
} elsif (($snum==8) || ($snum==5)) { |
|
&Apache::lonnet::expirespread('','','assesscalc',$mapp{$sresid}); |
|
} else { |
|
&Apache::lonnet::expirespread('','','assesscalc'); |
|
} |
|
|
|
# Store parameter |
$reply=&Apache::lonnet::critical('put:'. |
$reply=&Apache::lonnet::critical('put:'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.domain'}.':'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'. |
$ENV{'course.'.$ENV{'request.course.id'}.'.num'}.':resourcedata:'. |
Line 317 sub handler {
|
Line 346 sub handler {
|
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}); |
$ENV{'course.'.$ENV{'request.course.id'}.'.home'}); |
} else { |
} else { |
# ------------------------------------------------------------------ Store User |
# ------------------------------------------------------------------ Store User |
|
# |
|
# Expire sheets |
|
&Apache::lonnet::expirespread($uname,$udom,'studentcalc'); |
|
if ($snum==1) { |
|
&Apache::lonnet::expirespread |
|
($uname,$udom,'assesscalc',$symbp{$sresid}); |
|
} elsif ($snum==2) { |
|
&Apache::lonnet::expirespread |
|
($uname,$udom,'assesscalc',$mapp{$sresid}); |
|
} else { |
|
&Apache::lonnet::expirespread($uname,$udom,'assesscalc'); |
|
} |
|
|
|
# Store parameter |
$reply= |
$reply= |
&Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'. |
&Apache::lonnet::critical('put:'.$udom.':'.$uname.':resourcedata:'. |
$storecontent,$uhome); |
$storecontent,$uhome); |
Line 390 sub handler {
|
Line 433 sub handler {
|
function psub() { |
function psub() { |
pclose(); |
pclose(); |
if (document.parmform.pres_marker.value!='') { |
if (document.parmform.pres_marker.value!='') { |
|
document.parmform.action+='#'+document.parmform.pres_marker.value; |
|
var typedef=new Array(); |
|
typedef=document.parmform.pres_type.value.split('_'); |
|
if (typedef[0]=='date') { |
|
eval('document.parmform.recent_'+ |
|
document.parmform.pres_type.value+ |
|
'.value=document.parmform.pres_value.value;'); |
|
} else { |
|
eval('document.parmform.recent_'+typedef[0]+ |
|
'.value=document.parmform.pres_value.value;'); |
|
} |
document.parmform.submit(); |
document.parmform.submit(); |
} else { |
} else { |
document.parmform.pres_value.value=''; |
document.parmform.pres_value.value=''; |
Line 414 or ID
|
Line 468 or ID
|
at Domain |
at Domain |
<input type="text" value="$udom" size="6" name="udom"> |
<input type="text" value="$udom" size="6" name="udom"> |
</b> |
</b> |
<input type="submit" value="Display"> |
|
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_value"> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_type"> |
<input type="hidden" value='' name="pres_marker"> |
<input type="hidden" value='' name="pres_marker"> |
ENDHEAD |
ENDHEAD |
|
map { |
|
$r->print('<input type="hidden" value="'. |
|
$ENV{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
|
} ('tolerance','date_default','date_start','date_end','date_interval', |
|
'int','float','string'); |
|
|
$r->print('<h2>'.$message.'</h2><p>Sort list by '); |
$r->print('<h2>'.$message.'</h2><table><tr><td>Sort list by</td><td>'); |
$r->print('<select name="fcat" onChange="this.form.submit();">'); |
$r->print('<select name="fcat">'); |
$r->print('<option value="">Enclosing Map</option>'); |
$r->print('<option value="">Enclosing Map</option>'); |
map { |
map { |
$r->print('<option value="'.$_.'"'); |
$r->print('<option value="'.$_.'"'); |
if ($fcat eq $_) { $r->print(' selected'); } |
if ($fcat eq $_) { $r->print(' selected'); } |
$r->print('>'.$allkeys{$_}.'</option>'); |
$r->print('>'.$allkeys{$_}.'</option>'); |
} keys %allkeys; |
} keys %allkeys; |
$r->print('</select>'); |
$r->print( |
|
'</select></tr><tr><td>Select Enclosing Map</td><td><select name=pschp>'); |
|
$r->print('<option value=all>All Maps</option>'); |
|
map { |
|
$r->print('<option value="'.$_.'"'); |
|
if ($pschp eq $_) { $r->print(' selected'); } |
|
$r->print('>'.$allmaps{$_}.'</option>'); |
|
} keys %allmaps; |
|
$r->print( |
|
'</select></td></tr><tr><td>Select Parameter</td><td><select name=pscat>'); |
|
$r->print('<option value=all>All Parameters</option>'); |
|
map { |
|
$r->print('<option value="'.$_.'"'); |
|
if ($pscat eq $_) { $r->print(' selected'); } |
|
$r->print('>'.$allkeys{$_}.'</option>'); |
|
} keys %allkeys; |
|
$r->print( |
|
'</select></td></tr></table><br><input type="submit" value="Display">'); |
|
if (($pscat) || ($pschp)) { |
# ----------------------------------------------------------------- Start Table |
# ----------------------------------------------------------------- Start Table |
|
my $catmarker='parameter_'.$pscat; |
|
$catmarker=~s/\./\_/g; |
my $coursespan=$csec?8:5; |
my $coursespan=$csec?8:5; |
$r->print(<<ENDTABLEHEAD); |
$r->print(<<ENDTABLEHEAD); |
<p><table border=2> |
<p><table border=2> |
Line 463 ENDTABLEHEADFOUR
|
Line 541 ENDTABLEHEADFOUR
|
my $defbgone=''; |
my $defbgone=''; |
my $defbgtwo=''; |
my $defbgtwo=''; |
map { |
map { |
|
my $rid=$_; |
|
if (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})) { |
# ------------------------------------------------------ Entry for one resource |
# ------------------------------------------------------ Entry for one resource |
if ($defbgone eq '"E0E099"') { |
if ($defbgone eq '"E0E099"') { |
$defbgone='"E0E0DD"'; |
$defbgone='"E0E0DD"'; |
Line 475 ENDTABLEHEADFOUR
|
Line 555 ENDTABLEHEADFOUR
|
$defbgtwo='"FFFF99"'; |
$defbgtwo='"FFFF99"'; |
} |
} |
@outpar=(); |
@outpar=(); |
my $rid=$_; |
|
my $thistitle=''; |
my $thistitle=''; |
my %name= (); |
my %name= (); |
my %part= (); |
my %part= (); |
Line 490 ENDTABLEHEADFOUR
|
Line 569 ENDTABLEHEADFOUR
|
$display{$_}=&Apache::lonnet::metadata($uri,$_.'.display'); |
$display{$_}=&Apache::lonnet::metadata($uri,$_.'.display'); |
unless ($display{$_}) { $display{$_}=''; } |
unless ($display{$_}) { $display{$_}=''; } |
$display{$_}.=' ('.$name{$_}.')'; |
$display{$_}.=' ('.$name{$_}.')'; |
$default{$_}=&Apache::lonnet::metadata($uri,$_.'.default'); |
$default{$_}=&Apache::lonnet::metadata($uri,$_); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$type{$_}=&Apache::lonnet::metadata($uri,$_.'.type'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
$thistitle=&Apache::lonnet::metadata($uri,$_.'.title'); |
} split(/\,/,$keyp{$rid}); |
} split(/\,/,$keyp{$rid}); |
|
|
my $totalparms=scalar keys %name; |
my $totalparms=scalar keys %name; |
|
my $isdef=1; |
|
unless ($totalparms) { $totalparms=1; $isdef=0; } |
|
if ($pscat ne 'all') { $totalparms=1; } |
$r->print('<td bgcolor='.$defbgone. |
$r->print('<td bgcolor='.$defbgone. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
join(' / ',split(/\//,$uri)). |
join(' / ',split(/\//,$uri)). |
Line 510 ENDTABLEHEADFOUR
|
Line 592 ENDTABLEHEADFOUR
|
$r->print('<td bgcolor='.$defbgone. |
$r->print('<td bgcolor='.$defbgone. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
' rowspan='.$totalparms.'><tt><font size=-1>'. |
join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>'); |
join(' / ',split(/\//,$mapp{$rid})).'</font></tt></td>'); |
|
if ($isdef) { |
map { |
map { |
|
if (($_ eq $catmarker) || ($pscat eq 'all')) { |
my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); |
my $result=&parmval($part{$_}.'.'.$name{$_},$rid,$default{$_}); |
|
|
$r->print("<td bgcolor=".$defbgtwo. |
$r->print("<td bgcolor=".$defbgtwo. |
Line 569 ENDTABLEHEADFOUR
|
Line 653 ENDTABLEHEADFOUR
|
&plink($type{$_},$display{$_},$outpar[1],$mprefix.'1', |
&plink($type{$_},$display{$_},$outpar[1],$mprefix.'1', |
'parmform.pres','psub').'</td>'); |
'parmform.pres','psub').'</td>'); |
} |
} |
|
|
$r->print( |
$r->print( |
'<td bgcolor=#CCCCFF>'.&valout($outpar[$result],$type{$_}).'</td>'); |
'<td bgcolor=#CCCCFF>'.&valout($outpar[$result],$type{$_}).'</td>'); |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
|
} |
} sort keys %name; |
} sort keys %name; |
|
} else { |
|
$r->print("</tr>\n<tr>"); |
|
} |
# -------------------------------------------------- End entry for one resource |
# -------------------------------------------------- End entry for one resource |
|
} |
} @ids; |
} @ids; |
$r->print('</table></form></body></html>'); |
$r->print('</table>'); |
|
} |
|
$r->print('</form></body></html>'); |
untie(%bighash); |
untie(%bighash); |
untie(%parmhash); |
untie(%parmhash); |
} |
} |