first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,37 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/collapsesections
Renders a form section header
Example context (json):
{
}
}}
<div class="collapsible-actions">
<a id="collapsesections{{uniqid}}" href="#" aria-expanded="false" class="btn btn-link p-1 collapseexpand collapsemenu collapsed"{{!
}} role="button">
<span class="collapseall">{{#str}}collapseall{{/str}}</span>
<span class="expandall">{{#str}}expandall{{/str}}</span>
</a>
</div>
{{#js}}
require(['core_form/collapsesections'], function(Collapsesections) {
Collapsesections.init('#collapsesections{{uniqid}}');
});
{{/js}}
@@ -0,0 +1,48 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/editor_textarea
Displays an editor field in a form.
Example context (json):
{
"name": "test",
"id": "test0",
"rows": 4,
"cols": 20,
"value": "Sample text",
"format": 3
}
}}
<div>
<textarea id="{{id}}" name="{{name}}[text]" class="form-control" rows="{{rows}}" cols="{{cols}}" spellcheck="true" {{#changelistener}} onblur="{{onblur}}"
onchange="{{onchange}}" {{/changelistener}}>{{value}}</textarea>
</div>
<div>
{{#hasformats}}
<label for="menu{{name}}format" class="sr-only">{{formatlabel}}</label>
<select name="{{name}}[format]" id="menu{{name}}format" class="custom-select">
{{#formats}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>
{{/formats}}
</select>
{{/hasformats}}
{{^hasformats}}
<input name="{{name}}[format]" id="menu{{name}}format" type="hidden" value="{{format}}"/>
{{/hasformats}}
</div>
@@ -0,0 +1,41 @@
<label class="form-check-inline {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
{{^element.hardfrozen}}
{{^element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.deselectedvalue}}">
{{/element.frozen}}
{{#element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.frozenvalue}}">
{{/element.frozen}}
{{/element.hardfrozen}}
<input type="checkbox" name="{{element.name}}" class="form-check-input {{element.extraclasses}}"
id="{{element.id}}"
{{#element.selectedvalue}}
value="{{element.selectedvalue}}"
{{/element.selectedvalue}}
{{#element.checked}}checked{{/element.checked}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{#element.frozen}}
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</span>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,71 @@
<div class="mb-3 row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}} {{{element.parentclasses}}}">
<div class="col-md-3 col-form-label pb-0 pt-0">
{{#text}}
<label class="d-inline word-break" for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<div class="form-check d-flex">
{{^element.hardfrozen}}
{{^element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.deselectedvalue}}">
{{/element.frozen}}
{{#element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.frozenvalue}}">
{{/element.frozen}}
{{/element.hardfrozen}}
<input type="checkbox"
name="{{element.name}}"
class="form-check-input {{element.extraclasses}}"
{{#element.selectedvalue}}
value="{{element.selectedvalue}}"
{{/element.selectedvalue}}
id="{{element.id}}" {{#element.checked}}checked{{/element.checked}}
{{#error}}
autofocus aria-describedby="{{#text}}{{element.id}}_description {{/text}}{{element.iderror}}"
{{/error}}
{{^error}}
{{#text}}
aria-describedby="{{element.id}}_description"
{{/text}}
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{#element.frozen}}
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{#text}}
<span id="{{element.id}}_description">
{{{.}}}
</span>
{{/text}}
{{^text}}
<label for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
<div class="ml-2 d-flex align-items-center align-self-start">
{{#required}}
<div class="text-danger" title="{{#str}}required{{/str}}">
{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}
</div>
{{/required}}
{{{helpbutton}}}
</div>
</div>
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</div>
</div>
</div>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,46 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
{{#element.multiple}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
{{/element.multiple}}
<select class="custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}{{#html}} data-html="{{html}}"{{/html}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}
{{{text}}}
{{^element.hardfrozen}}
<input type="hidden" name="{{element.name}}" value="{{value}}">
{{/element.hardfrozen}}
{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
{{^element.frozen}}
{{#js}}
require(['core/form-autocomplete'], function(module) {
module.enhance({{#quote}}#{{element.id}}{{/quote}},
{{element.tags}},
{{#quote}}{{element.ajax}}{{/quote}},
{{#quote}}{{element.placeholder}}{{/quote}},
{{element.casesensitive}},
{{element.showsuggestions}},
{{#quote}}{{element.noselectionstring}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,46 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
{{#element.multiple}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
{{/element.multiple}}
<select class="custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}{{#html}} data-html="{{html}}"{{/html}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}
{{{text}}}
{{^element.hardfrozen}}
<input type="hidden" name="{{element.name}}" value="{{value}}">
{{/element.hardfrozen}}
{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
{{^element.frozen}}
{{#js}}
require(['core/form-autocomplete'], function(module) {
module.enhance({{#quote}}#{{element.id}}{{/quote}},
{{element.tags}},
{{#quote}}{{element.ajax}}{{/quote}},
{{#quote}}{{element.placeholder}}{{/quote}},
{{element.casesensitive}},
{{element.showsuggestions}},
{{#quote}}{{element.noselectionstring}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,20 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
<button
class="btn
{{^element.customclassoverride}}btn-secondary{{/element.customclassoverride}}
{{#element.customclassoverride}}{{.}}{{/element.customclassoverride}}"
name="{{element.name}}"
id="{{element.id}}"
type="button"
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{{element.attributes}}}
>
{{{element.value}}}
</button>
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,19 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<button
class="btn
{{^element.customclassoverride}}btn-secondary ml-0{{/element.customclassoverride}}
{{#element.customclassoverride}}{{.}}{{/element.customclassoverride}}"
name="{{element.name}}"
id="{{element.id}}"
type="button"
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{{element.attributes}}}>
{{{element.value}}}
</button>
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,41 @@
<label data-fieldtype="checkbox" class="form-check {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
{{^element.hardfrozen}}
{{#element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.frozenvalue}}">
{{/element.frozen}}
{{/element.hardfrozen}}
<input type="checkbox" name="{{element.name}}" class="form-check-input {{element.extraclasses}}"
id="{{element.id}}"
{{#element.value}}
value="{{element.value}}"
{{/element.value}}
{{^element.value}}
value="1"
{{/element.value}}
{{#element.checked}}checked{{/element.checked}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{#element.frozen}}
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{{label}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</span>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,72 @@
<div class="mb-3 row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}} {{{element.parentclasses}}}">
<div class="col-md-3 col-form-label pb-0 pt-0">
{{#text}}
<label class="d-inline word-break" for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<div class="form-check d-flex">
{{^element.hardfrozen}}
{{#element.frozen}}
<input type="hidden" name="{{element.name}}" value="{{element.frozenvalue}}">
{{/element.frozen}}
{{/element.hardfrozen}}
<input type="checkbox"
name="{{element.name}}"
class="form-check-input {{element.extraclasses}}"
{{#element.value}}
value="{{element.value}}"
{{/element.value}}
{{^element.value}}
value="1"
{{/element.value}}
id="{{element.id}}" {{#element.checked}}checked{{/element.checked}}
{{#error}}
autofocus aria-describedby="{{#text}}{{element.id}}_description {{/text}}{{element.iderror}}"
{{/error}}
{{^error}}
{{#text}}
aria-describedby="{{element.id}}_description"
{{/text}}
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{#element.frozen}}
disabled
{{/element.frozen}}
{{{element.attributes}}} >
{{#text}}
<span id="{{element.id}}_description">
{{{.}}}
</span>
{{/text}}
{{^text}}
<label for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
<div class="ml-2 d-flex align-items-center align-self-start">
{{#required}}
<div class="text-danger" title="{{#str}}required{{/str}}">
{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}
</div>
{{/required}}
{{{helpbutton}}}
</div>
</div>
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</div>
</div>
</div>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,149 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-choicedropdown
Choice dialog form element template.
Context variables required for this template:
* id - Element id,
* nameraw - Raw Element name without '[]'
* name - Element name,
* label - Element label,
* multiple - multi select?,
* checked - checked?,
* error - Is there an error associated with this element?,
* size - Element size,
* value - Element value,
* helpbutton - Helpbutton,
* hiddenlabel - Element hidden flag,
* frozen - Element frozen flag,
* hardfrozen - Element hard fronzen flag,
* extraclasses - Extra classes assocaited,
* type - Element type,
* attributes - Element attributes,
* options - [
{
text - Option text,
value - Option value,
selected - Selected?,
disabled - Disabled?,
optionattributes - Option attributes
}
]
Example context (json):
{
"element": {
"wrapperid": "fitem_id_choicedropdownfield",
"iderror": "error_id_choicedropdownfield",
"id": "id_choicedropdownfield",
"nameraw": "choicedropdownfield",
"name": "choicedropdownfield",
"label": null,
"multiple": null,
"checked": null,
"error": null,
"size": null,
"value": null,
"helpbutton": "",
"hiddenlabel": false,
"frozen": false,
"hardfrozen": false,
"extraclasses": null,
"type": "select",
"attributes": "",
"fieldicon": "<a class='btn'><i class='icon fa fa-ellipsis-h'></i></a>",
"options": [
{
"rawoptionid": "1",
"text": "Hidden",
"value": 0,
"selected": false,
"disabled": false,
"optionattributes": ""
},
{
"rawoptionid": "2",
"text": "Visible to everyone",
"value": 1,
"selected": true,
"disabled": false,
"optionattributes": ""
},
{
"rawoptionid": "3",
"text": "Allow only other course members to see my email address",
"value": 2,
"selected": false,
"disabled": false,
"optionattributes": ""
}
]
}
}
}}
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<select
class="custom-select d-none {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
data-region="choice-select"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}} autofocus aria-describedby="{{element.iderror}}" {{/error}}
{{{element.attributes}}}
>
{{#element.select}}
{{#options}}
<option
value="{{value}}"
data-optionid="{{element.id}}_{{optionuniqid}}"
{{#selected}}selected{{/selected}}
{{#disabled}}disabled{{/disabled}}
{{{optionattributes}}}
>
{{{name}}}
</option>
{{/options}}
{{/element.select}}
</select>
{{#element.dropdown}}
{{< core/local/dropdown/status}}
{{$ buttonclasses }} btn btn-outline-secondary dropdown-toggle {{/ buttonclasses }}
{{/ core/local/dropdown/status}}
{{/element.dropdown}}
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}
{{{text}}}
{{^element.hardfrozen}}
<input
type="hidden"
name="{{element.name}}"
value="{{value}}"
id="{{element.id}}"
>
{{/element.hardfrozen}}
{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['core_form/choicedropdown'], function(ChioceDropdown) {
ChioceDropdown.init('{{element.id}}');
});
{{/js}}
@@ -0,0 +1,10 @@
{{< core_form/element-template-inline }}
{{$element}}
<span class="fdate_selector d-flex align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,13 @@
{{< core_form/element-group }}
{{$element}}
<fieldset data-fieldtype="date" class="m-0 p-0 border-0" id="{{element.id}}">
<legend class="sr-only">{{label}}</legend>
<span class="fdate_selector d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
</fieldset>
{{/element}}
{{/ core_form/element-group }}
@@ -0,0 +1,10 @@
{{< core_form/element-template-inline }}
{{$element}}
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,13 @@
{{< core_form/element-group }}
{{$element}}
<fieldset data-fieldtype="date_time" class="m-0 p-0 border-0" id="{{element.id}}">
<legend class="sr-only">{{label}}</legend>
<div class="fdate_time_selector d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
</fieldset>
{{/element}}
{{/ core_form/element-group }}
@@ -0,0 +1,43 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-defaultcustom-inline
Defaultcustom form element template.
Example context (json):
{
"element": {
"elements": [
{"html": "<select><option>Default</option><option>Custom</option></select>",
"separator": ""},
{"html": "<input type=text>",
"separator": ""}
]
}
}
}}
{{< core_form/element-template-inline }}
{{$element}}
<span class="fdefaultcustom">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,48 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-defaultcustom
Defaultcustom form element template.
Example context (json):
{
"element": {
"elements": [
{"html": "<select><option>Default</option><option>Custom</option></select>",
"separator": ""},
{"html": "<input type=text>",
"separator": ""}
]
}
}
}}
{{< core_form/element-group }}
{{$element}}
<fieldset class="w-100 m-0 p-0 border-0" id="{{element.id}}">
<legend class="sr-only">{{label}}</legend>
<div class="d-flex flex-wrap align-items-center">
<span class="fdefaultcustom">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</span>
</div>
</fieldset>
{{/element}}
{{/ core_form/element-group }}
@@ -0,0 +1,10 @@
{{< core_form/element-template-inline }}
{{$element}}
<div class="d-flex ml-1">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1 @@
{{> core_form/element-group }}
@@ -0,0 +1,5 @@
{{< core_form/element-template-inline }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,5 @@
{{< core_form/element-template }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,26 @@
{{< core_form/element-template }}
{{$label}}
{{^element.hiddenlabel}}
<p id="{{element.id}}_label" class="mb-0 d-inline" aria-hidden="true">
{{{label}}}
</p>
{{/element.hiddenlabel}}
{{/label}}
{{$element}}
<fieldset class="w-100 m-0 p-0 border-0" id="{{element.id}}_fieldset">
<legend class="sr-only">{{label}}</legend>
{{{element.html}}}
</fieldset>
{{/element}}
{{/ core_form/element-template }}
{{#js}}
(function() {
var label = document.getElementById('{{element.id}}_label');
if (label) {
label.style.cursor = 'default';
label.addEventListener('click', function() {
document.querySelectorAll('#{{element.id}}_fieldset div.fp-toolbar a')[0].focus();
});
}
})();
{{/js}}
@@ -0,0 +1,26 @@
{{< core_form/element-template }}
{{$label}}
{{^element.hiddenlabel}}
<p id="{{element.id}}_label" class="mb-0 d-inline" aria-hidden="true">
{{{label}}}
</p>
{{/element.hiddenlabel}}
{{/label}}
{{$element}}
<fieldset class="w-100 m-0 p-0 border-0" id="{{element.id}}_fieldset">
<legend class="sr-only">{{label}}</legend>
{{{element.html}}}
</fieldset>
{{/element}}
{{/ core_form/element-template }}
{{#js}}
(function() {
var label = document.getElementById('{{element.id}}_label');
if (label) {
label.style.cursor = 'default';
label.addEventListener('click', function() {
document.querySelectorAll('#{{element.id}}_fieldset .fp-btn-choose')[0].focus();
});
}
})();
{{/js}}
@@ -0,0 +1 @@
{{> core_form/element-group }}
@@ -0,0 +1,5 @@
{{< core_form/element-template }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,10 @@
{{< core_form/element-template-inline }}
{{$element}}
<div class="d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
{{/element}}
{{/ core_form/element-template-inline }}
+43
View File
@@ -0,0 +1,43 @@
{{< core_form/element-template }}
{{$label}}
{{^element.hiddenlabel}}
<p id="{{element.id}}_label" class="mb-0 word-break" aria-hidden="true">
{{{label}}}
</p>
{{/element.hiddenlabel}}
{{/label}}
{{$element}}
{{#label}}
<fieldset class="w-100 m-0 p-0 border-0">
<legend class="sr-only">{{label}}</legend>
<div class="d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
</fieldset>
{{/label}}
{{^label}}
<div class="w-100 m-0 p-0 border-0">
<div class="d-flex flex-wrap align-items-center">
{{#element.elements}}
{{{separator}}}
{{{html}}}
{{/element.elements}}
</div>
</div>
{{/label}}
{{/element}}
{{/ core_form/element-template }}
{{#js}}
require(['jquery'], function($) {
$('#{{element.id}}_label').css('cursor', 'default');
$('#{{element.id}}_label').click(function() {
$('#{{element.id}}')
.find('button, a, input:not([type="hidden"]), select, textarea, [tabindex]')
.filter(':not([disabled]):not([tabindex="0"]):not([tabindex="-1"])')
.first().focus();
});
});
{{/js}}
@@ -0,0 +1,58 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-header
Renders a form section header
Example context (json):
{
"id": "id_general",
"header": "General",
"collapsed": 0,
"collapseable": 1,
"helpbutton": "Help"
}
}}
<legend class="sr-only">{{{header}}}</legend>
<div class="d-flex align-items-center mb-2">
<div class="position-relative d-flex ftoggler align-items-center position-relative mr-1">
{{#collapseable}}
<a data-toggle="collapse"
href="#{{id}}container"
role="button"
aria-expanded="{{#collapsed}}false{{/collapsed}}{{^collapsed}}true{{/collapsed}}"
aria-controls="{{id}}container"
class="btn btn-icon mr-1 icons-collapse-expand stretched-link fheader {{#collapsed}}collapsed{{/collapsed}}"
>
<span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
{{#pix}} t/expandedchevron, core {{/pix}}
</span>
<span class="collapsed-icon icon-no-margin p-2" title="{{#str}} expand, core {{/str}}">
<span class="dir-rtl-hide">{{#pix}} t/collapsedchevron, core {{/pix}}</span>
<span class="dir-ltr-hide">{{#pix}} t/collapsedchevron_rtl, core {{/pix}}</span>
</span>
<span class="sr-only">{{{header}}}</span>
</a>
{{/collapseable}}
<h3 class="d-flex align-self-stretch align-items-center mb-0" aria-hidden="true">
{{{header}}}
</h3>
</div>
{{{helpbutton}}}
</div>
<div id="{{id}}container" class="fcontainer {{#collapseable}}collapseable collapse {{/collapseable}} {{^collapsed}}show{{/collapsed}}">
@@ -0,0 +1 @@
{{> core_form/element-group }}
@@ -0,0 +1 @@
{{> core_form/element-select }}
@@ -0,0 +1,54 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-password-inline
Password inline form element template.
Example context (json):
{
"element": {
"name": "test",
"id": "test0",
"size": null,
"error": null,
"value": "Sample text",
"frozen": false,
"iderror": "test0_error",
"attributes": ""
}
}
}}
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
<input type="password"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}}>
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,54 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-password
Password form element template.
Example context (json):
{
"element": {
"name": "test",
"id": "test0",
"size": null,
"error": null,
"value": "Sample text",
"frozen": false,
"iderror": "test0_error",
"attributes": ""
}
}
}}
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<input type="password"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}}>
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,56 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-passwordunmask-fill
The fill for a passwordunmask form element.
The purpose of this template is to render the fill for a passwordunmask element.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* element
* valuechars (optional)
Example context (json):
{
"element": {
"valuechars": [
"E",
"x",
"a",
"m",
"p",
"l",
"e"
]
}
}
}}
<span>
{{# element.valuechars }}&bull;{{/ element.valuechars }}
{{^ element.valuechars }}<em>{{!
}}{{^ element.frozen }}{{# str }} novalueclicktoset, form {{/ str }}{{/ element.frozen }}{{!
}}{{# element.frozen }}{{# str }} novalue, form {{/ str }}{{/ element.frozen }}{{!
}}</em>{{/ element.valuechars }}
</span>
@@ -0,0 +1,93 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-passwordunmask
Moodle passwordunmask form element template.
The purpose of this template is to render a passwordunmask form element.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* element
* id
* name
* value
* size
Example context (json):
{
"element": {
"id": "example_password_unmask",
"name": "example",
"value": "Password1!",
"size": 40
}
}
}}
{{< core_form/element-template }}
{{$ element }}
<div data-passwordunmask="wrapper" data-passwordunmaskid="{{ element.id }}">
<div class="d-flex align-items-center">
<span data-passwordunmask="editor">
<input type="password"
{{# element.frozen }}readonly{{/ element.frozen }}
{{^ element.hardfrozen}} name="{{ element.name }}"{{/ element.hardfrozen }}
id="{{ element.id }}"
value="{{ element.value }}"
class="form-control d-none {{# error }}is-invalid{{/ error }}"
data-size="{{ element.size }}"
{{# error }}
autofocus aria-describedby="{{ element.iderror }}"
{{/ error }}
{{#required}}
aria-required="true"
{{/required}}
{{{ element.attributes }}}
>
</span>
{{^ element.frozen }}
<a href="#" class="form-control" data-passwordunmask="edit" title="{{ edithint }}">
{{/ element.frozen }}
<span data-passwordunmask="displayvalue">{{> core_form/element-passwordunmask-fill }}</span>
{{^ element.frozen }}
{{# pix }} t/passwordunmask-edit, core, {{# str }} passwordunmaskedithint, form {{/ str }}{{/ pix }}
</a>
{{/ element.frozen }}
<a href="#" class="btn btn-link icon-no-margin p-1 ml-1" data-passwordunmask="unmask" title="{{ unmaskhint }}">
{{# pix }} t/passwordunmask-reveal, core, {{# str }} passwordunmaskrevealhint, form {{/ str }}{{/ pix }}
</a>
</div>
<span data-passwordunmask="instructions" class="form-text text-muted" style="display: none;">
{{^ element.frozen }}
{{# str }} passwordunmaskinstructions, form {{/ str }}
{{/ element.frozen }}
</span>
</div>
{{/ element }}
{{/ core_form/element-template }}
{{#js}}
require(['core_form/passwordunmask'], function(PasswordUnmask) {
new PasswordUnmask("{{ element.id }}");
});
{{/ js }}
@@ -0,0 +1 @@
{{> core_form/element-selectgroups-inline }}
@@ -0,0 +1 @@
{{> core_form/element-selectgroups }}
@@ -0,0 +1,40 @@
{{!
@template core_form/element-radio-inline
Example context (json):
{
"element": {
"id": "id_test_radio0",
"name": "test_radio_button"
}
}
}}
<label class="form-check-inline form-check-label {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}">
{{^element.hardfrozen}}{{#element.frozen}}{{#element.checked}}
<input type="hidden" name="{{element.name}}" value="{{element.value}}">
{{/element.checked}}{{/element.frozen}}{{/element.hardfrozen}}
<input type="radio" class="form-check-input " {{^element.frozen}}name="{{element.name}}"{{/element.frozen}}
id="{{element.id}}" value="{{element.value}}"
{{#element.checked}}checked{{/element.checked}}
{{#element.frozen}}disabled{{/element.frozen}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{{element.attributes}}} >
{{{label}}}
</label>
{{#text}}
<em>{{{.}}}</em>
{{/text}}
{{{helpbutton}}}
<span class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</span>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
+64
View File
@@ -0,0 +1,64 @@
{{!
@template core_form/element-radio
Example context (json):
{
"element": {
"id": "id_test_radio0",
"name": "test_radio_button"
}
}
}}
<div class="mb-3 row {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.parentclasses}}}">
<div class="col-md-3 col-form-label pb-0 pt-0">
{{#text}}
<label class="d-inline word-break" for="{{element.id}}">
{{{label}}}
</label>
{{/text}}
</div>
<div class="col-md-9 checkbox">
<div class="form-check d-flex {{{element.extraclasses}}}">
<label class="form-check-label">
{{^element.hardfrozen}}{{#element.frozen}}{{#element.checked}}
<input type="hidden" name="{{element.name}}" value="{{element.value}}">
{{/element.checked}}{{/element.frozen}}{{/element.hardfrozen}}
<input type="radio" class="form-check-input" {{^element.frozen}}name="{{element.name}}"{{/element.frozen}}
id="{{element.id}}" value="{{element.value}}"
{{#element.checked}}checked{{/element.checked}}
{{#element.frozen}}disabled{{/element.frozen}}
{{#error}}{{#element.checked}}
autofocus aria-describedby="{{element.iderror}}"
{{/element.checked}}{{/error}}
{{#required}}aria-required="true"{{/required}} {{{element.attributes}}} >
{{#text}}
{{{.}}}
{{/text}}
{{^text}}
{{{label}}}
{{/text}}
</label>
<div class="ml-2 d-flex align-items-center align-self-start">
{{#required}}
<div class="text-danger" title="{{#str}}required{{/str}}">
{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}
</div>
{{/required}}
{{{helpbutton}}}
</div>
</div>
{{#error}}{{#element.checked}}
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}}{{#element.checked}} style="display: block;"{{/element.checked}}{{/error}}>
{{{error}}}
</div>
{{/element.checked}}{{/error}}
</div>
</div>
{{^element.frozen}}
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,5 @@
{{< core_form/element-template }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,37 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
{{#element.multiple}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
{{/element.multiple}}
<select class="{{^element.multiple}}custom-select{{/element.multiple}}
{{#element.multiple}}form-control{{/element.multiple}}
{{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}} {{{optionattributes}}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}
{{{text}}}
{{^element.hardfrozen}}
<input type="hidden" name="{{element.name}}" value="{{value}}" id="{{element.id}}">
{{/element.hardfrozen}}
{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
+131
View File
@@ -0,0 +1,131 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-select
Simple select form element template.
Context variables required for this template:
* id - Element id,
* nameraw - Raw Element name without '[]'
* name - Element name,
* label - Element label,
* multiple - multi select?,
* checked - checked?,
* error - Is there an error associated with this element?,
* size - Element size,
* value - Element value,
* helpbutton - Helpbutton,
* hiddenlabel - Element hidden flag,
* frozen - Element frozen flag,
* hardfrozen - Element hard fronzen flag,
* extraclasses - Extra classes assocaited,
* type - Element type,
* attributes - Element attributes,
* options - [
{
text - Option text,
value - Option value,
selected - Selected?,
disabled - Disabled?,
optionattributes - Option attributes
}
]
Example context (json):
{
"element": {
"id": "id_maildisplay",
"nameraw": "maildisplay",
"name": "maildisplay",
"label": null,
"multiple": null,
"checked": null,
"error": null,
"size": null,
"value": null,
"helpbutton": "",
"hiddenlabel": false,
"frozen": false,
"hardfrozen": false,
"extraclasses": null,
"type": "select",
"attributes": "",
"options": [
{
"text": "Hidden",
"value": 0,
"selected": false,
"disabled": false,
"optionattributes": ""
},
{
"text": "Visible to everyone",
"value": 1,
"selected": true,
"disabled": false,
"optionattributes": ""
},
{
"text": "Allow only other course members to see my email address",
"value": 2,
"selected": false,
"disabled": false,
"optionattributes": ""
}
]
}
}
}}
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
{{#element.multiple}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
{{/element.multiple}}
<select class="{{^element.multiple}}custom-select{{/element.multiple}}
{{#element.multiple}}form-control{{/element.multiple}}
{{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}}
{{{optionattributes}}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}
{{{text}}}
{{^element.hardfrozen}}
<input type="hidden" name="{{element.name}}" value="{{value}}" id="{{element.id}}">
{{/element.hardfrozen}}
{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,36 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
<select class="form-control custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.optiongroups}}
{{#text}}
<optgroup label="{{text}}">
{{/text}}
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}} {{{optionattributes}}}>{{{text}}}</option>
{{/options}}
{{#text}}
</optgroup>
{{/text}}
{{/element.optiongroups}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.optiongroups}}
{{#options}}
{{#selected}}{{{text}}}{{/selected}}
{{/options}}
{{/element.optiongroups}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
@@ -0,0 +1,36 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<select class="form-control custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.optiongroups}}
{{#text}}
<optgroup label="{{text}}">
{{/text}}
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}} {{{optionattributes}}}>{{{text}}}</option>
{{/options}}
{{/element.optiongroups}}
{{#text}}
</optgroup>
{{/text}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.optiongroups}}
{{#options}}
{{#selected}}{{{text}}}{{/selected}}
{{/options}}
{{/element.optiongroups}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,27 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<select class="custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}} {{#disabled}}disabled{{/disabled}} {{{optionattributes}}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}{{{text}}}{{/selected}}
{{/element.options}}
{{/element.frozen}}
<a class="mx-3" href="{{{element.link}}}">{{element.linklabel}}</a>
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1 @@
{{> core_form/element-select-inline }}
@@ -0,0 +1 @@
{{> core_form/element-select }}
@@ -0,0 +1,52 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-static
Static form element template. A static form element is an element that just outputs raw HTML.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* element - A context exported from an mform element.
* element.html - The raw html to display.
Example context (json):
{
"label": "Example label",
"element": {
"html": "Example HTML",
"staticlabel": true,
"extraclasses": null,
"name": "static_name",
"id": "id_static",
"wrapperid": "fitem_id_static",
"iderror": "id_error_static"
}
}
}}
{{< core_form/element-template }}
{{$element}}
<div class="form-control-static {{{element.extraclasses}}}" data-name="{{element.name}}">
{{{element.html}}}
</div>
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,25 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
<input type="submit"
class="btn
{{^element.customclassoverride}}
{{^element.secondary}}btn-primary{{/element.secondary}}
{{#element.secondary}}btn-secondary{{/element.secondary}}
{{/element.customclassoverride}}
{{#error}} btn-danger {{/error}}
{{#element.customclassoverride}}{{element.customclassoverride}}{{/element.customclassoverride}}"
name="{{element.name}}"
id="{{element.id}}"
value="{{element.value}}"
{{{element.attributes}}} >
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template-inline }}
{{# js }}
{{^element.frozen}}
require(['core_form/submit'], function(Submit) {
Submit.init("{{ element.id }}");
});
{{/element.frozen}}
{{/ js }}
@@ -0,0 +1,29 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<input type="submit"
class="btn
{{^element.customclassoverride}}
{{^element.secondary}}btn-primary{{/element.secondary}}
{{#element.secondary}}btn-secondary{{/element.secondary}}
{{/element.customclassoverride}}
{{#error}} btn-danger {{/error}}
{{element.extraclasses}}
{{#element.customclassoverride}}{{element.customclassoverride}}{{/element.customclassoverride}}"
name="{{element.name}}"
id="{{element.id}}"
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
value="{{element.value}}"
{{{element.attributes}}} >
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
{{# js }}
{{^element.frozen}}
require(['core_form/submit'], function(Submit) {
Submit.init("{{ element.id }}");
});
{{/element.frozen}}
{{/ js }}
@@ -0,0 +1,42 @@
{{< core_form/element-template-inline }}
{{$element}}
{{^element.frozen}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
<select class="custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}<span class="badge bg-info text-white">{{{text}}}</span>{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{#element.managestandardtagsurl}}
<a href="{{element.managestandardtagsurl}}">{{#str}}managestandardtags, core_tag{{/str}}</a>
{{/element.managestandardtagsurl}}
{{/element}}
{{/ core_form/element-template-inline }}
{{^element.frozen}}
{{#js}}
require(['core/form-autocomplete'], function(module) {
module.enhance({{#quote}}#{{element.id}}{{/quote}},
{{element.tags}},
{{#quote}}{{element.ajax}}{{/quote}},
{{#quote}}{{element.placeholder}}{{/quote}},
{{element.casesensitive}},
{{element.showsuggestions}},
{{#quote}}{{element.noselectionstring}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
+42
View File
@@ -0,0 +1,42 @@
{{< core_form/element-template }}
{{$element}}
{{^element.frozen}}
<input type="hidden" name="{{element.nameraw}}" value="_qf__force_multiselect_submission">
<select class="custom-select {{#error}}is-invalid{{/error}}" name="{{element.name}}"
id="{{element.id}}"
{{#element.multiple}}multiple{{/element.multiple}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{#element.options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{{text}}}</option>
{{/element.options}}
</select>
{{/element.frozen}}
{{#element.frozen}}
{{#element.options}}
{{#selected}}<span class="badge bg-info text-white">{{{text}}}</span>{{/selected}}
{{/element.options}}
{{/element.frozen}}
{{#element.managestandardtagsurl}}
<a href="{{element.managestandardtagsurl}}">{{#str}}managestandardtags, core_tag{{/str}}</a>
{{/element.managestandardtagsurl}}
{{/element}}
{{/ core_form/element-template }}
{{^element.frozen}}
{{#js}}
require(['core/form-autocomplete'], function(module) {
module.enhance({{#quote}}#{{element.id}}{{/quote}},
{{element.tags}},
{{#quote}}{{element.ajax}}{{/quote}},
{{#quote}}{{element.placeholder}}{{/quote}},
{{element.casesensitive}},
{{element.showsuggestions}},
{{#quote}}{{element.noselectionstring}}{{/quote}});
});
{{/js}}
{{/element.frozen}}
@@ -0,0 +1,20 @@
<div class="mb-3 {{#error}}has-danger{{/error}} fitem {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}}" {{#element.groupname}}data-groupname="{{.}}"{{/element.groupname}}>
{{#label}}
<label class="col-form-label {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
{{{label}}}
</label>
{{/label}}
<span data-fieldtype="{{element.type}}">
{{$ element }}
<!-- Element goes here -->
{{/ element }}
</span>
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</div>
</div>
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
@@ -0,0 +1,81 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-template
Template for the form element wrapper template.
Context variables required for this template:
* label
* required
* advanced
* helpbutton
* error
* element
* id
* name
Example context (json):
{
"label": "Course full name",
"required": true,
"advanced": false,
"error": null,
"element": {
"wrapperid": "fitem_id_fullname",
"id": "id_fullname",
"name": "fullname"
}
}
}}
<div id="{{element.wrapperid}}" class="mb-3 row {{#error}}has-danger{{/error}} fitem {{#element.emptylabel}}femptylabel{{/element.emptylabel}} {{#advanced}}advanced{{/advanced}} {{{element.extraclasses}}} {{{element.parentclasses}}}" {{#element.groupname}}data-groupname="{{.}}"{{/element.groupname}}>
<div class="col-md-3 col-form-label d-flex pb-0 pr-md-0">
{{# label}}{{$ label }}
{{^element.staticlabel}}
<label id="{{element.id}}_label" class="d-inline word-break {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}" for="{{element.id}}">
{{{label}}}
</label>
{{/element.staticlabel}}
{{#element.staticlabel}}
<span class="d-inline-block {{#element.hiddenlabel}}sr-only{{/element.hiddenlabel}}">
{{{label}}}
</span>
{{/element.staticlabel}}
{{/ label }}{{/ label}}
<div class="form-label-addon d-flex align-items-center align-self-start">
{{#required}}
<div class="text-danger" title="{{#str}}required{{/str}}">
{{#pix}}req, core, {{#str}}required{{/str}}{{/pix}}
</div>
{{/required}}
{{{helpbutton}}}
</div>
</div>
<div class="col-md-9 d-flex flex-wrap align-items-start felement" data-fieldtype="{{element.type}}">
{{$ element }}
<!-- Element goes here -->
{{/ element }}
<div class="form-control-feedback invalid-feedback" id="{{element.iderror}}" {{#error}} style="display: block;"{{/error}}>
{{{error}}}
</div>
</div>
</div>
{{#js}}
require(['theme_boost/form-display-errors'], function(module) {
module.enhance({{#quote}}{{element.id}}{{/quote}});
});
{{/js}}
@@ -0,0 +1,20 @@
{{< core_form/element-template-inline }}
{{$element}}
<input type="text"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
{{#element.frozen}}
readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
{{/element.frozen}}
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}}>
{{/element}}
{{/ core_form/element-template-inline }}
+20
View File
@@ -0,0 +1,20 @@
{{< core_form/element-template }}
{{$element}}
<input type="text"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
{{#element.frozen}}
readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
{{/element.frozen}}
id="{{element.id}}"
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}} >
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,19 @@
{{< core_form/element-template }}
{{$element}}
<textarea
name="{{element.name}}"
id="{{element.id}}"
class="form-control {{#error}}is-invalid{{/error}}"
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{{element.attributes}}}
{{#element.frozen}}
readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
{{/element.frozen}}
>{{element.value}}</textarea>
{{/element}}
{{/ core_form/element-template }}
+66
View File
@@ -0,0 +1,66 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/element-url
URL form element template.
Example context (json):
{
"element": {
"name": "test",
"id": "test0",
"wrapperid": "test0-wrapper",
"size": null,
"error": null,
"value": "http://example.org",
"frozen": false,
"iderror": "test0_error",
"attributes": "",
"filepickerclientid": "test0-filepickerclientid"
}
}
}}
{{< core_form/element-template }}
{{$element}}
{{#element.filepickerclientid}}
<div id="url-wrapper-{{element.filepickerclientid}}" class="d-inline-block mw-100">
{{/element.filepickerclientid}}
<input type="url"
class="form-control {{#error}}is-invalid{{/error}}"
name="{{element.name}}"
id="{{element.id}}"
value="{{element.value}}"
{{#element.size}}size="{{element.size}}"{{/element.size}}
{{#error}}
autofocus aria-describedby="{{element.iderror}}"
{{/error}}
{{#required}}
aria-required="true"
{{/required}}
{{#element.frozen}}
readonly {{#element.hardfrozen}}disabled{{/element.hardfrozen}}
{{/element.frozen}}
{{{element.attributes}}} >
{{#element.filepickerclientid}}
</div>
{{/element.filepickerclientid}}
{{^element.frozen}}
{{{element.filepickerhtml}}}
{{/element.frozen}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,5 @@
{{< core_form/element-template }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,5 @@
{{< core_form/element-template }}
{{$element}}
{{{element.html}}}
{{/element}}
{{/ core_form/element-template }}
@@ -0,0 +1,122 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/filetypes-browser
The template is used to render the content of the UI widget allowing the
user to select individual file types or their groups.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* groups
* key
* name
* selectable
* expanded
* ext
* types
* key
* name
* selected
* expanded
* ext
Example context (json):
{
"groups": [
{
"key": "web_file",
"name": "Web files",
"selectable": true,
"selected": false,
"ext": ".css .html .xhtml .htm .js",
"types": [
{
"key": ".css",
"name": "Cascading Style-Sheet",
"selected": true,
"ext": ".css"
},
{
"key": ".htm",
"name": "HTML text",
"selected": false,
"ext": ".htm .xhtml .html"
}
]
},
{
"key": "web_audio",
"name": "Web-safe audio files",
"selectable": false,
"selected": false,
"ext": null,
"types": [
{
"key": "audio/mp3",
"name": "Audio file (MP3)",
"selected": false,
"ext": ".mp3"
}
]
}
]
}
}}
<div data-filetypesbrowserbody="{{elementid}}" role="tree">
{{#groups}}
<div data-filetypesbrowserkey="{{key}}" role="treeitem" aria-expanded="{{#expanded}}true{{/expanded}}{{^expanded}}false{{/expanded}}">
<label>
{{#selectable}}
<input data-filetypesbrowserkey="{{key}}" type="checkbox" {{#selected}}checked{{/selected}}>
<strong data-filetypesname="{{key}}">{{name}}</strong>
<small class="muted" data-filetypesextensions="{{key}}">
{{ext}}
</small>
{{/selectable}}
{{^selectable}}
<strong>{{name}}</strong>
{{/selectable}}
</label>
{{#types.0}}
{{! The tree provides its own accessibility controls, these two links are here for mouse users.
For that reason, we hide them from assistive technologies. }}
<small aria-hidden="true" data-filetypesbrowserfeature="hideifexpanded" class="float-right float-right"><a href="#">{{#str}}expand{{/str}}</a></small>
<small aria-hidden="true" data-filetypesbrowserfeature="hideifcollapsed" class="float-right float-right"><a href="#">{{#str}}collapse{{/str}}</a></small>
{{/types.0}}
<ul class="unstyled list-unstyled" role="group">
{{#types}}
<li data-filetypesbrowserkey="{{key}}" style="margin-left: 2em" role="treeitem">
<label>
<input data-filetypesbrowserkey="{{key}}" type="checkbox" {{#selected}}checked{{/selected}}>
<span data-filetypesname="{{key}}">{{name}}</span>
<small class="muted" data-filetypesextensions="{{key}}">
{{ext}}
</small>
</label>
</li>
{{/types}}
</ul>
<hr style="clear:both">
</div>
{{/groups}}
</div>
@@ -0,0 +1,60 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/filetypes-descriptions
Template to describe chosen file types.
Classes required for JS:
* none
Data attributes required for JS:
* none
Context variables required for this template:
* hasdescriptions (bool)
* descriptions (array)
* description (string)
* extensions (string)
Example context (json):
{
"hasdescriptions": true,
"descriptions": [
{
"description": "Image (JPEG)",
"extensions": ".jpeg .jpe .jpg"
},
{
"description": "Image (GIF)",
"extensions": ".gif"
}
]
}
}}
<div class="form-filetypes-descriptions w-100">
{{#hasdescriptions}}
<ul class="list-unstyled unstyled">
{{#descriptions}}
<li>{{description}} <small class="text-dark">{{extensions}}</small></li>
{{/descriptions}}
</ul>
{{/hasdescriptions}}
{{^hasdescriptions}}
<p>{{#str}}noselection, form{{/str}}</p>
{{/hasdescriptions}}
</div>
@@ -0,0 +1,39 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/filetypes-trigger
Renders the button to open the file types browser element.
This template uses <input> element of the type "button" as that one seems
to be well styled by default (especially when compared to alternatives like
<button> that are not aligned nicely with the input field.
Classes required for JS:
* none
Data attributes required for JS:
* filetypeswidget - set to "browsertrigger" to mark the actual clickable element
Context variables required for this template:
* none
Example context (json):
{
}
}}
<input type="button" class="btn btn-secondary" data-filetypeswidget="browsertrigger" value="{{#str}} choose, core {{/str}}" />
@@ -0,0 +1,36 @@
{{!
This file is part of Moodle - http://moodle.org/
Moodle is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Moodle is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template core_form/setting_validation_failure
Error displayed when field fails validation (longer than max length).
Context variables required for this template:
* fieldid - element field id
* message - error message
Example context (json):
{
"fieldid": "test0",
"message": "test message"
}
}}
{{!
Setting error template for configtext_maxlength.
}}
<div>
<span class="error" id="maxlength_error_{{fieldid}}">{{message}}</span>
</div>