Forum LAMS for Tech-Heads - General Forum: Integrating LAMS into home-brewed application?


 
You may request notification for Integrating LAMS into home-brewed application?.
Search: 

1: Integrating LAMS into home-brewed application?
03/17/08 03:31 PM
[ Reply | Forward ]
Hi everyone,

I'm working on getting LAMS integrated into a fairly large-scale home-brewed application. It's an online learning module, where the user navigates through different sections with educational videos, and we would like the final section to be a LAMS assessment.

Because we want it to remain tightly integrated with the existing application, at least visually, we want the final section to contain our header/footer and an iframe containing the LAMS assessment. We don't want to make the user log in separately, we want it to be a seamless integration. So yeah, the main issue is pass-through authentication, and I'm not sure how to approach it. Can LAMS be easily integrated into an application in this manner, without going through a LMS?

Thanks in advance for any advice!


~ Keith

Posted by Keith Kamholz

2: Re: Integrating LAMS into home-brewed application?
In response to 1 03/17/08 05:39 PM
[ Reply | Forward ]
Keith,

Depends what you mean by "easily integrated". You would have to use some custom code in your existing application that does the same authentication stuff that all our LMS integrations do. So you do not have to use an LMS - you would use your application in place of the LMS.

All the code for our integrations is available for download, so you could pick one of those as a basis to copy some of the code. Some of the details on integration internals are found here and here on the wiki. The pages are out of date I'm afraid (ahh, the joys of documentation?!)

But it is more than the pass-through authentication for learner - the whole thing is set up to expect the teacher call authoring, monitoring, start the activity, etc from the external application. You could probably dodgy something up to log you (as a teacher) into LAMS initially and from there you could go straight to LAMS to access authoring and monitoring but that would be confusing for your users so we don't recommend it (I assume you aren't the only person using this system for teaching). You will need to start your assessment stuff from your application as your application needs to know the ID generated by LAMS so that the learners can then access the assessment.

We find most of the time we spent in doing an integration is working out the best way to do the screens in the LMS/external application, not actually doing the authentication stuff.

What language is your application written in? Our current integration code is current in PHP and Java.

Fiona

Posted by Fiona Malikoff

3: Re: Re: Integrating LAMS into home-brewed application?
In response to 2 03/17/08 05:41 PM
[ Reply | Forward ]
> Our current integration code is current in PHP and Java.

And TCL for .LRN

Posted by Ernie Ghiglione

4: Re: Re: Integrating LAMS into home-brewed application?
In response to 2 03/19/08 09:15 AM
[ Reply | Forward ]
Hi Fiona, thanks for the reply.

This is a Struts (Java+JSP+XSL) webapp. I suppose our situation is actually a bit easier than most. We don't need to do any authoring in this custom application, we only want to display the actual assessments. That simplifies things a lot.

Thanks for the links, I'll check that out and hopefully they will get me on the right track.


~ Keith

Posted by Keith Kamholz

5: Re: Re: Integrating LAMS into home-brewed application?
In response to 2 03/26/08 12:36 PM
[ Reply | Forward ]
Ok, so we have this almost working I think. However, when we specify the method attribute and set it to learner, we get an authentication error. However, when we don't specify the method, we can log in ok, just with author permissions.

Are the values author/monitor/learner still the valid values for the method parameter? If so, any idea what could be going wrong?

Thanks!

Posted by Keith Kamholz

6: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 5 03/26/08 05:32 PM
[ Reply | Forward ]
What's the URL you are calling look like? Opening learner and author is via the LoginRequestServlet if I remember correctly, which authenticates each request no matter the value of the method parameter.

Posted by Jun-Dir Liew

7: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 5 03/26/08 05:43 PM
[ Reply | Forward ]
Check that the method parameter matches the method used to make the hash.

the hash for the loginRequest servlet should be a hash of the following (concatenated and all set to lower case):timestamp, username, method, serverid and serverkey

The method in the hash here should match the &method parameter in the loginRequest url.

Hope that helps,

Luke

Posted by Luke Foxton

8: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 7 03/31/08 10:05 AM
[ Reply | Forward ]
Got it! The problem is that I wasn't including the method in the hash. There are a couple different hashes in the documentation wiki, one of which doesn't include the method, so that kida threw me off a bit.

So yeah, it's working now, we just need to display a specific assessment right away, rather than the default post-login page. Is there any way to do that? I was able to dissect out the URL from that default LAMS page, the one that opens an assessment, but I would rather do the authentication and page display all in one shot. Can this be done?

We're building this as a dynamic framework so that we can plug in any external page we want, so I'd rather not have any LAMS-specific code on the page. We can put it in if necessary, but that would severely impair the flexibility and reusability of the framework.

Posted by Keith Kamholz

9: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 8 03/31/08 08:30 PM
[ Reply | Forward ]
Keith,

