version 1.35, 2002/08/27 15:40:07
|
version 1.36, 2002/08/27 18:21:27
|
Line 60 package Apache::randomlabel;
|
Line 60 package Apache::randomlabel;
|
use Apache::lonnet; |
use Apache::lonnet; |
use strict; |
use strict; |
use Apache::edit; |
use Apache::edit; |
|
use Apache::File(); |
|
|
BEGIN { |
BEGIN { |
&Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label')); |
&Apache::lonxml::register('Apache::randomlabel',('randomlabel','labelgroup','location','label')); |
Line 106 sub start_randomlabel {
|
Line 107 sub start_randomlabel {
|
$result.="<applet code=\"$code\" codebase=\"$codebase\" width=\"$w\" height=\"$h\">\n"; |
$result.="<applet code=\"$code\" codebase=\"$codebase\" width=\"$w\" height=\"$h\">\n"; |
$result.="<param name=\"bgimg\" value=\"$bgimg\">\n"; |
$result.="<param name=\"bgimg\" value=\"$bgimg\">\n"; |
} elsif ($target eq 'tex') { |
} elsif ($target eq 'tex') { |
|
my $newbgimg = $bgimg; |
$bgimg=~s/(.gif|.jpg)$/.eps/; |
$bgimg=~s/(.gif|.jpg)$/.eps/; |
$bgimg= &Apache::lonnet::filelocation($bgimg); |
$bgimg= &Apache::lonnet::filelocation($bgimg); |
if (not $ENV{'request.role'}=~/^au\./) { |
if (not $ENV{'request.role'}=~/^au\./) { |
$bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/; |
$bgimg=~s/http:\/[^\/]*/\/home\/httpd\/html/; |
$bgimg=~s/\/$//; |
$bgimg=~s/\/$//; |
|
#if no eps file try to replicate it |
if (not-e $bgimg) { |
if (not-e $bgimg) { |
my $response = &Apache::lonnet::repcopy($bgimg); |
my $response = &Apache::lonnet::repcopy($bgimg); |
|
#if replication failed try to find ps file |
|
if (not-e $bgimg) { |
|
$bgimg=~s/\.eps$/\.ps/; |
|
#if no ps file try to replicate it |
|
if (not-e $bgimg) { |
|
$response = &Apache::lonnet::repcopy($bgimg); |
|
#if replication failed try to produce eps file dynamically |
|
$bgimg=~s/\.ps$/\.eps/; |
|
my $temp_file; |
|
my $filename = "/home/httpd/prtspool/$ENV{'user.name'}_$ENV{'user.domain'}_printout.dat"; |
|
$temp_file = Apache::File->new('>>'.$filename); |
|
$newbgimg =~ s/(.*)\/res\//\/home\/httpd\/html\/res\//; |
|
print $temp_file "$newbgimg\n"; |
|
$bgimg =~ m/\/([^\/]+)$/; |
|
$bgimg = '/home/httpd/prtspool/'.$1; |
|
} |
|
} |
} |
} |
} else { |
} else { |
$bgimg=~s/http:\/[^\/]*\/~([^\/]+)/\/home\/$1\/public_html/; |
$bgimg=~s/http:\/[^\/]*\/~([^\/]+)/\/home\/$1\/public_html/; |