| … | |
… | |
| 10 | |
10 | |
| 11 | use WebworkWebservice; |
11 | use WebworkWebservice; |
| 12 | package RQP; |
12 | package RQP; |
| 13 | @ISA = (SOAP::Server::Parameters); |
13 | @ISA = (SOAP::Server::Parameters); |
| 14 | local(*MYLOG); |
14 | local(*MYLOG); |
|
|
15 | |
|
|
16 | use WeBWorK::Utils::Tasks qw(fake_set fake_problem); |
|
|
17 | use RQP::Render; |
|
|
18 | |
|
|
19 | our $WW_DIRECTORY = $WebworkWebservice::WW_DIRECTORY; |
|
|
20 | our $PG_DIRECTORY = $WebworkWebservice::PG_DIRECTORY; |
|
|
21 | our $COURSENAME = $WebworkWebservice::COURSENAME; |
|
|
22 | our $HOST_NAME = $WebworkWebservice::HOST_NAME; |
|
|
23 | our $HOSTURL ="http://$HOST_NAME:8002"; #FIXME |
|
|
24 | our $ce =$WebworkWebservice::SeedCE; |
|
|
25 | # create a local course environment for some course |
|
|
26 | $ce = WeBWorK::CourseEnvironment->new($WW_DIRECTORY, "", "", $COURSENAME); |
|
|
27 | #print "\$ce = \n", WeBWorK::Utils::pretty_print_rh($ce); |
|
|
28 | our $db = WeBWorK::DB->new($ce->{dbLayout}); |
| 15 | |
29 | |
| 16 | #print MYLOG "restarting server\n\n"; |
30 | #print MYLOG "restarting server\n\n"; |
| 17 | sub test { |
31 | sub test { |
| 18 | open MYLOG, ">>/home/gage/debug_info.txt" ; |
32 | open MYLOG, ">>/home/gage/debug_info.txt" ; |
| 19 | local($|=1); |
33 | local($|=1); |
| … | |
… | |
| 91 | my $soap_som = pop; |
105 | my $soap_som = pop; |
| 92 | my $rh_params= $soap_som->method; |
106 | my $rh_params= $soap_som->method; |
| 93 | local(*DEBUGLOG); |
107 | local(*DEBUGLOG); |
| 94 | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; |
108 | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; |
| 95 | print DEBUGLOG "--RQP_SessionInformation\n"; |
109 | print DEBUGLOG "--RQP_SessionInformation\n"; |
| 96 | my $templateVars = []; |
110 | my $templatevars = $rh_params->{templatevars}; |
|
|
111 | $templatevars->{seed}=4321; |
| 97 | my $correctResponses = []; |
112 | my $correctResponses = []; |
| 98 | $rh_out = { |
113 | $rh_out = { |
|
|
114 | 'outcomevars' => {id=>45}, |
| 99 | 'templateVars' => $templateVars, |
115 | 'templatevars' => $templatevars, |
| 100 | 'correctResponses' => $correctResponses, |
116 | 'correctResponses' => $correctResponses, |
| 101 | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', |
117 | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', |
| 102 | }; |
118 | }; |
| 103 | close(DEBUGLOG); |
119 | close(DEBUGLOG); |
| 104 | return $rh_out; |
120 | return $rh_out; |
| 105 | } |
121 | } |
| 106 | |
122 | |
| 107 | |
123 | |
| 108 | sub RQP_Render { |
124 | sub RQP_Render { |
| 109 | my $class = shift; |
125 | RQP::Render::RQP_Render(@_); |
| 110 | my $soap_som = pop; |
|
|
| 111 | my $rh_params= $soap_som->method; |
|
|
| 112 | local(*DEBUGLOG); |
|
|
| 113 | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; |
|
|
| 114 | print DEBUGLOG "--RQP_Render\n"; |
|
|
| 115 | #my $output = WebworkWebservice::pretty_print_rh(\%parameters); |
|
|
| 116 | my $source = $rh_params->{source}; |
|
|
| 117 | $source =~s/</</g; |
|
|
| 118 | $source =~s/>/>/g; |
|
|
| 119 | my $output = "the first element is ". $self. " and the last ". ref($envelope)."\n\n"; |
|
|
| 120 | $output .= WebworkWebservice::pretty_print_rh($rh_params); |
|
|
| 121 | my $rh_out = { |
|
|
| 122 | templateVars => [], |
|
|
| 123 | persistentData => '', |
|
|
| 124 | outcomeVars => [], |
|
|
| 125 | output => $output, |
|
|
| 126 | source => $source, |
|
|
| 127 | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', |
|
|
| 128 | |
|
|
| 129 | }; |
|
|
| 130 | close(DEBUGLOG); |
|
|
| 131 | return $rh_out; |
|
|
| 132 | |
126 | |
| 133 | } |
127 | } |
| 134 | |
128 | |
| 135 | |
129 | |
| 136 | 1; |
130 | 1; |