--- loncom/interface/slotrequest.pm 2014/02/28 19:20:06 1.120 +++ loncom/interface/slotrequest.pm 2017/12/22 02:00:46 1.136 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler for requesting to have slots added to a students record # -# $Id: slotrequest.pm,v 1.120 2014/02/28 19:20:06 bisitz Exp $ +# $Id: slotrequest.pm,v 1.136 2017/12/22 02:00:46 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -37,7 +37,7 @@ use Apache::lonnet; use Apache::lonnavmaps(); use Date::Manip; use lib '/home/httpd/lib/perl/'; -use LONCAPA; +use LONCAPA qw(:DEFAULT :match); sub fail { my ($r,$code)=@_; @@ -56,12 +56,22 @@ sub fail { } sub start_page { - my ($r,$title,$brcrum)=@_; + my ($r,$title,$brcrum,$js)=@_; my $args; if (ref($brcrum) eq 'ARRAY') { $args = {bread_crumbs => $brcrum}; } - $r->print(&Apache::loncommon::start_page($title,undef,$args)); + if (($env{'form.requestattempt'}) || ($env{'form.command'} eq 'manageresv')) { + my %loaditems = ( + onload => 'javascript:uncheckSlotRadio();', + ); + if (ref($args) eq 'HASH') { + $args->{'add_entries'} = \%loaditems; + } else { + $args = { 'add_entries' => \%loaditems }; + } + } + $r->print(&Apache::loncommon::start_page($title,$js,$args)); } sub end_page { @@ -69,6 +79,291 @@ sub end_page { $r->print(&Apache::loncommon::end_page()); } +sub reservation_js { + my ($slots,$consumed_uniqueperiods,$available,$got_slots,$symb) = @_; + return unless ((ref($slots) eq 'HASH') && (ref($available) eq 'ARRAY')); + my $toskip; + if ($symb eq '') { + $toskip = { symb => 1, }; + } + my ($i,$j) = (0,0); + my $js; + foreach my $slot (sort + { return $slots->{$a}->{'starttime'} <=> $slots->{$b}->{'starttime'} } + (keys(%{$slots}))) { + + next if (!&allowed_slot($slot,$slots->{$slot},$symb,$slots, + $consumed_uniqueperiods,$toskip)); + $js .= " slotstart[$i]='$slots->{$slot}->{'starttime'}';\n". + " slotend[$i]='$slots->{$slot}->{'endtime'}';\n". + " slotname[$i]='$slot';\n"; + if (($symb) && (ref($got_slots) eq 'ARRAY')) { + if (grep(/^\Q$slot\E$/,@{$got_slots})) { + $js .= " currslot[$j]='$slot';\n"; + $j++; + } + } + $i++; + push(@{$available},$slot); + } + if ($j) { + $js = " var currslot = new Array($j);\n\n$js"; + } + my %alerts = &Apache::lonlocal::texthash ( + none => 'No reservable time slots found', + invalid => 'Invalid date format', + ); + return <<"ENDSCRIPT"; + +ENDSCRIPT + +} + + =pod slot_reservations db @@ -121,7 +416,6 @@ sub check_for_reservation { my ($symb,$mode)=@_; my $student = &Apache::lonnet::EXT("resource.0.availablestudent", $symb, $env{'user.domain'}, $env{'user.name'}); - my $course = &Apache::lonnet::EXT("resource.0.available", $symb, $env{'user.domain'}, $env{'user.name'}); my @slots = (split(/:/,$student), split(/:/, $course)); @@ -171,7 +465,7 @@ sub get_consumed_uniqueperiods { return 'error: Unable to determine current status'; } my @problems = $navmap->retrieveResources(undef, - sub { $_[0]->is_problem() },1,0); + sub { $_[0]->is_gradable() },1,0); my %used_slots; foreach my $problem (@problems) { my $symb = $problem->symb(); @@ -218,16 +512,19 @@ sub check_for_conflict { if (!defined($new_slot->{'uniqueperiod'})) { return undef; } if (!ref($consumed_uniqueperiods)) { - $consumed_uniqueperiods = &get_consumed_uniqueperiods($slots); - if (ref($consumed_uniqueperiods) eq 'HASH') { - if (&Apache::lonnet::error(%$consumed_uniqueperiods)) { - return 'error: Unable to determine current status'; - } + if ($consumed_uniqueperiods =~ /^error: /) { + return $consumed_uniqueperiods; } else { - return 'error: Unable to determine current status'; + $consumed_uniqueperiods = &get_consumed_uniqueperiods($slots); + if (ref($consumed_uniqueperiods) eq 'HASH') { + if (&Apache::lonnet::error(%$consumed_uniqueperiods)) { + return 'error: Unable to determine current status'; + } + } else { + return 'error: Unable to determine current status'; + } } - } - + } my ($new_uniq_start,$new_uniq_end) = @{$new_slot->{'uniqueperiod'}}; foreach my $slot_name (keys(%$consumed_uniqueperiods)) { my ($start,$end)=@{$consumed_uniqueperiods->{$slot_name}}; @@ -504,14 +801,20 @@ sub release_reservation { return (0,'error: Unable to determine current status'); } my $passed_resource = $navmap->getBySymb($symb); - if ($passed_resource->is_map()) { - my ($a_resource) = - $navmap->retrieveResources($passed_resource, - sub {$_[0]->is_problem()},0,1); - $symb = $a_resource->symb(); + if (ref($passed_resource)) { + if ($passed_resource->is_map()) { + my ($a_resource) = + $navmap->retrieveResources($passed_resource, + sub {$_[0]->is_gradable()},0,1); + $symb = $a_resource->symb(); + } + } else { + unless ($mgr eq 'F') { + return (0,'error: Unable to determine current status'); + } } - # get parameter string, check for existance, rebuild string with the slot + # get parameter string, check for existence, rebuild string with the slot my $student = &Apache::lonnet::EXT("resource.0.availablestudent", $symb,$udom,$uname); my @slots = split(/:/,$student); @@ -735,7 +1038,7 @@ STUFF } sub allowed_slot { - my ($slot_name,$slot,$symb,$slots,$consumed_uniqueperiods)=@_; + my ($slot_name,$slot,$symb,$slots,$consumed_uniqueperiods,$toskip)=@_; #already started if ($slot->{'starttime'} < time) { @@ -809,9 +1112,33 @@ sub allowed_slot { return 0 if (!$userallowed); # not allowed for this resource - if (defined($slot->{'symb'}) - && $slot->{'symb'} ne $symb) { - return 0; + if (defined($slot->{'symb'})) { + my $exclude = 1; + my @symbs; + if ($slot->{'symb'} =~ /,/) { + @symbs = split(/\s*,\s*/,$slot->{'symb'}); + } else { + @symbs = ($slot->{'symb'}); + } + my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb); + foreach my $reqsymb (@symbs) { + next if ($reqsymb eq ''); + my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($reqsymb); + if ($sloturl=~/\.(page|sequence)$/) { + if (($map ne '') && ($map eq $sloturl)) { + $exclude = 0; + last; + } + } elsif ($reqsymb eq $symb) { + $exclude = 0; + last; + } + } + if ($exclude) { + unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) { + return 0; + } + } } my $conflict = &check_for_conflict($symb,$slot_name,$slot,$slots, @@ -839,77 +1166,119 @@ sub get_description { } sub show_choices { - my ($r,$symb,$formname)=@_; - - my ($cnum,$cdom)=&get_course(); - my %slots = &Apache::lonnet::get_course_slots($cnum,$cdom); - my $consumed_uniqueperiods = &get_consumed_uniqueperiods(\%slots); - if (ref($consumed_uniqueperiods) eq 'HASH') { - if (&Apache::lonnet::error(%$consumed_uniqueperiods)) { - $r->print(''. - &mt('An error occurred determining slot availability'). - ''); - return; - } - } elsif ($consumed_uniqueperiods =~ /^error: /) { - $r->print(''. - &mt('An error occurred determining slot availability'). - ''); - return; - } - my (@available,$output); + my ($symb,$formname,$num,$class,$slots,$consumed_uniqueperiods,$available,$got_slots)=@_; + my $output; &Apache::lonxml::debug("Checking Slots"); - my @got_slots=&check_for_reservation($symb,'allslots'); - if ($got_slots[0] =~ /^error: /) { - $r->print(''. - &mt('An error occurred determining slot availability'). - ''); + if (!ref($available) eq 'ARRAY') { return; } - foreach my $slot (sort - { return $slots{$a}->{'starttime'} <=> $slots{$b}->{'starttime'} } - (keys(%slots))) { - - &Apache::lonxml::debug("Checking Slot $slot"); - next if (!&allowed_slot($slot,$slots{$slot},$symb,\%slots, - $consumed_uniqueperiods)); - - push(@available,$slot); - } - if (!@available) { - $output = '
'.&mt('No available times.'); + if (!@{$available}) { + $output = ''.&mt('No available times.').''; if ($env{'form.command'} ne 'manageresv') { $output .= ' '. &mt('Return to last resource').''; } - $output .= '
'; - $r->print($output); - return; + if ($class) { + return '
'.$output.'
'; + } else { + return $output; + } + } + if (@{$available} > 1) { + my $numavailable = scalar(@{$available}); + my $numreserved = 0; + my $js; + my $j = 0; + foreach my $got (@{$got_slots}) { + unless (($got eq '') || (!defined($got))) { + $numreserved ++; + if ($env{'form.command'} eq 'manageresv') { + $js .= " currslot[$j]='$got';\n"; + $j++; + } + } + } + my $showfilter = 'none'; + $output .= '
'.&mt('Actions').''."\n". + '
'; + my @options = ('all','filter'); + if ($numreserved) { + unshift(@options,'show'); + } + my %resmenu = &Apache::lonlocal::texthash ( + show => 'Show current reservation', + all => 'Show all', + filter => 'Search by date', + ); + foreach my $option (@options) { + my $onclick = "toggleSlotDisplay(this.form,'$num');"; + if (($option eq 'show') && ($env{'form.command'} eq 'manageresv')) { + $onclick .= "currSlotDisplay$num(this.form,'$num');"; + } + $output .= ''.(' ' x3)."\n"; + } + $output .= '
'; + my $chooserform = 'reservationchooser_'.$num; + my $starttime = $slots->{$available->[0]}->{'starttime'}; + my $endtime = $slots->{$available->[-1]}->{'starttime'}; + if ($env{'form.command'} eq 'manageresv') { + $output .= <<"ENDSCRIPT"; + + + +ENDSCRIPT + } + $output .= + '
'. + '
'. + '
'.&mt('Open after').''. + &Apache::lonhtmlcommon::date_setter($chooserform,'start',$starttime,'','','','','','','',1,1). + '
'.&mt('Closed before').''. + &Apache::lonhtmlcommon::date_setter($chooserform,'end',$endtime,'','','','','','','',1,1). + '

