From 79edee2d9a07b1cf0227ecb7be36bf7bbd2ae492 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Thu, 6 Jun 2013 09:50:43 -0400 Subject: [PATCH 1/6] read MKTG_URLS from env.json --- cms/envs/aws.py | 1 + 1 file changed, 1 insertion(+) diff --git a/cms/envs/aws.py b/cms/envs/aws.py index af5f39631d..35b15fe6ba 100644 --- a/cms/envs/aws.py +++ b/cms/envs/aws.py @@ -103,6 +103,7 @@ DEFAULT_FROM_EMAIL = ENV_TOKENS.get('DEFAULT_FROM_EMAIL', DEFAULT_FROM_EMAIL) 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) +MKTG_URLS = ENV_TOKENS.get('MKTG_URLS', MKTG_URLS) #Timezone overrides TIME_ZONE = ENV_TOKENS.get('TIME_ZONE', TIME_ZONE) From e2ee5145da06bd39966428cdac7658ab4e0f6048 Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Thu, 6 Jun 2013 10:05:44 -0400 Subject: [PATCH 2/6] updating mktg defaults in common.py --- cms/envs/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cms/envs/common.py b/cms/envs/common.py index 04d5888750..22e69fa08a 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -335,3 +335,14 @@ INSTALLED_APPS = ( ################# EDX MARKETING SITE ################################## EDXMKTG_COOKIE_NAME = 'edxloggedin' +MKTG_URLS = {} +MKTG_URL_LINK_MAP = { + 'ABOUT': 'about_edx', + 'CONTACT': 'contact', + 'FAQ': 'help_edx', + 'COURSES': 'courses', + 'ROOT': 'root', + 'TOS': 'tos', + 'HONOR': 'honor', + 'PRIVACY': 'privacy_edx', +} From 6526146b954f08897424fff3fc5f3073d60168c2 Mon Sep 17 00:00:00 2001 From: Frances Botsford Date: Wed, 5 Jun 2013 15:08:38 -0400 Subject: [PATCH 3/6] updated misused sass body-bg to container-bg variableon account and course views --- lms/static/sass/course/base/_base.scss | 4 ++-- lms/static/sass/multicourse/_account.scss | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lms/static/sass/course/base/_base.scss b/lms/static/sass/course/base/_base.scss index 584412ca22..6d87b7f554 100644 --- a/lms/static/sass/course/base/_base.scss +++ b/lms/static/sass/course/base/_base.scss @@ -35,7 +35,7 @@ a { width: 100%; border-radius: 3px; border: 1px solid $outer-border-color; - background: $body-bg; + background: $container-bg; @include box-shadow(0 1px 2px rgba(0, 0, 0, 0.05)); } } @@ -50,7 +50,7 @@ textarea, input[type="text"], input[type="email"], input[type="password"] { - background: $body-bg; + background: $white; border: 1px solid $border-color-2; @include border-radius(0); @include box-shadow(0 1px 0 0 rgba(255,255,255, 0.6), inset 0 0 3px 0 rgba(0,0,0, 0.1)); diff --git a/lms/static/sass/multicourse/_account.scss b/lms/static/sass/multicourse/_account.scss index dfd803a22d..e531754aac 100644 --- a/lms/static/sass/multicourse/_account.scss +++ b/lms/static/sass/multicourse/_account.scss @@ -6,7 +6,7 @@ // page-level .view-register, .view-login, .view-passwordreset { - background: $body-bg; + background: $container-bg; @@ -331,7 +331,7 @@ } textarea, input { - background: $body-bg; + background: $container-bg; color: rgba(0,0,0,.25); } } From 86a7a255c316fa81c951201b1c394187bd159898 Mon Sep 17 00:00:00 2001 From: Brian Talbot Date: Thu, 6 Jun 2013 10:35:44 -0400 Subject: [PATCH 4/6] resolves background color syncing for particular page/container wrappers --- lms/static/sass/base/_variables.scss | 3 ++- lms/static/sass/multicourse/_account.scss | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lms/static/sass/base/_variables.scss b/lms/static/sass/base/_variables.scss index 5c8c8d18d9..2bbb34a03f 100644 --- a/lms/static/sass/base/_variables.scss +++ b/lms/static/sass/base/_variables.scss @@ -88,9 +88,10 @@ $dashboard-profile-header-color: transparent; $dashboard-profile-color: rgb(252,252,252); $dot-color: $light-gray; -$content-wrapper-bg: shade($body-bg, 2%); +$content-wrapper-bg: $white; $course-bg-color: #d6d6d6; $course-bg-image: url(../images/bg-texture.png); +$account-content-wrapper-bg: shade($body-bg, 2%); $course-profile-bg: rgb(245,245,245); $course-header-bg: rgba(255,255,255, 0.93); diff --git a/lms/static/sass/multicourse/_account.scss b/lms/static/sass/multicourse/_account.scss index e531754aac..7528368986 100644 --- a/lms/static/sass/multicourse/_account.scss +++ b/lms/static/sass/multicourse/_account.scss @@ -98,7 +98,7 @@ // layout .content-wrapper { - background: $content-wrapper-bg; + background: $account-content-wrapper-bg; padding-bottom: 0; } From 9220a4f45940484a31edf61fb599f75d062ac9e4 Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 6 Jun 2013 10:29:10 -0400 Subject: [PATCH 5/6] Bullet-proofing for MKTG_URLS. --- .../contentstore/tests/test_utils.py | 6 ++++++ cms/djangoapps/contentstore/utils.py | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index c4b0f4bb51..0c33c2dcca 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -24,6 +24,12 @@ class LMSLinksTestCase(TestCase): with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}): self.assertEquals(self.get_about_page_link(), "//localhost:8000/courses/mitX/101/test/about") + @override_settings(MKTG_URLS={}) + def about_page_marketing_urls_not_set_test(self): + """ Error case. ENABLE_MKTG_SITE is True, but there is either no MKTG_URLS, or no MKTG_URLS Root property. """ + with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + self.assertEquals(self.get_about_page_link(), None) + @override_settings(LMS_BASE=None) def about_page_no_lms_base_test(self): """ No LMS_BASE, nor is ENABLE_MKTG_SITE True """ diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 703e9a266a..83c413ac72 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -4,6 +4,9 @@ from xmodule.modulestore.django import modulestore from xmodule.modulestore.exceptions import ItemNotFoundError from django.core.urlresolvers import reverse import copy +import logging + +log = logging.getLogger(__name__) DIRECT_ONLY_CATEGORIES = ['course', 'chapter', 'sequential', 'about', 'static_tab', 'course_info'] @@ -108,9 +111,18 @@ def get_lms_link_for_about_page(location): Returns the url to the course about page from the location tuple. """ if settings.MITX_FEATURES.get('ENABLE_MKTG_SITE', False): - # Root will be "www.edx.org". The complete URL will still not be exactly correct, - # but redirects exist from www.edx.org to get to the drupal course about page URL. - about_base = settings.MKTG_URLS.get('ROOT') + if not hasattr(settings, 'MKTG_URLS'): + log.exception("ENABLE_MKTG_SITE is True, but MKTG_URLS is not defined.") + about_base = None + else: + marketing_urls = settings.MKTG_URLS + if marketing_urls.get('ROOT', None) is None: + log.exception('There is no ROOT defined in MKTG_URLS') + about_base = None + else: + # Root will be "www.edx.org". The complete URL will still not be exactly correct, + # but redirects exist from www.edx.org to get to the drupal course about page URL. + about_base = marketing_urls.get('ROOT') elif settings.LMS_BASE is not None: about_base = settings.LMS_BASE else: From e5efdde76a7c7eda45cd64c1cd3ed45e38774314 Mon Sep 17 00:00:00 2001 From: cahrens Date: Thu, 6 Jun 2013 10:55:41 -0400 Subject: [PATCH 6/6] Strip off https:// --- .../contentstore/tests/test_utils.py | 18 ++++++++++++++++++ cms/djangoapps/contentstore/utils.py | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/cms/djangoapps/contentstore/tests/test_utils.py b/cms/djangoapps/contentstore/tests/test_utils.py index 0c33c2dcca..fec82db1bb 100644 --- a/cms/djangoapps/contentstore/tests/test_utils.py +++ b/cms/djangoapps/contentstore/tests/test_utils.py @@ -24,6 +24,24 @@ class LMSLinksTestCase(TestCase): with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': False}): self.assertEquals(self.get_about_page_link(), "//localhost:8000/courses/mitX/101/test/about") + @override_settings(MKTG_URLS={'ROOT': 'http://www.dummy'}) + def about_page_marketing_site_remove_http_test(self): + """ Get URL for about page, marketing root present, remove http://. """ + with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + self.assertEquals(self.get_about_page_link(), "//www.dummy/courses/mitX/101/test/about") + + @override_settings(MKTG_URLS={'ROOT': 'https://www.dummy'}) + def about_page_marketing_site_remove_https_test(self): + """ Get URL for about page, marketing root present, remove https://. """ + with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + self.assertEquals(self.get_about_page_link(), "//www.dummy/courses/mitX/101/test/about") + + @override_settings(MKTG_URLS={'ROOT': 'www.dummyhttps://x'}) + def about_page_marketing_site_https__edge_test(self): + """ Get URL for about page, only remove https:// at the beginning of the string. """ + with mock.patch.dict('django.conf.settings.MITX_FEATURES', {'ENABLE_MKTG_SITE': True}): + self.assertEquals(self.get_about_page_link(), "//www.dummyhttps://x/courses/mitX/101/test/about") + @override_settings(MKTG_URLS={}) def about_page_marketing_urls_not_set_test(self): """ Error case. ENABLE_MKTG_SITE is True, but there is either no MKTG_URLS, or no MKTG_URLS Root property. """ diff --git a/cms/djangoapps/contentstore/utils.py b/cms/djangoapps/contentstore/utils.py index 83c413ac72..e9b62331ef 100644 --- a/cms/djangoapps/contentstore/utils.py +++ b/cms/djangoapps/contentstore/utils.py @@ -5,6 +5,7 @@ from xmodule.modulestore.exceptions import ItemNotFoundError from django.core.urlresolvers import reverse import copy import logging +import re log = logging.getLogger(__name__) @@ -120,9 +121,11 @@ def get_lms_link_for_about_page(location): log.exception('There is no ROOT defined in MKTG_URLS') about_base = None else: - # Root will be "www.edx.org". The complete URL will still not be exactly correct, - # but redirects exist from www.edx.org to get to the drupal course about page URL. + # Root will be "https://www.edx.org". The complete URL will still not be exactly correct, + # but redirects exist from www.edx.org to get to the Drupal course about page URL. about_base = marketing_urls.get('ROOT') + # Strip off https:// (or http://) to be consistent with the formatting of LMS_BASE. + about_base = re.sub(r"^https?://", "", about_base) elif settings.LMS_BASE is not None: about_base = settings.LMS_BASE else: