Diff for /loncom/interface/slotrequest.pm between versions 1.48 and 1.49

version 1.48, 2006/02/26 19:40:14 version 1.49, 2006/03/07 16:15:48
Line 529  STUFF Line 529  STUFF
   
 sub allowed_slot {  sub allowed_slot {
     my ($slot_name,$slot,$symb,$slots,$consumed_uniqueperiods)=@_;      my ($slot_name,$slot,$symb,$slots,$consumed_uniqueperiods)=@_;
   
     #already started      #already started
     if ($slot->{'starttime'} < time) {      if ($slot->{'starttime'} < time) {
  # all open slot to be schedulable   # all open slot to be schedulable
  #return 0;   #return 0;
     }      }
     &Apache::lonxml::debug("$slot_name starttime good");      &Apache::lonxml::debug("$slot_name starttime good");
   
     #already ended      #already ended
     if ($slot->{'endtime'} < time) {      if ($slot->{'endtime'} < time) {
  return 0;   return 0;
     }      }
     &Apache::lonxml::debug("$slot_name endtime good");      &Apache::lonxml::debug("$slot_name endtime good");
   
     # not allowed to pick this one      # not allowed to pick this one
     if (defined($slot->{'type'})      if (defined($slot->{'type'})
  && $slot->{'type'} ne 'schedulable_student') {   && $slot->{'type'} ne 'schedulable_student') {
  return 0;   return 0;
     }      }
     &Apache::lonxml::debug("$slot_name type good");      &Apache::lonxml::debug("$slot_name type good");
   
       # its for a different set of users
       if (defined($slot->{'allowedsection'})) {
   
    return 0;
       }
       &Apache::lonxml::debug("$slot_name type good");
   
       # its for a different set of users
       if (defined($slot->{'allowedusers'})) {
   
    return 0;
       }
       &Apache::lonxml::debug("$slot_name type good");
   
     # not allowed for this resource      # not allowed for this resource
     if (defined($slot->{'symb'})      if (defined($slot->{'symb'})
  && $slot->{'symb'} ne $symb) {   && $slot->{'symb'} ne $symb) {
Line 738  sub show_table { Line 756  sub show_table {
     &Apache::grades::reset_perm();      &Apache::grades::reset_perm();
   
     my %show_fields=&Apache::lonlocal::texthash(      my %show_fields=&Apache::lonlocal::texthash(
      'name'         => 'Slot Name',       'name'            => 'Slot Name',
      'description'  => 'Description',       'description'     => 'Description',
      'type'         => 'Type',       'type'            => 'Type',
      'starttime'    => 'Start time',       'starttime'       => 'Start time',
      'endtime'      => 'End Time',       'endtime'         => 'End Time',
              'startreserve' => 'Time students can start reserving',               'startreserve'    => 'Time students can start reserving',
      'secret'       => 'Secret Word',       'secret'          => 'Secret Word',
      'maxspace'     => 'Maximum # of students',       'maxspace'        => 'Maximum # of students',
      'ip'           => 'IP or DNS restrictions',       'ip'              => 'IP or DNS restrictions',
      'symb'         => 'Resource slot is restricted to.',       'symb'            => 'Resource slot is restricted to.',
      'uniqueperiod' => 'Period of time slot is unique',       'allowedsections' => 'Sections slot is restricted to.',
      'scheduled'    => 'Scheduled Students',       'allowedusers'    => 'Users slot is restricted to.',
      'proctor'      => 'List of proctors');       'uniqueperiod'    => 'Period of time slot is unique',
        'scheduled'       => 'Scheduled Students',
        'proctor'         => 'List of proctors');
     my @show_order=('name','description','type','starttime','endtime',      my @show_order=('name','description','type','starttime','endtime',
        'startreserve','secret','maxspace','ip','symb',      'startreserve','secret','maxspace','ip','symb',
        'uniqueperiod','scheduled','proctor');      'allowedsections','allowedusers','uniqueperiod',
       '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')
                             : keys(%show_fields);                              : keys(%show_fields);
Line 832  sub show_table { Line 853  sub show_table {
   
     my %name_cache;      my %name_cache;
     my $slotsort = sub {      my $slotsort = sub {
  if ($env{'form.order'}=~/^(type|description|endtime|startreserve|maxspace|ip|symb)$/) {   if ($env{'form.order'}=~/^(type|description|endtime|startreserve|maxspace|ip|symb|allowedsections|allowedusers)$/) {
     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 911  sub show_table { Line 932  sub show_table {
     $title='<a href="'.$res.'?symb='.$slots{$slot}{'symb'}.'">'.$title.'</a>';      $title='<a href="'.$res.'?symb='.$slots{$slot}{'symb'}.'">'.$title.'</a>';
  }   }
   
    my $allowedsections;
    if (exists($show{'allowedsections'})) {
       $allowedsections = 
    join(', ',sort(split(/\s*,\s*/,
        $slots{$slot}->{'allowedsections'})));
    }
   
    my @allowedusers;
    if (exists($show{'allowedusers'})) {
       @allowedusers= map {
    my ($uname,$udom)=split(/:/,$_);
    my $fullname=$name_cache{$_};
    if (!defined($fullname)) {
       $fullname = &Apache::loncommon::plainname($uname,$udom);
       $fullname =~s/\s/&nbsp;/g;
       $name_cache{$_} = $fullname;
    }
    &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
       } (sort(split(/\s*,\s*/,$slots{$slot}->{'allowedusers'})));
    }
    my $allowedusers=join(', ',@allowedusers);
   
  my @proctors;   my @proctors;
  my $rowspan=1;   my $rowspan=1;
  my $colspan=1;   my $colspan=1;
Line 920  sub show_table { Line 963  sub show_table {
  my ($uname,$udom)=split(/@/,$_);   my ($uname,$udom)=split(/@/,$_);
  my $fullname=$name_cache{$_};   my $fullname=$name_cache{$_};
  if (!defined($fullname)) {   if (!defined($fullname)) {
     &Apache::lonnet::logthis("Gettign $uname $udom");  
     $fullname = &Apache::loncommon::plainname($uname,$udom);      $fullname = &Apache::loncommon::plainname($uname,$udom);
     $fullname =~s/\s/&nbsp;/g;      $fullname =~s/\s/&nbsp;/g;
     $name_cache{$_} = $fullname;      $name_cache{$_} = $fullname;
Line 970  DELETELINK Line 1012  DELETELINK
  if (exists($show{'symb'})) {   if (exists($show{'symb'})) {
     $colspan++;$r->print("<td>$title</td>\n");      $colspan++;$r->print("<td>$title</td>\n");
  }   }
  if (exists($show{'uniqueperiod'})) {   if (exists($show{'allowedsections'})) {
     $colspan++;$r->print("<td>$unique</td>\n");      $colspan++;$r->print("<td>$allowedsections</td>\n");
    }
    if (exists($show{'allowedusers'})) {
       $colspan++;$r->print("<td>$allowedusers</td>\n");
  }   }
  if (exists($show{'scheduled'})) {   if (exists($show{'scheduled'})) {
     $colspan++;$r->print("<td>$ids</td>\n</tr>\n");      $colspan++;$r->print("<td>$ids</td>\n</tr>\n");
Line 1156  sub csvupload_fields { Line 1201  sub csvupload_fields {
     ['maxspace','Maximum number of reservations'],      ['maxspace','Maximum number of reservations'],
     ['symb','Resource Restriction'],      ['symb','Resource Restriction'],
     ['uniqueperiod','Date range of slot exclusion'],      ['uniqueperiod','Date range of slot exclusion'],
     ['secret','Secret word proctor uses to validate']);      ['secret','Secret word proctor uses to validate'],
       ['allowedsections','Sections slot is restricted to'],
       ['allowedusers','Users slot is restricted to'],
       );
 }  }
   
 sub csv_upload_assign {  sub csv_upload_assign {

Removed from v.1.48  
changed lines
  Added in v.1.49


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