Commit 97590928 by Simon Chen

Merge branch 'master' into schen/xss-fix-dashboard-course-upsell

parents 79783800 41c1c30f
......@@ -90,6 +90,7 @@ from util.organizations_helpers import (
organizations_enabled,
)
from util.string_utils import _has_non_ascii_characters
from util.course_key_utils import from_string_or_404
from xmodule.contentstore.content import StaticContent
from xmodule.course_module import CourseFields
from xmodule.course_module import DEFAULT_START_DATE
......@@ -868,10 +869,7 @@ def course_info_handler(request, course_key_string):
GET
html: return html for editing the course info handouts and updates.
"""
try:
course_key = CourseKey.from_string(course_key_string)
except InvalidKeyError:
raise Http404
course_key = from_string_or_404(course_key_string)
with modulestore().bulk_operations(course_key):
course_module = get_course_and_check_access(course_key, request.user)
......
<%! from django.utils.translation import ugettext as _ %>
<%!
from openedx.core.djangolib.markup import Text
from django.utils.translation import ugettext as _
%>
<%page expression_filter="h"/>
<%inherit file="base.html" />
<%block name="content">
<div class="wrapper-mast wrapper sr">
<header class="mast">
<h1 class="page-header">${_("{studio_name} Account Activation").format(studio_name=settings.STUDIO_SHORT_NAME)}</h1>
<h1 class="page-header">
${Text(_("{studio_name} Account Activation")).format(
studio_name=Text(settings.STUDIO_SHORT_NAME),
)}
</h1>
</header>
</div>
......@@ -17,14 +25,20 @@
<div class="msg">
<h1 class="title">${_("Your account activation is complete!")}</h1>
<div class="copy">
<p>${_("Thank you for activating your account. You may now sign in and start using {studio_name} to author courses.").format(studio_name=settings.STUDIO_NAME)}</p>
<p>
${Text(_("Thank you for activating your account. You may now sign in and start using {studio_name} to author courses.")).format(
studio_name=Text(settings.STUDIO_NAME)
)}
</p>
</div>
</div>
<ul class="list-actions">
<li class="action-item">
<a href="/signin" class="action-primary action-signin">
${_("Sign into {studio_name}").format(studio_name=settings.STUDIO_SHORT_NAME)}
${Text(_("Sign into {studio_name}")).format(
studio_name=Text(settings.STUDIO_SHORT_NAME)
)}
</a>
</li>
</ul>
......
<%! from django.utils.translation import ugettext as _ %>
<%!
from openedx.core.djangolib.markup import HTML, Text
from django.utils.translation import ugettext as _
%>
<%page expression_filter="h"/>
<%inherit file="base.html" />
<%block name="content">
<div class="wrapper-mast wrapper sr">
<header class="mast">
<h1 class="page-header">${_("{studio_name} Account Activation").format(studio_name=settings.STUDIO_SHORT_NAME)}</h1>
<h1 class="page-header">
${Text(_("{studio_name} Account Activation")).format(
studio_name=Text(settings.STUDIO_SHORT_NAME)
)}
</h1>
</header>
</div>
......@@ -18,10 +26,14 @@
<h1 class="title">${_("Your account activation is invalid")}</h1>
<div class="copy">
<p>${_("We're sorry. Something went wrong with your activation. Check to make sure the URL you went to was correct, as e-mail programs will sometimes split it into two lines.")}</p>
<p>${_("If you still have issues, contact {platform_name} Support. In the meantime, you can also return to {link_start}the {studio_name} homepage.{link_end}").format(
platform_name=settings.PLATFORM_NAME, studio_name=settings.STUDIO_NAME,
link_start='<a href="/">', link_end="</a>"
)}</p>
<p>
${Text(_("If you still have issues, contact {platform_name} Support. In the meantime, you can also return to {link_start}the {studio_name} homepage.{link_end}")).format(
platform_name=Text(settings.PLATFORM_NAME),
studio_name=Text(settings.STUDIO_NAME),
link_start=HTML('<a href="/">'),
link_end=HTML('</a>')
)}
</p>
</div>
</div>
</div>
......
<%page expression_filter="h"/>
<%inherit file="../base.html" />
<%block name="content">
You're in dev mode!
......
<%page expression_filter="h"/>
<%inherit file="../../base.html" />
<%block name="view_notes">
......
<%page expression_filter="h"/>
<div class="wrapper wrapper-modal-window wrapper-modal-window-edit-xblock" aria-labelledby="modal-window-title" role="dialog">
<div class="modal-window-overlay"></div>
<div class="modal-window confirm modal-med modal-type-html modal-editor" style="top: 50px; left: 400px;" tabindex="-1" aria-labelledby="modal-window-title">
......
<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<div class="wrapper wrapper-modal-window wrapper-modal-window-bulkpublish-section" aria-labelledby="modal-window-title" role="dialog">
......
<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<div class="wrapper wrapper-modal-window wrapper-modal-window-bulkpublish-subsection" aria-labelledby="modal-window-title" role="dialog">
......
<%page expression_filter="h"/>
<%! from django.utils.translation import ugettext as _ %>
<div class="wrapper wrapper-modal-window wrapper-modal-window-bulkpublish-unit" aria-labelledby="modal-window-title" role="dialog">
......
<%page expression_filter="h"/>
<div class="add-section add-item">
<a href="#" class="button button-new" data-category="" data-parent="" data-default-name="New Section">
<i class="icon fa fa-plus"></i> New Section
......
<%page expression_filter="h"/>
<div class="add-subsection add-item">
<a href="#" class="button button-new" data-category="" data-parent="" data-default-name="New Subsection">
<i class="icon fa fa-plus"></i> New Subsection
......
<%page expression_filter="h"/>
<div class="add-unit add-item">
<a href="#" class="button button-new" data-category="" data-parent="" data-default-name="New Unit">
<i class="icon fa fa-plus"></i> New Unit
......
<%page expression_filter="h"/>
<div class="section-header">
<h3 class="section-header-details ui-toggle-expansion" title="Collapse/Expand this Section">
<i class="icon fa fa-caret-down icon"></i>
......
<%page expression_filter="h"/>
<div class="section-header">
<h3 class="section-header-details ui-toggle-expansion" title="Collapse/Expand this Section">
<i class="icon fa fa-caret-down icon"></i>
......
<%page expression_filter="h"/>
<div class="status-grading">
<p>
<span class="sr status-grading-label">Graded as:</span>
......
<%page expression_filter="h"/>
<div class="status-message">
<i class="icon fa fa-warning"></i>
<p class="status-message-copy">Critical error</p>
......
<%page expression_filter="h"/>
<div class="status-message">
<i class="icon fa fa-lock"></i>
<p class="status-message-copy">Contains Staff only content</p>
......
<%page expression_filter="h"/>
<div class="status-message">
<i class="icon fa fa-file-o"></i>
<p class="status-message-copy">Unpublished change(s) to live content</p>
......
<%page expression_filter="h"/>
<div class="status-message">
<i class="icon fa fa-file-o"></i>
<p class="status-message-copy">Unpublished unit(s) will not be released</p>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="status-release">
<p>
<span class="sr status-release-label">Release Status:</span>
......
<%page expression_filter="h"/>
<div class="subsection-header">
<h3 class="subsection-header-details ui-toggle-expansion" title="Collapse/Expand this Subsection">
<i class="icon fa fa-caret-down icon"></i>
......
<%page expression_filter="h"/>
<div class="subsection-header">
<h3 class="subsection-header-details ui-toggle-expansion" title="Collapse/Expand this Subsection">
<i class="icon fa fa-caret-down icon"></i>
......
<%page expression_filter="h"/>
<div class="unit-header">
<h3 class="unit-header-details">
<span class="unit-title item-title"><a class="unit-url" href="">Unit Name</a></span>
......
<%page expression_filter="h"/>
<span class="draggable-drop-indicator draggable-drop-indicator-after"><i class="icon fa fa-caret-right"></i></span>
<%page expression_filter="h"/>
<span class="draggable-drop-indicator draggable-drop-indicator-before"><i class="icon fa fa-caret-right"></i></span>
<%page expression_filter="h"/>
<span class="draggable-drop-indicator draggable-drop-indicator-initial"><i class="icon fa fa-caret-right"></i></span>
<%page expression_filter="h"/>
<%include file="metadata-edit.html" />
<%page expression_filter="h"/>
<section class="sequence-edit">
<%include file="metadata-edit.html" />
</section>
"""
Convenience methods for working with course objects
"""
from django.http import Http404
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
def from_string_or_404(course_key_string):
"""
Gets CourseKey from the string passed as parameter.
Parses course key from string(containing course key) or raises 404 if the string's format is invalid.
Arguments:
course_key_string(str): It is string containing the course key
Returns:
CourseKey: A key that uniquely identifies a course
Raises:
HTTP404: A 404 not found exception will be thrown if course_key_string's format is invalid
"""
try:
course_key = CourseKey.from_string(course_key_string)
except InvalidKeyError:
raise Http404
return course_key
"""
Tests for util.course_key_utils
"""
from nose.tools import assert_equals, assert_raises # pylint: disable=no-name-in-module
from util.course_key_utils import from_string_or_404
from opaque_keys.edx.keys import CourseKey
from django.http import Http404
def test_from_string_or_404():
#testing with split style course keys
assert_raises(
Http404,
from_string_or_404,
"/some.invalid.key/course-v1:TTT+CS01+2015_T0"
)
assert_equals(
CourseKey.from_string("course-v1:TTT+CS01+2015_T0"),
from_string_or_404("course-v1:TTT+CS01+2015_T0")
)
#testing with mongo style course keys
assert_raises(
Http404,
from_string_or_404,
"/some.invalid.key/TTT/CS01/2015_T0"
)
assert_equals(
CourseKey.from_string("TTT/CS01/2015_T0"),
from_string_or_404("TTT/CS01/2015_T0")
)
<%page expression_filter="h"/>
<%!
from django.utils.translation import ugettext as _
from third_party_auth import pipeline
......
<%! from django.utils.translation import ugettext as _ %>
<%! from django.template.defaultfilters import escapejs %>
<%! from edxnotes.helpers import is_feature_enabled as is_edxnotes_enabled %>
<%inherit file="/main.html" />
<%namespace name='static' file='/static_content.html'/>
<%block name="bodyclass">in-course view-teams</%block>
<%block name="title"><title>
Create New Team | [Course name]
</title></%block>
<%block name="header_extras">
<header class="global slim" aria-label="Main" role="banner">
<div class="wrapper-header nav-container">
<h1 class="logo" itemscope="" itemtype="http://schema.org/Organization">
<a href="/" itemprop="url">
<img src="/static/images/edx-theme/edx-logo-77x36.png" alt="Your Platform Name Here Home Page" itemprop="logo" />
</a>
</h1>
<h2><span class="provider">PlantsX:</span> GAR_123 Wild Life</h2>
<ul class="user">
<li class="primary">
<a href="/dashboard" class="user-link">
<i class="icon fa fa-home" aria-hidden="true"></i>
<span class="sr">Dashboard for:</span>
<div>frances</div>
</a>
</li>
<li class="primary">
<a href="#" class="dropdown" aria-haspopup="true" aria-expanded="false"><span class="sr">More options dropdown</span> &#9662;</a>
<ul class="dropdown-menu" aria-label="More Options" role="menu">
<li><a href="/account/settings">Account Settings</a></li>
<li><a href="/u/frances">My Profile</a></li>
<li><a href="/logout" role="menuitem">Sign Out</a></li>
</ul>
</li>
</ul>
</div>
</header>
<nav aria-label="Course Material" class="courseware wrapper-course-material">
<div class="course-material">
<ol class="course-tabs">
<li>
<a class="active" href="/courses/PlantsX/GAR_123/2014_T3/courseware">
Courseware
<span class="sr">, current location</span>
</a>
</li>
<li>
<a class="" href="/courses/PlantsX/GAR_123/2014_T3/info">
Course Info
</a>
</li>
<li>
<a class="" href="/courses/PlantsX/GAR_123/2014_T3/discussion/forum">
Discussion
</a>
</li>
<li>
<a class="" href="/courses/PlantsX/GAR_123/2014_T3/course_wiki">
Wiki
</a>
</li>
<li>
<a class="" href="/courses/PlantsX/GAR_123/2014_T3/progress">
Progress
</a>
</li>
<li>
<a class="" href="/courses/PlantsX/GAR_123/2014_T3/instructor">
Instructor
</a>
</li>
</ol>
</div>
</nav>
</%block>
<%block name="headextra">
<%static:css group='style-course-vendor'/>
<%static:css group='style-course'/>
<%block name="nav_skip">${"#content" if section_title else "#content"}</%block>
</%block>
<%block name="js_extra">
<script type="text/javascript">
$(function(){
$(".ui-accordion-header a, .ui-accordion-content .subtitle").each(function() {
var elemText = $(this).text().replace(/^\s+|\s+$/g,''); // Strip leading and trailing whitespace
var wordArray = elemText.split(" ");
var finalTitle = "";
if (wordArray.length > 0) {
for (i=0;i<=wordArray.length-1;i++) {
finalTitle += wordArray[i];
if (i == (wordArray.length-2)) {
finalTitle += "&nbsp;";
} else if (i == (wordArray.length-1)) {
// Do nothing
} else {
finalTitle += " ";
}
}
}
$(this).html(finalTitle);
});
});
</script>
</%block>
<div class="container">
<div class="course-wrapper">
<section class="course-content" id="course-content">
<header class="page-header">
<div class="page-header-main">
<nav class="breadcrumbs">
<a class="nav-item" href="">Solar Energy</a> <span class="icon fa-angle-right" aria-hidden="true"></span>
</nav>
<h1 class="page-title">Create a New Team</h1>
<p class="page-description">If you cannot find an existing team to join or would like to team up with a group of friends, create a new team.</p>
</div>
</header>
<div class="wrapper-msg is-incontext urgency-low warning">
<div class="msg">
<div class="msg-content">
<h3 class="title">Oops!</h3>
<div class="copy">
<p>We couldn't create your team because something needs to be fixed below.</p>
</div>
</div>
</div>
</div>
<div class="page-content">
<form class="create-team">
<fieldset class="required-wrapper">
<legend class="sr">Required Information</legend>
<div class="form-field is-required">
<label for="team-name" class="label">Team Name (Required)</label>
<input id="team-name" aria-required="true" class="input-text" />
<span class="tip tip-input">The name that will identify your team</span>
</div>
<div class="form-field is-required has-errors">
<label for="team-description" class="label">Team Description (Required)</label>
<textarea id="team-description" aria-required="true" class="input-text input-text-large"></textarea>
<span class="tip tip-input">A short description of the team to help other students understand the goals or directives the team is pursuing</span>
</div>
</fieldset>
<fieldset class="optional-wrapper">
<legend>Optional Characteristics</legend>
<p class="description">Help other students find and join your team by specifying characteristics. The more limitations you add, the fewer students may be interested in joining, so choose carefully.</p>
<div class="form-field">
<label for="team-language" class="label">Language</label>
<select id="team-language" name="team-language" class="input-select">
<option value="">Select...</option>
<option>Swahili</option>
<option>Mandarin</option>
<option>English</option>
<option>Hobbitish</option>
</select>
<span class="tip tip-input">The primary language of the team</span>
</div>
<div class="form-field">
<label for="team-country" class="label">Country</label>
<select id="team-country" name="team-country" class="input-select">
<option value="">Select...</option>
<option>Timbuktoo</option>
<option>The Moon</option>
<option>Paris</option>
<option>JP</option>
</select>
<span class="tip tip-input">The primary country of the team</span>
</div>
</fieldset>
<div class="form-actions">
<button class="action action-primary">Create</button>
<button class="action action-cancel" href="">Cancel</button>
</div>
</form>
</div>
</section>
</div>
</div>
......@@ -517,7 +517,7 @@ class MakoTemplateLinter(object):
<script.*?>| # script tag start
</script>| # script tag end
<%static:require_module.*?>| # require js script tag start
</%static:require_module> # require js script tag end""", re.VERBOSE + re.IGNORECASE)
</%static:require_module> # require js script tag end""", re.VERBOSE | re.IGNORECASE)
media_type_re = re.compile(r"""type=['"].*?['"]""", re.IGNORECASE)
contexts = [{'index': 0, 'type': 'html'}]
......@@ -773,7 +773,7 @@ class UnderscoreTemplateLinter(object):
end_index: The index of the end of the expression.
expression: The text of the expression.
"""
unescaped_expression_regex = re.compile("<%=.*?%>")
unescaped_expression_regex = re.compile("<%=.*?%>", re.DOTALL)
expressions = []
for match in unescaped_expression_regex.finditer(underscore_template):
......
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