--- loncom/homework/randomlabel.pm 2003/05/06 11:54:08 1.44 +++ loncom/homework/randomlabel.pm 2003/05/19 17:10:12 1.45 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # random labelling tool # -# $Id: randomlabel.pm,v 1.44 2003/05/06 11:54:08 www Exp $ +# $Id: randomlabel.pm,v 1.45 2003/05/19 17:10:12 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -99,19 +99,18 @@ sub start_randomlabel { &Apache::lonxml::startredirection(); $result.="BGIMG=".&Apache::lonnet::escape($bgimg); } elsif ($target eq 'tex') { - my $newbgimg = $bgimg; - $bgimg=~s/\.(gif|jpg|png|jpeg)$/\.eps/i; - $bgimg= &Apache::lonnet::filelocation($bgimg); - if (not $ENV{'request.role'}=~/^au\./) { - $bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/; - $bgimg=~s/\/$//; - #if no eps file try to replicate it - if (not-e $bgimg) { - if (&Apache::lonnet::repcopy($bgimg) ne OK ) { - #if replication failed try to find ps file - $bgimg=~s/\.eps$/\.ps/; - #if no ps file try to replicate it - if (not-e $bgimg && + my $newbgimg = $bgimg; + $bgimg=~s/\.(gif|jpg|png|jpeg)$/\.eps/i; + $bgimg= &Apache::lonnet::filelocation($bgimg); + $bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/; + $bgimg=~s/\/$//; + #if no eps file try to replicate it + if (not-e $bgimg) { + if (&Apache::lonnet::repcopy($bgimg) ne OK ) { + #if replication failed try to find ps file + $bgimg=~s/\.eps$/\.ps/; + #if no ps file try to replicate it + if (not -e $bgimg && &Apache::lonnet::repcopy($bgimg) ne OK) { #if replication failed try to produce eps file dynamically $bgimg=~s/\.ps$/\.eps/; @@ -123,11 +122,8 @@ sub start_randomlabel { $bgimg =~ m/\/([^\/]+)$/; $bgimg = '/home/httpd/prtspool/'.$1; } - } - } - } else { - $bgimg=~s/http:\/[^\/]*\/~([^\/]+)/\/home\/$1\/public_html/; - } + } + } $bgimg=~s/\/$//; my $dirtywidth=$texwidth+5; if ($texwidth==90) {