e3f69b58a2
This commit introduces support to the LTI module for LTI 2.0. As well as the initial commit the following changes were made and then squashed into the single commit for integration: * Fixed bug in services Fixed bug which limited characters allowed in values of template variables (e.g. vendor ID) in service endpoints. Changed language file to refer to tool registrations rather than tool proxies. * Refactored service classes Moved classes relating to services into areas where Moodle will autoload them * Ran code through code checker Removed all errors reported by the Code checker module excluding third-party OAuth.php file. * UI improvements Mainly when adding an external tool to a course - fields which should not be changed for a selected tool are either hidden or disabled. Admin settings page now shows the Tool Registration name against a tool rather than the launch URL, and the registration URL replaces the GUID on the tool registrations page. * Updated tool proxy registration Added check of tool proxy to ensure only offered capabilities and services are included. Also check tool proxy when processing a service request. * Code review changes Some fixes based on code review by Mark Nielsen and addition of some PHPDocs comments. * Updates from code/PHPdocs checks Removed use of eval and corrected invalid PHPdocs for new functions/classes * Corrected namespace error and incorrect string terminator * Updates based on forum feedback Added dependencies and backup, restore and uninstall methods for ltiservice subplugins. Changed most uses of is_null to empty * Updated custom parameters test Updated test_split_custom_parameters to include new function parameters. Corrected PHPdoc entry for lti_split_custom_parameters Fixed incorrect line separators in ltiservice.php * Added require_capability to registrationreturn.php * SQL and EOL updates Moved PHP variable in SQL into a named parameter Improved checks for end-of-line characters to include CR and LF on their own or together * Check for semicolon separators Semicolon separators in custom parameters are changed to EOL characters when upgrading to the 2014100100 version. * Remove unused file basiclti.js file not being used so removed. * Adjust line lengths Split long lines in upgrade.php * Added savepoint to upgrade.php savepoint omitted from earlier update to upgrade.php * Updated namespaces and upgrade Service and resource classes moved into .../local/... Upgrade SQL moved into a function and unit test created * Updated lti_tool_proxies table Added indices and foreign keys to lti_tool_proxies table * Fixed formatting and documentation issues * ltiservice class moved into local * Replaced lti_scale_used comments Put back commented out code for lti_scale_used * Removed redundant sesskey code * Fixed namespace and path check Updated ltiservice namespace for move into local Added check for existence of $_SERVER['PATH_INFO'] * Updated upgrade code Added indices and keys to lti_tool_settings table when upgrading Fixed errors in upgradelib_test.php (thanks to jleyva) Update SQL to use Moodle functions * Use of empty with class method PHP 5.4 does not like the use of empty with a class method so saved the value to a variable first. PHP 5.5 seems to accept the use of a method with empty. * Removed redundant indices Removed creation of indices for foreign keys on lti_tool_settings table from install.xml and upgrade.php * Fixes based on feedback Minor changes and corrections based on review in JIRA * Fixed bug in toolproxy service Corrected bug which failed to respond properly to an invalid request Also updated upgrade.txt file * Improved admin navigation Added the manage tool registrations page as a separate entry on the admin menu (within a folder named LTI). Made this entry the current position for the related pages. * Updated PHPdocs with class names Added class names with namespaces to PHPdocs to replace generic references to "object" * Changed object to iframe Use of object tag in register.php changed to use an iframe tag in line with the similar update made to view.php. * Improved registration process A message is now displayed if the registration page has not been loaded in the iframe within 20 seconds. If a user is returned to Moodle without a tool proxy being sent, the registration is moved back from pending to configured. * Fixes for integration Removed comment - the template is the default path unless overridden, so get_path and get_template should both be defined. Added comment and intval to fix the issue with obtaining an error reason.
143 lines
11 KiB
XML
143 lines
11 KiB
XML
<?xml version="1.0" encoding="UTF-8" ?>
|
|
<XMLDB PATH="mod/lti/db" VERSION="20140612" COMMENT="XMLDB file for Moodle mod/lti"
|
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
|
>
|
|
<TABLES>
|
|
<TABLE NAME="lti" COMMENT="This table contains Basic LTI activities instances">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Course basiclti activity belongs to"/>
|
|
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="name field for moodle instances"/>
|
|
<FIELD NAME="intro" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="General introduction of the basiclti activity"/>
|
|
<FIELD NAME="introformat" TYPE="int" LENGTH="4" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Format of the intro field (MOODLE, HTML, MARKDOWN...)"/>
|
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
|
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
|
<FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Basic LTI type"/>
|
|
<FIELD NAME="toolurl" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Remote tool url"/>
|
|
<FIELD NAME="securetoolurl" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="instructorchoicesendname" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Send user's name"/>
|
|
<FIELD NAME="instructorchoicesendemailaddr" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Send user's email"/>
|
|
<FIELD NAME="instructorchoiceallowroster" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Allow the roster to be retrieved"/>
|
|
<FIELD NAME="instructorchoiceallowsetting" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Allow a tool to store a setting"/>
|
|
<FIELD NAME="instructorcustomparameters" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false" COMMENT="Additional custom parameters provided by the instructor"/>
|
|
<FIELD NAME="instructorchoiceacceptgrades" TYPE="int" LENGTH="1" NOTNULL="false" SEQUENCE="false" COMMENT="Accept grades from tool"/>
|
|
<FIELD NAME="grade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="100" SEQUENCE="false" COMMENT="Grade scale"/>
|
|
<FIELD NAME="launchcontainer" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Launch external tool in a pop-up"/>
|
|
<FIELD NAME="resourcekey" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="password" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="debuglaunch" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Enable the debug-style launch which pauses before auto-submit"/>
|
|
<FIELD NAME="showtitlelaunch" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
|
<FIELD NAME="showdescriptionlaunch" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
|
<FIELD NAME="servicesalt" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="icon" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="secureicon" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
</KEYS>
|
|
<INDEXES>
|
|
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
|
|
</INDEXES>
|
|
</TABLE>
|
|
<TABLE NAME="lti_tool_proxies" COMMENT="LTI tool proxy registrations">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="Tool Provider" SEQUENCE="false" COMMENT="Tool Provider name"/>
|
|
<FIELD NAME="regurl" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="state" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false" COMMENT="Configured = 1, Pending = 2, Accepted = 3, Rejected = 4, Cancelled = 5"/>
|
|
<FIELD NAME="guid" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="secret" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="vendorcode" TYPE="char" LENGTH="255" NOTNULL="false" SEQUENCE="false"/>
|
|
<FIELD NAME="capabilityoffered" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="List of capabilities offered, one per line"/>
|
|
<FIELD NAME="serviceoffered" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="List of services offered, one per line"/>
|
|
<FIELD NAME="toolproxy" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="JSON string representing tool proxy returned by tool provider"/>
|
|
<FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of user which initiated the registration process"/>
|
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Date/time at which the record was created"/>
|
|
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Date/time at which the record was last modified"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
</KEYS>
|
|
<INDEXES>
|
|
<INDEX NAME="guid" UNIQUE="true" FIELDS="guid"/>
|
|
</INDEXES>
|
|
</TABLE>
|
|
<TABLE NAME="lti_types" COMMENT="Basic LTI pre-configured activities">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" DEFAULT="basiclti Activity" SEQUENCE="false" COMMENT="Activity name"/>
|
|
<FIELD NAME="baseurl" TYPE="text" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="tooldomain" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="state" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="2" SEQUENCE="false" COMMENT="Active = 1, Pending = 2, Rejected = 3"/>
|
|
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="coursevisible" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
|
|
<FIELD NAME="toolproxyid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Primary key of related tool proxy (null for LTI 1 tools)"/>
|
|
<FIELD NAME="enabledcapability" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Enabled capabilities, one per line (null for LTI 1 tools)"/>
|
|
<FIELD NAME="parameter" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Launch parameters, one per line (null for LTI 1 tools)"/>
|
|
<FIELD NAME="icon" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="URL to icon file"/>
|
|
<FIELD NAME="secureicon" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Secure URL to icon file"/>
|
|
<FIELD NAME="createdby" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
</KEYS>
|
|
<INDEXES>
|
|
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
|
|
<INDEX NAME="tooldomain" UNIQUE="false" FIELDS="tooldomain"/>
|
|
</INDEXES>
|
|
</TABLE>
|
|
<TABLE NAME="lti_types_config" COMMENT="Basic LTI types configuration">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="typeid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Basic LTI type id"/>
|
|
<FIELD NAME="name" TYPE="char" LENGTH="100" NOTNULL="true" SEQUENCE="false" COMMENT="Basic LTI param"/>
|
|
<FIELD NAME="value" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="Param value"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
</KEYS>
|
|
<INDEXES>
|
|
<INDEX NAME="typeid" UNIQUE="false" FIELDS="typeid"/>
|
|
</INDEXES>
|
|
</TABLE>
|
|
<TABLE NAME="lti_tool_settings" COMMENT="LTI tool setting values">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="toolproxyid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Primary key of related tool proxy"/>
|
|
<FIELD NAME="course" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Primary key of course (null for system-wide settings)"/>
|
|
<FIELD NAME="coursemoduleid" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="Primary key of course module - tool link added to course (null for system-wide and context-wide settings)"/>
|
|
<FIELD NAME="settings" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Setting values as JSON"/>
|
|
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Date/time at which the record was created"/>
|
|
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Date/time at which the record was last modified"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
<KEY NAME="toolproxy" TYPE="foreign" FIELDS="toolproxyid" REFTABLE="lti_tool_proxies" REFFIELDS="id" COMMENT="The tool proxy to which the setting relates"/>
|
|
<KEY NAME="course" TYPE="foreign" FIELDS="course" REFTABLE="course" REFFIELDS="id" COMMENT="The course to which the setting relates"/>
|
|
<KEY NAME="coursemodule" TYPE="foreign" FIELDS="coursemoduleid" REFTABLE="lti" REFFIELDS="id" COMMENT="The module instance to which the setting relates"/>
|
|
</KEYS>
|
|
</TABLE>
|
|
<TABLE NAME="lti_submission" COMMENT="Keeps track of individual submissions for LTI activities.">
|
|
<FIELDS>
|
|
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
|
|
<FIELD NAME="ltiid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="ID of the LTI tool instance"/>
|
|
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="datesubmitted" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="dateupdated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="gradepercent" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5"/>
|
|
<FIELD NAME="originalgrade" TYPE="number" LENGTH="10" NOTNULL="true" SEQUENCE="false" DECIMALS="5"/>
|
|
<FIELD NAME="launchid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false"/>
|
|
<FIELD NAME="state" TYPE="int" LENGTH="2" NOTNULL="true" SEQUENCE="false"/>
|
|
</FIELDS>
|
|
<KEYS>
|
|
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
|
|
</KEYS>
|
|
<INDEXES>
|
|
<INDEX NAME="ltiid" UNIQUE="false" FIELDS="ltiid"/>
|
|
</INDEXES>
|
|
</TABLE>
|
|
</TABLES>
|
|
</XMLDB> |