If I understand correctly, you are creating a LAMS sequence just a single activity and then running it as a lesson, and you want the learner to see just that one activity. So you don't want the Learner Progress bar on the left hand side, you don't want to see the LAMS logo, you don't want the learners to be able to do export portfolio.

Off the top of my head, the easiest way to do this is find lams_learning.war and unzip it, then find the file main.jsp. Change

<frameset rows="*" cols="160,*">

to

<frameset rows="*" cols="0,*">

This will hide the sidebar. I would prefer it if you don't remove the sidebar as it is needed if you ever create a LAMS sequence with more than one activity.

But it won't get rid of the "Congratulations, you have finished." message.

Then re-zip up the lams-learning.war. You should rezip it or the next time you upgrade LAMS, the upgrade will probably fail.

This will change when LAMS 2.1 comes out, as we are introducing a new "Non-Flash" version of learner, but the change will be similar. In 2.1 you can either do the same change to mainflash.jsp (same file, different name) or use the Non-flash mode and modify mainnoflash.jsp to only show the main iframe.

I can't think of any way to avoid the "Congratulations, you have finished." message. Even if I give you the URL to call the Multiple Choice tool directly (which is what I assume you are using for the assessment) then you will still get the "Congratulations" messages. The best I can offer is that  you also modify the lessonComplete.jsp and take out the old message and put in your own message. If you want to I18N it, then the message files are in the lams_dictionary.jar (org/lamsfoundation/lams/tools/mc). Of course, if you make these changes then they will be overwritten in the next upgrade.

Does that work?

Fiona

Posted by Fiona Malikoff

10: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 9 04/02/08 01:21 PM
[ Reply | Forward ]
Well, we really don't need to lock it down that much. The problem is that when the user navigates to the page with the embedded LAMS assessment, they see this:

http://www.keithdigital.com/hosting/LAMS-embedded.tiff


But we want the embedded iframe to show this, instead of the default post-login LAMS page:

http://www.keithdigital.com/hosting/LAMS-assessment.tiff


Does that make sense?

Posted by Keith Kamholz

11: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 10 04/02/08 06:56 PM
[ Reply | Forward ]
Keith,

I think there may still be a problem with the login request. If the login request is working correctly, it should already be going straight into learner or monitor when you click the link to lams. Which i presume is what you are after.

This is what a login request for learner looks like (this is for a SharePoint Integration):

(serverurl)/lams//LoginRequest?&sid=lamssharepoint&courseid=french+-+3235fed5-ff04-48fb-bcf0-f2fb1b42c292&uid=administrator&ts=1206667512364&hash=74a11bbd30127a15f0690f57c77aaec145cdf020&lang=fr&country=FR&firstName=administrator&lastName=+&email=administrator%40administrator.com&requestSrc=SharePoint&method=learner&lsid=1

Can you perhaps reproduce this problem, then send us a copy of the lams.log and the localhost_access_log.(date).log. I should be able to work out what is missing from these files.

Luke

Posted by Luke Foxton

12: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 11 04/03/08 01:47 PM
[ Reply | Forward ]
Got it! The only problem was that I wasn't passing the lsid. I didn't realize that parameter was referring to the id of the page you would like to open.

This is a little weird though... the Congratulations page isn't working. Firebug is showing me and error that reads: "uncaught exception: Permission denied to get property Window.contentFrame"
However, if I access just the LAMS survey in my main browser window, the messages appear just fine. It's only in the iframe of my application that the problem occurs. Any idea what could be going on?

Also, the interface is displayed properly, but the lesson doesn't appear to load unless I click the 'Resume' button. Otherwise, it just displays a message saying "The next task is loading. Please wait....". Weird, right?

And one other problem... for my main test user everything is working ok, but when I use another user account, without changing anything else, I get an error in the LAMS sidebar and the lesson doesn't load. It just says that "A following System Error has occurred: You may need to restart the browser window...". Any clue what could be causing this?

Sorry to keep bugging you with all these problems, but thanks for the all the help so far! It's much appreciated!

Posted by Keith Kamholz

13: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 12 04/03/08 05:57 PM
[ Reply | Forward ]
I suspect the permission denied and the "The next task is loading" is something to do with Javascript permissions. We run into problems with the integrations that stuff we are allowed to do in Javascript when LAMS opens the window is different to what we can do in Javascript when another site opens the window, all to do with Javascript permissions in the browser.

Can you temporarily make the window a popup window, rather than sticking it in an iframe and see what happens? I know you want an iframe, but making it a popup might help us work out what permission problems we might be encountering.

As for the system error one - can you dig out the lams.log and server.log again (after reproducing the problem)? When you have gone to other account, something has probably gone wrong in creating the new user on the LAMS side. So when its tried to add the user to the lesson, its failed and then it can't display the learner window.

Fiona

Posted by Fiona Malikoff

