cslmath / Champlain-Saint-Lambert-webwork-repo

A library of WeBWorK problems contributed by the Champlain Saint-Lambert math department
3 stars 4 forks source link

draggableProof.pl not working #36

Closed gabindu closed 3 years ago

gabindu commented 3 years ago

I tried to use one of the "draggable" problems from the OPL - and the dragging simply doesn't work.

Example: https://webwork.champlainww.ca/webwork2/201-203-INDURSKIS/FinalExam-Review/5/

I actually remember having run into that problem in the past, and it seems to be a generic problem. Any chance of looking into this, so using draggableProof.pl runs out of the box on our server?

Here are some relevant links on the topic I've found:

https://github.com/openwebwork/webwork-open-problem-library/issues/622

https://webwork.maa.org/moodle/mod/forum/discuss.php?d=4335

https://www.mathstat.dal.ca/~selinger/downloads/draggable/

(I've tried following the instructions mentioned there, creating a html/js/ and templates/macros/ folder in my course directory, putting in jquery.nestable.js and draggableProof.pl, respectively - to no avail.)

maharper commented 3 years ago

EDIT: I didn't read to the end of your issue the first time. OOPS.

You have to put the js subdirectory in the already existing course html directory. From your templates (File Manager) directory, press the up arrow. This is your course directory. Double click the html directory that is already there and this is where you need to create the js subdirectory.

Also the macros subdirectory is an already existing subdirectory of your templates directory, but I think that you will not need to add draggableProof.pl there, the version we have on the server is up-to-date.


Original (too hasty) reply):

To make that particular problem work in your course seems straight-forward. My experimentation shows that what is needed is:

gabindu commented 3 years ago

Hm, I've done exactly that, but it doesn't seem to work for me. Where exactly is the course html directory? I've tried putting js directly in the main directory of my course, and also creating a subdirectory html (which didn't exist) and putting js (and jquery.nestable.js in there), but neither works.

gabindu commented 3 years ago

ah, never mind, I just realized that I was always looking in the default, template folder for my course and never went a level up. Working now, thanks.

As for the future (when I forget in about 5 minutes time what I had to do - ahem), I understand that there's no nicer solution and it depends on an upstream fix, but couldn't we simply prophylactically create that js subdirectory with that file for all newly created courses? (Are there any custom scripts which can automatically be run when a course is created, so this could be done automatically maybe?)

maharper commented 3 years ago

Yes, I was thinking about this some. There is no easy way that I know of to pre-populate an html/js, but I will poke around a bit and see what I can find out. When we create a course, the templates directory from the model course gets copied across, but I don't think anything 'higher up' gets copied over. I'll try to dig up where those other directories (html, logs, scoring, ...) are determined.

maharper commented 3 years ago

I was wrong, we can do it. Adding a js subdirectory to the html directory in every model course and uploading a copy of jquery.nestable.js there will resolve the issue for every course created going forward (provided it is created based on one of our standard model courses).

for dest in model*/html; do sudo -u www-data -g wwdata mkdir -p "$dest"/js; sudo -u www-data -g wwdata cp jquery.nestable.js "$dest"/js; done did the trick

Stretch:

Everything in /templates/ and everything in /html/ is copied from the model course to the newly created course. Nothing else is.

Although some of the wiki documentation indicates that only the templates directory of the model course is used to pre-seed the new course, the code in WeBWorK::Utils::CourseManagement addCourse copies across the full contents of the templates directory and the html directory.