'. + ''. + '
'; + } + if ($class) { + return '
'.$output.'
'; + } else { + return $output; } - $r->print($output); } sub to_show { @@ -1112,12 +1489,13 @@ sub show_table { 'secret' => 'Secret Word', 'space' => '# of students/max', 'ip' => 'IP or DNS restrictions', - 'symb' => 'Resource slot is restricted to.', + 'symb' => 'Resource(s)/Map(s) slot is restricted to.', 'allowedsections' => 'Sections slot is restricted to.', 'allowedusers' => 'Users slot is restricted to.', 'uniqueperiod' => 'Period of time slot is unique', 'scheduled' => 'Scheduled Students', - 'proctor' => 'List of proctors'); + 'proctor' => 'List of proctors', + 'iptied' => 'Unique IP each student',); if ($crstype eq 'Community') { $show_fields{'startreserve'} = &mt('Time members can start reserving'); $show_fields{'endreserve'} = &mt('Time members can no longer reserve'); @@ -1125,7 +1503,7 @@ sub show_table { } my @show_order=('name','description','type','starttime','endtime', 'startreserve','endreserve','reservationmsg','secret','space', - 'ip','symb','allowedsections','allowedusers','uniqueperiod', + 'ip','iptied','symb','allowedsections','allowedusers','uniqueperiod', 'scheduled','proctor'); my @show = (exists($env{'form.show'})) ? &Apache::loncommon::get_env_multiple('form.show') @@ -1224,15 +1602,16 @@ sub show_table { $r->print(''); $r->print('

