1 |
efrain |
1 |
{{!
|
|
|
2 |
This file is part of Moodle - http://moodle.org/
|
|
|
3 |
|
|
|
4 |
Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
it under the terms of the GNU General Public License as published by
|
|
|
6 |
the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
(at your option) any later version.
|
|
|
8 |
|
|
|
9 |
Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
GNU General Public License for more details.
|
|
|
13 |
|
|
|
14 |
You should have received a copy of the GNU General Public License
|
|
|
15 |
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
}}
|
|
|
17 |
{{!
|
|
|
18 |
@template mod_lti/registration_upgrade_choice_page.mustache
|
|
|
19 |
|
|
|
20 |
This template provides the layout to display the upgrade choices
|
|
|
21 |
available when registering a tool for which there exists at least
|
|
|
22 |
one other tool with the same domain.
|
|
|
23 |
|
|
|
24 |
Classes required for JS:
|
|
|
25 |
* none
|
|
|
26 |
|
|
|
27 |
Data attributes required for JS:
|
|
|
28 |
* none
|
|
|
29 |
|
|
|
30 |
Context variables required for this template:
|
|
|
31 |
* startregurlenc: the URL provided by the tool to start the registration, url encoded
|
|
|
32 |
* tools: the list of tools matching the domain
|
|
|
33 |
|
|
|
34 |
Example context (json):
|
|
|
35 |
{
|
|
|
36 |
"startregurlenc":"https%3A%2F%2Fmytool.example%2Fregister",
|
|
|
37 |
"tools": [
|
|
|
38 |
{
|
|
|
39 |
"id": 222,
|
|
|
40 |
"name": "This is My LTI 1.1 tool",
|
|
|
41 |
"baseurl": "https://mytool.example",
|
|
|
42 |
"version": "LTI-1p0",
|
|
|
43 |
"sesskey": "785t9302"
|
|
|
44 |
}
|
|
|
45 |
]
|
|
|
46 |
}
|
|
|
47 |
|
|
|
48 |
}}
|
|
|
49 |
<p>{{#str}}dynreg_update_text, mod_lti {{/str}}</p>
|
|
|
50 |
<div class="alert alert-warning" role="alert">
|
|
|
51 |
{{#str}}dynreg_update_warn_dupdomain, mod_lti {{/str}}
|
|
|
52 |
</div>
|
|
|
53 |
<table class="table table-striped">
|
|
|
54 |
<tr>
|
|
|
55 |
<th>{{#str}}dynreg_update_name, mod_lti {{/str}}</th>
|
|
|
56 |
<th>{{#str}}dynreg_update_url, mod_lti {{/str}}</th>
|
|
|
57 |
<th>{{#str}}dynreg_update_version, mod_lti {{/str}}</th>
|
|
|
58 |
<th></th>
|
|
|
59 |
</tr>
|
|
|
60 |
{{#tools}}
|
|
|
61 |
<tr>
|
|
|
62 |
<td>{{name}}</td>
|
|
|
63 |
<td>{{baseurl}}</td>
|
|
|
64 |
<td>{{ltiversion}}</td>
|
|
|
65 |
<td><button data-href="startltiadvregistration.php?url={{startregurlenc}}&type={{id}}" class="btn btn-outline-primary">
|
|
|
66 |
<span class="btn-loader">{{> mod_lti/loader }}</span>
|
|
|
67 |
{{#str}}dynreg_update_btn_update, mod_lti {{/str}}
|
|
|
68 |
</button>
|
|
|
69 |
</td>
|
|
|
70 |
</tr>
|
|
|
71 |
{{/tools}}
|
|
|
72 |
</table>
|
|
|
73 |
{{^tools}}
|
|
|
74 |
{{#str}}dynreg_update_notools, mod_lti {{/str}}
|
|
|
75 |
{{/tools}}
|
|
|
76 |
<div>
|
|
|
77 |
<button data-href="startltiadvregistration.php?url={{startregurlenc}}&type=0" class="btn btn-primary">
|
|
|
78 |
<span class="btn-loader">{{> mod_lti/loader }}</span>
|
|
|
79 |
{{#str}}dynreg_update_btn_new, mod_lti {{/str}}
|
|
|
80 |
</button>
|
|
|
81 |
</div>
|
|
|
82 |
<form method="POST" id="startregform">
|
|
|
83 |
<input type="hidden" name="sesskey" value="{{sesskey}}"/>
|
|
|
84 |
</form>
|
|
|
85 |
{{#js}}
|
|
|
86 |
disableAndGo = e => {
|
|
|
87 |
document.querySelectorAll("button").forEach(e=>e.setAttribute("disabled", true));
|
|
|
88 |
e.target.querySelector("span.btn-loader").style.display="inline";
|
|
|
89 |
let form = document.getElementById("startregform");
|
|
|
90 |
form.action = e.target.getAttribute("data-href");
|
|
|
91 |
form.submit();
|
|
|
92 |
};
|
|
|
93 |
document.querySelectorAll("button").forEach(b=>b.onclick=disableAndGo);
|
|
|
94 |
{{/js}}
|