Skip to content

Commit

Permalink
MDL-66118 hub: Remove the mentions of moodle.net
Browse files Browse the repository at this point in the history
This is an update of the site registration admin page and some relevant
backend code to remove the mentions of moodle.net.

AMOS BEGIN
 CPY [registerwithmoodleorg,core_admin],[registerwithmoodleorg,core_hub]
AMOS END
  • Loading branch information
mudrd8mz committed Oct 4, 2019
1 parent 3bef0a6 commit 71f49c9
Show file tree
Hide file tree
Showing 12 changed files with 92 additions and 58 deletions.
2 changes: 1 addition & 1 deletion admin/registration/confirmregistration.php
Expand Up @@ -46,7 +46,7 @@
admin_externalpage_setup('registrationmoodleorg');

if ($url !== HUB_MOODLEORGHUBURL) {
// Allow other plugins to confirm registration on hubs other than moodle.net . Plugins implementing this
// Allow other plugins to confirm registration on custom hubs. Plugins implementing this
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
$callbacks = get_plugins_with_function('hub_registration');
foreach ($callbacks as $plugintype => $plugins) {
Expand Down
3 changes: 1 addition & 2 deletions admin/registration/forms.php
Expand Up @@ -32,5 +32,4 @@

defined('MOODLE_INTERNAL') || die();

debugging('Support for alternative hubs has been removed from Moodle in 3.4. For communication with moodle.net ' .
'see lib/classes/hub/ .', DEBUG_DEVELOPER);
debugging('Support for alternative hubs has been removed from Moodle in 3.4.', DEBUG_DEVELOPER);
12 changes: 6 additions & 6 deletions admin/registration/index.php
Expand Up @@ -22,7 +22,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
*
* This page displays the site registration form for Moodle.net.
* This page displays the site registration form.
* It handles redirection to the hub to continue the registration workflow process.
* It also handles update operation by web service.
*/
Expand All @@ -48,7 +48,7 @@
}

echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', 'Moodle.net'), 3, 'main');
echo $OUTPUT->heading(get_string('registerwithmoodleorgremove', 'core_hub'), 3, 'main');
$siteunregistrationform->display();
echo $OUTPUT->footer();
exit;
Expand Down Expand Up @@ -82,7 +82,7 @@

echo $OUTPUT->header();

// Current status of registration on Moodle.net.
// Current status of registration.

$notificationtype = \core\output\notification::NOTIFY_ERROR;
if (\core\hub\registration::is_registered()) {
Expand All @@ -104,11 +104,11 @@

// Heading.
if (\core\hub\registration::is_registered()) {
echo $OUTPUT->heading(get_string('updatesite', 'hub', 'Moodle.net'));
echo $OUTPUT->heading(get_string('registerwithmoodleorgupdate', 'core_hub'));
} else if ($isinitialregistration) {
echo $OUTPUT->heading(get_string('completeregistration', 'hub'));
echo $OUTPUT->heading(get_string('registerwithmoodleorgcomplete', 'core_hub'));
} else {
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'core_hub'));
}

$renderer = $PAGE->get_renderer('core', 'admin');
Expand Down
4 changes: 2 additions & 2 deletions admin/registration/renewregistration.php
Expand Up @@ -40,7 +40,7 @@
admin_externalpage_setup('registrationmoodleorg');

