<div>I had considered that something like what you suggest might be possible.<br></div><div><br></div><div>The program flow should never go beyond the Restart button, so it should be simple enough to put a copy of the protoNode somewhere in the icon sequence after the Restart button.</div>
<div><br></div><div>Whilst I know how to remove nodes and duplicate an existing node - that is to the extent you can see in my quiz example, I have no idea how you would programmatically go about taking a copy of a node from one location and duplicating it to another location.</div>
<div><br></div><div>There are some things about Xerte I understand quite well. There are other things that work when I copy the code written by the Masters, perhaps they work because I have such faith in them :-)</div><div>
<br></div><div>Kind regards</div><div><br></div><div>Johnathan</div><br><div class="gmail_quote">On 9 June 2010 17:03, 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">Can you do it by having a protoNode somewhere the flow never
goes, and when you kick up the question get that node, append it to the
appropriate parent and then dupe 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">Then when you return, loop over childNodes, deleting each one
using removeNode(), then put back your protoNode and duplicate it. You might
need to make sure you are getting a copy of the protoNode and not a reference.</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">Does that sound like what you are trying to do?</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 15:32<br>
<b>To:</b> Xerte discussion list<br>
<b>Subject:</b> Re: [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">No that&#39;s not it.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">The quiz works by taking an icon
structure called protoQuestion and duplicating it to accomodate the number of
questions to be displayed.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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. </p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</p>

</div>

<div>

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

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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 {</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">  // code needed here that
will</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> // 1. remove all the pages
created by the duplication that occurred in the if section above;</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt"> // 2. duplicate the pages
affresh, such that the page still works each time it is restarted or revisited.</p>

</div>

<div>

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

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">If I can find out how to do this
it should be straight forward to modify this so that the code</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">a) removes all the pages
duplicated the last time the page was run</p>

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">b) duplicates the appropriate
number of new pages required to meet the end users latest selection</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">which are the requirements of my
new wizard.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</p>

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:36.0pt">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.</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 <br>
 </p>

</div>

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

<div>

<p class="MsoNormal" style="margin-left:36.0pt">On 9 June 2010 11:30, Julian
Tenney &lt;<a href="mailto:Julian.Tenney@nottingham.ac.uk" target="_blank">Julian.Tenney@nottingham.ac.uk</a>&gt;
wrote:</p>

<div>

<div>

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

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

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

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

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

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

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

<p class="MsoNormal" style="margin-left:36.0pt"><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" style="margin-left:36.0pt"><span style="font-size:11.0pt;color:#1F497D"> </span></p>

<p class="MsoNormal" style="margin-left:36.0pt"><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:72.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>

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

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

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

</div>

<div>

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

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

<p class="MsoNormal" style="margin-left:72.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:72.0pt"> </p>

</div>

<div>

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

</div>

<div>

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

</div>

<div>

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

</div>

<div>

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

</div>

<div>

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

</div>

</div>

</div>

</div>

</div>

<p class="MsoNormal" style="margin-right:0cm;margin-bottom:12.0pt;margin-left:36.0pt"><br>
_______________________________________________<br>
Xerte mailing list<br>
<a href="mailto:Xerte@lists.nottingham.ac.uk" target="_blank">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></p>

</div>

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

</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>