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

version 1.305, 2006/05/15 23:40:54 version 1.321, 2006/07/14 17:44:11
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::longroup;
 use Apache::lonrss;  use Apache::lonrss;
   use LONCAPA;
   
 # --- Caches local to lonparmset  # --- Caches local to lonparmset
   
Line 91  Inputs:  $what - a parameter spec (inclu Line 93  Inputs:  $what - a parameter spec (inclu
   
 Returns:  A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels  Returns:  A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 14 possible levels
   
 14 - General Course  14- General Course
 13 - Map or Folder level in course  13- Map or Folder level in course
 12- resource default  12- resource default
 11- map default  11- map default
 10 - resource level in course  10- resource level in course
 9 - General for section  9 - General for section
 8 - Map or Folder level for section  8 - Map or Folder level for section
 7 - resource level in section  7 - resource level in section
Line 492  sub storeparm_by_symb_inner { Line 494  sub storeparm_by_symb_inner {
     }      }
           
     if ($reply=~/^error\:(.*)/) {      if ($reply=~/^error\:(.*)/) {
  return "<font color=red>Write Error: $1</font>";   return "<span class=\"LC_error\">Write Error: $1</span>";
     }      }
     return '';      return '';
 }  }
Line 506  sub storeparm_by_symb_inner { Line 508  sub storeparm_by_symb_inner {
   
 Format a value for output.  Format a value for output.
   
 Inputs:  $value, $type  Inputs:  $value, $type, $editable
   
 Returns: $value, formatted for output.  If $type indicates it is a date,  Returns: $value, formatted for output.  If $type indicates it is a date,
 localtime($value) is returned.  localtime($value) is returned.
   $editable will return an icon to click on
   
 =cut  =cut
   
 ##################################################  ##################################################
 ##################################################  ##################################################
 sub valout {  sub valout {
     my ($value,$type)=@_;      my ($value,$type,$editable)=@_;
     my $result = '';      my $result = '';
     # Values of zero are valid.      # Values of zero are valid.
     if (! $value && $value ne '0') {      if (! $value && $value ne '0') {
  $result = '&nbsp;&nbsp;';   if ($editable) {
       $result = '<img src="/adm/lonIcons/clickhere.gif" border="0" />';
    } else {
       $result='&nbsp;';
    }
     } else {      } else {
         if ($type eq 'date_interval') {          if ($type eq 'date_interval') {
             my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);              my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
Line 588  sub plink { Line 595  sub plink {
     return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'.      return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$marker.'" /></td></tr><tr><td align="center">'.
  '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"   '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
     .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.      .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
  &valout($value,$type).'</a></td></tr></table>';   &valout($value,$type,1).'</a></td></tr></table>';
 }  }
   
 sub page_js {  sub page_js {
Line 653  sub startpage { Line 660  sub startpage {
        &page_js(),         &page_js(),
        {'add_entries' => \%loaditems,});         {'add_entries' => \%loaditems,});
     my $breadcrumbs =       my $breadcrumbs = 
  &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting');   &Apache::lonhtmlcommon::breadcrumbs('Table Mode Parameter Setting','Table_Mode');
     $r->print(<<ENDHEAD);      $r->print(<<ENDHEAD);
 $start_page  $start_page
 $breadcrumbs  $breadcrumbs
Line 700  sub print_row { Line 707  sub print_row {
     }      }
     my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers');      my $automatic=&rulescache(($which=~/\_([^\_]+)$/)[0].'_triggers');
     if ($automatic) {      if ($automatic) {
  $parm.='<font color="red"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</font>';   $parm.='<span class="LC_warning"><br />'.&mt('Automatically sets').' '.join(', ',split(/\:/,$automatic)).'</span>';
     }      }
     $r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>');      $r->print('<td bgcolor='.$defbgone.'>'.$parm.'</td>');
         
Line 1055  sub parmmenu { Line 1062  sub parmmenu {
 </script>  </script>
 ENDSCRIPT  ENDSCRIPT
     $r->print();      $r->print();
     $r->print("\n<table><tr>");      $r->print("\n<table id=\"LC_parm_overview_parm_menu\"><tr>");
     my $cnt=0;      my $cnt=0;
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {      foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
  $r->print("\n<td><font size='-1'><label><input type='checkbox' name='pscat' ");   $r->print("\n<td><label><input type='checkbox' name='pscat' ");
  $r->print('value="'.$tempkey.'"');   $r->print('value="'.$tempkey.'"');
  if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {   if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
     $r->print(' checked');      $r->print(' checked');
  }   }
  $r->print('>'.$$allparms{$tempkey}.'</label></font></td>');   $r->print('>'.$$allparms{$tempkey}.'</label></td>');
   $cnt++;    $cnt++;
         if ($cnt==3) {          if ($cnt==3) {
     $r->print("</tr>\n<tr>");      $r->print("</tr>\n<tr>");
Line 1071  ENDSCRIPT Line 1078  ENDSCRIPT
  }   }
     }      }
     $r->print('      $r->print('
 </tr><tr><td>  </tr><tr id=\"LC_parm_overview_parm_menu_selectors\"><td>
 <a href="javascript:checkall(true, \'pscat\')">Select&nbsp;All</a><br />  <a href="javascript:checkall(true, \'pscat\')">Select&nbsp;All</a><br />
 <a href="javascript:checkstandard()">Select&nbsp;Common&nbsp;Only</a>  <a href="javascript:checkstandard()">Select&nbsp;Common&nbsp;Only</a>
 </td><td>  </td><td>
Line 1125  sub usermenu { Line 1132  sub usermenu {
     my %sectionhash = &Apache::loncommon::get_sections();      my %sectionhash = &Apache::loncommon::get_sections();
   
     my $groups;      my $groups;
     my %grouphash = &Apache::loncommon::coursegroups();      my %grouphash = &Apache::longroup::coursegroups();
   
     if (%sectionhash) {      if (%sectionhash) {
         $sections=$lt{'se'}.': <select name="csec"';          $sections=$lt{'se'}.': <select name="csec"';
Line 1265  sub sectionmenu { Line 1272  sub sectionmenu {
   
 sub groupmenu {  sub groupmenu {
     my ($r,$selectedgroups)=@_;      my ($r,$selectedgroups)=@_;
     my %grouphash = &Apache::loncommon::coursegroups();      my %grouphash = &Apache::longroup::coursegroups();
     return if (!%grouphash);      return if (!%grouphash);
   
     $r->print('<select name="Group" multiple="true" size="8" >');      $r->print('<select name="Group" multiple="true" size="8" >');
Line 1475  sub assessparms { Line 1482  sub assessparms {
     $id='';      $id='';
  } else {   } else {
     $message=      $message=
  "<font color=red>".&mt("Unknown ID")." '$id' ".   '<span class="LC_error">'.&mt("Unknown ID")." '$id' ".
  &mt('at domain')." '$udom'</font>";   &mt('at domain')." '$udom'</span>";
  }   }
     } else {      } else {
  $uname=$env{'form.uname'};   $uname=$env{'form.uname'};
Line 1487  sub assessparms { Line 1494  sub assessparms {
  $uhome=&Apache::lonnet::homeserver($uname,$udom);   $uhome=&Apache::lonnet::homeserver($uname,$udom);
         if ($uhome eq 'no_host') {          if ($uhome eq 'no_host') {
     $message=      $message=
  "<font color=red>".&mt("Unknown user")." '$uname' ".   '<span class="LC_error">'.&mt("Unknown user")." '$uname' ".
  &mt("at domain")." '$udom'</font>";   &mt("at domain")." '$udom'</span>";
     $uname='';      $uname='';
         } else {          } else {
     $csec=&Apache::lonnet::getsection($udom,$uname,      $csec=&Apache::lonnet::getsection($udom,$uname,
       $env{'request.course.id'});        $env{'request.course.id'});
                           
     if ($csec eq '-1') {      if ($csec eq '-1') {
  $message="<font color=red>".   $message='<span class="LC_error">'.
     &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".      &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".
     &mt("not in this course")."</font>";      &mt("not in this course")."</span>";
  $uname='';   $uname='';
  $csec=$env{'form.csec'};   $csec=$env{'form.csec'};
                 $cgroup=$env{'form.cgroup'};                  $cgroup=$env{'form.cgroup'};
Line 1512  sub assessparms { Line 1519  sub assessparms {
             @usersgroups = &Apache::lonnet::get_users_groups(              @usersgroups = &Apache::lonnet::get_users_groups(
                                        $udom,$uname,$env{'request.course.id'});                                         $udom,$uname,$env{'request.course.id'});
             if (@usersgroups > 0) {              if (@usersgroups > 0) {
                 unless (grep/^\Q$cgroup\E$/,@usersgroups) {                  unless (grep(/^\Q$cgroup\E$/,@usersgroups)) {
                     $cgroup = $usersgroups[0];                      $cgroup = $usersgroups[0];
                 }                  }
             }              }
Line 1570  sub assessparms { Line 1577  sub assessparms {
  &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);   &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
     } else {      } else {
         my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);          my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
         $r->print(&mt('Specific Resource').": ".$resource.   my $title = &Apache::lonnet::gettitle($pssymb);
                   '<input type="hidden" value="'.$pssymb.'" name="symb">'.          $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource).
                     '<input type="hidden" value="'.$pssymb.'" name="symb" />'.
   '<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.    '<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.
   ($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');    ($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');
     }      }
Line 1731  ENDTABLEHEADFOUR Line 1739  ENDTABLEHEADFOUR
                              '</font></tt><p><b>'.                               '</font></tt><p><b>'.
                              "<a href=\"javascript:openWindow('".                               "<a href=\"javascript:openWindow('".
   &Apache::lonnet::clutter($uri).'?symb='.    &Apache::lonnet::clutter($uri).'?symb='.
   &Apache::lonnet::escape($symbp{$rid}).    &escape($symbp{$rid}).
                              "', 'metadatafile', '450', '500', 'no', 'yes')\";".                               "', 'metadatafile', '450', '500', 'no', 'yes')\";".
                              " TARGET=_self>$title");                               " TARGET=_self>$title");
   
Line 1930  ENDMAPONE Line 1938  ENDMAPONE
             }              }
                           
             if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")};              if ($csec) {$r->print(&mt("Section")."<font color=\"red\"> <i>$csec</i></font>\n")};
             if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$csec</i></font>\n")};              if ($cgroup) {$r->print(&mt("Group")."<font color=\"red\"> <i>$cgroup</i></font>\n")};
             $r->print("</h4>\n");              $r->print("</h4>\n");
 #---------------------------------------------------------------- print table  #---------------------------------------------------------------- print table
             $r->print('<p><table border="2">');              $r->print('<p><table border="2">');
Line 2075  sub crsenv { Line 2083  sub crsenv {
             }              }
         }          }
     }      }
   
       my $start_table     =&Apache::loncommon::start_data_table();
       my $start_header_row=&Apache::loncommon::start_data_table_header_row();
       my $end_header_row  =&Apache::loncommon::end_data_table_header_row();
 # ------------------------- 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'},
Line 2091  sub crsenv { Line 2103  sub crsenv {
     ('url'            => '<b>'.&mt('Top Level Map').'</b> '.      ('url'            => '<b>'.&mt('Top Level Map').'</b> '.
                                  '<a href="javascript:openbrowser'.                                   '<a href="javascript:openbrowser'.
                                  "('envform','url','sequence')\">".                                   "('envform','url','sequence')\">".
                                  &mt('Select Map').'</a><br /><font color=red> '.                                   &mt('Select Map').'</a><br /><span class="LC_warning"> '.
                                  &mt('Modification may make assessment data inaccessible').                                   &mt('Modification may make assessment data inaccessible').
                                  '</font>',                                   '</span>',
              'description'    => '<b>'.&mt('Course Description').'</b>',               'description'    => '<b>'.&mt('Course Description').'</b>',
              'courseid'       => '<b>'.&mt('Course ID or number').               'courseid'       => '<b>'.&mt('Course ID or number').
                                  '</b><br />'.                                   '</b><br />'.
Line 2164  sub crsenv { Line 2176  sub crsenv {
                     '('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')',                      '('.&mt('or set value to "[_1]" to allow all roles',"<tt>yes</tt>").')',
      'rndseed'       'rndseed'
          => '<b>'.&mt('Randomization algorithm used').'</b> <br />'.           => '<b>'.&mt('Randomization algorithm used').'</b> <br />'.
                     '<font color="red">'.&mt('Modifying this will make problems').' '.                      '<span class="LC_error">'.&mt('Modifying this will make problems').' '.
                     &mt('have different numbers and answers').'</font>',                      &mt('have different numbers and answers').'</span>',
      'receiptalg'       'receiptalg'
          => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.           => '<b>'.&mt('Receipt algorithm used').'</b> <br />'.
                     &mt('This controls how receipt numbers are generated.'),                      &mt('This controls how receipt numbers are generated.'),
Line 2180  sub crsenv { Line 2192  sub crsenv {
                     ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'.                       ' ('.&mt('supported types').': Letter [8 1/2x11 in], Legal [8 1/2x14 in],'. 
                     ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'.                       ' Tabloid [11x17 in], Executive [7 1/2x10 in], A2 [420x594 mm],'. 
                     ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',                      ' A3 [297x420 mm], A4 [210x297 mm], A5 [148x210 mm], A6 [105x148 mm])',
        'print_header_format'
            => '<b>Print header format; substitutions:  %n student name %c course id %a assignment',
              'anonymous_quiz'               'anonymous_quiz'
                  => '<b>'.&mt('Anonymous quiz/exam').'</b><br />'.                   => '<b>'.&mt('Anonymous quiz/exam').'</b><br />'.
                     ' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)',                      ' (<tt><b>'.&mt('yes').'</b> '.&mt('to avoid print students names').' </tt>)',
Line 2191  sub crsenv { Line 2205  sub crsenv {
              'disable_receipt_display'               'disable_receipt_display'
                  => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.                   => '<b>'.&mt('Disable display of problem receipts').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
        'task_messages'
            => '<b>'.&mt('Send message to student when clicking Done on Tasks. [_1] to send a message only to student, [_2] to send message to student and add record to user information page for instructors. Leave blank to disable.','<tt>only_student</tt>','<tt>student_and_user_notes_screen</tt>').'</b>',
      'disablesigfigs'       'disablesigfigs'
          => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.           => '<b>'.&mt('Disable checking of Significant Figures').'</b><br />'.
                     ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',                      ' ('.&mt('"[_1]" to disable, anything else if not','<tt>yes</tt>').')',
Line 2218  sub crsenv { Line 2234  sub crsenv {
                              'problem_stream_switch',                               'problem_stream_switch',
      'suppress_tries',       'suppress_tries',
                              'default_paper_size',                               'default_paper_size',
        'print_header_format',
                              'disable_receipt_display',                               'disable_receipt_display',
                              'spreadsheet_default_classcalc',                               'spreadsheet_default_classcalc',
                              'spreadsheet_default_studentcalc',                               'spreadsheet_default_studentcalc',
Line 2227  sub crsenv { Line 2244  sub crsenv {
                              'default_enrollment_end_date',                               'default_enrollment_end_date',
      'tthoptions',       'tthoptions',
      'disablesigfigs',       'disablesigfigs',
      'disableexampointprint'       'disableexampointprint',
        'task_messages'
                              );                               );
  foreach my $parameter (sort(keys(%values))) {   foreach my $parameter (sort(keys(%values))) {
             unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {              unless (($parameter =~ m/^internal\./)||($parameter =~ m/^metadata\./)) {
Line 2237  sub crsenv { Line 2255  sub crsenv {
                 }                  }
             }              }
  }   }
   
         foreach my $parameter (@Display_Order) {          foreach my $parameter (@Display_Order) {
             my $description = $descriptions{$parameter};              my $description = $descriptions{$parameter};
             # onchange is javascript to automatically check the 'Set' button.              # onchange is javascript to automatically check the 'Set' button.
             my $onchange = 'onFocus="javascript:window.document.forms'.              my $onchange = 'onFocus="javascript:window.document.forms'.
                 "['envform'].elements['".$parameter."_setparmval']".                  "['envform'].elements['".$parameter."_setparmval']".
                 '.checked=true;"';                  '.checked=true;"';
             $output .= '<tr><td>'.$description.'</td>';              $output .= &Apache::loncommon::start_data_table_row().
    '<td>'.$description.'</td>';
             if ($parameter =~ /^default_enrollment_(start|end)_date$/) {              if ($parameter =~ /^default_enrollment_(start|end)_date$/) {
                 $output .= '<td>'.                  $output .= '<td>'.
                     &Apache::lonhtmlcommon::date_setter('envform',                      &Apache::lonhtmlcommon::date_setter('envform',
Line 2260  sub crsenv { Line 2280  sub crsenv {
             $output .= '<td>'.              $output .= '<td>'.
                 &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').                  &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
                 '</td>';                  '</td>';
             $output .= "</tr>\n";              $output .= &Apache::loncommon::end_data_table_row()."\n";
  }   }
         my $onchange = 'onFocus="javascript:window.document.forms'.          my $onchange = 'onFocus="javascript:window.document.forms'.
             '[\'envform\'].elements[\'newp_setparmval\']'.              '[\'envform\'].elements[\'newp_setparmval\']'.
             '.checked=true;"';              '.checked=true;"';
  $output.='<tr><td><i>'.&mt('Create New Environment Variable').'</i><br />'.   $output.=&Apache::loncommon::start_data_table_row().
       '<td><i>'.&mt('Create New Environment Variable').'</i><br />'.
     '<input type="text" size=40 name="newp_name" '.      '<input type="text" size=40 name="newp_name" '.
                 $onchange.' /></td><td>'.                  $onchange.' /></td><td>'.
             '<input type="text" size=40 name="newp_value" '.              '<input type="text" size=40 name="newp_value" '.
                 $onchange.' /></td><td>'.                  $onchange.' /></td><td>'.
     '<input type="checkbox" name="newp_setparmval" /></td></tr>';      '<input type="checkbox" name="newp_setparmval" /></td>'.
       &Apache::loncommon::end_data_table_row()."\n";
     }      }
     my %lt=&Apache::lonlocal::texthash(      my %lt=&Apache::lonlocal::texthash(
     'par'   => 'Parameter',      'par'   => 'Parameter',
Line 2292  sub crsenv { Line 2314  sub crsenv {
        $browse_js);         $browse_js);
     my $end_page =       my $end_page = 
  &Apache::loncommon::end_page();   &Apache::loncommon::end_page();
       my $end_table=&Apache::loncommon::end_data_table();
     $r->print(<<ENDENV);      $r->print(<<ENDENV);
 $start_page  $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
 <p>  $start_table
 <table border=2>  $start_header_row
 <tr><th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th></tr>  <th>$lt{'par'}</th><th>$lt{'val'}</th><th>$lt{'set'}?</th>
   $end_header_row
 $output  $output
 </table>  $end_table
 <input type="submit" name="crsenv" value="$lt{'sce'}">  <input type="submit" name="crsenv" value="$lt{'sce'}">
 </form>  </form>
 $end_page  $end_page
Line 2388  sub storedata { Line 2412  sub storedata {
     $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 {
     $r->print('<h2><font color="red">'.      $r->print('<div class="LC_error">'.
       &mt('Error storing parameters').'</font></h2>');        &mt('Error storing parameters').'</div>');
  }   }
  &Apache::lonnet::devalidateuserresdata($tuname,$tudom);   &Apache::lonnet::devalidateuserresdata($tuname,$tudom);
     } else {      } else {
Line 2403  sub storedata { Line 2427  sub storedata {
     &log_parmset({$tkey=>''},1,$tuname,$tudom);      &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('<div class="LC_error">'.
   &mt('Error deleting parameters').'</font></h2>');    &mt('Error deleting parameters').'</div>');
     }      }
     &Apache::lonnet::devalidateuserresdata($tuname,$tudom);      &Apache::lonnet::devalidateuserresdata($tuname,$tudom);
  } else {   } else {
Line 2421  sub storedata { Line 2445  sub storedata {
     &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom);      &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('<div class="LC_error">'.
       &mt('Error storing parameters').'</font></h2>');        &mt('Error storing parameters').'</div>');
  }   }
  &Apache::lonnet::devalidateuserresdata($tuname,$tudom);   &Apache::lonnet::devalidateuserresdata($tuname,$tudom);
     } else {      } else {
Line 2443  sub storedata { Line 2467  sub storedata {
     &log_parmset(\%loghash,1);      &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('<div class="LC_error">'.
       &mt('Error deleting parameters').'</font></h2>');        &mt('Error deleting parameters').'</div>');
  }   }
  &Apache::lonnet::devalidatecourseresdata($crs,$dom);   &Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }      }
Line 2453  sub storedata { Line 2477  sub storedata {
     &log_parmset(\%newdata,0);      &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('<div class="LC_error">'.
       &mt('Error storing parameters').'</font></h2>');        &mt('Error storing parameters').'</div>');
  }   }
  &Apache::lonnet::devalidatecourseresdata($crs,$dom);   &Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }      }
Line 2529  sub listdata { Line 2553  sub listdata {
     }      }
     $middle=~s/\.+$//;      $middle=~s/\.+$//;
     $middle=~s/^\.+//;      $middle=~s/^\.+//;
     my $realm='<font color="red">'.&mt('All Resources').'</font>';      my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>';
     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='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <br /><span class="LC_parm_folder">('.$1.')</span></span>';
     } elsif ($middle) {      } 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='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>';
     }      }
     if ($sortorder eq 'realmstudent') {      if ($sortorder eq 'realmstudent') {
  if ($realm ne $oldrealm) {   if ($realm ne $oldrealm) {
Line 2561  sub listdata { Line 2585  sub listdata {
     }      }
     if ($part ne $oldpart) {      if ($part ne $oldpart) {
  $r->print(&tableend().   $r->print(&tableend().
   "\n<font color='blue'>".&mt('Part').": $part</font>");    "\n<span class=\"LC_parm_part\">".&mt('Part').": $part</span>");
  $oldpart=$part;   $oldpart=$part;
     }      }
 #  #
Line 2694  ENDOVER Line 2718  ENDOVER
   
 # Menu to select levels, etc  # Menu to select levels, etc
   
     $r->print('<table border="1"><tr><td>');      $r->print('<table id="LC_parm_overview_scope">
                  <tr><td class="LC_parm_overview_level_menu">');
     &levelmenu($r,\%alllevs,$parmlev);      &levelmenu($r,\%alllevs,$parmlev);
     if ($parmlev ne 'general') {      if ($parmlev ne 'general') {
  $r->print('<td>');   $r->print('<td class="LC_parm_overview_map_menu">');
  &mapmenu($r,\%allmaps,$pschp,\%maptitles);   &mapmenu($r,\%allmaps,$pschp,\%maptitles);
  $r->print('</td>');   $r->print('</td>');
     }      }
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
   
     $r->print('<table border="1"><tr><td>');        $r->print('<table id="LC_parm_overview_controls">
                  <tr><td class="LC_parm_overview_parm_selectors">');  
     &parmmenu($r,\%allparms,\@pscat,\%keyorder);      &parmmenu($r,\%allparms,\@pscat,\%keyorder);
     $r->print('</td><td><table border="0" cellspacing="0" cellpadding="0">'.      $r->print('</td><td class="LC_parm_overview_restrictions">
               '<tr><td>'.&mt('Parts').'</td><td></td><td>'.&mt('Section(s)').                  <table class="LC_parm_overview_restrictions">'.
               '</td><td></td><td>'.&mt('Group(s)').'</td></tr><tr><td>');                '<tr><th>'.&mt('Parts').'</th><th>'.&mt('Section(s)').
                 '</th><th>'.&mt('Group(s)').'</th></tr><tr><td>');
     &partmenu($r,\%allparts,\@psprt);      &partmenu($r,\%allparts,\@psprt);
     $r->print('</td><td>&nbsp;</td><td>');      $r->print('</td><td>');
     &sectionmenu($r,\@selected_sections);      &sectionmenu($r,\@selected_sections);
     $r->print('</td><td>&nbsp;</td><td>');      $r->print('</td><td>');
     &groupmenu($r,\@selected_groups);      &groupmenu($r,\@selected_groups);
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
Line 3030  ENDMAINFORMHEAD Line 3057  ENDMAINFORMHEAD
  }   }
         next if (! $menu_item->{'permission'});          next if (! $menu_item->{'permission'});
         $menu_html.='<p>';          $menu_html.='<p>';
         $menu_html.='<font size="+1">';          $menu_html.='<span class="LC_parm_menu_item">';
         if (exists($menu_item->{'url'})) {          if (exists($menu_item->{'url'})) {
             $menu_html.=qq{<a href="$menu_item->{'url'}">};              $menu_html.=qq{<a href="$menu_item->{'url'}">};
         } else {          } else {
             $menu_html.=              $menu_html.=
                 qq{<a href="/adm/parmset?action=$menu_item->{'action'}">};                  qq{<a href="/adm/parmset?action=$menu_item->{'action'}">};
         }          }
         $menu_html.= &mt($menu_item->{'text'}).'</a></font>';          $menu_html.= &mt($menu_item->{'text'}).'</a></span>';
         if (exists($menu_item->{'help'})) {          if (exists($menu_item->{'help'})) {
             $menu_html.=              $menu_html.=
                 &Apache::loncommon::help_open_topic($menu_item->{'help'});                  &Apache::loncommon::help_open_topic($menu_item->{'help'});
Line 3226  ENDDEFHEAD Line 3253  ENDDEFHEAD
     }      }
 $r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'.  $r->print(&mt('Manual setting rules apply to all interfaces.').'<br />'.
   &mt('Automatic setting rules apply to table mode interfaces only.'));    &mt('Automatic setting rules apply to table mode interfaces only.'));
     $r->print("\n<table border='1'><tr><th>".&mt('Rule for parameter').'</th><th>'.      $r->print("\n".&Apache::loncommon::start_data_table().
       &mt('Action').'</th><th>'.&mt('Value').'</th></tr>');        &Apache::loncommon::start_data_table_header_row().
         "<th>".&mt('Rule for parameter').'</th><th>'.
         &mt('Action').'</th><th>'.&mt('Value').'</th>'.
         &Apache::loncommon::end_data_table_header_row());
     foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) {      foreach my $tempkey (&keysindisplayorder(\%allparms,\%keyorder)) {
  unless ($tempkey) { next; }   unless ($tempkey) { next; }
  $r->print("\n<tr><td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>');   $r->print("\n".&Apache::loncommon::start_data_table_row().
     "<td>".$allparms{$tempkey}."\n<br />(".$tempkey.')</td><td>');
  my $action=&rulescache($tempkey.'_action');   my $action=&rulescache($tempkey.'_action');
  $r->print('<select name="'.$tempkey.'_action">');   $r->print('<select name="'.$tempkey.'_action">');
  if (&isdateparm($defkeytype{$tempkey})) {   if (&isdateparm($defkeytype{$tempkey})) {
Line 3279  ENDYESNO Line 3310  ENDYESNO
         } else {          } else {
     $r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />');      $r->print('<input type="text" size="20" name="'.$tempkey.'_value" value="'.&rulescache($tempkey.'_value').'" />');
  }   }
         $r->print('</td></tr>');          $r->print('</td>'.&Apache::loncommon::end_data_table_row());
     }      }
     $r->print("</table>\n<input type='submit' name='storerules' value='".      $r->print(&Apache::loncommon::end_data_table().
         "\n<input type='submit' name='storerules' value='".
       &mt('Store Rules')."' /></form>\n".        &mt('Store Rules')."' /></form>\n".
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
     return;      return;
Line 3308  sub components { Line 3340  sub components {
  $section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom);   $section=&mt('User').": ".&Apache::loncommon::plainname($uname,$udom);
  $issection='';   $issection='';
     }      }
     my $realm='<font color="red">'.&mt('All Resources').'</font>';      my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>';
     my $realmdescription=&mt('all resources');       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='<span class="LC_parm_scope_folder">'.&mt('Folder/Map').': '.&Apache::lonnet::gettitle($1).' <span class="LC_parm_folder"><br />('.$1.')</span></span>';
   $realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1);    $realmdescription=&mt('folder').' '.&Apache::lonnet::gettitle($1);
    } elsif ($middle) {     } 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='<span class="LC_parm_scope_resource">'.&mt('Resource').': '.&Apache::lonnet::gettitle($middle).' <br /><span class="LC_parm_symb">('.$url.' in '.$map.' id: '.$id.')</span></span>';
  $realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle);   $realmdescription=&mt('resource').' '.&Apache::lonnet::gettitle($middle);
     }      }
     my $what=$part.'.'.$name;      my $what=$part.'.'.$name;
Line 3332  sub standard_parameter_names { Line 3364  sub standard_parameter_names {
    'weight' => 'Weight',     'weight' => 'Weight',
    'date_start' => 'Starting Date',     'date_start' => 'Starting Date',
    'date_end' => 'Ending Date',     'date_end' => 'Ending Date',
                                                      'interval' => 'Time Interval Length',
                                                      'tol' => 'Numerical Tolerance',
                                                      'sig' => 'Significant Digits',
                                                      'contentopen' => 'Content Opening Date',
                                                      'contentclose' => 'Content Closing Date',
                                                      'discussend' => 'End of Discussion Time',
                                                      'discusshide' => 'Discussion Hidden',
                                                      'problemstatus' => 'Problem Status Visible',
    'int_pos' => 'Positive Integer',     'int_pos' => 'Positive Integer',
    'int_zero_pos' => 'Positive Integer or Zero',     'int_zero_pos' => 'Positive Integer or Zero',
    'hinttries' => 'Number of Tries till Hints appear');     'hinttries' => 'Number of Tries till Hints appear',
                                                      'numbubbles' => 'Number of Bubbles in Exam Mode');
     if ($standard_parms{$name}) {      if ($standard_parms{$name}) {
  return $standard_parms{$name};    return $standard_parms{$name}; 
     } else {       } else { 
Line 3342  sub standard_parameter_names { Line 3383  sub standard_parameter_names {
     }      }
 }  }
   
   #
   # Parameter Change Log
   #
   
   
 sub parm_change_log {  sub parm_change_log {
     my ($r)=@_;      my ($r)=@_;
     &startpage($r);      &startpage($r);
     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); }      if ((keys(%parmlog))[0]=~/^error\:/) { undef(%parmlog); }
   
       $r->print('<form action="/adm/parmset?action=settable"
                        method="post" name"parameterlog">
                  <input type="hidden" name="action"
                         value="parameterchangelog" />');
       
       my %saveable_parameters = ('show' => 'scalar',);
       &Apache::loncommon::store_course_settings('parameter_log',
                                                 \%saveable_parameters);
       &Apache::loncommon::restore_course_settings('parameter_log',
                                                   \%saveable_parameters);
       if (!$env{'form.show'}) { $env{'form.show'}=10; }
   
       my $countselect =
    &Apache::lonmeta::selectbox('show',$env{'form.show'},undef,
       (&mt('all'),10,20,50,100,1000,10000));
   
       $r->print('<nobr>'.&mt('[_1] Records',$countselect).'</nobr>'.
         '<input type="submit" value="'.&mt('Display').'" />');
   
     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(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().      $r->print(&Apache::loncommon::start_data_table().&Apache::loncommon::start_data_table_header_row().
       '<th>'.&mt('Time').'</th><th>'.&mt('User').'</th><th>'.&mt('Extent').'</th><th>'.&mt('Users').'</th><th>'.        '<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>'.        &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;
     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=$#changes+1;   my $count=$#changes+1;
Line 3408  sub parm_change_log { Line 3475  sub parm_change_log {
  $r->print($value);   $r->print($value);
     }      }
     if ($value ne $all[$level]) {      if ($value ne $all[$level]) {
  $r->print('<br /><font color="red">'.&mt('Not active anymore').'</font>');   $r->print('<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>');
     } else {      } else {
  $stillactive=1;   $stillactive=1;
     }      }
Line 3433  sub parm_change_log { Line 3500  sub parm_change_log {
     }      }
     $r->print(&Apache::loncommon::end_data_table_row());      $r->print(&Apache::loncommon::end_data_table_row());
  }   }
    $shown++;
    if (!($env{'form.show'} eq &mt('all') 
         || $shown<=$env{'form.show'})) { last; }
     }      }
     $r->print(&Apache::loncommon::end_data_table());      $r->print(&Apache::loncommon::end_data_table());
       $r->print('</form>');
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
 }  }
   

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


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