version 1.126, 2015/09/23 23:04:53
|
version 1.130, 2015/09/27 22:35:39
|
Line 162 $js
|
Line 162 $js
|
var startdate = startm+"/"+startd+"/"+starty; |
var startdate = startm+"/"+startd+"/"+starty; |
var starttime = new Date(startdate).getTime(); |
var starttime = new Date(startdate).getTime(); |
starttime = starttime/1000; |
starttime = starttime/1000; |
|
var starth = form.start_hour.options[form.start_hour.selectedIndex].value; |
|
if (numberRegExp.test(starth)) { |
|
starth = parseInt(starth); |
|
if (starth > 0 && starth <= 23) { |
|
starttime += 3600 * starth; |
|
} |
|
} |
var enddate = endm+"/"+endd+"/"+endy; |
var enddate = endm+"/"+endd+"/"+endy; |
var endtime = new Date(enddate).getTime(); |
var endtime = new Date(enddate).getTime(); |
endtime = endtime/1000; |
endtime = endtime/1000; |
|
var endh = form.end_hour.options[form.end_hour.selectedIndex].value; |
|
if (numberRegExp.test(endh)) { |
|
endh = parseInt(endh); |
|
if (endh > 0 && endh <= 23) { |
|
endtime += 3600 * endh; |
|
} |
|
} |
|
|
var shown = 0; |
var shown = 0; |
for (var i=0; i<$i; i++) { |
for (var i=0; i<$i; i++) { |
if ((slotstart[i] >= starttime) && (slotend[i] <= endtime)) { |
if ((slotstart[i] >= starttime) && (slotend[i] <= endtime)) { |
Line 245 function uncheckSlotRadio() {
|
Line 260 function uncheckSlotRadio() {
|
} |
} |
} |
} |
} |
} |
|
|
|
function toggleSlotMap(maprownum,rownum) { |
|
if (document.getElementById('arrow'+maprownum)) { |
|
var img = document.getElementById('arrow'+maprownum); |
|
var rowdisplay; |
|
var celldisplay = ''; |
|
if (img.src.indexOf('arrow.open.gif')!=-1) { |
|
img.src = '/adm/lonIcons/arrow.closed.gif'; |
|
rowdisplay = 'none'; |
|
} |
|
else { |
|
img.src = '/adm/lonIcons/arrow.open.gif'; |
|
rowdisplay = 'table-row'; |
|
celldisplay = 'none'; |
|
} |
|
var resrows; |
|
var maptext; |
|
if (document.getElementsByClassName) { |
|
resrows = document.getElementsByClassName('LC_slotresrow_'+maprownum); |
|
maptext = document.getElementsByClassName('LC_slotmaptext_'+maprownum); |
|
} else { |
|
resrows = getElementsByClassName(document.body,'LC_slotresrow_'+maprownum); |
|
maptext = getElementsByClassName(document.body,'LC_slotmaptext_'+maprownum); |
|
} |
|
if (maptext.length) { |
|
for (var i=0; i<maptext.length; i++) { |
|
maptext[i].style.display = celldisplay; |
|
} |
|
} |
|
if (resrows.length) { |
|
var mapbgidx = 0; |
|
var rowclasses = ['LC_even_row','LC_odd_row']; |
|
var mapbgClass = 'LC_even_row'; |
|
var regExpBg = /LC_odd_row/i; |
|
if (rowdisplay == 'table-row') { |
|
if (document.getElementById('LC_slotmaprow_'+rownum)) { |
|
mapbgClass = document.getElementById('LC_slotmaprow_'+rownum).className; |
|
if (regExpBg.test(mapbgClass)) { |
|
mapbgidx = 1; |
|
} |
|
} |
|
} |
|
for (var i=0; i<resrows.length; i++) { |
|
resrows[i].style.display = rowdisplay; |
|
if (rowdisplay == 'table-row') { |
|
mapbgidx ++; |
|
var bgcolnew = mapbgidx % 2; |
|
var bgcolold = (mapbgidx+1) % 2; |
|
var k = i+parseInt(rownum)+1; |
|
if (document.getElementById('LC_slotresrow_'+k)) { |
|
document.getElementById('LC_slotresrow_'+k).className = document.getElementById('LC_slotresrow_'+k).className.replace(rowclasses[bgcolold],rowclasses[bgcolnew]); |
|
} |
|
} |
|
} |
|
if (document.getElementById('LC_slot_reservations')) { |
|
var numrowsOdd = resrows.length % 2; |
|
if (numrowsOdd) { |
|
var lastbgClass = 'LC_even_row'; |
|
var idx = 0; |
|
var lastresnum = parseInt(rownum) + resrows.length; |
|
if (rowdisplay == 'none') { |
|
lastresnum = rownum; |
|
if (document.getElementById('LC_slotmaprow_'+rownum)) { |
|
lastbgClass = document.getElementById('LC_slotmaprow_'+rownum).className; |
|
} |
|
} else { |
|
lastresnum = parseInt(rownum) + resrows.length; |
|
if (document.getElementById('LC_slotresrow_'+lastresnum)) { |
|
lastbgClass = document.getElementById('LC_slotresrow_'+lastresnum).className; |
|
} |
|
} |
|
if (regExpBg.test(lastbgClass)) { |
|
idx = 1; |
|
} |
|
var table = document.getElementById('LC_slot_reservations'); |
|
if ((table.rows.length) && (table.rows.length >= lastresnum)) { |
|
for (var i=lastresnum; i<table.rows.length; i++) { |
|
if (table.rows[i].style.display != 'none') { |
|
idx ++; |
|
var bgcolnew = idx % 2; |
|
var bgcolold = (idx+1) % 2; |
|
j = i+1; |
|
if (document.getElementById('LC_slotmaprow_'+j)) { |
|
document.getElementById('LC_slotmaprow_'+j).className = rowclasses[bgcolnew]; |
|
} else { |
|
if (document.getElementById('LC_slotresrow_'+j)) { |
|
document.getElementById('LC_slotresrow_'+j).className = document.getElementById('LC_slotresrow_'+j).className.replace(rowclasses[bgcolold],rowclasses[bgcolnew]); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
// ]]> |
// ]]> |
</script> |
</script> |
ENDSCRIPT |
ENDSCRIPT |
Line 1002 sub allowed_slot {
|
Line 1114 sub allowed_slot {
|
# not allowed for this resource |
# not allowed for this resource |
if (defined($slot->{'symb'})) { |
if (defined($slot->{'symb'})) { |
my $exclude = 1; |
my $exclude = 1; |
my ($slotmap,$slotid,$sloturl) = &Apache::lonnet::decode_symb($slot->{'symb'}); |
my @symbs; |
if ($sloturl=~/\.(page|sequence)$/) { |
if ($slot->{'symb'} =~ /,/) { |
my ($map,$id,$url) = &Apache::lonnet::decode_symb($symb); |
@symbs = split(/\s*,\s*/,$slot->{'symb'}); |
if (($map ne '') && ($map eq $slotmap)) { |
} 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; |
$exclude = 0; |
|
last; |
} |
} |
} elsif ($slot->{'symb'} eq $symb) { |
|
$exclude = 0; |
|
} |
} |
if ($exclude) { |
if ($exclude) { |
unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) { |
unless ((ref($toskip) eq 'HASH') && ($toskip->{'symb'})) { |
Line 1043 sub get_description {
|
Line 1166 sub get_description {
|
} |
} |
|
|
sub show_choices { |
sub show_choices { |
my ($r,$symb,$formname,$num,$slots,$consumed_uniqueperiods,$available,$got_slots)=@_; |
my ($symb,$formname,$num,$class,$slots,$consumed_uniqueperiods,$available,$got_slots)=@_; |
my $output; |
my $output; |
&Apache::lonxml::debug("Checking Slots"); |
&Apache::lonxml::debug("Checking Slots"); |
if (!ref($available) eq 'ARRAY') { |
if (!ref($available) eq 'ARRAY') { |
Line 1055 sub show_choices {
|
Line 1178 sub show_choices {
|
$output .= ' <a href="/adm/flip?postdata=return:">'. |
$output .= ' <a href="/adm/flip?postdata=return:">'. |
&mt('Return to last resource').'</a>'; |
&mt('Return to last resource').'</a>'; |
} |
} |
$r->print($output); |
if ($class) { |
return; |
return '<div class="'.$class.'">'.$output.'</div>'; |
|
} else { |
|
return $output; |
|
} |
} |
} |
if (@{$available} > 1) { |
if (@{$available} > 1) { |
my $numavailable = scalar(@{$available}); |
my $numavailable = scalar(@{$available}); |
Line 1204 STUFF
|
Line 1330 STUFF
|
if (@{$available} > 1) { |
if (@{$available} > 1) { |
$output .= '</div></fieldset>'; |
$output .= '</div></fieldset>'; |
} |
} |
$r->print($output); |
if ($class) { |
return; |
return '<div class="'.$class.'">'.$output.'</div>'; |
|
} else { |
|
return $output; |
|
} |
} |
} |
|
|
sub to_show { |
sub to_show { |
Line 1360 sub show_table {
|
Line 1489 sub show_table {
|
'secret' => 'Secret Word', |
'secret' => 'Secret Word', |
'space' => '# of students/max', |
'space' => '# of students/max', |
'ip' => 'IP or DNS restrictions', |
'ip' => 'IP or DNS restrictions', |
'symb' => 'Resource/Map slot is restricted to.', |
'symb' => 'Resource(s)/Map(s) slot is restricted to.', |
'allowedsections' => 'Sections slot is restricted to.', |
'allowedsections' => 'Sections slot is restricted to.', |
'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', |
Line 1575 sub show_table {
|
Line 1704 sub show_table {
|
localtime($slots{$slot}{'uniqueperiod'}[1]); |
localtime($slots{$slot}{'uniqueperiod'}[1]); |
} |
} |
|
|
my $title; |
my @titles; |
if (exists($slots{$slot}{'symb'})) { |
if (exists($slots{$slot}{'symb'})) { |
my (undef,undef,$res)= |
my @symbs; |
&Apache::lonnet::decode_symb($slots{$slot}{'symb'}); |
if ($slots{$slot}{'symb'} =~ /,/) { |
$res = &Apache::lonnet::clutter($res); |
@symbs = split(/\s*,\s*/,$slots{$slot}{'symb'}); |
$title = &Apache::lonnet::gettitle($slots{$slot}{'symb'}); |
} else { |
$title='<a href="'.$res.'?symb='.$slots{$slot}{'symb'}.'">'.$title.'</a>'; |
@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,'<a href="'.$res.'?symb='.$reqsymb.'">'.$title.'</a>'); |
|
} |
} |
} |
|
|
my $allowedsections; |
my $allowedsections; |
Line 1698 LOGLINK
|
Line 1835 LOGLINK
|
$colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n"); |
$colspan++;$r->print("<td>$slots{$slot}{'ip'}</td>\n"); |
} |
} |
if (exists($show{'symb'})) { |
if (exists($show{'symb'})) { |
$colspan++;$r->print("<td>$title</td>\n"); |
$colspan++;$r->print("<td>".join('<br />',@titles)."</td>\n"); |
} |
} |
if (exists($show{'allowedsections'})) { |
if (exists($show{'allowedsections'})) { |
$colspan++;$r->print("<td>$allowedsections</td>\n"); |
$colspan++;$r->print("<td>$allowedsections</td>\n"); |
Line 1759 sub manage_reservations {
|
Line 1896 sub manage_reservations {
|
return; |
return; |
} |
} |
my (%parent,%shownparent,%container,%container_title,%contents); |
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 @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"); |
my $slotheader = '<p>'. |
my $slotheader = '<p>'. |
&mt('Your reservation status for any such assignments is listed below:'). |
&mt('Your reservation status for any such assignments is listed below:'). |
'</p>'. |
'</p>'. |
'<table class="LC_data_table LC_tableOfContent">'."\n"; |
'<table class="LC_data_table LC_tableOfContent" id="LC_slot_reservations">'."\n"; |
my $shownheader = 0; |
my $shownheader = 0; |
my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef); |
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()) { |
while (my $resource = $it->next()) { |
if ($resource == $it->BEGIN_MAP()) { |
if ($resource == $it->BEGIN_MAP()) { |
$depth++; |
$depth++; |
Line 1777 sub manage_reservations {
|
Line 1917 sub manage_reservations {
|
if ($resource == $it->END_MAP()) { |
if ($resource == $it->END_MAP()) { |
$depth--; |
$depth--; |
$lastcontainer = $parent{$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 .= '<td valign="top"><span class="'.$class.'">'. |
|
$output{$repsymb}{'msg'}. |
|
'</span></td><td valign="top">'. |
|
&slot_chooser($repsymb,$class,$formnum,$allavailable,$slots, |
|
$consumed_uniqueperiods). |
|
'</td>'; |
|
|
|
} else { |
|
$mapitem .= '<td colspan="2" valign="middle"><span class="'.$class.'">'. |
|
$output{$repsymb}{'msg'}. |
|
'</span></td>'; |
|
} |
|
} |
|
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'}. |
|
'<tr class="'.$bgcolor.' LC_slotresrow_'.$output{$symb}{'mapnum'}.'"'. |
|
' style="display:none" id="LC_slotresrow_'.$output{$symb}{'rownum'}.'">'. |
|
$output{$symb}{'info'}. |
|
$output{$symb}{'data'}.'</tr>'."\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'}. |
|
'<tr class="'.$bgcolor.' LC_slotresrow_'.$output{$symb}{'mapnum'}.'"'. |
|
' style="display:table-row" id="LC_slotresrow_'.$output{$symb}{'rownum'}.'">'. |
|
$output{$symb}{'info'}. |
|
$output{$symb}{'data'}.'</tr>'."\n"; |
|
$shown ++; |
|
} |
|
} |
|
} |
|
if ($mapitem) { |
|
if ($got_map_slot) { |
|
$mapitem =~ s{(<img src=\"/adm/lonIcons/arrow\.)open(\.gif\")}{$1closed$2}; |
|
$mapitem .= '</tr>'."\n"; |
|
} else { |
|
$mapitem .= '<td colspan="2"> </td></tr>'."\n"; |
|
} |
|
} |
|
$r->print($mapitem.$currmapoutput); |
|
@ordered=(); |
|
undef(%output); |
|
$currmapoutput = ''; |
|
$got_map_slot = ''; |
|
$mapitem = ''; |
} |
} |
if (ref($resource)) { |
if (ref($resource)) { |
my $symb = $resource->symb(); |
my $symb = $resource->symb(); |
my $ressymb = $symb; |
|
$contents{$lastcontainer} ++; |
$contents{$lastcontainer} ++; |
next if (!$resource->is_problem() && !$resource->is_sequence() && |
next if (!$resource->is_problem() && !$resource->is_sequence() && |
!$resource->is_page()); |
!$resource->is_page()); |
Line 1793 sub manage_reservations {
|
Line 2013 sub manage_reservations {
|
if ($resource->is_problem()) { |
if ($resource->is_problem()) { |
my ($useslots) = $resource->slot_control(); |
my ($useslots) = $resource->slot_control(); |
next if (($useslots eq '') || ($useslots =~ /^\s*no\s*$/i)); |
next if (($useslots eq '') || ($useslots =~ /^\s*no\s*$/i)); |
|
push(@ordered,$symb); |
|
$output{$symb}{type} = $useslots; |
my ($msg,$get_choices,$slotdescription); |
my ($msg,$get_choices,$slotdescription); |
my $title = $resource->compTitle(); |
my $title = $resource->compTitle(); |
my $status = $resource->simpleStatus('0'); |
my $status = $resource->simpleStatus('0'); |
my ($slot_status,$date,$slot_name) = $resource->check_for_slot('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 '') { |
if ($slot_name ne '') { |
my %slot=&Apache::lonnet::get_slot($slot_name); |
my %slot=&Apache::lonnet::get_slot($slot_name); |
$slotdescription=&get_description($slot_name,\%slot); |
$slotdescription=&get_description($slot_name,\%slot); |
Line 1840 sub manage_reservations {
|
Line 2065 sub manage_reservations {
|
$msg = &Apache::lonnavmaps::getDescription($resource,'0'); |
$msg = &Apache::lonnavmaps::getDescription($resource,'0'); |
} |
} |
} |
} |
|
$output{$symb}{'msg'} = $msg; |
$reservable ++; |
$reservable ++; |
|
$output{$symb}{'reservable'} = $reservable; |
my $treelevel = $depth; |
my $treelevel = $depth; |
my $higherup = $lastcontainer; |
my $higherup = $lastcontainer; |
if ($depth > 1) { |
if ($depth > 1) { |
Line 1861 sub manage_reservations {
|
Line 2088 sub manage_reservations {
|
$treelevel --; |
$treelevel --; |
$higherup = $parent{$treelevel}; |
$higherup = $parent{$treelevel}; |
} |
} |
foreach my $item (@maprows) { |
for (my $i=0; $i<@maprows; $i++) { |
|
$mapnum ++; |
$rownum ++; |
$rownum ++; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
$shown ++; |
|
my $bgcolor = $backgrounds[$shown % $numcolors]; |
if (!$shownheader) { |
if (!$shownheader) { |
$r->print($slotheader); |
$mapitem .= $slotheader; |
$shownheader = 1; |
$shownheader = 1; |
} |
} |
$r->print('<tr class="'.$bgcolor.'">'.$item.'</tr>'."\n"); |
if (ref($maprows[$i]) eq 'ARRAY') { |
|
if ($i < scalar(@maprows)-1) { |
|
$mapitem .= '<tr class="'.$bgcolor.'" id="LC_slotmaprow_'.$rownum.'">'. |
|
'<td>'.join('',@{$maprows[$i]}).'</td>'. |
|
'<td colspan="2"> </td></tr>'."\n"; |
|
} else { |
|
$mapitem .= |
|
'<tr class="'.$bgcolor.'" id="LC_slotmaprow_'.$rownum.'">'. |
|
'<td>'.$maprows[$i][0]. |
|
'<img src="/adm/lonIcons/arrow.open.gif" id="arrow'.$mapnum.'" '. |
|
'alt="arrow" onmouseover="this.style.cursor=\'pointer\'" '. |
|
'onclick="'."toggleSlotMap('$mapnum','$rownum');".'" />'. |
|
$maprows[$i][1].(' ' x6).'</td>'."\n"; |
|
} |
|
} |
} |
} |
|
$output{$symb}{'mapnum'} = $mapnum; |
} |
} |
$rownum ++; |
$rownum ++; |
my $bgcolor = $backgrounds[$rownum % $numcolors]; |
$output{$symb}{'rownum'} = $rownum; |
|
$output{$symb}{'shown'} = $shown; |
if (!$shownheader) { |
if (!$shownheader) { |
$r->print($slotheader); |
$output{$symb}{'header'} = $slotheader; |
$shownheader = 1; |
$shownheader = 1; |
} |
} |
$r->print('<tr class="'.$bgcolor.'"><td>'."\n"); |
$output{$symb}{'info'} = '<td>'; |
for (my $i=0; $i<$depth; $i++) { |
for (my $i=0; $i<$depth; $i++) { |
$r->print('<img src="'.$location.'" alt="" />'); |
$output{$symb}{'info'} .= '<img src="'.$location.'" alt="" />'; |
} |
} |
my $result = '<a href="'.$resource->src().'?symb='.$symb.'">'. |
$output{$symb}{'info'} .= '<a href="'.$resource->src().'?symb='.$symb.'">'. |
'<img class="LC_contentImage" src="/adm/lonIcons/'; |
'<img class="LC_contentImage" src="/adm/lonIcons/'; |
if ($resource->is_task()) { |
if ($resource->is_task()) { |
$result .= 'task.gif" alt="'.&mt('Task'); |
$output{$symb}{'info'} .= 'task.gif" alt="'.&mt('Task'); |
} else { |
} else { |
$result .= 'problem.gif" alt="'.&mt('Problem'); |
$output{$symb}{'info'} .= 'problem.gif" alt="'.&mt('Problem'); |
} |
} |
$result .= '" /><b>'.$title.'</b></a>'.(' ' x6).'</td>'; |
$output{$symb}{'info'} .= '" /><b>'.$title.'</b></a>'.(' ' x6).'</td>'; |
|
|
my $hasaction; |
my $hasaction; |
if ($status == $resource->OPEN) { |
if ($status == $resource->OPEN) { |
if ($get_choices) { |
if ($get_choices) { |
$hasaction = 1; |
$hasaction = 1; |
|
$output{$symb}{'hasaction'} = $hasaction; |
} |
} |
} |
} |
|
my $class = 'LC_slottext_'.$mapnum; |
if ($hasaction) { |
if ($hasaction) { |
$result .= '<td valign="top">'.$msg.'</td>'. |
$output{$symb}{'data'} = '<td valign="top"><span class="'.$class.'">'.$msg.'</span></td>'. |
'<td valign="top">'; |
'<td valign="top">'. |
|
&slot_chooser($symb,$class,$reservable,$allavailable,$slots, |
|
$consumed_uniqueperiods).'</td>'; |
} else { |
} else { |
$result .= '<td colspan="2" valign="middle">'.$msg.'</td>'; |
$output{$symb}{'data'} = '<td colspan="2" valign="middle">'. |
|
'<span class="'.$class.'">'.$msg.'</span>'. |
|
'</td>'; |
} |
} |
$r->print($result); |
|
if ($hasaction) { |
|
my @got_slots=&check_for_reservation($symb,'allslots'); |
|
if ($got_slots[0] =~ /^error: /) { |
|
$r->print('<span class="LC_error">'. |
|
&mt('An error occurred determining slot availability.'). |
|
'</span>'); |
|
} else { |
|
my $formname = 'manageres_'.$reservable; |
|
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 ((defined($slots->{$slot}->{'symb'})) && |
|
($slots->{$slot}->{'symb'} ne $symb)) { |
|
next; |
|
} |
|
} |
|
push(@available,$slot); |
|
} |
|
} |
|
&show_choices($r,$symb,$formname,$reservable,$slots,$consumed_uniqueperiods, |
|
\@available,\@got_slots); |
|
} |
|
} |
|
$r->print('</td>'); |
|
} |
|
$r->print('</tr>'); |
|
} |
} |
} |
} |
} |
} |
Line 1952 sub manage_reservations {
|
Line 2174 sub manage_reservations {
|
|
|
sub show_map_row { |
sub show_map_row { |
my ($depth,$location,$type,$title,$maprows) = @_; |
my ($depth,$location,$type,$title,$maprows) = @_; |
my $output = '<td>'; |
my $spacers; |
for (my $i=0; $i<$depth-1; $i++) { |
for (my $i=0; $i<$depth-2; $i++) { |
$output .= '<img src="'.$location.'" alt="" />'; |
$spacers .= '<img src="'.$location.'" alt="" />'; |
} |
} |
|
my $icon; |
if ($type eq 'page') { |
if ($type eq 'page') { |
$output .= '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" /> '."\n"; |
$icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" /> '."\n"; |
} else { |
} else { |
$output .= '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" /> '."\n"; |
$icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" /> '."\n"; |
} |
} |
$output .= $title.'</td><td colspan="2"> </td>'."\n"; |
$icon .= $title; |
unshift (@{$maprows},$output); |
unshift (@{$maprows},[$spacers,$icon]); |
return; |
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 = '<span class="'.$class.'"><span class="LC_error">'. |
|
&mt('An error occurred determining slot availability.'). |
|
'</span></span>'; |
|
} 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 { |
sub show_reservations { |
my ($r,$uname,$udom) = @_; |
my ($r,$uname,$udom) = @_; |
if (!defined($uname)) { |
if (!defined($uname)) { |
Line 2683 sub csvupload_fields {
|
Line 2955 sub csvupload_fields {
|
['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'], |
['symb','Resource/Map Restriction'], |
['symb','Resource(s)/Map(s) 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'], |
['allowedsections','Sections slot is restricted to'], |
Line 3018 sub handler {
|
Line 3290 sub handler {
|
} |
} |
if ($env{'form.requestattempt'}) { |
if ($env{'form.requestattempt'}) { |
$r->print('<div class="LC_left_float">'); |
$r->print('<div class="LC_left_float">'); |
&show_choices($r,$symb,undef,undef,\%slots,$consumed_uniqueperiods,$available,$got_slots); |
$r->print(&show_choices($symb,undef,undef,undef,\%slots,$consumed_uniqueperiods,$available,$got_slots)); |
$r->print('</div><div style="padding:0;clear:both;margin:0;border:0"></div>'); |
$r->print('</div><div style="padding:0;clear:both;margin:0;border:0"></div>'); |
} elsif ($env{'form.command'} eq 'release') { |
} elsif ($env{'form.command'} eq 'release') { |
&release_slot($r,$symb); |
&release_slot($r,$symb); |