Diff for /loncom/interface/lonparmset.pm between versions 1.348 and 1.350.2.1

version 1.348, 2006/11/29 15:38:22 version 1.350.2.1, 2006/12/14 20:08:15
Line 65  use Apache::lonlocal; Line 65  use Apache::lonlocal;
 use Apache::lonnavmaps;  use Apache::lonnavmaps;
 use Apache::longroup;  use Apache::longroup;
 use Apache::lonrss;  use Apache::lonrss;
 use LONCAPA;  use LONCAPA qw(:DEFAULT :match);
   
 # --- Caches local to lonparmset  # --- Caches local to lonparmset
   
Line 122  sub parmval_by_symb { Line 122  sub parmval_by_symb {
 # load caches  # load caches
     &cacheparmhash();      &cacheparmhash();
   
     my $useropt=&Apache::lonnet::get_userresdata($uname,$udom);      my $useropt;
       if ($uname ne '' && $udom ne '') {
    $useropt = &Apache::lonnet::get_userresdata($uname,$udom);
       }
   
     my $result='';      my $result='';
     my @outpar=();      my @outpar=();
Line 173  sub parmval_by_symb { Line 176  sub parmval_by_symb {
     }      }
   
 # ------------------------------------------------------ fourth, back to course  # ------------------------------------------------------ fourth, back to course
     if (defined($csec)) {      if ($csec ne '') {
         if (defined($$courseopt{$seclevel})) {          if (defined($$courseopt{$seclevel})) {
     $outpar[9]=$$courseopt{$seclevel};      $outpar[9]=$$courseopt{$seclevel};
     $result=9;      $result=9;
Line 189  sub parmval_by_symb { Line 192  sub parmval_by_symb {
  }   }
     }      }
 # ------------------------------------------------------ fifth, check course group  # ------------------------------------------------------ fifth, check course group
     if (defined($cgroup)) {      if ($cgroup ne '') {
         if (defined($$courseopt{$grplevel})) {          if (defined($$courseopt{$grplevel})) {
             $outpar[6]=$$courseopt{$grplevel};              $outpar[6]=$$courseopt{$grplevel};
             $result=6;              $result=6;
Line 206  sub parmval_by_symb { Line 209  sub parmval_by_symb {
   
 # ---------------------------------------------------------- fifth, check user  # ---------------------------------------------------------- fifth, check user
   
     if (defined($uname)) {      if ($uname ne '') {
  if (defined($$useropt{$courselevel})) {   if (defined($$useropt{$courselevel})) {
     $outpar[3]=$$useropt{$courselevel};      $outpar[3]=$$useropt{$courselevel};
     $result=3;      $result=3;
Line 270  sub resetrulescache { Line 273  sub resetrulescache {
 sub rulescache {  sub rulescache {
     my $id=shift;      my $id=shift;
     if ($rulesid ne $env{'request.course.id'}) {      if ($rulesid ne $env{'request.course.id'}) {
  %rules=();   && !defined($rules{$id})) {
     }  
     unless (defined($rules{$id})) {  
  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'};
  %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);   %rules=&Apache::lonnet::dump('parmdefactions',$dom,$crs);
Line 2363  sub readdata { Line 2364  sub readdata {
   
     my $classlist=&Apache::loncoursedata::get_classlist();      my $classlist=&Apache::loncoursedata::get_classlist();
     foreach (keys %$classlist) {      foreach (keys %$classlist) {
         # the following undefs are for 'domain', and 'username' respectively.          if ($_=~/^($match_username)\:($match_domain)$/) {
         if ($_=~/^(\w+)\:(\w+)$/) {  
     my ($tuname,$tudom)=($1,$2);      my ($tuname,$tudom)=($1,$2);
     my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);      my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
             foreach my $userkey (keys %{$useropt}) {              foreach my $userkey (keys %{$useropt}) {
Line 2486  sub storedata { Line 2486  sub storedata {
   
 sub extractuser {  sub extractuser {
     my $key=shift;      my $key=shift;
     return ($key=~/^$env{'request.course.id'}.\[useropt\:(\w+)\:(\w+)\]\./);      return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./);
 }  }
   
 sub listdata {  sub listdata {
Line 2544  sub listdata { Line 2544  sub listdata {
     my $section=&mt('All Students');      my $section=&mt('All Students');
     if ($middle=~/^\[(.*)\]/) {      if ($middle=~/^\[(.*)\]/) {
  my $issection=$1;   my $issection=$1;
  if ($issection=~/^useropt\:(\w+)\:(\w+)/) {   if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {
     $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);      $section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
  } else {   } else {
     $section=&mt('Group/Section').': '.$issection;      $section=&mt('Group/Section').': '.$issection;
Line 2918  sub parse_key { Line 2918  sub parse_key {
     $data{'scope_type'} = 'all';      $data{'scope_type'} = 'all';
     if ($middle=~/^\[(.*)\]/) {      if ($middle=~/^\[(.*)\]/) {
         $data{'scope'} = $1;          $data{'scope'} = $1;
  if ($data{'scope'}=~/^useropt\:(\w+)\:(\w+)/) {   if ($data{'scope'}=~/^useropt\:($match_username)\:($match_domain)/) {
     $data{'scope_type'} = 'user';      $data{'scope_type'} = 'user';
     $data{'scope'} = [$1,$2];      $data{'scope'} = [$1,$2];
  } else {   } else {
Line 3718  sub parm_change_log { Line 3718  sub parm_change_log {
       &mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'.        &mt('Parameter').'</th><th>'.&mt('Part').'</th><th>'.&mt('New Value').'</th><th>'.&mt('Announce').'</th>'.
       &Apache::loncommon::end_data_table_header_row());        &Apache::loncommon::end_data_table_header_row());
     my $shown=0;      my $shown=0;
       my $folder='';
       if ($env{'form.displayfilter'} eq 'currentfolder') {
    my $last='';
    if (tie(my %hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
    &GDBM_READER(),0640)) {
       $last=$hash{'last_known'};
       untie(%hash);
    }
    if ($last) { ($folder) = &Apache::lonnet::decode_symb($last); }
       }
     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))) {
         my @changes=keys(%{$parmlog{$id}{'logentry'}});          my @changes=keys(%{$parmlog{$id}{'logentry'}});
  my $count = 0;   my $count = 0;
Line 3739  sub parm_change_log { Line 3749  sub parm_change_log {
    $parmlog{$id}{'exe_udom'});     $parmlog{$id}{'exe_udom'});
  }   }
  my $row_start=&Apache::loncommon::start_data_table_row();   my $row_start=&Apache::loncommon::start_data_table_row();
  $r->print($row_start);  
  my $makenewrow=0;   my $makenewrow=0;
  my %istype=();   my %istype=();
  my $output;   my $output;
Line 3749  sub parm_change_log { Line 3758  sub parm_change_log {
     !exists($parmlog{$id}{'logentry'}{$changed.'.type'}));      !exists($parmlog{$id}{'logentry'}{$changed.'.type'}));
             my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)=              my ($realm,$section,$parmname,$part,$what,$middle,$uname,$udom,$issection,$realmdescription)=
  &components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag);   &components($changed,$parmlog{$id}{'uname'},$parmlog{$id}{'udom'},undef,undef,$typeflag);
       if ($env{'form.displayfilter'} eq 'currentfolder') {
    if ($folder) {
       if ($middle!~/^\Q$folder\E/) { next; }
    }
       }
     if ($typeflag) {      if ($typeflag) {
  $istype{$parmname}=$value;    $istype{$parmname}=$value; 
  if (!$env{'form.includetypes'}) { next; }    if (!$env{'form.includetypes'}) { next; } 
Line 3801  sub parm_change_log { Line 3815  sub parm_change_log {
     }      }
     $output .= '</td>'.&Apache::loncommon::end_data_table_row();      $output .= '</td>'.&Apache::loncommon::end_data_table_row();
  }   }
  $r->print('<td rowspan="'.$count.'">'.$time.'</td>          if ($env{'form.displayfilter'} eq 'containing') {
       my $wholeentry=$about_me_link.':'.
    $parmlog{$id}{'exe_uname'}.':'.$parmlog{$id}{'exe_udom'}.':'.
    $output;
       if ($wholeentry!~/\Q$env{'form.containingphrase'}\E/i) { next; }        
    }
           if ($count) {
       $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>'.
   $send_msg_link.'</td>'.$output);    $send_msg_link.'</td>'.$output);
       $shown++;
  $shown++;   }
  if (!($env{'form.show'} eq &mt('all')    if (!($env{'form.show'} eq &mt('all') 
       || $shown<=$env{'form.show'})) { last; }        || $shown<=$env{'form.show'})) { last; }
     }      }

Removed from v.1.348  
changed lines
  Added in v.1.350.2.1


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