Skip to content

Commit

Permalink
MDL-69863 tool_brickfield: Language improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
mchurchward authored and stronk7 committed May 4, 2021
1 parent ad1a600 commit 623c1b0
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 23 deletions.
11 changes: 7 additions & 4 deletions admin/tool/brickfield/classes/form/registration_form.php
Expand Up @@ -60,9 +60,6 @@ public function definition() {
$hash = $registration->get_secret_key();

$mform->addElement('header', 'activationheader', get_string('activationheader', manager::PLUGINNAME));
$mform->addElement('static', 'siteinfosummary', '', get_string('activationinfo', manager::PLUGINNAME,
'<a href="' . $registration->get_regurl() . '" data-action="send_info" target="_blank">'));

$mform->addElement('text', 'key', get_string('secretkey', manager::PLUGINNAME));
$mform->setType('key', PARAM_TEXT);
$mform->setDefault('key', !empty($key) ? $key : '');
Expand All @@ -77,10 +74,12 @@ public function definition() {
$mform->addElement('static', 'siteinfosummary', '',
get_string('sendfollowinginfo', manager::PLUGINNAME, $info->moreinfostring));

$mform->addElement('hidden', 'lang', $info->language);
$mform->addElement('hidden', 'lang', $info->languagecode);
$mform->setType('lang', PARAM_TEXT);
$mform->addElement('hidden', 'countrycode', $info->country);
$mform->setType('countrycode', PARAM_TEXT);
$mform->addElement('hidden', 'url', $info->url);
$mform->setType('url', PARAM_URL);

$this->add_action_buttons(false, get_string('activate', manager::PLUGINNAME, '#'));
}
Expand All @@ -99,6 +98,7 @@ protected function get_defaultinfo(): stdClass {
$data->name = $site->fullname;
$data->url = $CFG->wwwroot;
$data->language = get_string('thislanguage', 'langconfig');
$data->languagecode = $admin->lang ?: $CFG->lang;
$data->country = $admin->country ?: $CFG->country;
$data->email = $admin->email;
$data->moreinfo = self::get_moreinfo();
Expand All @@ -125,6 +125,9 @@ private static function get_moreinfo(): array {
$moreinfo['numfactivities'] = $DB->count_records('course_modules');
$moreinfo['mobileservice'] = empty($CFG->enablemobilewebservice) ? 0 : $CFG->enablemobilewebservice;
$moreinfo['usersmobileregistered'] = $DB->count_records('user_devices');
$moreinfo['contentyperesults'] = '';
$moreinfo['contenttypeerrors'] = '';
$moreinfo['percheckerrors'] = '';
return $moreinfo;
}

Expand Down
13 changes: 12 additions & 1 deletion admin/tool/brickfield/classes/registration.php
Expand Up @@ -86,7 +86,10 @@ class registration {
protected $siteid;

/** @var string The URL to register at. */
private static $regurl = 'https://account.mybrickfield.ie/';
private static $regurl = 'https://account.mybrickfield.ie/register';

/** @var string The URL to view terms at. */
private static $termsurl = 'https://account.mybrickfield.ie/terms';

/**
* Object registration constructor.
Expand Down Expand Up @@ -254,6 +257,14 @@ public function get_regurl(): string {
return self::$regurl;
}

/**
* Get the terms and conditions URL.
* @return string
*/
public function get_termsurl(): string {
return self::$termsurl;
}

/**
* Perform all actions needed to note that the summary data was sent.
*/
Expand Down
20 changes: 10 additions & 10 deletions admin/tool/brickfield/lang/en/tool_brickfield.php
Expand Up @@ -28,7 +28,7 @@
$string['pluginname'] = 'Accessibility toolkit';
$string['accessibility'] = 'Accessibility';
$string['accessibilitydisabled'] = 'The Brickfield accessibility toolkit is not enabled on this site. Contact your site administrator to enable.';
$string['accessibilityreport'] = 'Accessibility report';
$string['accessibilityreport'] = 'Accessibility toolkit';
$string['analysistype'] = 'Enable analysis requests';
$string['analysistypedisabled'] = 'Content analysis is disabled';
$string['analysistype_desc'] = 'Prevent content analysis from being requested';
Expand Down Expand Up @@ -96,7 +96,7 @@
$string['noerrorsfound'] = 'No common accessibility errors were found for your search parameters, congratulations!';
$string['norecords'] = 'No relevant records were found for your search parameters.';
$string['notregistered'] = 'Your accessibility toolkit needs to be registered.';
$string['notvalidated'] = 'Your accessibility toolkit is still being validated.';
$string['notvalidated'] = 'Your accessibility toolkit is functional while being validated.';
$string['numinstances'] = 'Number of instances';
$string['pagedesc:checktype'] = '<p>In order to summarise and analyse the results of the various checks conducted, we group these checks into different content types. Hence, all image-related accessibility check results are in the "Image" content type group, all layout-related accessibility check results are in the "Layout" content type group, and so on.</p><p>Activities are included as either activities, resources or content areas relating to the courses themselves.</p><p>The content type chart page displays the error breakdown per content type group: Image, Layout, Link, Media, Table, and Text.</p>';
$string['pagedesc:pertarget'] = '<p>In order to summarise and analyse the check results per activity, we group these check results into the different activities detected.</p><p>Activities are included as either activities, resources, or other content areas relating to the courses themselves. Each activity with no detected errors is counted as passed, each activity with one or more detected errors is counted as failed. The ratio of passed to failed activities is then displayed.</p><p>The activity breakdown chart page displays the ratio of passed to failed instances in total, per activity, such as assignment, course, label etc.</p>';
Expand All @@ -109,10 +109,7 @@
$string['privacy:metadata'] = 'The Accessibility checks report plugin does not store any personal data.';
$string['processanalysisrequests'] = 'Process content analysis requests';
$string['registernow'] = 'Please register now.';
$string['registrationinfo'] = '<p>This registration process allows you to use the Brickfield accessibility toolkit freemium version
for your registered Moodle site.</p>
<p>This usage is subject to these {$a} and which you agree to, by using this
product.</p>';
$string['registrationinfo'] = '<p>This registration process allows you to use the Brickfield accessibility toolkit freemium version for your registered Moodle site.</p><p>This usage is subject to these <a href="{$a}" target="_blank">terms and conditions (opens in new window)</a> and which you agree to, by using this product.</p>';
$string['remaining'] = ' ({$a} errors remaining)';
$string['response:0'] = 'This URL doesn\'t point anywhere';
$string['response:404'] = 'This URL page was not found';
Expand All @@ -122,7 +119,7 @@
$string['schedule:scheduled'] = 'This course has been scheduled for analysis.';
$string['schedule:sitenotscheduled'] = 'The global (course independent) content has not yet been scheduled for analysis, to find common accessibility issues.</p><p>By clicking on the "Submit for analysis" button, you confirm that you want all your relevant global (course independant) content to be scheduled for analysis.</p><p>This analysis will conduct multiple common accessibility checks on this content, and those results will then display on these Accessibility toolkit report pages.</p><p>Please view the <a href="{$a}">Accessibility toolkit help page</a> for further details.</p><p>This analysis will be processed in the background, by the Moodle scheduled tasks, so its speed of completion will depend on task timings and task run schedules.';
$string['schedule:sitescheduled'] = 'The global (course independent) content has been scheduled for analysis.';
$string['settings'] = 'Accessibility tool settings';
$string['settings'] = 'Accessibility toolkit settings';
$string['taberrors'] = 'Check Errors';
$string['targetavetitle'] = 'Average errors per activity';
$string['targetpercentage'] = 'Percentage of instances passed/not per activity';
Expand Down Expand Up @@ -207,13 +204,15 @@
$string['activated'] = 'The plugin is activated and ready to use.';
$string['activationform'] = 'Brickfield registration';
$string['activationheader'] = 'Brickfield activation';
$string['activationinfo'] = 'In order to use this plugin, you must be registered, or have a valid code for this platform. If you are not already registered, please {$a}register your details</a>. <br />After registration, <b>you will then have online access to the keys</b> that you must submit in this form. <br />Registration validation is then triggered by running the Accessibility toolkit cron scheduled tasks.';
$string['activationinfo'] = '<p>In order to use this plugin, you must provide valid keys for this site in this form.</p><p>Please {$a}register your details (opens in new window)</a> to receive those keys if you do not already have them. </p><p>Once activated, your keys will then be validated via scheduled cron tasks.</p>';
$string['automatedsentdaily'] = '';
$string['contenttypeerrors'] = 'Total results of activity content tests per course and per content type.';
$string['contentyperesults'] = 'Total passed/failed for content areas per course.';
$string['country'] = 'Country';
$string['country_help'] = 'Country of the site';
$string['hashcorrect'] = 'The entered code is correct.';
$string['hashincorrect'] = 'The entered code is not correct.';
$string['inactive'] = 'The plugin is inactive and cannot be used. Please enter valid registration keys, and press activate.';
$string['inactive'] = 'The plugin is inactive and cannot be used. Please enter valid registration keys, and press "Activate".';
$string['installed'] = 'Plugin installed';
$string['installedcli'] = 'Plugin installed via command line';
$string['installeddescription'] = 'The plugin has been installed, redirect to activation form.';
Expand All @@ -229,6 +228,7 @@
$string['numfactivities'] = 'Number of activities ({$a})';
$string['numfiles'] = 'Number of files ({$a})';
$string['numusers'] = 'Number of users ({$a})';
$string['percheckerrors'] = 'Number of specific tests and errors per check per course.';
$string['privacy'] = 'Privacy notice and data processing agreement';
$string['privacy_help'] = 'Access the link to read the entire policy';
$string['privacydesc'] = 'I agree to the <a href="{$a}" target="_blank">privacy notice and data processing agreement</a> for someurl.com';
Expand All @@ -248,7 +248,7 @@
$string['siteurl_help'] = 'The URL of the site';
$string['usedifferentemail'] = 'Use different email';
$string['usersmobileregistered'] = 'Number of users with registered mobile devices ({$a})';
$string['validationerror'] = 'Registration key validation has failed. Check that your keys are correct.';
$string['validationerror'] = 'Registration key validation has failed. Check that your registered site URL and keys are correct.';

// Tool section.
$string['activityresults:pluginname'] = 'Activity breakdown accessibility tool report';
Expand Down
16 changes: 9 additions & 7 deletions admin/tool/brickfield/registration.php
Expand Up @@ -38,7 +38,8 @@
\tool_brickfield\accessibility::require_accessibility_enabled();

admin_externalpage_setup('tool_brickfield_activation');
$PAGE->set_url(__DIR__ . '/registration.php');
$thisurl = new moodle_url(\tool_brickfield\accessibility::get_plugin_url().'/registration.php');
$PAGE->set_url($thisurl);

$termsandconditions = optional_param('terms', 0, PARAM_BOOL);
if ($termsandconditions) {
Expand All @@ -62,14 +63,10 @@
['style' => 'display: block; margin: 0 auto; float: right;']);
echo $OUTPUT->heading(get_string('pluginname', manager::PLUGINNAME), 3);

$url = new moodle_url('/admin/tool/brickfield/registration.php', ['terms' => 1]);
$action = new popup_action('click', $url, 'popup', ['height' => 400, 'width' => 600]);
$tandclinktext = get_string('termsandconditionslink', 'tool_brickfield');
$a = $OUTPUT->action_link($url, $tandclinktext, $action, ['target' => '_blank']);
$reginfo = get_string('registrationinfo', 'tool_brickfield', $a);
$registration = new registration();
$reginfo = get_string('registrationinfo', manager::PLUGINNAME, $registration->get_termsurl());
echo format_text($reginfo, FORMAT_HTML, ['noclean' => true]);

$registration = new registration();
if ($fromform = $registrationform->get_data()) {
if (!$registration->set_keys_for_registration($fromform->key, $fromform->hash)) {
echo $OUTPUT->notification(get_string('hashincorrect', manager::PLUGINNAME), 'notifyproblem');
Expand All @@ -87,5 +84,10 @@
} else {
echo $OUTPUT->notification(get_string('activated', manager::PLUGINNAME), 'success');
}

$keyinfo = get_string('activationinfo', manager::PLUGINNAME, '<a href="' . $registration->get_regurl() .
'" data-action="send_info" target="_blank">');
echo format_text($keyinfo, FORMAT_HTML, ['noclean' => true]);

$registrationform->display();
echo $OUTPUT->footer();
2 changes: 1 addition & 1 deletion admin/tool/brickfield/tests/behat/accessresults.feature
Expand Up @@ -19,7 +19,7 @@ Feature: Brickfield activityresults
And I set the field "id_key" to "123456789012345678901234567890ab"
And I set the field "id_hash" to "ab123456789012345678901234567890"
And I press "Activate"
Then I should see "Your accessibility toolkit is still being validated."
Then I should see "Your accessibility toolkit is functional while being validated."
And I navigate to "Plugins > Admin tools > Accessibility > Reports" in site administration
And I press "Submit for analysis"
Then I should see "The global (course independent) content has been scheduled for analysis."
Expand Down

0 comments on commit 623c1b0

Please sign in to comment.