version 1.287, 2006/04/14 16:38:43
|
version 1.310, 2006/06/02 10:02:37
|
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 lib '/home/httpd/lib/perl/'; |
|
use LONCAPA; |
|
|
# --- Caches local to lonparmset |
# --- Caches local to lonparmset |
|
|
Line 90 Inputs: $what - a parameter spec (inclu
|
Line 94 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 117 sub parmval {
|
Line 121 sub parmval {
|
sub parmval_by_symb { |
sub parmval_by_symb { |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
my ($what,$symb,$def,$uname,$udom,$csec,$cgroup,$courseopt)=@_; |
# load caches |
# load caches |
|
|
&cacheparmhash(); |
&cacheparmhash(); |
|
|
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
my $useropt=&Apache::lonnet::get_userresdata($uname,$udom); |
Line 126 sub parmval_by_symb {
|
Line 129 sub parmval_by_symb {
|
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 394 sub storeparm_by_symb {
|
Line 398 sub storeparm_by_symb {
|
return ''; |
return ''; |
} |
} |
|
|
{ |
sub log_parmset { |
my $logid; |
return &Apache::lonnet::instructor_log('parameterlog',@_); |
sub log_parmset { |
|
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
|
$logid++; |
|
my $id=time().'00000'.$$.'00000'.$logid; |
|
&Apache::lonnet::put('nohist_parameterlog', |
|
{ |
|
$id.'_exe_uname' => $env{'user.name'}, |
|
$id.'_exe_udom' => $env{'user.domain'}, |
|
$id.'_exe_time' => time(), |
|
$id.'_exe_ip' => $ENV{'REMOTE_ADDR'}, |
|
$id.'_symb' => $symb, |
|
$id.'_spnam' => $spnam, |
|
$id.'_snum' => $snum, |
|
$id.'_nval' => $nval, |
|
$id.'_ntype' => $ntype, |
|
$id.'_uname' => $uname, |
|
$id.'_udom' => $udom, |
|
$id.'_csec' => $csec, |
|
$id.'_cgroup' => $cgroup |
|
}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'} |
|
); |
|
} |
|
} |
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
# ---------------------------------------------------------- Get symb, map, etc |
# ---------------------------------------------------------- Get symb, map, etc |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_; |
&log_parmset(@_); |
|
# ---------------------------------------------------------- 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 479 sub storeparm_by_symb_inner {
|
Line 460 sub storeparm_by_symb_inner {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
('resourcedata',[keys(%storecontent)],$cdom,$cnum); |
|
&log_parmset(\%storecontent,1); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$cdom,$cnum); |
('resourcedata',\%storecontent,$cdom,$cnum); |
|
&log_parmset(\%storecontent); |
} |
} |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
&Apache::lonnet::devalidatecourseresdata($cnum,$cdom); |
} else { |
} else { |
Line 502 sub storeparm_by_symb_inner {
|
Line 485 sub storeparm_by_symb_inner {
|
if ($delete) { |
if ($delete) { |
$reply=&Apache::lonnet::del |
$reply=&Apache::lonnet::del |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
('resourcedata',[keys(%storecontent)],$udom,$uname); |
|
&log_parmset(\%storecontent,1,$uname,$udom); |
} else { |
} else { |
$reply=&Apache::lonnet::cput |
$reply=&Apache::lonnet::cput |
('resourcedata',\%storecontent,$udom,$uname); |
('resourcedata',\%storecontent,$udom,$uname); |
|
&log_parmset(\%storecontent,0,$uname,$udom); |
} |
} |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
&Apache::lonnet::devalidateuserresdata($uname,$udom); |
} |
} |
Line 671 sub startpage {
|
Line 656 sub startpage {
|
&page_js(), |
&page_js(), |
{'add_entries' => \%loaditems,}); |
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs(undef, |
&Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting'); |
'Table Mode Parameter Setting'); |
|
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 1140 sub usermenu {
|
Line 1124 sub usermenu {
|
'oi' => "or ID", |
'oi' => "or ID", |
'ad' => "at Domain" |
'ad' => "at Domain" |
); |
); |
my %sectionhash=(); |
|
my $sections=''; |
my $sections=''; |
my $numsec = &Apache::loncommon::get_sections( |
my %sectionhash = &Apache::loncommon::get_sections(); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}, |
|
\%sectionhash); |
|
my $groups; |
my $groups; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
my $numgrp = &Apache::loncommon::coursegroups( |
|
\%grouphash, |
if (%sectionhash) { |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
if ($numsec > 0) { |
|
$sections=$lt{'se'}.': <select name="csec"'; |
$sections=$lt{'se'}.': <select name="csec"'; |
if ($numsec && $numgrp && $parmlev ne 'full') { |
if (%grouphash && $parmlev ne 'full') { |
$sections .= qq| onchange="group_or_section('csec')" |; |
$sections .= qq| onchange="group_or_section('csec')" |; |
} |
} |
$sections .= '>'; |
$sections .= '>'; |
Line 1165 sub usermenu {
|
Line 1143 sub usermenu {
|
} |
} |
$sections.='</select>'; |
$sections.='</select>'; |
} |
} |
if ($numsec && $numgrp && $parmlev ne 'full') { |
if (%sectionhash && %grouphash && $parmlev ne 'full') { |
$sections .= ' or '; |
$sections .= ' or '; |
$sections .= qq| |
$sections .= qq| |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 1191 function group_or_section(caller) {
|
Line 1169 function group_or_section(caller) {
|
</script> |
</script> |
|; |
|; |
} |
} |
if ($numgrp > 0) { |
|
|
if (%grouphash) { |
$groups=$lt{'gr'}.': <select name="cgroup"'; |
$groups=$lt{'gr'}.': <select name="cgroup"'; |
if ($numsec && $numgrp && $env{'form.action'} eq 'settable') { |
if (%sectionhash && $env{'form.action'} eq 'settable') { |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
$groups .= qq| onchange="group_or_section('cgroup')" |; |
} |
} |
$groups .= '>'; |
$groups .= '>'; |
Line 1270 sub levelmenu {
|
Line 1249 sub levelmenu {
|
|
|
sub sectionmenu { |
sub sectionmenu { |
my ($r,$selectedsections)=@_; |
my ($r,$selectedsections)=@_; |
my %sectionhash=(); |
my %sectionhash = &Apache::loncommon::get_sections(); |
my $sections=''; |
return if (!%sectionhash); |
my $numsec = &Apache::loncommon::get_sections( |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$r->print('<select name="Section" multiple="true" size="8" >'); |
$env{'course.'.$env{'request.course.id'}.'.num'}, |
foreach my $s ('all',sort keys %sectionhash) { |
\%sectionhash); |
$r->print(' <option value="'.$s.'"'); |
if ($numsec) { |
foreach (@{$selectedsections}) { |
$r->print('<select name="Section" multiple="true" size="8" >'); |
if ($s eq $_) { |
foreach my $s ('all',sort keys %sectionhash) { |
$r->print(' selected'); |
$r->print(' <option value="'.$s.'"'); |
last; |
foreach (@{$selectedsections}) { |
|
if ($s eq $_) { |
|
$r->print(' selected'); |
|
last; |
|
} |
|
} |
} |
$r->print('>'.$s."</option>\n"); |
|
} |
} |
$r->print("</select>\n"); |
$r->print('>'.$s."</option>\n"); |
} |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
sub groupmenu { |
sub groupmenu { |
my ($r,$selectedgroups)=@_; |
my ($r,$selectedgroups)=@_; |
my %grouphash; |
my %grouphash = &Apache::longroup::coursegroups(); |
my $numgrp = &Apache::loncommon::coursegroups( |
return if (!%grouphash); |
\%grouphash, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$r->print('<select name="Group" multiple="true" size="8" >'); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
foreach my $group (sort(keys(%grouphash))) { |
if ($numgrp) { |
$r->print(' <option value="'.$group.'"'); |
$r->print('<select name="Group" multiple="true" size="8" >'); |
foreach (@{$selectedgroups}) { |
foreach my $group (sort(keys(%grouphash))) { |
if ($group eq $_) { |
$r->print(' <option value="'.$group.'"'); |
$r->print(' selected'); |
foreach (@{$selectedgroups}) { |
last; |
if ($group eq $_) { |
} |
$r->print(' selected'); |
} |
last; |
$r->print('>'.$group."</option>\n"); |
} |
|
} |
|
$r->print('>'.$group."</option>\n"); |
|
} |
|
$r->print("</select>\n"); |
|
} |
} |
|
$r->print("</select>\n"); |
} |
} |
|
|
|
|
Line 1437 sub assessparms {
|
Line 1407 sub assessparms {
|
my $uhome; |
my $uhome; |
my $csec; |
my $csec; |
my $cgroup; |
my $cgroup; |
my $grouplist; |
|
my @usersgroups = (); |
my @usersgroups = (); |
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
Line 1543 sub assessparms {
|
Line 1512 sub assessparms {
|
.$name{'lastname'}.' '.$name{'generation'}. |
.$name{'lastname'}.' '.$name{'generation'}. |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
"<br>\n".&mt('ID').": ".$name{'id'}.'<p>'; |
} |
} |
$grouplist = &Apache::lonnet::get_users_groups( |
@usersgroups = &Apache::lonnet::get_users_groups( |
$udom,$uname,$env{'request.course.id'}); |
$udom,$uname,$env{'request.course.id'}); |
if ($grouplist) { |
if (@usersgroups > 0) { |
@usersgroups = &Apache::lonnet::sort_course_groups($grouplist, |
unless (grep(/^\Q$cgroup\E$/,@usersgroups)) { |
$env{'request.course.id'}); |
|
unless (grep/^\Q$cgroup\E$/,@usersgroups) { |
|
$cgroup = $usersgroups[0]; |
$cgroup = $usersgroups[0]; |
} |
} |
} else { |
|
$cgroup = ''; |
|
} |
} |
} |
} |
} |
} |
Line 1769 ENDTABLEHEADFOUR
|
Line 1734 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"); |
|
|
Line 1968 ENDMAPONE
|
Line 1933 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 2011 sub crsenv {
|
Line 1976 sub crsenv {
|
my $r=shift; |
my $r=shift; |
my $setoutput=''; |
my $setoutput=''; |
|
|
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef, |
my $breadcrumbs = |
'Edit Course Environment'); |
&Apache::lonhtmlcommon::breadcrumbs('Edit Course Environment'); |
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'}; |
|
|
Line 2115 sub crsenv {
|
Line 2080 sub crsenv {
|
} |
} |
# ------------------------- 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}); |
|
|
# -------------------------------------------------------- Get parameters again |
# -------------------------------------------------------- Get parameters again |
|
|
Line 2354 sub tablestart {
|
Line 2320 sub tablestart {
|
return ''; |
return ''; |
} else { |
} else { |
$tableopen=1; |
$tableopen=1; |
return '<table border="2"><tr><th>'.&mt('Parameter').'</th><th>'. |
return &Apache::loncommon::start_data_table().'<tr><th>'.&mt('Parameter').'</th><th>'. |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
&mt('Delete').'</th><th>'.&mt('Set to ...').'</th></tr>'; |
} |
} |
} |
} |
Line 2362 sub tablestart {
|
Line 2328 sub tablestart {
|
sub tableend { |
sub tableend { |
if ($tableopen) { |
if ($tableopen) { |
$tableopen=0; |
$tableopen=0; |
return '</table>'; |
return &Apache::loncommon::end_data_table(); |
} else { |
} else { |
return''; |
return''; |
} |
} |
Line 2421 sub storedata {
|
Line 2387 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom); |
$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 { |
Line 2436 sub storedata {
|
Line 2403 sub storedata {
|
} elsif ($cmd eq 'del') { |
} elsif ($cmd eq 'del') { |
if ($tuname) { |
if ($tuname) { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') { |
|
&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('<h2><font color="red">'. |
Line 2453 sub storedata {
|
Line 2421 sub storedata {
|
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
if (&Apache::lonnet::put('resourcedata',{$tkey=>$data, |
$tkey.'.type' => $typeof}, |
$tkey.'.type' => $typeof}, |
$tudom,$tuname) eq 'ok') { |
$tudom,$tuname) eq 'ok') { |
|
&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('<h2><font color="red">'. |
Line 2473 sub storedata {
|
Line 2442 sub storedata {
|
my $putentries=$#newdatakeys+1; |
my $putentries=$#newdatakeys+1; |
if ($delentries) { |
if ($delentries) { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') { |
|
my %loghash=map { $_ => '' } @deldata; |
|
&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('<h2><font color="red">'. |
Line 2482 sub storedata {
|
Line 2453 sub storedata {
|
} |
} |
if ($putentries) { |
if ($putentries) { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') { |
|
&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('<h2><font color="red">'. |
Line 2607 sub listdata {
|
Line 2579 sub listdata {
|
# |
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart(). |
':</b></td><td><input type="checkbox" name="del_'. |
&Apache::loncommon::start_data_table_row(). |
|
'<td><b>'.&standard_parameter_names($name). |
|
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
Line 2653 sub listdata {
|
Line 2627 sub listdata {
|
} |
} |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'. |
$thistype.'">'); |
$thistype.'">'); |
$r->print('</td></tr>'); |
$r->print('</td>'.&Apache::loncommon::end_data_table_row()); |
} |
} |
} |
} |
return $foundkeys; |
return $foundkeys; |
Line 2665 sub newoverview {
|
Line 2639 sub newoverview {
|
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 $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $start_page = &Apache::loncommon::start_page('Set Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 2819 sub overview {
|
Line 2793 sub overview {
|
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
|
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $start_page=&Apache::loncommon::start_page('Modify Parameters'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Overview'); |
$r->print(<<ENDOVER); |
$r->print(<<ENDOVER); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 3046 ENDMAINFORMHEAD
|
Line 3020 ENDMAINFORMHEAD
|
action => 'setdefaults', |
action => 'setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
{ text => 'Parameter Change Log and Course Blog Posting', |
{ text => 'Parameter Change Log and Course Blog Posting/User Notification', |
action => 'parameterchangelog', |
action => 'parameterchangelog', |
permission => $parm_permission, |
permission => $parm_permission, |
}, |
}, |
Line 3109 sub setrestrictmeta {
|
Line 3083 sub setrestrictmeta {
|
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(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Restrict Metadata')); |
'Restrict Metadata')); |
|
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 $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
my $key_base = $env{'course.'.$env{'request.course.id'}.'.'}; |
Line 3141 sub setrestrictmeta {
|
Line 3114 sub setrestrictmeta {
|
} |
} |
} |
} |
} |
} |
&Apache::lonnet::coursedescription($env{'request.course.id'}); |
&Apache::lonnet::coursedescription($env{'request.course.id'}, |
|
{'freshen_cache' => 1}); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
my %metadata_fields = &Apache::lonmeta::fieldnames('portfolio'); |
foreach my $field (sort(keys(%metadata_fields))) { |
foreach my $field (sort(keys(%metadata_fields))) { |
&Apache::lonnet::logthis ($field); |
&Apache::lonnet::logthis ($field); |
Line 3166 sub defaultsetter {
|
Line 3140 sub defaultsetter {
|
|
|
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
&Apache::loncommon::start_page('Parameter Setting Default Actions'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults'); |
my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Defaults'); |
$r->print(<<ENDDEFHEAD); |
$r->print(<<ENDDEFHEAD); |
$start_page |
$start_page |
$breadcrumbs |
$breadcrumbs |
Line 3316 ENDYESNO
|
Line 3290 ENDYESNO
|
return; |
return; |
} |
} |
|
|
sub parm_change_log { |
sub components { |
my ($r)=@_; |
my ($key,$uname,$udom,$exeuser,$exedomain)=@_; |
&startpage($r); |
my $typeflag=0; |
|
if ($key=~/\.type$/) { |
my @ids=(); |
$key=~s/\.type$//; |
my %symbp=(); |
$typeflag=1; |
my %mapp=(); |
} |
my %typep=(); |
my $issection; |
my %keyp=(); |
my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
my %uris=(); |
my $section=&mt('All Students'); |
my %maptitles=(); |
if ($middle=~/^\[(.*)\]/) { |
|
$issection=$1; |
# -------------------------------------------------------- Variable declaration |
$section=&mt('Group/Section').': '.$issection; |
|
$middle=~s/^\[(.*)\]//; |
my %allmaps=(); |
} |
my %alllevs=(); |
$middle=~s/\.+$//; |
|
$middle=~s/^\.+//; |
my $uname; |
if ($uname) { |
my $udom; |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
my $uhome; |
$issection=''; |
my $csec; |
} |
my $cgroup; |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
my $grouplist; |
my $realmdescription=&mt('all resources'); |
my @usersgroups = (); |
if ($middle=~/^(.+)\_\_\_\(all\)$/) { |
|
$realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
$realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1); |
|
} elsif ($middle) { |
$alllevs{'Resource Level'}='full'; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$alllevs{'Map/Folder Level'}='map'; |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
$alllevs{'Course Level'}='general'; |
$realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle); |
|
} |
|
my $what=$part.'.'.$name; |
|
return ($realm,$section,$name,$part,$typeflag, |
|
$what,$middle,$uname,$udom,$issection,$realmdescription); |
|
} |
|
|
|
sub standard_parameter_names { |
|
my ($name)=@_; |
|
my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date', |
|
'answerdate' => 'Answer Date', |
|
'opendate' => 'Open Date', |
|
'maxtries' => 'Max. Number of Tries', |
|
'weight' => 'Weight', |
|
'date_start' => 'Starting Date', |
|
'date_end' => 'Ending Date', |
|
'interval' => 'Time Interval Length', |
|
'tol' => 'Numerical Tolerance', |
|
'sig' => 'Significant Digits', |
|
'contentopen' => 'Content Opening Date', |
|
'contentclose' => 'Content Closing Date', |
|
'discussend' => 'End of Discussion Time', |
|
'discusshide' => 'Discussion Hidden', |
|
'problemstatus' => 'Problem Status Visible', |
|
'int_pos' => 'Positive Integer', |
|
'int_zero_pos' => 'Positive Integer or Zero', |
|
'hinttries' => 'Number of Tries till Hints appear', |
|
'numbubbles' => 'Number of Bubbles in Exam Mode'); |
|
if ($standard_parms{$name}) { |
|
return $standard_parms{$name}; |
|
} else { |
|
return $name; |
|
} |
|
} |
|
|
my %allparms; |
# |
my %allparts; |
# Parameter Change Log |
my %keyorder; |
# |
# --------------------------------------------------------- Get all assessments |
|
&extractResourceInformation(\@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allmaps, |
|
\%mapp, \%symbp,\%maptitles,\%uris, |
|
\%keyorder); |
|
|
|
$mapp{'0.0'} = ''; |
|
$symbp{'0.0'} = ''; |
|
|
|
my %level=&Apache::lonlocal::texthash('parmlevel_14' => 'General Course', |
sub parm_change_log { |
'parmlevel_13' => 'Map or Folder level in course', |
my ($r)=@_; |
'parmlevel_12' => 'Resource default', |
&startpage($r); |
'parmlevel_11' => 'Map default', |
|
'parmlevel_10' => 'Resource level in course', |
|
'parmlevel_9' => 'General for section', |
|
'parmlevel_8' => 'Map or Folder level for section', |
|
'parmlevel_7' => 'Resource level in section', |
|
'parmlevel_6' => 'General for group', |
|
'parmlevel_5' => 'Map or Folder level for group', |
|
'parmlevel_4' => 'Resource level in group', |
|
'parmlevel_3' => 'General for specific student', |
|
'parmlevel_2' => 'Map or Folder level for specific student', |
|
'parmlevel_1' => 'Resource level for specific student'); |
|
|
|
# $id.'_exe_uname' => $env{'user.name'}, |
|
# $id.'_exe_udom' => $env{'user.domain'}, |
|
# $id.'_exe_time' => time(), |
|
# $id.'_exe_ip' => $ENV{'REMOTE_ADDR'}, |
|
# $id.'_symb' => $symb, |
|
# $id.'_spnam' => $spnam, |
|
# $id.'_snum' => $snum, |
|
# $id.'_nval' => $nval, |
|
# $id.'_ntype' => $ntype, |
|
# $id.'_uname' => $uname, |
|
# $id.'_udom' => $udom, |
|
# $id.'_csec' => $csec, |
|
# $id.'_cgroup' => $cgroup |
|
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'}); |
my %exetime=(); |
if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); } |
foreach my $key (keys(%parmlog)) { |
$r->print('<form method="post"><input type="hidden" name="action" value="parameterchangelog" />'); |
if ($key=~/^(.+)\_exe\_time$/) { |
unless ($env{'form.show'}) { $env{'form.show'}=10; } |
$exetime{$1}=$parmlog{$key}; |
my $countselect = &Apache::lonmeta::selectbox('show', |
} |
$env{'form.show'}, |
} |
undef, |
$r->print('<table border="2">'); |
(10,20,50,100,1000,10000,100000)); |
foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } (keys(%exetime))) { |
$r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'. |
my ($part,$name)=($parmlog{$id.'_spnam'}=~/^(.*)[\_\.]([^\_\.]+)$/); |
'<input type="submit" value="'.&mt('Display').'" />'); |
my $spnam=$part.'_'.$name; |
|
$r->print('<tr><td>'. |
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
&Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}). |
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
'</td><td>'. |
$r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::aboutmewrapper( |
'<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'. |
&Apache::loncommon::plainname($parmlog{$id.'_exe_uname'}, |
&mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'. |
$parmlog{$id.'_exe_udom'}), |
&Apache::loncommon::end_data_table_header_row()); |
$parmlog{$id.'_exe_uname'}, |
my $shown=0; |
$parmlog{$id.'_exe_udom'}).'<br /><tt>'. |
foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) { |
$parmlog{$id.'_exe_uname'}.':'.$parmlog{$id.'_exe_udom'}.'</tt>'. |
my @changes=keys(%{$parmlog{$id}{'logentry'}}); |
((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) || |
my $count=$#changes+1; |
($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))? |
my $time = |
'<br />'.&Apache::loncommon::messagewrapper(&mt('Send message'), |
&Apache::lonlocal::locallocaltime($parmlog{$id}{'exe_time'}); |
$parmlog{$id.'_exe_uname'}, |
my $plainname = |
$parmlog{$id.'_exe_udom'}):''). |
&Apache::loncommon::plainname($parmlog{$id}{'exe_uname'}, |
'</td><td>'. |
$parmlog{$id}{'exe_udom'}); |
$level{'parmlevel_'.$parmlog{$id.'_snum'}}. |
my $about_me_link = |
'</td><td>'. |
&Apache::loncommon::aboutmewrapper($plainname, |
&mt($allparms{$name}).'<br /><tt>'.$name.'</tt>'. |
$parmlog{$id}{'exe_uname'}, |
'</td><td>'. |
$parmlog{$id}{'exe_udom'}); |
($part?&mt('Part: [_1]',$part):&mt('All parts')). |
my $send_msg_link=''; |
'</td><td>'. |
if ((($parmlog{$id}{'exe_uname'} ne $env{'user.name'}) |
$parmlog{$id.'_symb'}. |
|| ($parmlog{$id}{'exe_udom'} ne $env{'user.domain'}))) { |
'</td><td>'. |
$send_msg_link ='<br />'. |
($parmlog{$id.'_nval'}? |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
(&isdateparm($spnam)?&Apache::lonlocal::locallocaltime($parmlog{$id.'_nval'}):$parmlog{$id.'_nval'}) |
$parmlog{$id}{'exe_uname'}, |
:&mt('Deleted Parameter')). |
$parmlog{$id}{'exe_udom'}); |
'</td></tr>'); |
} |
|
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 %istype=(); |
|
foreach my $changed (reverse(sort(@changes))) { |
|
my $value=$parmlog{$id}{'logentry'}->{$changed}; |
|
my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection,$realmdescription)= |
|
&components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'}); |
|
if ($typeflag) { $istype{$parmname}=$value; } |
|
if ($makenewrow) { $r->print($row_start); } else { $makenewrow=1; } |
|
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
|
&standard_parameter_names($parmname).'</td><td>'. |
|
($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>'); |
|
my $stillactive=0; |
|
if ($parmlog{$id}{'deleteflag'}) { |
|
$r->print(&mt('Deleted')); |
|
} else { |
|
if ($typeflag) { |
|
$r->print(&mt('Type: [_1]',&standard_parameter_names($value))); |
|
} else { |
|
my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what), |
|
$uname,$udom,$issection,$issection,$courseopt); |
|
if (&isdateparm($istype{$parmname})) { |
|
$r->print(&Apache::lonlocal::locallocaltime($value)); |
|
} else { |
|
$r->print($value); |
|
} |
|
if ($value ne $all[$level]) { |
|
$r->print('<br /><font color="red">'.&mt('Not active anymore').'</font>'); |
|
} else { |
|
$stillactive=1; |
|
} |
|
} |
|
} |
|
$r->print('</td>'); |
|
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)) { |
|
$r->print('<td>'. |
|
&Apache::loncommon::messagewrapper('Notify User',$uname,$udom,$title,$description). |
|
'</td>'); |
|
} else { |
|
$r->print('<td>'. |
|
&Apache::lonrss::course_blog_link($id,$title,$description). |
|
'</td>'); |
|
} |
|
} else { |
|
$r->print('<td> </td>'); |
|
} |
|
$r->print(&Apache::loncommon::end_data_table_row()); |
|
} |
|
$shown++; |
|
if ($shown>=$env{'form.show'}) { last; } |
} |
} |
$r->print('</table>'); |
$r->print(&Apache::loncommon::end_data_table()); |
|
$r->print('</form>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 3495 sub handler {
|
Line 3531 sub handler {
|
|
|
} elsif (! exists($env{'form.action'})) { |
} elsif (! exists($env{'form.action'})) { |
$r->print(&header()); |
$r->print(&header()); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs(undef, |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Parameter Manager')); |
'Parameter Manager')); |
|
&print_main_menu($r,$parm_permission); |
&print_main_menu($r,$parm_permission); |
} 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', |
Line 3525 sub handler {
|
Line 3560 sub handler {
|
&assessparms($r); |
&assessparms($r); |
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
text=>"Parameter Change Log and Course Blog Posting"}); |
text=>"Parameter Change Log"}); |
&parm_change_log($r); |
&parm_change_log($r); |
} |
} |
} else { |
} else { |