After a few more hours of work, I was able to get both 1 and 2 described
above working, however in a marginal fashion. I'll describe what I've done
to overcome these challenges, but I'm still looking for input as I believe
both of these problems have more elegant solutions than what I came up with.
1. I scraped the asset handler from the studio page that launches the
XBlock edit dialog. I was able to extract the Org, Course, and Run
parameters, and then construct a string out of them that gave me the asset
resource handler. This method works, but is pretty sloppy. It also relies
on the developers not changing the template of the page in cms, because I'm
scraping a particular html tag by its id. Any thoughts on a better way to
do this?
2. As mentioned above, I saw that the AJAX payload that returned with an
error did include the expected strings from my configuration file. I used
the .error method of the get call to read the returned jqXHR and parse my
expected result.
request.success(function(data) {
// This doesn't work - we have to get the AJAX reply in a failure
message (unexpected format by cms)
});
request.error(function(jqXHR, textStatus, errorThrown) {
var data = jqXHR.responseText;
Counting an error as a success isn't the right way to go about this, but as
stated above, it appears that raw AJAX isn't allowed for some reason in an
XBlock. The other annoying side effect of doing business this way is that
I get the annoying "Studio's having trouble saving your work" banner that
pops-up in studio when I'm using my XBlock edit dialog. How can I do this
better?
Thanks!
Froont
--
You received this message because you are subscribed to the Google Groups
"General Open edX discussion" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/edx-code/bb3cf6e6-c018-49f8-96a5-e8af910c6ab2%40googlegroups.com.