Parent Directory
|
Revision Log
Revision 5243 -
(view)
(download)
(as text)
Original Path: branches/rel-2-4-dev/webwork2/lib/RQP.pm
| 1 : | gage | 3253 | #!/usr/local/bin/perl -w |
| 2 : | |||
| 3 : | |||
| 4 : | use SOAP::Lite +trace; | ||
| 5 : | #+trace => | ||
| 6 : | #[parameters,trace=>sub{ local($|=1); print LOG "start>>", | ||
| 7 : | #WebworkWebservice::pretty_print_rh(\@_ ),"<<stop\n\n"; }]; | ||
| 8 : | |||
| 9 : | |||
| 10 : | |||
| 11 : | use WebworkWebservice; | ||
| 12 : | package RQP; | ||
| 13 : | @ISA = (SOAP::Server::Parameters); | ||
| 14 : | local(*MYLOG); | ||
| 15 : | |||
| 16 : | gage | 3292 | 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}); | ||
| 29 : | |||
| 30 : | gage | 3253 | #print MYLOG "restarting server\n\n"; |
| 31 : | sub test { | ||
| 32 : | open MYLOG, ">>/home/gage/debug_info.txt" ; | ||
| 33 : | local($|=1); | ||
| 34 : | my $som = pop; | ||
| 35 : | my $self = shift; | ||
| 36 : | my $rh_parameter = $som->method; | ||
| 37 : | #$som->match('/'); | ||
| 38 : | #print MYLOG "headers\n", WebworkWebservice::pretty_print_rh($rh_parameter),"\n"; | ||
| 39 : | #warn "parameters ", WebworkWebservice::pretty_print_rh($rh_parameter); | ||
| 40 : | #my $params = $som->paramsall(); | ||
| 41 : | #warn "params ", join(" ", @{$params}); | ||
| 42 : | print MYLOG "body ", WebworkWebservice::pretty_print_rh($som->body); | ||
| 43 : | close(MYLOG); | ||
| 44 : | return "test hi bye"; | ||
| 45 : | } | ||
| 46 : | |||
| 47 : | sub RQP_ServerInformation { | ||
| 48 : | my $class = shift; | ||
| 49 : | my $soap_som = pop; | ||
| 50 : | my $rh_params= $soap_som->method; | ||
| 51 : | local(*DEBUGLOG); | ||
| 52 : | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; | ||
| 53 : | print DEBUGLOG "--RQP_ServerInformation\n"; | ||
| 54 : | |||
| 55 : | $rh_out = { 'identifier' => 'http://www.openwebwork.org', | ||
| 56 : | 'name' => 'WeBWorK', | ||
| 57 : | 'description' => 'WeBWorK server. See http://webwork.math.rochester.edu', | ||
| 58 : | 'cloning' => 0, | ||
| 59 : | 'implicitCloning' => 1, | ||
| 60 : | 'rendering' => 1, | ||
| 61 : | 'itemFormats' => ['pg'], | ||
| 62 : | 'renderFormats' => ['xml'], | ||
| 63 : | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', | ||
| 64 : | }; | ||
| 65 : | return $rh_out; | ||
| 66 : | } | ||
| 67 : | |||
| 68 : | sub RQP_ItemInformation { | ||
| 69 : | my $class = shift; | ||
| 70 : | my $soap_som = pop; | ||
| 71 : | my $rh_params= $soap_som->method; | ||
| 72 : | local(*DEBUGLOG); | ||
| 73 : | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; | ||
| 74 : | print DEBUGLOG "--RQP_ItemInformation\n"; | ||
| 75 : | my $format = 'HTML'; | ||
| 76 : | my $sourceErrors = ''; | ||
| 77 : | $rh_out = { | ||
| 78 : | 'format' => $format, | ||
| 79 : | 'sourceErrors' => $sourceErrors, | ||
| 80 : | 'template' => 1, | ||
| 81 : | 'adaptive' => 1, | ||
| 82 : | 'timeDependent' => 0, | ||
| 83 : | 'canComputeScore' => 1, | ||
| 84 : | 'solutionAvailable' => 0, | ||
| 85 : | 'hintAvailable' => 0, | ||
| 86 : | 'validationPossible' => 1, | ||
| 87 : | 'maxScore' => 1, | ||
| 88 : | 'length' => 1, | ||
| 89 : | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', | ||
| 90 : | }; | ||
| 91 : | close(DEBUGLOG); | ||
| 92 : | return $rh_out; | ||
| 93 : | } | ||
| 94 : | |||
| 95 : | sub RQP_ProcessTemplate { | ||
| 96 : | |||
| 97 : | |||
| 98 : | } | ||
| 99 : | |||
| 100 : | sub RQP_Clone { | ||
| 101 : | |||
| 102 : | } | ||
| 103 : | sub RQP_SessionInformation { | ||
| 104 : | my $class = shift; | ||
| 105 : | my $soap_som = pop; | ||
| 106 : | my $rh_params= $soap_som->method; | ||
| 107 : | local(*DEBUGLOG); | ||
| 108 : | open DEBUGLOG, ">>/home/gage/debug_info.txt" || die "can't open debug file"; | ||
| 109 : | print DEBUGLOG "--RQP_SessionInformation\n"; | ||
| 110 : | gage | 3292 | my $templatevars = $rh_params->{templatevars}; |
| 111 : | $templatevars->{seed}=4321; | ||
| 112 : | gage | 3253 | my $correctResponses = []; |
| 113 : | $rh_out = { | ||
| 114 : | gage | 3292 | 'outcomevars' => {id=>45}, |
| 115 : | 'templatevars' => $templatevars, | ||
| 116 : | gage | 3253 | 'correctResponses' => $correctResponses, |
| 117 : | input => '<hr>'.WebworkWebservice::pretty_print_rh($rh_params).'<hr>', | ||
| 118 : | }; | ||
| 119 : | close(DEBUGLOG); | ||
| 120 : | return $rh_out; | ||
| 121 : | } | ||
| 122 : | |||
| 123 : | |||
| 124 : | sub RQP_Render { | ||
| 125 : | gage | 3292 | RQP::Render::RQP_Render(@_); |
| 126 : | gage | 3253 | |
| 127 : | } | ||
| 128 : | |||
| 129 : | |||
| 130 : | 1; |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |