Linking lessons without opening a new window

For issues related to delivery of content to end-learners e.g. LMS tracking via SCORM and delivery of content offline.

Moderator: Nav

Linking lessons without opening a new window

Postby SB Support » Thu Jun 26, 2008 11:31 am

Note: There is an easier way to set up relative linking. Please see viewtopic.php?f=15&t=156&p=1269#p1269 located below. Since the method of communicating with Javascript outlined below is still valid and can be used for other purposes, we shall leave it here.

Note: The target audience for these instructions are users with a minimal familiarity with JavaScript and HTML.

Note: There's another way to do javascript signaling not using hyperlinks, so you can use actions to trigger the call, outlined below at viewtopic.php?f=15&t=156&p=1481#p1481

It is possible to directly navigate from the content of one lesson to another lesson even though this is not a SCORM compliant approach.

The approach described here is to navigate from one lesson using a button, hotspot, or text hyperlink to another lesson without popping up a new window. This approach doesn't specifically limit you to link to another lesson. You can link to any other URL resources.

We will refer to these two lessons: A and B. The following steps will show you how to create a link to navigate from lesson A to lesson B.

The general idea is to generate certain events in lesson A that can be intercepted with modified javascript function in the player.html file. Once this event is captured in the JavaScript, we will add new logic to redirect the browser window to point to lesson B. One of the easiest events for this purpose is when a button or hotspot object launches URLs.

Step 1:
We will start by creating a button object in lesson A and use the "Launch Web page" option from the "Edit Hyperlink” panel in the main tool bar. This is the hyperlink that you want learners to use to go to lesson B. The event label you specify here is going to be used later in the JavaScript. In our example, we will use event label "http://jump2B"
Step1.png
Step 1
Step1.png (8.63 KiB) Viewed 30011 times
.

Step 2:
Download and extract lesson A. Use a text editor to open launch file "resources\AC_RunActiveContent.js". Find the javascript function "openWindow(url,w,h)". Add the following code into the beginning of this function.

if (url=="http://jump2B") {
document.location="../lesson_B/player.html";
return;
}

So, after inserting the above code, the function will look as follows:
Step2.png
Step 2
Step2.png (283.02 KiB) Viewed 30010 times


This code first checks to see if the hyperlink trigger is named "jump2B". If it is true, it redirects the browser to lesson B which is located at "../lesson_B/player.html". In this example, we use a relative path, however, you can use an absolute path if necessary. Based on this relative path, the url structure of lesson A and lesson B is illustrated below.

[parent path]
...
[lesson_A]
player.html
[lesson_B]
player.html
....
....

Step3.png
Step 3
Step3.png (198.4 KiB) Viewed 30010 times


In the browser, the urls to lesson A and lesson B might look like this:
"http://www.suddenlysmart.com/sample/course1/lesson_A/player.html" and
"http://www.suddenlysmart.com/sample/course1/lesson_B/player.html".
Last edited by SB Support on Thu Aug 07, 2008 5:21 pm, edited 1 time in total.
SB Support
 
Posts: 79
Joined: Tue Aug 21, 2007 4:37 pm

Re: Linking lessons without opening a new window

Postby Jolliff » Thu Jun 26, 2008 2:35 pm

This is excellent. Can I safely assume that if I need to link to more than one parallel lesson, I can just give each a unique name such as jump2B, jump2C, and add an additional IF statement to the javascript for each extra link, after the first?