'); my $linkstart=''.$show_fields{$which}.''); + $tableheader .= ''.$linkstart.$which.'">'.$show_fields{$which}.''; } } - $r->print(&Apache::loncommon::end_data_table_header_row()); + $tableheader .= &Apache::loncommon::end_data_table_header_row(); + my $shownheader = 0; my %name_cache; my $slotsort = sub { @@ -1327,13 +1706,21 @@ sub show_table { localtime($slots{$slot}{'uniqueperiod'}[1]); } - my $title; + my @titles; if (exists($slots{$slot}{'symb'})) { - my (undef,undef,$res)= - &Apache::lonnet::decode_symb($slots{$slot}{'symb'}); - $res = &Apache::lonnet::clutter($res); - $title = &Apache::lonnet::gettitle($slots{$slot}{'symb'}); - $title=''.$title.''; + my @symbs; + if ($slots{$slot}{'symb'} =~ /,/) { + @symbs = split(/\s*,\s*/,$slots{$slot}{'symb'}); + } else { + @symbs = ($slots{$slot}{'symb'}); + } + foreach my $reqsymb (@symbs) { + my (undef,undef,$res) = + &Apache::lonnet::decode_symb($reqsymb); + $res = &Apache::lonnet::clutter($res); + my $title = &Apache::lonnet::gettitle($reqsymb); + push(@titles,''.$title.''); + } } my $allowedsections; @@ -1381,30 +1768,39 @@ sub show_table { delete => 'Delete', slotlog => 'History', ); - my $edit=(<<"EDITLINK"); + my ($edit,$delete,$showlog,$remove_all); + if ($mgr) { + $edit=(<<"EDITLINK"); $lt{'edit'} EDITLINK - my $delete=(<<"DELETELINK"); + $delete=(<<"DELETELINK"); $lt{'delete'} DELETELINK - my $showlog=(<<"LOGLINK"); + $remove_all=&remove_link($slot,'remove all').'
'; + + if ($ids eq '') { + undef($remove_all); + } else { + undef($delete); + } + } + + $showlog=(<<"LOGLINK"); $lt{'slotlog'} LOGLINK - my $remove_all=&remove_link($slot,'remove all').'
'; - - if ($ids eq '') { - undef($remove_all); - } else { - undef($delete); - } if ($slots{$slot}{'type'} ne 'schedulable_student') { undef($showlog); undef($remove_all); } + unless ($shownheader) { + $r->print($tableheader); + $shownheader = 1; + } + my $row_start=&Apache::loncommon::start_data_table_row(); my $row_end=&Apache::loncommon::end_data_table_row(); $r->print($row_start. @@ -1449,8 +1845,18 @@ LOGLINK if (exists($show{'ip'})) { $colspan++;$r->print("$slots{$slot}{'ip'}\n"); } + if (exists($show{'iptied'})) { + $colspan++; + if ($slots{$slot}{'iptied'} eq 'yes') { + $r->print(''.&mt('Yes')."\n"); + } elsif ($slots{$slot}{'iptied'} eq 'answer') { + $r->print(''.&mt('Yes, including post-answer date')."\n"); + } else { + $r->print(''.&mt('No')."\n"); + } + } if (exists($show{'symb'})) { - $colspan++;$r->print("$title\n"); + $colspan++;$r->print("".join('
',@titles)."\n"); } if (exists($show{'allowedsections'})) { $colspan++;$r->print("$allowedsections\n"); @@ -1473,12 +1879,17 @@ $row_end STUFF } } - $r->print(&Apache::loncommon::end_data_table().''); + if ($shownheader) { + $r->print(&Apache::loncommon::end_data_table()); + } else { + $r->print('

