[Xerte-dev] Re: navigating to page name

Dave Burnett d_b_burnett at hotmail.com
Tue Feb 14 14:01:09 GMT 2012



I think we just ran across that tidbit a couple weeks ago in another context.Or the page *was* being destroyed and replaced. I was losing info somehow.Let me see if I can find the thread..
From: Julian.Tenney at nottingham.ac.uk
To: xerte-dev at lists.nottingham.ac.uk
Date: Tue, 14 Feb 2012 13:38:30 +0000
Subject: [Xerte-dev] Re: navigating to page name



Yes, that’s right, I’ve just checked in the engine: the page icon is the icon you create here, with the path to the model on it. The engine loads up the model, and pastes it’s children into the page icon created in makePages. It does not replace the icon itself. From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: 14 February 2012 13:32
To: For Xerte technical developers
Subject: [Xerte-dev] Re: navigating to page name > Part of the problem has been the lack of a suitable identifier for each page that could be set within an xwd form Why can’t you set attributes on the icon in the makePages script, in these bits of code? if (modName == 'xerteModel'){  newXML = new XML('<PG model="' + extXML.firstChild.childNodes[i].attributes.modelFile + '"/>');  //is there an initObject...?  if (extXML.firstChild.childNodes[i].attributes.initObject != undefined){    newXML.firstChild.attributes.initObject = extXML.firstChild.childNodes[i].attributes.initObject;  }} else { newXML = new XML('<PG model="templatePath + \'models/' + modName + '.rlm\'"/>');}newChild = newXML.firstChild;newChild.attributes.title = extXML.firstChild.childNodes[i].attributes.name;newChild.attributes.linkID = extXML.firstChild.childNodes[i].attributes.linkID;  if (extXML.firstChild.childNodes[i].attributes.linkID == _level0.linkID && extXML.firstChild.childNodes[i].attributes.linkID != undefined){  linkIndex = i;}ifc.appendChild(newChild); newChild is the xml that is added to the interface. The engine then loads up the modesl identified in each page attached, but does not replace the page icons you create here. You won’t see the changes at design time(i.e. populate the name property in the xerte editor), but they can be set at runtime, and thus be used for navigation.   From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Kemp Johnathan
Sent: 14 February 2012 12:36
To: For Xerte technical developers
Subject: [Xerte-dev] Re: navigating to page name I have considered how to implement the ability to route pages for some time now. Part of the problem has been the lack of a suitable identifier for each page that could be set within an xwd form. In page wizards I used the "name" field of the page icon, but this is not definable from an xwd form.  In pageTemplates projects the xwd defined name value is used as the page title and there is no way to set the page Icon name property. The page title is a bad candidate as a unique identifier as its main function is to be a a page title making it potentially lengthy, potentially liable to change, possibly even unique and probably more prone to error in typing when referring to it as a page destination. As part of the move to individual page templates I am including in every xwd file an optional property pageID the purpose of which is to act solely as an identifier to enable other pages to locate it in the project. I have a number of page wizards that I will be converting to individual page templates that offer routing i.e. the ability to specify a target page which the user will be taken to on completing an action e.g. making a selection from a multiple choice question, clicking on a link in some text etc. These will use the new pageID property. This is achieved by using the following code. In the rlm file's getPageID script the following opening is used for any page that offers routing if (extXML == undefined){ // Page Wizard 
    pageIcon.templateData = pageIcon.extXML.toObject();
    pageIcon.templateData = pageIcon.templateData.pageWizard[0];

    // routed pages only
    pageID_array = new Array();
    for (i = 0; i < rootIcon.pages.length; i++){
      pageID_array.push(rootIcon.pages[i].extXML.firstChild.childNodes[0].attributes.pageID);
    }

} else { // Toolkits 
   myXML = new XML(extXML.firstChild.childNodes[rootIcon.getPageIndex() - pgOffset]);
   pageIcon.templateData = myXML.toObject();
   rootIcon.setTitleText(templateData.learningObject[0].name);

   // routed pages only
   pageID_array = new Array(); 
   for (i = 0; i < extXML.firstChild.childNodes.length; i++){
     pageID_array.push(extXML.firstChild.childNodes[i].attributes.pageID);
   }  
} This makes available to the routed page an array of every page in the project with a value for pageID where it has been defined.  Navigation to a page can then be handled in a manner such as

// navigate to destination page
for (i = 0; i < pageID_array.length; i++){
   if (pageID_array[i] == destPageName){
     pageFound = "true";
     destinationIndex = i;
     rootIcon.gotoPage(destinationIndex);  
   break;
  } else {
    pageFound = "false";
  }
} This will open up the potential to create a variety of "routed" pages which all use a standard method of page identification. Kind regards Johnathan    On 14 February 2012 09:50, Julian Tenney <Julian.Tenney at nottingham.ac.uk> wrote:Ah, the other gotcha is that those asfunc calls need the full path to the object. From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 14 February 2012 08:24
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: navigating to page name :-)sleep worked!Got it working with _level0.engine.navToPage(pagetitletogoto); From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2012 00:43
To: xerte-dev at lists.nottingham.ac.uk
Subject: [Xerte-dev] Re: navigating to page name So much for in vino veritas.From: ronm at mitchellmedia.co.uk
To: xerte-dev at lists.nottingham.ac.uk
Date: Tue, 14 Feb 2012 00:31:28 +0000
Subject: [Xerte-dev] Re: navigating to page nameThanks for the suggestion Davebut I've pretty much tried that but it's not working e.g. if I debug(myPageIndex); it's coming up undefined.Time to shut down and have another look in the morning.CheersRon From: xerte-dev-bounces at lists.nottingham.ac.uk [mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Dave Burnett
Sent: 14 February 2012 00:22
To: xerte-dev at lists.nottingham.ac.uk
Subject: [Xerte-dev] Re: navigating to page name 
http://lists.nottingham.ac.uk/pipermail/xerte/2010-April/004972.html ?? I've had a couple pints, so I may be missing the point.:-) From: ronm at mitchellmedia.co.uk
To: xerte-dev at lists.nottingham.ac.uk
Date: Tue, 14 Feb 2012 00:10:31 +0000
Subject: [Xerte-dev] navigating to page nameHiI think I'm missing something silly here :-(In a script icon in a page templates project I want to dynamically pass a page title to navigate to that page. I know <a href="asfunction:_level0.engine.navToPage,yourpagetitle">Click here or some other wording</a> works in xot as a hyperlink but haven't managed to call the same function in a script icon? Or is there another/easier way of doing this e.g. navigating to a page title in a page templates project? CheersRon  
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 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 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
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
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/20120214/a106a347/attachment-0001.html>


More information about the Xerte-dev mailing list