version 1.215, 2005/06/06 19:51:05
|
version 1.222, 2005/06/14 15:43:54
|
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 ($rules{$id}) { |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
|
$rulesid=$env{'request.course.id'}; |
|
} |
|
return $rules{$id}; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
# |
# |
Line 776 sub parmmenu {
|
Line 796 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 850 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 1004 sub standardkeyorder {
|
Line 1036 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 1780 sub crsenv {
|
Line 1814 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 2135 sub listdata {
|
Line 2169 sub listdata {
|
$r->print( |
$r->print( |
&Apache::lonhtmlcommon::date_setter('overviewform', |
&Apache::lonhtmlcommon::date_setter('overviewform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}). |
$$resourcedata{$thiskey}, |
|
'',1). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />' |
); |
); |
|
} elsif ($thistype eq 'string_yesno') { |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="yes"'); |
|
if ($$resourcedata{$thiskey} eq 'yes') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('Yes').'</label> '); |
|
$r->print('<label><input type="radio" name="set_'.$thiskey. |
|
'" value="no"'); |
|
if ($$resourcedata{$thiskey} eq 'no') { |
|
$r->print(' checked="checked"'); |
|
} |
|
$r->print(' />'.&mt('No').'</label>'); |
} else { |
} else { |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$r->print('<input type="text" name="set_'.$thiskey.'" value="'. |
$$resourcedata{$thiskey}.'">'); |
$$resourcedata{$thiskey}.'">'); |
Line 2152 sub listdata {
|
Line 2200 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 2298 ENDOVER
|
Line 2345 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 2462 ENDMAINFORMHEAD
|
Line 2508 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 2508 ENDMAINFORMHEAD
|
Line 2553 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 |
|
if ($env{'form.storerules'}) { |
|
# storage here |
|
&resetrulescache(); |
|
} |
|
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); |
|
my %lt=&Apache::lonlocal::texthash('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("\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>'); |
|
|
|
|
|
$r->print("\n</td><td>\n"); |
|
|
|
if (&isdateparm($defkeytype{$tempkey})) { |
|
my $hours=&rulescache($tempkey.'_hours'); |
|
my $min=&rulescache($tempkey.'_min'); |
|
my $sec=&rulescache($tempkey.'_sec'); |
|
$r->print(<<ENDINPUTDATE); |
|
<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="yes" $yeschecked /> $lt{'yes'}</label><br /> |
|
<label><input type="radio" name="$tempkey" value="no" $nochecked /> $lt{'no'}</label> |
|
ENDYESNO |
|
} else { |
|
$r->print('<input type="text" size="20" name="'.$tempkey.'" value="'.&rulescache($tempkey.'_value').'" />'); |
|
} |
|
$r->print('</td></tr>'); |
|
} |
|
$r->print("</table></form></body></html>"); |
|
return; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
Line 2522 Main handler. Calls &assessparms and &c
|
Line 2679 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 2589 sub handler {
|
Line 2747 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'}); |