version 1.213, 2005/06/06 15:46:02
|
version 1.231, 2005/06/20 14:13:00
|
Line 70 my $parmhashid;
|
Line 70 my $parmhashid;
|
my %parmhash; |
my %parmhash; |
my $symbsid; |
my $symbsid; |
my %symbs; |
my %symbs; |
|
my $rulesid; |
|
my %rules; |
|
|
# --- end local caches |
# --- end local caches |
|
|
Line 240 sub symbcache {
|
Line 242 sub symbcache {
|
return $symbs{$id}; |
return $symbs{$id}; |
} |
} |
|
|
|
sub resetrulescache { |
|
$rulesid=''; |
|
} |
|
|
|
sub rulescache { |
|
my $id=shift; |
|
if ($rulesid ne $env{'request.course.id'}) { |
|
%rules=(); |
|
} |
|
unless (defined($rules{$id})) { |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
|
$rulesid=$env{'request.course.id'}; |
|
} |
|
return $rules{$id}; |
|
} |
|
|
|
sub preset_defaults { |
|
my $type=shift; |
|
if (&rulescache($type.'_action') eq 'default') { |
|
# yes, there is something |
|
return (&rulescache($type.'_hours'), |
|
&rulescache($type.'_min'), |
|
&rulescache($type.'_sec'), |
|
&rulescache($type.'_value')); |
|
} else { |
|
# nothing there or something else |
|
return ('','','','',''); |
|
} |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
# |
# |
Line 271 sub storeparm {
|
Line 305 sub storeparm {
|
# - username |
# - username |
# - userdomain |
# - userdomain |
|
|
|
my %recstack; |
sub storeparm_by_symb { |
sub storeparm_by_symb { |
|
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$recflag)=@_; |
|
unless ($recflag) { |
|
# first time call |
|
%recstack=(); |
|
$recflag=1; |
|
} |
|
# store parameter |
|
&storeparm_by_symb_inner |
|
($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec); |
|
my ($prefix,$parm)=($spnam=~/^(.*[\_\.])([^\_\.]+)$/); |
|
# remember that this was set |
|
$recstack{$parm}=1; |
|
# what does this trigger? |
|
foreach my $triggered (split(/\:/,&rulescache($parm.'_triggers'))) { |
|
# don't backfire |
|
unless ((!$triggered) || ($recstack{$triggered})) { |
|
my $action=&rulescache($triggered.'_action'); |
|
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
|
# set triggered parameter on same level |
|
my $newspnam=$prefix.$triggered; |
|
my $newvalue=''; |
|
my $active=1; |
|
if ($action=~/^when\_setting/) { |
|
# are there restrictions? |
|
if (&rulescache($triggered.'_triggervalue')=~/\w/) { |
|
$active=0; |
|
foreach my $possiblevalue (split(/\s*\,\s*/,&rulescache($triggered.'_triggervalue'))) { |
|
if (lc($possiblevalue) eq lc($nval)) { $active=1; } |
|
} |
|
} |
|
$newvalue=&rulescache($triggered.'_value'); |
|
} else { |
|
my $totalsecs=((&rulescache($triggered.'_days')*24+&rulescache($triggered.'_hours'))*60+&rulescache($triggered.'_min'))*60+&rulescache($triggered.'_sec'); |
|
if ($action=~/^later\_than/) { |
|
$newvalue=$nval+$totalsecs; |
|
} else { |
|
$newvalue=$nval-$totalsecs; |
|
} |
|
} |
|
if ($active) { |
|
&storeparm_by_symb($symb,$newspnam,$snum,$newvalue,&rulescache($triggered.'_type'), |
|
$uname,$udom,$csec,$recflag); |
|
} |
|
} |
|
} |
|
return ''; |
|
} |
|
|
|
sub storeparm_by_symb_inner { |
# ---------------------------------------------------------- Get symb, map, etc |
# ---------------------------------------------------------- Get symb, map, etc |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec)=@_; |
# ---------------------------------------------------------- Construct prefixes |
# ---------------------------------------------------------- Construct prefixes |
Line 440 sub plink {
|
Line 524 sub plink {
|
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
$winvalue=$env{'form.recent_'.(split(/\_/,$type))[0]}; |
} |
} |
} |
} |
|
my ($parmname)=((split(/\&/,$marker))[1]=~/\_([^\_]+)$/); |
|
my ($hour,$min,$sec,$val)=&preset_defaults($parmname); |
|
unless (defined($winvalue)) { $winvalue=$val; } |
return |
return |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
&valout($value,$type).'</a><a name="'.$marker.'"></a>'; |
} |
} |
|
|
Line 544 sub print_row {
|
Line 629 sub print_row {
|
} else { |
} else { |
$parm=~s|\[.*\]\s||g; |
$parm=~s|\[.*\]\s||g; |
} |
} |
|
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
|
if ($automatic) { |
|
$parm.='<font color="red"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</font>'; |
|
} |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
|
|
my $thismarker=$which; |
my $thismarker=$which; |
Line 776 sub parmmenu {
|
Line 864 sub parmmenu {
|
checkthis('duedate','pscat'); |
checkthis('duedate','pscat'); |
checkthis('opendate','pscat'); |
checkthis('opendate','pscat'); |
checkthis('answerdate','pscat'); |
checkthis('answerdate','pscat'); |
checkthis('interval','pscat'); |
} |
} |
|
|
function checkdisset() { |
|
checkthis('discussend','pscat'); |
|
checkthis('discusshide','pscat'); |
|
} |
|
|
|
function checkcontdates() { |
|
checkthis('contentopen','pscat'); |
|
checkthis('contentclose','pscat'); |
|
} |
|
|
|
|
function checkvisi() { |
function checkvisi() { |
checkthis('hiddenresource','pscat'); |
checkthis('hiddenresource','pscat'); |
Line 820 ENDSCRIPT
|
Line 918 ENDSCRIPT
|
} |
} |
$r->print(' |
$r->print(' |
</tr><tr><td> |
</tr><tr><td> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkstandard()">Select Standard</a> |
<a href="javascript:checkstandard()">Select Common Only</a> |
</td><td> |
</td><td> |
<a href="javascript:checkdates()">Select Dates</a> |
<a href="javascript:checkdates()">Add Problem Dates</a> |
<a href="javascript:checkvisi()">Select Visibilities</a> |
<a href="javascript:checkcontdates()">Add Content Dates</a><br /> |
<a href="javascript:checkparts()">Select Part Parameters</a> |
<a href="javascript:checkdisset()">Add Discussion Settings</a> |
|
<a href="javascript:checkvisi()">Add Visibilities</a><br /> |
|
<a href="javascript:checkparts()">Add Part Parameters</a> |
</td><td> |
</td><td> |
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
<a href="javascript:checkall(false, \'pscat\')">Unselect All</a> |
</td> |
</td> |
Line 903 sub displaymenu {
|
Line 1003 sub displaymenu {
|
|
|
sub mapmenu { |
sub mapmenu { |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
my ($r,$allmaps,$pschp,$maptitles)=@_; |
$r->print(&mt('Select Enclosing Map or Folder').' '); |
$r->print('<b>'.&mt('Select Enclosing Map or Folder').'</b> '); |
$r->print('<select name="pschp">'); |
$r->print('<select name="pschp">'); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
$r->print('<option value="all">'.&mt('All Maps or Folders').'</option>'); |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) { |
Line 916 sub mapmenu {
|
Line 1016 sub mapmenu {
|
|
|
sub levelmenu { |
sub levelmenu { |
my ($r,$alllevs,$parmlev)=@_; |
my ($r,$alllevs,$parmlev)=@_; |
$r->print(&mt('Select Parameter Level'). |
$r->print('<b>'.&mt('Select Parameter Level'). |
&Apache::loncommon::help_open_topic('Course_Parameter_Levels').' '); |
&Apache::loncommon::help_open_topic('Course_Parameter_Levels').'</b> '); |
$r->print('<select name="parmlev">'); |
$r->print('<select name="parmlev">'); |
foreach (reverse sort keys %{$alllevs}) { |
foreach (reverse sort keys %{$alllevs}) { |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
$r->print('<option value="'.$$alllevs{$_}.'"'); |
Line 972 sub keysindisplayorder {
|
Line 1072 sub keysindisplayorder {
|
} (keys %{$name}); |
} (keys %{$name}); |
} |
} |
|
|
|
sub sortmenu { |
|
my ($r,$sortorder)=@_; |
|
$r->print('<br /><input type="radio" name="sortorder" value="realmstudent"'); |
|
if ($sortorder eq 'realmstudent') { |
|
$r->print(' checked="on"'); |
|
} |
|
$r->print(' />'.&mt('Sort by realm first, then student (group/section)')); |
|
$r->print('<br /><input type="radio" name="sortorder" value="studentrealm"'); |
|
if ($sortorder eq 'studentrealm') { |
|
$r->print(' checked="on"'); |
|
} |
|
$r->print(' />'.&mt('Sort by student (group/section) first, then realm')); |
|
} |
|
|
sub standardkeyorder { |
sub standardkeyorder { |
return ('parameter_0_opendate' => 1, |
return ('parameter_0_opendate' => 1, |
'parameter_0_duedate' => 2, |
'parameter_0_duedate' => 2, |
Line 990 sub standardkeyorder {
|
Line 1104 sub standardkeyorder {
|
'parameter_0_ordered' => 15, |
'parameter_0_ordered' => 15, |
'parameter_0_tol' => 16, |
'parameter_0_tol' => 16, |
'parameter_0_sig' => 17, |
'parameter_0_sig' => 17, |
'parameter_0_turnoffunit' => 18); |
'parameter_0_turnoffunit' => 18, |
|
'parameter_0_discussend' => 19, |
|
'parameter_0_discusshide' => 20); |
} |
} |
|
|
################################################## |
################################################## |
Line 1048 sub assessparms {
|
Line 1164 sub assessparms {
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
$alllevs{'Resource Level'}='full'; |
$alllevs{'Resource Level'}='full'; |
$alllevs{'Map Level'}='map'; |
$alllevs{'Map/Folder Level'}='map'; |
$alllevs{'Course Level'}='general'; |
$alllevs{'Course Level'}='general'; |
|
|
my %allparms; |
my %allparms; |
Line 1766 sub crsenv {
|
Line 1882 sub crsenv {
|
'anonymous_quiz' |
'anonymous_quiz' |
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
=> '<b>'.&mt('Anonymous quiz/exam').'</b><br />'. |
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)', |
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date when enrolling students').'</b>', |
'default_enrollment_start_date' => '<b>'.&mt('Default beginning date for student access.').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date when enrolling students').'</b>', |
'default_enrollment_end_date' => '<b>'.&mt('Default ending date for student access.').'</b>', |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'. |
'nothideprivileged' => '<b>'.&mt('Privileged users that should not be hidden on staff listings').'</b>'. |
'<br />(<tt>user:domain,user:domain,...</tt>)', |
'<br />(<tt>user:domain,user:domain,...</tt>)', |
'languages' => '<b>'.&mt('Languages used').'</b>', |
'languages' => '<b>'.&mt('Languages used').'</b>', |
Line 2036 sub extractuser {
|
Line 2152 sub extractuser {
|
} |
} |
|
|
sub listdata { |
sub listdata { |
my ($r,$resourcedata,$listdata)=@_; |
my ($r,$resourcedata,$listdata,$sortorder)=@_; |
# Start list output |
# Start list output |
|
|
my $oldsection=''; |
my $oldsection=''; |
Line 2045 sub listdata {
|
Line 2161 sub listdata {
|
my $pointer=0; |
my $pointer=0; |
$tableopen=0; |
$tableopen=0; |
my $foundkeys=0; |
my $foundkeys=0; |
foreach my $thiskey (sort keys %{$listdata}) { |
foreach my $thiskey (sort { |
|
if ($sortorder eq 'realmstudent') { |
|
my ($astudent,$arealm)=($a=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
|
my ($bstudent,$brealm)=($b=~/^$env{'request.course.id'}\.([^\.]+)\.(.+)\.[^\.]+$/); |
|
($arealm cmp $brealm) || ($astudent cmp $bstudent); |
|
} else { |
|
$a cmp $b; |
|
} |
|
} keys %{$listdata}) { |
if ($$listdata{$thiskey.'.type'}) { |
if ($$listdata{$thiskey.'.type'}) { |
my $thistype=$$listdata{$thiskey.'.type'}; |
my $thistype=$$listdata{$thiskey.'.type'}; |
if ($$resourcedata{$thiskey.'.type'}) { |
if ($$resourcedata{$thiskey.'.type'}) { |
Line 2072 sub listdata {
|
Line 2196 sub listdata {
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
} |
} |
if ($section ne $oldsection) { |
if ($sortorder eq 'realmstudent') { |
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
if ($realm ne $oldrealm) { |
$oldsection=$section; |
$r->print(&tableend()."\n<hr /><h1>$realm</h1>"); |
$oldrealm=''; |
$oldrealm=$realm; |
} |
$oldsection=''; |
if ($realm ne $oldrealm) { |
} |
$r->print(&tableend()."\n<h2>$realm</h2>"); |
if ($section ne $oldsection) { |
$oldrealm=$realm; |
$r->print(&tableend()."\n<h2>$section</h2>"); |
$oldpart=''; |
$oldsection=$section; |
|
$oldpart=''; |
|
} |
|
} else { |
|
if ($section ne $oldsection) { |
|
$r->print(&tableend()."\n<hr /><h1>$section</h1>"); |
|
$oldsection=$section; |
|
$oldrealm=''; |
|
} |
|
if ($realm ne $oldrealm) { |
|
$r->print(&tableend()."\n<h2>$realm</h2>"); |
|
$oldrealm=$realm; |
|
$oldpart=''; |
|
} |
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$r->print(&tableend(). |
"\n<h3><font color='blue'>".&mt('Part').": $part</font></h3>"); |
"\n<font color='blue'>".&mt('Part').": $part</font>"); |
$oldpart=$part; |
$oldpart=$part; |
} |
} |
# |
# |
|
# Preset defaults? |
|
# |
|
my ($hour,$min,$sec,$val)=('','','',''); |
|
unless ($$resourcedata{$thiskey}) { |
|
my ($parmname)=($thiskey=~/\.(\w+)$/); |
|
($hour,$min,$sec,$val)=&preset_defaults($parmname); |
|
} |
|
|
|
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart().'<tr><td><b>'.$name. |
Line 2100 sub listdata {
|
Line 2246 sub listdata {
|
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::date_setter('overviewform', |
&Apache::lonhtmlcommon::date_setter('overviewform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}). |
$$resourcedata{$thiskey}, |
|
'',1,'','',$hour,$min,$sec). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
); |
); |
|
} elsif ($thistype eq 'string_yesno') { |
|
my $showval; |
|
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} else { |
|
$showval=$val; |
|
} |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="yes"'); |
|
if ($showval eq 'yes') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('Yes').'</label> '); |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="no"'); |
|
if ($showval eq 'no') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('No').'</label>'); |
} else { |
} else { |
|
my $showval; |
|
if (defined($$resourcedata{$thiskey})) { |
|
$showval=$$resourcedata{$thiskey}; |
|
} else { |
|
$showval=$val; |
|
} |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$$resourcedata{$thiskey}.'">'); |
$showval.'">'); |
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
Line 2117 sub listdata {
|
Line 2289 sub listdata {
|
|
|
sub newoverview { |
sub newoverview { |
my $r=shift; |
my $r=shift; |
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag('Set Parameters'); |
'Set Course Assessment Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
Line 2130 $html
|
Line 2301 $html
|
</head> |
</head> |
$bodytag |
$bodytag |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=newoverview" name="parmform"> |
<form method="post" action="/adm/parmset?action=newoverview" name="overviewform"> |
ENDOVER |
ENDOVER |
my @ids=(); |
my @ids=(); |
my %typep=(); |
my %typep=(); |
Line 2147 ENDOVER
|
Line 2318 ENDOVER
|
|
|
my %alllevs=(); |
my %alllevs=(); |
$alllevs{'Resource Level'}='full'; |
$alllevs{'Resource Level'}='full'; |
$alllevs{'Map Level'}='map'; |
$alllevs{'Map/Folder Level'}='map'; |
$alllevs{'Course Level'}='general'; |
$alllevs{'Course Level'}='general'; |
|
|
my $csec=$env{'form.csec'}; |
my $csec=$env{'form.csec'}; |
Line 2196 ENDOVER
|
Line 2367 ENDOVER
|
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td>'); |
$r->print('</td><td>'); |
§ionmenu($r,\@selected_sections); |
§ionmenu($r,\@selected_sections); |
$r->print('</td></tr></table>'. |
|
'<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
$r->print('</td></tr></table>'); |
|
|
|
my $sortorder=$env{'form.sortorder'}; |
|
unless ($sortorder) { $sortorder='realmstudent'; } |
|
&sortmenu($r,$sortorder); |
|
|
|
$r->print('<p><input type="submit" name="dis" value="'.&mt('Display').'" /></p>'); |
|
|
# Build the list data hash from the specified parms |
# Build the list data hash from the specified parms |
|
|
Line 2248 ENDOVER
|
Line 2425 ENDOVER
|
|
|
# List data |
# List data |
|
|
&listdata($r,$resourcedata,$listdata); |
&listdata($r,$resourcedata,$listdata,$sortorder); |
} |
} |
$r->print(&tableend(). |
$r->print(&tableend(). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':''). |
Line 2257 ENDOVER
|
Line 2434 ENDOVER
|
|
|
sub overview { |
sub overview { |
my $r=shift; |
my $r=shift; |
my $bodytag=&Apache::loncommon::bodytag( |
my $bodytag=&Apache::loncommon::bodytag('Modify Parameters'); |
'Modify Course Assessment Parameters'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
Line 2280 ENDOVER
|
Line 2456 ENDOVER
|
|
|
my $resourcedata=&readdata($crs,$dom); |
my $resourcedata=&readdata($crs,$dom); |
|
|
|
|
|
my $sortorder=$env{'form.sortorder'}; |
|
unless ($sortorder) { $sortorder='realmstudent'; } |
|
&sortmenu($r,$sortorder); |
|
|
# List data |
# List data |
|
|
my $foundkeys=&listdata($r,$resourcedata,$resourcedata); |
my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder); |
|
|
$r->print(&tableend().'<p>'. |
$r->print(&tableend().'<p>'. |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>'); |
Line 2416 ENDMAINFORMHEAD
|
Line 2597 ENDMAINFORMHEAD
|
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set/Modify Course Assessment Parameters - Helper Mode', |
{ text => 'Set/Modify Resource Parameters - Helper Mode', |
url => '/adm/helper/parameter.helper', |
url => '/adm/helper/parameter.helper', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Modify Course Assessment Parameters - Overview Mode', |
{ text => 'Modify Resource Parameters - Overview Mode', |
action => 'setoverview', |
action => 'setoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set Course Assessment Parameters - Overview Mode', |
{ text => 'Set Resource Parameters - Overview Mode', |
action => 'newoverview', |
action => 'newoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Set/Modify Course Assessment Parameters - Table Mode', |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
action => 'settable', |
action => 'settable', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Cascading_Parameters', |
help => 'Cascading_Parameters', |
}, |
}, |
# { text => 'Set Parameter Default Preferences', |
{ text => 'Set Parameter Setting Default Actions', |
# help => 'Course_View_Class_List', |
action => 'setdefaults', |
# action => 'setdefaults', |
permission => $parm_permission, |
# permission => $parm_permission, |
}, |
# }, |
|
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
Line 2462 ENDMAINFORMHEAD
|
Line 2642 ENDMAINFORMHEAD
|
} |
} |
|
|
|
|
|
################################################## |
|
|
|
sub defaultsetter { |
|
my $r=shift; |
|
my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions'); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults'); |
|
my $html=&Apache::lonxml::xmlbegin(); |
|
$r->print(<<ENDDEFHEAD); |
|
$html |
|
<head> |
|
<title>LON-CAPA Parameters</title> |
|
</head> |
|
$bodytag |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=setdefaults" name="defaultform"> |
|
ENDDEFHEAD |
|
my @ids=(); |
|
my %typep=(); |
|
my %keyp=(); |
|
my %allparms=(); |
|
my %allparts=(); |
|
my %allmaps=(); |
|
my %mapp=(); |
|
my %symbp=(); |
|
my %maptitles=(); |
|
my %uris=(); |
|
my %keyorder=&standardkeyorder(); |
|
my %defkeytype=(); |
|
|
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
|
\%mapp, \%symbp,\%maptitles,\%uris, |
|
\%keyorder,\%defkeytype); |
|
if ($env{'form.storerules'}) { |
|
my %newrules=(); |
|
my @delrules=(); |
|
my %triggers=(); |
|
foreach my $key (keys(%env)) { |
|
if ($key=~/^form\.(\w+)\_action$/) { |
|
my $tempkey=$1; |
|
my $action=$env{$key}; |
|
if ($action) { |
|
$newrules{$tempkey.'_action'}=$action; |
|
if ($action ne 'default') { |
|
my ($whichaction,$whichparm)=($action=~/^(.*\_)([^\_]+)$/); |
|
$triggers{$whichparm}.=$tempkey.':'; |
|
} |
|
$newrules{$tempkey.'_type'}=$defkeytype{$tempkey}; |
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
$newrules{$tempkey.'_days'}=$env{'form.'.$tempkey.'_days'}; |
|
$newrules{$tempkey.'_hours'}=$env{'form.'.$tempkey.'_hours'}; |
|
$newrules{$tempkey.'_min'}=$env{'form.'.$tempkey.'_min'}; |
|
$newrules{$tempkey.'_sec'}=$env{'form.'.$tempkey.'_sec'}; |
|
} else { |
|
$newrules{$tempkey.'_value'}=$env{'form.'.$tempkey.'_value'}; |
|
$newrules{$tempkey.'_triggervalue'}=$env{'form.'.$tempkey.'_triggervalue'}; |
|
} |
|
} else { |
|
push(@delrules,$tempkey.'_action'); |
|
push(@delrules,$tempkey.'_type'); |
|
push(@delrules,$tempkey.'_hours'); |
|
push(@delrules,$tempkey.'_min'); |
|
push(@delrules,$tempkey.'_sec'); |
|
push(@delrules,$tempkey.'_value'); |
|
} |
|
} |
|
} |
|
foreach my $key (keys %allparms) { |
|
$newrules{$key.'_triggers'}=$triggers{$key}; |
|
} |
|
&Apache::lonnet::put('parmdefactions',\%newrules,$dom,$crs); |
|
&Apache::lonnet::del('parmdefactions',\@delrules,$dom,$crs); |
|
&resetrulescache(); |
|
} |
|
my %lt=&Apache::lonlocal::texthash('days' => 'Days', |
|
'hours' => 'Hours', |
|
'min' => 'Minutes', |
|
'sec' => 'Seconds', |
|
'yes' => 'Yes', |
|
'no' => 'No'); |
|
my @standardoptions=('','default'); |
|
my @standarddisplay=('',&mt('Default value when manually setting')); |
|
my @dateoptions=('','default'); |
|
my @datedisplay=('',&mt('Default value when manually setting')); |
|
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
|
unless ($tempkey) { next; } |
|
push @standardoptions,'when_setting_'.$tempkey; |
|
push @standarddisplay,&mt('Automatically set when setting ').$tempkey; |
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
push @dateoptions,'later_than_'.$tempkey; |
|
push @datedisplay,&mt('Automatically set later than ').$tempkey; |
|
push @dateoptions,'earlier_than_'.$tempkey; |
|
push @datedisplay,&mt('Automatically set earlier than ').$tempkey; |
|
} |
|
} |
|
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
|
&mt('Automatic setting rules apply to table mode interfaces only.')); |
|
$r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'. |
|
&mt('Action').'</th><th>'.&mt('Value').'</th></tr>'); |
|
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
|
unless ($tempkey) { next; } |
|
$r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
|
my $action=&rulescache($tempkey.'_action'); |
|
$r->print('<select name="'.$tempkey.'_action">'); |
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
for (my $i=0;$i<=$#dateoptions;$i++) { |
|
if ($dateoptions[$i]=~/\_$tempkey$/) { next; } |
|
$r->print("\n<option value='$dateoptions[$i]'". |
|
($dateoptions[$i] eq $action?' selected="selected"':''). |
|
">$datedisplay[$i]</option>"); |
|
} |
|
} else { |
|
for (my $i=0;$i<=$#standardoptions;$i++) { |
|
if ($standardoptions[$i]=~/\_$tempkey$/) { next; } |
|
$r->print("\n<option value='$standardoptions[$i]'". |
|
($standardoptions[$i] eq $action?' selected="selected"':''). |
|
">$standarddisplay[$i]</option>"); |
|
} |
|
} |
|
$r->print('</select>'); |
|
unless (&isdateparm($defkeytype{$tempkey})) { |
|
$r->print("\n<br />".&mt('Triggering value(s) of other parameter (optional, comma-separated):'). |
|
'<input type="text" size="20" name="'.$tempkey.'_triggervalue" value="'.&rulescache($tempkey.'_triggervalue').'" />'); |
|
} |
|
$r->print("\n</td><td>\n"); |
|
|
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
my $days=&rulescache($tempkey.'_days'); |
|
my $hours=&rulescache($tempkey.'_hours'); |
|
my $min=&rulescache($tempkey.'_min'); |
|
my $sec=&rulescache($tempkey.'_sec'); |
|
$r->print(<<ENDINPUTDATE); |
|
<input name="$tempkey\_days" type="text" size="4" value="$days" />$lt{'days'}<br /> |
|
<input name="$tempkey\_hours" type="text" size="4" value="$hours" />$lt{'hours'}<br /> |
|
<input name="$tempkey\_min" type="text" size="4" value="$min" />$lt{'min'}<br /> |
|
<input name="$tempkey\_sec" type="text" size="4" value="$sec" />$lt{'sec'} |
|
ENDINPUTDATE |
|
} elsif ($defkeytype{$tempkey} eq 'string_yesno') { |
|
my $yeschecked=''; |
|
my $nochecked=''; |
|
if (&rulescache($tempkey.'_value') eq 'yes') { $yeschecked='checked="checked"'; } |
|
if (&rulescache($tempkey.'_value') eq 'no') { $nochecked='checked="checked"'; } |
|
|
|
$r->print(<<ENDYESNO); |
|
<label><input type="radio" name="$tempkey\_value" value="yes" $yeschecked /> $lt{'yes'}</label><br /> |
|
<label><input type="radio" name="$tempkey\_value" value="no" $nochecked /> $lt{'no'}</label> |
|
ENDYESNO |
|
} else { |
|
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
|
} |
|
$r->print('</td></tr>'); |
|
} |
|
$r->print("</table>\n<input type='submit' name='storerules' value='". |
|
&mt('Store Rules')."' /></form>\n</body>\n</html>"); |
|
return; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
Line 2476 Main handler. Calls &assessparms and &c
|
Line 2812 Main handler. Calls &assessparms and &c
|
=cut |
=cut |
################################################## |
################################################## |
################################################## |
################################################## |
use Data::Dumper; |
# use Data::Dumper; |
|
|
sub handler { |
sub handler { |
my $r=shift; |
my $r=shift; |
|
|
Line 2490 sub handler {
|
Line 2827 sub handler {
|
'pres_marker', |
'pres_marker', |
'pres_value', |
'pres_value', |
'pres_type', |
'pres_type', |
'udom','uname']); |
'udom','uname','symb']); |
|
|
|
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
Line 2532 sub handler {
|
Line 2869 sub handler {
|
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'crsenv' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=crsenv', |
text=>"Course Environment"}); |
text=>"Course Environment"}); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
|
'Edit Course Environment')); |
|
&crsenv($r); |
&crsenv($r); |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setoverview' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
Line 2543 sub handler {
|
Line 2878 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setoverview', |
text=>"Overview Mode"}); |
text=>"Overview Mode"}); |
&newoverview($r); |
&newoverview($r); |
} elsif ($env{'form.action'} eq 'settable' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setdefaults' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setdefaults', |
|
text=>"Set Defaults"}); |
|
&defaultsetter($r); |
|
} elsif ($env{'form.action'} eq 'settable' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |