diff --git a/lms/djangoapps/courseware/views.py b/lms/djangoapps/courseware/views.py index e75ef8e8cf..9099d21233 100644 --- a/lms/djangoapps/courseware/views.py +++ b/lms/djangoapps/courseware/views.py @@ -522,6 +522,12 @@ def static_university_profile(request, org_id): """ Return the profile for the particular org_id that does not have any courses. """ + # Redirect to the properly capitalized org_id + last_path = request.path.split('/')[-1] + if last_path != org_id: + return redirect('static_university_profile', org_id=org_id) + + # Render template template_file = "university_profile/{0}.html".format(org_id).lower() context = dict(courses=[], org_id=org_id) return render_to_response(template_file, context) @@ -533,17 +539,28 @@ def university_profile(request, org_id): """ Return the profile for the particular org_id. 404 if it's not valid. """ + virtual_orgs_ids = settings.VIRTUAL_UNIVERSITIES + meta_orgs = getattr(settings, 'META_UNIVERSITIES', {}) + + # Get all the ids associated with this organization all_courses = modulestore().get_courses() - valid_org_ids = set(c.org for c in all_courses).union(settings.VIRTUAL_UNIVERSITIES) - if org_id not in valid_org_ids: + valid_orgs_ids = set(c.org for c in all_courses) + valid_orgs_ids.update(virtual_orgs_ids + meta_orgs.keys()) + + if org_id not in valid_orgs_ids: raise Http404("University Profile not found for {0}".format(org_id)) - # Only grab courses for this org... - courses = get_courses_by_university(request.user, - domain=request.META.get('HTTP_HOST'))[org_id] - courses = sort_by_announcement(courses) + # Grab all courses for this organization(s) + org_ids = set([org_id] + meta_orgs.get(org_id, [])) + org_courses = [] + domain = request.META.get('HTTP_HOST') + for key in org_ids: + cs = get_courses_by_university(request.user, domain=domain)[key] + org_courses.extend(cs) - context = dict(courses=courses, org_id=org_id) + org_courses = sort_by_announcement(org_courses) + + context = dict(courses=org_courses, org_id=org_id) template_file = "university_profile/{0}.html".format(org_id).lower() return render_to_response(template_file, context) diff --git a/lms/envs/aws.py b/lms/envs/aws.py index cc9247b876..aa30315eca 100644 --- a/lms/envs/aws.py +++ b/lms/envs/aws.py @@ -76,6 +76,7 @@ LOGGING = get_logger_config(LOG_DIR, COURSE_LISTINGS = ENV_TOKENS.get('COURSE_LISTINGS', {}) SUBDOMAIN_BRANDING = ENV_TOKENS.get('SUBDOMAIN_BRANDING', {}) VIRTUAL_UNIVERSITIES = ENV_TOKENS.get('VIRTUAL_UNIVERSITIES', []) +META_UNIVERSITIES = ENV_TOKENS.get('META_UNIVERSITIES', {}) COMMENTS_SERVICE_URL = ENV_TOKENS.get("COMMENTS_SERVICE_URL", '') COMMENTS_SERVICE_KEY = ENV_TOKENS.get("COMMENTS_SERVICE_KEY", '') CERT_QUEUE = ENV_TOKENS.get("CERT_QUEUE", 'test-pull') diff --git a/lms/envs/cms/dev.py b/lms/envs/cms/dev.py index 4b6b0a12f0..9333b7883c 100644 --- a/lms/envs/cms/dev.py +++ b/lms/envs/cms/dev.py @@ -9,6 +9,7 @@ MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = False SUBDOMAIN_BRANDING['edge'] = 'edge' SUBDOMAIN_BRANDING['preview.edge'] = 'edge' VIRTUAL_UNIVERSITIES = ['edge'] +META_UNIVERSITIES = {} modulestore_options = { 'default_class': 'xmodule.raw_module.RawDescriptor', diff --git a/lms/envs/dev.py b/lms/envs/dev.py index f204dc287b..24bad58459 100644 --- a/lms/envs/dev.py +++ b/lms/envs/dev.py @@ -113,6 +113,9 @@ SUBDOMAIN_BRANDING = { # have an actual course with that org set VIRTUAL_UNIVERSITIES = [] +# Organization that contain other organizations +META_UNIVERSITIES = {'UTx': ['UTAustinX']} + COMMENTS_SERVICE_KEY = "PUT_YOUR_API_KEY_HERE" ############################## Course static files ########################## diff --git a/lms/static/images/university/utaustin/utaustin-cover_2025x550.jpg b/lms/static/images/university/utaustin/utaustin-cover_2025x550.jpg new file mode 100644 index 0000000000..7294b53f1b Binary files /dev/null and b/lms/static/images/university/utaustin/utaustin-cover_2025x550.jpg differ diff --git a/lms/static/images/university/utaustin/utaustin-standalone_187x80.png b/lms/static/images/university/utaustin/utaustin-standalone_187x80.png new file mode 100644 index 0000000000..5349800763 Binary files /dev/null and b/lms/static/images/university/utaustin/utaustin-standalone_187x80.png differ diff --git a/lms/templates/university_profile/utaustinx.html b/lms/templates/university_profile/utaustinx.html new file mode 100644 index 0000000000..b4f6b4446e --- /dev/null +++ b/lms/templates/university_profile/utaustinx.html @@ -0,0 +1,23 @@ +<%inherit file="base.html" /> +<%namespace name='static' file='../static_content.html'/> + +<%block name="title">
+ The University of Texas at Austin is the top-ranked public university in a nearly 1,000-mile radius, and is ranked in the top 25 universities in the world. Students have been finding their passion in life at UT Austin for more than 130 years, and it has been a member of the prestigious AAU since 1929. UT Austin combines the academic depth and breadth of a world research institute (regularly ranking within the top three producers of doctoral degrees in the country) with the fun and excitement of a big-time collegiate experience. It is currently the fifth-largest university in America, with more than 50,000 students and 3,000 professors across 17 colleges and schools, and is the first major American university to build a medical school in the past 50 years.
+%block> + +${parent.body()} diff --git a/lms/templates/university_profile/utx.html b/lms/templates/university_profile/utx.html index b9378f6ce3..ea34ddb85b 100644 --- a/lms/templates/university_profile/utx.html +++ b/lms/templates/university_profile/utx.html @@ -1,5 +1,8 @@ <%inherit file="base.html" /> <%namespace name='static' file='../static_content.html'/> +<%! + from django.core.urlresolvers import reverse +%> <%block name="title">Educating students, providing care for patients, conducting groundbreaking research and serving the needs of Texans and the nation for more than 130 years, The University of Texas System is one of the largest public university systems in the United States, with nine academic universities and six health science centers. Student enrollment exceeded 215,000 in the 2011 academic year. The UT System confers more than one-third of the state’s undergraduate degrees and educates nearly three-fourths of the state’s health care professionals annually. The UT System has an annual operating budget of $13.1 billion (FY 2012) including $2.3 billion in sponsored programs funded by federal, state, local and private sources. With roughly 87,000 employees, the UT System is one of the largest employers in the state.
+Find out about the University of Texas Austin.
%block> ${parent.body()} diff --git a/lms/urls.py b/lms/urls.py index ee213f2b8c..de5c8184fa 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -69,44 +69,22 @@ urlpatterns = ('', url(r'^heartbeat$', include('heartbeat.urls')), - url(r'^university_profile/UTx$', 'courseware.views.static_university_profile', - name="static_university_profile", kwargs={'org_id': 'UTx'}), - url(r'^university_profile/WellesleyX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/WellesleyX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'WellesleyX'}), - url(r'^university_profile/GeorgetownX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/GeorgetownX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'GeorgetownX'}), - - # Dan accidentally sent out a press release with lower case urls for McGill, Toronto, - # Rice, ANU, Delft, and EPFL. Hence the redirects. - url(r'^university_profile/McGillX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/McGillX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'McGillX'}), - url(r'^university_profile/mcgillx$', - RedirectView.as_view(url='/university_profile/McGillX')), - - url(r'^university_profile/TorontoX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/TorontoX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'TorontoX'}), - url(r'^university_profile/torontox$', - RedirectView.as_view(url='/university_profile/TorontoX')), - - url(r'^university_profile/RiceX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/RiceX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'RiceX'}), - url(r'^university_profile/ricex$', - RedirectView.as_view(url='/university_profile/RiceX')), - - url(r'^university_profile/ANUx$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/ANUx$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'ANUx'}), - url(r'^university_profile/anux$', - RedirectView.as_view(url='/university_profile/ANUx')), - - url(r'^university_profile/DelftX$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/DelftX$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'DelftX'}), - url(r'^university_profile/delftx$', - RedirectView.as_view(url='/university_profile/DelftX')), - - url(r'^university_profile/EPFLx$', 'courseware.views.static_university_profile', + url(r'^(?i)university_profile/EPFLx$', 'courseware.views.static_university_profile', name="static_university_profile", kwargs={'org_id': 'EPFLx'}), - url(r'^university_profile/epflx$', - RedirectView.as_view(url='/university_profile/EPFLx')), url(r'^university_profile/(?P