--- loncom/interface/loncommon.pm 2003/06/20 14:44:06 1.106
+++ loncom/interface/loncommon.pm 2003/07/17 18:10:53 1.109
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.106 2003/06/20 14:44:06 bowersj2 Exp $
+# $Id: loncommon.pm,v 1.109 2003/07/17 18:10:53 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -549,7 +549,8 @@ sub help_open_topic {
my ($topic, $text, $stayOnPage, $width, $height) = @_;
$text = "" if (not defined $text);
$stayOnPage = 0 if (not defined $stayOnPage);
- if ($ENV{'browser.interface'} eq 'textual') {
+ if ($ENV{'browser.interface'} eq 'textual' ||
+ $ENV{'environment.remote'} eq 'off' ) {
$stayOnPage=1;
}
$width = 350 if (not defined $width);
@@ -1352,9 +1353,11 @@ sub aboutmewrapper {
sub syllabuswrapper {
- my ($link,$un,$do,$tf)=@_;
- if ($tf) { $link=''.$link.''; }
- return "$link";
+ my ($linktext,$coursedir,$domain,$fontcolor)=@_;
+ if ($fontcolor) {
+ $linktext=''.$linktext.'';
+ }
+ return "$linktext";
}
# ---------------------------------------------------------------- Language IDs
@@ -1511,6 +1514,41 @@ sub get_previous_attempt {
}
}
+sub relative_to_absolute {
+ my ($url,$output)=@_;
+ my $parser=HTML::TokeParser->new(\$output);
+ my $token;
+ my $thisdir=$url;
+ my @rlinks=();
+ while ($token=$parser->get_token) {
+ if ($token->[0] eq 'S') {
+ if ($token->[1] eq 'a') {
+ if ($token->[2]->{'href'}) {
+ $rlinks[$#rlinks+1]=$token->[2]->{'href'};
+ }
+ } elsif ($token->[1] eq 'img' || $token->[1] eq 'embed' ) {
+ $rlinks[$#rlinks+1]=$token->[2]->{'src'};
+ } elsif ($token->[1] eq 'base') {
+ $thisdir=$token->[2]->{'href'};
+ }
+ }
+ }
+ $thisdir=~s-/[^/]*$--;
+ foreach (@rlinks) {
+ unless (($_=~/^http:\/\//i) ||
+ ($_=~/^\//) ||
+ ($_=~/^javascript:/i) ||
+ ($_=~/^mailto:/i) ||
+ ($_=~/^\#/)) {
+ my $newlocation=&Apache::lonnet::hreflocation($thisdir,$_);
+ $output=~s/(\"|\'|\=\s*)$_(\"|\'|\s|\>)/$1$newlocation$2/;
+ }
+ }
+# -------------------------------------------------- Deal with Applet codebases
+ $output=~s/(\