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 tool_langimport/langimport
|
|
|
19 |
|
|
|
20 |
Template for the language import page.
|
|
|
21 |
|
|
|
22 |
Classes required for JS:
|
|
|
23 |
* none
|
|
|
24 |
|
|
|
25 |
Data attributes required for JS:
|
|
|
26 |
* none
|
|
|
27 |
|
|
|
28 |
Context variables required for this template:
|
|
|
29 |
* sesskey string The session key.
|
|
|
30 |
* uninstallurl string The URL for the uninstall action.
|
|
|
31 |
* updateurl string The URL for the update-language-packs action.
|
|
|
32 |
* installurl string The URL for the install action.
|
|
|
33 |
* installedoptions array The list of languages installed.
|
|
|
34 |
* toinstalloptions array The list of languages to be installed.
|
|
|
35 |
* caninstall boolean Flag to indicate if there are language packs that can be installed.
|
|
|
36 |
|
|
|
37 |
Example context (json):
|
|
|
38 |
{
|
|
|
39 |
"sesskey": "sesskey",
|
|
|
40 |
"uninstallurl": "#",
|
|
|
41 |
"updateurl": "#",
|
|
|
42 |
"installurl": "#",
|
|
|
43 |
"installedoptions": [
|
|
|
44 |
{
|
|
|
45 |
"value": "en",
|
|
|
46 |
"text": "English",
|
|
|
47 |
"selected": true
|
|
|
48 |
}
|
|
|
49 |
],
|
|
|
50 |
"toinstalloptions": [
|
|
|
51 |
{
|
|
|
52 |
"value": "ja",
|
|
|
53 |
"text": "Japanese"
|
|
|
54 |
},
|
|
|
55 |
{
|
|
|
56 |
"value": "fr",
|
|
|
57 |
"text": "French"
|
|
|
58 |
},
|
|
|
59 |
{
|
|
|
60 |
"value": "es",
|
|
|
61 |
"text": "Spanish"
|
|
|
62 |
}
|
|
|
63 |
],
|
|
|
64 |
"caninstall": true
|
|
|
65 |
}
|
|
|
66 |
}}
|
|
|
67 |
<div class="container-fluid langimport">
|
|
|
68 |
<div class="row rtl-compatible">
|
|
|
69 |
<div class="col-md-{{#caninstall}}6{{/caninstall}}{{^caninstall}}12{{/caninstall}} span{{#caninstall}}6{{/caninstall}}{{^caninstall}}12{{/caninstall}} mb-1">
|
|
|
70 |
<form id="uninstallform" action="{{uninstallurl}}" method="post">
|
|
|
71 |
<fieldset>
|
|
|
72 |
<div class="mb-3">
|
|
|
73 |
<label for="menuuninstalllang">{{#str}}installedlangs, tool_langimport{{/str}}</label>
|
|
|
74 |
<select size="15" multiple="multiple" id="menuuninstalllang" class="form-control input-block-level" name="uninstalllang[]">
|
|
|
75 |
{{#installedoptions}}
|
|
|
76 |
<option value="{{value}}" {{#selected}}selected="selected"{{/selected}}>{{{text}}}‎</option>
|
|
|
77 |
{{/installedoptions}}
|
|
|
78 |
</select>
|
|
|
79 |
</div>
|
|
|
80 |
<div class="mb-3">
|
|
|
81 |
<input type="hidden" name="sesskey" value="{{sesskey}}">
|
|
|
82 |
<input id="languninstallbutton" type="submit" value="{{#str}}uninstall, tool_langimport{{/str}}" class="btn btn-secondary">
|
|
|
83 |
</div>
|
|
|
84 |
</fieldset>
|
|
|
85 |
</form>
|
|
|
86 |
{{#updateurl}}
|
|
|
87 |
<div>
|
|
|
88 |
<form id="updateform" action="{{updateurl}}" method="post">
|
|
|
89 |
<fieldset>
|
|
|
90 |
<input type="hidden" name="sesskey" value="{{sesskey}}">
|
|
|
91 |
<input type="submit" value="{{#str}}updatelangs, tool_langimport{{/str}}" class="btn btn-secondary">
|
|
|
92 |
{{#hasmanyinstalledlanguages}}
|
|
|
93 |
<p class="mt-2 small">{{#str}} updatelangsnote, tool_langimport, {"taskname": {{#quote}}{{updatelangstaskname}}{{/quote}} }{{/str}}</p>
|
|
|
94 |
{{/hasmanyinstalledlanguages}}
|
|
|
95 |
</fieldset>
|
|
|
96 |
</form>
|
|
|
97 |
</div>
|
|
|
98 |
{{/updateurl}}
|
|
|
99 |
</div>
|
|
|
100 |
{{#caninstall}}
|
|
|
101 |
<div class="col-md-6 mb-1">
|
|
|
102 |
<form id="installform" action="{{installurl}}" method="post">
|
|
|
103 |
<fieldset>
|
|
|
104 |
<div class="mb-3">
|
|
|
105 |
<label for="menupack">{{#str}}availablelangs, install{{/str}}</label>
|
|
|
106 |
<select size="15" multiple="multiple" class="form-control input-block-level" id="menupack" name="pack[]">
|
|
|
107 |
{{#toinstalloptions}}
|
|
|
108 |
<option value="{{value}}" {{#selected}}selected="selected"{{/selected}}>{{{text}}}‎</option>
|
|
|
109 |
{{/toinstalloptions}}
|
|
|
110 |
</select>
|
|
|
111 |
</div>
|
|
|
112 |
<div class="mb-3">
|
|
|
113 |
{{< core/search_input_auto }}
|
|
|
114 |
{{$label}}
|
|
|
115 |
{{#str}} search, tool_langimport {{/str}}
|
|
|
116 |
{{/label}}
|
|
|
117 |
{{/ core/search_input_auto }}
|
|
|
118 |
</div>
|
|
|
119 |
<div class="mb-3">
|
|
|
120 |
<input type="hidden" name="sesskey" value="{{sesskey}}">
|
|
|
121 |
<input type="submit" value="{{#str}}install, tool_langimport{{/str}}" class="btn btn-secondary">
|
|
|
122 |
</div>
|
|
|
123 |
</fieldset>
|
|
|
124 |
</form>
|
|
|
125 |
</div>
|
|
|
126 |
{{/caninstall}}
|
|
|
127 |
</div>
|
|
|
128 |
</div>
|
|
|
129 |
{{#js}}
|
|
|
130 |
require(['tool_langimport/search', 'tool_langimport/uninstall'], function(search, uninstall) {
|
|
|
131 |
search.init(document.querySelector('#installform'));
|
|
|
132 |
uninstall.init(document.querySelector('#uninstallform'));
|
|
|
133 |
});
|
|
|
134 |
{{/js}}
|