if ($url !== HUB_MOODLEORGHUBURL) {
// Allow other plugins to renew registration on hubs other than moodle.net . Plugins implementing this
// Allow other plugins to renew registration on custom hubs. Plugins implementing this
// callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration .
$callbacks = get_plugins_with_function('hub_registration');
foreach ($callbacks as $plugintype => $plugins) {
Expand All @@ -56,7 +56,7 @@

echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
$hublink = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
$hublink = html_writer::tag('a', HUB_MOODLEORGHUBURL, array('href' => HUB_MOODLEORGHUBURL));

$deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);

Expand Down
23 changes: 22 additions & 1 deletion admin/renderer.php
Expand Up @@ -2092,6 +2092,27 @@ protected function legacy_log_store_writing_error() {
* @return string
*/
public function moodleorg_registration_message() {
return format_text(get_string('registermoodlenet', 'admin'), FORMAT_HTML, ['noclean' => true]);

$out = format_text(get_string('registerwithmoodleorginfo', 'core_hub'), FORMAT_MARKDOWN);

$out .= html_writer::link(
new moodle_url('/admin/settings.php', ['section' => 'moodleservices']),
$this->output->pix_icon('i/info', '').' '.get_string('registerwithmoodleorginfoapp', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);

$out .= html_writer::link(
HUB_MOODLEORGHUBURL,
$this->output->pix_icon('i/stats', '').' '.get_string('registerwithmoodleorginfostats', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);

$out .= html_writer::link(
HUB_MOODLEORGHUBURL.'/sites',
$this->output->pix_icon('i/location', '').' '.get_string('registerwithmoodleorginfosites', 'core_hub'),
['class' => 'btn btn-link', 'role' => 'opener', 'target' => '_href']
);

return $this->output->box($out);
}
}
Expand Up @@ -75,7 +75,7 @@ public function __construct(context $pagecontext) {
);
$this->navigation[] = $addpage;
$competenciesrepository = new single_button(
new moodle_url('https://moodle.net/competencies'),
new moodle_url('https://archive.moodle.net/competencies'),
get_string('competencyframeworksrepository', 'tool_lp'),
'get'
);
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/usertours/classes/manager.php
Expand Up @@ -257,7 +257,7 @@ protected function print_tour_list() {
'title' => get_string('importtour', 'tool_usertours'),
],
(object) [
'link' => new \moodle_url('https://moodle.net/tours'),
'link' => new \moodle_url('https://archive.moodle.net/tours'),
'linkproperties' => [
'target' => '_blank',
],
Expand Down
22 changes: 18 additions & 4 deletions lang/en/hub.php
Expand Up @@ -76,7 +76,7 @@
$string['errorcourseinfo'] = 'An error occurred when retrieving course metadata from {$a}. Please try again to retrieve the course metadata by reloading this page later. Otherwise you can decide to continue the registration process with the following default metadata. ';
$string['errorcoursepublish'] = 'An error occurred during the course publication ({$a}). Please try again later.';
$string['errorcoursewronglypublished'] = 'A publication error has been returned by Moodle.net. Please try again later.';
$string['errorotherhubsnotsupported'] = 'This page can no longer be used for registration with sites other than Moodle.net';
$string['errorotherhubsnotsupported'] = 'This page can no longer be used for registration with custom sites directories.';
$string['errorregistration'] = 'An error occurred during registration, please try again later. ({$a})';
$string['errorunpublishcourses'] = 'Due to an unexpected error, the courses could not be deleted from Moodle.net. Try again later (recommended) or contact Moodle.net administrator.';
$string['errorws'] = '{$a}';
Expand Down Expand Up @@ -113,7 +113,7 @@
$string['operation'] = 'Actions';
$string['participantnumberaverage'] = 'Average number of participants ({$a})';
$string['policyagreed'] = 'Privacy notice and data processing agreement';
$string['policyagreeddesc'] = 'I agree to the <a href="{$a}" target="_blank">Privacy notice and data processing agreement</a> for Moodle.net';
$string['policyagreeddesc'] = 'I agree to the <a href="{$a}" target="_blank">Privacy notice and data processing agreement</a>';
$string['postaladdress'] = 'Postal address';
$string['postaladdress_help'] = 'Postal address of this site, or of the entity represented by this site.';
$string['postsnumber'] = 'Number of posts ({$a})';
Expand All @@ -134,6 +134,19 @@
$string['registereduserdevices'] = 'Number of users with registered mobile devices ({$a})';
$string['registeredactiveuserdevices'] = 'Number of active users with registered mobile devices which are receiving notifications ({$a})';
$string['registersite'] = 'Register with {$a}';
$string['registerwithmoodleorg'] = 'Register your site';
$string['registerwithmoodleorgupdate'] = 'Update your site registration';
$string['registerwithmoodleorgcomplete'] = 'Complete your site registration';
$string['registerwithmoodleorginfo'] = 'We\'d love to stay in touch and provide you with important things for your Moodle site! By registering:
* You can subscribe to receive notifications of new Moodle releases, security alerts and other important news.
* You can access and activate mobile push notifications from your Moodle site through our free Moodle app.
* You are contributing to our Moodle statistics of the worldwide community, which help us improve Moodle and our community sites.
* If you wish, your site can be included in the list of registered Moodle sites in your country.';
$string['registerwithmoodleorginfoapp'] = 'About the Moodle app';
$string['registerwithmoodleorginfostats'] = 'Moodle statistics';
$string['registerwithmoodleorginfosites'] = 'Other sites in my country';
$string['registerwithmoodleorgremove'] = 'Unregistering your site';
$string['registrationconfirmed'] = 'Site registration confirmed';
$string['registrationconfirmedon'] = 'Thank you for registering your site. Registration information will be kept up to date by the \'Site registration\' scheduled task.';
$string['removefromhub'] = 'Remove from Moodle.net';
Expand Down Expand Up @@ -209,10 +222,11 @@
$string['unregistrationerror'] = 'An error occurred when the site tried to unregister from Moodle.net: {$a}';
$string['update'] = 'Update';
$string['updatesite'] = 'Update registration on {$a}';
$string['updatesiteregistration'] = 'Update registration';
$string['updatestatus'] = 'Check it now.';
$string['usedifferentemail'] = 'Use different email';
$string['unregisterexplained'] = 'If the site with URL {$a} is registered on Moodle.net its registration will be removed.';
$string['urlalreadyregistered'] = 'Your site seems to be already registered on Moodle.net, which means something has gone wrong. Please contact the Moodle.net administrator to reset your registration so you can try again.';
$string['unregisterexplained'] = 'If the site with URL {$a} is registered, then its registration will be removed.';
$string['urlalreadyregistered'] = 'Your site seems to be already registered, which means something has gone wrong. Please contact the Moodle.net administrator to reset your registration so you can try again.';
$string['usersnumber'] = 'Number of users ({$a})';
$string['wrongtoken'] = 'The registration failed for some unknown reason (network?). Please try again.';

Expand Down
36 changes: 18 additions & 18 deletions lib/classes/hub/api.php
Expand Up @@ -33,7 +33,7 @@
use moodle_url;

/**
* Methods to communicate with moodle.net web services
* Provides methods to communicate with the hub (sites directory) web services.
*
* @package core
* @copyright 2017 Marina Glancy
Expand All @@ -51,11 +51,11 @@ class api {
const HUB_BACKUP_FILE_TYPE = 'backup';

/**
* Calls moodle.net WS
* Calls a remote function exposed via web services on the hub.
*
* @param string $function name of WS function
* @param array $data parameters of WS function
* @param bool $allowpublic allow request without moodle.net registration
* @param bool $allowpublic allow request without registration on the hub
* @return mixed depends on the function
* @throws moodle_exception
*/
Expand All @@ -71,7 +71,7 @@ protected static function call($function, array $data = [], $allowpublic = false
}

/**
* Performs REST request to moodle.net (using GET method)
* Performs a REST request to the hub site (using the GET method).
*
* @param string $token
* @param string $function
Expand All @@ -94,7 +94,7 @@ protected static function call_rest($token, $function, array $data) {
// Connection error.
throw new moodle_exception('errorconnect', 'hub', '', $curl->error);
} else if (isset($curloutput['exception'])) {
// Exception occurred on moodle.net .
// Exception occurred on the remote side.
self::process_curl_exception($token, $curloutput);
} else if ($info['http_code'] != 200) {
throw new moodle_exception('errorconnect', 'hub', '', $info['http_code']);
Expand All @@ -104,7 +104,7 @@ protected static function call_rest($token, $function, array $data) {
}

/**
* Analyses exception received from moodle.net
* Analyses exception received from the hub server.
*
* @param string $token token used for CURL request
* @param array $curloutput output from CURL request
Expand All @@ -127,7 +127,7 @@ protected static function process_curl_exception($token, $curloutput) {
}

/**
* Update site registration on moodle.net
* Update site registration on the hub.
*
* @param array $siteinfo
* @throws moodle_exception
Expand All @@ -138,20 +138,20 @@ public static function update_registration(array $siteinfo) {
}

/**
* Returns information about moodle.net
* Returns information about the hub.
*
* Example of the return array:
* {
* "courses": 384,
* "description": "Moodle.net connects you with free content and courses shared by Moodle ...",
* "downloadablecourses": 190,
* "enrollablecourses": 194,
* "description": "Official Moodle sites directory.",
* "downloadablecourses": 0,
* "enrollablecourses": 0,
* "hublogo": 1,
* "language": "en",
* "name": "Moodle.net",
* "name": "moodle",
* "sites": 274175,
* "url": "https://moodle.net",
* "imgurl": "https://moodle.net/local/hub/webservice/download.php?filetype=hubscreenshot"
* "url": "https://stats.moodle.org",
* "imgurl": "https://stats.moodle.org/local/hub/webservice/download.php?filetype=hubscreenshot"
* }
*
* @return array
Expand Down Expand Up @@ -357,7 +357,7 @@ public static function unregister_courses($courseids) {
*
* @param array|\stdClass $courseinfo
* @return int id of the published course on the hub
* @throws moodle_exception if communication to moodle.net failed or course could not be published
* @throws moodle_exception if the communication with the hub failed or the course could not be published
*/
public static function register_course($courseinfo) {
$params = array('courses' => array($courseinfo));
Expand All @@ -371,7 +371,7 @@ public static function register_course($courseinfo) {
/**
* Uploads a screenshot for the published course
*
* @param int $hubcourseid id of the published course on moodle.net, it must be published from this site
* @param int $hubcourseid id of the published course on the hub, it must be published from this site
* @param \stored_file $file
* @param int $screenshotnumber ordinal number of the screenshot
*/
Expand All @@ -390,7 +390,7 @@ public static function add_screenshot($hubcourseid, \stored_file $file, $screens
/**
* Downloads course backup
*
* @param int $hubcourseid id of the course on moodle.net
* @param int $hubcourseid id of the course on the hub
* @param string $path local path (in tempdir) to save the downloaded backup to.
*/
public static function download_course_backup($hubcourseid, $path) {
Expand All @@ -414,7 +414,7 @@ public static function download_course_backup($hubcourseid, $path) {
/**
* Uploads a course backup
*
* @param int $hubcourseid id of the published course on moodle.net, it must be published from this site
* @param int $hubcourseid id of the published course on the hub, it must be published from this site
* @param \stored_file $backupfile
*/
public static function upload_course_backup($hubcourseid, \stored_file $backupfile) {
Expand Down

0 comments on commit 71f49c9

Please sign in to comment.