[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm randomlabel.pm randomlylabel.pm
raeburn
raeburn@source.lon-capa.org
Fri, 19 Dec 2008 14:28:14 -0000
raeburn Fri Dec 19 14:28:14 2008 EDT
Modified files:
/loncom/homework imageresponse.pm randomlabel.pm randomlylabel.pm
Log:
- Regular Expression for both http and https.
- Use lonnet::absolute_url() when adding protocol in randomlylabel.pm
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.96 loncom/homework/imageresponse.pm:1.97
--- loncom/homework/imageresponse.pm:1.96 Tue Nov 18 19:14:28 2008
+++ loncom/homework/imageresponse.pm Fri Dec 19 14:28:14 2008
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# image click response style
#
-# $Id: imageresponse.pm,v 1.96 2008/11/18 19:14:28 jms Exp $
+# $Id: imageresponse.pm,v 1.97 2008/12/19 14:28:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -320,7 +320,7 @@
my $image=$Apache::response::foilgroup{"$name.image"};
&Apache::lonxml::debug("image is $image");
if ( ($target eq 'web' || $target eq 'answer')
- && $image !~ /^http:/ ) {
+ && $image !~ /^https?\:/ ) {
$image=&clean_up_image($image);
}
push(@images,$image);
@@ -386,7 +386,7 @@
my $image=$Apache::response::foilgroup{"$name.image"};
&Apache::lonxml::debug("image is $image");
if ( ($target eq 'web' || $target eq 'answer')
- && $image !~ /^http:/ ) {
+ && $image !~ /^https?\:/ ) {
$image = &clean_up_image($image);
}
my $token=&prep_image($image,'answeronly',$name);
@@ -401,7 +401,7 @@
my ($image)=@_;
if ($image =~ /\s*<img\s*/) {
($image) = ($image =~ /src\s*=\s*[\"\']([^\"\']+)[\"\']/i);
- if ($image !~ /^http:/) {
+ if ($image !~ /^https?\:/) {
$image=&Apache::lonnet::hreflocation('',$image);
}
if (!$image) {
Index: loncom/homework/randomlabel.pm
diff -u loncom/homework/randomlabel.pm:1.93 loncom/homework/randomlabel.pm:1.94
--- loncom/homework/randomlabel.pm:1.93 Tue Nov 25 13:16:17 2008
+++ loncom/homework/randomlabel.pm Fri Dec 19 14:28:14 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# random labelling tool
#
-# $Id: randomlabel.pm,v 1.93 2008/11/25 13:16:17 jms Exp $
+# $Id: randomlabel.pm,v 1.94 2008/12/19 14:28:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -172,7 +172,7 @@
$label_xscale = 1.0; # Assume image size not overridden.
$label_yscale = 1.0;
my $bgimg= &Apache::lonxml::get_param('bgimg',$parstack,$safeeval);
- if ( defined($bgimg) && $bgimg !~ /^http:/ ) {
+ if ( defined($bgimg) && $bgimg !~ /^https?\:/ ) {
$bgimg=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$bgimg);
if (&Apache::lonnet::repcopy($bgimg) ne 'ok') {
$bgimg='/home/httpd/html/adm/lonKaputt/lonlogo_broken.gif';
Index: loncom/homework/randomlylabel.pm
diff -u loncom/homework/randomlylabel.pm:1.30 loncom/homework/randomlylabel.pm:1.31
--- loncom/homework/randomlylabel.pm:1.30 Tue Sep 25 23:16:13 2007
+++ loncom/homework/randomlylabel.pm Fri Dec 19 14:28:14 2008
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# randomlabel.png: composite together text and images into 1 image
#
-# $Id: randomlylabel.pm,v 1.30 2007/09/25 23:16:13 albertel Exp $
+# $Id: randomlylabel.pm,v 1.31 2008/12/19 14:28:14 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -213,8 +213,8 @@
my ($imgsrc,$set_trans)=@_;
my $image;
if ($imgsrc !~ m|^(/home/)|) {
- if ($imgsrc !~ /^http:/) {
- $imgsrc="http://".$ENV{'HTTP_HOST'}.$imgsrc;
+ if ($imgsrc !~ /^https?\:/) {
+ $imgsrc=&Apache::lonnet::absolute_url($ENV{'HTTP_HOST'}).$imgsrc;
}
my $ua=new LWP::UserAgent;
my $request=new HTTP::Request('GET',"$imgsrc");