Difference between revisions of "Client Editor"

From WeBWorK_wiki
Jump to navigation Jump to search
Line 18: Line 18:
 
* A valid command line string must be entered for the DISPLAY_COMMAND.
 
* A valid command line string must be entered for the DISPLAY_COMMAND.
 
* Choose a server site to render the questions for display.
 
* Choose a server site to render the questions for display.
  +
** You can add additional server sites in the script file <code>renderProblem.pl</code>
   
   

Revision as of 09:53, 4 November 2010

External Client Editor

It is often convenient to use an external editor to write new WeBWorK questions rather than to compose them using the web browser interface. To do this your local editor calls the script renderProblem.pl which sends the current contents of the editor off to a WeBWorK server for processing and then displays the resulting rendered problem in a browser. The question is "live" so you can enter responses and see whether they are graded correctly. The text file for the new question remains on your desktop or laptop.


How to use it

UnderConstruction

  • Create a short screencast showing the external client in action.

Configuring renderProblem.pl

The configuration section for the client is at the top of the renderProblem.pl file.

  • A valid local path must be entered for the TEMPOUTPUTFILE.
  • A valid command line string must be entered for the DISPLAY_COMMAND.
  • Choose a server site to render the questions for display.
    • You can add additional server sites in the script file renderProblem.pl


 # Sample path to a temporary file for storing the output of renderProblem.pl on a Mac.
 use constant  TEMPOUTPUTFILE   => '/Users/gage/Desktop/renderProblemOutput.html'; 

 # Sample command lines for displaying the temporary file in a browser on a Mac.
 use constant  DISPLAY_COMMAND  => 'open -a firefox ';   #browser opens tempoutputfile above
 # use constant  DISPLAY_COMMAND  => "open -a 'Google Chrome' ";


 my $use_site;
 $use_site = 'test_webwork';    # select rendering site  test.webwork.maa.org
 #$use_site = 'local';           # select rendering site localhost
 #$use_site = 'rochester_test';  # select rendering site 128.151.231.2 (at Rochester)

Configuring the client editor

  • BBEdit on the Mac

For BBEdit (on the Mac) the renderProblem.pl must be copied from webwork2/clients/renderProblem.pl to ~/Library/Application Support/BBEdit/Unix Support/Unix Filters/renderProblem.pl on the Mac. I also assign this filter a key command ^R so that a problem can be rendered with a single stroke.

  • Unix editors

Most modern browsers have facilities for passing their contents through a command line filter.


  • Command line

From the command line

 renderProblem.pl <TextInputFileName 
  • grabs the contents of the file TextInputFileName
  • ships it to the WeBWorK server site for rendering,
  • stores the result in the TEMPOUTPUTFILE and then
  • executes the DISPLAY_COMMAND to display the TEMPOUTPUTFILE.

Configuring the server

Every WeBWorK site is automatically configured to be a server for external client editors. The site will return an error message unless the course "daemon_course" has been created. The default name of the course can be changed in the renderViaXMLRPC.pm file (see below).

IMPORTANT: The line defining the server url must be completed. It should appear near the top of global.conf and should be copied from global.conf.dist if it does not.

$apache_server_url   = "";  #  http://your.server.edu

Other changes, such as modifications to the password and to the name of the "daemon_course" associated with the external client editor are made in webwork2/lib/WeBWorK/ContentGenerator/renderViaXMLRPC.pm. (These configuration lines may be moved to global.conf at a later date.)

When working correctly a reboot of the apache server should print to the command line several messages specifying the location of the top directory (e.g. /opt/webwork/webwork2 ) of the WeBWorK source code.

webwork.apache2-config:  WeBWorK root directory set to /opt/webwork/webwork2
WebworkWebservice: webwork_directory set to /opt/webwork/webwork2