Diff for /loncom/interface/lonparmset.pm between versions 1.276 and 1.293

version 1.276, 2006/02/09 22:11:54 version 1.293, 2006/04/18 18:10:55
Line 293  sub preset_defaults { Line 293  sub preset_defaults {
 }  }
   
 ##################################################  ##################################################
   
   sub date_sanity_info {
      my $checkdate=shift;
      unless ($checkdate) { return ''; }
      my $result='';
      my $crsprefix='course.'.$env{'request.course.id'}.'.';
      if ($env{$crsprefix.'default_enrollment_end_date'}) {
         if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {
            $result.='<br />'.&mt('After course enrollment end!');
         }
      }
      if ($env{$crsprefix.'default_enrollment_start_date'}) {
         if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {
            $result.='<br />'.&mt('Before course enrollment start!');
         }
      }
      return $result;
   }
   ##################################################
 ##################################################  ##################################################
 #  #
 # Store a parameter by ID  # Store a parameter by ID
Line 375  sub storeparm_by_symb { Line 394  sub storeparm_by_symb {
     return '';      return '';
 }  }
   
   sub log_parmset {
       return &Apache::lonnet::instructor_log('parameterlog',@_);
   }
   
 sub storeparm_by_symb_inner {  sub storeparm_by_symb_inner {
 # ---------------------------------------------------------- Get symb, map, etc  # ---------------------------------------------------------- Get symb, map, etc
     my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;      my ($symb,$spnam,$snum,$nval,$ntype,$uname,$udom,$csec,$cgroup)=@_;
Line 431  sub storeparm_by_symb_inner { Line 454  sub storeparm_by_symb_inner {
  if ($delete) {   if ($delete) {
     $reply=&Apache::lonnet::del      $reply=&Apache::lonnet::del
  ('resourcedata',[keys(%storecontent)],$cdom,$cnum);   ('resourcedata',[keys(%storecontent)],$cdom,$cnum);
               &log_parmset(\%storecontent,1);
  } else {   } else {
     $reply=&Apache::lonnet::cput      $reply=&Apache::lonnet::cput
  ('resourcedata',\%storecontent,$cdom,$cnum);   ('resourcedata',\%storecontent,$cdom,$cnum);
       &log_parmset(\%storecontent);
  }   }
  &Apache::lonnet::devalidatecourseresdata($cnum,$cdom);   &Apache::lonnet::devalidatecourseresdata($cnum,$cdom);
     } else {      } else {
Line 454  sub storeparm_by_symb_inner { Line 479  sub storeparm_by_symb_inner {
  if ($delete) {   if ($delete) {
     $reply=&Apache::lonnet::del      $reply=&Apache::lonnet::del
  ('resourcedata',[keys(%storecontent)],$udom,$uname);   ('resourcedata',[keys(%storecontent)],$udom,$uname);
       &log_parmset(\%storecontent,1,$uname,$udom);
  } else {   } else {
     $reply=&Apache::lonnet::cput      $reply=&Apache::lonnet::cput
  ('resourcedata',\%storecontent,$udom,$uname);   ('resourcedata',\%storecontent,$udom,$uname);
       &log_parmset(\%storecontent,0,$uname,$udom);
  }   }
  &Apache::lonnet::devalidateuserresdata($uname,$udom);   &Apache::lonnet::devalidateuserresdata($uname,$udom);
     }      }
Line 516  sub valout { Line 543  sub valout {
             }              }
             $result=~s/\s+$//;              $result=~s/\s+$//;
         } elsif (&isdateparm($type)) {          } elsif (&isdateparm($type)) {
             $result = localtime($value);              $result = localtime($value).&date_sanity_info($value);
         } else {          } else {
             $result = $value;              $result = $value;
         }          }
Line 561  sub plink { Line 588  sub plink {
  &valout($value,$type).'</a></td></tr></table>';   &valout($value,$type).'</a></td></tr></table>';
 }  }
   
 sub startpage {  sub page_js {
     my $r=shift;  
     my $loaditems = qq|onUnload="pclose()" onLoad="group_or_section('cgroup')"|;  
     my $bodytag=&Apache::loncommon::bodytag('Set/Modify Course Parameters','',  
                                             $loaditems);  
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Table Mode Parameter Setting');  
     my $selscript=&Apache::loncommon::studentbrowser_javascript();      my $selscript=&Apache::loncommon::studentbrowser_javascript();
     my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();      my $pjump_def = &Apache::lonhtmlcommon::pjump_javascript_definition();
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDHEAD);      return(<<ENDJS);
 $html  <script type="text/javascript">
 <head>  
 <title>LON-CAPA Course Parameters</title>  
 <script>  
   
     function pclose() {      function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",          parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
Line 616  $html Line 636  $html
     }      }
 </script>  </script>
 $selscript  $selscript
 </head>  ENDJS
 $bodytag  
   }
   sub startpage {
       my ($r) = @_;
   
       my %loaditems = ('onunload' => "pclose()",
        'onload'   => "group_or_section('cgroup')",);
   
       my $start_page = 
    &Apache::loncommon::start_page('Set/Modify Course Parameters',
          &page_js(),
          {'add_entries' => \%loaditems,});
       my $breadcrumbs = 
    &Apache::lonhtmlcommon::breadcrumbs(undef,
       'Table Mode Parameter Setting');
       $r->print(<<ENDHEAD);
   $start_page
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=settable" name="parmform">  <form method="post" action="/adm/parmset?action=settable" name="parmform">
 <input type="hidden" value='' name="pres_value">  <input type="hidden" value='' name="pres_value" />
 <input type="hidden" value='' name="pres_type">  <input type="hidden" value='' name="pres_type" />
 <input type="hidden" value='' name="pres_marker">  <input type="hidden" value='' name="pres_marker" />
 <input type="hidden" value='1' name="prevvisit">  <input type="hidden" value='1' name="prevvisit" />
 ENDHEAD  ENDHEAD
 }  }
   
