version 1.301, 2006/05/09 20:25:06
|
version 1.350.2.6, 2007/01/18 21:14:04
|
Line 63 use Apache::lonhomework;
|
Line 63 use Apache::lonhomework;
|
use Apache::lonxml; |
use Apache::lonxml; |
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonnavmaps; |
use Apache::lonnavmaps; |
|
use Apache::longroup; |
|
use Apache::lonrss; |
|
use LONCAPA qw(:DEFAULT :match); |
|
|
# --- Caches local to lonparmset |
# --- Caches local to lonparmset |
|
|
Line 90 Inputs: $what - a parameter spec (inclu
|
Line 93 Inputs: $what - a parameter spec (inclu
|
|
|
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 14 possible levels |
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 14 possible levels |
|
|
14 - General Course |
14- General Course |
13 - Map or Folder level in course |
13- Map or Folder level in course |
12- resource default |
12- resource default |
11- map default |
11- map default |
10 - resource level in course |
10- resource level in course |
9 - General for section |
9 - General for section |
8 - Map or Folder level for section |
8 - Map or Folder level for section |
7 - resource level in section |
7 - resource level in section |
Line 119 sub parmval_by_symb {
|
Line 122 sub parmval_by_symb {
|
# load caches |
# load caches |
&cacheparmhash(); |
&cacheparmhash(); |
|
|
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $useropt; |
|
if ($uname ne '' && $udom ne '') { |
|
$useropt = &Apache::lonnet::get_userresdata($uname,$udom); |
|
} |
|
|
my $result=''; |
my $result=''; |
my @outpar=(); |
my @outpar=(); |
# ----------------------------------------------------- Cascading lookup scheme |
# ----------------------------------------------------- Cascading lookup scheme |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$what; |
my $symbparm=$symb.'.'.$what; |
my $mapparm=$map.'___(all).'.$what; |
my $mapparm=$map.'___(all).'.$what; |
Line 169 sub parmval_by_symb {
|
Line 176 sub parmval_by_symb {
|
} |
} |
|
|
# ------------------------------------------------------ fourth, back to course |
# ------------------------------------------------------ fourth, back to course |
if (defined($csec)) { |
if ($csec ne '') { |
if (defined($$courseopt{$seclevel})) { |
if (defined($$courseopt{$seclevel})) { |
$outpar[9]=$$courseopt{$seclevel}; |
$outpar[9]=$$courseopt{$seclevel}; |
$result=9; |
$result=9; |
Line 185 sub parmval_by_symb {
|
Line 192 sub parmval_by_symb {
|
} |
} |
} |
} |
# ------------------------------------------------------ fifth, check course group |
# ------------------------------------------------------ fifth, check course group |
if (defined($cgroup)) { |
if ($cgroup ne '') { |
if (defined($$courseopt{$grplevel})) { |
if (defined($$courseopt{$grplevel})) { |
$outpar[6]=$$courseopt{$grplevel}; |
$outpar[6]=$$courseopt{$grplevel}; |
$result=6; |
$result=6; |
Line 202 sub parmval_by_symb {
|
Line 209 sub parmval_by_symb {
|
|
|
# ---------------------------------------------------------- fifth, check user |
# ---------------------------------------------------------- fifth, check user |
|
|
if (defined($uname)) { |
if ($uname ne '') { |
if (defined($$useropt{$courselevel})) { |
if (defined($$useropt{$courselevel})) { |
$outpar[3]=$$useropt{$courselevel}; |
$outpar[3]=$$useropt{$courselevel}; |
$result=3; |
$result=3; |
Line 265 sub resetrulescache {
|
Line 272 sub resetrulescache {
|
|
|
sub rulescache { |
sub rulescache { |
my $id=shift; |
my $id=shift; |
if ($rulesid ne $env{'request.course.id'}) { |
if ($rulesid ne $env{'request.course.id'} |
%rules=(); |
&& !defined($rules{$id})) { |
} |
|
unless (defined($rules{$id})) { |
|
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'}; |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
%rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs); |
Line 403 sub storeparm_by_symb_inner {
|
Line 408 sub storeparm_by_symb_inner {
|
# ---------------------------------------------------------- Construct prefixes |
# ---------------------------------------------------------- Construct prefixes |
$spnam=~s/\_([^\_]+)$/\.$1/; |
$spnam=~s/\_([^\_]+)$/\.$1/; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
my $map=(&Apache::lonnet::decode_symb($symb))[0]; |
|
$map = &Apache::lonnet::deversion($map); |
|
|
my $symbparm=$symb.'.'.$spnam; |
my $symbparm=$symb.'.'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
my $mapparm=$map.'___(all).'.$spnam; |
|
|
Line 488 sub storeparm_by_symb_inner {
|
Line 495 sub storeparm_by_symb_inner {
|
} |
} |
|
|
if ($reply=~/^error\:(.*)/) { |
if ($reply=~/^error\:(.*)/) { |
return "<font color=red>Write Error: $1</font>"; |
return "<span class=\"LC_error\">Write Error: $1</span>"; |
} |
} |
return ''; |
return ''; |
} |
} |
Line 502 sub storeparm_by_symb_inner {
|
Line 509 sub storeparm_by_symb_inner {
|
|
|
Format a value for output. |
Format a value for output. |
|
|
Inputs: $value, $type |
Inputs: $value, $type, $editable |
|
|
Returns: $value, formatted for output. If $type indicates it is a date, |
Returns: $value, formatted for output. If $type indicates it is a date, |
localtime($value) is returned. |
localtime($value) is returned. |
|
$editable will return an icon to click on |
|
|
=cut |
=cut |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
sub valout { |
sub valout { |
my ($value,$type)=@_; |
my ($value,$type,$editable)=@_; |
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 = ' '; |
if ($editable) { |
|
$result = '<span class="LC_clickhere">*</span>'; |
|
} else { |
|
$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 584 sub plink {
|
Line 596 sub plink {
|
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'. |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
'<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','" |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
.$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'. |
&valout($value,$type).'</a></td></tr></table>'; |
&valout($value,$type,1).'</a></td></tr></table>'; |
} |
} |
|
|
sub page_js { |
sub page_js { |
Line 649 sub startpage {
|
Line 661 sub startpage {
|
&page_js(), |
&page_js(), |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting'); |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode'); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 696 sub print_row {
|
Line 708 sub print_row {
|
} |
} |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers'); |
if ($automatic) { |
if ($automatic) { |
$parm.='<font color="red"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</font>'; |
$parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>'; |
} |
} |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
$r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>'); |
|
|
Line 1051 sub parmmenu {
|
Line 1063 sub parmmenu {
|
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
$r->print(); |
$r->print(); |
$r->print("\n<table><tr>"); |
$r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>"); |
my $cnt=0; |
my $cnt=0; |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { |
$r->print("\n<td><font size='-1'><label><input type='checkbox' name='pscat' "); |
$r->print("\n<td><label><input type='checkbox' name='pscat' "); |
$r->print('value="'.$tempkey.'"'); |
$r->print('value="'.$tempkey.'"'); |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) { |
$r->print(' checked'); |
$r->print(' checked'); |
} |
} |
$r->print('>'.$$allparms{$tempkey}.'</label></font></td>'); |
$r->print('>'.$$allparms{$tempkey}.'</label></td>'); |
$cnt++; |
$cnt++; |
if ($cnt==3) { |
if ($cnt==3) { |
$r->print("</tr>\n<tr>"); |
$r->print("</tr>\n<tr>"); |
Line 1067 ENDSCRIPT
|
Line 1079 ENDSCRIPT
|
} |
} |
} |
} |
$r->print(' |
$r->print(' |
</tr><tr><td> |
</tr><tr id=\"LC_parm_overview_parm_menu_selectors\"><td> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkall(true, \'pscat\')">Select All</a><br /> |
<a href="javascript:checkstandard()">Select Common Only</a> |
<a href="javascript:checkstandard()">Select Common Only</a> |
</td><td> |
</td><td> |
Line 1121 sub usermenu {
|
Line 1133 sub usermenu {
|
my %sectionhash = &Apache::loncommon::get_sections(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
|
|
my $groups; |
my $groups; |
my %grouphash = &Apache::loncommon::coursegroups(); |
my %grouphash = &Apache::longroup::coursegroups(); |
|
|
if (%sectionhash) { |
if (%sectionhash) { |
$sections=$lt{'se'}.': <select name="csec"'; |
$sections=$lt{'se'}.': <select name="csec"'; |
Line 1261 sub sectionmenu {
|
Line 1273 sub sectionmenu {
|
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($r,$selectedgroups)=@_; |
my %grouphash = &Apache::loncommon::coursegroups(); |
my %grouphash = &Apache::longroup::coursegroups(); |
return if (!%grouphash); |
return if (!%grouphash); |
|
|
$r->print('<select name="Group" multiple="true" size="8" >'); |
$r->print('<select name="Group" multiple="true" size="8" >'); |
Line 1471 sub assessparms {
|
Line 1483 sub assessparms {
|
$id=''; |
$id=''; |
} else { |
} else { |
$message= |
$message= |
"<font color=red>".&mt("Unknown ID")." '$id' ". |
'<span class="LC_error">'.&mt("Unknown ID")." '$id' ". |
&mt('at domain')." '$udom'</font>"; |
&mt('at domain')." '$udom'</span>"; |
} |
} |
} else { |
} else { |
$uname=$env{'form.uname'}; |
$uname=$env{'form.uname'}; |
Line 1483 sub assessparms {
|
Line 1495 sub assessparms {
|
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
$uhome=&Apache::lonnet::homeserver($uname,$udom); |
if ($uhome eq 'no_host') { |
if ($uhome eq 'no_host') { |
$message= |
$message= |
"<font color=red>".&mt("Unknown user")." '$uname' ". |
'<span class="LC_error">'.&mt("Unknown user")." '$uname' ". |
&mt("at domain")." '$udom'</font>"; |
&mt("at domain")." '$udom'</span>"; |
$uname=''; |
$uname=''; |
} else { |
} else { |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$csec=&Apache::lonnet::getsection($udom,$uname, |
$env{'request.course.id'}); |
$env{'request.course.id'}); |
|
|
if ($csec eq '-1') { |
if ($csec eq '-1') { |
$message="<font color=red>". |
$message='<span class="LC_error">'. |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("User")." '$uname' ".&mt("at domain")." '$udom' ". |
&mt("not in this course")."</font>"; |
&mt("not in this course")."</span>"; |
$uname=''; |
$uname=''; |
$csec=$env{'form.csec'}; |
$csec=$env{'form.csec'}; |
$cgroup=$env{'form.cgroup'}; |
$cgroup=$env{'form.cgroup'}; |
Line 1503 sub assessparms {
|
Line 1515 sub assessparms {
|
$message="\n<p>\n".&mt("Full Name").": ". |
$message="\n<p>\n".&mt("Full Name").": ". |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
$name{'firstname'}.' '.$name{'middlename'}.' ' |
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br />\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
@usersgroups = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if (@usersgroups > 0) { |
if (@usersgroups > 0) { |
unless (grep/^\Q$cgroup\E$/,@usersgroups) { |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
$cgroup = $usersgroups[0]; |
$cgroup = $usersgroups[0]; |
} |
} |
} |
} |
Line 1551 sub assessparms {
|
Line 1563 sub assessparms {
|
foreach ('tolerance','date_default','date_start','date_end', |
foreach ('tolerance','date_default','date_start','date_end', |
'date_interval','int','float','string') { |
'date_interval','int','float','string') { |
$r->print('<input type="hidden" value="'. |
$r->print('<input type="hidden" value="'. |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'">'); |
$env{'form.recent_'.$_}.'" name="recent_'.$_.'" />'); |
} |
} |
|
|
if (!$pssymb) { |
if (!$pssymb) { |
Line 1566 sub assessparms {
|
Line 1578 sub assessparms {
|
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
&displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder); |
} else { |
} else { |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb); |
$r->print(&mt('Specific Resource').": ".$resource. |
my $title = &Apache::lonnet::gettitle($pssymb); |
'<input type="hidden" value="'.$pssymb.'" name="symb">'. |
$r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource). |
|
'<input type="hidden" value="'.$pssymb.'" name="symb" />'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
'<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'. |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />'); |
} |
} |
Line 1627 sub assessparms {
|
Line 1640 sub assessparms {
|
); |
); |
$r->print(<<ENDTABLETWO); |
$r->print(<<ENDTABLETWO); |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan=3>$lt{'pie'}</th> |
<th rowspan=3>$lt{'csv'}<br>($csuname $lt{'at'} $csudom)</th> |
<th rowspan=3>$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th> |
</tr><tr><td colspan=5></td><th colspan=2>$lt{'ic'}</th><th colspan=2>$lt{'rl'}</th> |
<th colspan=1>$lt{'ic'}</th> |
<th colspan=1>$lt{'ic'}</th> |
|
|
Line 1727 ENDTABLEHEADFOUR
|
Line 1740 ENDTABLEHEADFOUR
|
'</font></tt><p><b>'. |
'</font></tt><p><b>'. |
"<a href=\"javascript:openWindow('". |
"<a href=\"javascript:openWindow('". |
&Apache::lonnet::clutter($uri).'?symb='. |
&Apache::lonnet::clutter($uri).'?symb='. |
&Apache::lonnet::escape($symbp{$rid}). |
&escape($symbp{$rid}). |
"', 'metadatafile', '450', '500', 'no', 'yes')\";". |
"', 'metadatafile', '450', '500', 'no', 'yes');\"". |
" TARGET=_self>$title"); |
" target=\"_self\">$title"); |
|
|
if ($thistitle) { |
if ($thistitle) { |
$r->print(' ('.$thistitle.')'); |
$r->print(' ('.$thistitle.')'); |
Line 1926 ENDMAPONE
|
Line 1939 ENDMAPONE
|
} |
} |
|
|
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$csec</i></font>\n")}; |
if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")}; |
$r->print("</h4>\n"); |
$r->print("</h4>\n"); |
#---------------------------------------------------------------- print table |
#---------------------------------------------------------------- print table |
$r->print('<p><table border="2">'); |
$r->print('<p><table border="2">'); |
Line 1993 sub crsenv {
|
Line 2006 sub crsenv {
|
('environment', |
('environment', |
{'top level map backup '.$bkuptime => $tmp[1] }, |
{'top level map backup '.$bkuptime => $tmp[1] }, |
$dom,$crs). |
$dom,$crs). |
'<br>'; |
'<br />'; |
} |
} |
# |
# |
# Deal with modified default spreadsheets |
# Deal with modified default spreadsheets |
Line 2071 sub crsenv {
|
Line 2084 sub crsenv {
|
} |
} |
} |
} |
} |
} |
|
|
|
my $start_table =&Apache::loncommon::start_data_table(); |
|
my $start_header_row=&Apache::loncommon::start_data_table_header_row(); |
|
my $end_header_row =&Apache::loncommon::end_data_table_header_row(); |
# ------------------------- Re-init course environment entries for this session |
# ------------------------- Re-init course environment entries for this session |
|
|
&Apache::lonnet::coursedescription($env{'request.course.id'} |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
{'freshen_cache' => 1}); |
{'freshen_cache' => 1}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
Line 2087 sub crsenv {
|
Line 2104 sub crsenv {
|
('url' => '<b>'.&mt('Top Level Map').'</b> '. |
('url' => '<b>'.&mt('Top Level Map').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','url','sequence')\">". |
"('envform','url','sequence')\">". |
&mt('Select Map').'</a><br /><font color=red> '. |
&mt('Select Map').'</a><br /><span class="LC_warning"> '. |
&mt('Modification may make assessment data inaccessible'). |
&mt('Modification may make assessment data inaccessible'). |
'</font>', |
'</span>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'description' => '<b>'.&mt('Course Description').'</b>', |
'courseid' => '<b>'.&mt('Course ID or number'). |
'courseid' => '<b>'.&mt('Course ID or number'). |
'</b><br />'. |
'</b><br />'. |
Line 2100 sub crsenv {
|
Line 2117 sub crsenv {
|
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'default_xml_style' => '<b>'.&mt('Default XML Style File').'</b> '. |
'<a href="javascript:openbrowser'. |
'<a href="javascript:openbrowser'. |
"('envform','default_xml_style'". |
"('envform','default_xml_style'". |
",'sty')\">$SelectStyleFile</a><br>", |
",'sty')\">$SelectStyleFile</a><br />", |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'question.email' => '<b>'.&mt('Feedback Addresses for Resource Content Question'). |
'</b><br />(<tt>user:domain,'. |
'</b><br />(<tt>user:domain,'. |
'user:domain(section;section;...;*;...),...</tt>)', |
'user:domain(section;section;...;*;...),...</tt>)', |
Line 2160 sub crsenv {
|
Line 2177 sub crsenv {
|
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
'('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')', |
'rndseed' |
'rndseed' |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Randomization algorithm used').'</b> <br />'. |
'<font color="red">'.&mt('Modifying this will make problems').' '. |
'<span class="LC_error">'.&mt('Modifying this will make problems').' '. |
&mt('have different numbers and answers').'</font>', |
&mt('have different numbers and answers').'</span>', |
'receiptalg' |
'receiptalg' |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
=> '<b>'.&mt('Receipt algorithm used').'</b> <br />'. |
&mt('This controls how receipt numbers are generated.'), |
&mt('This controls how receipt numbers are generated.'), |
Line 2176 sub crsenv {
|
Line 2193 sub crsenv {
|
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])', |
|
'print_header_format' |
|
=> '<b>Print header format; substitutions</b>: %n student name %c course id %a assignment note, numbers after the % limit the field size', |
'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>)', |
Line 2187 sub crsenv {
|
Line 2206 sub crsenv {
|
'disable_receipt_display' |
'disable_receipt_display' |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
=> '<b>'.&mt('Disable display of problem receipts').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
|
'task_messages' |
|
=> '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>', |
'disablesigfigs' |
'disablesigfigs' |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
=> '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'. |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')', |
Line 2214 sub crsenv {
|
Line 2235 sub crsenv {
|
'problem_stream_switch', |
'problem_stream_switch', |
'suppress_tries', |
'suppress_tries', |
'default_paper_size', |
'default_paper_size', |
|
'print_header_format', |
'disable_receipt_display', |
'disable_receipt_display', |
'spreadsheet_default_classcalc', |
'spreadsheet_default_classcalc', |
'spreadsheet_default_studentcalc', |
'spreadsheet_default_studentcalc', |
Line 2223 sub crsenv {
|
Line 2245 sub crsenv {
|
'default_enrollment_end_date', |
'default_enrollment_end_date', |
'tthoptions', |
'tthoptions', |
'disablesigfigs', |
'disablesigfigs', |
'disableexampointprint' |
'disableexampointprint', |
|
'task_messages' |
); |
); |
foreach my $parameter (sort(keys(%values))) { |
foreach my $parameter (sort(keys(%values))) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) { |
Line 2233 sub crsenv {
|
Line 2256 sub crsenv {
|
} |
} |
} |
} |
} |
} |
|
|
foreach my $parameter (@Display_Order) { |
foreach my $parameter (@Display_Order) { |
my $description = $descriptions{$parameter}; |
my $description = $descriptions{$parameter}; |
# onchange is javascript to automatically check the 'Set' button. |
# onchange is javascript to automatically check the 'Set' button. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
"['envform'].elements['".$parameter."_setparmval']". |
"['envform'].elements['".$parameter."_setparmval']". |
'.checked=true;"'; |
'.checked=true;"'; |
$output .= '<tr><td>'.$description.'</td>'; |
$output .= &Apache::loncommon::start_data_table_row(). |
|
'<td>'.$description.'</td>'; |
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
if ($parameter =~ /^default_enrollment_(start|end)_date$/) { |
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::date_setter('envform', |
&Apache::lonhtmlcommon::date_setter('envform', |
Line 2256 sub crsenv {
|
Line 2281 sub crsenv {
|
$output .= '<td>'. |
$output .= '<td>'. |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval'). |
'</td>'; |
'</td>'; |
$output .= "</tr>\n"; |
$output .= &Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
my $onchange = 'onFocus="javascript:window.document.forms'. |
my $onchange = 'onFocus="javascript:window.document.forms'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'[\'envform\'].elements[\'newp_setparmval\']'. |
'.checked=true;"'; |
'.checked=true;"'; |
$output.='<tr><td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
$output.=&Apache::loncommon::start_data_table_row(). |
|
'<td><i>'.&mt('Create New Environment Variable').'</i><br />'. |
'<input type="text" size=40 name="newp_name" '. |
'<input type="text" size=40 name="newp_name" '. |
$onchange.' /></td><td>'. |
$onchange.' /></td><td>'. |
'<input type="text" size=40 name="newp_value" '. |
'<input type="text" size=40 name="newp_value" '. |
$onchange.' /></td><td>'. |
$onchange.' /></td><td>'. |
'<input type="checkbox" name="newp_setparmval" /></td></tr>'; |
'<input type="checkbox" name="newp_setparmval" /></td>'. |
|
&Apache::loncommon::end_data_table_row()."\n"; |
} |
} |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'par' => 'Parameter', |
'par' => 'Parameter', |
Line 2284 sub crsenv {
|
Line 2311 sub crsenv {
|
'</script>'; |
'</script>'; |
|
|
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set Course Environment Parameters', |
&Apache::loncommon::start_page('Set Course Environment', |
$browse_js); |
$browse_js); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
|
my $end_table=&Apache::loncommon::end_data_table(); |
$r->print(<<ENDENV); |
$r->print(<<ENDENV); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
<form method="post" action="/adm/parmset?action=crsenv" name="envform"> |
$setoutput |
$setoutput |
<p> |
$start_table |
<table border=2> |
$start_header_row |
<tr><th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th></tr> |
<th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th> |
|
$end_header_row |
$output |
$output |
</table> |
$end_table |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
<input type="submit" name="crsenv" value="$lt{'sce'}"> |
</form> |
</form> |
$end_page |
$end_page |
Line 2335 sub readdata {
|
Line 2364 sub readdata {
|
|
|
my $classlist=&Apache::loncoursedata::get_classlist(); |
my $classlist=&Apache::loncoursedata::get_classlist(); |
foreach (keys %$classlist) { |
foreach (keys %$classlist) { |
# the following undefs are for 'domain', and 'username' respectively. |
if ($_=~/^($match_username)\:($match_domain)$/) { |
if ($_=~/^(\w+)\:(\w+)$/) { |
|
my ($tuname,$tudom)=($1,$2); |
my ($tuname,$tudom)=($1,$2); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom); |
foreach my $userkey (keys %{$useropt}) { |
foreach my $userkey (keys %{$useropt}) { |
Line 2384 sub storedata {
|
Line 2412 sub storedata {
|
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
$r->print('<br />'.&mt('Stored modified parameter for').' '. |
&Apache::loncommon::plainname($tuname,$tudom)); |
&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2399 sub storedata {
|
Line 2427 sub storedata {
|
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
&log_parmset({$tkey=>''},1,$tuname,$tudom); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</font></h2>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
push (@deldata,$thiskey); |
push (@deldata,$thiskey,$thiskey.'.type'); |
} |
} |
} elsif ($cmd eq 'datepointer') { |
} elsif ($cmd eq 'datepointer') { |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
my $data=&Apache::lonhtmlcommon::get_date_from_form($env{$_}); |
Line 2417 sub storedata {
|
Line 2445 sub storedata {
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
$r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
&Apache::lonnet::devalidateuserresdata($tuname,$tudom); |
} else { |
} else { |
Line 2439 sub storedata {
|
Line 2467 sub storedata {
|
&log_parmset(\%loghash,1); |
&log_parmset(\%loghash,1); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
$r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries)); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error deleting parameters').'</font></h2>'); |
&mt('Error deleting parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
Line 2449 sub storedata {
|
Line 2477 sub storedata {
|
&log_parmset(\%newdata,0); |
&log_parmset(\%newdata,0); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
$r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>'); |
} else { |
} else { |
$r->print('<h2><font color="red">'. |
$r->print('<div class="LC_error">'. |
&mt('Error storing parameters').'</font></h2>'); |
&mt('Error storing parameters').'</div>'); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
&Apache::lonnet::devalidatecourseresdata($crs,$dom); |
} |
} |
Line 2458 sub storedata {
|
Line 2486 sub storedata {
|
|
|
sub extractuser { |
sub extractuser { |
my $key=shift; |
my $key=shift; |
return ($key=~/^$env{'request.course.id'}.\[useropt\:(\w+)\:(\w+)\]\./); |
return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./); |
} |
} |
|
|
sub listdata { |
sub listdata { |
Line 2516 sub listdata {
|
Line 2544 sub listdata {
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
my $issection=$1; |
my $issection=$1; |
if ($issection=~/^useropt\:(\w+)\:(\w+)/) { |
if ($issection=~/^useropt\:($match_username)\:($match_domain)/) { |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2); |
} else { |
} else { |
$section=&mt('Group/Section').': '.$issection; |
$section=&mt('Group/Section').': '.$issection; |
Line 2525 sub listdata {
|
Line 2553 sub listdata {
|
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>'; |
} elsif ($middle) { |
} elsif ($middle) { |
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='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
} |
} |
if ($sortorder eq 'realmstudent') { |
if ($sortorder eq 'realmstudent') { |
if ($realm ne $oldrealm) { |
if ($realm ne $oldrealm) { |
Line 2557 sub listdata {
|
Line 2585 sub listdata {
|
} |
} |
if ($part ne $oldpart) { |
if ($part ne $oldpart) { |
$r->print(&tableend(). |
$r->print(&tableend(). |
"\n<font color='blue'>".&mt('Part').": $part</font>"); |
"\n<span class=\"LC_parm_part\">".&mt('Part').": $part</span>"); |
$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(). |
$r->print(&tablestart(). |
Line 2585 sub listdata {
|
Line 2604 sub listdata {
|
&Apache::lonhtmlcommon::date_setter('parmform', |
&Apache::lonhtmlcommon::date_setter('parmform', |
$jskey, |
$jskey, |
$$resourcedata{$thiskey}, |
$$resourcedata{$thiskey}, |
'',1,'','',$hour,$min,$sec). |
'',1,'',''). |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
'<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'. |
&date_sanity_info($$resourcedata{$thiskey}) |
&date_sanity_info($$resourcedata{$thiskey}) |
); |
); |
Line 2593 sub listdata {
|
Line 2612 sub listdata {
|
my $showval; |
my $showval; |
if (defined($$resourcedata{$thiskey})) { |
if (defined($$resourcedata{$thiskey})) { |
$showval=$$resourcedata{$thiskey}; |
$showval=$$resourcedata{$thiskey}; |
} else { |
|
$showval=$val; |
|
} |
} |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
$r->print('<label><input type="radio" name="set_'.$thiskey. |
'" value="yes"'); |
'" value="yes"'); |
Line 2612 sub listdata {
|
Line 2629 sub listdata {
|
my $showval; |
my $showval; |
if (defined($$resourcedata{$thiskey})) { |
if (defined($$resourcedata{$thiskey})) { |
$showval=$$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="'. |
$showval.'">'); |
$showval.'">'); |
Line 2690 ENDOVER
|
Line 2705 ENDOVER
|
|
|
# Menu to select levels, etc |
# Menu to select levels, etc |
|
|
$r->print('<table border="1"><tr><td>'); |
$r->print('<table id="LC_parm_overview_scope"> |
|
<tr><td class="LC_parm_overview_level_menu">'); |
&levelmenu($r,\%alllevs,$parmlev); |
&levelmenu($r,\%alllevs,$parmlev); |
if ($parmlev ne 'general') { |
if ($parmlev ne 'general') { |
$r->print('<td>'); |
$r->print('<td class="LC_parm_overview_map_menu">'); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
&mapmenu($r,\%allmaps,$pschp,\%maptitles); |
$r->print('</td>'); |
$r->print('</td>'); |
} |
} |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
|
|
$r->print('<table border="1"><tr><td>'); |
$r->print('<table id="LC_parm_overview_controls"> |
|
<tr><td class="LC_parm_overview_parm_selectors">'); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
&parmmenu($r,\%allparms,\@pscat,\%keyorder); |
$r->print('</td><td><table border="0" cellspacing="0" cellpadding="0">'. |
$r->print('</td><td class="LC_parm_overview_restrictions"> |
'<tr><td>'.&mt('Parts').'</td><td></td><td>'.&mt('Section(s)'). |
<table class="LC_parm_overview_restrictions">'. |
'</td><td></td><td>'.&mt('Group(s)').'</td></tr><tr><td>'); |
'<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)'). |
|
'</th><th>'.&mt('Group(s)').'</th></tr><tr><td>'); |
&partmenu($r,\%allparts,\@psprt); |
&partmenu($r,\%allparts,\@psprt); |
$r->print('</td><td> </td><td>'); |
$r->print('</td><td>'); |
§ionmenu($r,\@selected_sections); |
§ionmenu($r,\@selected_sections); |
$r->print('</td><td> </td><td>'); |
$r->print('</td><td>'); |
&groupmenu($r,\@selected_groups); |
&groupmenu($r,\@selected_groups); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
$r->print('</td></tr></table>'); |
Line 2814 ENDOVER
|
Line 2832 ENDOVER
|
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub clean_parameters { |
|
my ($r) = @_; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
|
my $start_page=&Apache::loncommon::start_page('Clean Parameters'); |
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Clean'); |
|
$r->print(<<ENDOVER); |
|
$start_page |
|
$breadcrumbs |
|
<form method="post" action="/adm/parmset?action=cleanparameters" name="parmform"> |
|
ENDOVER |
|
# Store modified |
|
|
|
&storedata($r,$crs,$dom); |
|
|
|
# Read modified data |
|
|
|
my $resourcedata=&readdata($crs,$dom); |
|
|
|
# List data |
|
|
|
$r->print('<h3>'. |
|
&mt('These parameters refer to resources that do not exist.'). |
|
'</h3>'. |
|
'<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'.'<br />'. |
|
'<br />'); |
|
$r->print(&Apache::loncommon::start_data_table(). |
|
'<tr>'. |
|
'<th>'.&mt('Delete').'</th>'. |
|
'<th>'.&mt('Parameter').'</th>'. |
|
'</tr>'); |
|
foreach my $thiskey (sort(keys(%{$resourcedata}))) { |
|
next if (!exists($resourcedata->{$thiskey.'.type'}) |
|
&& $thiskey=~/\.type$/); |
|
my %data = &parse_key($thiskey); |
|
if (exists($data{'realm_exists'}) |
|
&& !$data{'realm_exists'}) { |
|
$r->print(&Apache::loncommon::start_data_table_row(). |
|
'<tr>'. |
|
'<td><input type="checkbox" name="del_'.$thiskey.'" /></td>' ); |
|
|
|
$r->print('<td>'); |
|
$r->print(&mt('Parameter: "[_1]" with value: "[_2]"', |
|
&standard_parameter_names($data{'parameter_name'}), |
|
$resourcedata->{$thiskey})); |
|
$r->print('<br />'); |
|
if ($data{'scope_type'} eq 'all') { |
|
$r->print(&mt('All users')); |
|
} elsif ($data{'scope_type'} eq 'user') { |
|
$r->print(&mt('User: [_1]',join(':',@{$data{'scope'}}))); |
|
} elsif ($data{'scope_type'} eq 'section') { |
|
$r->print(&mt('Section: [_1]',$data{'scope'})); |
|
} elsif ($data{'scope_type'} eq 'group') { |
|
$r->print(&mt('Group: [_1]',$data{'scope'})); |
|
} |
|
$r->print('<br />'); |
|
if ($data{'realm_type'} eq 'all') { |
|
$r->print(&mt('All Resources')); |
|
} elsif ($data{'realm_type'} eq 'folder') { |
|
$r->print(&mt('Folder: [_1]'),$data{'realm'}); |
|
} elsif ($data{'realm_type'} eq 'symb') { |
|
my ($map,$resid,$url) = |
|
&Apache::lonnet::decode_symb($data{'realm'}); |
|
$r->print(&mt('Resource: [_1] <br /> with ID: [_2] <br /> in folder [_3]', |
|
$url,$resid,$map)); |
|
} |
|
$r->print(&mt('Part: [_1]',$data{'parameter_part'})); |
|
$r->print('</td></tr>'); |
|
|
|
} |
|
} |
|
$r->print(&Apache::loncommon::end_data_table().'<p>'. |
|
'<input type="submit" value="'.&mt('Delete Checked Parameters').'" />'. |
|
'</p></form>'. |
|
&Apache::loncommon::end_page()); |
|
} |
|
|
|
sub parse_key { |
|
my ($key) = @_; |
|
my %data; |
|
my ($middle,$part,$name)= |
|
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
$data{'scope_type'} = 'all'; |
|
if ($middle=~/^\[(.*)\]/) { |
|
$data{'scope'} = $1; |
|
if ($data{'scope'}=~/^useropt\:($match_username)\:($match_domain)/) { |
|
$data{'scope_type'} = 'user'; |
|
$data{'scope'} = [$1,$2]; |
|
} else { |
|
#FIXME check for group scope |
|
$data{'scope_type'} = 'section'; |
|
} |
|
$middle=~s/^\[(.*)\]//; |
|
} |
|
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
|
$data{'realm_type'}='all'; |
|
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
|
$data{'realm'} = $1; |
|
$data{'realm_type'} = 'folder'; |
|
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
|
($data{'realm_exists'}) = &Apache::lonnet::is_on_map($data{'realm'}); |
|
&Apache::lonnet::logthis($1." siad ". $data{'realm_exists'} ); |
|
} elsif ($middle) { |
|
$data{'realm'} = $middle; |
|
$data{'realm_type'} = 'symb'; |
|
$data{'realm_title'} = &Apache::lonnet::gettitle($data{'realm'}); |
|
my ($map,$resid,$url) = &Apache::lonnet::decode_symb($data{'realm'}); |
|
$data{'realm_exists'} = &Apache::lonnet::symbverify($data{'realm'},$url); |
|
} |
|
|
|
$data{'parameter_part'} = $part; |
|
$data{'parameter_name'} = $name; |
|
|
|
return %data; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
=pod |
=pod |
|
|
=item check_cloners |
=item check_cloners |
Line 2977 ENDMAINFORMHEAD
|
Line 3113 ENDMAINFORMHEAD
|
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
my $vgr = &Apache::lonnet::allowed('vgr',$env{'request.course.id'}); |
|
|
my @menu = |
my @menu = |
( |
( { divider=>'Settings for Your Course', |
{ text => 'Set Course Environment Parameters', |
}, |
|
{ text => 'Set Course Environment', |
action => 'crsenv', |
action => 'crsenv', |
permission => $parm_permission, |
permission => $parm_permission, |
|
help => 'Course_Environment', |
}, |
}, |
{ text => 'Set Portfolio Metadata', |
{ text => 'Set Portfolio Metadata', |
action => 'setrestrictmeta', |
action => 'setrestrictmeta', |
Line 2990 ENDMAINFORMHEAD
|
Line 3128 ENDMAINFORMHEAD
|
url => '/adm/slotrequest?command=showslots', |
url => '/adm/slotrequest?command=showslots', |
permission => $vgr, |
permission => $vgr, |
}, |
}, |
{ divider => 1, |
{ text => 'Set Parameter Setting Default Actions', |
|
action => 'setdefaults', |
|
permission => $parm_permission, |
|
}, |
|
{ divider => 'New and Existing Parameter Settings for Your Resources', |
}, |
}, |
{ text => 'Set/Modify Resource 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, |
|
help => 'Parameter_Helper', |
}, |
}, |
{ text => 'Modify Resource Parameters - Overview Mode', |
{ text => 'Set/Modify Resource Parameters - Overview Mode', |
action => 'setoverview', |
|
permission => $parm_permission, |
|
}, |
|
{ text => 'Set Resource Parameters - Overview Mode', |
|
action => 'newoverview', |
action => 'newoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
|
help => 'Parameter_Overview', |
}, |
}, |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
{ text => 'Set/Modify Resource Parameters - Table Mode', |
action => 'settable', |
action => 'settable', |
permission => $parm_permission, |
permission => $parm_permission, |
help => 'Cascading_Parameters', |
help => 'Table_Mode', |
}, |
}, |
{ text => 'Set Parameter Setting Default Actions', |
{ divider => 'Existing Parameter Settings for Your Resources', |
action => 'setdefaults', |
}, |
|
{ text => 'Modify Resource Parameters - Overview Mode', |
|
action => 'setoverview', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
help => 'Parameter_Overview', |
|
}, |
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
action => 'parameterchangelog', |
action => 'parameterchangelog', |
permission => $parm_permission, |
permission => $parm_permission, |
Line 3021 ENDMAINFORMHEAD
|
Line 3164 ENDMAINFORMHEAD
|
my $menu_html = ''; |
my $menu_html = ''; |
foreach my $menu_item (@menu) { |
foreach my $menu_item (@menu) { |
if ($menu_item->{'divider'}) { |
if ($menu_item->{'divider'}) { |
$menu_html .= '<hr />'; |
$menu_html .= '<h3>'.&mt($menu_item->{'divider'}).'</h3>'; |
next; |
next; |
} |
} |
next if (! $menu_item->{'permission'}); |
next if (! $menu_item->{'permission'}); |
$menu_html.='<p>'; |
$menu_html.='<p>'; |
$menu_html.='<font size="+1">'; |
$menu_html.='<span class="LC_parm_menu_item">'; |
if (exists($menu_item->{'url'})) { |
if (exists($menu_item->{'url'})) { |
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
$menu_html.=qq{<a href="$menu_item->{'url'}">}; |
} else { |
} else { |
$menu_html.= |
$menu_html.= |
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
qq{<a href="/adm/parmset?action=$menu_item->{'action'}">}; |
} |
} |
$menu_html.= &mt($menu_item->{'text'}).'</a></font>'; |
$menu_html.= &mt($menu_item->{'text'}).'</a></span>'; |
if (exists($menu_item->{'help'})) { |
if (exists($menu_item->{'help'})) { |
$menu_html.= |
$menu_html.= |
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
&Apache::loncommon::help_open_topic($menu_item->{'help'}); |
Line 3045 ENDMAINFORMHEAD
|
Line 3188 ENDMAINFORMHEAD
|
} |
} |
### Set portfolio metadata |
### Set portfolio metadata |
sub output_row { |
sub output_row { |
my ($r, $field_name, $field_text) = @_; |
my ($r, $field_name, $field_text, $added_flag) = @_; |
|
my $row_class; |
my $output; |
my $output; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $options=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
my $values=$env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.values'}; |
unless (defined($options)) { |
if (!defined($options)) { |
$options = 'active,stuadd'; |
$options = 'active,stuadd'; |
$values = ''; |
$values = ''; |
} |
} |
$output.='<strong>'.$field_text.':</strong>'; |
if (!($options =~ /deleted/)) { |
$output.='<input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /><br />'; |
$output = &Apache::loncommon::start_data_table_row(); |
|
$output .= '<td><span class="LC_metadata"><strong>'.$field_text.':</strong></span></td>'; |
my @options= ( ['active', 'Show to student'], |
# $output .= '<td><strong>'.$field_text.':</strong></td>'; |
|
$output .= '<td><span class="LC_metadata"><input name="'.$field_name.'_values" type="text" value="'.$values.'" size="80" /></span></td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
my @options= ( ['active', 'Show to student'], |
['onlyone','Student may select only one choice'], |
['onlyone','Student may select only one choice'], |
['stuadd', 'Student may type choices']); |
['stuadd', 'Student may type choices']); |
foreach my $opt (@options) { |
if ($added_flag) { |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
push @options,['deleted', 'Delete Metadata Field']; |
$output.=(' 'x5).'<label><input type="checkbox" name="'. |
} |
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
foreach my $opt (@options) { |
&mt($opt->[1]).'</label> <br />'; |
my $checked = ($options =~ m/$opt->[0]/) ? ' checked="checked" ' : '' ; |
|
$output .= &Apache::loncommon::continue_data_table_row(); |
|
$output .= '<td colspan="2">'.(' ' x 5).'<span class="LC_metadata"><label><input type="checkbox" name="'. |
|
$field_name.'_'.$opt->[0].'" value="yes"'.$checked.' />'. |
|
&mt($opt->[1]).'</label></span> </td>'; |
|
$output .= &Apache::loncommon::end_data_table_row(); |
|
} |
|
|
} |
} |
return ($output); |
return ($output); |
} |
} |
|
sub order_meta_fields { |
|
my ($r)=@_; |
|
my $idx = 1; |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
$r->print(&Apache::loncommon::start_page('Order Metadata Fields')); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>"/adm/parmset?action=setrestrictmeta", |
|
text=>"Restrict Metadata"}, |
|
{text=>"Order Metadata"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Order Metadata')); |
|
if ($env{'form.storeorder'}) { |
|
my $newpos = $env{'form.newpos'} - 1; |
|
my $currentpos = $env{'form.currentpos'} - 1; |
|
my @neworder = (); |
|
my @oldorder = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
|
my $i; |
|
if ($newpos > $currentpos) { |
|
# moving stuff up |
|
for ($i=0;$i<$currentpos;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
for ($i=$currentpos;$i<$newpos;$i++) { |
|
$neworder[$i]=$oldorder[$i+1]; |
|
} |
|
$neworder[$newpos]=$oldorder[$currentpos]; |
|
for ($i=$newpos+1;$i<=$#oldorder;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
} else { |
|
# moving stuff down |
|
for ($i=0;$i<$newpos;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
$neworder[$newpos]=$oldorder[$currentpos]; |
|
for ($i=$newpos+1;$i<$currentpos+1;$i++) { |
|
$neworder[$i]=$oldorder[$i-1]; |
|
} |
|
for ($i=$currentpos+1;$i<=$#oldorder;$i++) { |
|
$neworder[$i]=$oldorder[$i]; |
|
} |
|
} |
|
my $ordered_fields = join ",", @neworder; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
|
&Apache::lonnet::appenv('course.'.$env{'request.course.id'}.'.metadata.addedorder' => $ordered_fields); |
|
} |
|
my $fields = &get_added_meta_fieldnames(); |
|
my $ordered_fields; |
|
my @fields_in_order = split /,/,$env{'course.'.$env{'request.course.id'}.'.metadata.addedorder'}; |
|
if (!@fields_in_order) { |
|
# no order found, pick sorted order then create metadata.addedorder key. |
|
foreach my $key (sort keys %$fields) { |
|
push @fields_in_order, $key; |
|
$ordered_fields = join ",", @fields_in_order; |
|
} |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.addedorder'=>$ordered_fields},$dom,$crs); |
|
} |
|
$r->print('<table>'); |
|
my $num_fields = scalar(@fields_in_order); |
|
foreach my $key (@fields_in_order) { |
|
$r->print('<tr><td>'); |
|
$r->print('<form method="post" action="">'); |
|
$r->print('<select name="newpos" onChange="this.form.submit()">'); |
|
for (my $i = 1;$i le $num_fields;$i ++) { |
|
if ($i eq $idx) { |
|
$r->print('<option value="'.$i.'" SELECTED>('.$i.')</option>'); |
|
} else { |
|
$r->print('<option value="'.$i.'">'.$i.'</option>'); |
|
} |
|
} |
|
$r->print('</select></td><td>'); |
|
$r->print('<input type="hidden" name="currentpos" value="'.$idx.'" />'); |
|
$r->print('<input type="hidden" name="storeorder" value="true" />'); |
|
$r->print('</form>'); |
|
$r->print($$fields{$key}.'</td></tr>'); |
|
$idx ++; |
|
} |
|
$r->print('</table>'); |
|
return 'ok'; |
|
} |
|
sub continue { |
|
my $output; |
|
$output .= '<form action="" method="post">'; |
|
$output .= '<input type="hidden" name="action" value="setrestrictmeta" />'; |
|
$output .= '<input type="submit" value="Continue" />'; |
|
return ($output); |
|
} |
|
sub addmetafield { |
|
my ($r)=@_; |
|
$r->print(&Apache::loncommon::start_page('Add Metadata Field')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Add Metadata Field')); |
|
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
if (exists($env{'form.undelete'})) { |
|
my @meta_fields = &Apache::loncommon::get_env_multiple('form.undeletefield'); |
|
foreach my $meta_field(@meta_fields) { |
|
my $options = $env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.options'}; |
|
$options =~ s/deleted//; |
|
$options =~ s/,,/,/; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.options'=>$options},$dom,$crs); |
|
|
|
$r->print('Undeleted Metadata Field <strong>'.$env{'course.'.$env{'request.course.id'}.'.metadata.'.$meta_field.'.added'}."</strong> with result ".$put_result.'<br />'); |
|
} |
|
$r->print(&continue()); |
|
} elsif (exists($env{'form.fieldname'})) { |
|
my $meta_field = $env{'form.fieldname'}; |
|
my $display_field = $env{'form.fieldname'}; |
|
$meta_field =~ s/\W/_/g; |
|
$meta_field =~ tr/A-Z/a-z/; |
|
my $put_result = &Apache::lonnet::put('environment', |
|
{'metadata.'.$meta_field.'.values'=>"", |
|
'metadata.'.$meta_field.'.added'=>"$display_field", |
|
'metadata.'.$meta_field.'.options'=>""},$dom,$crs); |
|
$r->print('Added new Metadata Field <strong>'.$env{'form.fieldname'}."</strong> with result ".$put_result.'<br />'); |
|
$r->print(&continue()); |
|
} else { |
|
my $fields = &get_deleted_meta_fieldnames(); |
|
if ($fields) { |
|
$r->print('You may undelete previously deleted fields.<br />Check those you wish to undelete and click Undelete.<br />'); |
|
$r->print('<form method="post" action="">'); |
|
foreach my $key(keys(%$fields)) { |
|
$r->print('<input type="checkbox" name="undeletefield" value="'.$key.'" />'.$$fields{$key}.'<br /'); |
|
} |
|
$r->print('<input type="submit" name="undelete" value="Undelete" />'); |
|
$r->print('</form>'); |
|
} |
|
$r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); |
|
$r->print('<input type="text" name="fieldname" /><br />'); |
|
$r->print('<input type="submit" value="Add Metadata Field" />'); |
|
$r->print('</form>'); |
|
} |
|
} |
sub setrestrictmeta { |
sub setrestrictmeta { |
my ($r)=@_; |
my ($r)=@_; |
my $next_meta; |
my $next_meta; |
my $output; |
my $output; |
my $item_num; |
my $item_num; |
my $put_result; |
my $put_result; |
|
|
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::loncommon::start_page('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 3098 sub setrestrictmeta {
|
Line 3385 sub setrestrictmeta {
|
if ($env{'form.'.$meta_field.'_active'}) { |
if ($env{'form.'.$meta_field.'_active'}) { |
$options.='active,'; |
$options.='active,'; |
} |
} |
|
if ($env{'form.'.$meta_field.'_deleted'}) { |
|
$options.='deleted,'; |
|
} |
|
|
my $name = $save_field; |
my $name = $save_field; |
$put_result = &Apache::lonnet::put('environment', |
$put_result = &Apache::lonnet::put('environment', |
{'metadata.'.$meta_field.'.options'=>$options, |
{'metadata.'.$meta_field.'.options'=>$options, |
Line 3109 sub setrestrictmeta {
|
Line 3400 sub setrestrictmeta {
|
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
{'freshen_cache' => 1}); |
{'freshen_cache' => 1}); |
|
# Get the default metadata fields |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
|
# Now get possible added metadata fields |
|
my $added_metadata_fields = &get_added_meta_fieldnames(\%metadata_fields); |
|
my $row_alt = 1; |
|
$output .= &Apache::loncommon::start_data_table(); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
&Apache::lonnet::logthis ($field); |
|
if ($field ne 'courserestricted') { |
if ($field ne 'courserestricted') { |
|
$row_alt = $row_alt ? 0 : 1; |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
$output.= &output_row($r, $field, $metadata_fields{$field}); |
} |
} |
} |
} |
|
my $added_flag = 1; |
|
foreach my $field (sort(keys(%$added_metadata_fields))) { |
|
$row_alt = $row_alt ? 0 : 1; |
|
$output.= &output_row($r, $field, $$added_metadata_fields{$field},$added_flag, $row_alt); |
|
} |
|
$output .= &Apache::loncommon::end_data_table(); |
$r->print(<<ENDenv); |
$r->print(<<ENDenv); |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<form method="post" action="/adm/parmset?action=setrestrictmeta" name="form"> |
<p> |
|
$output |
$output |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions"> |
<input type="submit" name="restrictmeta" value="Update Metadata Restrictions" /> |
|
</form><br /> |
|
<form method="post" action="/adm/parmset?action=addmetadata" name="form1"> |
|
<input type="submit" name="restrictmeta" value="Add a Metadata Field" /> |
|
</form> |
|
<br /> |
|
<form method="post" action="/adm/parmset?action=ordermetadata" name="form2"> |
|
<input type="submit" name="restrictmeta" value="Order Metadata Fields" /> |
</form> |
</form> |
ENDenv |
ENDenv |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return 'ok'; |
return 'ok'; |
} |
} |
################################################## |
################################################## |
|
sub get_added_meta_fieldnames { |
|
my %fields; |
|
foreach my $key(%env) { |
|
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
|
my $field_name = $1; |
|
my ($display_field_name) = $env{$key}; |
|
$fields{$field_name} = $display_field_name; |
|
} |
|
} |
|
return \%fields; |
|
} |
|
sub get_deleted_meta_fieldnames { |
|
my %fields; |
|
my ($default_fields) = @_; |
|
foreach my $key(%env) { |
|
if ($key =~ m/\.metadata\.(.+)\.added$/) { |
|
my $field_name = $1; |
|
if ($env{'course.'.$env{'request.course.id'}.'.metadata.'.$field_name.'.options'} =~ m/deleted/) { |
|
my ($display_field_name) = $env{$key}; |
|
$fields{$field_name} = $display_field_name; |
|
} |
|
} |
|
} |
|
return \%fields; |
|
} |
sub defaultsetter { |
sub defaultsetter { |
my ($r) = @_; |
my ($r) = @_; |
|
|
Line 3222 ENDDEFHEAD
|
Line 3554 ENDDEFHEAD
|
} |
} |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
$r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'. |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
&mt('Automatic setting rules apply to table mode interfaces only.')); |
$r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'. |
$r->print("\n".&Apache::loncommon::start_data_table(). |
&mt('Action').'</th><th>'.&mt('Value').'</th></tr>'); |
&Apache::loncommon::start_data_table_header_row(). |
|
"<th>".&mt('Rule for parameter').'</th><th>'. |
|
&mt('Action').'</th><th>'.&mt('Value').'</th>'. |
|
&Apache::loncommon::end_data_table_header_row()); |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) { |
unless ($tempkey) { next; } |
unless ($tempkey) { next; } |
$r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
$r->print("\n".&Apache::loncommon::start_data_table_row(). |
|
"<td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>'); |
my $action=&rulescache($tempkey.'_action'); |
my $action=&rulescache($tempkey.'_action'); |
$r->print('<select name="'.$tempkey.'_action">'); |
$r->print('<select name="'.$tempkey.'_action">'); |
if (&isdateparm($defkeytype{$tempkey})) { |
if (&isdateparm($defkeytype{$tempkey})) { |
Line 3275 ENDYESNO
|
Line 3611 ENDYESNO
|
} else { |
} else { |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
$r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />'); |
} |
} |
$r->print('</td></tr>'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
$r->print("</table>\n<input type='submit' name='storerules' value='". |
$r->print(&Apache::loncommon::end_data_table(). |
|
"\n<input type='submit' name='storerules' value='". |
&mt('Store Rules')."' /></form>\n". |
&mt('Store Rules')."' /></form>\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
sub components { |
sub components { |
my ($key,$uname,$udom,$exeuser,$exedomain)=@_; |
my ($key,$uname,$udom,$exeuser,$exedomain,$typeflag)=@_; |
my $typeflag=0; |
|
if ($key=~/\.type$/) { |
if ($typeflag) { |
$key=~s/\.type$//; |
$key=~s/\.type$//; |
$typeflag=1; |
|
} |
} |
|
|
|
my ($middle,$part,$name)= |
|
($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my $issection; |
my $issection; |
my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
|
my $section=&mt('All Students'); |
my $section=&mt('All Students'); |
if ($middle=~/^\[(.*)\]/) { |
if ($middle=~/^\[(.*)\]/) { |
$issection=$1; |
$issection=$1; |
Line 3304 sub components {
|
Line 3643 sub components {
|
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
$issection=''; |
$issection=''; |
} |
} |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>'; |
|
my $realmdescription=&mt('all resources'); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
$realm='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>'; |
} elsif ($middle) { |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
|
} elsif ($middle) { |
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='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>'; |
|
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
} |
} |
my $what=$part.'.'.$name; |
my $what=$part.'.'.$name; |
return ($realm,$section,$name,$part,$typeflag, |
return ($realm,$section,$name,$part, |
$what,$middle,$uname,$udom,$issection); |
$what,$middle,$uname,$udom,$issection,$realmdescription); |
|
} |
|
|
|
my %standard_parms; |
|
sub load_parameter_names { |
|
open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab"); |
|
while (my $configline=<$config>) { |
|
if ($configline !~ /\S/ || $configline=~/^\#/) { next; } |
|
chomp($configline); |
|
my ($short,$plain)=split(/:/,$configline); |
|
my (undef,$name,$type)=split(/\&/,$short,3); |
|
if ($type eq 'display') { |
|
$standard_parms{$name} = $plain; |
|
} |
|
} |
|
close($config); |
|
$standard_parms{'int_pos'} = 'Positive Integer'; |
|
$standard_parms{'int_zero_pos'} = 'Positive Integer or Zero'; |
|
%standard_parms=&Apache::lonlocal::texthash(%standard_parms); |
} |
} |
|
|
sub standard_parameter_names { |
sub standard_parameter_names { |
my ($name)=@_; |
my ($name)=@_; |
my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date', |
if (!%standard_parms) { |
'answerdate' => 'Answer Date', |
&load_parameter_names(); |
'opendate' => 'Open Date', |
} |
'maxtries' => 'Max. Number of Tries', |
|
'weight' => 'Weight', |
|
'date_start' => 'Starting Date', |
|
'date_end' => 'Ending Date', |
|
'int_pos' => 'Positive Integer', |
|
'int_zero_pos' => 'Positive Integer or Zero', |
|
'hinttries' => 'Number of Tries till Hints appear'); |
|
if ($standard_parms{$name}) { |
if ($standard_parms{$name}) { |
return $standard_parms{$name}; |
return $standard_parms{$name}; |
} else { |
} else { |
Line 3335 sub standard_parameter_names {
|
Line 3688 sub standard_parameter_names {
|
} |
} |
} |
} |
|
|
|
# |
|
# Parameter Change Log |
|
# |
|
|
|
|
sub parm_change_log { |
sub parm_change_log { |
my ($r)=@_; |
my ($r)=@_; |
&startpage($r); |
$r->print(&Apache::loncommon::start_page('Parameter Change Log')); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Change Log')); |
|
|
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
my %parmlog=&Apache::lonnet::dump('nohist_parameterlog', |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
|
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
|
|
|
$r->print('<form action="/adm/parmset?action=parameterchangelog" |
|
method="post" name="parameterlog">'); |
|
|
|
my %saveable_parameters = ('show' => 'scalar',); |
|
&Apache::loncommon::store_course_settings('parameter_log', |
|
\%saveable_parameters); |
|
&Apache::loncommon::restore_course_settings('parameter_log', |
|
\%saveable_parameters); |
|
$r->print(&Apache::loncommon::display_filter(). |
|
'<label>'.&Apache::lonhtmlcommon::checkbox('includetypes',$env{'form.includetypes'},'1'). |
|
' '.&mt('Include parameter types').'</label>'. |
|
'<input type="submit" value="'.&mt('Display').'" /></form>'); |
|
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
&Apache::loncommon::end_data_table_header_row()); |
&Apache::loncommon::end_data_table_header_row()); |
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
my $shown=0; |
|
my $folder=''; |
|
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
my $last=''; |
|
if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db', |
|
&GDBM_READER(),0640)) { |
|
$last=$hash{'last_known'}; |
|
untie(%hash); |
|
} |
|
if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); } |
|
} |
|
foreach my $id (sort |
|
{ |
|
if ($parmlog{$b}{'exe_time'} ne $parmlog{$a}{'exe_time'}) { |
|
return $parmlog{$b}{'exe_time'} <=>$parmlog{$a}{'exe_time'} |
|
} |
|
my $aid = (split('00000',$a))[-1]; |
|
my $bid = (split('00000',$b))[-1]; |
|
return $bid<=>$aid; |
|
} (keys(%parmlog))) { |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
my $count=$#changes+1; |
my $count = 0; |
my $time = |
my $time = |
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
my $plainname = |
my $plainname = |
Line 3370 sub parm_change_log {
|
Line 3763 sub parm_change_log {
|
$parmlog{$id}{'exe_udom'}); |
$parmlog{$id}{'exe_udom'}); |
} |
} |
my $row_start=&Apache::loncommon::start_data_table_row(); |
my $row_start=&Apache::loncommon::start_data_table_row(); |
$r->print($row_start.'<td rowspan="'.$count.'">'.$time.'</td> |
|
<td rowspan="'.$count.'">'.$about_me_link. |
|
'<br /><tt>'.$parmlog{$id}{'exe_uname'}. |
|
':'.$parmlog{$id}{'exe_udom'}.'</tt>'. |
|
$send_msg_link.'</td>'); |
|
my $makenewrow=0; |
my $makenewrow=0; |
my %istype=(); |
my %istype=(); |
|
my $output; |
foreach my $changed (reverse(sort(@changes))) { |
foreach my $changed (reverse(sort(@changes))) { |
my $value=$parmlog{$id}{'logentry'}->{$changed}; |
my $value=$parmlog{$id}{'logentry'}{$changed}; |
my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)= |
my $typeflag = ($changed =~/\.type$/ && |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'}); |
!exists($parmlog{$id}{'logentry'}{$changed.'.type'})); |
if ($typeflag) { $istype{$parmname}=$value; } |
my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
if ($makenewrow) { $r->print($row_start); } else { $makenewrow=1; } |
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag); |
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
if ($env{'form.displayfilter'} eq 'currentfolder') { |
|
if ($folder) { |
|
if ($middle!~/^\Q$folder\E/) { next; } |
|
} |
|
} |
|
if ($typeflag) { |
|
$istype{$parmname}=$value; |
|
if (!$env{'form.includetypes'}) { next; } |
|
} |
|
$count++; |
|
if ($makenewrow) { |
|
$output .= $row_start; |
|
} else { |
|
$makenewrow=1; |
|
} |
|
$output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
&standard_parameter_names($parmname).'</td><td>'. |
&standard_parameter_names($parmname).'</td><td>'. |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'); |
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'; |
my $stillactive=0; |
my $stillactive=0; |
if ($parmlog{$id}{'deleteflag'}) { |
if ($parmlog{$id}{'delflag'}) { |
$r->print(&mt('Deleted')); |
$output .= &mt('Deleted'); |
} else { |
} else { |
if ($typeflag) { |
if ($typeflag) { |
$r->print(&mt('Type: [_1]',&standard_parameter_names($value))); |
$output .= &mt('Type: [_1]',&standard_parameter_names($value)); |
} else { |
} else { |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
$uname,$udom,$issection,$issection,$courseopt); |
$uname,$udom,$issection,$issection,$courseopt); |
if (&isdateparm($istype{$parmname})) { |
if (&isdateparm($istype{$parmname})) { |
$r->print(&Apache::lonlocal::locallocaltime($value)); |
$output .= &Apache::lonlocal::locallocaltime($value); |
} else { |
} else { |
$r->print($value); |
$output .= $value; |
} |
} |
if ($value ne $all[$level]) { |
if ($value ne $all[$level]) { |
$r->print('<br /><font color="red">'.&mt('Not active anymore').'</font>'); |
$output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>'; |
} else { |
} else { |
$stillactive=1; |
$stillactive=1; |
} |
} |
} |
} |
} |
} |
$r->print('</td>'); |
$output .= '</td><td>'; |
if ($stillactive) { |
if ($stillactive) { |
|
my $title=&mt('Changed [_1]',&standard_parameter_names($parmname)); |
|
my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription, |
|
(&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value)); |
if (($uname) && ($udom)) { |
if (($uname) && ($udom)) { |
$r->print('<td>Notify Link</td>'); |
$output .= |
|
&Apache::loncommon::messagewrapper('Notify User', |
|
$uname,$udom,$title, |
|
$description); |
} else { |
} else { |
$r->print('<td>Blog Link</td>'); |
$output .= |
|
&Apache::lonrss::course_blog_link($id,$title, |
|
$description); |
} |
} |
} else { |
|
$r->print('<td> </td>'); |
|
} |
} |
$r->print(&Apache::loncommon::end_data_table_row()); |
$output .= '</td>'.&Apache::loncommon::end_data_table_row(); |
|
} |
|
if ($env{'form.displayfilter'} eq 'containing') { |
|
my $wholeentry=$about_me_link.':'. |
|
$parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'. |
|
$output; |
|
if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; } |
} |
} |
|
if ($count) { |
|
$r->print($row_start.'<td rowspan="'.$count.'">'.$time.'</td> |
|
<td rowspan="'.$count.'">'.$about_me_link. |
|
'<br /><tt>'.$parmlog{$id}{'exe_uname'}. |
|
':'.$parmlog{$id}{'exe_udom'}.'</tt>'. |
|
$send_msg_link.'</td>'.$output); |
|
$shown++; |
|
} |
|
if (!($env{'form.show'} eq &mt('all') |
|
|| $shown<=$env{'form.show'})) { last; } |
} |
} |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_data_table()); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub check_for_course_info { |
|
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
return 1 if ($navmap); |
|
return 0; |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 3459 sub handler {
|
Line 3891 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
&Apache::lonhtmlcommon::add_breadcrumb({href=>"/adm/parmset", |
text=>"Parameter Manager", |
text=>"Parameter Manager", |
faq=>10, |
faq=>10, |
bug=>'Instructor Interface'}); |
bug=>'Instructor Interface', |
|
help => 'Parameter_Manager'}); |
|
|
# ----------------------------------------------------- Needs to be in a course |
# ----------------------------------------------------- Needs to be in a course |
my $parm_permission = |
my $parm_permission = |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
(&Apache::lonnet::allowed('opa',$env{'request.course.id'}) || |
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
&Apache::lonnet::allowed('opa',$env{'request.course.id'}.'/'. |
$env{'request.course.sec'})); |
$env{'request.course.sec'})); |
if ($env{'request.course.id'} && $parm_permission) { |
my $exists = &check_for_course_info(); |
|
|
|
if ($env{'request.course.id'} && $parm_permission && $exists) { |
|
|
# Start Page |
# Start Page |
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
Line 3484 sub handler {
|
Line 3919 sub handler {
|
# the table mode |
# the table mode |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
if ((($env{'form.command'} eq 'set') && ($env{'form.url'}) |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
&& (!$env{'form.dis'})) || ($env{'form.symb'})) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({help=>'Problem_Parameters', |
|
text=>"Problem Parameters"}); |
&assessparms($r); |
&assessparms($r); |
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
Line 3498 sub handler {
|
Line 3935 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"}); |
&overview($r); |
&overview($r); |
|
} elsif ($env{'form.action'} eq 'addmetadata' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&addmetafield($r); |
|
} elsif ($env{'form.action'} eq 'ordermetadata' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=addmetadata', |
|
text=>"Add Metadata Field"}); |
|
&order_meta_fields($r); |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'setrestrictmeta' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=setrestrictmeta', |
text=>"Restrict Metadata"}); |
text=>"Restrict Metadata"}); |
Line 3519 sub handler {
|
Line 3964 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log"}); |
text=>"Parameter Change Log"}); |
&parm_change_log($r); |
&parm_change_log($r); |
|
} elsif ($env{'form.action'} eq 'cleanparameters' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=cleanparameters', |
|
text=>"Clean Parameters"}); |
|
&clean_parameters($r); |
} |
} |
} else { |
} else { |
# ----------------------------- Not in a course, or not allowed to modify parms |
# ----------------------------- Not in a course, or not allowed to modify parms |
$env{'user.error.msg'}= |
if ($exists) { |
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
$env{'user.error.msg'}= |
|
"/adm/parmset:opa:0:0:Cannot modify assessment parameters"; |
|
} else { |
|
$env{'user.error.msg'}= |
|
"/adm/parmset::0:1:Course environment gone, reinitialize the course"; |
|
} |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
return OK; |
return OK; |