Merge branch 'MDL-68328-dlfix' of https://github.com/cengage/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2020-05-01 00:32:00 +02:00
commit fd0344e388

View File

@ -63,10 +63,10 @@ class mod_lti_mod_form extends moodleform_mod {
// Type ID parameter being passed when adding an preconfigured tool from activity chooser.
$typeid = optional_param('typeid', false, PARAM_INT);
$showoptions = has_capability('mod/lti:addmanualinstance', $this->context);
// Show configuration details only if not preset (when new) or user has the capabilities to do so (when editing).
if ($this->_instance) {
$showtypes = has_capability('mod/lti:addpreconfiguredinstance', $this->context);
$showoptions = has_capability('mod/lti:addmanualinstance', $this->context);
if (!$showoptions && $this->current->typeid == 0) {
// If you cannot add a manual instance and this is already a manual instance, then
// remove the 'types' selector.
@ -74,7 +74,6 @@ class mod_lti_mod_form extends moodleform_mod {
}
} else {
$showtypes = !$typeid;
$showoptions = !$typeid && has_capability('mod/lti:addmanualinstance', $this->context);
}
$this->typeid = 0;
@ -202,9 +201,15 @@ class mod_lti_mod_form extends moodleform_mod {
$mform->setAdvanced('securetoolurl');
$mform->addHelpButton('securetoolurl', 'secure_launch_url', 'lti');
$mform->hideIf('securetoolurl', 'typeid', 'in', $noncontentitemtypes);
} else {
// We still need those on page to support deep linking return, but hidden to avoid instructor modification.
$mform->addElement('hidden', 'toolurl', '', array('id' => 'id_toolurl'));
$mform->setType('toolurl', PARAM_URL);
$mform->addElement('hidden', 'securetoolurl', '', array('id' => 'id_securetoolurl'));
$mform->setType('securetoolurl', PARAM_URL);
}
$mform->addElement('hidden', 'urlmatchedtypeid', '', array( 'id' => 'id_urlmatchedtypeid' ));
$mform->addElement('hidden', 'urlmatchedtypeid', '', array('id' => 'id_urlmatchedtypeid'));
$mform->setType('urlmatchedtypeid', PARAM_INT);
$launchoptions = array();
@ -250,6 +255,14 @@ class mod_lti_mod_form extends moodleform_mod {
$mform->setAdvanced('secureicon');
$mform->addHelpButton('secureicon', 'secure_icon_url', 'lti');
$mform->hideIf('secureicon', 'typeid', 'in', $noncontentitemtypes);
} else {
// Keep those in the form to allow deep linking, key and secret are removed altogether.
$mform->addElement('hidden', 'instructorcustomparameters', '', array('id' => 'id_instructorcustomparameters'));
$mform->setType('instructorcustomparameters', PARAM_TEXT);
$mform->addElement('hidden', 'icon', '', array('id' => 'id_icon'));
$mform->setType('icon', PARAM_URL);
$mform->addElement('hidden', 'secureicon', '', array('id' => 'id_secureicon'));
$mform->setType('secureicon', PARAM_URL);
}
// Add privacy preferences fieldset where users choose whether to send their data.