'.&mt('No slots meet the criteria for display').'

'); + } + $r->print(''); return; } sub manage_reservations { - my ($r,$crstype) = @_; + my ($r,$crstype,$slots,$consumed_uniqueperiods,$allavailable) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); $r->print('

' .&mt('Instructors may use a reservation system to place restrictions on when and where assignments can be worked on.') @@ -1497,17 +1908,33 @@ sub manage_reservations { &Apache::lonnet::logthis('Manage Reservations - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); return; } + if (ref($consumed_uniqueperiods) eq 'HASH') { + if (&Apache::lonnet::error(%$consumed_uniqueperiods)) { + $r->print(''. + &mt('An error occurred determining slot availability.'). + ''); + return; + } + } elsif ($consumed_uniqueperiods =~ /^error: /) { + $r->print(''. + &mt('An error occurred determining slot availability.'). + ''); + return; + } my (%parent,%shownparent,%container,%container_title,%contents); - my ($depth,$count,$reservable,$lastcontainer,$rownum) = (0,0,0,0,0); + my ($depth,$count,$reservable,$lastcontainer,$rownum,$shown) = (0,0,0,0,0,0); my @backgrounds = ("LC_odd_row","LC_even_row"); my $numcolors = scalar(@backgrounds); my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif"); my $slotheader = '

