version 1.130, 2015/09/27 22:35:39
|
version 1.134, 2016/10/27 21:02:02
|
Line 1494 sub show_table {
|
Line 1494 sub show_table {
|
'allowedusers' => 'Users slot is restricted to.', |
'allowedusers' => 'Users slot is restricted to.', |
'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', |
|
'iptied' => 'Unique IP each student',); |
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{'endreserve'} = &mt('Time members can no longer reserve'); |
Line 1502 sub show_table {
|
Line 1503 sub show_table {
|
} |
} |
my @show_order=('name','description','type','starttime','endtime', |
my @show_order=('name','description','type','starttime','endtime', |
'startreserve','endreserve','reservationmsg','secret','space', |
'startreserve','endreserve','reservationmsg','secret','space', |
'ip','symb','allowedsections','allowedusers','uniqueperiod', |
'ip','iptied','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 1601 sub show_table {
|
Line 1602 sub show_table {
|
$r->print('</div>'); |
$r->print('</div>'); |
$r->print('<p><input type="submit" name="start" value="'.&mt('Update Display').'" /></p>'); |
$r->print('<p><input type="submit" name="start" value="'.&mt('Update Display').'" /></p>'); |
my $linkstart='<a href="/adm/slotrequest?command=showslots&order='; |
my $linkstart='<a href="/adm/slotrequest?command=showslots&order='; |
$r->print(&Apache::loncommon::start_data_table(). |
my $tableheader = &Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row().' |
&Apache::loncommon::start_data_table_header_row().' |
<th></th>'); |
<th></th>'; |
foreach my $which (@show_order) { |
foreach my $which (@show_order) { |
if ($which ne 'proctor' && exists($show{$which})) { |
if ($which ne 'proctor' && exists($show{$which})) { |
$r->print('<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>'); |
$tableheader .= '<th>'.$linkstart.$which.'">'.$show_fields{$which}.'</a></th>'; |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_data_table_header_row()); |
$tableheader .= &Apache::loncommon::end_data_table_header_row(); |
|
my $shownheader = 0; |
|
|
my %name_cache; |
my %name_cache; |
my $slotsort = sub { |
my $slotsort = sub { |
Line 1766 sub show_table {
|
Line 1768 sub show_table {
|
delete => 'Delete', |
delete => 'Delete', |
slotlog => 'History', |
slotlog => 'History', |
); |
); |
my $edit=(<<"EDITLINK"); |
my ($edit,$delete,$showlog,$remove_all); |
|
if ($mgr) { |
|
$edit=(<<"EDITLINK"); |
<a href="/adm/helper/newslot.helper?name=$slot">$lt{'edit'}</a> |
<a href="/adm/helper/newslot.helper?name=$slot">$lt{'edit'}</a> |
EDITLINK |
EDITLINK |
|
|
my $delete=(<<"DELETELINK"); |
$delete=(<<"DELETELINK"); |
<a href="/adm/slotrequest?command=delete&slotname=$slot">$lt{'delete'}</a> |
<a href="/adm/slotrequest?command=delete&slotname=$slot">$lt{'delete'}</a> |
DELETELINK |
DELETELINK |
|
|
my $showlog=(<<"LOGLINK"); |
$remove_all=&remove_link($slot,'remove all').'<br />'; |
|
|
|
if ($ids eq '') { |
|
undef($remove_all); |
|
} else { |
|
undef($delete); |
|
} |
|
} |
|
|
|
$showlog=(<<"LOGLINK"); |
<a href="/adm/slotrequest?command=slotlog&slotname=$slot">$lt{'slotlog'}</a> |
<a href="/adm/slotrequest?command=slotlog&slotname=$slot">$lt{'slotlog'}</a> |
LOGLINK |
LOGLINK |
|
|
my $remove_all=&remove_link($slot,'remove all').'<br />'; |
|
|
|
if ($ids eq '') { |
|
undef($remove_all); |
|
} else { |
|
undef($delete); |
|
} |
|
if ($slots{$slot}{'type'} ne 'schedulable_student') { |
if ($slots{$slot}{'type'} ne 'schedulable_student') { |
undef($showlog); |
undef($showlog); |
undef($remove_all); |
undef($remove_all); |
} |
} |
|
|
|
unless ($shownheader) { |
|
$r->print($tableheader); |
|
$shownheader = 1; |
|
} |
|
|
my $row_start=&Apache::loncommon::start_data_table_row(); |
my $row_start=&Apache::loncommon::start_data_table_row(); |
my $row_end=&Apache::loncommon::end_data_table_row(); |
my $row_end=&Apache::loncommon::end_data_table_row(); |
$r->print($row_start. |
$r->print($row_start. |
Line 1834 LOGLINK
|
Line 1845 LOGLINK
|
if (exists($show{'ip'})) { |
if (exists($show{'ip'})) { |
$colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n"); |
$colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n"); |
} |
} |
|
if (exists($show{'iptied'})) { |
|
$colspan++; |
|
if ($slots{$slot}{'iptied'} eq 'yes') { |
|
$r->print('<td>'.&mt('Yes')."</td>\n"); |
|
} elsif ($slots{$slot}{'iptied'} eq 'answer') { |
|
$r->print('<td>'.&mt('Yes, including post-answer date')."</td>\n"); |
|
} else { |
|
$r->print('<td>'.&mt('No')."</td>\n"); |
|
} |
|
} |
if (exists($show{'symb'})) { |
if (exists($show{'symb'})) { |
$colspan++;$r->print("<td>".join('<br />',@titles)."</td>\n"); |
$colspan++;$r->print("<td>".join('<br />',@titles)."</td>\n"); |
} |
} |
Line 1858 $row_end
|
Line 1879 $row_end
|
STUFF |
STUFF |
} |
} |
} |
} |
$r->print(&Apache::loncommon::end_data_table().'</form>'); |
if ($shownheader) { |
|
$r->print(&Apache::loncommon::end_data_table()); |
|
} else { |
|
$r->print('<p>'.&mt('No slots meet the criteria for display').'</p>'); |
|
} |
|
$r->print('</form>'); |
return; |
return; |
} |
} |
|
|
Line 2349 sub show_reservations {
|
Line 2375 sub show_reservations {
|
if ($showntablehdr) { |
if ($showntablehdr) { |
$r->print(&Apache::loncommon::end_data_table().'<br />'); |
$r->print(&Apache::loncommon::end_data_table().'<br />'); |
if (($curr{'page'} > 1) || ($more_records)) { |
if (($curr{'page'} > 1) || ($more_records)) { |
$r->print('<table><tr>'); |
$r->print('<p>'); |
if ($curr{'page'} > 1) { |
if ($curr{'page'} > 1) { |
$r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>'); |
$r->print('<input type="button" onclick="javascript:chgPage('."'previous'".');" value="'. |
|
&mt('Previous [_1] changes',$curr{'show'}).'" />'); |
} |
} |
if ($more_records) { |
if ($more_records) { |
$r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>'); |
$r->print('<input type="button" onclick="javascript:chgPage('."'next'".');" value="'. |
|
&mt('Next [_1] changes',$curr{'show'}).'" />'); |
} |
} |
$r->print('</tr></table>'); |
$r->print('</p>'); |
$r->print(<<"ENDSCRIPT"); |
$r->print(<<"ENDSCRIPT"); |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 2560 sub show_reservations_log {
|
Line 2588 sub show_reservations_log {
|
if ($showntablehdr) { |
if ($showntablehdr) { |
$r->print(&Apache::loncommon::end_data_table().'<br />'); |
$r->print(&Apache::loncommon::end_data_table().'<br />'); |
if (($curr{'page'} > 1) || ($more_records)) { |
if (($curr{'page'} > 1) || ($more_records)) { |
$r->print('<table><tr>'); |
$r->print('<p>'); |
if ($curr{'page'} > 1) { |
if ($curr{'page'} > 1) { |
$r->print('<td><a href="javascript:chgPage('."'previous'".');">'.&mt('Previous [_1] changes',$curr{'show'}).'</a></td>'); |
$r->print('<input type="button" onclick="javascript:chgPage('."'previous'".');" value="'. |
|
&mt('Previous [_1] changes',$curr{'show'}).'" />'); |
} |
} |
if ($more_records) { |
if ($more_records) { |
$r->print('<td><a href="javascript:chgPage('."'next'".');">'.&mt('Next [_1] changes',$curr{'show'}).'</a></td>'); |
$r->print('<input type="button" onclick="javascript:chgPage('."'next'".');" value="'. |
|
&mt('Next [_1] changes',$curr{'show'}).'" />'); |
} |
} |
$r->print('</tr></table>'); |
$r->print('</p>'); |
$r->print(<<"ENDSCRIPT"); |
$r->print(<<"ENDSCRIPT"); |
<script type="text/javascript"> |
<script type="text/javascript"> |
function chgPage(caller) { |
function chgPage(caller) { |
Line 2707 sub display_filter {
|
Line 2737 sub display_filter {
|
} |
} |
$output .= '</select></td>'; |
$output .= '</select></td>'; |
} |
} |
$output .= '<td> </td><td valign="middle"><input type="submit" value="'. |
$output .= '<td> </td></tr></table>'. |
&mt('Update Display').'" /></tr></table>'. |
'<p><input type="submit" value="'. |
|
&mt('Update Display').'" /></p>'. |
'<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.9.0'); |
,'2.9.0'); |
Line 2952 sub csvupload_fields {
|
Line 2983 sub csvupload_fields {
|
['endreserve','Reservation End 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'], |
|
['iptied','Unique IP each student'], |
['proctor','List of proctor ids'], |
['proctor','List of proctor ids'], |
['description','Slot Description'], |
['description','Slot Description'], |
['maxspace','Maximum number of reservations'], |
['maxspace','Maximum number of reservations'], |
Line 3023 sub csv_upload_assign {
|
Line 3055 sub csv_upload_assign {
|
} |
} |
|
|
if ($entries{$fields{'startreserve'}}) { |
if ($entries{$fields{'startreserve'}}) { |
$slot{'startreserve'}= |
my $date = &UnixDate($entries{$fields{'startreserve'}},"%s"); |
&UnixDate($entries{$fields{'startreserve'}},"%s"); |
if ($date eq '') { |
|
push(@errors,"$name -- No reservation start time set for slot -- value provided had invalid format"); |
|
} else { |
|
$slot{'startreserve'} = $date; |
|
} |
} |
} |
if (defined($slot{'startreserve'}) |
if (defined($slot{'startreserve'}) |
&& $slot{'startreserve'} > $slot{'starttime'}) { |
&& $slot{'startreserve'} > $slot{'starttime'}) { |
Line 3033 sub csv_upload_assign {
|
Line 3069 sub csv_upload_assign {
|
} |
} |
|
|
if ($entries{$fields{'endreserve'}}) { |
if ($entries{$fields{'endreserve'}}) { |
$slot{'endreserve'}= |
my $date = &UnixDate($entries{$fields{'endreserve'}},"%s"); |
&UnixDate($entries{$fields{'endreserve'}},"%s"); |
if ($date eq '') { |
|
push(@errors,"$name -- No reservation end time set for slot -- value provided had invalid format"); |
|
} else { |
|
$slot{'endreserve'} = $date; |
|
} |
} |
} |
if (defined($slot{'endreserve'}) |
if (defined($slot{'endreserve'}) |
&& $slot{'endreserve'} > $slot{'starttime'}) { |
&& $slot{'endreserve'} > $slot{'starttime'}) { |
Line 3062 sub csv_upload_assign {
|
Line 3102 sub csv_upload_assign {
|
$slot{$key}=$entries{$fields{$key}}; |
$slot{$key}=$entries{$fields{$key}}; |
} |
} |
} |
} |
|
if ($entries{$fields{'iptied'}} =~ /^\s*(yes|1)\s*$/i) { |
|
$slot{'iptied'}='yes'; |
|
} elsif ($entries{$fields{'iptied'}} =~ /^\s*answer\s*$/i) { |
|
$slot{'iptied'}='answer'; |
|
} |
if ($entries{$fields{'allowedusers'}}) { |
if ($entries{$fields{'allowedusers'}}) { |
$entries{$fields{'allowedusers'}} =~ s/^\s+//; |
$entries{$fields{'allowedusers'}} =~ s/^\s+//; |
$entries{$fields{'allowedusers'}} =~ s/\s+$//; |
$entries{$fields{'allowedusers'}} =~ s/\s+$//; |
Line 3094 sub csv_upload_assign {
|
Line 3139 sub csv_upload_assign {
|
} |
} |
} |
} |
if ($entries{$fields{'uniqueperiod'}}) { |
if ($entries{$fields{'uniqueperiod'}}) { |
my ($start,$end)=split(',',$entries{$fields{'uniqueperiod'}}); |
my ($start,$end)= map { &UnixDate($_,"%s"); } split(',',$entries{$fields{'uniqueperiod'}}); |
my @times=(&UnixDate($start,"%s"), |
if (($start ne '') && ($end ne '')) { |
&UnixDate($end,"%s")); |
$slot{'uniqueperiod'}=[$start,$end]; |
$slot{'uniqueperiod'}=\@times; |
} else { |
|
push(@errors,"$name -- Slot's unique period ignored -- one or both of the comma separated values for start and end had an invalid format"); |
|
} |
} |
} |
if (defined($slot{'uniqueperiod'}) |
if (ref($slot{'uniqueperiod'}) eq 'ARRAY' |
&& $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) { |
&& $slot{'uniqueperiod'}[0] > $slot{'uniqueperiod'}[1]) { |
push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time."); |
push(@errors,"$name not created -- Slot's unique period start time is later than the unique period's end time."); |
next; |
next; |
Line 3262 sub handler {
|
Line 3309 sub handler {
|
} |
} |
&csv_upload_map($r); |
&csv_upload_map($r); |
} |
} |
} elsif ($env{'form.command'} eq 'slotlog' && $mgr eq 'F') { |
} elsif (($env{'form.command'} eq 'slotlog') && ($vgr eq 'F')) { |
&show_reservations_log($r); |
&show_reservations_log($r); |
} else { |
} else { |
my $symb=&unescape($env{'form.symb'}); |
my $symb=&unescape($env{'form.symb'}); |
Line 3284 sub handler {
|
Line 3331 sub handler {
|
my ($status) = &Apache::lonhomework::check_slot_access('0',$type); |
my ($status) = &Apache::lonhomework::check_slot_access('0',$type); |
if ($status eq 'CAN_ANSWER' || |
if ($status eq 'CAN_ANSWER' || |
$status eq 'NEEDS_CHECKIN' || |
$status eq 'NEEDS_CHECKIN' || |
$status eq 'WAITING_FOR_GRADE') { |
$status eq 'WAITING_FOR_GRADE' || |
|
$status eq 'NEED_DIFFERENT_IP') { |
&fail($r,'not_allowed'); |
&fail($r,'not_allowed'); |
return OK; |
return OK; |
} |
} |