May 9, 2018 at 2:38 pm #396433
I have button called Responsibilities Summary, it branches to a section within my title, it has 4 pages in the section. The users don’t have to view these page at all or can look at all of them. The Responsibilities Summary button is on every page in my title.
I created a variable SummaryGoBack. I added an action to the Responsibilities Summary button to modify SummaryGoBack and sets it equal to VAR(CurrentPageName) and also to go to the Responsibilities Summary section.
My goal is, on the Responsibilities Summary section pages to have a button on each page that will take you back to the page you left from.
Is Var(CurrentPageName) okay (all my pages have unique names) or is there a better locator I should be using, and what would the java scrip be I would need to put on the “Back to course” button on the Responsibilities Summary section pages?
thanks in advance for any help!July 9, 2018 at 10:27 pm #401432
Hi Benjamin, Trying to make something like this work i notice a few things to be aware of.
For example… if you use Chapters and Sections… well the html-name of your page will have those included.
I got a getBack(); function in my scripts that returns indeed to the proper last page visited.
lastPageVisited = VarSummaryGoBack.getValue();
Like this it will not work, trying to go back to the real name of the page… Simple sample in my example.
Taking however into account the Chapter and possibly Section your page is in it will work.
And as a extra from Trivantis…all uppercast characters will be converted to undercast and all spaces to _
then the function below will get it back to that page.
lastPageVisited = VarSummaryGoBack.getValue();
So what we need to do to get this working, is getting the proper name including chapters and sections and convert uppercast to undercast and replace spaces by _
I am working on a sample of this in Lectora Online, when its working i export a package and add it here.
PS. there is also a variable called CurrentPageId.. gonna check what that one does…if there is some array of all pages, then i do think the CurrentPageId might get to the actual pagename…July 9, 2018 at 11:19 pm #401434
Basically this function now works with a few caveats i have to fix somehow.
lastPageVisited = VarSummaryGoBack.getValue().toLowerCase().replace(/\s+/g, ‘_’);
//lastSectionVisited = VarLastSectionName.getValue().toLowerCase().replace(/\s+/g, ‘_’);
lastChapterVisited = VarLastChapterName.getValue().toLowerCase().replace(/\s+/g, ‘_’);
constructedPageName = lastChapterVisited+”_”+lastPageVisited+”.html”;
I only have Chapters in my title, so no need for the Sections.
In any Chapters or Sections you need to have an action setting the LastChapter/LastSection variable.
Issues i would need to solve.
– When you have pages outside Chapters and Sections i do have to find a solution for that. Probably nulling it.
– When using shortnames when publishing, i dont have a clue about the pageNames, have to test that… and figure out how to check and process that.
– Not sure how Tests are working. Would need to check that.
– All now in Lectora Online, have to see if there is a difference when using it in Inspire or Publisher
Quickly did a testrun with publishing as Short-ID named, and that looked promising. I do think Lectora uses the earlier mentioned CurrentPageId to create names for the pages. Something like pageCurrentPageId. So setting your publishing to Short-ID probably simplifies things…no need for worrying about Chapters and Sections..just add the CurrentPageId and your good..
Testing that now.
July 9, 2018 at 11:42 pm #401437
- This reply was modified 1 year, 7 months ago by Math Notermans.
Yes that works way better. No worry about Chapters and Sections. You just have to ensure a variable for LastPageId is updated on every page… and publish with this option checked: Convert Page Names to short ID-based Names
And then with this function you can go back to your last stored page..
lastPageId = VarLastPageId.getValue();
var test = “page”+lastPageId+”.html”;
Make sure your summary pages dont inherit any code storing the IDs and all will work fine.
MathJuly 10, 2018 at 12:21 pm #401518
Wow Math, nicely done. Thanks for building this, I’ll try it out.
One other question for you regarding Lectora Online. Is there any big difference between it and Inspire. I have a coworker and it seems like online would help us work together a lot better, right now we store titles on google drive and some titles have gotten mixed up when someone had it opened and someone else went in and starting saving. We have to build our titles to 508 compliance and I wasn’t sure if inspire and online had the same functionality.
Thanks again!July 10, 2018 at 9:15 pm #401532
You must be logged in to reply to this topic.