15: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 13 04/16/08 12:51 PM
[ Reply | Forward ]
I figured out a fix for the problem. You're right, it's a Javascript issue, but its not a permissions problem. It's just an issue with how your script refers to the content frame when it's loading content.

It refers to:
top.frames['contentFrame'].location.href = "...";

And the fix is to use:
parent.frames['contentFrame'].location.href = "...";

This doesn't seem to break anything, and makes a lot more sense. The change refers to the frame relative to its own location in the DOM, whereas the 'top' reference breaks any time you try to nest LAMS in a frame/iframe/etc.

Is there any chance of getting that changed in the next version? For now, I assume the only option is to go in and make the change in all the source files, which might need to happen in several places, and recompile it all. I found instructions for building from the source at http://wiki.lamsfoundation.org/display/lams/Building+LAMS.

Would I need to go through that whole setup if I just need to build a new WAR file to deploy on our server? Or can I just ignore all the database stuff and build the modified war? To do so, would, I just run "assemble-ear"?

Thanks!

Posted by Keith Kamholz

16: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 15 04/16/08 05:38 PM
[ Reply | Forward ]
I suspect we are using top.frames to ensure that if we end up inside an extra frameset like chat & scribe, forum & scribe, etc then it breaks out of the extra frameset.

I'll have a look at whether it can be fixed in time for the next release.

I think there are three files that will need looking at, all in lams-learning.war: progress.jsp, requestURL.jsp and welcome.jsp.  I think it is progress.jsp that has the most potential to break if we change it.

You don't need to do a whole build if you just want to change a few jsps containing this string. War files are actually zip format, so you can unzip them, change the files and rezip them back up again. You probably want to take a backup of the .war file first!

Just be careful when you rezip them - some of the nice GUI zip  tools end up putting an extra directory in the zip file ie you end up with everything in a folder lams-learning within the zip file. That will completely confuse Java.

Warning: if you ever do "assemble-ear" then you will find all the tool's will disappear from your LAMS server. So if you can do it by just unzipping and rezipping, that's the way to go for now.

Fiona

Posted by Fiona Malikoff

17: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 16 04/24/08 12:50 PM
[ Reply | Forward ]
Excellent, you're right, that's a much better solution.

I just changed requestURL.jsp and welcome.jsp, but I didn't see a progress.jsp file in lams-learning.war. There's a progressBroken.jsp, but that doesn't appear to need the change. I'll give what I have now a shot though, and I'll let you know how it works out. Thanks yet again!

Posted by Keith Kamholz

18: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 17 04/24/08 03:45 PM
[ Reply | Forward ]
We think we have it fixed for the next release (as of last night), but we haven't tested it fully yet. We will be testing it next week and if it is all working then we'll let you know.

If you want to see what we've done and can read source code difference reports, have a look at
http://lamscvs.melcoe.mq.edu.au/fisheye/changelog/lams/lams_learning?cs=MAIN:asukkar:20080424010733

As I said, it hasn't been through my "do weird and wonderful things that will break stuff" testing, so there may be more changes to come.

Fiona

Posted by Fiona Malikoff

19: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 18 04/28/08 07:53 PM
[ Reply | Forward ]
Keith,

I've tested Anthony's changes yesterday (to fix the javascript error), so you should be right to copy them into your server.

Fiona

Posted by Fiona Malikoff

20: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 19 05/15/08 03:50 PM
[ Reply | Forward ]
Ok, so with all your help, our integration seems to be working quite nicely. However, we just encountered a cross-browser issue where the lesson hangs on the 'Next task is loading' message in Internet Explorer. I've been using my own fix for that one Javascript issue that we addressed, so I don't know if my fix broke it in IE or if it was already broken. Do you know if everything was completely functional in IE before?

Posted by Keith Kamholz

21: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 20 05/15/08 05:01 PM
[ Reply | Forward ]
LAMS itself should have been working in IE. We consider IE one of our supportd browsers, so we do test it regularly in IE. I test it occasionally in IE7 and haven't encountered any issues.

Firefox is probably the best tested (and tuned for) browser, as that is what most of the development team use day to day but some of our other staff use IE regularly so I'm sure they would tell us in a hurry if the "next" in IE was broken.

But (and it is a big but) we don't run with our windows inserted in another frame, so it may be something to do with IE and how it handles frames. Did you have a look at the changes Anthony made for 2.1 to see if they would work any better?

It could also be something to do with the settings in IE - occasionally I get tripped up when I've turned on some security setting in IE and something that seems completely unrelated to me stops working.

Fiona

Posted by Fiona Malikoff

14: Re: Re: Re: Re: Re: Re: Re: Re: Re: Integrating LAMS into home-brewed application?
In response to 12 04/03/08 10:10 PM
[ Reply | Forward ]
While your there Keith,

It might be an idea to sen us the localhost.access.(date).log file and we might be able to see if there is a problem with your urls.

Luke

Posted by Luke Foxton

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum