'
+ .&mt('Instructors may use a reservation system to place restrictions on when and where assignments can be worked on.')
+ .' '
+ .&mt('One example is for management of laboratory space, which is only available at certain times, and has a limited number of seats.')
+ .'
'
+ .&mt('Your reservation status for any such assignments is listed below:')
+ .'
'
+ );
+ if (!defined($navmap)) {
+ $r->print('
'.
+ &mt('Unable to retrieve information about course contents').
+ '
');
+ &Apache::lonnet::logthis('Manage Reservations - could not create navmap object in '.lc($type).':'.$env{'request.course.id'});
+ return;
+ }
+ my (%parent,%shownparent,%container,%container_title,%contents);
+ my ($depth,$count,$reservable,$lastcontainer,$rownum) = (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");
+ $r->print('
'."\n");
+ my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
+ while (my $resource = $it->next()) {
+ if ($resource == $it->BEGIN_MAP()) {
+ $depth++;
+ $parent{$depth} = $lastcontainer;
+ }
+ if ($resource == $it->END_MAP()) {
+ $depth--;
+ $lastcontainer = $parent{$depth};
+ }
+ if (ref($resource)) {
+ my $symb = $resource->symb();
+ my $ressymb = $symb;
+ $contents{$lastcontainer} ++;
+ next if (!$resource->is_problem() && !$resource->is_sequence() &&
+ !$resource->is_page());
+ $count ++;
+ if (($resource->is_sequence()) || ($resource->is_page())) {
+ $lastcontainer = $count;
+ $container{$lastcontainer} = $resource;
+ $container_title{$lastcontainer} = $resource->compTitle();
+ }
+ if ($resource->is_problem()) {
+ my ($useslots) = $resource->slot_control();
+ next if (($useslots eq '') || ($useslots =~ /^\s*no\s*$/i));
+ 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');
+ if ($slot_name ne '') {
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+ $slotdescription=&get_description($slot_name,\%slot);
+ }
+ if ($slot_status == $resource->NOT_IN_A_SLOT) {
+ $msg=&mt('No current reservation.');
+ $get_choices = 1;
+ } elsif ($slot_status == $resource->NEEDS_CHECKIN) {
+ $msg=''.&mt('Reserved:').
+ ' '.$slotdescription.' '.
+ &mt('Access requires proctor validation.');
+ } elsif ($slot_status == $resource->WAITING_FOR_GRADE) {
+ $msg=&mt('Submitted and currently in grading queue.');
+ } elsif ($slot_status == $resource->CORRECT) {
+ $msg=&mt('Problem is unavailable.');
+ } elsif ($slot_status == $resource->RESERVED) {
+ $msg=''.&mt('Reserved:').
+ ' '.$slotdescription.' '.
+ &mt('Problem is currently available.');
+ } elsif ($slot_status == $resource->RESERVED_LOCATION) {
+ $msg=''.&mt('Reserved:').
+ ' '.$slotdescription.' '.
+ &mt('Problem is available at a different location.');
+ $get_choices = 1;
+ } elsif ($slot_status == $resource->RESERVED_LATER) {
+ $msg=''.&mt('Reserved:').
+ ' '.$slotdescription.' '.
+ &mt('Problem will be available later.');
+ $get_choices = 1;
+ } elsif ($slot_status == $resource->RESERVABLE) {
+ $msg=&mt('Reservation needed');
+ $get_choices = 1;
+ } elsif ($slot_status == $resource->NOTRESERVABLE) {
+ $msg=&mt('Reservation needed: none available.');
+ } elsif ($slot_status == $resource->UNKNOWN) {
+ $msg=&mt('Unable to determine status due to network problems.');
+ } else {
+ if ($status != $resource->OPEN) {
+ $msg = &Apache::lonnavmaps::getDescription($resource,'0');
+ }
+ }
+ $reservable ++;
+ my $treelevel = $depth;
+ my $higherup = $lastcontainer;
+ if ($depth > 1) {
+ my @maprows;
+ while ($treelevel > 1) {
+ if (ref($container{$higherup})) {
+ my $res = $container{$higherup};
+ last if (defined($shownparent{$higherup}));
+ my $maptitle = $res->compTitle();
+ my $type = 'sequence';
+ if ($res->is_page()) {
+ $type = 'page';
+ }
+ &show_map_row($treelevel,$location,$type,$maptitle,
+ \@maprows);
+ $shownparent{$higherup} = 1;
+ }
+ $treelevel --;
+ $higherup = $parent{$treelevel};
+ }
+ foreach my $item (@maprows) {
+ $rownum ++;
+ my $bgcolor = $backgrounds[$rownum % $numcolors];
+ $r->print('
'.
+ &mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.'
+ ,'2.6.99.0');
+ if ($version) {
+ $output .= ' '.&mt('This LON-CAPA server is version [_1]',$version);
+ }
+ $output .= '
';
+ return $output;
}
sub upload_start {
my ($r)=@_;
$r->print(&Apache::grades::checkforfile_js());
- my $result.='
'."\n";
+ my $result.='
'."\n";
$result.=' '.
&mt('Specify a file containing the slot definitions.').
'
'."\n";
@@ -1412,7 +2105,7 @@ Total number of records found in file: $
Enter as many fields as you can. The system will inform you and bring you back
to this page if the data selected is insufficient to create the slots.
-
+
@@ -1648,6 +2341,23 @@ sub csv_upload_assign {
return '';
}
+sub slot_command_titles {
+ my %titles = (
+ slotlog => 'Reservation Logs',
+ showslots => 'Manage Slots',
+ showresv => 'Reservation History',
+ manageresv => 'Manage Reservations',
+ uploadstart => 'Upload Slots File',
+ csvuploadmap => 'Upload Slots File',
+ csvuploadassign => 'Upload Slots File',
+ delete => 'Slot Deletion',
+ release => 'Reservation Result',
+ remove_reservation => 'Remove Registration',
+ get_reservation => 'Request Reservation',
+ );
+ return %titles;
+}
+
sub handler {
my $r=shift;
@@ -1659,16 +2369,65 @@ sub handler {
}
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
-
+
+ my %crumb_titles = &slot_command_titles();
+ my $brcrum;
+
my $vgr=&Apache::lonnet::allowed('vgr',$env{'request.course.id'});
my $mgr=&Apache::lonnet::allowed('mgr',$env{'request.course.id'});
+ if ($env{'form.command'} eq 'showslots') {
+ if (($vgr ne 'F') && ($mgr ne 'F')) {
+ $env{'form.command'} = 'manageresv';
+ }
+ } elsif ($env{'form.command'} eq 'manageresv') {
+ if (($vgr eq 'F') || ($mgr eq 'F')) {
+ $env{'form.command'} = 'showslots';
+ }
+ }
my $title='Requesting Another Worktime';
- if ($env{'form.command'} =~ /^(showslots|uploadstart|csvuploadmap|csvuploadassign)$/ && $vgr eq 'F') {
- $title = 'Managing Slots';
+ if ($env{'form.command'} eq 'showresv') {
+ $title = 'Reservation History';
+ if ($env{'form.origin'} eq 'aboutme') {
+ $brcrum =[{href=>"/adm/$env{'form.udom'}/$env{'form.uname'}/aboutme",text=>'Personal Information Page'}];
+ } else {
+ $brcrum =[{href=>"/adm/slotrequest?command=manageresv",text=>'Manage Reservations'}];
+ }
+ if (ref($brcrum) eq 'ARRAY') {
+ push(@{$brcrum},{href=>"/adm/slotrequest?command=showresv",text=>$title});
+ }
+ } elsif ($env{'form.command'} eq 'manageresv') {
+ $title = 'Manage Reservations';
+ $brcrum =[{href=>"/adm/slotrequest?command=manageresv",text=>$title}];
+ } elsif ($vgr eq 'F') {
+ if ($env{'form.command'} =~ /^(slotlog|showslots|uploadstart|csvuploadmap|csvuploadassign|delete|release|remove_registration)$/) {
+ $brcrum =[{href=>"/adm/slotrequest?command=showslots",
+ text=>$crumb_titles{'showslots'}}];
+ $title = 'Managing Slots';
+ unless ($env{'form.command'} eq 'showslots') {
+ if (ref($brcrum) eq 'ARRAY') {
+ push(@{$brcrum},{href=>"/adm/slotrequest?command=$env{'form.command'}",text=>$crumb_titles{$env{'form.command'}}});
+ }
+ }
+ }
+ } elsif ($env{'form.command'} eq 'release') {
+ if ($env{'form.context'} eq 'usermanage') {
+ $brcrum =[{href=>"/adm/slotrequest?command=manageresv",
+ text=>$crumb_titles{'showslots'}}];
+ $title = 'Manage Reservations';
+ if (ref($brcrum) eq 'ARRAY') {
+ push(@{$brcrum},{href=>"/adm/slotrequest?command=$env{'form.command'}",text=>$crumb_titles{$env{'form.command'}}});
+ }
+
+ }
}
- &start_page($r,$title);
+ &start_page($r,$title,$brcrum);
- if ($env{'form.command'} eq 'showslots' && $vgr eq 'F') {
+ if ($env{'form.command'} eq 'manageresv') {
+ my $crstype = &Apache::loncommon::course_type();
+ &manage_reservations($r,$crstype);
+ } elsif ($env{'form.command'} eq 'showresv') {
+ &show_reservations($r,$env{'form.uname'},$env{'form.udom'});
+ } elsif ($env{'form.command'} eq 'showslots' && $vgr eq 'F') {
&show_table($r,$mgr);
} elsif ($env{'form.command'} eq 'remove_registration' && $mgr eq 'F') {
&remove_registration($r);
@@ -1695,6 +2454,8 @@ sub handler {
}
&csv_upload_map($r);
}
+ } elsif ($env{'form.command'} eq 'slotlog' && $mgr eq 'F') {
+ &show_reservations_log($r);
} else {
my $symb=&unescape($env{'form.symb'});
if (!defined($symb)) {