version 1.265, 2004/07/03 20:45:23
|
version 1.275, 2004/08/13 20:12:11
|
Line 83 my %colormap =
|
Line 83 my %colormap =
|
# is not yet done and due in less then 24 hours |
# is not yet done and due in less then 24 hours |
my $hurryUpColor = "#FF0000"; |
my $hurryUpColor = "#FF0000"; |
|
|
|
sub launch_win { |
|
my ($mode,$script)=@_; |
|
my $result; |
|
if ($script ne 'no') { |
|
$result.='<script type="text/javascript">'; |
|
} |
|
$result.='function launch_navmapwin() { |
|
newWindow=open(\'/adm/navmaps?launchExternal\',\'loncapanav\',\'width=400,height=600,scrollbars=1\'); |
|
}'; |
|
if ($mode eq 'now') { |
|
$result.="\nlaunch_navmapwin();\n"; |
|
} |
|
if ($script ne 'no') { |
|
$result.='</script>'; |
|
} |
|
if ($mode eq 'link') { |
|
$result.='<a href="javascript:launch_navmapwin();void(0);">' |
|
.&mt("Launch navigation in separate window")."</a> "; |
|
} |
|
return $result; |
|
} |
|
|
|
sub close { |
|
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
|
return(<<ENDCLOSE); |
|
<script type="text/javascript"> |
|
window.status='Accessing Nav Control'; |
|
menu=window.open("/adm/rat/empty.html","loncapanav", |
|
"height=600,width=400,scrollbars=1"); |
|
window.status='Closing Nav Control'; |
|
menu.close(); |
|
window.status='Done.'; |
|
</script> |
|
ENDCLOSE |
|
} |
|
|
|
sub update { |
|
if ($ENV{'environment.remotenavmap'} ne 'on') { return ''; } |
|
if (!$ENV{'request.course.id'}) { return ''; } |
|
if ($ENV{'REQUEST_URI'}=~m|^/adm/navmaps|) { return ''; } |
|
return(<<ENDUPDATE); |
|
<form name="navform"></form> |
|
<script type="text/javascript"> |
|
this.document.navform.action='/adm/navmaps#curloc'; |
|
this.document.navform.target='loncapanav'; |
|
this.document.navform.submit(); |
|
</script> |
|
ENDUPDATE |
|
} |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
real_handler($r); |
real_handler($r); |
Line 111 sub real_handler {
|
Line 161 sub real_handler {
|
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
|
|
|
if ($ENV{QUERY_STRING} eq 'collapseExternal') { |
|
&Apache::lonnet::put('environment',{'remotenavmap' => 'off'}); |
|
&Apache::lonnet::appenv('environment.remotenavmap' => 'off'); |
|
my $menu=&Apache::lonmenu::reopenmenu(); |
|
my $navstatus=&Apache::lonmenu::get_nav_status(); |
|
if ($menu) { |
|
$menu=(<<MENU) |
|
swmenu=$menu |
|
swmenu.clearTimeout(swmenu.menucltim); |
|
$navstatus |
|
MENU |
|
} |
|
$r->print(<<"ENDSUBM"); |
|
<html> |
|
<head> |
|
<script type="text/javascript"> |
|
function submitthis() { |
|
$menu |
|
self.close(); |
|
} |
|
|
|
</script> |
|
</head> |
|
<body bgcolor="#FFFFFF" onLoad="submitthis()"></body> |
|
</html> |
|
ENDSUBM |
|
return; |
|
} |
|
if ($ENV{QUERY_STRING} eq 'launchExternal') { |
|
&Apache::lonnet::put('environment',{'remotenavmap' => 'on'}); |
|
&Apache::lonnet::appenv('environment.remotenavmap' => 'on'); |
|
} |
|
|
# Create the nav map |
# Create the nav map |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
|
|
Line 123 sub real_handler {
|
Line 206 sub real_handler {
|
$r->print("<html><head>\n"); |
$r->print("<html><head>\n"); |
$r->print("<title>".&mt('Navigate Course Contents')."</title>"); |
$r->print("<title>".&mt('Navigate Course Contents')."</title>"); |
# ------------------------------------------------------------ Get query string |
# ------------------------------------------------------------ Get query string |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['register','sort']); |
|
|
# ----------------------------------------------------- Force menu registration |
# ----------------------------------------------------- Force menu registration |
my $addentries=''; |
my $addentries=''; |
|
my $more_unload; |
|
if ($ENV{'environment.remotenavmap'} eq 'on') { |
|
$r->print('<script type="text/javascript"> |
|
function collapse() { |
|
this.document.location="/adm/navmaps?collapseExternal"; |
|
} |
|
</script>'); |
|
# FIXME need to be smarter to only catch window close events |
|
# $more_unload="collapse()" |
|
} |
if ($ENV{'form.register'}) { |
if ($ENV{'form.register'}) { |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
$addentries=' onLoad="'.&Apache::lonmenu::loadevents(). |
'" onUnload="'.&Apache::lonmenu::unloadevents().'"'; |
'" onUnload="'.&Apache::lonmenu::unloadevents().';'. |
$r->print(&Apache::lonmenu::registerurl(1)); |
$more_unload.'"'; |
|
$r->print(&Apache::lonmenu::registerurl(1)); |
|
} else { |
|
$addentries=' onUnload="'.$more_unload.'"'; |
} |
} |
|
|
# Header |
# Header |
Line 173 sub real_handler {
|
Line 269 sub real_handler {
|
} |
} |
} |
} |
|
|
|
if ($ENV{QUERY_STRING} eq 'launchExternal') { |
|
$r->print(' |
|
<form name="returnwin" action="/adm/flip?postdata=return%3a" |
|
method="post" target="loncapaclient"> |
|
</form>'); |
|
$r->print(' |
|
<script type="text/javascript"> |
|
this.document.returnwin.submit(); |
|
</script>'); |
|
} |
|
|
|
if ($ENV{'environment.remotenavmap'} ne 'on') { |
|
$r->print(&launch_win('link','yes')); |
|
} |
|
if ($ENV{'environment.remotenavmap'} eq 'on') { |
|
# $r->print("<a href='navmaps?collapseExternal'>" . |
|
$r->print("<a href='javascript:collapse();void(0);'>" . |
|
&mt("Close separate navigation window"). |
|
"</a> "); |
|
} |
|
|
my $jumpToFirstHomework = 0; |
my $jumpToFirstHomework = 0; |
# Check to see if the student is jumping to next open, do-able problem |
# Check to see if the student is jumping to next open, do-able problem |
if ($ENV{QUERY_STRING} eq 'jumpToFirstHomework') { |
if ($ENV{QUERY_STRING} eq 'jumpToFirstHomework') { |
Line 233 sub real_handler {
|
Line 350 sub real_handler {
|
&mt("Show Only Uncompleted Homework")."</a> "); |
&mt("Show Only Uncompleted Homework")."</a> "); |
} |
} |
|
|
|
$r->print("<form> |
|
<nobr> |
|
Sort by: |
|
<select name=\"sort\"> |
|
<option value=\"\"></option> |
|
<option value=\"title\">Title</option> |
|
<option value=\"duedate\">Duedate</option> |
|
</select> |
|
<input type=\"submit\" name=\"Sort\" /> |
|
</nobr> |
|
</form>"); |
# renderer call |
# renderer call |
my $renderArgs = { 'cols' => [0,1,2,3], |
my $renderArgs = { 'cols' => [0,2,3], |
|
'sort' => $ENV{'form.sort'}, |
'url' => '/adm/navmaps', |
'url' => '/adm/navmaps', |
'navmap' => $navmap, |
'navmap' => $navmap, |
'suppressNavmap' => 1, |
'suppressNavmap' => 1, |
Line 959 sub render_resource {
|
Line 1088 sub render_resource {
|
|
|
if ($resource->is_problem() && $part ne '0' && |
if ($resource->is_problem() && $part ne '0' && |
!$params->{'condensed'}) { |
!$params->{'condensed'}) { |
my $displaypart=&Apache::lonnet::EXT('resource.'.$part.'.display', |
my $displaypart=$resource->part_display($part); |
$resource->symb()); |
|
unless ($displaypart) { $displaypart=$part; } |
|
$partLabel = " (Part: $displaypart)"; |
$partLabel = " (Part: $displaypart)"; |
$link.='#'.&Apache::lonnet::escape($part); |
$link.='#'.&Apache::lonnet::escape($part); |
$title = ""; |
$title = ""; |
Line 971 sub render_resource {
|
Line 1098 sub render_resource {
|
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; |
$nonLinkedText .= ' (' . $resource->countParts() . ' parts)'; |
} |
} |
|
|
if (!$params->{'resource_nolink'} && !$resource->is_sequence()) { |
my $target; |
$result .= " $curMarkerBegin<a href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>"; |
if ($ENV{'environment.remotenavmap'} eq 'on') { |
|
$target=' target="loncapaclient" '; |
|
} |
|
if (!$params->{'resource_nolink'} && !$resource->is_sequence() && !$resource->is_empty_sequence) { |
|
$result .= " $curMarkerBegin<a $target href='$link'>$title$partLabel</a>$curMarkerEnd $nonLinkedText</td>"; |
} else { |
} else { |
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>"; |
$result .= " $curMarkerBegin$title$partLabel$curMarkerEnd $nonLinkedText</td>"; |
} |
} |
Line 1250 sub render {
|
Line 1381 sub render {
|
#$currenturl=~s/^[^\/]+//; |
#$currenturl=~s/^[^\/]+//; |
|
|
$here = $jump = &Apache::lonnet::symbread($currenturl); |
$here = $jump = &Apache::lonnet::symbread($currenturl); |
} |
} else { |
|
&Apache::lonnet::logthis("Hrrm,"); |
|
|
|
} |
|
|
# Step three: Ensure the folders are open |
# Step three: Ensure the folders are open |
my $mapIterator = $navmap->getIterator(undef, undef, undef, 1); |
my $mapIterator = $navmap->getIterator(undef, undef, undef, 1); |
Line 1369 sub render {
|
Line 1503 sub render {
|
"&here=" . Apache::lonnet::escape($here) . |
"&here=" . Apache::lonnet::escape($here) . |
"\">".&mt('Open All Folders')."</a>"; |
"\">".&mt('Open All Folders')."</a>"; |
} |
} |
$result .= "<br /><br />\n"; |
$result .= "\n"; |
} |
} |
|
|
|
# Check for any unread discussions in all resources. |
|
if (!$args->{'resource_no_folder_link'}) { |
|
my $totdisc = 0; |
|
my $haveDisc = ''; |
|
my @allres=$navmap->retrieveResources(); |
|
foreach my $resource (@allres) { |
|
if ($resource->hasDiscussion()) { |
|
my $ressymb; |
|
if ($resource->symb() =~ m-(___adm/\w+/\w+)/(\d+)/bulletinboard$-) { |
|
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
|
} else { |
|
$ressymb = $resource->symb(); |
|
} |
|
$haveDisc .= $ressymb.':'; |
|
$totdisc ++; |
|
} |
|
} |
|
if ($totdisc > 0) { |
|
$haveDisc =~ s/:$//; |
|
my %lt = &Apache::lonlocal::texthash( |
|
'mapr' => 'Mark all posts read', |
|
); |
|
$result .= (<<END); |
|
<a href="javascript:document.clearbubbles.submit()">$lt{'mapr'}</a> <a href="javascript:void(open('/adm/help/NavMaps_MarkPosts_Read.hlp', 'Help_for_NavMaps_MarkPosts', 'menubar=0,toolbar=1,scrollbars=1,width=350,height=400,resizable=yes'))" title="Online Help"><image src="/adm/help/gif/smallHelp.gif" border="0" alt="(Help: NavMaps_MarkPostsLink)" /></a> |
|
<form name="clearbubbles" method="post" action="/adm/feedback"> |
|
<input type="hidden" name="navurl" value="$ENV{'QUERY_STRING'}" /> |
|
<input type="hidden" name="navmaps" value="$haveDisc" /> |
|
</form> |
|
END |
|
} else { |
|
$result .= '<br />'; |
|
} |
|
} |
|
$result .= "<br />\n"; |
if ($r) { |
if ($r) { |
$r->print($result); |
$r->print($result); |
$r->rflush(); |
$r->rflush(); |
Line 1443 sub render {
|
Line 1611 sub render {
|
$args->{'here'} = $here; |
$args->{'here'} = $here; |
|
|
$args->{'indentLevel'} = -1; # first BEGIN_MAP takes this to 0 |
$args->{'indentLevel'} = -1; # first BEGIN_MAP takes this to 0 |
while ($curRes = $it->next($closeAllPages)) { |
my @resources; |
|
my $code='';# sub { !(shift->is_map();) }; |
|
if ($args->{'sort'} eq 'title') { |
|
@resources=$navmap->retrieveResources(undef, |
|
sub { !shift->is_map(); }); |
|
@resources= sort {lc($a->compTitle) cmp lc($b->compTitle)} @resources; |
|
} elsif ($args->{'sort'} eq 'duedate') { |
|
@resources=$navmap->retrieveResources(undef, |
|
sub { shift->is_problem(); }); |
|
@resources= sort |
|
{ |
|
if ($a->duedate ne $b->duedate) { |
|
return $a->duedate cmp $b->duedate; |
|
} else { |
|
lc($a->compTitle) cmp lc($b->compTitle) |
|
} |
|
} @resources; |
|
} |
|
|
|
while (1) { |
|
if ($args->{'sort'}) { |
|
$curRes = shift(@resources); |
|
} else { |
|
$curRes = $it->next($closeAllPages); |
|
} |
|
if (!$curRes) { last; } |
|
|
# Maintain indentation level. |
# Maintain indentation level. |
if ($curRes == $it->BEGIN_MAP() || |
if ($curRes == $it->BEGIN_MAP() || |
$curRes == $it->BEGIN_BRANCH() ) { |
$curRes == $it->BEGIN_BRANCH() ) { |
Line 1557 sub render {
|
Line 1751 sub render {
|
|
|
# Set up some data about the parts that the cols might want |
# Set up some data about the parts that the cols might want |
my $filter = $it->{FILTER}; |
my $filter = $it->{FILTER}; |
my $stack = $it->getStack(); |
my $src; |
my $src = getLinkForResource($stack); |
if ($args->{'sort'}) { |
|
$src = $curRes->src(); # FIXME this is wrong for .pages |
|
} else { |
|
my $stack = $it->getStack(); |
|
$src=getLinkForResource($stack); |
|
} |
my $anchor=''; |
my $anchor=''; |
if ($src=~s/(\#.*$)//) { |
if ($src=~s/(\#.*)$//) { |
$anchor=$1; |
$anchor=$1; |
} |
} |
my $srcHasQuestion = $src =~ /\?/; |
my $srcHasQuestion = $src =~ /\?/; |
Line 1568 sub render {
|
Line 1767 sub render {
|
($srcHasQuestion?'&':'?') . |
($srcHasQuestion?'&':'?') . |
'symb=' . &Apache::lonnet::escape($curRes->symb()). |
'symb=' . &Apache::lonnet::escape($curRes->symb()). |
$anchor; |
$anchor; |
|
|
# Now, display each column. |
# Now, display each column. |
foreach my $col (@$cols) { |
foreach my $col (@$cols) { |
my $colHTML = ''; |
my $colHTML = ''; |
Line 1942 sub hasDiscussion {
|
Line 2141 sub hasDiscussion {
|
# backward compatibility (bulletin boards used to be 'wrapped') |
# backward compatibility (bulletin boards used to be 'wrapped') |
my $ressymb = $symb; |
my $ressymb = $symb; |
if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { |
if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) { |
unless ($ressymb =~ m|bulletin___\d+___adm/wrapper|) { |
unless ($ressymb =~ m|adm/wrapper/adm|) { |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard'; |
} |
} |
} |
} |
Line 1950 sub hasDiscussion {
|
Line 2149 sub hasDiscussion {
|
if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) { |
if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) { |
return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb}; |
return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb}; |
} else { |
} else { |
return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; |
# return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_CHECK}; # v.1.1 behavior |
|
return $self->{DISCUSSION_TIME}->{$ressymb} > 0; # in 1.2 will display speech bubble icons for all items with posts until marked as read (even if read in v 1.1). |
} |
} |
} |
} |
|
|
Line 3254 sub is_survey {
|
Line 3454 sub is_survey {
|
return 0; |
return 0; |
} |
} |
|
|
|
sub is_empty_sequence { |
|
my $self=shift; |
|
my $src = $self->src(); |
|
return !$self->is_page() && $self->navHash("is_map_", 1) && !$self->navHash("map_type_" . $self->map_pc()); |
|
} |
|
|
# Private method: Shells out to the parmval in the nav map, handler parts. |
# Private method: Shells out to the parmval in the nav map, handler parts. |
sub parmval { |
sub parmval { |
my $self = shift; |
my $self = shift; |
Line 3477 sub weight {
|
Line 3683 sub weight {
|
$self->symb(), $ENV{'user.domain'}, |
$self->symb(), $ENV{'user.domain'}, |
$ENV{'user.name'}, |
$ENV{'user.name'}, |
$ENV{'request.course.sec'}); |
$ENV{'request.course.sec'}); |
|
} |
|
sub part_display { |
|
my $self= shift(); my $partID = shift(); |
|
if (! defined($partID)) { $partID = '0'; } |
|
my $display=&Apache::lonnet::EXT('resource.'.$partID.'.display', |
|
$self->symb); |
|
if (! defined($display) || $display eq '') { |
|
$display = $partID; |
|
} |
|
return $display; |
} |
} |
|
|
# Multiple things need this |
# Multiple things need this |
Line 4091 sub status {
|
Line 4306 sub status {
|
|
|
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
if ($dateStatus == PAST_DUE_ANSWER_LATER || |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
$dateStatus == PAST_DUE_NO_ANSWER ) { |
return $dateStatus; |
return $suppressFeedback ? ANSWER_SUBMITTED : $dateStatus; |
} |
} |
|
|
if ($dateStatus == ANSWER_OPEN) { |
if ($dateStatus == ANSWER_OPEN) { |