[system] / branches / gage_dev / webwork2 / clients / renderProblem_rawoutput.pl Repository:
ViewVC logotype

View of /branches/gage_dev/webwork2/clients/renderProblem_rawoutput.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6940 - (download) (as text) (annotate)
Mon Jul 18 19:19:15 2011 UTC (22 months, 1 week ago) by gage
File size: 44266 byte(s)
merging with trunk



    1 #!/usr/bin/perl -w
    2 
    3 ################################################################################
    4 # WeBWorK Online Homework Delivery System
    5 # Copyright © 2000-2007 The WeBWorK Project, http://openwebwork.sf.net/
    6 # $CVSHeader: webwork2/clients/renderProblem.pl,v 1.4 2010/05/11 15:44:05 gage Exp $
    7 #
    8 # This program is free software; you can redistribute it and/or modify it under
    9 # the terms of either: (a) the GNU General Public License as published by the
   10 # Free Software Foundation; either version 2, or (at your option) any later
   11 # version, or (b) the "Artistic License" which comes with this package.
   12 #
   13 # This program is distributed in the hope that it will be useful, but WITHOUT
   14 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   15 # FOR A PARTICULAR PURPOSE.  See either the GNU General Public License or the
   16 # Artistic License for more details.
   17 ################################################################################
   18 
   19 =head1 NAME
   20 
   21 webwork2/clients/renderProblem.pl
   22 
   23 This script will take a file and send it to a WeBWorK daemon webservice
   24 to have it rendered.  The result is split into the basic HTML rendering
   25 and evaluation of answers and then passed to a browser for printing.
   26 
   27 The formatting allows the browser presentation to be interactive with the
   28 daemon running the script webwork2/lib/renderViaXMLRPC.pm
   29 
   30 Rembember to configure the local output file and display command !!!!!!!!
   31 
   32 =cut
   33 
   34 use strict;
   35 use warnings;
   36 
   37 <<<<<<< .working
   38 <<<<<<< .working
   39 <<<<<<< .working
   40 
   41 
   42 ##################################################
   43 #  configuration section for client
   44 ##################################################
   45 
   46 # Use address to WeBWorK code library where WebworkClient.pm is located.
   47 use lib '/opt/webwork/webwork2/lib';
   48 #use Crypt::SSLeay;  # needed for https
   49 use WebworkClient;
   50 
   51 
   52 #############################################
   53 # Configure
   54 #############################################
   55 
   56 <<<<<<< .working
   57  ############################################################
   58 # configure the local output file and display command !!!!!!!!
   59  ############################################################
   60 =======
   61  ############################################################
   62 # configure the local output file and display command !!!!!!!!
   63  ############################################################
   64 
   65  # Path to a temporary file for storing the output of renderProblem.pl
   66  use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html';
   67 
   68  # Command line for displaying the temporary file in a browser.
   69  #use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
   70  # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";
   71    use constant DISPLAY_COMMAND => " less ";   # display tempoutputfile with less
   72  ############################################################
   73 
   74  my $use_site;
   75  $use_site = 'test_webwork';    # select a rendering site
   76  #$use_site = 'local';           # select a rendering site
   77  #$use_site = 'rochester_test';  # select a rendering site
   78 
   79 
   80  ############################################################
   81 
   82 # To configure the target webwork server
   83 # two URLs are required
   84 # 1. $XML_URL   http://test.webwork.maa.org/mod_xmlrpc
   85 #    points to the Webservice.pm and Webservice/RenderProblem modules
   86 #    Is used by the client to send the original XML request to the webservice
   87 #
   88 # 2. $FORM_ACTION_URL      http:http://test.webwork.maa.org/webwork2/html2xml
   89 #    points to the renderViaXMLRPC.pm module.
   90 #
   91 #     This url is placed as form action url when the rendered HTML from the original
   92 #     request is returned to the client from Webservice/RenderProblem. The client
   93 #     reorganizes the XML it receives into an HTML page (with a WeBWorK form) and
   94 #     pipes it through a local browser.
   95 #
   96 #     The browser uses this url to resubmit the problem (with answers) via the standard
   97 #     HTML webform used by WeBWorK to the renderViaXMLRPC.pm handler.
   98 #
   99 #     This renderViaXMLRPC.pm handler acts as an intermediary between the browser
  100 #     and the webservice.  It interprets the HTML form sent by the browser,
  101 #     rewrites the form data in XML format, submits it to the WebworkWebservice.pm
  102 #     which processes it and sends the the resulting HTML back to renderViaXMLRPC.pm
  103 #     which in turn passes it back to the browser.
  104 # 3.  The second time a problem is submitted renderViaXMLRPC.pm receives the WeBWorK form
  105 #     submitted directly by the browser.
  106 #     The renderViaXMLRPC.pm translates the WeBWorK form, has it processes by the webservice
  107 #     and returns the result to the browser.
  108 #     The The client renderProblem.pl script is no longer involved.
  109 # 4.  Summary: renderProblem.pl is only involved in the first round trip
  110 #     of the submitted problem.  After that the communication is  between the browser and
  111 #     renderViaXMLRPC using HTML forms and between renderViaXMLRPC and the WebworkWebservice.pm
  112 #     module using XML_RPC.
  113 # 5.  The XML_PASSWORD is defined on the site.  In future versions a more secure password method
  114 #     may be implemented.  This is sufficient to keep out robots.
  115 # 6.  The course "daemon_course" must be a course that has been created on the server or an error will
  116 #     result. A different name can be used but the course must exist on the server.
  117 >>>>>>> .merge-right.r6936
  118 
  119 <<<<<<< .working
  120  # Path to a temporary file for storing the output of renderProblem.pl
  121 use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html';
  122 
  123  # Command line for displaying the temporary file in a browser.
  124  #use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
  125  # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";
  126    use constant DISPLAY_COMMAND => " less ";   # display tempoutputfile with less
  127  ############################################################
  128 
  129  my $use_site;
  130  $use_site = 'test_webwork';    # select a rendering site
  131  #$use_site = 'local';           # select a rendering site
  132  #$use_site = 'rochester_test';  # select a rendering site
  133 
  134 
  135  ############################################################
  136 
  137 # To configure the target webwork server
  138 # two URLs are required
  139 # 1. $XML_URL   http://test.webwork.maa.org/mod_xmlrpc
  140 #    points to the Webservice.pm and Webservice/RenderProblem modules
  141 #    Is used by the client to send the original XML request to the webservice
  142 #
  143 # 2. $FORM_ACTION_URL      http:http://test.webwork.maa.org/webwork2/html2xml
  144 #    points to the renderViaXMLRPC.pm module.
  145 #
  146 #     This url is placed as form action url when the rendered HTML from the original
  147 #     request is returned to the client from Webservice/RenderProblem. The client
  148 #     reorganizes the XML it receives into an HTML page (with a WeBWorK form) and
  149 #     pipes it through a local browser.
  150 #
  151 #     The browser uses this url to resubmit the problem (with answers) via the standard
  152 #     HTML webform used by WeBWorK to the renderViaXMLRPC.pm handler.
  153 #
  154 #     This renderViaXMLRPC.pm handler acts as an intermediary between the browser
  155 #     and the webservice.  It interprets the HTML form sent by the browser,
  156 #     rewrites the form data in XML format, submits it to the WebworkWebservice.pm
  157 #     which processes it and sends the the resulting HTML back to renderViaXMLRPC.pm
  158 #     which in turn passes it back to the browser.
  159 # 3.  The second time a problem is submitted renderViaXMLRPC.pm receives the WeBWorK form
  160 #     submitted directly by the browser.
  161 #     The renderViaXMLRPC.pm translates the WeBWorK form, has it processes by the webservice
  162 #     and returns the result to the browser.
  163 #     The The client renderProblem.pl script is no longer involved.
  164 # 4.  Summary: renderProblem.pl is only involved in the first round trip
  165 #     of the submitted problem.  After that the communication is  between the browser and
  166 #     renderViaXMLRPC using HTML forms and between renderViaXMLRPC and the WebworkWebservice.pm
  167 #     module using XML_RPC.
  168 # 5.  The XML_PASSWORD is defined on the site.  In future versions a more secure password method
  169 #     may be implemented.  This is sufficient to keep out robots.
  170 # 6.  The course "daemon_course" must be a course that has been created on the server or an error will
  171 #     result. A different name can be used but the course must exist on the server.
  172 =======
  173 =======
  174 >>>>>>> .merge-right.r6936
  175 =======
  176 >>>>>>> .merge-right.r6936
  177 =======
  178 >>>>>>> .merge-right.r6936
  179 
  180 our ( $XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
  181 if ($use_site eq 'local') {
  182 # the rest can work!!
  183   $XML_URL      =  'http://localhost:80';
  184   $FORM_ACTION_URL  =  'http://localhost:80/webwork2/html2xml';
  185   $XML_PASSWORD     =  'xmlwebwork';
  186   $XML_COURSE       =  'daemon_course';
  187 } elsif ($use_site eq 'rochester_test') {
  188 
  189   $XML_URL      =  'http://128.151.231.2';
  190   $FORM_ACTION_URL  =  'http://128.151.231.2/webwork2/html2xml';
  191   $XML_PASSWORD     = 'xmlwebwork';
  192   $XML_COURSE       = 'daemon_course';
  193 
  194 } elsif ($use_site eq 'test_webwork') {
  195 
  196 <<<<<<< .working
  197 <<<<<<< .working
  198 <<<<<<< .working
  199   $XML_URL      =  'https://test.webwork.maa.org';
  200   $FORM_ACTION_URL  =  'https://test.webwork.maa.org/webwork2/html2xml';
  201   $XML_PASSWORD     = 'xmlwebwork';
  202   $XML_COURSE       = 'daemon_course';
  203 =======
  204 ##################################################
  205 #  configuration section for client
  206 ##################################################
  207 >>>>>>> .merge-right.r6936
  208 =======
  209 ##################################################
  210 #  configuration section for client
  211 ##################################################
  212 >>>>>>> .merge-right.r6936
  213 =======
  214 ##################################################
  215 #  configuration section for client
  216 ##################################################
  217 >>>>>>> .merge-right.r6936
  218 
  219 <<<<<<< .working
  220 <<<<<<< .working
  221 <<<<<<< .working
  222 }
  223 =======
  224 # Use address to WeBWorK code library where WebworkClient.pm is located.
  225 use lib '/opt/webwork/webwork2/lib';
  226 #use Crypt::SSLeay;  # needed for https
  227 use WebworkClient;
  228 >>>>>>> .merge-right.r6936
  229 =======
  230 # Use address to WeBWorK code library where WebworkClient.pm is located.
  231 use lib '/opt/webwork/webwork2/lib';
  232 #use Crypt::SSLeay;  # needed for https
  233 use WebworkClient;
  234 >>>>>>> .merge-right.r6936
  235 =======
  236 # Use address to WeBWorK code library where WebworkClient.pm is located.
  237 use lib '/opt/webwork/webwork2/lib';
  238 #use Crypt::SSLeay;  # needed for https
  239 use WebworkClient;
  240 >>>>>>> .merge-right.r6936
  241 
  242 <<<<<<< .working
  243 <<<<<<< .working
  244 <<<<<<< .working
  245 ##################################################
  246 #  END configuration section for client
  247 ##################################################
  248 =======
  249 >>>>>>> .merge-right.r6936
  250 =======
  251 >>>>>>> .merge-right.r6936
  252 =======
  253 >>>>>>> .merge-right.r6936
  254 
  255 #############################################
  256 # Configure
  257 #############################################
  258 
  259 <<<<<<< .working
  260 <<<<<<< .working
  261 <<<<<<< .working
  262 =======
  263  ############################################################
  264 # configure the local output file and display command !!!!!!!!
  265  ############################################################
  266 
  267  # Path to a temporary file for storing the output of renderProblem.pl
  268  use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html';
  269 
  270  # Command line for displaying the temporary file in a browser.
  271  #use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
  272  # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";
  273    use constant DISPLAY_COMMAND => " less ";   # display tempoutputfile with less
  274  ############################################################
  275 
  276  my $use_site;
  277  $use_site = 'test_webwork';    # select a rendering site
  278  #$use_site = 'local';           # select a rendering site
  279  #$use_site = 'rochester_test';  # select a rendering site
  280 
  281 
  282  ############################################################
  283 
  284 # To configure the target webwork server
  285 # two URLs are required
  286 # 1. $XML_URL   http://test.webwork.maa.org/mod_xmlrpc
  287 #    points to the Webservice.pm and Webservice/RenderProblem modules
  288 #    Is used by the client to send the original XML request to the webservice
  289 #
  290 # 2. $FORM_ACTION_URL      http:http://test.webwork.maa.org/webwork2/html2xml
  291 #    points to the renderViaXMLRPC.pm module.
  292 #
  293 #     This url is placed as form action url when the rendered HTML from the original
  294 #     request is returned to the client from Webservice/RenderProblem. The client
  295 #     reorganizes the XML it receives into an HTML page (with a WeBWorK form) and
  296 #     pipes it through a local browser.
  297 #
  298 #     The browser uses this url to resubmit the problem (with answers) via the standard
  299 #     HTML webform used by WeBWorK to the renderViaXMLRPC.pm handler.
  300 #
  301 #     This renderViaXMLRPC.pm handler acts as an intermediary between the browser
  302 #     and the webservice.  It interprets the HTML form sent by the browser,
  303 #     rewrites the form data in XML format, submits it to the WebworkWebservice.pm
  304 #     which processes it and sends the the resulting HTML back to renderViaXMLRPC.pm
  305 #     which in turn passes it back to the browser.
  306 # 3.  The second time a problem is submitted renderViaXMLRPC.pm receives the WeBWorK form
  307 #     submitted directly by the browser.
  308 #     The renderViaXMLRPC.pm translates the WeBWorK form, has it processes by the webservice
  309 #     and returns the result to the browser.
  310 #     The The client renderProblem.pl script is no longer involved.
  311 # 4.  Summary: renderProblem.pl is only involved in the first round trip
  312 #     of the submitted problem.  After that the communication is  between the browser and
  313 #     renderViaXMLRPC using HTML forms and between renderViaXMLRPC and the WebworkWebservice.pm
  314 #     module using XML_RPC.
  315 # 5.  The XML_PASSWORD is defined on the site.  In future versions a more secure password method
  316 #     may be implemented.  This is sufficient to keep out robots.
  317 # 6.  The course "daemon_course" must be a course that has been created on the server or an error will
  318 #     result. A different name can be used but the course must exist on the server.
  319 >>>>>>> .merge-right.r6936
  320 =======
  321  ############################################################
  322 # configure the local output file and display command !!!!!!!!
  323  ############################################################
  324 
  325  # Path to a temporary file for storing the output of renderProblem.pl
  326  use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html';
  327 
  328  # Command line for displaying the temporary file in a browser.
  329  #use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
  330  # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";
  331    use constant DISPLAY_COMMAND => " less ";   # display tempoutputfile with less
  332  ############################################################
  333 
  334  my $use_site;
  335  $use_site = 'test_webwork';    # select a rendering site
  336  #$use_site = 'local';           # select a rendering site
  337  #$use_site = 'rochester_test';  # select a rendering site
  338 
  339 
  340  ############################################################
  341 
  342 # To configure the target webwork server
  343 # two URLs are required
  344 # 1. $XML_URL   http://test.webwork.maa.org/mod_xmlrpc
  345 #    points to the Webservice.pm and Webservice/RenderProblem modules
  346 #    Is used by the client to send the original XML request to the webservice
  347 #
  348 # 2. $FORM_ACTION_URL      http:http://test.webwork.maa.org/webwork2/html2xml
  349 #    points to the renderViaXMLRPC.pm module.
  350 #
  351 #     This url is placed as form action url when the rendered HTML from the original
  352 #     request is returned to the client from Webservice/RenderProblem. The client
  353 #     reorganizes the XML it receives into an HTML page (with a WeBWorK form) and
  354 #     pipes it through a local browser.
  355 #
  356 #     The browser uses this url to resubmit the problem (with answers) via the standard
  357 #     HTML webform used by WeBWorK to the renderViaXMLRPC.pm handler.
  358 #
  359 #     This renderViaXMLRPC.pm handler acts as an intermediary between the browser
  360 #     and the webservice.  It interprets the HTML form sent by the browser,
  361 #     rewrites the form data in XML format, submits it to the WebworkWebservice.pm
  362 #     which processes it and sends the the resulting HTML back to renderViaXMLRPC.pm
  363 #     which in turn passes it back to the browser.
  364 # 3.  The second time a problem is submitted renderViaXMLRPC.pm receives the WeBWorK form
  365 #     submitted directly by the browser.
  366 #     The renderViaXMLRPC.pm translates the WeBWorK form, has it processes by the webservice
  367 #     and returns the result to the browser.
  368 #     The The client renderProblem.pl script is no longer involved.
  369 # 4.  Summary: renderProblem.pl is only involved in the first round trip
  370 #     of the submitted problem.  After that the communication is  between the browser and
  371 #     renderViaXMLRPC using HTML forms and between renderViaXMLRPC and the WebworkWebservice.pm
  372 #     module using XML_RPC.
  373 # 5.  The XML_PASSWORD is defined on the site.  In future versions a more secure password method
  374 #     may be implemented.  This is sufficient to keep out robots.
  375 # 6.  The course "daemon_course" must be a course that has been created on the server or an error will
  376 #     result. A different name can be used but the course must exist on the server.
  377 >>>>>>> .merge-right.r6936
  378 =======
  379  ############################################################
  380 # configure the local output file and display command !!!!!!!!
  381  ############################################################
  382 
  383  # Path to a temporary file for storing the output of renderProblem.pl
  384  use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html';
  385 
  386  # Command line for displaying the temporary file in a browser.
  387  #use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
  388  # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";
  389    use constant DISPLAY_COMMAND => " less ";   # display tempoutputfile with less
  390  ############################################################
  391 
  392  my $use_site;
  393  $use_site = 'test_webwork';    # select a rendering site
  394  #$use_site = 'local';           # select a rendering site
  395  #$use_site = 'rochester_test';  # select a rendering site
  396 
  397 
  398  ############################################################
  399 
  400 # To configure the target webwork server
  401 # two URLs are required
  402 # 1. $XML_URL   http://test.webwork.maa.org/mod_xmlrpc
  403 #    points to the Webservice.pm and Webservice/RenderProblem modules
  404 #    Is used by the client to send the original XML request to the webservice
  405 #
  406 # 2. $FORM_ACTION_URL      http:http://test.webwork.maa.org/webwork2/html2xml
  407 #    points to the renderViaXMLRPC.pm module.
  408 #
  409 #     This url is placed as form action url when the rendered HTML from the original
  410 #     request is returned to the client from Webservice/RenderProblem. The client
  411 #     reorganizes the XML it receives into an HTML page (with a WeBWorK form) and
  412 #     pipes it through a local browser.
  413 #
  414 #     The browser uses this url to resubmit the problem (with answers) via the standard
  415 #     HTML webform used by WeBWorK to the renderViaXMLRPC.pm handler.
  416 #
  417 #     This renderViaXMLRPC.pm handler acts as an intermediary between the browser
  418 #     and the webservice.  It interprets the HTML form sent by the browser,
  419 #     rewrites the form data in XML format, submits it to the WebworkWebservice.pm
  420 #     which processes it and sends the the resulting HTML back to renderViaXMLRPC.pm
  421 #     which in turn passes it back to the browser.
  422 # 3.  The second time a problem is submitted renderViaXMLRPC.pm receives the WeBWorK form
  423 #     submitted directly by the browser.
  424 #     The renderViaXMLRPC.pm translates the WeBWorK form, has it processes by the webservice
  425 #     and returns the result to the browser.
  426 #     The The client renderProblem.pl script is no longer involved.
  427 # 4.  Summary: renderProblem.pl is only involved in the first round trip
  428 #     of the submitted problem.  After that the communication is  between the browser and
  429 #     renderViaXMLRPC using HTML forms and between renderViaXMLRPC and the WebworkWebservice.pm
  430 #     module using XML_RPC.
  431 # 5.  The XML_PASSWORD is defined on the site.  In future versions a more secure password method
  432 #     may be implemented.  This is sufficient to keep out robots.
  433 # 6.  The course "daemon_course" must be a course that has been created on the server or an error will
  434 #     result. A different name can be used but the course must exist on the server.
  435 >>>>>>> .merge-right.r6936
  436 
  437 <<<<<<< .working
  438 <<<<<<< .working
  439 <<<<<<< .working
  440 use constant DISPLAYMODE   => 'images'; #  jsMath  is another possibilities.
  441 
  442 
  443 our @COMMANDS = qw( listLibraries    renderProblem  ); #listLib  readFile tex2pdf
  444 
  445 
  446 ##################################################
  447 =======
  448 
  449 our ( $XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
  450 if ($use_site eq 'local') {
  451 # the rest can work!!
  452   $XML_URL      =  'http://localhost:80';
  453   $FORM_ACTION_URL  =  'http://localhost:80/webwork2/html2xml';
  454   $XML_PASSWORD     =  'xmlwebwork';
  455   $XML_COURSE       =  'daemon_course';
  456 } elsif ($use_site eq 'rochester_test') {
  457 
  458   $XML_URL      =  'http://128.151.231.2';
  459   $FORM_ACTION_URL  =  'http://128.151.231.2/webwork2/html2xml';
  460   $XML_PASSWORD     = 'xmlwebwork';
  461   $XML_COURSE       = 'daemon_course';
  462 
  463 } elsif ($use_site eq 'test_webwork') {
  464 
  465   $XML_URL      =  'https://test.webwork.maa.org';
  466   $FORM_ACTION_URL  =  'https://test.webwork.maa.org/webwork2/html2xml';
  467   $XML_PASSWORD     = 'xmlwebwork';
  468   $XML_COURSE       = 'daemon_course';
  469 
  470 }
  471 
  472 ##################################################
  473 #  END configuration section for client
  474 ##################################################
  475 
  476 
  477 
  478 use constant DISPLAYMODE   => 'images'; #  jsMath  is another possibilities.
  479 
  480 
  481 our @COMMANDS = qw( listLibraries    renderProblem  ); #listLib  readFile tex2pdf
  482 
  483 
  484 ##################################################
  485 >>>>>>> .merge-right.r6936
  486 =======
  487 
  488 our ( $XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
  489 if ($use_site eq 'local') {
  490 # the rest can work!!
  491   $XML_URL      =  'http://localhost:80';
  492   $FORM_ACTION_URL  =  'http://localhost:80/webwork2/html2xml';
  493   $XML_PASSWORD     =  'xmlwebwork';
  494   $XML_COURSE       =  'daemon_course';
  495 } elsif ($use_site eq 'rochester_test') {
  496 
  497   $XML_URL      =  'http://128.151.231.2';
  498   $FORM_ACTION_URL  =  'http://128.151.231.2/webwork2/html2xml';
  499   $XML_PASSWORD     = 'xmlwebwork';
  500   $XML_COURSE       = 'daemon_course';
  501 
  502 } elsif ($use_site eq 'test_webwork') {
  503 
  504   $XML_URL      =  'https://test.webwork.maa.org';
  505   $FORM_ACTION_URL  =  'https://test.webwork.maa.org/webwork2/html2xml';
  506   $XML_PASSWORD     = 'xmlwebwork';
  507   $XML_COURSE       = 'daemon_course';
  508 
  509 }
  510 
  511 ##################################################
  512 #  END configuration section for client
  513 ##################################################
  514 
  515 
  516 
  517 use constant DISPLAYMODE   => 'images'; #  jsMath  is another possibilities.
  518 
  519 
  520 our @COMMANDS = qw( listLibraries    renderProblem  ); #listLib  readFile tex2pdf
  521 
  522 
  523 ##################################################
  524 >>>>>>> .merge-right.r6936
  525 =======
  526 
  527 our ( $XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
  528 if ($use_site eq 'local') {
  529 # the rest can work!!
  530   $XML_URL      =  'http://localhost:80';
  531   $FORM_ACTION_URL  =  'http://localhost:80/webwork2/html2xml';
  532   $XML_PASSWORD     =  'xmlwebwork';
  533   $XML_COURSE       =  'daemon_course';
  534 } elsif ($use_site eq 'rochester_test') {
  535 
  536   $XML_URL      =  'http://128.151.231.2';
  537   $FORM_ACTION_URL  =  'http://128.151.231.2/webwork2/html2xml';
  538   $XML_PASSWORD     = 'xmlwebwork';
  539   $XML_COURSE       = 'daemon_course';
  540 
  541 } elsif ($use_site eq 'test_webwork') {
  542 
  543   $XML_URL      =  'https://test.webwork.maa.org';
  544   $FORM_ACTION_URL  =  'https://test.webwork.maa.org/webwork2/html2xml';
  545   $XML_PASSWORD     = 'xmlwebwork';
  546   $XML_COURSE       = 'daemon_course';
  547 
  548 }
  549 
  550 ##################################################
  551 #  END configuration section for client
  552 ##################################################
  553 
  554 
  555 
  556 use constant DISPLAYMODE   => 'images'; #  jsMath  is another possibilities.
  557 
  558 
  559 our @COMMANDS = qw( listLibraries    renderProblem  ); #listLib  readFile tex2pdf
  560 
  561 
  562 ##################################################
  563 >>>>>>> .merge-right.r6936
  564 # end configuration section
  565 <<<<<<< .working
  566 <<<<<<< .working
  567 <<<<<<< .working
  568 >>>>>>> .merge-right.r6936
  569 ##################################################
  570 =======
  571 ##################################################
  572 >>>>>>> .merge-right.r6936
  573 =======
  574 ##################################################
  575 >>>>>>> .merge-right.r6936
  576 =======
  577 ##################################################
  578 >>>>>>> .merge-right.r6936
  579 
  580 
  581 our ( $XML_URL,$FORM_ACTION_URL, $XML_PASSWORD, $XML_COURSE);
  582 if ($use_site eq 'local') {
  583 # the rest can work!!
  584   $XML_URL      =  'http://localhost:80';
  585   $FORM_ACTION_URL  =  'http://localhost:80/webwork2/html2xml';
  586   $XML_PASSWORD     =  'xmlwebwork';
  587   $XML_COURSE       =  'daemon_course';
  588 } elsif ($use_site eq 'rochester_test') {
  589 
  590   $XML_URL      =  'http://128.151.231.2';
  591   $FORM_ACTION_URL  =  'http://128.151.231.2/webwork2/html2xml';
  592   $XML_PASSWORD     = 'xmlwebwork';
  593   $XML_COURSE       = 'daemon_course';
  594 
  595 } elsif ($use_site eq 'test_webwork') {
  596 
  597 <<<<<<< .working
  598 <<<<<<< .working
  599 <<<<<<< .working
  600 <<<<<<< .working
  601   $XML_URL      =  'https://test.webwork.maa.org';
  602   $FORM_ACTION_URL  =  'https://test.webwork.maa.org/webwork2/html2xml';
  603   $XML_PASSWORD     = 'xmlwebwork';
  604   $XML_COURSE       = 'daemon_course';
  605 =======
  606 our $xmlrpc_client = new WebworkClient;
  607 
  608 ##################################################
  609 # input/output section
  610 ##################################################
  611 
  612 
  613 =======
  614 our $xmlrpc_client = new WebworkClient;
  615 
  616 ##################################################
  617 # input/output section
  618 ##################################################
  619 
  620 
  621 >>>>>>> .merge-right.r6936
  622 =======
  623 our $xmlrpc_client = new WebworkClient;
  624 
  625 ##################################################
  626 # input/output section
  627 ##################################################
  628 
  629 
  630 >>>>>>> .merge-right.r6936
  631 =======
  632 our $xmlrpc_client = new WebworkClient;
  633 
  634 ##################################################
  635 # input/output section
  636 ##################################################
  637 
  638 
  639 >>>>>>> .merge-right.r6936
  640 our $source;
  641 <<<<<<< .working
  642 <<<<<<< .working
  643 <<<<<<< .working
  644 >>>>>>> .merge-right.r6936
  645 our $rh_result;
  646 # filter mode  main code
  647 =======
  648 our $rh_result;
  649 # filter mode  main code
  650 >>>>>>> .merge-right.r6936
  651 =======
  652 our $rh_result;
  653 # filter mode  main code
  654 >>>>>>> .merge-right.r6936
  655 =======
  656 our $rh_result;
  657 # filter mode  main code
  658 >>>>>>> .merge-right.r6936
  659 
  660 <<<<<<< .working
  661 <<<<<<< .working
  662 <<<<<<< .working
  663 <<<<<<< .working
  664 }
  665 
  666 =======
  667 >>>>>>> .merge-right.r6936
  668 =======
  669 >>>>>>> .merge-right.r6936
  670 =======
  671 >>>>>>> .merge-right.r6936
  672 =======
  673 >>>>>>> .merge-right.r6936
  674 <<<<<<< .working
  675 ##################################################
  676 #  END configuration section for client
  677 ##################################################
  678 =======
  679 undef $/;
  680 $source   = <>; #slurp input
  681 $/ =1;
  682 <<<<<<< .working
  683 <<<<<<< .working
  684 <<<<<<< .working
  685 $xmlrpc_client->encodeSource($source);
  686 $xmlrpc_client->url($XML_URL);
  687 $xmlrpc_client->{form_action_url}= $FORM_ACTION_URL;
  688 $xmlrpc_client->{displayMode}   = DISPLAYMODE();
  689 $xmlrpc_client->{user}          = 'xmluser';
  690 $xmlrpc_client->{password}      = $XML_PASSWORD;
  691 $xmlrpc_client->{course}        = $XML_COURSE;
  692 >>>>>>> .merge-right.r6936
  693 =======
  694 $xmlrpc_client->encodeSource($source);
  695 $xmlrpc_client->url($XML_URL);
  696 $xmlrpc_client->{form_action_url}= $FORM_ACTION_URL;
  697 $xmlrpc_client->{displayMode}   = DISPLAYMODE();
  698 $xmlrpc_client->{user}          = 'xmluser';
  699 $xmlrpc_client->{password}      = $XML_PASSWORD;
  700 $xmlrpc_client->{course}        = $XML_COURSE;
  701 >>>>>>> .merge-right.r6936
  702 =======
  703 $xmlrpc_client->encodeSource($source);
  704 $xmlrpc_client->url($XML_URL);
  705 $xmlrpc_client->{form_action_url}= $FORM_ACTION_URL;
  706 $xmlrpc_client->{displayMode}   = DISPLAYMODE();
  707 $xmlrpc_client->{user}          = 'xmluser';
  708 $xmlrpc_client->{password}      = $XML_PASSWORD;
  709 $xmlrpc_client->{course}        = $XML_COURSE;
  710 >>>>>>> .merge-right.r6936
  711 =======
  712 $xmlrpc_client->encodeSource($source);
  713 $xmlrpc_client->url($XML_URL);
  714 $xmlrpc_client->{form_action_url}= $FORM_ACTION_URL;
  715 $xmlrpc_client->{displayMode}   = DISPLAYMODE();
  716 $xmlrpc_client->{user}          = 'xmluser';
  717 $xmlrpc_client->{password}      = $XML_PASSWORD;
  718 $xmlrpc_client->{course}        = $XML_COURSE;
  719 >>>>>>> .merge-right.r6936
  720 
  721 <<<<<<< .working
  722 <<<<<<< .working
  723 <<<<<<< .working
  724 <<<<<<< .working
  725 =======
  726 #xmlrpcCall('renderProblem');
  727 our $output;
  728 if ( $xmlrpc_client->xmlrpcCall('renderProblem') )    {
  729     $output = "1\n";
  730   $output = pretty_print( $xmlrpc_client->{output} );
  731 } else {
  732     $output = "0\n";
  733   $output = $xmlrpc_client->{output};  # error report
  734 }
  735 >>>>>>> .merge-right.r6936
  736 =======
  737 #xmlrpcCall('renderProblem');
  738 our $output;
  739 if ( $xmlrpc_client->xmlrpcCall('renderProblem') )    {
  740     $output = "1\n";
  741   $output = pretty_print( $xmlrpc_client->{output} );
  742 } else {
  743     $output = "0\n";
  744   $output = $xmlrpc_client->{output};  # error report
  745 }
  746 >>>>>>> .merge-right.r6936
  747 =======
  748 #xmlrpcCall('renderProblem');
  749 our $output;
  750 if ( $xmlrpc_client->xmlrpcCall('renderProblem') )    {
  751     $output = "1\n";
  752   $output = pretty_print( $xmlrpc_client->{output} );
  753 } else {
  754     $output = "0\n";
  755   $output = $xmlrpc_client->{output};  # error report
  756 }
  757 >>>>>>> .merge-right.r6936
  758 =======
  759 #xmlrpcCall('renderProblem');
  760 our $output;
  761 if ( $xmlrpc_client->xmlrpcCall('renderProblem') )    {
  762     $output = "1\n";
  763   $output = pretty_print( $xmlrpc_client->{output} );
  764 } else {
  765     $output = "0\n";
  766   $output = $xmlrpc_client->{output};  # error report
  767 }
  768 >>>>>>> .merge-right.r6936
  769 
  770 
  771 use constant DISPLAYMODE   => 'images'; #  jsMath  is another possibilities.
  772 
  773 <<<<<<< .working
  774 <<<<<<< .working
  775 <<<<<<< .working
  776 <<<<<<< .working
  777 =======
  778 local(*FH);
  779 open(FH, '>'.TEMPOUTPUTFILE) or die "Can't open file ".TEMPOUTPUTFILE()." for writing";
  780 print FH $output;
  781 close(FH);
  782 >>>>>>> .merge-right.r6936
  783 =======
  784 local(*FH);
  785 open(FH, '>'.TEMPOUTPUTFILE) or die "Can't open file ".TEMPOUTPUTFILE()." for writing";
  786 print FH $output;
  787 close(FH);
  788 >>>>>>> .merge-right.r6936
  789 =======
  790 local(*FH);
  791 open(FH, '>'.TEMPOUTPUTFILE) or die "Can't open file ".TEMPOUTPUTFILE()." for writing";
  792 print FH $output;
  793 close(FH);
  794 >>>>>>> .merge-right.r6936
  795 =======
  796 local(*FH);
  797 open(FH, '>'.TEMPOUTPUTFILE) or die "Can't open file ".TEMPOUTPUTFILE()." for writing";
  798 print FH $output;
  799 close(FH);
  800 >>>>>>> .merge-right.r6936
  801 
  802 <<<<<<< .working
  803 <<<<<<< .working
  804 <<<<<<< .working
  805 <<<<<<< .working
  806 our @COMMANDS = qw( listLibraries    renderProblem  ); #listLib  readFile tex2pdf
  807 
  808 
  809 ##################################################
  810 # end configuration section
  811 ##################################################
  812 
  813 
  814 
  815 our $xmlrpc_client = new WebworkClient;
  816 
  817 ##################################################
  818 # input/output section
  819 ##################################################
  820 
  821 
  822 our $source;
  823 our $rh_result;
  824 # filter mode  main code
  825 
  826 undef $/;
  827 $source   = <>; #slurp input
  828 $/ =1;
  829 $xmlrpc_client->encodeSource($source);
  830 $xmlrpc_client->url($XML_URL);
  831 $xmlrpc_client->{form_action_url}= $FORM_ACTION_URL;
  832 $xmlrpc_client->{displayMode}   = DISPLAYMODE();
  833 $xmlrpc_client->{user}          = 'xmluser';
  834 $xmlrpc_client->{password}      = $XML_PASSWORD;
  835 $xmlrpc_client->{course}        = $XML_COURSE;
  836 
  837 #xmlrpcCall('renderProblem');
  838 our $output;
  839 if ( $xmlrpc_client->xmlrpcCall('renderProblem') )    {
  840     $output = "1\n";
  841   $output = pretty_print( $xmlrpc_client->{output} );
  842     } else {
  843     $output = "0\n";
  844   $output = $xmlrpc_client->{output};  # error report
  845 }
  846 
  847 
  848 
  849 local(*FH);
  850 open(FH, '>'.TEMPOUTPUTFILE) or die "Can't open file ".TEMPOUTPUTFILE()." for writing";
  851 print FH $output;
  852 close(FH);
  853 
  854 system(DISPLAY_COMMAND().TEMPOUTPUTFILE());
  855 
  856 ##################################################
  857 # end input/output section
  858 ##################################################
  859 
  860 sub pretty_print {
  861 =======
  862 system(DISPLAY_COMMAND().TEMPOUTPUTFILE());
  863 
  864 ##################################################
  865 # end input/output section
  866 ##################################################
  867 
  868 sub pretty_print {
  869 >>>>>>> .merge-right.r6936
  870 =======
  871 system(DISPLAY_COMMAND().TEMPOUTPUTFILE());
  872 
  873 ##################################################
  874 # end input/output section
  875 ##################################################
  876 
  877 sub pretty_print {
  878 >>>>>>> .merge-right.r6936
  879 =======
  880 system(DISPLAY_COMMAND().TEMPOUTPUTFILE());
  881 
  882 ##################################################
  883 # end input/output section
  884 ##################################################
  885 
  886 sub pretty_print {
  887 >>>>>>> .merge-right.r6936
  888 =======
  889 system(DISPLAY_COMMAND().TEMPOUTPUTFILE());
  890 
  891 ##################################################
  892 # end input/output section
  893 ##################################################
  894 
  895 sub pretty_print {
  896 >>>>>>> .merge-right.r6936
  897     shift if UNIVERSAL::isa($_[0] => __PACKAGE__);
  898   my $rh = shift;
  899   my $indent = shift || 0;
  900   my $out = "";
  901   my $type = ref($rh);
  902 
  903   if (defined($type) and $type) {
  904     $out .= " type = $type; ";
  905   } elsif (! defined($rh )) {
  906     $out .= " type = UNDEFINED; ";
  907   }
  908   return $out." " unless defined($rh);
  909 
  910   if ( ref($rh) =~/HASH/ or "$rh" =~/HASH/ ) {
  911       $out .= "{\n";
  912       $indent++;
  913     foreach my $key (sort keys %{$rh})  {
  914       $out .= "  "x$indent."$key => " . pretty_print( $rh->{$key}, $indent ) . "\n";
  915     }
  916     $indent--;
  917     $out .= "\n"."  "x$indent."}\n";
  918 
  919   } elsif (ref($rh)  =~  /ARRAY/ or "$rh" =~/ARRAY/) {
  920       $out .= " ( ";
  921     foreach my $elem ( @{$rh} )  {
  922       $out .= pretty_print($elem, $indent);
  923 
  924     }
  925     $out .=  " ) \n";
  926   } elsif ( ref($rh) =~ /SCALAR/ ) {
  927     $out .= "scalar reference ". ${$rh};
  928   } elsif ( ref($rh) =~/Base64/ ) {
  929     $out .= "base64 reference " .$$rh;
  930   } else {
  931     $out .=  $rh;
  932   }
  933 
  934   return $out." ";
  935 }
  936 
  937 ##################################################
  938 # XMLRPC client --
  939 # the code below is identical between renderProblem.pl and renderViaXMLRPC.pm????
  940 # and has been included in WebworkClient.pm
  941 ##################################################
  942 
  943 # package WeBWorK::ContentGenerator::renderViaXMLRPC_client;
  944 #
  945 # use Crypt::SSLeay;  # needed for https
  946 # use XMLRPC::Lite;
  947 # use MIME::Base64 qw( encode_base64 decode_base64);
  948 #
  949 # use constant  TRANSPORT_METHOD => 'XMLRPC::Lite';
  950 # use constant  REQUEST_CLASS    => 'WebworkXMLRPC';  # WebworkXMLRPC is used for soap also!!
  951 # use constant  REQUEST_URI      => 'mod_xmlrpc';
  952 #
  953 # sub new {
  954 #   my $self = {
  955 #     output      => '',
  956 #     encodedSource   => '',
  957 #     url             => '',
  958 #     password        => '',
  959 #     course          => '',
  960 #     displayMode     => '',
  961 #     inputs_ref      => {     AnSwEr0001 => '',
  962 #                    AnSwEr0002 => '',
  963 #                    AnSwEr0003 => '',
  964 #     },
  965 #   };
  966 #
  967 #   bless $self;
  968 # }
  969 #
  970 #
  971 # our $result;
  972 #
  973 # ##################################################
  974 # # Utilities --
  975 # #    this code is identical between renderProblem.pl and renderViaXMLRPC.pm
  976 # ##################################################
  977 #
  978 # sub xmlrpcCall {
  979 #   my $self        = shift;
  980 #   my $command     = shift;
  981 #   $command        = 'listLibraries' unless $command;
  982 #
  983 #     my $requestResult = TRANSPORT_METHOD
  984 #       -> proxy($self->{url}.'/'.REQUEST_URI);
  985 #
  986 #     my $input = $self->setInputTable();
  987 #     local( $result);
  988 #     # use eval to catch errors
  989 #     eval { $result = $requestResult->call(REQUEST_CLASS.'.'.$command,$input) };
  990 #     if ($@) {
  991 #       print STDERR "There were a lot of errors for $command\n" ;
  992 #       print STDERR "Errors: \n $@\n End Errors\n" ;
  993 #       return 0 #failure
  994 #     }
  995 #
  996 #     unless (ref($result) and $result->fault) {
  997 #       my $rh_result = $result->result();
  998 #       #print STDERR pretty_print_rh($rh_result);
  999 #     $self->{output} = $rh_result; #$self->formatRenderedProblem($rh_result);
 1000 #     return 1; # success
 1001 #
 1002 #     } else {
 1003 #     $self->{output} = 'Error from server: '. join( ",\n ",
 1004 #       $result->faultcode,
 1005 #       $result->faultstring);
 1006 #     return 0; #failure
 1007 #     }
 1008 # }
 1009 #
 1010 # sub encodeSource {
 1011 #   my $self = shift;
 1012 #   my $source = shift;
 1013 #   $self->{encodedSource} =encode_base64($source);
 1014 # }
 1015 # sub url {
 1016 #   my $self = shift;
 1017 #   my $new_url = shift;
 1018 #   $self->{url} = $new_url if defined($new_url) and $new_url =~ /\S/;
 1019 #   $self->{url};
 1020 # }
 1021 # sub pretty_print {    # provides html output -- NOT a method
 1022 #     my $r_input = shift;
 1023 #     my $level = shift;
 1024 #     $level = 4 unless defined($level);
 1025 #     $level--;
 1026 #     return '' unless $level > 0;  # only print three levels of hashes (safety feature)
 1027 #     my $out = '';
 1028 #     if ( not ref($r_input) ) {
 1029 #       $out = $r_input if defined $r_input;    # not a reference
 1030 #       $out =~ s/</&lt;/g  ;  # protect for HTML output
 1031 #     } elsif ("$r_input" =~/hash/i) {  # this will pick up objects whose '$self' is hash and so works better than ref($r_iput).
 1032 #       local($^W) = 0;
 1033 #
 1034 #     $out .= "$r_input " ."<TABLE border = \"2\" cellpadding = \"3\" BGCOLOR = \"#FFFFFF\">";
 1035 #
 1036 #
 1037 #     foreach my $key ( sort ( keys %$r_input )) {
 1038 #       $out .= "<tr><TD> $key</TD><TD>=&gt;</td><td>&nbsp;".pretty_print($r_input->{$key}) . "</td></tr>";
 1039 #     }
 1040 #     $out .="</table>";
 1041 #   } elsif (ref($r_input) eq 'ARRAY' ) {
 1042 #     my @array = @$r_input;
 1043 #     $out .= "( " ;
 1044 #     while (@array) {
 1045 #       $out .= pretty_print(shift @array, $level) . " , ";
 1046 #     }
 1047 #     $out .= " )";
 1048 #   } elsif (ref($r_input) eq 'CODE') {
 1049 #     $out = "$r_input";
 1050 #   } else {
 1051 #     $out = $r_input;
 1052 #     $out =~ s/</&lt;/g; # protect for HTML output
 1053 #   }
 1054 #
 1055 #   return $out." ";
 1056 # }
 1057 #
 1058 # sub setInputTable_for_listLib {
 1059 #   my $self = shift;
 1060 #   my $out = {
 1061 #     pw          =>   $self->{password},
 1062 #     set         =>   'set0',
 1063 #     library_name =>  'Library',
 1064 #     command      =>  'all',
 1065 #   };
 1066 #
 1067 #   $out;
 1068 # }
 1069 # sub setInputTable {
 1070 #   my $self = shift;
 1071 #   my $out = {
 1072 #     pw          =>   $self->{password},
 1073 #     library_name =>  'Library',
 1074 #     command      =>  'renderProblem',
 1075 #     answer_form_submitted   => 1,
 1076 #     course                  => $self->{course},
 1077 #     extra_packages_to_load  => [qw( AlgParserWithImplicitExpand Expr
 1078 #                                     ExprWithImplicitExpand AnswerEvaluator
 1079 #                                     AnswerEvaluatorMaker
 1080 #     )],
 1081 #     mode                    => $self->{displayMode},
 1082 #     modules_to_evaluate     => [ qw(
 1083 # Exporter
 1084 # DynaLoader
 1085 # GD
 1086 # WWPlot
 1087 # Fun
 1088 # Circle
 1089 # Label
 1090 # PGrandom
 1091 # Units
 1092 # Hermite
 1093 # List
 1094 # Match
 1095 # Multiple
 1096 # Select
 1097 # AlgParser
 1098 # AnswerHash
 1099 # Fraction
 1100 # VectorField
 1101 # Complex1
 1102 # Complex
 1103 # MatrixReal1 Matrix
 1104 # Distributions
 1105 # Regression
 1106 #
 1107 #     )],
 1108 #     envir                   => $self->environment(),
 1109 #     problem_state           => {
 1110 #
 1111 #       num_of_correct_ans  => 0,
 1112 #       num_of_incorrect_ans => 4,
 1113 #       recorded_score       => 1.0,
 1114 #     },
 1115 #     source                   => $self->{encodedSource},  #base64 encoded
 1116 #
 1117 #
 1118 #
 1119 #   };
 1120 #
 1121 #   $out;
 1122 # }
 1123 #
 1124 # sub environment {
 1125 #   my $self = shift;
 1126 #   my $envir = {
 1127 #     answerDate  => '4014438528',
 1128 #     CAPA_Graphics_URL=>'http://webwork-db.math.rochester.edu/capa_graphics/',
 1129 #     CAPA_GraphicsDirectory =>'/ww/webwork/CAPA/CAPA_Graphics/',
 1130 #     CAPA_MCTools=>'/ww/webwork/CAPA/CAPA_MCTools/',
 1131 #     CAPA_Tools=>'/ww/webwork/CAPA/CAPA_Tools/',
 1132 #     cgiDirectory=>'Not defined',
 1133 #     cgiURL => 'Not defined',
 1134 #     classDirectory=> 'Not defined',
 1135 #     courseName=>'Not defined',
 1136 #     courseScriptsDirectory=>'not defined',
 1137 #     displayMode=>$self->{displayMode},
 1138 #     dueDate=> '4014438528',
 1139 #     effectivePermissionLevel => 10,
 1140 #     externalGif2EpsPath=>'not defined',
 1141 #     externalPng2EpsPath=>'not defined',
 1142 #     externalTTHPath=>'/usr/local/bin/tth',
 1143 #     fileName=>'set0/prob1a.pg',
 1144 #     formattedAnswerDate=>'6/19/00',
 1145 #     formattedDueDate=>'6/19/00',
 1146 #     formattedOpenDate=>'6/19/00',
 1147 #     functAbsTolDefault=> 0.0000001,
 1148 #     functLLimitDefault=>0,
 1149 #     functMaxConstantOfIntegration=> 1000000000000.0,
 1150 #     functNumOfPoints=> 5,
 1151 #     functRelPercentTolDefault=> 0.000001,
 1152 #     functULimitDefault=>1,
 1153 #     functVarDefault=> 'x',
 1154 #     functZeroLevelDefault=> 0.000001,
 1155 #     functZeroLevelTolDefault=>0.000001,
 1156 #     htmlDirectory =>'not defined',
 1157 #     htmlURL =>'not defined',
 1158 #     inputs_ref => $self->{inputs_ref},
 1159 #     macroDirectory=>'not defined',
 1160 #     numAbsTolDefault=>0.0000001,
 1161 #     numFormatDefault=>'%0.13g',
 1162 #     numOfAttempts=> 0,
 1163 #     numRelPercentTolDefault => 0.0001,
 1164 #     numZeroLevelDefault =>0.000001,
 1165 #     numZeroLevelTolDefault =>0.000001,
 1166 #     openDate=> '3014438528',
 1167 #     permissionLevel =>10,
 1168 #     PRINT_FILE_NAMES_FOR => [ 'gage'],
 1169 #     probFileName => 'set0/prob1a.pg',
 1170 #     problemSeed  => 1234,
 1171 #     problemValue =>1,
 1172 #     probNum => 13,
 1173 #     psvn => 54321,
 1174 #     psvn=> 54321,
 1175 #     questionNumber => 1,
 1176 #     scriptDirectory => 'Not defined',
 1177 #     sectionName => 'Gage',
 1178 #     sectionNumber => 1,
 1179 #     sessionKey=> 'Not defined',
 1180 #     setNumber =>'not defined',
 1181 #     studentLogin =>'gage',
 1182 #     studentName => 'Mike Gage',
 1183 #     tempDirectory => 'not defined',
 1184 #     templateDirectory=>'not defined',
 1185 #     tempURL=>'not defined',
 1186 #     webworkDocsURL => 'not defined',
 1187 #
 1188 #     showHints => 1,               # extra options -- usually passed from the input form
 1189 #     showSolutions => 1,
 1190 #
 1191 #   };
 1192 #   $envir;
 1193 # };
 1194 #
 1195 # sub formatAnswerRow {
 1196 #   my $self = shift;
 1197 #   my $rh_answer = shift;
 1198 #   my $problemNumber = shift;
 1199 #   my $answerString  = $rh_answer->{original_student_ans}||'&nbsp;';
 1200 #   my $correctAnswer = $rh_answer->{correct_ans}||'';
 1201 #   my $ans_message   = $rh_answer->{ans_message}||'';
 1202 #   my $score         = ($rh_answer->{score}) ? 'Correct' : 'Incorrect';
 1203 #   my $row = qq{
 1204 #     <tr>
 1205 #         <td>
 1206 #         Prob: $problemNumber
 1207 #       </td>
 1208 #       <td>
 1209 #         $answerString
 1210 #       </td>
 1211 #       <td>
 1212 #           $score
 1213 #       </td>
 1214 #       <td>
 1215 #         Correct answer is $correctAnswer
 1216 #       </td>
 1217 #       <td>
 1218 #         <i>$ans_message</i>
 1219 #       </td>
 1220 #     </tr>\n
 1221 #   };
 1222 #   $row;
 1223 # }
 1224 #
 1225 # sub formatRenderedProblem {
 1226 #   my $self        = shift;
 1227 #   my $rh_result         = $self->{output};  # wrap problem in formats
 1228 #   my $problemText       = decode_base64($rh_result->{text});
 1229 #   my $rh_answers        = $rh_result->{answers};
 1230 #   my $encodedSource     = $self->{encodedSource}||'foobar';
 1231 #   my $warnings          = '';
 1232 #   if ( defined ($rh_result->{WARNINGS}) and $rh_result->{WARNINGS} ){
 1233 #     $warnings = "<div style=\"background-color:pink\">
 1234 #                  <p >WARNINGS</p><p>".decode_base64($rh_result->{WARNINGS})."</p></div>";
 1235 #   }
 1236 #   #warn "keys: ", join(" | ", sort keys %{$rh_result });
 1237 #   my $debug_messages = $rh_result->{flags}->{DEBUG_messages} ||     [];
 1238 #     $debug_messages = join("<br/>\n", @{  $debug_messages }    );
 1239 #     my $internal_debug_messages = $rh_result->{internal_debug_messages} || [];
 1240 #     $internal_debug_messages = join("<br/>\n", @{ $internal_debug_messages  } );
 1241 #   # collect answers
 1242 #   my $answerTemplate    = q{<hr>ANSWERS <table border="3" align="center">};
 1243 #   my $problemNumber     = 1;
 1244 #     foreach my $key (sort  keys %{$rh_answers}) {
 1245 #       $answerTemplate  .= $self->formatAnswerRow($rh_answers->{$key}, $problemNumber++);
 1246 #     }
 1247 #   $answerTemplate      .= q{</table> <hr>};
 1248 #
 1249 #   my $FULL_URL = $self->url;
 1250 #   my $FORM_ACTION_URL  =  "$FULL_URL/webwork2/html2xml";
 1251 #   my $problemTemplate = <<ENDPROBLEMTEMPLATE;
 1252 # <html>
 1253 # <head>
 1254 # <base href="$FULL_URL">
 1255 # <title>WeBWorK Editor using host $HOSTNAME</title>
 1256 # </head>
 1257 # <body>
 1258 #         $answerTemplate
 1259 #         <form action="$FORM_ACTION_URL" method="post">
 1260 #       $problemText
 1261 #          <input type="hidden" name="answersSubmitted" value="1">
 1262 #          <input type="hidden" name="problemAddress" value="probSource">
 1263 #          <input type="hidden" name="problemSource" value="$encodedSource">
 1264 #          <input type="hidden" name="problemSeed" value="1234">
 1265 #          <input type="hidden" name="pathToProblemFile" value="foobar">
 1266 #          <p><input type="submit" name="submit" value="submit answers"></p>
 1267 #        </form>
 1268 # <HR>
 1269 # <h3> Warning section </h3>
 1270 # $warnings
 1271 # <h3>
 1272 # Debug message section
 1273 # </h3>
 1274 # $debug_messages
 1275 # <h3>
 1276 # internal errors
 1277 # </h3>
 1278 # $internal_debug_messages
 1279 #
 1280 # </body>
 1281 # </html>
 1282 #
 1283 # ENDPROBLEMTEMPLATE
 1284 #
 1285 #
 1286 #
 1287 #   $problemTemplate;
 1288 # }
 1289 #
 1290 
 1291 1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9