MDL-53982 competency: Javascript error due to string injection

This commit is contained in:
Frederic Massart 2016-05-02 12:57:03 +08:00
parent 3219a4535f
commit ba7f6eeaee
6 changed files with 12 additions and 8 deletions

View File

@ -79,6 +79,7 @@ class competency_plan_navigation implements renderable, templatable {
$data->competencyid = $this->competencyid;
$data->planid = $this->planid;
$data->baseurl = $this->baseurl;
$data->jumptocompetency = get_string('jumptocompetency', 'tool_lp');
$plancompetencies = \core_competency\api::list_plan_competencies($data->planid);
$data->competencies = array();

View File

@ -84,6 +84,8 @@ class user_competency_course_navigation implements renderable, templatable {
$data->courseid = $this->courseid;
$data->baseurl = $this->baseurl;
$data->groupselector = '';
$data->jumptocompetency = get_string('jumptocompetency', 'tool_lp');
$data->jumptouser = get_string('jumptouser', 'tool_lp');
if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'),
$context)) {

View File

@ -1,7 +1,7 @@
<div class="pull-right well">
{{#hascompetencies}}
<span>
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
<label for="competency-nav-{{uniqid}}" class="accesshide">{{jumptocompetency}}</label>
<select id="competency-nav-{{uniqid}}">
{{#competencies}}
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{shortname}} {{idnumber}}</option>
@ -15,7 +15,7 @@
require(['core/form-autocomplete', 'tool_lp/competency_plan_navigation'], function(autocomplete, nav) {
(new nav('#competency-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{competencyid}}, {{planid}}));
{{#hascompetencies}}
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, '{{#str}}jumptocompetency, tool_lp{{/str}}');
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, '{{jumptocompetency}}');
{{/hascompetencies}}
});

View File

@ -3,7 +3,7 @@
<form class="user-competency-course-navigation">
{{#hasusers}}
<span>
<label for="user-nav-{{uniqid}}" class="accesshide">{{#str}}jumptouser, tool_lp{{/str}}</label>
<label for="user-nav-{{uniqid}}" class="accesshide">{{jumptouser}}</label>
<select id="user-nav-{{uniqid}}">
{{#users}}
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{fullname}}</option>
@ -14,7 +14,7 @@
<br>
{{#hascompetencies}}
<span>
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
<label for="competency-nav-{{uniqid}}" class="accesshide">{{jumptocompetency}}</label>
<select id="competency-nav-{{uniqid}}">
{{#competencies}}
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{shortname}} {{idnumber}}</option>
@ -28,10 +28,10 @@
require(['core/form-autocomplete', 'tool_lp/user_competency_course_navigation'], function(autocomplete, nav) {
(new nav('#user-nav-{{uniqid}}', '#competency-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{competencyid}}, {{courseid}}));
{{#hasusers}}
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, '{{#str}}jumptouser, tool_lp{{/str}}');
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, '{{jumptouser}}');
{{/hasusers}}
{{#hascompetencies}}
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, '{{#str}}jumptocompetency, tool_lp{{/str}}');
autocomplete.enhance('#competency-nav-{{uniqid}}', false, false, '{{jumptocompetency}}');
{{/hascompetencies}}
});

View File

@ -77,6 +77,7 @@ class user_course_navigation implements renderable, templatable {
$data->courseid = $this->courseid;
$data->baseurl = $this->baseurl;
$data->groupselector = '';
$data->jumptouser = get_string('jumptouser', 'tool_lp');
if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'),
$context)) {

View File

@ -3,7 +3,7 @@
<form class="user-competency-course-navigation">
{{#hasusers}}
<span>
<label for="user-nav-{{uniqid}}" class="accesshide">{{#str}}jumptouser, tool_lp{{/str}}</label>
<label for="user-nav-{{uniqid}}" class="accesshide">{{jumptouser}}</label>
<select id="user-nav-{{uniqid}}">
{{#users}}
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{fullname}}</option>
@ -17,7 +17,7 @@
require(['core/form-autocomplete', 'report_competency/user_course_navigation'], function(autocomplete, nav) {
(new nav('#user-nav-{{uniqid}}', '{{baseurl}}', {{userid}}, {{courseid}}));
{{#hasusers}}
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, '{{#str}}jumptouser, tool_lp{{/str}}');
autocomplete.enhance('#user-nav-{{uniqid}}', false, false, '{{jumptouser}}');
{{/hasusers}}
});
{{/js}}