Diff for /loncom/interface/slotrequest.pm between versions 1.110 and 1.111

version 1.110, 2011/01/03 18:04:56 version 1.111, 2011/12/18 17:15:03
Line 143  sub check_for_reservation { Line 143  sub check_for_reservation {
  !ref($slots{$slot_name}));   !ref($slots{$slot_name}));
  &Apache::lonxml::debug(time." $slot_name ".   &Apache::lonxml::debug(time." $slot_name ".
        $slots{$slot_name}->{'starttime'}." -- ".         $slots{$slot_name}->{'starttime'}." -- ".
        $slots{$slot_name}->{'startreserve'});         $slots{$slot_name}->{'startreserve'}." -- ".
  if ($slots{$slot_name}->{'endtime'} > time &&                                 $slots{$slot_name}->{'endreserve'});
     $slots{$slot_name}->{'startreserve'} < time) {   if (($slots{$slot_name}->{'endtime'} > time) &&
     # between start of reservation times and end of slot      ($slots{$slot_name}->{'startreserve'} < time) &&
               ((!$slots{$slot_name}->{'endreserve'}) || 
                ($slots{$slot_name}->{'endreserve'} > time))) {
       # between start of reservation time and end of reservation time
               # and before end of slot
     if ($mode eq 'allslots') {      if ($mode eq 'allslots') {
  push(@got,$slot_name);   push(@got,$slot_name);
     } else {      } else {
Line 756  sub allowed_slot { Line 760  sub allowed_slot {
     if ($slot->{'startreserve'} > time) {      if ($slot->{'startreserve'} > time) {
  return 0;   return 0;
     }      }
       # reserve time ended
       if (($slot->{'endreserve'}) &&
           ($slot->{'endreserve'} < time)) {
           return 0;
       }    
     &Apache::lonxml::debug("$slot_name reserve good");      &Apache::lonxml::debug("$slot_name reserve good");
   
     my $userallowed=0;      my $userallowed=0;
Line 1096  sub show_table { Line 1105  sub show_table {
      'starttime'       => 'Start time',       'starttime'       => 'Start time',
      'endtime'         => 'End Time',       'endtime'         => 'End Time',
              'startreserve'    => 'Time students can start reserving',               'startreserve'    => 'Time students can start reserving',
                'endreserve'      => 'Time students can no longer reserve',
              'reservationmsg'  => 'Message triggered by reservation',               'reservationmsg'  => 'Message triggered by reservation',
      'secret'          => 'Secret Word',       'secret'          => 'Secret Word',
      'space'           => '# of students/max',       'space'           => '# of students/max',
Line 1108  sub show_table { Line 1118  sub show_table {
      'proctor'         => 'List of proctors');       'proctor'         => 'List of proctors');
     if ($crstype eq 'Community') {      if ($crstype eq 'Community') {
         $show_fields{'startreserve'} = &mt('Time members can start reserving');          $show_fields{'startreserve'} = &mt('Time members can start reserving');
           $show_fields{'endreserve'} = &mt('Time members can no longer reserve');
         $show_fields{'scheduled'} = &mt('Scheduled Members');          $show_fields{'scheduled'} = &mt('Scheduled Members');
     }      }
     my @show_order=('name','description','type','starttime','endtime',      my @show_order=('name','description','type','starttime','endtime',
     'startreserve','reservationmsg','secret','space','ip','symb',      'startreserve','endreserve','reservationmsg','secret','space',
     'allowedsections','allowedusers','uniqueperiod',      'ip','symb','allowedsections','allowedusers','uniqueperiod',
     'scheduled','proctor');      'scheduled','proctor');
     my @show =       my @show = 
  (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')   (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show')
Line 1223  sub show_table { Line 1234  sub show_table {
   
     my %name_cache;      my %name_cache;
     my $slotsort = sub {      my $slotsort = sub {
  if ($env{'form.order'}=~/^(type|description|endtime|startreserve|ip|symb|allowedsections|allowedusers|reservationmsg)$/) {   if ($env{'form.order'}=~/^(type|description|endtime|startreserve|endreserve|ip|symb|allowedsections|allowedusers|reservationmsg)$/) {
     if (lc($slots{$a}->{$env{'form.order'}})      if (lc($slots{$a}->{$env{'form.order'}})
  ne lc($slots{$b}->{$env{'form.order'}})) {   ne lc($slots{$b}->{$env{'form.order'}})) {
  return (lc($slots{$a}->{$env{'form.order'}})    return (lc($slots{$a}->{$env{'form.order'}}) 
Line 1305  sub show_table { Line 1316  sub show_table {
  &Apache::lonlocal::locallocaltime($slots{$slot}->{'endtime'}):'');   &Apache::lonlocal::locallocaltime($slots{$slot}->{'endtime'}):'');
  my $start_reserve=($slots{$slot}->{'startreserve'}?   my $start_reserve=($slots{$slot}->{'startreserve'}?
    &Apache::lonlocal::locallocaltime($slots{$slot}->{'startreserve'}):'');     &Apache::lonlocal::locallocaltime($slots{$slot}->{'startreserve'}):'');
           my $end_reserve=($slots{$slot}->{'endreserve'}?
                            &Apache::lonlocal::locallocaltime($slots{$slot}->{'endreserve'}):'');
   
  my $unique;   my $unique;
  if (ref($slots{$slot}{'uniqueperiod'})) {   if (ref($slots{$slot}{'uniqueperiod'})) {
Line 1412  LOGLINK Line 1425  LOGLINK
  if (exists($show{'startreserve'})) {   if (exists($show{'startreserve'})) {
     $colspan++;$r->print("<td>$start_reserve</td>\n");      $colspan++;$r->print("<td>$start_reserve</td>\n");
  }   }
           if (exists($show{'endreserve'})) {
               $colspan++;$r->print("<td>$end_reserve</td>\n");
           }
         if (exists($show{'reservationmsg'})) {          if (exists($show{'reservationmsg'})) {
             $colspan++;$r->print("<td>$reservemsg</td>\n");              $colspan++;$r->print("<td>$reservemsg</td>\n");
         }          }
Line 2347  sub csvupload_fields { Line 2363  sub csvupload_fields {
     ['starttime','Start Time of slot'],      ['starttime','Start Time of slot'],
     ['endtime','End Time of slot'],      ['endtime','End Time of slot'],
     ['startreserve','Reservation Start Time'],      ['startreserve','Reservation Start Time'],
               ['endreserve','Reservation End Time'],
             ['reservationmsg','Message when reservation changed'],              ['reservationmsg','Message when reservation changed'],
     ['ip','IP or DNS restriction'],      ['ip','IP or DNS restriction'],
     ['proctor','List of proctor ids'],      ['proctor','List of proctor ids'],
Line 2429  sub csv_upload_assign { Line 2446  sub csv_upload_assign {
     next;      next;
  }   }
   
           if ($entries{$fields{'endreserve'}}) {
               $slot{'endreserve'}=
                   &UnixDate($entries{$fields{'endreserve'}},"%s");
           }
           if (defined($slot{'endreserve'})
               && $slot{'endreserve'} > $slot{'starttime'}) {
               push(@errors,"$name not created -- Slot's reservation end time is after the slot's start time.");
               next;
           }
   
         if ($slot{'type'} eq 'schedulable_student') {          if ($slot{'type'} eq 'schedulable_student') {
             if ($entries{$fields{'reservationmsg'}}) {              if ($entries{$fields{'reservationmsg'}}) {
                  if (($entries{$fields{'reservationmsg'}} eq 'only_student') ||                   if (($entries{$fields{'reservationmsg'}} eq 'only_student') ||

Removed from v.1.110  
changed lines
  Added in v.1.111


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