[system] / trunk / xmlrpc / daemon / MathTranslators.pm Repository:
ViewVC logotype

Diff of /trunk/xmlrpc/daemon/MathTranslators.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 899 Revision 900
13use WeBWorK::PG::Translator; 13use WeBWorK::PG::Translator;
14use WeBWorK::PG::IO; 14use WeBWorK::PG::IO;
15use Benchmark; 15use Benchmark;
16use MIME::Base64 qw( encode_base64 decode_base64); 16use MIME::Base64 qw( encode_base64 decode_base64);
17 17
18my $debugOn =0; 18my $debugOn = 1;
19my $PASSWORD = $Global::PASSWORD; 19my $PASSWORD = $Global::PASSWORD;
20 20
21 21
22my $TEMPDIRECTORY = $Global::TEMPDIRECTORY; 22my $TEMPDIRECTORY = $Global::TEMPDIRECTORY;
23my $TEMP_BASE_URL = $Global::TEMP_BASE_URL; 23my $TEMP_BASE_URL = $Global::TEMP_BASE_URL;
24my $externalLatexPath = $Global::externalLatexPath; 24my $externalLatexPath = $Global::externalLatexPath;
31my $tmp_directory_permission = $Global::tmp_directory_permission; 31my $tmp_directory_permission = $Global::tmp_directory_permission;
32my $numericalGroupID = $Global::numericalGroupID; # group ID for webadmin 32my $numericalGroupID = $Global::numericalGroupID; # group ID for webadmin
33 33
34sub tex2pdf { 34sub tex2pdf {
35 35
36 my $rh = shift; 36 my $rh = shift;
37 local($|)=1; 37 local($|) = 1;
38 my $out = {}; 38 my $out = {};
39 unless ($rh->{pw} eq $PASSWORD ) { 39 unless ($rh->{pw} eq $PASSWORD ) {
40 $out->{error}=404; 40 $out->{error} = 404;
41 return($out); 41 return($out);
42 } 42 }
43 #obtain the path to the file 43 #obtain the path to the file
44 my $filePath = $rh->{fileName}; 44 my $filePath = $rh->{fileName};
45 my @pathElements = split("/", $filePath); 45 my @pathElements = split("/", $filePath);
46 46
47 # grab the last element as the fileName 47 # grab the last element as the fileName
48 #remove the extension from the file name 48 #remove the extension from the file name
49 my $fileName = pop @pathElements; 49 my $fileName = pop @pathElements;
50 $fileName =~ s/\.pg$//; 50 $fileName =~ s/\.pg$//;
51 51
52 #Create the full url and the full directory path -- If pathElements is empty this can give an extra //? Should I worry? 52 #Create the full url and the full directory path -- If pathElements is empty this can give an extra //? Should I worry? maybe
53 my $url = $TEMP_BASE_URL. join("/",@pathElements). "/$fileName.pdf"; 53 my $url = $TEMP_BASE_URL. join("/",@pathElements);
54 $url .= '/' unless $url =~ m|/$|; # only add / if it is needed.
55 $url .= "$fileName.pdf";
54 my $texFileBasePath = $TEMPDIRECTORY.join("/",@pathElements) . "/$fileName"; 56 my $texFileBasePath = $TEMPDIRECTORY.join("/",@pathElements);
57 $texFileBasePath .= '/' unless $texFileBasePath =~ m|/$|;
58 $texFileBasePath .= "$fileName";
55 59
56 # create the intermediate directories if they don't exists 60 # create the intermediate directories if they don't exists
57 # create a dummy .pdf file 61 # create a dummy .pdf file
58 surePathToTmpFile2($texFileBasePath.'.pdf'); 62 surePathToTmpFile2($texFileBasePath.'.pdf');
59# my $filePermission = '0775'; 63# my $filePermission = '0775';

Legend:
Removed from v.899  
changed lines
  Added in v.900

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9