Diff for /loncom/interface/lonparmset.pm between versions 1.411 and 1.413

version 1.411, 2008/10/10 10:54:03 version 1.413, 2008/10/23 14:26:17
Line 325  sub date_sanity_info { Line 325  sub date_sanity_info {
    my $crsprefix='course.'.$env{'request.course.id'}.'.';     my $crsprefix='course.'.$env{'request.course.id'}.'.';
    if ($env{$crsprefix.'default_enrollment_end_date'}) {     if ($env{$crsprefix.'default_enrollment_end_date'}) {
       if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {        if ($checkdate>$env{$crsprefix.'default_enrollment_end_date'}) {
          $result.='<br />'.&mt('After course enrollment end!');           $result.='<div class="LC_warning">'
                    .&mt('After course enrollment end!')
                    .'</div>';
       }        }
    }     }
    if ($env{$crsprefix.'default_enrollment_start_date'}) {     if ($env{$crsprefix.'default_enrollment_start_date'}) {
       if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {        if ($checkdate<$env{$crsprefix.'default_enrollment_start_date'}) {
          $result.='<br />'.&mt('Before course enrollment start!');           $result.='<div class="LC_warning">'
                    .&mt('Before course enrollment start!')
                    .'</div>';
       }        }
    }     }
   # Preparation for additional warnings about dates in the past/future.
   # An improved, more context sensitive version is recommended,
   # e.g. warn for due and answer dates which are defined before the corresponding open date, etc.
   #   if ($checkdate<time) {
   #      $result.='<div class="LC_info">'
   #              .'('.&mt('in the past').')'
   #              .'</div>';
   #      }
   #   if ($checkdate>time) {
   #      $result.='<div class="LC_info">'
   #              .'('.&mt('in the future').')'
   #              .'</div>';
   #      }
    return $result;     return $result;
 }  }
 ##################################################  ##################################################