The segment would then look like this:
Code: Select all
function openWindow (url,w,h)  {
     if   (url=="http://jump2B">  {
          document.location="../lesson_B/player.html";
          return;
     }
     if   (url=="http://jump2C">  {
          document.location="../lesson_C/player.html";
          return;
     }
Qualcomm Enterprise Services - Information Design & Training
"There is an evil tendency underlying all our technology—the tendency to do what is reasonable, even when it isn't any good."
~Robert Pirsig
Jolliff
 
Posts: 15
Joined: Tue Jun 24, 2008 1:41 pm
Location: San Diego

Re: Linking lessons without opening a new window

Postby kentxu » Fri Jun 27, 2008 10:19 am

Yes. You can link multiple lessons using this method.
Development Team
kentxu
 
Posts: 33
Joined: Tue Mar 13, 2007 3:08 pm

Re: Linking lessons without opening a new window

Postby jzoeller » Mon Aug 11, 2008 8:31 am

I am aware that this method has changed a bit with the new release. I now make these edits to the AC_RunActiveContent.js file. Also, I understand that you must make these edits to both the linkhandler(s) and linkHandler(s) functions. However, I am having difficulty in doing this with a mailto: request. My code is pasted below. Can someone tell me what I am doing wrong?

Code: Select all
function linkHandler(s) {
   if (s.indexOf("trigger://mailtojoanna,")>0) {
      document.location="mailto:trr1jaw@ups.com";
   }
   
   window.document.tsunamiplayer.SetVariable("/:callbackHyperlink",s);
}

//workaround: new version of flash players (above 9.0.45) turns any hyperlink function call into lower case
function linkhandler(s) {
   if (s.indexOf("trigger://mailtojoanna,")>0) {
      document.location="mailto:trr1jaw@ups.com";
   }
   
   window.document.tsunamiplayer.SetVariable("/:callbackHyperlink",s);
}
Jim Zoeller
UPS Airlines
jzoeller@ups.com
jzoeller
 
Posts: 44
Joined: Mon Apr 02, 2007 5:56 am
Location: Louisville, KY

Re: Linking lessons without opening a new window

Postby SB Support » Mon Aug 11, 2008 10:23 am

Jim,

I assume this post is unrelated to the initial topic of launching another lesson in the same window, right? You just want to invoke the learners email client to send an email? If yes, there is an easier and more flexible way to do this than having to edit a .js file.

We've had similar requests before and create an email SDK object to do this. Rather than explain how it works in this post, just open the example we have in SmartBuilder.

1) From the Home window, select Shared Library > Examples, then select the lesson called "E-mail example (SDK object)" and click Save As.
2) On the Authoring Stage, preview the lesson to see how it behaves.
3) Open the Action List to see how it was configured. Notice that in this example all the fields (To, From, Subj, etc) are configured dynamically based on learner input. You could also select the Email object and configure it with static data using its Properties panel.

Hope that helps
SB Support
 
Posts: 79
Joined: Tue Aug 21, 2007 4:37 pm

Re: Linking lessons without opening a new window

Postby pluke » Tue Aug 19, 2008 2:51 pm

Please document here how you do this with the new release. I need to do link to nearby lessons, and though I figured out you have to modify the AC_RunActiveContent.js file, and I can see that there are more things to modify, I don't know enough to understand what they are. Please make it really clear for those of us who are just code pirates and not javascript coders :)
pluke
 
Posts: 7
Joined: Tue Aug 19, 2008 2:47 pm
Location: San Diego, CA

Re: Linking lessons without opening a new window

Postby kentxu » Wed Aug 20, 2008 5:33 pm

jzoeller wrote:I am aware that this method has changed a bit with the new release. I now make these edits to the AC_RunActiveContent.js file. Also, I understand that you must make these edits to both the linkhandler(s) and linkHandler(s) functions. However, I am having difficulty in doing this with a mailto: request. My code is pasted below. Can someone tell me what I am doing wrong?

Code: Select all
function linkHandler(s) {
   if (s.indexOf("trigger://mailtojoanna,")>0) {
      document.location="mailto:trr1jaw@ups.com";
   }
   
   window.document.tsunamiplayer.SetVariable("/:callbackHyperlink",s);
}

//workaround: new version of flash players (above 9.0.45) turns any hyperlink function call into lower case
function linkhandler(s) {
   if (s.indexOf("trigger://mailtojoanna,")>0) {
      document.location="mailto:trr1jaw@ups.com";
   }
   
   window.document.tsunamiplayer.SetVariable("/:callbackHyperlink",s);
}


Hi Jim,

Please note that the instruction in the original post has been updated. The linkHandler/linkhandler functions are deprecated in the most recent 3.7 release. Hyperlink text internal event no longer triggers these callbacks anymore.