'. &mt('Your reservation status for any such assignments is listed below:'). '

'. - ''."\n"; + '
'."\n"; my $shownheader = 0; my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); + my (@ordered,%output,$mapitem,$got_map_slot,$currmapoutput,$mapnum); + $mapnum = 0; + $shown = 0; while (my $resource = $it->next()) { if ($resource == $it->BEGIN_MAP()) { $depth++; @@ -1516,12 +1943,92 @@ sub manage_reservations { if ($resource == $it->END_MAP()) { $depth--; $lastcontainer = $parent{$depth}; + my %allstatuses; + foreach my $symb (@ordered) { + if (ref($output{$symb}) eq 'HASH') { + if (($output{$symb}{'type'} eq 'map_map') || ($output{$symb}{'type'} eq 'map')) { + if ($output{$symb}{'slotstatus'} ne '') { + if (ref($allstatuses{$output{$symb}{'slotstatus'}}) eq 'ARRAY') { + push(@{$allstatuses{$output{$symb}{'slotstatus'}}},$symb); + } else { + $allstatuses{$output{$symb}{'slotstatus'}} = [$symb]; + } + } + } + } + } + if (keys(%allstatuses) == 1) { + $got_map_slot = 1; + my $repsymb; + my @values = values(%allstatuses); + if (ref($values[0]) eq 'ARRAY') { + if (ref($output{$values[0][0]}) eq 'HASH') { + $repsymb = $values[0][0]; + } + } + if (($mapitem) && ($repsymb)) { + my $formnum = $mapnum.'_'.$output{$repsymb}{'reservable'}; + my $class = 'LC_slotmaptext_'.$mapnum; + if ($output{$repsymb}{'hasaction'}) { + $mapitem .= ''; + + } else { + $mapitem .= ''; + } + } + my $counter = 0; + foreach my $symb (@ordered) { + if (ref($output{$symb}) eq 'HASH') { + $counter ++; + my $bgcolor = $backgrounds[($output{$symb}{'shown'} + $counter) % $numcolors]; + $currmapoutput .= $output{$symb}{'header'}. + ''. + $output{$symb}{'info'}. + $output{$symb}{'data'}.''."\n"; + } + } + } else { + my $counter = 0; + foreach my $symb (@ordered) { + if (ref($output{$symb}) eq 'HASH') { + $counter ++; + my $bgcolor = $backgrounds[($output{$symb}{'shown'} + $counter) % $numcolors]; + $currmapoutput .= $output{$symb}{'header'}. + ''. + $output{$symb}{'info'}. + $output{$symb}{'data'}.''."\n"; + $shown ++; + } + } + } + if ($mapitem) { + if ($got_map_slot) { + $mapitem =~ s{(print($mapitem.$currmapoutput); + @ordered=(); + undef(%output); + $currmapoutput = ''; + $got_map_slot = ''; + $mapitem = ''; } if (ref($resource)) { my $symb = $resource->symb(); - my $ressymb = $symb; $contents{$lastcontainer} ++; - next if (!$resource->is_problem() && !$resource->is_sequence() && + next if (!$resource->is_gradable() && !$resource->is_sequence() && !$resource->is_page()); $count ++; if (($resource->is_sequence()) || ($resource->is_page())) { @@ -1529,13 +2036,18 @@ sub manage_reservations { $container{$lastcontainer} = $resource; $container_title{$lastcontainer} = $resource->compTitle(); } - if ($resource->is_problem()) { + if ($resource->is_gradable()) { my ($useslots) = $resource->slot_control(); next if (($useslots eq '') || ($useslots =~ /^\s*no\s*$/i)); + push(@ordered,$symb); + $output{$symb}{type} = $useslots; my ($msg,$get_choices,$slotdescription); my $title = $resource->compTitle(); my $status = $resource->simpleStatus('0'); my ($slot_status,$date,$slot_name) = $resource->check_for_slot('0'); + + $output{$symb}{'slotstatus'} = $slot_status; + $output{$symb}{'slotname'} = $slot_name; if ($slot_name ne '') { my %slot=&Apache::lonnet::get_slot($slot_name); $slotdescription=&get_description($slot_name,\%slot); @@ -1579,7 +2091,9 @@ sub manage_reservations { $msg = &Apache::lonnavmaps::getDescription($resource,'0'); } } + $output{$symb}{'msg'} = $msg; $reservable ++; + $output{$symb}{'reservable'} = $reservable; my $treelevel = $depth; my $higherup = $lastcontainer; if ($depth > 1) { @@ -1600,53 +2114,71 @@ sub manage_reservations { $treelevel --; $higherup = $parent{$treelevel}; } - foreach my $item (@maprows) { + for (my $i=0; $i<@maprows; $i++) { + $mapnum ++; $rownum ++; - my $bgcolor = $backgrounds[$rownum % $numcolors]; + $shown ++; + my $bgcolor = $backgrounds[$shown % $numcolors]; if (!$shownheader) { - $r->print($slotheader); + $mapitem .= $slotheader; $shownheader = 1; } - $r->print(''.$item.''."\n"); + if (ref($maprows[$i]) eq 'ARRAY') { + if ($i < scalar(@maprows)-1) { + $mapitem .= ''. + ''. + ''."\n"; + } else { + $mapitem .= + ''. + ''."\n"; + } + } } + $output{$symb}{'mapnum'} = $mapnum; } $rownum ++; - my $bgcolor = $backgrounds[$rownum % $numcolors]; + $output{$symb}{'rownum'} = $rownum; + $output{$symb}{'shown'} = $shown; if (!$shownheader) { - $r->print($slotheader); + $output{$symb}{'header'} = $slotheader; $shownheader = 1; } - $r->print(''; + $output{$symb}{'info'} .= '" />'.$title.''.(' ' x6).''; + my $hasaction; if ($status == $resource->OPEN) { if ($get_choices) { $hasaction = 1; + $output{$symb}{'hasaction'} = $hasaction; } } + my $class = 'LC_slottext_'.$mapnum; if ($hasaction) { - $result .= ''. - ''. + ''; } else { - $result .= ''; - } - $r->print($result); - if ($hasaction) { - my $formname = 'manageres_'.$reservable; - &show_choices($r,$symb,$formname); - $r->print(''); + $output{$symb}{'data'} = ''; } - $r->print(''); } } } @@ -1668,20 +2200,70 @@ sub manage_reservations { sub show_map_row { my ($depth,$location,$type,$title,$maprows) = @_; - my $output = ''."\n"; - unshift (@{$maprows},$output); + $icon .= $title; + unshift (@{$maprows},[$spacers,$icon]); return; } +sub slot_chooser { + my ($symb,$class,$formnum,$allavailable,$slots,$consumed_uniqueperiods) = @_; + my $output; + my @got_slots=&check_for_reservation($symb,'allslots'); + if ($got_slots[0] =~ /^error: /) { + $output = ''. + &mt('An error occurred determining slot availability.'). + ''; + } else { + my $formname = 'manageres_'.$formnum; + if (ref($allavailable) eq 'ARRAY') { + my @available; + if (ref($slots) eq 'HASH') { + foreach my $slot (@{$allavailable}) { + # not allowed for this resource + if (ref($slots->{$slot}) eq 'HASH') { + if ($slots->{$slot}->{'symb'} ne '') { + my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb); + my $exclude = 1; + my @reqsymbs = split(/\s*,\s*/,$slots->{$slot}->{'symb'}); + if (@reqsymbs) { + if (grep(/^\Q$symb\E$/,@reqsymbs)) { + $exclude = 0; + } else { + foreach my $reqsymb (@reqsymbs) { + my (undef,undef,$sloturl) = &Apache::lonnet::decode_symb($reqsymb); + if ($sloturl=~/\.(page|sequence)$/) { + if (($map ne '') && ($map eq $sloturl)) { + $exclude = 0; + last; + } + } + } + } + next if ($exclude); + } + } + } + push(@available,$slot); + } + } + $output .= &show_choices($symb,$formname,$formnum,$class, + $slots,$consumed_uniqueperiods, + \@available,\@got_slots); + } + } + return $output; +} + sub show_reservations { my ($r,$uname,$udom) = @_; if (!defined($uname)) { @@ -1793,16 +2375,19 @@ sub show_reservations { if ($showntablehdr) { $r->print(&Apache::loncommon::end_data_table().'
'); if (($curr{'page'} > 1) || ($more_records)) { - $r->print('
'. + $output{$repsymb}{'msg'}. + ''. + &slot_chooser($repsymb,$class,$formnum,$allavailable,$slots, + $consumed_uniqueperiods). + ''. + $output{$repsymb}{'msg'}. + '
'.join('',@{$maprows[$i]}).' 
'.$maprows[$i][0]. + ''. + $maprows[$i][1].(' ' x6).'
'."\n"); + $output{$symb}{'info'} = ''; for (my $i=0; $i<$depth; $i++) { - $r->print(''); + $output{$symb}{'info'} .= ''; } - my $result = ''. - 'src().'?symb='.$symb.'">'. + ''.&mt('Task');
+                    $output{$symb}{'info'} .= 'task.gif'.$title.''.(' ' x6).''.$msg.''.(' ' x6); + $output{$symb}{'data'} = ''.$msg.''. + &slot_chooser($symb,$class,$reservable,$allavailable,$slots, + $consumed_uniqueperiods).''.$msg.''. + ''.$msg.''. + '
'; - for (my $i=0; $i<$depth-1; $i++) { - $output .= ''; + my $spacers; + for (my $i=0; $i<$depth-2; $i++) { + $spacers .= ''; } + my $icon; if ($type eq 'page') { - $output .= ' '."\n"; + $icon = ' '."\n"; } else { - $output .= ' '."\n"; + $icon = ' '."\n"; } - $output .= $title.' 
'); + $r->print('

'); if ($curr{'page'} > 1) { - $r->print('

'); + $r->print(''); } if ($more_records) { - $r->print(''); + $r->print(''); } - $r->print('
'.&mt('Previous [_1] changes',$curr{'show'}).''.&mt('Next [_1] changes',$curr{'show'}).'
'); + $r->print('

'); $r->print(<<"ENDSCRIPT"); ENDSCRIPT } @@ -2002,14 +2588,16 @@ sub show_reservations_log { if ($showntablehdr) { $r->print(&Apache::loncommon::end_data_table().'
'); if (($curr{'page'} > 1) || ($more_records)) { - $r->print(''); + $r->print('

'); if ($curr{'page'} > 1) { - $r->print('

'); + $r->print(''); } if ($more_records) { - $r->print(''); + $r->print(''); } - $r->print('
'.&mt('Previous [_1] changes',$curr{'show'}).''.&mt('Next [_1] changes',$curr{'show'}).'
'); + $r->print('

'); $r->print(<<"ENDSCRIPT");