Codejail blocking <script>

Hello everyone

I am adding advanced blank problem to my course.

I have an HTML that does everything within <label></label> now I want to add a script that shall be able to hide problem-responce-wrapper using

<script>
document.getElimentById("problem-responce-wrapper).style.display = "none"
</script>

But codejail doesn’t recognise this <script></script> as safe execution.

I am assuming that functional codejail is present in my instance. I need to pass this particular <script> as executable command how can I achieve this?

I took a look at readme.md from codejail repo but did not understand much. Step by step adding this command to safe execution is what I am looking for. I will be using this method quite often in my course and hence it is essential.

Once I achieve the goals I plan to write up the post how we can use H5p activites without any server and serve it locally and also obtain grades with it.

Thanks😀

Hi Melsu. Welcome to the Open EdX forums.

Can you share more about what you are trying to do, and what resulted? I’m a little confused because you start out saying that you’re adding HTML to a course, but you’re getting a codejail error. Normally, you would only get a codejail error if you were adding Python code to your course.

1 Like

Hi @Melsu. For the H5p activities, as you may know that it gets integrated with openedx via LTI component. If you want to avoid LTI integration and use similar activities locally on openedx, this might need engineering effort to design a Xblock which functions similar to one of the H5p activity.

If XBlock customisation is not an option for you, I suggest to use LTI integration as it is one time effort in a course and provides a gateway to use any kind of H5p activity anywhere in the course and the grading also works fine on openedx.

Hi @Melsu an you please share some screen capture or the written code which is creating problem for you?

Hi well lti is okay but can we grade the activity? No right.

So I have considered a solution for myself. Which is create activity on h5p.org

Download .H5p file rename it to .zip extract it on to tunapandah5p plugin

Finally create html with just mentioning name of the folder. The rest of the work is done by js inside the plug in (I have rearranged the files and code to keep the files minimum)

Now you are ready with the html page that does exactly what H5p activity does from h5p.com

Now I want to also make use of grading and I thought of using existing resources as I don’t have much knowledge of building xblock.

The existing resource I would like to use is xblock that can grade in % instead of full credit or half credit. I have changed calculation to obtain exact score. The problem is when I put the whole html inside it works like charm but I can’t get rid of (or hide it) the problem-response-wrapper which is where we enter answers and submit button.

So I want to map submit button from html with actual submit button and what to submit grade as answer if answer is 5 allocate grade 5 etc.

If it works we can make this tweeks to button and answer variables and the out of box solution for H5p is ready but I don’t know how exactly to deal with these things on xblock so I was thinking rather use js within the xblock code but that also doesn’t work because of code Jail / lonecapa issues

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.