Diff for /loncom/interface/lonparmset.pm between versions 1.299 and 1.305

version 1.299, 2006/05/09 14:38:10 version 1.305, 2006/05/15 23:40:54
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::lonrss;
   
 # --- Caches local to lonparmset  # --- Caches local to lonparmset
   
Line 125  sub parmval_by_symb { Line 126  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 403  sub storeparm_by_symb_inner { Line 405  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 1117  sub usermenu { Line 1121  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 = &Apache::loncommon::coursegroups();      my %grouphash = &Apache::loncommon::coursegroups();
   
     if ($numsec > 0) {      if (%sectionhash) {
         $sections=$lt{'se'}.': <select name="csec"';          $sections=$lt{'se'}.': <select name="csec"';
         if (%grouphash && $parmlev ne 'full') {          if (%grouphash && $parmlev ne 'full') {
             $sections .= qq| onchange="group_or_section('csec')" |;              $sections .= qq| onchange="group_or_section('csec')" |;
Line 1139  sub usermenu { Line 1140  sub usermenu {
         }          }
         $sections.='</select>';          $sections.='</select>';
     }      }
     if ($numsec && %grouphash && $parmlev ne 'full') {      if (%sectionhash && %grouphash && $parmlev ne 'full') {
         $sections .= '&nbsp;or&nbsp;';          $sections .= '&nbsp;or&nbsp;';
         $sections .= qq|          $sections .= qq|
 <script type="text/javascript">  <script type="text/javascript">
Line 1168  function group_or_section(caller) { Line 1169  function group_or_section(caller) {
   
     if (%grouphash) {      if (%grouphash) {
         $groups=$lt{'gr'}.': <select name="cgroup"';          $groups=$lt{'gr'}.': <select name="cgroup"';
         if ($numsec && $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 1245  sub levelmenu { Line 1246  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 {
Line 2081  sub crsenv { Line 2077  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});         {'freshen_cache' => 1});
   
 # -------------------------------------------------------- Get parameters again  # -------------------------------------------------------- Get parameters again
Line 3313  sub components { Line 3309  sub components {
  $issection='';   $issection='';
     }      }
     my $realm='<font color="red">'.&mt('All Resources').'</font>';      my $realm='<font color="red">'.&mt('All Resources').'</font>';
       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='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>';
     } 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='<font color="orange">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><font color="#aaaaaa" size="-2">('.$url.' in '.$map.' id: '.$id.')</font></font>';
    $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,$typeflag,
     $what,$middle,$uname,$udom,$issection);      $what,$middle,$uname,$udom,$issection,$realmdescription);
 }  }
   
 sub standard_parameter_names {  sub standard_parameter_names {
Line 3349  sub parm_change_log { Line 3348  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'});
       if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); }
   
     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(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
     my $bgcolor='#EEEEEE';        '<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>'.
         &Apache::loncommon::end_data_table_header_row());
     foreach my $id (sort { $parmlog{$b}{'exe_time'}<=>$parmlog{$a}{'exe_time'} } (keys(%parmlog))) {      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 @changes=keys(%{$parmlog{$id}{'logentry'}});
  my $count=$#changes+1;   my $count=$#changes+1;
  my $time =   my $time =
Line 3374  sub parm_change_log { Line 3376  sub parm_change_log {
    $parmlog{$id}{'exe_uname'},     $parmlog{$id}{'exe_uname'},
    $parmlog{$id}{'exe_udom'});     $parmlog{$id}{'exe_udom'});
  }   }
  $r->print('<tr bgcolor="'.$bgcolor.'"><td rowspan="'.$count.'">'.$time.'</td>   my $row_start=&Apache::loncommon::start_data_table_row();
    $r->print($row_start.'<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>'.
Line 3383  sub parm_change_log { Line 3386  sub parm_change_log {
  my %istype=();   my %istype=();
  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 ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection,$realmdescription)=
  &components($changed,$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 bgcolor="'.$bgcolor.'">'); } else { $makenewrow=1; }      if ($makenewrow) { $r->print($row_start); } 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>');
Line 3413  sub parm_change_log { Line 3416  sub parm_change_log {
     }      }
     $r->print('</td>');      $r->print('</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>');      $r->print('<td>'.
         &Apache::loncommon::messagewrapper('Notify User',$uname,$udom,$title,$description).
         '</td>');
  } else {   } else {
     $r->print('<td>Blog Link</td>');      $r->print('<td>'.
         &Apache::lonrss::course_blog_link($id,$title,$description).
         '</td>');
  }   }
     } else {      } else {
  $r->print('<td>&nbsp;</td>');   $r->print('<td>&nbsp;</td>');
     }      }
     $r->print('</tr>');      $r->print(&Apache::loncommon::end_data_table_row());
  }   }
     }      }
     $r->print('</table>');      $r->print(&Apache::loncommon::end_data_table());
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
 }  }
   

Removed from v.1.299  
changed lines
  Added in v.1.305


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