Line 551  sub valout { Line 568  sub valout {
     } 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);
               my @timer;
             $year=$year-70;              $year=$year-70;
             $mday--;              $mday--;
             if ($year) {              if ($year) {
  $result.=$year.' yrs ';  #               $result.=&mt('[quant,_1,yr]',$year).' ';
                   push(@timer,&mt('[quant,_1,yr]',$year));
             }              }
             if ($mon) {              if ($mon) {
  $result.=$mon.' mths ';  #               $result.=&mt('[quant,_1,mth]',$mon).' ';
                   push(@timer,&mt('[quant,_1,mth]',$mon));
             }              }
             if ($mday) {              if ($mday) {
  $result.=$mday.' days ';  #               $result.=&mt('[quant,_1,day]',$mday).' ';
                   push(@timer,&mt('[quant,_1,day]',$mday));
             }              }
             if ($hour) {              if ($hour) {
  $result.=$hour.' hrs ';  #               $result.=&mt('[quant,_1,hr]',$hour).' ';
                   push(@timer,&mt('[quant,_1,hr]',$hour));
             }              }
             if ($min) {              if ($min) {
  $result.=$min.' mins ';  #               $result.=&mt('[quant,_1,min]',$min).' ';
                   push(@timer,&mt('[quant,_1,min]',$min));
             }              }
             if ($sec) {              if ($sec) {
  $result.=$sec.' secs ';  #               $result.=&mt('[quant,_1,sec]',$sec).' ';
                   push(@timer,&mt('[quant,_1,sec]',$sec));
             }              }
             $result=~s/\s+$//;  #           $result=~s/\s+$//;
               if (!@timer) { # Special case: all entries 0 -> display "0 secs" intead of empty field to keep this field editable
                   push(@timer,&mt('[quant,_1,sec]',0));
               }
               $result.=join(", ",@timer);
         } elsif (&isdateparm($type)) {          } elsif (&isdateparm($type)) {
             $result = &Apache::lonlocal::locallocaltime($value).              $result = &Apache::lonlocal::locallocaltime($value).
  &date_sanity_info($value);   &date_sanity_info($value);
Line 973  sub extractResourceInformation { Line 1001  sub extractResourceInformation {
     if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {      if (!exists($$allparms{$name}) || $$allparms{$name} =~ m/^\s*$/ ) {
  my $display= &Apache::lonnet::metadata($srcf,$key.'.display');   my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
  my $parmdis = $display;   my $parmdis = $display;
  $parmdis =~ s/ \[Part.*$//g;   $parmdis =~ s/\s*\[Part.*$//g;
  $$allparms{$name}=$parmdis;   $$allparms{$name}=$parmdis;
  if (ref($defkeytype)) {   if (ref($defkeytype)) {
     $$defkeytype{$name}=      $$defkeytype{$name}=
Line 1185  sub usermenu { Line 1213  sub usermenu {
     my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.      my $chooseopt=&Apache::loncommon::select_dom_form($udom,'udom').' '.
         &Apache::loncommon::selectstudent_link('parmform','uname','udom');          &Apache::loncommon::selectstudent_link('parmform','uname','udom');
     my $selscript=&Apache::loncommon::studentbrowser_javascript();      my $selscript=&Apache::loncommon::studentbrowser_javascript();
     my %lt=&Apache::lonlocal::texthash(  
     'se'    => "Section",  
                     'gr'    => "Group",  
     'fu'    => "For User",  
     'oi'    => "or ID",  
     'ad'    => "at Domain"  
        );  
     my $sections='';      my $sections='';
     my %sectionhash = &Apache::loncommon::get_sections();      my %sectionhash = &Apache::loncommon::get_sections();
   
     my $groups;      my $groups;
     my %grouphash = &Apache::longroup::coursegroups();      my %grouphash = &Apache::longroup::coursegroups();
   
       my $g_s_header='';
       my $g_s_footer='';
   
     if (%sectionhash) {      if (%sectionhash) {
         $sections=$lt{'se'}.': <select name="csec"';          $sections=&mt('Section:').' <select name="csec"';
         if (%grouphash && $parmlev ne 'full') {          if (%grouphash && $parmlev ne 'full') {
             $sections .= qq| onchange="group_or_section('csec')" |;              $sections .= qq| onchange="group_or_section('csec')" |;
         }          }
Line 1211  sub usermenu { Line 1236  sub usermenu {
         }          }
         $sections.='</select>';          $sections.='</select>';
     }      }
   
     if (%sectionhash && %grouphash && $parmlev ne 'full') {      if (%sectionhash && %grouphash && $parmlev ne 'full') {
         $sections .= '&nbsp;or&nbsp;';          $sections .= '&nbsp;'.&mt('or').'&nbsp;';
         $sections .= qq|          $sections .= qq|
 <script type="text/javascript">  <script type="text/javascript">
 function group_or_section(caller) {  function group_or_section(caller) {
Line 1239  function group_or_section(caller) { Line 1265  function group_or_section(caller) {
     }       } 
   
     if (%grouphash) {      if (%grouphash) {
         $groups=$lt{'gr'}.': <select name="cgroup"';          $groups=&mt('Group:').' <select name="cgroup"';
         if (%sectionhash && $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')" |;
         }          }
Line 1261  function group_or_section(caller) { Line 1287  function group_or_section(caller) {
         }          }
         $groups.='</select>';          $groups.='</select>';
     }      }
     $r->print(<<ENDMENU);  
 <b>      if (%sectionhash || %grouphash) {
 $sections          $g_s_header='<fieldset><legend>'.&mt('Group/Section').'</legend><div>';
 $groups          $g_s_footer='</div></fieldset>';
 <br />      }
 $lt{'fu'}   
 <input type="text" value="$uname" size="12" name="uname" />      $r->print('<b>'
 $lt{'oi'}               .$g_s_header
 <input type="text" value="$id" size="12" name="id" />                .$sections
 $lt{'ad'}               .$groups
 $chooseopt               .$g_s_footer
 </b>               .'<fieldset><legend>'.&mt('User').'</legend><div>'
 ENDMENU               .&mt('For User [_1] or Student/Employee ID [_2] at Domain [_3]'
                    ,'<input type="text" value="'.$uname.'" size="12" name="uname" />'
                    ,'<input type="text" value="'.$id.'" size="12" name="id" /> '
                    ,$chooseopt)
                .'</div></fieldset>'
                .'</b>'
       );
 }  }
   
 sub displaymenu {  sub displaymenu {
Line 1281  sub displaymenu { Line 1313  sub displaymenu {
     $r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'.      $r->print('<table border="1"><tr><th>'.&mt('Select Parameters to View').'</th><th>'.
      &mt('Select Parts to View').'</th></tr><tr><td>');         &mt('Select Parts to View').'</th></tr><tr><td>');  
     &parmmenu($r,$allparms,$pscat,$keyorder);      &parmmenu($r,$allparms,$pscat,$keyorder);
     $r->print('</td><td>');      $r->print('</td><td valign="top" align="center">');
     &partmenu($r,$allparts,$psprt);      &partmenu($r,$allparts,$psprt);
     $r->print('</td></tr></table>');      $r->print('</td></tr></table>');
 }  }
Line 2946  sub listdata { Line 2978  sub listdata {
       $$resourcedata{$thiskey},        $$resourcedata{$thiskey},
       '',1,'','').        '',1,'','').
 '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.  '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
 (($$resourcedata{$thiskey}!=0)?'<a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.  (($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.
 &mt('Shift all dates based on this date').'</a>':'').  &mt('Shift all dates based on this date').'</a></span>':'').
 &date_sanity_info($$resourcedata{$thiskey})  &date_sanity_info($$resourcedata{$thiskey})
   );    );
     } elsif ($thistype eq 'date_interval') {      } elsif ($thistype eq 'date_interval') {

Removed from v.1.411  
changed lines
  Added in v.1.413


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