version 1.280, 2006/03/16 20:38:19
|
version 1.287, 2006/04/14 16:38:43
|
Line 394 sub storeparm_by_symb {
|
Line 394 sub storeparm_by_symb {
|
return ''; |
return ''; |
} |
} |
|
|
|
{ |
|
my $logid; |
|
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]; |
Line 633 ENDJS
|
Line 662 ENDJS
|
} |
} |
sub startpage { |
sub startpage { |
my ($r) = @_; |
my ($r) = @_; |
my $html = &Apache::lonxml::xmlbegin(); |
|
my $head = &Apache::loncommon::head('LON-CAPA Course Parameters', |
|
&page_js()); |
|
my $loaditems = |
|
qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|; |
|
|
|
my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','', |
my %loaditems = ('onunload' => "pclose()", |
$loaditems); |
'onload' => "group_or_section('cgroup')",); |
|
|
|
my $start_page = |
|
&Apache::loncommon::start_page('Set/Modify Course Parameters', |
|
&page_js(), |
|
{'add_entries' => \%loaditems,}); |
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs(undef, |
&Apache::lonhtmlcommon::breadcrumbs(undef, |
'Table Mode Parameter Setting'); |
'Table Mode Parameter Setting'); |
$r->print(<<ENDHEAD); |
$r->print(<<ENDHEAD); |
$html |
$start_page |
$head |
|
$bodytag |
|
$breadcrumbs |
$breadcrumbs |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<form method="post" action="/adm/parmset?action=settable" name="parmform"> |
<input type="hidden" value='' name="pres_value" /> |
<input type="hidden" value='' name="pres_value" /> |
Line 2297 sub crsenv {
|
Line 2324 sub crsenv {
|
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
&Apache::loncommon::browser_and_searcher_javascript('parmset'). |
'</script>'; |
'</script>'; |
|
|
my $html=&Apache::lonxml::xmlbegin(); |
|
my $start_page = |
my $start_page = |
&Apache::loncommon::start_page('Set Course Environment Parameters', |
&Apache::loncommon::start_page('Set Course Environment Parameters', |
$browse_js); |
$browse_js); |
Line 3019 ENDMAINFORMHEAD
|
Line 3045 ENDMAINFORMHEAD
|
{ text => 'Set Parameter Setting Default Actions', |
{ text => 'Set Parameter Setting Default Actions', |
action => 'setdefaults', |
action => 'setdefaults', |
permission => $parm_permission, |
permission => $parm_permission, |
|
}, |
|
{ text => 'Parameter Change Log and Course Blog Posting', |
|
action => 'parameterchangelog', |
|
permission => $parm_permission, |
}, |
}, |
); |
); |
my $menu_html = ''; |
my $menu_html = ''; |
Line 3286 ENDYESNO
|
Line 3316 ENDYESNO
|
return; |
return; |
} |
} |
|
|
|
sub parm_change_log { |
|
my ($r)=@_; |
|
&startpage($r); |
|
|
|
my @ids=(); |
|
my %symbp=(); |
|
my %mapp=(); |
|
my %typep=(); |
|
my %keyp=(); |
|
my %uris=(); |
|
my %maptitles=(); |
|
|
|
# -------------------------------------------------------- Variable declaration |
|
|
|
my %allmaps=(); |
|
my %alllevs=(); |
|
|
|
my $uname; |
|
my $udom; |
|
my $uhome; |
|
my $csec; |
|
my $cgroup; |
|
my $grouplist; |
|
my @usersgroups = (); |
|
|
|
my $coursename=$env{'course.'.$env{'request.course.id'}.'.description'}; |
|
|
|
$alllevs{'Resource Level'}='full'; |
|
$alllevs{'Map/Folder Level'}='map'; |
|
$alllevs{'Course Level'}='general'; |
|
|
|
my %allparms; |
|
my %allparts; |
|
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', |
|
'parmlevel_13' => 'Map or Folder level in course', |
|
'parmlevel_12' => 'Resource default', |
|
'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', |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'}); |
|
my %exetime=(); |
|
foreach my $key (keys(%parmlog)) { |
|
if ($key=~/^(.+)\_exe\_time$/) { |
|
$exetime{$1}=$parmlog{$key}; |
|
} |
|
} |
|
$r->print('<table border="2">'); |
|
foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } (keys(%exetime))) { |
|
my ($part,$name)=($parmlog{$id.'_spnam'}=~/^(.*)[\_\.]([^\_\.]+)$/); |
|
my $spnam=$part.'_'.$name; |
|
$r->print('<tr><td>'. |
|
&Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}). |
|
'</td><td>'. |
|
&Apache::loncommon::aboutmewrapper( |
|
&Apache::loncommon::plainname($parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}), |
|
$parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}).'<br /><tt>'. |
|
$parmlog{$id.'_exe_uname'}.':'.$parmlog{$id.'_exe_udom'}.'</tt>'. |
|
((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) || |
|
($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))? |
|
'<br />'.&Apache::loncommon::messagewrapper(&mt('Send message'), |
|
$parmlog{$id.'_exe_uname'}, |
|
$parmlog{$id.'_exe_udom'}):''). |
|
'</td><td>'. |
|
$level{'parmlevel_'.$parmlog{$id.'_snum'}}. |
|
'</td><td>'. |
|
&mt($allparms{$name}).'<br /><tt>'.$name.'</tt>'. |
|
'</td><td>'. |
|
($part?&mt('Part: [_1]',$part):&mt('All parts')). |
|
'</td><td>'. |
|
$parmlog{$id.'_symb'}. |
|
'</td><td>'. |
|
($parmlog{$id.'_nval'}? |
|
(&isdateparm($spnam)?&Apache::lonlocal::locallocaltime($parmlog{$id.'_nval'}):$parmlog{$id.'_nval'}) |
|
:&mt('Deleted Parameter')). |
|
'</td></tr>'); |
|
} |
|
$r->print('</table>'); |
|
$r->print(&Apache::loncommon::end_page()); |
|
} |
|
|
################################################## |
################################################## |
################################################## |
################################################## |
|
|
Line 3378 sub handler {
|
Line 3523 sub handler {
|
text=>"Table Mode", |
text=>"Table Mode", |
help => 'Course_Setting_Parameters'}); |
help => 'Course_Setting_Parameters'}); |
&assessparms($r); |
&assessparms($r); |
} |
} elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) { |
|
&Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable', |
|
text=>"Parameter Change Log and Course Blog Posting"}); |
|
&parm_change_log($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'}= |
$env{'user.error.msg'}= |