[Xerte-dev] Re: How to wait while Xerte populates rootIcon.pages

Julian Tenney Julian.Tenney at nottingham.ac.uk
Thu Apr 19 09:56:20 BST 2012


Yes, that's probably the best thing to do: extXML will be available immediately and has all the info you need,

From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 10 April 2012 18:26
To: xerte-dev at lists.nottingham.ac.uk
Subject: [Xerte-dev] Re: How to wait while Xerte populates rootIcon.pages

Maybe the banana peel is here:
.extXML
The page is inited, but the external xml has not been parsed?
I take it these are all pages that are models/templates, not built within desktop itself.


________________________________
From: Julian.Tenney at nottingham.ac.uk
To: xerte-dev at lists.nottingham.ac.uk
Date: Tue, 10 Apr 2012 17:15:15 +0100
Subject: [Xerte-dev] Re: How to wait while Xerte populates rootIcon.pages
wait till next week and I'll investgate further. Or look in the engine source to see when that onInit is being fired

________________________________
From: xerte-dev-bounces at lists.nottingham.ac.uk [xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Kemp Johnathan [johnathan.kemp at ntlworld.com]
Sent: 10 April 2012 14:30
To: For Xerte technical developers
Subject: [Xerte-dev] Re: How to wait while Xerte populates rootIcon.pages
If I have an interaction as a child of the entry frame and add a time limit with a wait of 1 second and hang a script of the time limit icon with the contents
debug("last page id is " + rootIcon.pages[2].extXML.firstChild.childNodes[0].attributes.name<http://attributes.name>);
debug("first page id is " + rootIcon.pages[0].extXML.firstChild.childNodes[0].attributes.pageID);
debug("second page id is " + rootIcon.pages[1].extXML.firstChild.childNodes[0].attributes.pageID);

I see values reported back for each debug line.

If I have an interation as a child of the entry frame and add an event icon with eventName = onInit and icon = rootIcon and then attach the same script as above to it each of the three entries returns undefined e.g.

last page id is undefined.

This suggests that the onInit event fires before the population of the pages array has completed?

Kind regards

Johnathan




On 10 April 2012 13:01, Julian Tenney <Julian.Tenney at nottingham.ac.uk<mailto:Julian.Tenney at nottingham.ac.uk>> wrote:
Listen for rooticon.onInit, it fires once the initial parse is complete
________________________________________
From: xerte-dev-bounces at lists.nottingham.ac.uk<mailto:xerte-dev-bounces at lists.nottingham.ac.uk> [xerte-dev-bounces at lists.nottingham.ac.uk<mailto:xerte-dev-bounces at lists.nottingham.ac.uk>] On Behalf Of Kemp Johnathan [johnathan.kemp at ntlworld.com<mailto:johnathan.kemp at ntlworld.com>]
Sent: 10 April 2012 11:17
To: For Xerte technical developers
Subject: [Xerte-dev] Re: How to wait while Xerte populates rootIcon.pages

Thanks for that Dave.

A wait makes for a slightly untidy start since the title page loads but has undefined displayed until the timer has finished, but it does give time for the array to build.

I guess the optimal solution would be for Xerte to broadcast an event when the array has been built, then it might be possible to limit the delay to the minimum.

Kind regards

Johnathan
On 9 April 2012 23:18, Dave Burnett <d_b_burnett at hotmail.com<mailto:d_b_burnett at hotmail.com><mailto:d_b_burnett at hotmail.com<mailto:d_b_burnett at hotmail.com>>> wrote:
What does a wait interaction in the entryframe do?

________________________________
Date: Mon, 9 Apr 2012 23:06:32 +0100
From: johnathan.kemp at ntlworld.com<mailto:johnathan.kemp at ntlworld.com><mailto:johnathan.kemp at ntlworld.com<mailto:johnathan.kemp at ntlworld.com>>
To: Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk><mailto:Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>>
Subject: [Xerte-dev] How to wait while Xerte populates rootIcon.pages


Hello everyone - a little puzzle for Easter,

I don't know if anyone can throw any light on this little problem I have hit.

Xerte desktop creates an array rootIcon.pages

By the time a learning object setup script runs rootIcon.pages has not been defined as it has undefined length.
By the time a script off an Entry Frame runs it has length 0, so it has been created but not populated.
By the time a script in a page runs its length is the number of pages in the project.

For each entry in the array Xerte will place the details of a page including the extXML data so you can get at the values set in an xwd form for any page in your project. However at the time the first page has loaded only the details of the xml for the first page have loaded. By the time the next page of a project is loaded the array is fully populated.

This effectively means that my Connector pages which use this array for desktop projects (but not for XOt projects) cannot work as the first page of a project, because they cannot look up the pages they are set up to connect to.

However it appears that the loading of the style sheet in my entryFrame's setup script effectively causes the first page to load twice. This is invisible to the end user but any debug statements will be repeated, showing the page loaded twice.

This has the benefit that in Xerte preview mode, or if the published project is viewed in Internet Explorer or Firefox a connector page can operate as the first page of a project, because by the time the page has reloaded the rootIcon.pages array is fully populated.

The twist is I have been trying to use this to make it possible to open a Xerte project at a specific page by adding

?pageID=myTargetPage

to the url of an external link to the project. I achieve this by adding some Connector page like code to the title page. A project then uses this form of Title page as the first page of the project.  When the project opens in the browser it opens at the first page and the pageID value if one is passed in the Url gets captured. The Title page then uses the same method as a standard connector page to go to the page specified by the pageID.

I have this working in Firefox and Internet Explorer. However in Opera the url parameter captures perfectly but for some reason the rootIcon.pages array is still not populated with the extXML data for any of the other pages, so the redirect fails. If I use the Xerte navigation to move to page 2 and then go back to the title page it will redirect to the page specified in the url, so the principle works in Opera.

So is there a way I can force the rootIcon.pages array to fully populate before I move on to compare the url pageID. I tried a while loop but just looping until the array has time to populate does not work. I guess because the array stops populating whilst the loop is running. I am sure this would be a feature many people would find useful, so any ideas as to how I get the page to wait until the array is populated would be much appreciated.

Kind regards

Johnathan



This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
_______________________________________________ Xerte-dev mailing list Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk><mailto:Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.

_______________________________________________
Xerte-dev mailing list
Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk><mailto:Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>>
http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it.   Please do not use, copy or disclose the information contained in this message or in any attachment.  Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.




_______________________________________________
Xerte-dev mailing list
Xerte-dev at lists.nottingham.ac.uk<mailto:Xerte-dev at lists.nottingham.ac.uk>
http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev


_______________________________________________ Xerte-dev mailing list Xerte-dev at lists.nottingham.ac.uk http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nottingham.ac.uk/pipermail/xerte-dev/attachments/20120419/bbc23f12/attachment-0001.html>


More information about the Xerte-dev mailing list