The recommended way to do this is by using mock URLs and catch them in the openWindow function. We will also introduce relative URL support next month which should eliminate most of the need to modify javascript for "content linking" purpose.
Development Team
kentxu
 
Posts: 33
Joined: Tue Mar 13, 2007 3:08 pm

Re: Linking lessons without opening a new window

Postby Nav » Tue Dec 15, 2009 5:40 pm

NOTE: This is the new and updated way to accomplish relative path linking. All of the above is still accurate, but this method is probably the easiest, and doesn't require any modification of javascript.

Basically, you can set up relative linking simply by putting in the relative path in the Launch Web page field, and choosing Open Resource In: Same Page.

2009-12-15_1550.png
2009-12-15_1550.png (15.74 KiB) Viewed 29767 times

Then obviously you'll need to set up your course structure after publishing and downloading the lessons so that the lesson folders are at the same level. Note that "../" in the above graphic means to go up one level, then back down into a different folder (lesson2). Your file structure should look something like:

structure.png
structure.png (7.43 KiB) Viewed 29767 times

If you have any questions, please let us know.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Linking lessons without opening a new window

Postby Nav » Fri Oct 01, 2010 9:43 am

Now with auto-invocation! If you want to call a custom javascript function without the learner having to click a button (the trigger being a timer or a video ending), you can use the URL Data object* to send the information. However, the javascript that you need to change in the "resources/AC_RunActiveContent.js" file is actually this one below (where the text outlined in green has been added to the file):

2010-10-01_0921.png
2010-10-01_0921.png (7.39 KiB) Viewed 29604 times

And in SmartBuilder, your action would look like the following:

invoke.png
invoke.png (10.79 KiB) Viewed 29604 times

Let me know if you any questions!

- Nav

* NOT the Server Communication object. You'll need to add the URL Data object by going to More objects, and choosing it from the list that loads up.
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm

Re: Linking lessons without opening a new window

Postby GrahamJClark » Mon Apr 18, 2011 6:47 pm

I’m trying to set up relative and/or absolute linking from one lesson to another as per Nav’s screen shots above. However, it’s not working for me. Every time I click on the link I’ve created it logs me out. I’m really not sure what to put in the Launch Web page field.

The first time I tried a relative path as follows:
../Lessons/BSBWOR402A - Promote team effectiveness/player.html

The second time I tried an absolute path as follows:
http://asp2.smartbuilder.com/smartbuild ... layer.html

Can someone please tell me what I’m doing wrong? Thank you.
GrahamJClark
 
Posts: 2
Joined: Mon Apr 18, 2011 6:29 pm

Re: Linking lessons without opening a new window

Postby Nav » Tue Apr 19, 2011 10:04 am

Hi Graham,
Being logged into SmartBuilder and testing this stuff is a bit tricky. The SmartBuilder Authoring Stage is running through your browser, so when you preview, and then try to go to a different URL, you're going to run into problems because you're technically leaving SmartBuilder, which logs you out.

Instead, try publishing your lesson and viewing the published lesson. It will popup in a new window.

In addition, your URLs need a bit of tailoring. If you're going to use a relative path, this will work, but you will probably have to hold of testing until you get your lessons downloaded, and then uploaded into their final locations with all the folders named as expected. This is the method that I would recommend.

If you're going to use the URL http://asp2.smartbuilder.com/smartbuild ... layer.html , you must be logged in to SmartBuilder to view it. So that might be okay to test with, but obviously not for your end learners because they'd have to be logged in to your SB account! Instead, you'll want to share the lesson and point to that shared link (publish the lesson, go to My Published Content, click on the Share button, and copy the URL that is given there). But then you get our branding on the shared stuff, so I don't know if that works for you. I don't recommend this for anything but testing.

Hope that helps. Let me know if anything was unclear.

- Nav
Nav
 
Posts: 866
Joined: Mon Nov 05, 2007 2:58 pm


Return to Delivery (LMS Tracking / SCORM / Offline Delivery)

Who is online

Users browsing this forum: No registered users and 2 guests

cron
Not able to open ./cache/data_global.php