Commit 358ed255 by cahrens Committed by Eric Fischer

Fix improper escaping.

parent 7c5a9da7
...@@ -75,18 +75,18 @@ define([ ...@@ -75,18 +75,18 @@ define([
}, },
getOutlineAnchorMessage: function () { getOutlineAnchorMessage: function () {
var message = gettext( var message = _.escape(gettext(
/* /*
Translators: 'outlineAnchor' is an anchor pointing to Translators: 'outlineAnchor' is an anchor pointing to
the course outline page. the course outline page.
*/ */
'This content group is not in use. Add a content group to any unit from the %(outlineAnchor)s.' 'This content group is not in use. Add a content group to any unit from the %(outlineAnchor)s.'
), )),
anchor = str.sprintf( anchor = str.sprintf(
'<a href="%(url)s" title="%(text)s">%(text)s</a>', '<a href="%(url)s" title="%(text)s">%(text)s</a>',
{ {
url: this.model.collection.parents[0].outlineUrl, url: this.model.collection.parents[0].outlineUrl,
text: gettext('Course Outline') text: _.escape(gettext('Course Outline'))
} }
); );
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<h3 class="title"> <h3 class="title">
<a href="#" class="toggle group-toggle <% if (showContentGroupUsages){ print('hide'); } else { print('show'); } %>-groups"> <a href="#" class="toggle group-toggle <% if (showContentGroupUsages){ print('hide'); } else { print('show'); } %>-groups">
<i class="ui-toggle-expansion icon fa fa-caret-<% if (showContentGroupUsages){ print('down'); } else { print('right'); } %>"></i> <i class="ui-toggle-expansion icon fa fa-caret-<% if (showContentGroupUsages){ print('down'); } else { print('right'); } %>"></i>
<%= name %> <%- name %>
</a> </a>
</h3> </h3>
</header> </header>
...@@ -11,28 +11,28 @@ ...@@ -11,28 +11,28 @@
<ol class="collection-info group-configuration-info group-configuration-info-<% if(showContentGroupUsages){ print('block'); } else { print('inline'); } %>"> <ol class="collection-info group-configuration-info group-configuration-info-<% if(showContentGroupUsages){ print('block'); } else { print('inline'); } %>">
<% if (!_.isUndefined(id)) { %> <% if (!_.isUndefined(id)) { %>
<li class="group-configuration-id" <li class="group-configuration-id"
><span class="group-configuration-label"><%= gettext('ID') %>: </span ><span class="group-configuration-label"><%- gettext('ID') %>: </span
><span class="group-configuration-value"><%= id %></span ><span class="group-configuration-value"><%- id %></span
></li> ></li>
<% } %> <% } %>
<% if (!showContentGroupUsages) { %> <% if (!showContentGroupUsages) { %>
<li class="group-configuration-usage-count"> <li class="group-configuration-usage-count">
<%= usageCountMessage %> <%- usageCountMessage %>
</li> </li>
<% } %> <% } %>
</ol> </ol>
<ul class="actions group-configuration-actions"> <ul class="actions group-configuration-actions">
<li class="action action-edit"> <li class="action action-edit">
<button class="edit"><i class="icon fa fa-pencil"></i> <%= gettext("Edit") %></button> <button class="edit"><i class="icon fa fa-pencil"></i> <%- gettext("Edit") %></button>
</li> </li>
<% if (_.isEmpty(usage)) { %> <% if (_.isEmpty(usage)) { %>
<li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Delete') %>"> <li class="action action-delete wrapper-delete-button" data-tooltip="<%- gettext('Delete') %>">
<button class="delete action-icon"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button> <button class="delete action-icon"><i class="icon fa fa-trash-o"></i><span><%- gettext("Delete") %></span></button>
</li> </li>
<% } else { %> <% } else { %>
<li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Cannot delete when in use by a unit') %>"> <li class="action action-delete wrapper-delete-button" data-tooltip="<%- gettext('Cannot delete when in use by a unit') %>">
<button class="delete action-icon is-disabled" aria-disabled="true" disabled="disabled"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button> <button class="delete action-icon is-disabled" aria-disabled="true" disabled="disabled"><i class="icon fa fa-trash-o"></i><span><%- gettext("Delete") %></span></button>
</li> </li>
<% } %> <% } %>
</ul> </ul>
...@@ -41,17 +41,18 @@ ...@@ -41,17 +41,18 @@
<% if (showContentGroupUsages) { %> <% if (showContentGroupUsages) { %>
<div class="collection-references wrapper-group-configuration-usages"> <div class="collection-references wrapper-group-configuration-usages">
<% if (!_.isEmpty(usage)) { %> <% if (!_.isEmpty(usage)) { %>
<h4 class="intro group-configuration-usage-text"><%= gettext('This content group is used in:') %></h4> <h4 class="intro group-configuration-usage-text"><%- gettext('This content group is used in:') %></h4>
<ol class="usage group-configuration-usage"> <ol class="usage group-configuration-usage">
<% _.each(usage, function(unit) { %> <% _.each(usage, function(unit) { %>
<li class="usage-unit group-configuration-usage-unit"> <li class="usage-unit group-configuration-usage-unit">
<p><a href=<%= unit.url %> ><%= unit.label %></a></p> <p><a href=<%- unit.url %> ><%- unit.label %></a></p>
</li> </li>
<% }) %> <% }) %>
</ol> </ol>
<% } else { %> <% } else { %>
<p class="group-configuration-usage-text"> <p class="group-configuration-usage-text">
<%= outlineAnchorMessage %> <!-- This contains an anchor link and therefore can't be escaped. -->
<%= outlineAnchorMessage %>
</p> </p>
<% } %> <% } %>
</div> </div>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<h3 class="title group-configuration-title"> <h3 class="title group-configuration-title">
<a href="#" class="toggle group-toggle <% if(showGroups){ print('hide'); } else { print('show'); } %>-groups"> <a href="#" class="toggle group-toggle <% if(showGroups){ print('hide'); } else { print('show'); } %>-groups">
<i class="ui-toggle-expansion icon fa fa-caret-<% if(showGroups){ print('down'); } else { print('right'); } %>"></i> <i class="ui-toggle-expansion icon fa fa-caret-<% if(showGroups){ print('down'); } else { print('right'); } %>"></i>
<%= name %> <%- name %>
</a> </a>
</h3> </h3>
</header> </header>
...@@ -11,20 +11,20 @@ ...@@ -11,20 +11,20 @@
<ol class="collection-info group-configuration-info group-configuration-info-<% if(showGroups){ print('block'); } else { print('inline'); } %>"> <ol class="collection-info group-configuration-info group-configuration-info-<% if(showGroups){ print('block'); } else { print('inline'); } %>">
<% if (!_.isUndefined(id)) { %> <% if (!_.isUndefined(id)) { %>
<li class="group-configuration-id" <li class="group-configuration-id"
><span class="group-configuration-label"><%= gettext('ID') %>: </span ><span class="group-configuration-label"><%- gettext('ID') %>: </span
><span class="group-configuration-value"><%= id %></span ><span class="group-configuration-value"><%- id %></span
></li> ></li>
<% } %> <% } %>
<% if (showGroups) { %> <% if (showGroups) { %>
<li class="collection-description group-configuration-description"> <li class="collection-description group-configuration-description">
<%= description %> <%- description %>
</li> </li>
<% } else { %> <% } else { %>
<li class="group-configuration-groups-count"> <li class="group-configuration-groups-count">
<%= groupsCountMessage %> <%- groupsCountMessage %>
</li> </li>
<li class="group-configuration-usage-count"> <li class="group-configuration-usage-count">
<%= usageCountMessage %> <%- usageCountMessage %>
</li> </li>
<% } %> <% } %>
</ol> </ol>
...@@ -34,23 +34,23 @@ ...@@ -34,23 +34,23 @@
<ol class="collection-items groups groups-<%= index %>"> <ol class="collection-items groups groups-<%= index %>">
<% groups.each(function(group, groupIndex) { %> <% groups.each(function(group, groupIndex) { %>
<li class="item group group-<%= groupIndex %>"> <li class="item group group-<%= groupIndex %>">
<span class="name group-name"><%= group.get('name') %></span> <span class="name group-name"><%- group.get('name') %></span>
<span class="meta group-allocation"><%= allocation %>%</span> <span class="meta group-allocation"><%- allocation %>%</span>
</li> </li>
<% }) %> <% }) %>
</ol> </ol>
<% } %> <% } %>
<ul class="actions group-configuration-actions"> <ul class="actions group-configuration-actions">
<li class="action action-edit"> <li class="action action-edit">
<button class="edit"><i class="icon fa fa-pencil"></i> <%= gettext("Edit") %></button> <button class="edit"><i class="icon fa fa-pencil"></i> <%- gettext("Edit") %></button>
</li> </li>
<% if (_.isEmpty(usage)) { %> <% if (_.isEmpty(usage)) { %>
<li class="action action-delete wrapper-delete-button"> <li class="action action-delete wrapper-delete-button">
<button class="delete action-icon"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button> <button class="delete action-icon"><i class="icon fa fa-trash-o"></i><span><%- gettext("Delete") %></span></button>
</li> </li>
<% } else { %> <% } else { %>
<li class="action action-delete wrapper-delete-button" data-tooltip="<%= gettext('Cannot delete when in use by an experiment') %>"> <li class="action action-delete wrapper-delete-button" data-tooltip="<%- gettext('Cannot delete when in use by an experiment') %>">
<button class="delete action-icon is-disabled" aria-disabled="true"><i class="icon fa fa-trash-o"></i><span><%= gettext("Delete") %></span></button> <button class="delete action-icon is-disabled" aria-disabled="true"><i class="icon fa fa-trash-o"></i><span><%- gettext("Delete") %></span></button>
</li> </li>
<% } %> <% } %>
</ul> </ul>
...@@ -58,11 +58,11 @@ ...@@ -58,11 +58,11 @@
<% if(showGroups) { %> <% if(showGroups) { %>
<div class="collection-references wrapper-group-configuration-usages"> <div class="collection-references wrapper-group-configuration-usages">
<% if (!_.isEmpty(usage)) { %> <% if (!_.isEmpty(usage)) { %>
<h4 class="intro group-configuration-usage-text"><%= gettext('This Group Configuration is used in:') %></h4> <h4 class="intro group-configuration-usage-text"><%- gettext('This Group Configuration is used in:') %></h4>
<ol class="usage group-configuration-usage"> <ol class="usage group-configuration-usage">
<% _.each(usage, function(unit) { %> <% _.each(usage, function(unit) { %>
<li class="usage-unit group-configuration-usage-unit"> <li class="usage-unit group-configuration-usage-unit">
<p><a href=<%= unit.url %> ><%= unit.label %></a></p> <p><a href=<%- unit.url %> ><%- unit.label %></a></p>
<% if (unit.validation) { %> <% if (unit.validation) { %>
<p> <p>
<% if (unit.validation.type === 'warning') { %> <% if (unit.validation.type === 'warning') { %>
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<i class="icon fa fa-exclamation-circle"></i> <i class="icon fa fa-exclamation-circle"></i>
<% } %> <% } %>
<span class="usage-validation-message group-configuration-validation-message"> <span class="usage-validation-message group-configuration-validation-message">
<%= unit.validation.text %> <%- unit.validation.text %>
</span> </span>
</p> </p>
<% } %> <% } %>
...@@ -80,6 +80,7 @@ ...@@ -80,6 +80,7 @@
</ol> </ol>
<% } else { %> <% } else { %>
<p class="group-configuration-usage-text"> <p class="group-configuration-usage-text">
<!-- This contains an anchor link and therefore can't be escaped. -->
<%= outlineAnchorMessage %> <%= outlineAnchorMessage %>
</p> </p>
<% } %> <% } %>
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<%namespace name='static' file='../../static_content.html'/> <%namespace name='static' file='../../static_content.html'/>
<%! <%!
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openedx.core.djangolib.js_utils import js_escaped_string
from courseware.courses import get_studio_url from courseware.courses import get_studio_url
from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_user_partition
%> %>
...@@ -27,7 +28,7 @@ from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_ ...@@ -27,7 +28,7 @@ from openedx.core.djangoapps.course_groups.partition_scheme import get_cohorted_
% for content_group in content_groups: % for content_group in content_groups:
{ {
id: ${content_group.id}, id: ${content_group.id},
name: "${content_group.name | h}", name: "${content_group.name | n, js_escaped_string}",
user_partition_id: cohortUserPartitionId user_partition_id: cohortUserPartitionId
}, },
% endfor % endfor
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment