Merge branch 'MDL-41810_master' of https://github.com/totara/openbadges
Conflicts: badges/upgrade.txt
This commit is contained in:
@@ -45,7 +45,7 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('html', html_writer::tag('span', '', array('class' => 'notconnected', 'id' => 'connection-error')));
|
||||
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
|
||||
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
|
||||
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);
|
||||
$mform->addElement('static', 'url', get_string('url'), 'http://' . BADGE_BACKPACKURL);
|
||||
$status = html_writer::tag('span', get_string('notconnected', 'badges'),
|
||||
array('class' => 'notconnected', 'id' => 'connection-status'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
@@ -67,7 +67,7 @@ class edit_backpack_form extends moodleform {
|
||||
$mform->addElement('hidden', 'userid', $USER->id);
|
||||
$mform->setType('userid', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'backpackurl', BADGE_BACKPACKURL);
|
||||
$mform->addElement('hidden', 'backpackurl', 'http://' . BADGE_BACKPACKURL);
|
||||
$mform->setType('backpackurl', PARAM_URL);
|
||||
|
||||
}
|
||||
@@ -118,7 +118,7 @@ class edit_collections_form extends moodleform {
|
||||
|
||||
$mform->addElement('header', 'backpackheader', get_string('backpackconnection', 'badges'));
|
||||
$mform->addHelpButton('backpackheader', 'backpackconnection', 'badges');
|
||||
$mform->addElement('static', 'url', get_string('url'), BADGE_BACKPACKURL);
|
||||
$mform->addElement('static', 'url', get_string('url'), 'http://' . BADGE_BACKPACKURL);
|
||||
|
||||
$status = html_writer::tag('span', get_string('connected', 'badges'), array('class' => 'connected'));
|
||||
$mform->addElement('static', 'status', get_string('status'), $status);
|
||||
|
||||
@@ -29,6 +29,7 @@ define('AJAX_SCRIPT', true);
|
||||
require_once(dirname(dirname(__FILE__)) . '/config.php');
|
||||
require_once($CFG->dirroot . '/badges/lib/backpacklib.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
require_once($CFG->libdir . '/badgeslib.php');
|
||||
|
||||
require_sesskey();
|
||||
require_login();
|
||||
@@ -86,7 +87,7 @@ if (!isset($data->status) || $data->status != 'okay') {
|
||||
|
||||
// Make sure email matches a backpack.
|
||||
$check = new stdClass();
|
||||
$check->backpackurl = BADGE_BACKPACKURL;
|
||||
$check->backpackurl = 'http://' . BADGE_BACKPACKURL;
|
||||
$check->email = $data->email;
|
||||
|
||||
$bp = new OpenBadgesBackpackHandler($check);
|
||||
@@ -105,7 +106,7 @@ if (isset($request->status) && $request->status == 'missing') {
|
||||
$obj = new stdClass();
|
||||
$obj->userid = $USER->id;
|
||||
$obj->email = $data->email;
|
||||
$obj->backpackurl = BADGE_BACKPACKURL;
|
||||
$obj->backpackurl = 'http://' . BADGE_BACKPACKURL;
|
||||
$obj->backpackuid = $backpackuid;
|
||||
$obj->autosync = 0;
|
||||
$obj->password = '';
|
||||
|
||||
@@ -26,12 +26,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
/*
|
||||
* URL of backpack. Currently only the Open Badges backpack
|
||||
* is supported.
|
||||
*/
|
||||
define('BADGE_BACKPACKURL', 'http://backpack.openbadges.org');
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
|
||||
@@ -13,3 +13,5 @@ information provided here is intended especially for developers.
|
||||
allows to indicate that a badge should be archived instead of fully deleted.
|
||||
If this parameter is set to FALSE, a badge will all its information, criteria,
|
||||
and awards will be removed from the database.
|
||||
* BADGE_BACKPACKURL constant has been moved from badges/lib/backpacklib.php to lib/badgeslib.php, and URI scheme
|
||||
name ('http://') has been removed.
|
||||
|
||||
+8
-3
@@ -93,6 +93,11 @@ define('BADGE_MESSAGE_DAILY', 2);
|
||||
define('BADGE_MESSAGE_WEEKLY', 3);
|
||||
define('BADGE_MESSAGE_MONTHLY', 4);
|
||||
|
||||
/*
|
||||
* URL of backpack. Currently only the Open Badges backpack is supported.
|
||||
*/
|
||||
define('BADGE_BACKPACKURL', 'backpack.openbadges.org');
|
||||
|
||||
/**
|
||||
* Class that represents badge.
|
||||
*
|
||||
@@ -1177,7 +1182,7 @@ function badges_check_backpack_accessibility() {
|
||||
// Using fake assertion url to check whether backpack can access the web site.
|
||||
$fakeassertion = new moodle_url('/badges/assertion.php', array('b' => 'abcd1234567890'));
|
||||
|
||||
// Curl request to http://backpack.openbadges.org/baker.
|
||||
// Curl request to backpack baker.
|
||||
$curl = new curl();
|
||||
$options = array(
|
||||
'FRESH_CONNECT' => true,
|
||||
@@ -1185,7 +1190,7 @@ function badges_check_backpack_accessibility() {
|
||||
'HEADER' => 0,
|
||||
'CONNECTTIMEOUT' => 2,
|
||||
);
|
||||
$location = 'http://backpack.openbadges.org/baker';
|
||||
$location = 'http://' . BADGE_BACKPACKURL . '/baker';
|
||||
$out = $curl->get($location, array('assertion' => $fakeassertion->out(false)), $options);
|
||||
|
||||
$data = json_decode($out);
|
||||
@@ -1254,7 +1259,7 @@ function badges_setup_backpack_js() {
|
||||
if (!empty($CFG->badges_allowexternalbackpack)) {
|
||||
$PAGE->requires->string_for_js('error:backpackproblem', 'badges');
|
||||
$protocol = (strpos($CFG->wwwroot, 'https://') === 0) ? 'https://' : 'http://';
|
||||
$PAGE->requires->js(new moodle_url($protocol . 'backpack.openbadges.org/issuer.js'), true);
|
||||
$PAGE->requires->js(new moodle_url($protocol . BADGE_BACKPACKURL . '/issuer.js'), true);
|
||||
$PAGE->requires->js('/badges/backpack.js', true);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user