1
+ use strict;
2
+ use warnings;
3
+ # use feature 'signatures';
4
+ # no warnings qw(experimental::signatures);
5
+
1
6
package RenderApp ;
2
7
use Mojo::Base ' Mojolicious' ;
3
8
@@ -15,7 +20,7 @@ BEGIN {
15
20
$ENV {PG_ROOT } = $main::dirname . ' /PG' ;
16
21
17
22
# Used for reconstructing library paths from sym-links.
18
- $ENV {OPL_DIRECTORY } = " webwork-open-problem-library" ;
23
+ $ENV {OPL_DIRECTORY } = " $ENV {RENDER_ROOT}/ webwork-open-problem-library" ;
19
24
20
25
$ENV {MOJO_CONFIG } = (-r " $ENV {RENDER_ROOT}/render_app.conf" ) ? " $ENV {RENDER_ROOT}/render_app.conf" : " $ENV {RENDER_ROOT}/render_app.conf.dist" ;
21
26
# $ENV{MOJO_MODE} = 'production';
@@ -26,8 +31,9 @@ use lib "$main::dirname";
26
31
print " home directory " . $main::dirname . " \n " ;
27
32
28
33
use RenderApp::Model::Problem;
29
- use RenderApp::Controller::RenderProblem;
30
34
use RenderApp::Controller::IO;
35
+ use WeBWorK::RenderProblem;
36
+ use WeBWorK::FormatRenderedProblem;
31
37
32
38
sub startup {
33
39
my $self = shift ;
@@ -66,6 +72,7 @@ sub startup {
66
72
$self -> helper(newProblem => sub { shift ; RenderApp::Model::Problem-> new(@_ ) });
67
73
68
74
# Helpers
75
+ $self -> helper(format => sub { WeBWorK::FormatRenderedProblem::formatRenderedProblem(@_ ) });
69
76
$self -> helper(validateRequest => sub { RenderApp::Controller::IO::validate(@_ ) });
70
77
$self -> helper(parseRequest => sub { RenderApp::Controller::Render::parseRequest(@_ ) });
71
78
$self -> helper(croak => sub { RenderApp::Controller::Render::croak(@_ ) });
@@ -107,20 +114,7 @@ sub startup {
107
114
$r -> any(' /pg_files/CAPA_Graphics/*static' )-> to(' StaticFiles#CAPA_graphics_file' );
108
115
$r -> any(' /pg_files/tmp/*static' )-> to(' StaticFiles#temp_file' );
109
116
$r -> any(' /pg_files/*static' )-> to(' StaticFiles#pg_file' );
110
- $r -> any(' /*fail' )-> to(' StaticFiles#public_file' );
111
- # # any other requests fall through
112
- # $r->any('/*fail' => sub {
113
- # my $c = shift;
114
- # my $report = $c->stash('fail')."\nCOOKIE:";
115
- # for my $cookie (@{$c->req->cookies}) {
116
- # $report .= "\n".$cookie->to_string;
117
- # }
118
- # $report .= "\nFORM DATA:";
119
- # foreach my $k (@{$c->req->params->names}) {
120
- # $report .= "\n$k = ".join ', ', @{$c->req->params->every_param($k)};
121
- # }
122
- # $c->log->fatal($report);
123
- # $c->rendered(404)});
117
+ $r -> any(' /*static' )-> to(' StaticFiles#public_file' );
124
118
}
125
119
126
120
1;
0 commit comments