MDL-53982 competency: Javascript error due to string injection

This commit is contained in:
Frederic Massart 2016-05-02 16:52:21 +08:00
parent 71c0a5745c
commit 60011d9a8a
6 changed files with 8 additions and 12 deletions

View File

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

View File

@ -84,8 +84,6 @@ class user_competency_course_navigation implements renderable, templatable {
$data->courseid = $this->courseid; $data->courseid = $this->courseid;
$data->baseurl = $this->baseurl; $data->baseurl = $this->baseurl;
$data->groupselector = ''; $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'), if (has_any_capability(array('moodle/competency:usercompetencyview', 'moodle/competency:coursecompetencymanage'),
$context)) { $context)) {

View File

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

View File

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

View File

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

View File

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