[Xerte] Having problems duplicating nodes
Paul Swanson
Paul.Swanson at harlandfs.com
Tue Dec 9 23:33:18 GMT 2008
Making progress ... but not using your suggestion. I came up with a
different way.
I started to think that my lesson1quiz array was not being appended to,
but overwritten, when using the following code:
lesson1Counter = 0; // counter for number of questions
// loop through all questions to get lesson 1
for (i = 0; i < quizData.question.length; i++) {
if (quizData.question[i].lesson == '1') {
lesson1quiz[lesson1Counter].question = quizData.question[i];
lesson1Counter++;
} // end of quizData.question[i] conditional
}
but by changing it to:
lesson1Counter = 0; // counter for number of questions
// loop through all questions to get lesson 1
for (i = 0; i < quizData.question.length; i++) {
if (quizData.question[i].lesson == '1') {
lesson1quiz.push(quizData.question[i]);
lesson1Counter++;
} // end of quizData.question[i] conditional
}
and then changing the references that display the questions to
{lesson1quiz[questIndex].prompt}, I am getting the questions and answers
to display within the individual lesson. My only problem now is that if
the user tries to navigate back within the question framework, the page
appears blank. questIndex is set by this statement:
questIndex = icon.parentNode.index() - 1;
The page that the questIndex code is on is the first page of my
lesson1quiz framework, with an Entry Pane preceeding it. Any thoughts on
that?
Again, thanks for all the help. And a special thanks to Dave B, who
offered to take a look at my file and offer suggestions (even though I
didn't take him up on it).
Paul
________________________________
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: Tuesday, December 09, 2008 1:39 AM
To: Xerte discussion list
Subject: RE: [Xerte] Having problems duplicating nodes
I'd use decision icons, set to randomUnused to present the
questions - then there's no need to randomise your arrays. Pick out each
question using icon.parentNode.index() or similar, with a page on the
deision for each question - but you'll make those with duplicate(). You
will still need to build some arrays for sec1Questions, sec2Questions
though. I might be tempted to make those arrays of xmlNodes rather than
the bits of templateData. You can get the pre-XML2Object xml from your
file with the variable extXML. I'd loop over that, picking out your
nodes and adding them to your arrays, then use those arrays to drive
your code.
HTH?
J
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: Monday, December 08, 2008 10:52 PM
To: Xerte discussion list
Subject: RE: [Xerte] Having problems duplicating nodes
how fussy are you about the .xml format?
could you work with:
<questions>
<question section="1">
<!--data for question here -->
</question>
<!--etc-->
</questions>
and generally, what does the .rlo need to do? Present a
framework of content for each section, and then show the quiz (on the
last page?). Do the page types vary?
and then a final section framework summarises and then shows all
questions, randomised?
________________________________
From: xerte-bounces at lists.nottingham.ac.uk on behalf of Paul
Swanson
Sent: Mon 08/12/2008 19:15
To: Xerte discussion list
Subject: RE: [Xerte] Having problems duplicating nodes
Commenting out the two randomQuizData lines doesn't change
anything. I've moved the statement that randomizes the questions to the
button that launches the final test, rather than have it in the setup
script.
Maybe I'm just going about this entirely the wrong way. What I
want to accomplish is to have all my test questions within one setup.xml
file. I have six lessons, and some of the questions will also be
presented at the end of each lesson. So I need to parse which questions
are for lesson 1, which are for lesson 2, etc. Once the student has
completed all of the lessons, they must take a test to pass the course.
This test will be comprised of all of the questions for all of the
lessons, with the questions randomized. Am I on the right track with
what I've been trying to do, or do I need to take a different approach?
Paul
________________________________
From: xerte-bounces at lists.nottingham.ac.uk
[mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: Thursday, December 04, 2008 11:32 PM
To: Xerte discussion list
Subject: RE: [Xerte] Having problems duplicating nodes
You are creating references to the same array.
quizData = templateData.quiz[0]; // non-randomized
questions
randomQuizData = templateData.quiz[0]; // for randomized
questions
randomQuizData.question.randomize(); // randomize the
list of questions.
quizData.question is also randomised.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.nottingham.ac.uk/pipermail/xerte/attachments/20081209/f3c821ae/attachment.html
More information about the Xerte
mailing list