--- loncom/interface/slotrequest.pm 2015/09/25 16:13:00 1.128 +++ loncom/interface/slotrequest.pm 2015/09/27 14:21:48 1.129 @@ -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.128 2015/09/25 16:13:00 raeburn Exp $ +# $Id: slotrequest.pm,v 1.129 2015/09/27 14:21:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -261,7 +261,7 @@ function uncheckSlotRadio() { } } -function toggleSlotMap(maprownum) { +function toggleSlotMap(maprownum,rownum) { if (document.getElementById('arrow'+maprownum)) { var img = document.getElementById('arrow'+maprownum); var rowdisplay; @@ -278,20 +278,81 @@ function toggleSlotMap(maprownum) { var resrows; var maptext; if (document.getElementsByClassName) { - resrows = document.getElementsByClassName('LC_slotmaprow_'+maprownum); + resrows = document.getElementsByClassName('LC_slotresrow_'+maprownum); maptext = document.getElementsByClassName('LC_slotmaptext_'+maprownum); } else { - resrows = getElementsByClassName(document.body,'LC_slotmaprow_'+maprownum); + resrows = getElementsByClassName(document.body,'LC_slotresrow_'+maprownum); maptext = getElementsByClassName(document.body,'LC_slotmaptext_'+maprownum); } + if (maptext.length) { + for (var i=0; i= lastresnum)) { + for (var i=lastresnum; i'. - ''."\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()) { - @ordered=(); - undef(%output); - $currmapoutput = ''; - $got_map_slot = ''; - $mapitem = ''; $depth++; $parent{$depth} = $lastcontainer; } @@ -1881,23 +1938,30 @@ sub manage_reservations { ''; } } + my $counter = 0; foreach my $symb (@ordered) { if (ref($output{$symb}) eq 'HASH') { - my $bgcolor = $backgrounds[$output{$symb}{'rownum'} % $numcolors]; + $counter ++; + my $bgcolor = $backgrounds[($output{$symb}{'shown'} + $counter) % $numcolors]; $currmapoutput .= $output{$symb}{'header'}. - ''.$output{$symb}{'info'}. + ''. + $output{$symb}{'info'}. $output{$symb}{'data'}.''."\n"; } } } else { + my $counter = 0; foreach my $symb (@ordered) { if (ref($output{$symb}) eq 'HASH') { - my $bgcolor = $backgrounds[$output{$symb}{'rownum'} % $numcolors]; + $counter ++; + my $bgcolor = $backgrounds[($output{$symb}{'shown'} + $counter) % $numcolors]; $currmapoutput .= $output{$symb}{'header'}. - ''.$output{$symb}{'info'}. + ''. + $output{$symb}{'info'}. $output{$symb}{'data'}.''."\n"; + $shown ++; } } } @@ -1910,6 +1974,11 @@ sub manage_reservations { } } $r->print($mapitem.$currmapoutput); + @ordered=(); + undef(%output); + $currmapoutput = ''; + $got_map_slot = ''; + $mapitem = ''; } if (ref($resource)) { my $symb = $resource->symb(); @@ -2003,21 +2072,24 @@ sub manage_reservations { for (my $i=0; $i<@maprows; $i++) { $mapnum ++; $rownum ++; - my $bgcolor = $backgrounds[$rownum % $numcolors]; + $shown ++; + my $bgcolor = $backgrounds[$shown % $numcolors]; if (!$shownheader) { $mapitem .= $slotheader; $shownheader = 1; } if (ref($maprows[$i]) eq 'ARRAY') { if ($i < scalar(@maprows)-1) { - $mapitem .= ''. + $mapitem .= ''. + ''. ''."\n"; } else { $mapitem .= - ''. + ''."\n"; } } @@ -2026,6 +2098,7 @@ sub manage_reservations { } $rownum ++; $output{$symb}{'rownum'} = $rownum; + $output{$symb}{'shown'} = $shown; if (!$shownheader) { $output{$symb}{'header'} = $slotheader; $shownheader = 1;
'.join('',@{$maprows[$i]}).'
'.join('',@{$maprows[$i]}).' 
'.$maprows[$i][0]. + '
'.$maprows[$i][0]. ''. + 'onclick="'."toggleSlotMap('$mapnum','$rownum');".'" />'. $maprows[$i][1].(' ' x6).'