GRB - Error if you use an image from another course in a test
I've two course
"My borderiou course" with an image in its document tool which URL is
or (http://stable.chamilo.org/courses/MYBORDERIOUCOURSE/document/avatar.jpg whatever)
"My borderiou course 2" with a test
I add the image from course 1, in my test in the "My borderiou course 2" course.
When I do the test, I teleport myself to the course "My borderiou course" !
I leaved the test and the course, panic !
It is a usual manipulation, to use an image from another media (Chamilo course or not).
Should fix bug that changes the course id from course to another during an exercise see #5780
Updated by Yannick Warnier over 8 years ago
I don't understand why this bug reappeared (literally). It had been fixed months ago (for EPSU if I remember well). There should be a filter in the exercise (and course) copy to seek and destroy all links to the previous course. I suppose it's only fixed for the course copy, then?
Updated by Hubert Borderiou over 8 years ago
- Status changed from Needs testing to Needs more info
It works fine for doing the test (if you have several questions on your test, see below).
But you cannot reorder the question with the drag'n'drop feature, and you can't end the test if you have only this question in your test.
Updated by Yannick Warnier over 8 years ago
- Assignee set to Yoselyn Castillo
- % Done changed from 50 to 70
I'm not really comfortable at all with this change, although I recognize it was made the right way.For a number of reasons, in Chamilo, we base the reactions of the application on the url parameters as a priority over the session:
- it ensures you (as an admin) can easily be in two courses at the same time
- it ensures order, making sure the latest situation is always considered as the most important one
- it ensures that, even if the session is lost, getting back on your track will enable you to find where you were exactly (as opposed to storing it in the session, in which case you would return to the previous step and be lost on a page with no indication of what course you were in)
(I'm sure I can find other reasons but these are the first ones that come to mind)
This has the negative impact of loading the server more (because it requires us to check permissions at each page load), but it has the quality of increasing security (because of the same checks).The problem with this bug report is that a media from another Chamilo course, when used inside an exercise, is loaded after the main page containing it, so it works like this:
- Chamilo loads the exercise page in the "AAA" course and sets the session data based on the URL (including "_cid = AAA")
- Chamilo loads the image (coming from "BBB" inside the exercise) and resets the session data based on the URL of this image (including "_cid=BBB")
- When the user clicks the button (and this is what Julio fixed in his patch, which is right but maybe there will be other ways to get to another exercise step which escaped him this time), the URL was generated without the ID of the course, so it was using the last known ID, which was the ID of BBB
- make sure that, when loading media from another course (we would have to define "media"), the cidReq is not set in the session.
- use a central repository that doesn't really need a course ID to show the document or not, but that's kind of a very long shot...
So the conclusion for now is that this seems to work but that we need to watch that every link placed in the exercises tool has the cidReq (or at least the numerical course id).
In any case, the first bug reported was solved and verified. I'm assigning it to Yoselyn to do the verification about the drag & drop.
Updated by Yoselyn Castillo over 8 years ago
- File end-test.gif end-test.gif added
- File drag-drop-result.gif drag-drop-result.gif added
- Status changed from Needs testing to Assigned
- Assignee changed from Yoselyn Castillo to Julio Montoya
These are the results of my tests:
I have entered "My borderiou course 2"
I have tested one test with one image from other course( "Test avec une image d'un autre cours") It worked fine
I have tested one test with only one question with one image from other course( "Test question seule et image dans un autre cours")
I couldn't end the test(See the image)
Drag and Drop of questions works but it shows a SQL string:
"string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '1' WHERE question_id = '2' AND c_id = '46' AND exercice_id = '1' " string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '2' WHERE question_id = '4' AND c_id = '46' AND exercice_id = '1' " string(135) "UPDATE `stablechamilo`.`c_quiz_rel_question` SET question_order = '3' WHERE question_id = '1' AND c_id = '46' AND exercice_id = '1' " "
See the image