MDL-69002 core_badges: move backpack validation to a separate page

Instead of running the site backpack validation every time badges/backpacks.php
page is loaded, an action button has been added to the backpacks with OB set
to 2.0 to let admins running manually this verification when needed.
This commit is contained in:
Sara Arjona 2020-06-10 12:27:40 +02:00
parent 3e567085a8
commit 92219c8ffd
4 changed files with 16 additions and 6 deletions

View file

@ -80,6 +80,14 @@ if ($action == 'edit') {
echo $output->heading(get_string('managebackpacks', 'badges'));
$form->display();
} else if ($action == 'test') {
// If no backpack has been selected, there isn't anything to test.
if (empty($id)) {
redirect($url);
}
echo $OUTPUT->header();
echo $output->render_test_backpack_result($id);
} else {
echo $OUTPUT->header();
echo $output->heading(get_string('managebackpacks', 'badges'));

View file

@ -72,11 +72,11 @@ class external_backpacks_page implements \renderable {
} else {
$backpack->canedit = false;
}
$backpack->cantest = ($backpack->apiversion == OPEN_BADGES_V2);
$backpack->iscurrent = ($backpack->id == $CFG->badges_site_backpack);
$data->backpacks[] = $backpack;
}
$data->warning = badges_verify_site_backpack();
return $data;
}

View file

@ -25,9 +25,8 @@
Example context (json):
{
"backpacks": [
{"backpackweburl": "http://localhost/", "sitebackpack": true, "canedit": false}
],
"warning": "<span class='text-warning'>Could not login</span>"
{"backpackweburl": "http://localhost/", "sitebackpack": true, "canedit": false, "cantest": true}
]
}
}}
@ -59,9 +58,11 @@
{{#pix}}t/delete, core,{{#str}}delete{{/str}}{{/pix}}
</a>
{{/iscurrent}}
{{#cantest}}
<a href="{{baseurl}}?id={{id}}&action=test">{{#pix}}t/check, core,{{#str}}testsettings, core_badges{{/str}}{{/pix}}</a>
{{/cantest}}
</td>
</tr>
{{/backpacks}}
</tbody>
</table>
{{{warning}}}
</table>