[Xerte] use of isFunc and passing of parameters
Dave Burnett
d_b_burnett at hotmail.com
Wed Apr 21 16:51:17 BST 2010
1) Julian mentioned duplicate named functions will just overwrite each other.
So I see no harm in containing them within the wizard (if they are identical).
My Entry pane location is just where I would locate a function in a traditionally structured piece, since if changes need to be made, there would be a single "point of access".
2) I think using the fully qualified path to a function, i.e. href="asfunction:_level0.engine.navToPage,destPageName" is the correct syntax to use. It appears if it is mixed with the short-hand function call "navToPage(destPageName)", there are issues.
So as long as you use fully qualified paths in both cases, it functions as expected.
As to why args acts as it does when the 2 cases are mixed, I would guess that it is a scope issue that is solved by using the fully qualified path in all instances.
Dave
----------------------------------------
> Date: Wed, 21 Apr 2010 12:58:26 +0100
> From: johnathan.kemp at ntlworld.com
> To: xerte at lists.nottingham.ac.uk
> Subject: RE: [Xerte] use of isFunc and passing of parameters
> CC: Julian.Tenney at nottingham.ac.uk
>
> Thank you Julian and Dave for your comments and observations.
>
> I used a function in the routed hotspot wizard because I thought that a function would provide a tidier and more elegant solution. I can avoid the whole issue of the current value of args[0] in the routed hotspot wizard by including all the code in the navToPage function as part of the handleClick script and deleting the script that defines the function. That way there is no function, no function call, and the value of args[0] is irrelevant to the functioning of the wizard.
>
> I am more concerned about the use of
>
> href="asfunction:_level0.engine.navToPage,destPageName"
>
> in the Routed Plain Text Wizard. I cannot get away in this case without a function.
>
> I appreciate the logic of including the navToPage function once in the Interface's Entry Frame, but this is not appropriate when creating wizards as the Wizard needs to be self sufficient, and not dependent on a function that exists elsewhere in the project.
>
> I have tested a project with more than one Routed Plain Text wizard in it and the navigation works between the pages - i.e. each page can call the other pages without compromising there ability to call the pages they have links to.
>
> However I am concerned that their apparent ability to compromise the value of args[0] may affect the use of functions that developers have added to their projects.
>
> Would others have any reservations about the use of
>
> href="asfunction:_level0.engine.navToPage,destPageName"
>
> in a page that hosted a function?
>
> I guess I am looking for a second opinion, from those who know the innards of Xerte better than I do, as to whether the Routed Text Wizard is safe to be released for public use?
>
>
> Kind regards
>
> Johnathan
>
> ---- Julian Tenney wrote:
>> It's not ideal , but they'll just overwrite each other
>>
>> -----Original Message-----
>> From: xerte-bounces at lists.nottingham.ac.uk [mailto:xerte-bounces at lists.nottingham.ac.uk] On Behalf Of johnathan.kemp at ntlworld.com
>> Sent: Tuesday, April 20, 2010 4:06 PM
>> To: Dave Burnett
>> Cc: Xerte discussion list
>> Subject: RE: [Xerte] use of isFunc and passing of parameters
>>
>> Dave,
>>
>> I thought that in Xerte each page existed separately, i.e. the code for the page was only loaded when that particular page was being displayed, so that in practice only one copy of the navToPage function would exist at any one time.
>>
>> Am I wrong in this assumption?
>>
>> Kind regards
>>
>> Johnathan
>> ---- Dave Burnett wrote:
>>>
>>>
>>> Johnathan, one thing to look out for is you have 3 identical function script icons called "navToPage".
>>> I think that may lead to some weird issues when it comes to debugging.
>>>
>>> ----------------------------------------
>>>> Date: Mon, 19 Apr 2010 23:46:07 +0100
>>>> From: johnathan.kemp at ntlworld.com
>>>> To: d_b_burnett at hotmail.com
>>>> Subject: RE: [Xerte] use of isFunc and passing of parameters
>>>> CC: xerte at lists.nottingham.ac.uk
>>>>
>>>> I have attached a zipped up sample xerte project.
>>>>
>>>> If you unzip it and open it in Xerte you will be able to see what I am referring to.
>>>>
>>>> The use of href="asfunction:_level0.engine.navToPage,destPageName", appears to be setting the value of args[0] such that the value of the passed parameter when using navToPage(pageName) is ignored.
>>>>
>>>> The only solution I have found is to set args[0] in the script that calls the function and then to pass args[0] as the parameter, e.g.
>>>>
>>>> args[0] = hsData.hotspot[icon.parentNode.index()].destination;
>>>> navToPage(args[0]);
>>>>
>>>> This does not feel right. I don't understand what it is that the hyperlink approach is doing that is affecting the receipt of the passed parameter.
>>>>
>>>> Any ideas would be most welcome.
>>>>
>>>> Kind regards
>>>>
>>>> Johnathan
>>>>
>>>> ---- Dave Burnett wrote:
>>>>>
>>>>>
>>>>> Do you have a sample file I could take a peek at?
>>>>>
>>>>> Dave
>>>>>
>>>>> ----------------------------------------
>>>>>> Date: Sun, 18 Apr 2010 22:33:38 +0100
>>>>>> From: johnathan.kemp at ntlworld.com
>>>>>> To: xerte at lists.nottingham.ac.uk
>>>>>> Subject: Re: [Xerte] use of isFunc and passing of parameters
>>>>>>
>>>>>> Just to clarify my first posting.
>>>>>>
>>>>>> I originally tested the second method, that of calling the function from a script e.g. navToPage(parameter1,parameter2,parameter3), but found that only parameter 1 was passed through to the function as args[0]. args[1] and args[2] were undefined. However this still left me with the situation where if I had two wizards.
>>>>>>
>>>>>> The routed hotspot wizard that called the function from a script using navToPage(destPageName)
>>>>>>
>>>>>> and
>>>>>>
>>>>>> The routed text wizard that called the function using href="asfunction:_level0.engine.navToPage,destPageName"
>>>>>>
>>>>>> Pages created with the routed hotspot wizard work fine until a page based on the routed text wizard is used to redirect the user to a page based on the routed hotspot wizard. At which point the args[0] from the routed text page appears to persist so that the routed hotspot page effectively redirects to itself, rather than the page name passed to it.
>>>>>>
>>>>>> The only solution appears to redefine args[0] to the destination page and then call navToPage(destPageName)
>>>>>>
>>>>>> I hope this makes things a bit clearer.
>>>>>>
>>>>>> Any ideas as to what is happening here and how to modify things so that the parameter is passed correctly, without the work around would be much appreciated.
>>>>>>
>>>>>> Kind regards
>>>>>>
>>>>>> Johnathan
>>>>>>
>>>>>> ---- johnathan.kemp at ntlworld.com wrote:
>>>>>>> I am developing a couple of page wizards, both of which provide the capability to define exit points from the page.
>>>>>>>
>>>>>>> The first is a text page that allows you to define hyperlinks to other pages in the project. This is supported by a script where isFunc = 1.
>>>>>>>
>>>>>>> I am calling it with
>>>>>>>
>>>>>>> Routed Tab.
>>>>>>>
>>>>>>> The destination page name, in this case rtFinal, is received as args[0] in the script navToPage. It appears only possible to pass one parameter.
>>>>>>>
>>>>>>> I have a second wizard based on the hotspot in which any hotspot can have a destination page assigned to it. I have a similar function script in this wizard which is called by the script that runs when the hotspot is clicked on.
>>>>>>>
>>>>>>> This script calls the function by navToPage(parameter1,parameter2,parameter3)
>>>>>>> The results are received by the script in args[0],args[1],args[2]
>>>>>>>
>>>>>>> All has worked well when the pages work in isolation, but once the text page has been run this then appears to define the args array at a level that dominates over the hotspot page. The only way I can get this to work is if I set args[0] before I call the function and then pass args[0] as a parameter, otherwise it picks up the value of args[0] set by the text page.
>>>>>>>
>>>>>>> Can anyone shed any light on what is going on here?
>>>>>>> Do I need to declare a new array args at the start of every page?
>>>>>>> How would you operate two functions in a page if every function is going to handle its parameters as the same array args[]?
>>>>>>>
>>>>>>> Kind regards
>>>>>>>
>>>>>>> Johnathan
>>>>>>> _______________________________________________
>>>>>>> Xerte mailing list
>>>>>>> Xerte at lists.nottingham.ac.uk
>>>>>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>>>>>>
>>>>>> _______________________________________________
>>>>>> Xerte mailing list
>>>>>> Xerte at lists.nottingham.ac.uk
>>>>>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>>>>>
>>>>> _________________________________________________________________
>>>>> The New Busy is not the too busy. Combine all your e-mail accounts with Hotmail.
>>>>> http://www.windowslive.com/campaign/thenewbusy?tile=multiaccount&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_4
>>>
>>> _________________________________________________________________
>>> The New Busy think 9 to 5 is a cute idea. Combine multiple calendars with Hotmail.
>>> http://www.windowslive.com/campaign/thenewbusy?tile=multicalendar&ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_5
>>
>> _______________________________________________
>> Xerte mailing list
>> Xerte at lists.nottingham.ac.uk
>> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
>
> _______________________________________________
> Xerte mailing list
> Xerte at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte
_________________________________________________________________
Hotmail is redefining busy with tools for the New Busy. Get more from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_2
More information about the Xerte
mailing list