[LON-CAPA-cvs] cvs: rat / lonpageflip.pm loncom/interface lonnavmaps.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 02 Aug 2005 20:51:23 -0000
albertel Tue Aug 2 16:51:23 2005 EDT
Modified files:
/loncom/interface lonnavmaps.pm
/rat lonpageflip.pm
Log:
- BUG#3753, launch window now when launching and not knowing what the next resource is, will present a screen with links to first resource, and to close the external navmaps window.
- also more links in the navmpas window control the loncapaclient window rather than open in the navmaps window
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.334 loncom/interface/lonnavmaps.pm:1.335
--- loncom/interface/lonnavmaps.pm:1.334 Fri Jul 15 01:20:37 2005
+++ loncom/interface/lonnavmaps.pm Tue Aug 2 16:51:18 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.334 2005/07/15 05:20:37 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.335 2005/08/02 20:51:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -208,6 +208,20 @@
if ($ENV{QUERY_STRING} eq 'launchExternal') {
&Apache::lonnet::put('environment',{'remotenavmap' => 'on'});
&Apache::lonnet::appenv('environment.remotenavmap' => 'on');
+ my $menu=&Apache::lonmenu::reopenmenu();
+ my $navstatus=&Apache::lonmenu::get_nav_status();
+ if ($menu) {
+ $r->print(<<MENU);
+ <script type="text/javascript">
+ swmenu=$menu
+ swmenu.clearTimeout(swmenu.menucltim);
+ $navstatus
+ </script>
+MENU
+ }
+ }
+ if ($ENV{QUERY_STRING} eq 'turningOffExternal') {
+ $env{'environment.remotenavmap'}='off';
}
# Create the nav map
@@ -290,7 +304,7 @@
if ($ENV{QUERY_STRING} eq 'launchExternal') {
$r->print('
- <form name="returnwin" action="/adm/flip?postdata=return%3a"
+ <form name="returnwin" action="/adm/flip?postdata=navlaunch%3a"
method="post" target="loncapaclient">
</form>');
$r->print('
@@ -1164,7 +1178,11 @@
my $discussionHTML = ""; my $feedbackHTML = ""; my $errorHTML = "";
my $link = $params->{"resourceLink"};
- my $linkopen = "<a href='$link'>";
+ my $target;
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $target=' target="loncapaclient" ';
+ }
+ my $linkopen = "<a $target href='$link'>";
my $linkclose = "</a>";
my $location=&Apache::loncommon::lonhttpdurl("/adm/lonMisc");
if ($resource->hasDiscussion()) {
@@ -1177,7 +1195,7 @@
my $feedback = $resource->getFeedback();
foreach (split(/\,/, $feedback)) {
if ($_) {
- $feedbackHTML .= ' <a href="/adm/email?display='
+ $feedbackHTML .= ' <a '.$target.' href="/adm/email?display='
. &Apache::lonnet::escape($_) . '">'
. '<img src="'.$location.'/feedback.gif" '
. 'border="0" /></a>';
@@ -1192,7 +1210,7 @@
last if ($errorcount>=10); # Only output 10 bombs maximum
if ($_) {
$errorcount++;
- $errorHTML .= ' <a href="/adm/email?display='
+ $errorHTML .= ' <a '.$target.' href="/adm/email?display='
. &Apache::lonnet::escape($_) . '">'
. '<img src="'.$location.'/bomb.gif" '
. 'border="0" /></a>';
@@ -1214,7 +1232,11 @@
$params->{'multipart'} && $part eq "0";
my $link = $params->{"resourceLink"};
- my $linkopen = "<a href='$link'>";
+ my $target;
+ if ($env{'environment.remotenavmap'} eq 'on') {
+ $target=' target="loncapaclient" ';
+ }
+ my $linkopen = "<a $target href='$link'>";
my $linkclose = "</a>";
if ($resource->is_problem() &&
Index: rat/lonpageflip.pm
diff -u rat/lonpageflip.pm:1.53 rat/lonpageflip.pm:1.54
--- rat/lonpageflip.pm:1.53 Thu Apr 7 02:56:27 2005
+++ rat/lonpageflip.pm Tue Aug 2 16:51:18 2005
@@ -2,7 +2,7 @@
#
# Page flip handler
#
-# $Id: lonpageflip.pm,v 1.53 2005/04/07 06:56:27 albertel Exp $
+# $Id: lonpageflip.pm,v 1.54 2005/08/02 20:51:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -171,6 +171,28 @@
return ($next,$mapurl);
}
+sub navlaunch {
+ my ($r)=@_;
+ &Apache::loncommon::content_type($r,'text/html');
+ &Apache::loncommon::no_cache($r);
+ $r->send_http_header;
+ my $html=&Apache::lonxml::xmlbegin();
+ $r->print("$html<head>\n");
+ $r->print('</head>'.
+ &Apache::loncommon::bodytag('Launched'));
+ $r->print(<<ENDNAV);
+ <p><a href="/adm/flip?postdata=firstres%3a">Goto first resource</a></p>
+ <script type="text/javascript">
+ function collapse() {
+ menu=window.open("/adm/navmaps?collapseExternal","loncapanav",
+ "height=600,width=400,scrollbars=1");
+ this.document.location='/adm/navmaps?turningOffExternal';
+ }
+ </script>
+ <p><a href="javascript:collapse();">Collapse External Navigation Window</a></p>
+ENDNAV
+ $r->print(&Apache::loncommon::endbodytag().'</html>');
+}
# ================================================================ Main Handler
sub handler {
@@ -199,7 +221,20 @@
$currenturl=&Apache::lonenc::unencrypted($currenturl);
}
$currenturl=~s/\.\d+\.(\w+)$/\.$1/;
- if ($direction eq 'return') {
+ if ($direction eq 'firstres') {
+ my $furl;
+ if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db',
+ &GDBM_READER(),0640)) {
+ $furl=$bighash{'first_url'};
+ untie(%bighash);
+ }
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->header_out(Location =>
+ 'http://'.$ENV{'HTTP_HOST'}.$furl);
+
+ return REDIRECT;
+ }
+ if ($direction eq 'return' || $direction eq 'navlaunch') {
# -------------------------------------------------------- Return to last known
my $last;
if (tie(%hash,'GDBM_File',$env{'request.course.fn'}.'_symb.db',
@@ -223,11 +258,16 @@
} else {
$newloc='/adm/noidea.html';
}
- &Apache::loncommon::content_type($r,'text/html');
- $r->header_out(Location =>
- 'http://'.$ENV{'HTTP_HOST'}.$newloc);
-
- return REDIRECT;
+ if ($newloc eq '/adm/noidea.html' && $direction eq 'navlaunch') {
+ &navlaunch($r);
+ return OK;
+ } else {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->header_out(Location =>
+ 'http://'.$ENV{'HTTP_HOST'}.$newloc);
+
+ return REDIRECT;
+ }
}
$currenturl=~s/^http\:\/\///;
$currenturl=~s/^[^\/]+//;
@@ -244,10 +284,15 @@
if ($last) {
$currenturl=&Apache::lonnet::clutter((&Apache::lonnet::decode_symb($last))[2]);
} else {
- &Apache::loncommon::content_type($r,'text/html');
- $r->header_out(Location =>
- 'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html');
- return REDIRECT;
+ if ($direction eq 'return') {
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->header_out(Location =>
+ 'http://'.$ENV{'HTTP_HOST'}.'/adm/noidea.html');
+ return REDIRECT;
+ } else {
+ &navlaunch($r);
+ return OK;
+ }
}
}
# ------------------------------------------- Do we have any idea where we are?