Hello All,
I'm building a custom XBlock and I've run into a roadBlock (of sorts). I have two issues that I've been troubleshooting and was wondering if someone else has overcome these. In searching the XBlock depositories online, I can't find any other XBlocks that have this functionality.
Here's what I'm trying to do: My XBlock has configuration parameters that apply to an entire course, but would be different for other courses on the same Open edX server. In order to make the XBlock easier for course developers to work with, I want to create a config file for the XBlock that is unique to each course. My preferred method to do this is via Studio (I don't want course developers messing with the shell or trying to edit python variables). I upload my config file to the course content files & uploads so it becomes a static resource of the course. Yes, I know this makes it accessible to users, but the config file doesn't contain anything sensitive. Here are the problems I'm encountering:
1. I've been unable to find a javascript function that provides the URL handler of static course content. This URL handler changes the /static/config.txt into the /asset-v1:Org+Course_Run+type@asset+bl...@config.txt format. Does anyone know of a javascript runtime URL handler that does this? Is there another way to get the resource handle of static course content from within the XBlock javascript files?
2. For testing, I hard coded the URL handler into a jQuery.get statement in the XBlock static/js/edit.js file. The jQuery.get is supposed to retrieve the contents of my config file for parsing by further javascript. I'm getting the console error "Studio AJAX Error" which traces back to a "base.js" that I can't locate - there are many base.js files in the cms construct. Are custom AJAX gets not allowed in XBlocks? Is there a way around this? I can see that the AJAX request comes back with the payload from my config file with an HTTP 200, but it also contains the error message.
FYI - my development XBlock is running on Ficus 3.2.
Any insight anyone is willing to provide on either of these issues would be much appreciated. Thank you in advance for your help!
Froont