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

version 1.297, 2006/05/01 14:59:38 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 649  sub startpage { Line 653  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 1118  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;      my %grouphash = &Apache::loncommon::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 1143  sub usermenu { Line 1140  sub usermenu {
         }          }
         $sections.='</select>';          $sections.='</select>';
     }      }
     if ($numsec && $numgrp && $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 1169  function group_or_section(caller) { Line 1166  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 1248  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 {
     my ($r,$selectedgroups)=@_;      my ($r,$selectedgroups)=@_;
     my %grouphash;      my %grouphash = &Apache::loncommon::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 1984  sub crsenv { Line 1973  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 2088  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 2647  sub newoverview { Line 2636  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 2801  sub overview { Line 2790  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 3091  sub setrestrictmeta { Line 3080  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 3149  sub defaultsetter { Line 3137  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 3321  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 3357  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 3382  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 3391  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 3421  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());
 }  }
   
Line 3500  sub handler { Line 3502  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',

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


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