Diff for /loncom/interface/lonparmset.pm between versions 1.292 and 1.295

version 1.292, 2006/04/18 02:13:49 version 1.295, 2006/04/22 15:39:22
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 2355  sub tablestart { Line 2333  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 2363  sub tablestart { Line 2341  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 2614  sub listdata { Line 2592  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 2660  sub listdata { Line 2640  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 3355  sub components { Line 3335  sub components {
     return ($realm,$section,$name,$part,$typeflag,      return ($realm,$section,$name,$part,$typeflag,
     $what,$middle,$uname,$udom,$issection);      $what,$middle,$uname,$udom,$issection);
 }  }
   
 sub standard_parameter_names {  sub standard_parameter_names {
     my ($name)=@_;      my ($name)=@_;
     my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date',      my %standard_parms=&Apache::lonlocal::texthash('duedate' => 'Due Date',
Line 3363  sub standard_parameter_names { Line 3344  sub standard_parameter_names {
    'maxtries' => 'Max. Number of Tries',     'maxtries' => 'Max. Number of Tries',
    'weight' => 'Weight',     'weight' => 'Weight',
    'date_start' => 'Starting Date',     'date_start' => 'Starting Date',
    'date_end' => 'Ending 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 3377  sub parm_change_log { Line 3361  sub parm_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'});
     my %exetime=();  
     foreach my $key (keys(%parmlog)) {  
  if ($key=~/^(.+)\_exe\_time$/) {  
     $exetime{$1}=$parmlog{$key};  
  }  
     }      
     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('<table border="2">');      $r->print('<table border="2">');
     foreach my $id (sort { $exetime{$b}<=>$exetime{$a} } (keys(%exetime))) {      my $bgcolor='#EEEEEE';
         my @changes=split(/\,/,$parmlog{$id.'_logentry'});      foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) {
    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'});
  my $plainname =    my $plainname = 
     &Apache::loncommon::plainname($parmlog{$id.'_exe_uname'},      &Apache::loncommon::plainname($parmlog{$id}{'exe_uname'},
   $parmlog{$id.'_exe_udom'});    $parmlog{$id}{'exe_udom'});
  my $about_me_link =    my $about_me_link = 
     &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'}))) {      $send_msg_link ='<br />'.
     my $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,$what,$middle,$uname,$udom,$issection)=              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>'.
       &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}{'deleteflag'}) {
  $r->print(&mt('Deleted'));   $r->print(&mt('Deleted'));
     } else {      } else {
  if ($typeflag) {   if ($typeflag) {

Removed from v.1.292  
changed lines
  Added in v.1.295


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>