openlab-at-city-tech / webworkqa

WeBWorK integration for WordPress and BuddyPress
GNU General Public License v2.0
4 stars 2 forks source link

Documentation for WW configuration #140

Open boonebgorges opened 6 years ago

boonebgorges commented 6 years ago

Before another campus can use, we'll need documentation on how to set up WeBWorK so that it can work with WP. This means:

drdrew42 commented 5 years ago

Configuration of the Ask for Help button is very straightforward - I can write up a short paragraph that explains where these configurations can be set: globally, configure once for all sections (in webwork2/conf/defaults.config); or locally, using each course's own config file (courses/<courseName>/course.conf).

For example, I use the following script to add the WW-OpenLab integration to individual courses:

#!/bin/bash 
# usage: OLWW <courseID - with wildcard support>
# for example OLWW * would configure all courses

i=1
for d in /opt/webwork/courses/$1/; do
    OUT=`cat ${d}course.conf | grep "Ask For Help"`
    if [ "$OUT" = "" ]; then
        echo '$courseURLs{feedbackFormURL} = "https://openlab.<yourschool>.edu/ol-webwork/?webwork=1";' | sudo tee -a ${d}course.conf > /dev/null
        echo '$feedback_button_name = "Ask For Help";' | sudo tee -a ${d}course.conf > /dev/null
        echo "$i : Added ol-ww link to $d"
    else
        echo "$i : $d already has ol-ww link"
    fi
# drop the code below once POST data is used instead of parsing the problem-id 
# from the body of our problem
    PLOUT=`cat ${d}course.conf | grep "PRINT_FILE_NAMES_PERMISSION_LEVEL"`
    if [ "$PLOUT" = "" ]; then
        echo '$pg{specialPGEnvironmentVars}{PRINT_FILE_NAMES_PERMISSION_LEVEL} = 0;' | sudo tee -a ${d}course.conf > /dev/null
        echo "$i : Added permissionLevel to $d"
    else
        echo "$i : $d already has permissions set"
    fi
    ((i++))
done

There are no restrictions on WW-version, as the back-end for this feature has existed in the WeBWorK codebase for over 10 years.

drdrew42 commented 4 years ago

When documenting integration with WW, it should also be noted that individual instructors can also manage their own transition from "email my instructor" to "ask for help" by adding the following two lines to their course.conf file, located at the highest level of their course directory structure (found via File Manager):

$courseURLs{feedbackFormURL} = "https://<your-wordpress-site>/ol-webwork/?webwork=1";
$feedback_button_name = "Ask For Help";

@boonebgorges is this URL reliable? i.e. will 'ol-webwork' necessarily be the path if someone installs this extension on their OpenLab site? Or will the documentation need to be more flexible here with regards to where we point WeBWorK to POST question data?

boonebgorges commented 4 years ago

@drdrew42 No, ol-webwork is not part of the URL. The correct format is {your-wordpress-url}/?webwork=1. On the OpenLab, ol-webwork is the URL of our specific WordPress site in the Multisite network that runs the WW plugin.