[Xerte-dev] Re: LTI Provider
Ron Mitchell
ronm at mitchellmedia.co.uk
Tue Oct 16 17:28:57 BST 2012
Hi Simon
sorry it's taken a while to find time to test this further since we
discussed it at the developer day. It appears there are two separate but not
entirely unrelated issues...
1. function get_string issue
As we discovered during the developer day if Moodle integration is enabled
there's a clash with this function name at around line 527 of lti_util.php
/* This is a bit of homage to Moodle's pattern of internationalisation */
function get_string($key,$bundle) {
return $key;
}
What I've since discovered is that even if the site is set to another method
of authentication e.g. static the clash still exists because the code in the
XOT config.php simply checks if integration_config_path in the sitedetails
table has a value and if it does requires that path. Obviously there might
only be a conflict if the integration path is to a Moodle installation but
there's not really an accurate way of checking that the path is to a moodle
rather than another application. The simplest solution seems to be to do
what you did last week and change the function e.g.
function get_string2($key,$bundle) {
return $key;
}
Not sure if there's any problem with that? Alternatively how about checking
if it exists e.g. has a moodle path set and then using get_string2 e.g.
/* This is a bit of homage to Moodle's pattern of internationalisation */
if(!function_exists("get_string")) {
function get_string($key,$bundle) {
return $key;
}}else{
function get_string2($key,$bundle) {
return $key;
}}
I tested this and it resolves the cannot redeclare error
2. re-authenticating LTI if Moodle authentication is used
There's a more fundamental issue with the LTI functionality if Moodle
authentication is used with XOT. I've tried to find a solution to this but
couldn't find the right section of LTI code. I think there needs to be a
check to see if Moodle authentication is in use and if it is to pick up the
username from the session variable without displaying a form to
re-authenticate. e.g. when adding a new external LO if the time period has
expired or its first use then check if Moodle authentication is in use and
if it is just check for the username in the session and use that rather than
displaying the login form.
I can help resolve/test this but not sure where to prevent the form and use
the session instead?
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 09 October 2012 15:39
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
yep that seems to have cracked it! Working now with both my localhost and
Centos tests.
The one issue I do still have is with an upgraded installation of XOT 1.7 to
1.8. This where I mentioned that on management.php if I click LTI settings
View then LTI Keys View I don't get the option to add a key or view any
existing keys. This is on the same server as I have a new XOT 1.8
installation and I see those options with that and it all works. The 4 LTI
tables exist in the database and I've tried adding a key and secret manually
but the integration still doesn't work. Any idea what might be preventing
the view keys link from working?
The link goes no further than shown.
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 09 October 2012 15:08
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
Try an update now. I have got this apparently working on mine now with
static authentication and closing the browser completely between create and
going back it isn't giving me any errors.
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 09 October 2012 15:00
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
ok great - glad you can reproduce the problem now and happy to test any
changes.
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 09 October 2012 14:53
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
Looks like I managed to create myself a bug! The session_status() function I
was going to use to detect if sessions were started but then found its only
in php >5.4.0 so have now done it a different way.
I have now realised why Im getting things different from you as I have
completely closed my browser and tried and get the issue, Ill look into
this now and get back to you as soon as possible.
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 09 October 2012 14:45
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
thanks - progress of sorts...
1. I thought this has fixed things but if I only log into Moodle and then
access the links to Lo's I added previously they are broken and with the
debug code in place give the following errors:
Notice: Undefined index: toolkits_logon_username in
C:\xampp\htdocs\newxottrunktest\website_code\php\user_library.php on line 37
Notice: Undefined index: toolkits_logon_username in
C:\xampp\htdocs\newxottrunktest\website_code\php\user_library.php on line 42
Fatal error: Call to a member function getFirstname() on a non-object in
C:\xampp\htdocs\newxottrunktest\website_code\php\login_library.php on line
352
However if I then open and login to xot via a new tab those previous links
work.
If I then try to add a new resources I see the list of LO's but upon
choosing one I get the following error:
Fatal error: Call to undefined function session_status() in
C:\xampp\htdocs\newxottrunktest\LTI\ims-lti\UoN_LTI.php on line 54
I get the same error on the Cenos installation too.
If I close all browser windows and login to only moodle again the links
don't work again.
HTH
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 09 October 2012 13:44
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
Please update your copy from SVN as Ive added a patch that hopefully will
fix things (under some circumstances it looks like sessions didn't start so
I start it) this should hopefully fix the issue as the errors in line 37 &
42 are related to no data in the SESSIONS variable and as this was blank the
user data returned nothing and therefore in the login_processing2 function
it tried to query a non existent object as this was the action if it wasn't
set.
Let me know if this fixes thing.
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 08 October 2012 17:21
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
I've been going round and round the houses with this nearly all day :-( and
discovered there's a problem with my initial localhost test too. Here's what
happens locally and with your latest code in place...
1. I removed the external tool configuration from my localhost moodle 2
install and also removed all lti_resource and lti_user entries in the
newxottrunktest I've been using for testing as well as the moodle course
activities - so effectively starting again from scratch. The newxottrunktest
is using static for authentication.
2. Configured the external tool via moodle admin
3. Add an external tool activity in a moodle course and prompted to login to
newxottrunktest and select an LO - all fine at this point.
4. Close all browser windows and re-visit the Moodle course then click the
previous external activity link - with the error reporting lines in place I
get the following:
Notice: Undefined index: toolkits_logon_username in
C:\xampp\htdocs\newxottrunktest\website_code\php\user_library.php on line 37
Notice: Undefined index: toolkits_logon_username in
C:\xampp\htdocs\newxottrunktest\website_code\php\user_library.php on line 42
Fatal error: Call to a member function getFirstname() on a non-object in
C:\xampp\htdocs\newxottrunktest\website_code\php\login_library.php on line
352
So for me it's working when initially set up and logged in but upon closing
all browsers and logging in again it's broken. I was able to replicate the
same issue with the Centos installations too.
The other issue about not being able to see the option to add an LTI Key may
be related to the fact that the XOT installation I was using was using
Moodle for authentication. On the same server I've added a new test
installation using static for authentication and can see the option to add a
new key with that. I'll revisit that and confirm at some point but
interested to hear your thoughts on the main issue first.
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 08 October 2012 16:35
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
Im not exactly clear about what you are trying in the first part from the
description you have a php error. Just to be safe please grab the latest
off svn as Ive made a few updates to it today (but I don't think they should
affect this area). Does your database LTI tables exist?
To get the php errors to display to screen add the following lines after the
config.php include in LTI/index.php (about line 12).
error_reporting(E_ALL);
ini_set('display_errors',"ON");
This should then help to narrow down the issue
2nd point, Im can not see why same server as moodle would cause an issue. I
think it might be a misunderstanding in how to add a new key from the
management page. To add a new key: Goto management.php under "Site", Click
"View" next to "LTI settings" then "View" next to "LTI Keys" you will then
see an item called "New" and the text next to it will be "Add New LTI Key"
this will then display the form to add a new lti key.
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 08 October 2012 13:42
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
have you managed to get the LTI functionality to work on a live server
rather than localhost? I've tried to get this working on a Centos server
linking from that server to an XOT 1.8 installation on the same server and
also another server. When clicking save and display or following the link
added to a course I don't get prompted to login to XOT and just get what
appears to be a blank Iframe. Do any of the LTI files need special
permissions?
Also on the XOT installations on the same server as the Moodle I only see
the option to View LTI keys not Add a new key so I had to add the key and
secret direct to the db. Any idea why that might be?
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 03 October 2012 15:28
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
good point - I guess that's a real advantage in that if a teacher with
moodle course and XOT access has the relevant details they can still add an
XOT resource even if the Moodle admin hasn't set-up the specific external
tool.
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 03 October 2012 15:17
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
I have updated the documentation as suggested. As this is a landing page to
lti then the documentation on the moodle page makes sense.
If you put the full url into the url box on the specific instance then you
would get to the correct place. This means that if Xerte hasn't been setup
in moodle it can still be used you would just enter the information that you
entered under site administration on that specific instance.
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 03 October 2012 14:56
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
thanks the key difference was that tick box to 'show tool type when creating
tool instances'
With that ticked there's no need to add a url when adding an external tool
activity as long as the correct external tool is selected from the drop
down. Without it ticked it just goes to the login page. I hadn't ticked that
originally because the moodle help says:
In most cases, this option does not need to be selected. Teachers can use
this tool configuration based on the Launch URL matching the Tool base URL,
which is the preferred method. The only case in which this option should be
selected is if the tool configuration is just intended for single sign on.
For example, if all launches to the tool provider just take the user to a
landing page instead of to a specific resource.
If this is correct perhaps needs adding to the quick documentation?
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 03 October 2012 13:56
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
I think you haven't set up your moodle correctly. You can have it so moodle
is set only once with the Xerte Object under the LTI Administration[under
site administration] (I have included a screenshot from mine) once this is
set and the tick box below the custom parameters box is ticked then this
will show up in the usual adding a new external tool, type in an activity
Name then in the drop down box for external tool type choose the name you
gave the object under the site administration don't enter anything into the
launch url and just click save and display. This then means you just select
the external tool from the drop down XOT in your case, it suggest the XOT
hasn't been setup as I have said above, there is no reason to additionally
enter the url below this.
There is currently no support to create accounts in the lti additions, All
I do is call the authentication mechanism. For LDAP it will add users into
the logindetails table, for others I believe you would have to add code to
the authentication mechanism so that it could add to itself etc
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Julian Tenney
Sent: 03 October 2012 12:17
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
> In my new features slot on the 10th ok if I mention this and suggest
delegates speak to you if they have any questions?
Please do! I'll make a fresh zip, 1.81, the LTI release.
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 03 October 2012 12:08
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
thanks for the screenshots - very useful. All working well now! :-)
I had added the /lti/ when configuring via admin > plugins > activity
modules > external tool but I hadn't added a url or a url with /lti/ in the
end when adding an external tool activity to a course. Now that I've done
that it works great. It seems a shame that the Moodle settings can't
automatically pick up the correct url by selecting the name of the external
tool. e.g. If I select XOT as shown in the screenshot (the name I gave to
the external tool via admin) I still have to add the url with /lti/ appended
for the selection of an LO to work otherwise it just takes me to the
standard login screen. Not a problem for me but I can see it being a problem
where users just put what they know to be the installation url, or no url at
all, rather than knowing or remembering to add /lti/. I know this is more a
moodle limitation rather than any kind of limitation of what you've
developed which is great!
I guess once users know what to do via a guide or something then they should
remember and I guess in an institution it would be worth customising the
help for the external resource activity to show what url to add.
I can see awareness of LTI growing quickly over the next couple of years
especially where Moodle is used as the VLE. Does the functionality exist in
what you have developed to automatically create accounts from the consumer
e.g. if the XOT db was used to store accounts? I'm guessing not at the
moment but I could see that being very useful for OER collaborative projects
etc.
Great stuff!
In my new features slot on the 10th ok if I mention this and suggest
delegates speak to you if they have any questions?
Cheers
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 03 October 2012 11:08
To: For Xerte technical developers
Subject: [Xerte-dev] Re: LTI Provider
Ron,
Sorry about not mentioning to run upgrade.php I assumed (wrongly!) that
standard practice would be to run each time when upgrading code.
It should work with all the authentication methods, I had only used it
against LDAP. I have just switched to static as authentication and gone
through it and it appears to work as Id expect.
The steps will be (I have attached screen grabs to compare to)
1st you should get a login asking for username/password ( this will only
appear once) [Xerte-lti-1.png]
2nd you should get a screen with instructions on the left and list of
projects in the right with a select button at the bottom [Xerte-lti-2.png]
an empty workspace & [Xerte-lti-3.png] for workspace with some content.
The obvious thing I can think of is you didn't put the correct url into the
Tool Base URL, it should be the usual Xerte url with the addition of /LTI/
on the end as only this URL is configured to accept the LTI link
Simon
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Ron Mitchell
Sent: 03 October 2012 10:10
To: 'For Xerte technical developers'
Subject: [Xerte-dev] Re: LTI Provider
Hi Simon
thought I'd have a go at testing this for you but may be misunderstanding
how it works. Firstly will it only work with XOT configured for LDAP or
should it also work if XOT is set to static authentication?
Results of tests so far:
1. Realised I had to run upgrade.php to create the lti table - this worked
fine.
2. Adding a key and secret via management.php also worked fine.
3. Configuring the Moodle external tool via admin > manage plugins etc also
worked fine
4. Adding an external tool activity to a course and selecting save and
display simply launches the XOT login page and upon login shows the
workspace e.g. there isn't an option to select a specific LO for the link.
Is this because it won't work with static authentication or am I missing
something?
HTH
Ron
From: xerte-dev-bounces at lists.nottingham.ac.uk
[mailto:xerte-dev-bounces at lists.nottingham.ac.uk] On Behalf Of Simon Atack
Sent: 02 October 2012 17:14
To: xerte-dev at lists.nottingham.ac.uk
Subject: [Xerte-dev] LTI Provider
First thank you all for the welcome.
Yesterday I submitted to svn the LTI Provider integration function I have
been working on. This allow you to have launch Xerte from within a VLE
giving single sign on etc (In moodle this is the External Tool activity
plugin).
It handles the association between the LTI userid & the Xerte username (and
allows regular re-authentication) and then if staff lets you select the
project you want to associate the link with, and then displays the project
for subsequent launches of the link. It also includes LTI Key/Secret
Management in the main Xerte management interface.
I have tested it myself on my local box with a fresh install of Xerte
(configured for LDAP authentication) and Moodle 2.2.2+. I have tried to
keep the changes as few as possible to integrate it in (I have extended a
couple of functions to support extra parameters as well as factoring some
repeated lines into functions so there is only 1 copy doing anything). It
would be really useful if others could download it, test it out and give
feedback.
There is a very brief documentation file LTI Documentation.txt included with
a brief note of what you need to do, anyone having problems/or trouble
understanding how to get it working please get it touch.
The LTI library is based off the IMS sample code for LTI in php and extended
by UoN and has been used in the Rogo OSS project.
Thanks
Simon
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/20121016/820f6a0d/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2645 bytes
Desc: not available
URL: <http://lists.nottingham.ac.uk/pipermail/xerte-dev/attachments/20121016/820f6a0d/attachment-0001.jpg>
More information about the Xerte-dev
mailing list