Line 1928  ENDMAPONE Line 1964  ENDMAPONE
             $r->print("</table></center>");              $r->print("</table></center>");
         } # end of $parmlev eq general          } # end of $parmlev eq general
     }      }
     $r->print('</form></body></html>');      $r->print('</form>'.&Apache::loncommon::end_page());
 } # end sub assessparms  } # end sub assessparms
   
   
Line 1953  Returns: nothing Line 1989  Returns: nothing
 sub crsenv {  sub crsenv {
     my $r=shift;      my $r=shift;
     my $setoutput='';      my $setoutput='';
     my $bodytag=&Apache::loncommon::bodytag(  
                              'Set Course Environment Parameters');  
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,
     'Edit Course Environment');      'Edit Course Environment');
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 2178  sub crsenv { Line 2213  sub crsenv {
      'disableexampointprint'       'disableexampointprint'
          => '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'.           => '<b>'.&mt('Disable automatically printing point values onto exams.').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
                'externalsyllabus'
                    => '<b>'.&mt('URL of Syllabus (not using internal handler)').'</b>',
      'tthoptions'       'tthoptions'
          => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>'           => '<b>'.&mt('Default set of options to pass to tth/m when converting tex').'</b>'
              );                ); 
         my @Display_Order = ('url','description','courseid','cloners','grading',          my @Display_Order = ('url','description','courseid','cloners','grading',
                                'externalsyllabus',
                              'default_xml_style','pageseparators',                               'default_xml_style','pageseparators',
                              'question.email','comment.email','policy.email',                               'question.email','comment.email','policy.email',
                              'student_classlist_view',                               'student_classlist_view',
Line 2260  sub crsenv { Line 2298  sub crsenv {
     my $Parameter=&mt('Parameter');      my $Parameter=&mt('Parameter');
     my $Value=&mt('Value');      my $Value=&mt('Value');
     my $Set=&mt('Set');      my $Set=&mt('Set');
     my $browse_js=&Apache::loncommon::browser_and_searcher_javascript('parmset');      my $browse_js=
     my $html=&Apache::lonxml::xmlbegin();   '<script type="text/javascript" language="Javascript">'.
     $r->print(<<ENDenv);   &Apache::loncommon::browser_and_searcher_javascript('parmset').
 $html   '</script>';
 <head>      
 <script type="text/javascript" language="Javascript" >      my $start_page = 
 $browse_js   &Apache::loncommon::start_page('Set Course Environment Parameters',
 </script>         $browse_js);
 <title>LON-CAPA Course Environment</title>      my $end_page = 
 </head>   &Apache::loncommon::end_page();
 $bodytag      $r->print(<<ENDENV);
   $start_page
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=crsenv" name="envform">  <form method="post" action="/adm/parmset?action=crsenv" name="envform">
 $setoutput  $setoutput
Line 2281  $output Line 2320  $output
 </table>  </table>
 <input type="submit" name="crsenv" value="$lt{'sce'}">  <input type="submit" name="crsenv" value="$lt{'sce'}">
 </form>  </form>
 </body>  $end_page
 </html>      ENDENV
 ENDenv  
 }  }
 ##################################################  ##################################################
 # Overview mode  # Overview mode
Line 2362  sub storedata { Line 2400  sub storedata {
  if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,   if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,
  $tkey.'.type' => $typeof},   $tkey.'.type' => $typeof},
  $tudom,$tuname) eq 'ok') {   $tudom,$tuname) eq 'ok') {
       &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom);
     $r->print('<br />'.&mt('Stored modified parameter for').' '.      $r->print('<br />'.&mt('Stored modified parameter for').' '.
       &Apache::loncommon::plainname($tuname,$tudom));        &Apache::loncommon::plainname($tuname,$tudom));
  } else {   } else {
Line 2377  sub storedata { Line 2416  sub storedata {
     } elsif ($cmd eq 'del') {      } elsif ($cmd eq 'del') {
  if ($tuname) {   if ($tuname) {
     if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') {      if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') {
       &log_parmset({$tkey=>''},1,$tuname,$tudom);
  $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));   $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));
     } else {      } else {
  $r->print('<h2><font color="red">'.   $r->print('<h2><font color="red">'.
Line 2394  sub storedata { Line 2434  sub storedata {
  if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,   if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,
  $tkey.'.type' => $typeof},   $tkey.'.type' => $typeof},
  $tudom,$tuname) eq 'ok') {   $tudom,$tuname) eq 'ok') {
       &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom);
     $r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom));      $r->print('<br />'.&mt('Stored modified date for').' '.&Apache::loncommon::plainname($tuname,$tudom));
  } else {   } else {
     $r->print('<h2><font color="red">'.      $r->print('<h2><font color="red">'.
Line 2414  sub storedata { Line 2455  sub storedata {
     my $putentries=$#newdatakeys+1;      my $putentries=$#newdatakeys+1;
     if ($delentries) {      if ($delentries) {
  if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') {   if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') {
       my %loghash=map { $_ => '' } @deldata;
       &log_parmset(\%loghash,1);
     $r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries));      $r->print('<h2>'.&mt('Deleted [_1] parameter(s)</h2>',$delentries));
  } else {   } else {
     $r->print('<h2><font color="red">'.      $r->print('<h2><font color="red">'.
Line 2423  sub storedata { Line 2466  sub storedata {
     }      }
     if ($putentries) {      if ($putentries) {
  if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {   if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
       &log_parmset(\%newdata,0);
     $r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>');      $r->print('<h3>'.&mt('Stored [_1] parameter(s)',$putentries/2).'</h3>');
  } else {   } else {
     $r->print('<h2><font color="red">'.      $r->print('<h2><font color="red">'.
Line 2548  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 2560  sub listdata { Line 2604  sub listdata {
       $jskey,        $jskey,
       $$resourcedata{$thiskey},        $$resourcedata{$thiskey},
       '',1,'','',$hour,$min,$sec).        '',1,'','',$hour,$min,$sec).
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'  '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
   &date_sanity_info($$resourcedata{$thiskey})
   );    );
     } elsif ($thistype eq 'string_yesno') {      } elsif ($thistype eq 'string_yesno') {
  my $showval;   my $showval;
Line 2600  sub listdata { Line 2645  sub listdata {
 }  }
   
 sub newoverview {  sub newoverview {
     my $r=shift;      my ($r) = @_;
     my $bodytag=&Apache::loncommon::bodytag('Set Parameters');  
     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 $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
 $html  $start_page
 <head>  
 <title>LON-CAPA Parameters</title>  
 </head>  
 $bodytag  
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=newoverview" name="parmform">  <form method="post" action="/adm/parmset?action=newoverview" name="parmform">
 ENDOVER  ENDOVER
Line 2719  ENDOVER Line 2760  ENDOVER
     }      }
     $r->print(&tableend().      $r->print(&tableend().
      ((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':'').       ((($env{'form.store'}) || ($env{'form.dis'}))?'<p><input type="submit" name="store" value="'.&mt('Store').'" /></p>':'').
       '</form></body></html>');        '</form>'.&Apache::loncommon::end_page());
 }  }
   
 sub secgroup_lister {  sub secgroup_lister {
Line 2758  sub secgroup_lister { Line 2799  sub secgroup_lister {
 }  }
   
 sub overview {  sub overview {
     my $r=shift;      my ($r) = @_;
     my $bodytag=&Apache::loncommon::bodytag('Modify Parameters');  
     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('Modify Parameters');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Overview');
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDOVER);      $r->print(<<ENDOVER);
 $html  $start_page
 <head>  
 <title>LON-CAPA Parameters</title>  
 </head>  
 $bodytag  
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=setoverview" name="parmform">  <form method="post" action="/adm/parmset?action=setoverview" name="parmform">
 ENDOVER  ENDOVER
Line 2791  ENDOVER Line 2828  ENDOVER
     my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder);      my $foundkeys=&listdata($r,$resourcedata,$resourcedata,$sortorder);
   
     $r->print(&tableend().'<p>'.      $r->print(&tableend().'<p>'.
  ($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form></body></html>');   ($foundkeys?'<input type="submit" value="'.&mt('Modify Parameters').'" />':&mt('There are no parameters.')).'</p></form>'.
         &Apache::loncommon::end_page());
 }  }
   
 ##################################################  ##################################################
Line 2940  Output html header for page Line 2978  Output html header for page
 ##################################################  ##################################################
 ##################################################  ##################################################
 sub header {  sub header {
     my $html=&Apache::lonxml::xmlbegin();      return &Apache::loncommon::start_page('Parameter Manager');
     my $bodytag=&Apache::loncommon::bodytag('Parameter Manager');  
     my $title = &mt('LON-CAPA Parameter Manager');  
     return(<<ENDHEAD);  
 $html  
 <head>  
 <title>$title</title>  
 </head>  
 $bodytag  
 ENDHEAD  
 }  }
 ##################################################  ##################################################
 ##################################################  ##################################################
Line 3001  ENDMAINFORMHEAD Line 3030  ENDMAINFORMHEAD
           { text => 'Set Parameter Setting Default Actions',            { text => 'Set Parameter Setting Default Actions',
             action => 'setdefaults',              action => 'setdefaults',
             permission => $parm_permission,              permission => $parm_permission,
               },          
     { text => 'Parameter Change Log and Course Blog Posting/User Notification',
               action => 'parameterchangelog',
               permission => $parm_permission,
             },              },
           );            );
     my $menu_html = '';      my $menu_html = '';
Line 3059  sub setrestrictmeta { Line 3092  sub setrestrictmeta {
     my $output;      my $output;
     my $item_num;      my $item_num;
     my $put_result;      my $put_result;
     $r->print(&Apache::lonxml::xmlbegin());      
     $r->print('<head>      $r->print(&Apache::loncommon::start_page('Restrict Metadata'));
             <title>LON-CAPA Restrict Metadata</title>  
             </head>');  
     $r->print(&Apache::loncommon::bodytag('Restrict Metadata'));  
     $r->print(&Apache::lonhtmlcommon::breadcrumbs(undef,      $r->print(&Apache::lonhtmlcommon::breadcrumbs(undef,
     'Restrict Metadata'));      'Restrict Metadata'));
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
Line 3111  sub setrestrictmeta { Line 3141  sub setrestrictmeta {
         <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">          <input type="submit" name="restrictmeta" value="Update Metadata Restrictions">
         </form>          </form>
 ENDenv  ENDenv
     $r->print('</body>      $r->print(&Apache::loncommon::end_page());
                 </html>');  
     return 'ok';      return 'ok';
 }  }
 ##################################################  ##################################################
   
 sub defaultsetter {  sub defaultsetter {
     my $r=shift;      my ($r) = @_;
     my $bodytag=&Apache::loncommon::bodytag('Parameter Setting Default Actions');  
     my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};      my $start_page = 
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};   &Apache::loncommon::start_page('Parameter Setting Default Actions');
     my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults');      my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs(undef,'Defaults');
     my $html=&Apache::lonxml::xmlbegin();  
     $r->print(<<ENDDEFHEAD);      $r->print(<<ENDDEFHEAD);
 $html  $start_page
 <head>  
 <title>LON-CAPA Parameters</title>  
 </head>  
 $bodytag  
 $breadcrumbs  $breadcrumbs
 <form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">  <form method="post" action="/adm/parmset?action=setdefaults" name="defaultform">
 ENDDEFHEAD  ENDDEFHEAD
   
       my $dom = $env{'course.'.$env{'request.course.id'}.'.domain'};
       my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     my @ids=();      my @ids=();
     my %typep=();      my %typep=();
     my %keyp=();      my %keyp=();
Line 3269  ENDYESNO Line 3296  ENDYESNO
         $r->print('</td></tr>');          $r->print('</td></tr>');
     }      }
     $r->print("</table>\n<input type='submit' name='storerules' value='".      $r->print("</table>\n<input type='submit' name='storerules' value='".
       &mt('Store Rules')."' /></form>\n</body>\n</html>");        &mt('Store Rules')."' /></form>\n".
         &Apache::loncommon::end_page());
     return;      return;
 }  }
   
   sub components {
       my ($key,$uname,$udom,$exeuser,$exedomain)=@_;
       my $typeflag=0;
       if ($key=~/\.type$/) {
    $key=~s/\.type$//;
           $typeflag=1;
       }
       my $issection;
       my ($middle,$part,$name)=($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
       my $section=&mt('All Students');
       if ($middle=~/^\[(.*)\]/) {
    $issection=$1;
    $section=&mt('Group/Section').': '.$issection;
    $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>';
       if ($middle=~/^(.+)\_\_\_\(all\)$/) {
    $realm='<font color="green">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><font color="#aaaaaa" size="-2">('.$1.')</font></font>';
       } elsif ($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>';
       }
       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 {
       my ($r)=@_;
       &startpage($r);
       my %parmlog=&Apache::lonnet::dump('nohist_parameterlog',
         $env{'course.'.$env{'request.course.id'}.'.domain'},
         $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'},
        $env{'course.'.$env{'request.course.id'}.'.domain'});
       $r->print('<table border="2">');
       my $bgcolor='#EEEEEE';
       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 $time =
       &Apache::lonlocal::locallocaltime($parmlog{$id.'_exe_time'});
    my $plainname = 
       &Apache::loncommon::plainname($parmlog{$id.'_exe_uname'},
     $parmlog{$id.'_exe_udom'});
    my $about_me_link = 
       &Apache::loncommon::aboutmewrapper($plainname,
          $parmlog{$id.'_exe_uname'},
          $parmlog{$id.'_exe_udom'});
    my $send_msg_link='';
    if ((($parmlog{$id.'_exe_uname'} ne $env{'user.name'}) 
        || ($parmlog{$id.'_exe_udom'} ne $env{'user.domain'}))) {
       $send_msg_link ='<br />'.
    &Apache::loncommon::messagewrapper(&mt('Send message'),
      $parmlog{$id.'_exe_uname'},
      $parmlog{$id.'_exe_udom'});
    }
    $r->print('<tr bgcolor="'.$bgcolor.'"><td rowspan="'.$count.'">'.$time.'</td>
                          <td rowspan="'.$count.'">'.$about_me_link.
     '<br /><tt>'.$parmlog{$id.'_exe_uname'}.
             ':'.$parmlog{$id.'_exe_udom'}.'</tt>'.
     $send_msg_link.'</td>');
    my $makenewrow=0;
    my %istype=();
    foreach my $changed (reverse(sort(@changes))) {
               my $value=$parmlog{$id.'_logentry'}->{$changed};
               my ($realm,$section,$parmname,$part,$typeflag,$what,$middle,$uname,$udom,$issection)=
    &components($changed,$parmlog{$id.'_uname'},$parmlog{$id.'_udom'});
       if ($typeflag) { $istype{$parmname}=$value; }
       if ($makenewrow) { $r->print('<tr bgcolor="'.$bgcolor.'">'); } else { $makenewrow=1; }
       $r->print('<td>'.$realm.'</td><td>'.$section.'</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'}) {
    $r->print(&mt('Deleted'));
       } else {
    if ($typeflag) {
       $r->print(&mt('Type: [_1]',&standard_parameter_names($value)));
    } else {
       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>');
       if ($stillactive) {
    if (($uname) && ($udom)) {
       $r->print('<td>Notify Link</td>');
    } else {
       $r->print('<td>Blog Link</td>');
    }
       } else {
    $r->print('<td>&nbsp;</td>');
       }
       $r->print('</tr>');
    }
       }
       $r->print('</table>');
       $r->print(&Apache::loncommon::end_page());
   }
   
 ##################################################  ##################################################
 ##################################################  ##################################################
   
Line 3365  sub handler { Line 3536  sub handler {
     text=>"Table Mode",      text=>"Table Mode",
     help => 'Course_Setting_Parameters'});      help => 'Course_Setting_Parameters'});
     &assessparms($r);      &assessparms($r);
         }          } elsif ($env{'form.action'} eq 'parameterchangelog' && $parm_permission) {
                       &Apache::lonhtmlcommon::add_breadcrumb({href=>'/adm/parmset?action=settable',
       text=>"Parameter Change Log"});
       &parm_change_log($r);
    }       
     } else {      } else {
 # ----------------------------- Not in a course, or not allowed to modify parms  # ----------------------------- Not in a course, or not allowed to modify parms
  $env{'user.error.msg'}=   $env{'user.error.msg'}=

Removed from v.1.276  
changed lines
  Added in v.1.293


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