<div>No that&#39;s not it.<br></div><div><br></div><div>The page I am trying to create will allow the end user (not the designer who sets up the wizard) to select options that will decide which questions are offered to them. This means that each time they reach the &quot;quiz&quot; end and click restart it will be necessary to as far as is possible get back to the situation that applied before the page was first run.</div>
<div><br></div><div>The quiz works by taking an icon structure called protoQuestion and duplicating it to accomodate the number of questions to be displayed.</div><div><br></div><div>For my page to work, if built == true, I need to remove all nodes that were duplications of protoQuestion and then re-duplicate the nodes the number of times appropriate for the current selections the user has made.</div>
<div><br></div><div>You will get a feel for what I am trying to achieve if you open the project example I attached to my last email and use the TOC to go to the randomSequence page. The part of the quiz code that builds the pages is not run in the getPageID script. The user selections are processed first to create an array with one element for each &quot;question&quot; &quot;option&quot;. The create questions script then runs to duplicate protoQuestion as many times as is necessary based on the length of the array. The page works once but fails on the restart - at present I have removed code that represents early attempts to remove and re-duplicate the icons.</div>
<div><br></div><div>I have included the quiz page as a simpler example that is closer to the original script for the quiz page. The only difference being that I have separated out the part of the getPageId script that makes the pages and moved it to the end of the icon sequence to just before the Decision icon. The quiz page still works. </div>
<div><br></div><div>The challenge is to take the code in the &quot;make questions&quot; script of the quiz page and add an else section to it.</div><div>e.g.</div><div><br></div><div>if (icon.attributes.built != &#39;true&#39;){<br>
  icon.parentNode.getChildByName(&quot;questions&quot;).firstChild.duplicate(pageIcon.templateData.learningObject[0].quiz[0].question.length - 1);<br><br>  icon.attributes.built = &#39;true&#39;;<br><br>}<br>else {<br></div>
<div>  // code needed here that will</div><div> // 1. remove all the pages created by the duplication that occurred in the if section above;</div><div> // 2. duplicate the pages affresh, such that the page still works each time it is restarted or revisited.</div>
<div>}</div><div><br></div><div>If I can find out how to do this it should be straight forward to modify this so that the code</div><div>a) removes all the pages duplicated the last time the page was run</div><div>b) duplicates the appropriate number of new pages required to meet the end users latest selection</div>
<div><br></div><div>which are the requirements of my new wizard.</div><div><br></div><div>The quiz page at present can remove nodes and re-create them, but comparison of the xml of the pages that existed after the initial, build by using debug, with the new pages created, shows them not to be the same and the page fails to run correctly in the second running. .i.e. when it is restarted or revisited.</div>
<div><br></div><div>Is what I am trying to achieve possible? I cannot recall a Xerte page that actually allows the end user to take actions that effectively allow the end user to configure in some way the pages structure.</div>
<div><br></div><div>Kind regards</div><div><br></div><div>Johnathan <br> </div><br><div class="gmail_quote">On 9 June 2010 11:30, Julian Tenney <span dir="ltr">&lt;<a href="mailto:Julian.Tenney@nottingham.ac.uk">Julian.Tenney@nottingham.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">








<div lang="EN-GB" link="blue" vlink="purple">

<div>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">When you’re manipulating xml, I always do:</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">If (icon.built != true){</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">  //manipulate the xml</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">  icon.built = true;</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">}</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Then it will only happen once, and bult = true is set on the
underlying XML node itself. Is that it?</span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">

<p class="MsoNormal" style="margin-left:36.0pt"><b><span lang="EN-US" style="font-size:10.0pt">From:</span></b><span lang="EN-US" style="font-size:10.0pt">
<a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a>
[mailto:<a href="mailto:xerte-bounces@lists.nottingham.ac.uk" target="_blank">xerte-bounces@lists.nottingham.ac.uk</a>] <b>On Behalf Of </b>Kemp
Johnathan<br>
<b>Sent:</b> 09 June 2010 10:08<br>
<b>To:</b> Xerte discussion list<br>
<b>Subject:</b> [Xerte] xerte 2.n - Help needed to remove and then
re-duplicateicons</span></p>

</div><div><div class="h5">

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">I am working on a new page wizard
that is based on the quiz page.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">As part of its functioning it
presents the user with an option screen.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">The selections the user makes
will decide how many &quot;questions&quot; are presented to the user.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">The problem is that whilst I can
get the page to run once, if the user then clicks on the restart button, or
returns to the page at a later time, the page will not run correctly a second
time as I am not able to successfully remove and re-duplicate the
&quot;proQuestion&quot; that is the master for all the questions that are
created at run time.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">Can anyone see what I am doing
wrong, or suggest the correct way to achieve this?</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">I have attached a sample project
which includes both a quiz page that attempts to remove and re-duplicate the
questions each time the page is returned to or the Restart button is clicked.
If I can get this to work I should be able to get the same process to work in
my new page.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">The sample project also includes
an example of my new page so that you can see what I am trying to achieve.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">The idea of the new page is to
support music practice where for example the end result may be to play a number
of different scales with both hands with variety of expression and style.
Initially practice may be to learn the scales playing only the left or right
hand, and then later add playing hands together, then later add variations of
style and expression. Selection of an easy level only offers for practice
single handed scales. Harder levels then introduce double handed play,
variation in style and expression.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">In both example pages it is the
&quot;make pages&quot; script icon that needs attention. The quiz page gives
you some idea of what I have tried so far.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">Any help would be most
appreciated.</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">Kind regards</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">Johnathan</p>

</div>

</div></div></div>

</div>


<br>_______________________________________________<br>
Xerte mailing list<br>
<a href="mailto:Xerte@lists.nottingham.ac.uk">Xerte@lists.nottingham.ac.uk</a><br>
<a href="http://lists.nottingham.ac.uk/mailman/listinfo/xerte" target="_blank">http://lists.nottingham.ac.uk/mailman/listinfo/xerte</a><br>
<br></blockquote></div><br>