diff --git a/.gitignore b/.gitignore index 05e76c4caadb..83e2b676556d 100644 --- a/.gitignore +++ b/.gitignore @@ -27,6 +27,7 @@ conf/locale/en/LC_MESSAGES/*.po !messages.po lms/static/sass/*.css lms/static/sass/application.scss +lms/static/sass/course.scss cms/static/sass/*.css lms/lib/comment_client/python nosetests.xml diff --git a/common/djangoapps/mitxmako/shortcuts.py b/common/djangoapps/mitxmako/shortcuts.py index 076656402767..7f7c3f9ebe80 100644 --- a/common/djangoapps/mitxmako/shortcuts.py +++ b/common/djangoapps/mitxmako/shortcuts.py @@ -41,7 +41,9 @@ def marketing_link(name): return settings.MKTG_URLS.get('ROOT') + settings.MKTG_URLS.get(name) # only link to the old pages when the marketing site isn't on elif not settings.MITX_FEATURES.get('ENABLE_MKTG_SITE') and name in link_map: - return reverse(link_map[name]) + # don't try to reverse disabled marketing links + if link_map[name] is not None: + return reverse(link_map[name]) else: log.warning("Cannot find corresponding link for name: {name}".format(name=name)) return '#' diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 463ad333165a..474581c688ed 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -1194,6 +1194,10 @@ def accept_name_change(request): def _get_news(top=None): "Return the n top news items on settings.RSS_URL" + # Don't return anything if we're in a themed site + if settings.MITX_FEATURES["USE_CUSTOM_THEME"]: + return None + feed_data = cache.get("students_index_rss_feed_data") if feed_data is None: if hasattr(settings, 'RSS_URL'): diff --git a/lms/envs/aws.py b/lms/envs/aws.py index a3d5cb653f87..7f69d3596b23 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -99,6 +99,8 @@ with open(ENV_ROOT / CONFIG_PREFIX + "env.json") as env_file: ENV_TOKENS = json.load(env_file) +PLATFORM_NAME = ENV_TOKENS.get('PLATFORM_NAME', PLATFORM_NAME) + SITE_NAME = ENV_TOKENS['SITE_NAME'] SESSION_COOKIE_DOMAIN = ENV_TOKENS.get('SESSION_COOKIE_DOMAIN') @@ -113,11 +115,19 @@ DEFAULT_FEEDBACK_EMAIL = ENV_TOKENS.get('DEFAULT_FEEDBACK_EMAIL', DEFAULT_FEEDBACK_EMAIL) ADMINS = ENV_TOKENS.get('ADMINS', ADMINS) SERVER_EMAIL = ENV_TOKENS.get('SERVER_EMAIL', SERVER_EMAIL) +TECH_SUPPORT_EMAIL = ENV_TOKENS.get('TECH_SUPPORT_EMAIL', TECH_SUPPORT_EMAIL) +CONTACT_EMAIL = ENV_TOKENS.get('CONTACT_EMAIL', CONTACT_EMAIL) +BUGS_EMAIL = ENV_TOKENS.get('BUGS_EMAIL', BUGS_EMAIL) #Theme overrides THEME_NAME = ENV_TOKENS.get('THEME_NAME', None) if not THEME_NAME is None: enable_theme(THEME_NAME) + FAVICON_PATH = 'themes/%s/images/favicon.ico' % THEME_NAME + +# Marketing link overrides +for key, value in ENV_TOKENS.get('MKTG_URL_LINK_MAP', {}).items(): + MKTG_URL_LINK_MAP[key] = value #Timezone overrides TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE) diff --git a/lms/envs/common.py b/lms/envs/common.py index 410287972321..2029715c6004 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -31,6 +31,9 @@ from .discussionsettings import * ################################### FEATURES ################################### +# The display name of the platform to be used in templates/emails/etc. +PLATFORM_NAME = "edX" + COURSEWARE_ENABLED = True ENABLE_JASMINE = False @@ -315,6 +318,9 @@ DEFAULT_FROM_EMAIL = 'registration@edx.org' DEFAULT_FEEDBACK_EMAIL = 'feedback@edx.org' SERVER_EMAIL = 'devops@edx.org' +TECH_SUPPORT_EMAIL = 'technical@edx.org' +CONTACT_EMAIL = 'info@edx.org' +BUGS_EMAIL = 'bugs@edx.org' ADMINS = ( ('edX Admins', 'admin@edx.org'), ) @@ -330,6 +336,8 @@ PROJECT_ROOT / "static", ] +FAVICON_PATH = 'images/favicon.ico' + # Locale/Internationalization TIME_ZONE = 'America/New_York' # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name LANGUAGE_CODE = 'en' # http://www.i18nguy.com/unicode/language-identifiers.html diff --git a/lms/static/sass/application.scss.mako b/lms/static/sass/application.scss.mako index c310347b6f2c..823587bf0487 100644 --- a/lms/static/sass/application.scss.mako +++ b/lms/static/sass/application.scss.mako @@ -4,6 +4,20 @@ @import 'base/font_face'; @import 'base/mixins'; @import 'base/variables'; + +## THEMING +## ------- +## Set up this file to import an edX theme library if the environment +## indicates that a theme should be used. The assumption is that the +## theme resides outside of this main edX repository, in a directory +## called themes//, with its base Sass file in +## themes//static/sass/_.scss. That one entry +## point can be used to @import in as many other things as needed. +% if env.get('THEME_NAME') is not None: + // import theme's Sass overrides + @import '${env.get('THEME_NAME')}'; +% endif + @import 'base/base'; @import 'base/extends'; @import 'base/animations'; @@ -36,16 +50,3 @@ @import 'news'; @import 'shame'; - -## THEMING -## ------- -## Set up this file to import an edX theme library if the environment -## indicates that a theme should be used. The assumption is that the -## theme resides outside of this main edX repository, in a directory -## called themes//, with its base Sass file in -## themes//static/sass/_.scss. That one entry -## point can be used to @import in as many other things as needed. -% if env.get('THEME_NAME') is not None: - // import theme's Sass overrides - @import '${env.get('THEME_NAME')}' -% endif diff --git a/lms/static/sass/course.scss b/lms/static/sass/course.scss.mako similarity index 73% rename from lms/static/sass/course.scss rename to lms/static/sass/course.scss.mako index e57865fa9d43..9d65505316dd 100644 --- a/lms/static/sass/course.scss +++ b/lms/static/sass/course.scss.mako @@ -4,6 +4,20 @@ @import 'base/font_face'; @import 'base/mixins'; @import 'base/variables'; + +## THEMING +## ------- +## Set up this file to import an edX theme library if the environment +## indicates that a theme should be used. The assumption is that the +## theme resides outside of this main edX repository, in a directory +## called themes//, with its base Sass file in +## themes//static/sass/_.scss. That one entry +## point can be used to @import in as many other things as needed. +% if env.get('THEME_NAME') is not None: + // import theme's Sass overrides + @import '${env.get('THEME_NAME')}'; +% endif + @import 'base/base'; @import 'base/extends'; @import 'base/animations'; diff --git a/lms/templates/course.html b/lms/templates/course.html index f009955df158..e8c7cd587545 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -1,4 +1,5 @@ <%namespace name='static' file='static_content.html'/> +<%namespace file='main.html' import="stanford_theme_enabled"/> <%! from django.core.urlresolvers import reverse from courseware.courses import course_image_url, get_course_about_section @@ -24,7 +25,11 @@

${course.number} ${get_course_about_secti

${get_course_about_section(course, 'short_description')}

- ${get_course_about_section(course, 'university')} + % if stanford_theme_enabled(): + ${get_course_about_section(course, 'university')} + % else: + ${get_course_about_section(course, 'university')} + % endif ${course.start_date_text}
diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index 941bf6169879..cc4b2ec31746 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -8,7 +8,11 @@ <%inherit file="../main.html" /> <%block name="headextra"> - <%include file="../google_analytics.html" /> + % if self.theme_enabled(): + <%include file="../theme-google-analytics.html" /> + % else: + <%include file="../google_analytics.html" /> + % endif <%block name="js_extra"> @@ -46,7 +50,12 @@
-

${course.number}: ${get_course_about_section(course, "title")}${get_course_about_section(course, "university")}

+

+ ${course.number}: ${get_course_about_section(course, "title")} + % if not self.theme_enabled(): + ${get_course_about_section(course, "university")} + % endif +

@@ -105,14 +114,26 @@

${course.number}: ${get_course_about_section(course, "title")} - - - + ## TODO: this should probably be an overrideable block, + ## or something allowing themes to do whatever they + ## want here (and on this whole page, really). + % if self.stanford_theme_enabled(): + + + % else: + + + + % endif

diff --git a/lms/templates/courseware/courses.html b/lms/templates/courseware/courses.html index a8fe851d19de..7f0d596f4b89 100644 --- a/lms/templates/courseware/courses.html +++ b/lms/templates/courseware/courses.html @@ -5,13 +5,21 @@ <%block name="title">Courses
-
+ ## `news` should be `None` whenever a non-edX theme is enabled: + ## see common/djangoapps/student/views.py#_get_news %if news:
diff --git a/lms/templates/registration/activation_invalid.html b/lms/templates/registration/activation_invalid.html index 09d373a39dbf..0a6d6d30c9e2 100644 --- a/lms/templates/registration/activation_invalid.html +++ b/lms/templates/registration/activation_invalid.html @@ -12,7 +12,7 @@

Activation Invalid

Something went wrong. Check to make sure the URL you went to was correct -- e-mail programs will sometimes split it into two lines. If you still have issues, e-mail us to let us know what happened - at bugs@edx.org.

+ at ${settings.BUGS_EMAIL}.

Or you can go back to the home page.

diff --git a/lms/templates/static_templates/404.html b/lms/templates/static_templates/404.html index f29968e2f5ec..c297cec881a9 100644 --- a/lms/templates/static_templates/404.html +++ b/lms/templates/static_templates/404.html @@ -4,5 +4,5 @@

Page not found

-

The page that you were looking for was not found. Go back to the homepage or let us know about any pages that may have been moved at technical@edx.org.

+

The page that you were looking for was not found. Go back to the homepage or let us know about any pages that may have been moved at ${settings.TECH_SUPPORT_EMAIL}.

diff --git a/lms/templates/static_templates/server-down.html b/lms/templates/static_templates/server-down.html index 7fada34a5374..ac847db9ee2c 100644 --- a/lms/templates/static_templates/server-down.html +++ b/lms/templates/static_templates/server-down.html @@ -1,6 +1,6 @@ <%inherit file="../main.html" />
-

Currently the edX servers are down

-

Our staff is currently working to get the site back up as soon as possible. Please email us at technical@edx.org to report any problems or downtime.

+

Currently the ${settings.PLATFORM_NAME} servers are down

+

Our staff is currently working to get the site back up as soon as possible. Please email us at ${settings.TECH_SUPPORT_EMAIL} to report any problems or downtime.

diff --git a/lms/templates/static_templates/server-error.html b/lms/templates/static_templates/server-error.html index 5564ea082e1d..04fc11d11a1e 100644 --- a/lms/templates/static_templates/server-error.html +++ b/lms/templates/static_templates/server-error.html @@ -1,6 +1,6 @@ <%inherit file="../main.html" />
-

There has been a 500 error on the edX servers

-

Please wait a few seconds and then reload the page. If the problem persists, please email us at technical@edx.org.

+

There has been a 500 error on the ${settings.PLATFORM_NAME} servers

+

Please wait a few seconds and then reload the page. If the problem persists, please email us at ${settings.TECH_SUPPORT_EMAIL}.

diff --git a/lms/templates/static_templates/server-overloaded.html b/lms/templates/static_templates/server-overloaded.html index bbf4550ff400..2432f2b481af 100644 --- a/lms/templates/static_templates/server-overloaded.html +++ b/lms/templates/static_templates/server-overloaded.html @@ -1,6 +1,6 @@ <%inherit file="../main.html" />
-

Currently the edX servers are overloaded

-

Our staff is currently working to get the site back up as soon as possible. Please email us at technical@edx.org to report any problems or downtime.

+

Currently the ${settings.PLATFORM_NAME} servers are overloaded

+

Our staff is currently working to get the site back up as soon as possible. Please email us at ${settings.TECH_SUPPORT_EMAIL} to report any problems or downtime.

diff --git a/lms/urls.py b/lms/urls.py index 851731e6ec50..d2265463de50 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -58,66 +58,92 @@ name='auth_password_reset_done'), url(r'^heartbeat$', include('heartbeat.urls')), +) - ## - ## Only universities without courses should be included here. If - ## courses exist, the dynamic profile rule below should win. - ## - url(r'^(?i)university_profile/WellesleyX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'WellesleyX'}), - url(r'^(?i)university_profile/McGillX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'McGillX'}), - url(r'^(?i)university_profile/TorontoX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'TorontoX'}), - url(r'^(?i)university_profile/RiceX$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'RiceX'}), - url(r'^(?i)university_profile/ANUx$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'ANUx'}), - url(r'^(?i)university_profile/EPFLx$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'EPFLx'}), - - url(r'^university_profile/(?P[^/]+)$', 'courseware.views.university_profile', - name="university_profile"), - - #Semi-static views (these need to be rendered and have the login bar, but don't change) +# University profiles only make sense in the default edX context +if not settings.MITX_FEATURES["USE_CUSTOM_THEME"]: + urlpatterns += ( + ## + ## Only universities without courses should be included here. If + ## courses exist, the dynamic profile rule below should win. + ## + url(r'^(?i)university_profile/WellesleyX$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'WellesleyX'}), + url(r'^(?i)university_profile/McGillX$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'McGillX'}), + url(r'^(?i)university_profile/TorontoX$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'TorontoX'}), + url(r'^(?i)university_profile/RiceX$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'RiceX'}), + url(r'^(?i)university_profile/ANUx$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'ANUx'}), + url(r'^(?i)university_profile/EPFLx$', 'courseware.views.static_university_profile', + name="static_university_profile", kwargs={'org_id': 'EPFLx'}), + + url(r'^university_profile/(?P[^/]+)$', 'courseware.views.university_profile', + name="university_profile"), + ) + +#Semi-static views (these need to be rendered and have the login bar, but don't change) +urlpatterns += ( url(r'^404$', 'static_template_view.views.render', {'template': '404.html'}, name="404"), - url(r'^about$', 'static_template_view.views.render', - {'template': 'about.html'}, name="about_edx"), - url(r'^jobs$', 'static_template_view.views.render', - {'template': 'jobs.html'}, name="jobs"), - url(r'^contact$', 'static_template_view.views.render', - {'template': 'contact.html'}, name="contact"), - url(r'^press$', 'student.views.press', name="press"), - url(r'^media-kit$', 'static_template_view.views.render', - {'template': 'media-kit.html'}, name="media-kit"), - url(r'^faq$', 'static_template_view.views.render', - {'template': 'faq.html'}, name="faq_edx"), - url(r'^help$', 'static_template_view.views.render', - {'template': 'help.html'}, name="help_edx"), - - url(r'^tos$', 'static_template_view.views.render', - {'template': 'tos.html'}, name="tos"), - url(r'^privacy$', 'static_template_view.views.render', - {'template': 'privacy.html'}, name="privacy_edx"), - # TODO: (bridger) The copyright has been removed until it is updated for edX - # url(r'^copyright$', 'static_template_view.views.render', - # {'template': 'copyright.html'}, name="copyright"), - url(r'^honor$', 'static_template_view.views.render', - {'template': 'honor.html'}, name="honor"), - - #Press releases - url(r'^press/([_a-zA-Z0-9-]+)$', 'static_template_view.views.render_press_release', name='press_release'), - - # Favicon - (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}), - - url(r'^submit_feedback$', 'util.views.submit_feedback_via_zendesk'), - - # TODO: These urls no longer work. They need to be updated before they are re-enabled - # url(r'^reactivate/(?P[^/]*)$', 'student.views.reactivation_email'), ) +# Semi-static views only used by edX, not by themes +if not settings.MITX_FEATURES["USE_CUSTOM_THEME"]: + urlpatterns += ( + url(r'^jobs$', 'static_template_view.views.render', + {'template': 'jobs.html'}, name="jobs"), + url(r'^press$', 'student.views.press', name="press"), + url(r'^media-kit$', 'static_template_view.views.render', + {'template': 'media-kit.html'}, name="media-kit"), + url(r'^help$', 'static_template_view.views.render', + {'template': 'help.html'}, name="help_edx"), + + # TODO: (bridger) The copyright has been removed until it is updated for edX + # url(r'^copyright$', 'static_template_view.views.render', + # {'template': 'copyright.html'}, name="copyright"), + + #Press releases + url(r'^press/([_a-zA-Z0-9-]+)$', 'static_template_view.views.render_press_release', name='press_release'), + + # Favicon + (r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/static/images/favicon.ico'}), + + url(r'^submit_feedback$', 'util.views.submit_feedback_via_zendesk'), + + # TODO: These urls no longer work. They need to be updated before they are re-enabled + # url(r'^reactivate/(?P[^/]*)$', 'student.views.reactivation_email'), + ) + +# Only enable URLs for those marketing links actually enabled in the +# settings. Disable URLs by marking them as None. +for key, value in settings.MKTG_URL_LINK_MAP.items(): + # Skip disabled URLs + if value is None: + continue + + # These urls are enabled separately + if key == "ROOT" or key == "COURSES": + continue + + # Make the assumptions that the templates are all in the same dir + # and that they all match the name of the key (plus extension) + template = "%s.html" % key.lower() + + # To allow theme templates to inherit from default templates, + # prepend a standard prefix + if settings.MITX_FEATURES["USE_CUSTOM_THEME"]: + template = "theme-" + template + + # Make the assumption that the URL we want is the lowercased + # version of the map key + urlpatterns += (url(r'^%s' % key.lower(), + 'static_template_view.views.render', + {'template': template}, name=value),) + + if settings.PERFSTATS: urlpatterns += (url(r'^reprofile$', 'perfstats.views.end_profile'),)