version 1.290, 2006/04/15 21:12:56
|
version 1.293, 2006/04/18 18:10:55
|
Line 394 sub storeparm_by_symb {
|
Line 394 sub storeparm_by_symb {
|
return ''; |
return ''; |
} |
} |
|
|
{ |
sub log_parmset { |
my $logid; |
return &Apache::lonnet::instructor_log('parameterlog',@_); |
sub log_parmset { |
|
my ($storehash,$delflag,$uname,$udom)=@_; |
|
my $logentry=join(',',map { |
|
&Apache::lonnet::escape($_).'=>'.&Apache::lonnet::escape($$storehash{$_}); |
|
} keys %$storehash); |
|
$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.'_delflag' => $delflag, |
|
$id.'_logentry' => $logentry, |
|
$id.'_uname' => $uname, |
|
$id.'_udom' => $udom, |
|
}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
|
$env{'course.'.$env{'request.course.id'}.'.num'} |
|
); |
|
} |
|
} |
} |
|
|
sub storeparm_by_symb_inner { |
sub storeparm_by_symb_inner { |
Line 2614 sub listdata {
|
Line 2592 sub listdata {
|
# |
# |
# Ready to print |
# Ready to print |
# |
# |
$r->print(&tablestart().'<tr><td><b>'.$name. |
$r->print(&tablestart().'<tr><td><b>'.&standard_parameter_names($name). |
':</b></td><td><input type="checkbox" name="del_'. |
'</b></td><td><input type="checkbox" name="del_'. |
$thiskey.'" /></td><td>'); |
$thiskey.'" /></td><td>'); |
$foundkeys++; |
$foundkeys++; |
if (&isdateparm($thistype)) { |
if (&isdateparm($thistype)) { |
Line 3053 ENDMAINFORMHEAD
|
Line 3031 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 3324 ENDYESNO
|
Line 3302 ENDYESNO
|
} |
} |
|
|
sub components { |
sub components { |
my ($key,$uname,$udom)=@_; |
my ($key,$uname,$udom,$exeuser,$exedomain)=@_; |
my $typeflag=0; |
my $typeflag=0; |
if ($key=~/\.type$/) { |
if ($key=~/\.type$/) { |
$key=~s/\.type$//; |
$key=~s/\.type$//; |
$typeflag=1; |
$typeflag=1; |
} |
} |
|
my $issection; |
my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/); |
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=~/^\[(.*)\]/) { |
my $issection=$1; |
$issection=$1; |
if ($uname) { |
$section=&mt('Group/Section').': '.$issection; |
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
|
} else { |
|
$section=&mt('Group/Section').': '.$issection; |
|
} |
|
$middle=~s/^\[(.*)\]//; |
$middle=~s/^\[(.*)\]//; |
} |
} |
$middle=~s/\.+$//; |
$middle=~s/\.+$//; |
$middle=~s/^\.+//; |
$middle=~s/^\.+//; |
|
if ($uname) { |
|
$section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom); |
|
$issection=''; |
|
} |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
my $realm='<font color="red">'.&mt('All Resources').'</font>'; |
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='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>'; |
Line 3350 sub components {
|
Line 3329 sub components {
|
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($middle); |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
$realm='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>'; |
} |
} |
return ($realm,$section,$name,$part,$typeflag); |
my $what=$part.'.'.$name; |
|
return ($realm,$section,$name,$part,$typeflag, |
|
$what,$middle,$uname,$udom,$issection); |
|
} |
|
|
|
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', |
|
'int_pos' => 'Positive Integer', |
|
'int_zero_pos' => 'Positive Integer or Zero', |
|
'hinttries' => 'Number of Tries till Hints appear'); |
|
if ($standard_parms{$name}) { |
|
return $standard_parms{$name}; |
|
} else { |
|
return $name; |
|
} |
} |
} |
|
|
sub parm_change_log { |
sub parm_change_log { |
Line 3364 sub parm_change_log {
|
Line 3364 sub parm_change_log {
|
if ($key=~/^(.+)\_exe\_time$/) { |
if ($key=~/^(.+)\_exe\_time$/) { |
$exetime{$1}=$parmlog{$key}; |
$exetime{$1}=$parmlog{$key}; |
} |
} |
} |
} |
|
my $courseopt=&Apache::lonnet::get_courseresdata($env{'course.'.$env{'request.course.id'}.'.num'}, |
|
$env{'course.'.$env{'request.course.id'}.'.domain'}); |
$r->print('<table border="2">'); |
$r->print('<table border="2">'); |
foreach my $id (sort { $exetime{$a}<=>$exetime{$b} } (keys(%exetime))) { |
my $bgcolor='#EEEEEE'; |
my @changes=split(/\,/,$parmlog{$id.'_logentry'}); |
foreach my $id (sort { $exetime{$b}<=>$exetime{$a} } (keys(%exetime))) { |
|
if ($bgcolor eq '#EEEEEE') { $bgcolor='#FFFFCC'; } else { $bgcolor='#EEEEEE'; } |
|
my @changes=keys(%{$parmlog{$id.'_logentry'}}); |
my $count=$#changes+1; |
my $count=$#changes+1; |
my $time = |
my $time = |
&Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}); |
&Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'}); |
Line 3378 sub parm_change_log {
|
Line 3382 sub parm_change_log {
|
&Apache::loncommon::aboutmewrapper($plainname, |
&Apache::loncommon::aboutmewrapper($plainname, |
$parmlog{$id.'_exe_uname'}, |
$parmlog{$id.'_exe_uname'}, |
$parmlog{$id.'_exe_udom'}); |
$parmlog{$id.'_exe_udom'}); |
|
my $send_msg_link=''; |
my $send_msg_link; |
|
if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) |
if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) |
|| ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) { |
|| ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) { |
my $send_msg_link ='<br />'. |
$send_msg_link ='<br />'. |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
&Apache::loncommon::messagewrapper(&mt('Send message'), |
$parmlog{$id.'_exe_uname'}, |
$parmlog{$id.'_exe_uname'}, |
$parmlog{$id.'_exe_udom'}); |
$parmlog{$id.'_exe_udom'}); |
} |
} |
$r->print('<tr><td rowspan="'.$count.'">'.$time.'</td> |
$r->print('<tr bgcolor="'.$bgcolor.'"><td rowspan="'.$count.'">'.$time.'</td> |
<td rowspan="'.$count.'">'.$about_me_link. |
<td rowspan="'.$count.'">'.$about_me_link. |
'<br /><tt>'.$parmlog{$id.'_exe_uname'}. |
'<br /><tt>'.$parmlog{$id.'_exe_uname'}. |
':'.$parmlog{$id.'_exe_udom'}.'</tt>'. |
':'.$parmlog{$id.'_exe_udom'}.'</tt>'. |
$send_msg_link.'</td>'); |
$send_msg_link.'</td>'); |
my $makenewrow=0; |
my $makenewrow=0; |
my %istype=(); |
my %istype=(); |
foreach my $changed (sort @changes) { |
foreach my $changed (reverse(sort(@changes))) { |
my ($key,$value)=split(/\=\>/,&Apache::lonnet::unescape($changed)); |
my $value=$parmlog{$id.'_logentry'}->{$changed}; |
my ($realm,$section,$parmname,$part,$typeflag)= |
my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)= |
&components($key,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'}); |
&components($changed,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'}); |
if ($typeflag) { $istype{$parmname}=$value; } |
if ($typeflag) { $istype{$parmname}=$value; } |
if ($makenewrow) { $r->print('<tr>'); } else { $makenewrow=1; } |
if ($makenewrow) { $r->print('<tr bgcolor="'.$bgcolor.'">'); } else { $makenewrow=1; } |
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
$r->print('<td>'.$realm.'</td><td>'.$section.'</td><td>'. |
&mt('Part: [_1]',$part).'</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'}) { |
if ($parmlog{$id.'_deleteflag'}) { |
$r->print(&mt('Deleted')); |
$r->print(&mt('Deleted')); |
} else { |
} else { |
if ($typeflag) { |
if ($typeflag) { |
$r->print(&mt('Type: [_1]',$value)); |
$r->print(&mt('Type: [_1]',&standard_parameter_names($value))); |
} elsif (&isdateparm($istype{$parmname})) { |
|
$r->print(&Apache::lonlocal::locallocaltime($value)); |
|
} else { |
} else { |
$r->print($value); |
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></tr>'); |
$r->print('</td>'); |
|
if ($stillactive) { |
|
if (($uname) && ($udom)) { |
|
$r->print('<td>Notify Link</td>'); |
|
} else { |
|
$r->print('<td>Blog Link</td>'); |
|
} |
|
} else { |
|
$r->print('<td> </td>'); |
|
} |
|
$r->print('</tr>'); |
} |
} |
} |
} |
$r->print('</table>'); |
$r->print('</table>'); |
Line 3514 sub handler {
|
Line 3538 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 { |