version 1.100, 2009/08/05 13:40:10
|
version 1.106, 2009/11/04 15:37:23
|
Line 1026 sub show_table {
|
Line 1026 sub show_table {
|
my ($r,$mgr)=@_; |
my ($r,$mgr)=@_; |
|
|
my ($cnum,$cdom)=&get_course(); |
my ($cnum,$cdom)=&get_course(); |
|
my $crstype=&Apache::loncommon::course_type($cdom.'_'.$cnum); |
my %slots=&Apache::lonnet::dump('slots',$cdom,$cnum); |
my %slots=&Apache::lonnet::dump('slots',$cdom,$cnum); |
if ( (keys(%slots))[0] =~ /^error: 2 /) { |
if ( (keys(%slots))[0] =~ /^error: 2 /) { |
undef(%slots); |
undef(%slots); |
Line 1049 sub show_table {
|
Line 1050 sub show_table {
|
} |
} |
|
|
if (!keys(%slots)) { |
if (!keys(%slots)) { |
$r->print('<div>'.&mt('No slots have been created in this course.').'</div>'); |
if ($crstype eq 'Community') { |
|
$r->print('<div>'.&mt('No slots have been created in this community.').'</div>'); |
|
} else { |
|
$r->print('<div>'.&mt('No slots have been created in this course.').'</div>'); |
|
} |
return; |
return; |
} |
} |
|
|
Line 1085 sub show_table {
|
Line 1090 sub show_table {
|
'uniqueperiod' => 'Period of time slot is unique', |
'uniqueperiod' => 'Period of time slot is unique', |
'scheduled' => 'Scheduled Students', |
'scheduled' => 'Scheduled Students', |
'proctor' => 'List of proctors'); |
'proctor' => 'List of proctors'); |
|
if ($crstype eq 'Community') { |
|
$show_fields{'startreserve'} = &mt('Time members can start reserving'); |
|
$show_fields{'scheduled'} = &mt('Scheduled Members'); |
|
} |
my @show_order=('name','description','type','starttime','endtime', |
my @show_order=('name','description','type','starttime','endtime', |
'startreserve','secret','space','ip','symb', |
'startreserve','secret','space','ip','symb', |
'allowedsections','allowedusers','uniqueperiod', |
'allowedsections','allowedusers','uniqueperiod', |
Line 1429 STUFF
|
Line 1438 STUFF
|
} |
} |
|
|
sub manage_reservations { |
sub manage_reservations { |
my ($r,$type) = @_; |
my ($r,$crstype) = @_; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
$r->print('<p>' |
$r->print('<p>' |
.&mt('Instructors may use a reservation system to place restrictions on when and where assignments can be worked on.') |
.&mt('Instructors may use a reservation system to place restrictions on when and where assignments can be worked on.') |
.'<br />' |
.'<br />' |
.&mt('One example is for management of laboratory space, which is only available at certain times, and has a limited number of seats.') |
.&mt('One example is for management of laboratory space, which is only available at certain times, and has a limited number of seats.') |
.'</p><p>' |
|
.&mt('Your reservation status for any such assignments is listed below:') |
|
.'</p>' |
.'</p>' |
); |
); |
if (!defined($navmap)) { |
if (!defined($navmap)) { |
$r->print('<div class="LC_error">'. |
$r->print('<div class="LC_error">'); |
&mt('Unable to retrieve information about course contents'). |
if ($crstype eq 'Community') { |
'</div>'); |
$r->print(&mt('Unable to retrieve information about community contents')); |
&Apache::lonnet::logthis('Manage Reservations - could not create navmap object in '.lc($type).':'.$env{'request.course.id'}); |
} else { |
|
$r->print(&mt('Unable to retrieve information about course contents')); |
|
} |
|
$r->print('</div>'); |
|
&Apache::lonnet::logthis('Manage Reservations - could not create navmap object in '.lc($crstype).':'.$env{'request.course.id'}); |
return; |
return; |
} |
} |
my (%parent,%shownparent,%container,%container_title,%contents); |
my (%parent,%shownparent,%container,%container_title,%contents); |
Line 1451 sub manage_reservations {
|
Line 1462 sub manage_reservations {
|
my @backgrounds = ("LC_odd_row","LC_even_row"); |
my @backgrounds = ("LC_odd_row","LC_even_row"); |
my $numcolors = scalar(@backgrounds); |
my $numcolors = scalar(@backgrounds); |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif"); |
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif"); |
$r->print('<table class="LC_data_table LC_tableOfContent">'."\n"); |
my $slotheader = '<p>'. |
|
&mt('Your reservation status for any such assignments is listed below:'). |
|
'</p>'. |
|
'<table class="LC_data_table LC_tableOfContent">'."\n"; |
|
my $shownheader = 0; |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
while (my $resource = $it->next()) { |
while (my $resource = $it->next()) { |
if ($resource == $it->BEGIN_MAP()) { |
if ($resource == $it->BEGIN_MAP()) { |
Line 1546 sub manage_reservations {
|
Line 1561 sub manage_reservations {
|
foreach my $item (@maprows) { |
foreach my $item (@maprows) { |
$rownum ++; |
$rownum ++; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
|
if (!$shownheader) { |
|
$r->print($slotheader); |
|
$shownheader = 1; |
|
} |
$r->print('<tr class="'.$bgcolor.'">'.$item.'</tr>'."\n"); |
$r->print('<tr class="'.$bgcolor.'">'.$item.'</tr>'."\n"); |
} |
} |
} |
} |
$rownum ++; |
$rownum ++; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
|
if (!$shownheader) { |
|
$r->print($slotheader); |
|
$shownheader = 1; |
|
} |
$r->print('<tr class="'.$bgcolor.'"><td>'."\n"); |
$r->print('<tr class="'.$bgcolor.'"><td>'."\n"); |
for (my $i=0; $i<$depth; $i++) { |
for (my $i=0; $i<$depth; $i++) { |
$r->print('<img src="'.$location.'" alt="" />'); |
$r->print('<img src="'.$location.'" alt="" />'); |
Line 1585 sub manage_reservations {
|
Line 1608 sub manage_reservations {
|
} |
} |
} |
} |
} |
} |
|
if ($shownheader) { |
|
$r->print('</table>'); |
|
} |
if (!$reservable) { |
if (!$reservable) { |
$r->print('<span class="LC_info">'.&mt('No course items currently require a reservation to gain access.').'</span>'); |
$r->print('<span class="LC_info">'); |
|
if ($crstype eq 'Community') { |
|
$r->print(&mt('No community items currently require a reservation to gain access.')); |
|
} else { |
|
$r->print(&mt('No course items currently require a reservation to gain access.')); |
|
} |
|
$r->print('</span>'); |
} |
} |
$r->print('</table>'. |
$r->print('<p><a href="/adm/slotrequest?command=showresv">'. |
'<p><a href="/adm/slotrequest?command=showresv">'. |
|
&mt('Reservation History').'</a></p>'); |
&mt('Reservation History').'</a></p>'); |
} |
} |
|
|
Line 1620 sub show_reservations {
|
Line 1651 sub show_reservations {
|
my $formname = 'slotlog'; |
my $formname = 'slotlog'; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
|
my $crstype = &Apache::loncommon::course_type(); |
my %log=&Apache::lonnet::dump('nohist_'.$cdom.'_'.$cnum.'_slotlog',$udom,$uname); |
my %log=&Apache::lonnet::dump('nohist_'.$cdom.'_'.$cnum.'_slotlog',$udom,$uname); |
if ($env{'form.origin'} eq 'aboutme') { |
if ($env{'form.origin'} eq 'aboutme') { |
$r->print('<div class="LC_fontsize_large">'. |
$r->print('<div class="LC_fontsize_large">'); |
&mt('History of student-reservable slots for: [_1]', |
my $name = &Apache::loncommon::plainname($env{'form.uname'},$env{'form.udom'}, |
&Apache::loncommon::plainname($env{'form.uname'},$env{'form.udom'}, |
'firstname'); |
'firstname')).'</div>'); |
if ($crstype eq 'Community') { |
|
$r->print(&mt('History of member-reservable slots for: [_1]', |
|
$name)); |
|
} else { |
|
$r->print(&mt('History of student-reservable slots for: [_1]', |
|
$name)); |
|
|
|
} |
|
$r->print('</div>'); |
} |
} |
$r->print('<form action="/adm/slotrequest" method="post" name="'.$formname.'">'); |
$r->print('<form action="/adm/slotrequest" method="post" name="'.$formname.'">'); |
# set defaults |
# set defaults |
Line 1674 sub show_reservations {
|
Line 1714 sub show_reservations {
|
} |
} |
} |
} |
my (%titles,%maptitles); |
my (%titles,%maptitles); |
my %lt = &reservationlog_contexts(); |
my %lt = &reservationlog_contexts($crstype); |
foreach my $id (sort { $log{$b}{'exe_time'}<=>$log{$a}{'exe_time'} } (keys(%log))) { |
foreach my $id (sort { $log{$b}{'exe_time'}<=>$log{$a}{'exe_time'} } (keys(%log))) { |
next if (($log{$id}{'exe_time'} < $curr{'log_start_date'}) || |
next if (($log{$id}{'exe_time'} < $curr{'log_start_date'}) || |
($log{$id}{'exe_time'} > $curr{'log_end_date'})); |
($log{$id}{'exe_time'} > $curr{'log_end_date'})); |
Line 1754 ENDSCRIPT
|
Line 1794 ENDSCRIPT
|
sub show_reservations_log { |
sub show_reservations_log { |
my ($r) = @_; |
my ($r) = @_; |
my $badslot; |
my $badslot; |
|
my $crstype = &Apache::loncommon::course_type(); |
if ($env{'form.slotname'} eq '') { |
if ($env{'form.slotname'} eq '') { |
$r->print('<div class="LC_warning">'.&mt('No slot name provided').'</div>'); |
$r->print('<div class="LC_warning">'.&mt('No slot name provided').'</div>'); |
$badslot = 1; |
$badslot = 1; |
Line 1764 sub show_reservations_log {
|
Line 1805 sub show_reservations_log {
|
$badslot = 1; |
$badslot = 1; |
} elsif ($slot{type} ne 'schedulable_student') { |
} elsif ($slot{type} ne 'schedulable_student') { |
my $description = &get_description($env{'form.slotname'},\%slot); |
my $description = &get_description($env{'form.slotname'},\%slot); |
$r->print('<div class="LC_warning">'.&mt('Reservation history unavailable for non-student-reservable slot: [_1].',$description).'</div>'); |
$r->print('<div class="LC_warning">'); |
|
if ($crstype eq 'Community') { |
|
$r->print(&mt('Reservation history unavailable for non-member-reservable slot: [_1].',$description)); |
|
} else { |
|
$r->print(&mt('Reservation history unavailable for non-student-reservable slot: [_1].',$description)); |
|
} |
|
$r->print('</div>'); |
$badslot = 1; |
$badslot = 1; |
} |
} |
} |
} |
Line 1835 sub show_reservations_log {
|
Line 1882 sub show_reservations_log {
|
|
|
my %slot=&Apache::lonnet::get_slot($env{'form.slotname'}); |
my %slot=&Apache::lonnet::get_slot($env{'form.slotname'}); |
my $description = $slot{'description'}; |
my $description = $slot{'description'}; |
$r->print('<span class="LC_fontsize_large">'. |
$r->print('<span class="LC_fontsize_large">'); |
&mt('Reservation changes for student-reservable slot: [_1]',$description).'</span><br />'); |
if ($crstype eq 'Community') { |
|
$r->print(&mt('Reservation changes for member-reservable slot: [_1]',$description)); |
|
} else { |
|
$r->print(&mt('Reservation changes for student-reservable slot: [_1]',$description)); |
|
} |
|
$r->print('</span><br />'); |
$r->print(&display_filter($formname,$cdom,$cnum,\%curr,$version,\@allsymbs)); |
$r->print(&display_filter($formname,$cdom,$cnum,\%curr,$version,\@allsymbs)); |
my $showntablehdr = 0; |
my $showntablehdr = 0; |
my $tablehdr = &Apache::loncommon::start_data_table(). |
my $tablehdr = &Apache::loncommon::start_data_table(). |
Line 1855 sub show_reservations_log {
|
Line 1906 sub show_reservations_log {
|
$minshown = 1 + ($curr{'page'} - 1) * $curr{'show'}; |
$minshown = 1 + ($curr{'page'} - 1) * $curr{'show'}; |
} |
} |
} |
} |
my %lt = &reservationlog_contexts(); |
my %lt = &reservationlog_contexts($crstype); |
my (%titles,%maptitles); |
my (%titles,%maptitles); |
foreach my $id (sort { $log{$b}{'exe_time'}<=>$log{$a}{'exe_time'} } (keys(%log))) { |
foreach my $id (sort { $log{$b}{'exe_time'}<=>$log{$a}{'exe_time'} } (keys(%log))) { |
next if (($log{$id}{'exe_time'} < $curr{'log_start_date'}) || |
next if (($log{$id}{'exe_time'} < $curr{'log_start_date'}) || |
Line 1975 sub get_resource_title {
|
Line 2026 sub get_resource_title {
|
} |
} |
|
|
sub reservationlog_contexts { |
sub reservationlog_contexts { |
|
my ($crstype) = @_; |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
any => 'Any', |
any => 'Any', |
user => 'By student', |
user => 'By student', |
Line 1984 sub reservationlog_contexts {
|
Line 2036 sub reservationlog_contexts {
|
release => 'Dropped reservation', |
release => 'Dropped reservation', |
usermanage => 'By student', |
usermanage => 'By student', |
); |
); |
|
if ($crstype eq 'Community') { |
|
$lt{'user'} = &mt('By member'); |
|
$lt{'usermanage'} = $lt{'user'}; |
|
} |
return %lt; |
return %lt; |
} |
} |
|
|
Line 2004 sub display_filter {
|
Line 2060 sub display_filter {
|
&Apache::lonhtmlcommon::date_setter($formname,'log_end_date', |
&Apache::lonhtmlcommon::date_setter($formname,'log_end_date', |
$curr->{'log_end_date'},undef, |
$curr->{'log_end_date'},undef, |
undef,undef,undef,undef,undef,undef,$nolink); |
undef,undef,undef,undef,undef,undef,$nolink); |
my %lt = &reservationlog_contexts(); |
my $crstype = &Apache::loncommon::course_type(); |
|
my %lt = &reservationlog_contexts($crstype); |
$output .= '<td valign="top"><b>'.&mt('Window during which changes occurred:'). |
$output .= '<td valign="top"><b>'.&mt('Window during which changes occurred:'). |
'</b><br /><table><tr><td>'.&mt('After:'). |
'</b><br /><table><tr><td>'.&mt('After:'). |
'</td><td>'.$startform.'</td></tr><tr><td>'.&mt('Before:').'</td><td>'. |
'</td><td>'.$startform.'</td></tr><tr><td>'.&mt('Before:').'</td><td>'. |
Line 2054 sub display_filter {
|
Line 2111 sub display_filter {
|
&mt('Update Display').'" /></tr></table>'. |
&mt('Update Display').'" /></tr></table>'. |
'<p class="LC_info">'. |
'<p class="LC_info">'. |
&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.' |
&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.' |
,'2.6.99.0'); |
,'2.9.0'); |
if ($version) { |
if ($version) { |
$output .= ' '.&mt('This LON-CAPA server is version [_1]',$version); |
$output .= ' '.&mt('This LON-CAPA server is version [_1]',$version); |
} |
} |
Line 2064 sub display_filter {
|
Line 2121 sub display_filter {
|
|
|
sub upload_start { |
sub upload_start { |
my ($r)=@_; |
my ($r)=@_; |
$r->print(&Apache::grades::checkforfile_js()); |
$r->print( |
my $result.='<table width="100%" border="0"><tr bgcolor="#E6FFFF"><td>'."\n"; |
&Apache::grades::checkforfile_js() |
$result.=' <b>'. |
.'<h3>'.&mt('Specify a file containing the slot definitions.').'</h3>' |
&mt('Specify a file containing the slot definitions.'). |
.'<form method="post" enctype="multipart/form-data"' |
'</b></td></tr>'."\n"; |
.' action="/adm/slotrequest" name="slotupload">' |
$result.='<tr bgcolor="#ffffe6"><td>'."\n"; |
.'<input type="hidden" name="command" value="csvuploadmap" />' |
my $upfile_select=&Apache::loncommon::upfile_select_html(); |
.&Apache::lonhtmlcommon::start_pick_box() |
my $ignore=&mt('Ignore First Line'); |
.&Apache::lonhtmlcommon::row_title(&mt('File')) |
$result.=<<ENDUPFORM; |
.&Apache::loncommon::upfile_select_html() |
<form method="post" enctype="multipart/form-data" action="/adm/slotrequest" name="slotupload"> |
.&Apache::lonhtmlcommon::row_closure() |
<input type="hidden" name="command" value="csvuploadmap" /> |
.&Apache::lonhtmlcommon::row_title( |
$upfile_select |
'<label for="noFirstLine">' |
<br /><input type="button" onClick="javascript:checkUpload(this.form);" value="Upload Data" /> |
.&mt('Ignore First Line') |
<label><input type="checkbox" name="noFirstLine" />$ignore</label> |
.'</label>') |
</form> |
.'<input type="checkbox" name="noFirstLine" id="noFirstLine" />' |
ENDUPFORM |
.&Apache::lonhtmlcommon::row_closure(1) |
$result.='</td></tr></table>'."\n"; |
.&Apache::lonhtmlcommon::end_pick_box() |
$result.='</td></tr></table>'."\n"; |
.'<p>' |
$r->print($result); |
.'<input type="button" onclick="javascript:checkUpload(this.form);"' |
|
.' value="'.&mt('Next').'" />' |
|
.'</p>' |
|
.'</form>' |
|
); |
} |
} |
|
|
sub csvuploadmap_header { |
sub csvuploadmap_header { |
Line 2104 sub csvuploadmap_header {
|
Line 2165 sub csvuploadmap_header {
|
Total number of records found in file: $distotal <hr /> |
Total number of records found in file: $distotal <hr /> |
Enter as many fields as you can. The system will inform you and bring you back |
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.<hr /> |
to this page if the data selected is insufficient to create the slots.<hr /> |
<input type="button" value="Reverse Association" onClick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> |
<input type="button" value="Reverse Association" onclick="javascript:this.form.associate.value='Reverse Association';submit(this.form);" /> |
<label><input type="checkbox" name="noFirstLine"$checked />$ignore</label> |
<label><input type="checkbox" name="noFirstLine"$checked />$ignore</label> |
<input type="hidden" name="associate" value="" /> |
<input type="hidden" name="associate" value="" /> |
<input type="hidden" name="datatoken" value="$datatoken" /> |
<input type="hidden" name="datatoken" value="$datatoken" /> |
Line 2129 sub csvuploadmap_footer {
|
Line 2190 sub csvuploadmap_footer {
|
</table> |
</table> |
<input type="hidden" name="nfields" value="$i" /> |
<input type="hidden" name="nfields" value="$i" /> |
<input type="hidden" name="keyfields" value="$keyfields" /> |
<input type="hidden" name="keyfields" value="$keyfields" /> |
<input type="button" onClick="javascript:verify(this.form)" value="$buttontext" /><br /> |
<input type="button" onclick="javascript:verify(this.form)" value="$buttontext" /><br /> |
</form> |
</form> |
ENDPICK |
ENDPICK |
} |
} |