From d5029abfdcd7d131c1162e0e0a5cd10d6a91ec0b Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 30 Apr 2014 10:17:52 -0400 Subject: [PATCH] Make course ids and usage ids opaque to LMS and Studio [partial commit] This commit updates lms/templates. These keys are now objects with a limited interface, and the particular internal representation is managed by the data storage layer (the modulestore). For the LMS, there should be no outward-facing changes to the system. The keys are, for now, a change to internal representation only. For Studio, the new serialized form of the keys is used in urls, to allow for further migration in the future. Co-Author: Andy Armstrong Co-Author: Christina Roberts Co-Author: David Baumgold Co-Author: Diana Huang Co-Author: Don Mitchell Co-Author: Julia Hansbrough Co-Author: Nimisha Asthagiri Co-Author: Sarina Canelake [LMS-2370] --- .../class_dashboard/all_section_metrics.js | 4 +- lms/templates/conditional_ajax.html | 1 - lms/templates/conditional_module.html | 2 +- lms/templates/course.html | 4 +- lms/templates/courseware/course_about.html | 13 +- .../courseware/course_navigation.html | 2 +- lms/templates/courseware/courseware.html | 2 +- lms/templates/courseware/gradebook.html | 2 +- .../courseware/instructor_dashboard.html | 111 ++++---- .../courseware/mktg_coming_soon.html | 1 - .../courseware/mktg_course_about.html | 5 +- lms/templates/courseware/progress.html | 6 +- .../dashboard/_dashboard_course_listing.html | 16 +- lms/templates/discussion/user_profile.html | 2 +- lms/templates/help_modal.html | 2 +- .../instructor_dashboard_2/course_info.html | 6 +- .../instructor_dashboard_2/student_admin.html | 22 +- lms/templates/navigation.html | 6 +- lms/templates/notes.html | 248 +++++++++--------- lms/templates/peer_grading/peer_grading.html | 2 +- .../shoppingcart/verified_cert_receipt.html | 5 +- lms/templates/sysadmin_dashboard_gitlogs.html | 6 +- .../verify_student/_verification_support.html | 4 +- .../midcourse_reverify_dash.html | 8 +- .../verify_student/photo_verification.html | 4 +- .../verify_student/show_requirements.html | 4 +- lms/templates/verify_student/verified.html | 2 +- 27 files changed, 240 insertions(+), 250 deletions(-) diff --git a/lms/templates/class_dashboard/all_section_metrics.js b/lms/templates/class_dashboard/all_section_metrics.js index fc417255c7..7824be9285 100644 --- a/lms/templates/class_dashboard/all_section_metrics.js +++ b/lms/templates/class_dashboard/all_section_metrics.js @@ -6,7 +6,7 @@ $(function () { - d3.json("${reverse('all_sequential_open_distrib', kwargs=dict(course_id=course_id))}", function(error, json) { + d3.json("${reverse('all_sequential_open_distrib', kwargs=dict(course_id=course_id.to_deprecated_string()))}", function(error, json) { var section, paramOpened, barGraphOpened, error; var i, curr_id; var errorMessage = gettext('Unable to retrieve data, please try again later.'); @@ -46,7 +46,7 @@ $(function () { } }); - d3.json("${reverse('all_problem_grade_distribution', kwargs=dict(course_id=course_id))}", function(error, json) { + d3.json("${reverse('all_problem_grade_distribution', kwargs=dict(course_id=course_id.to_deprecated_string()))}", function(error, json) { var section, paramGrade, barGraphGrade, error; var i, curr_id; var errorMessage = gettext('Unable to retrieve data, please try again later.'); diff --git a/lms/templates/conditional_ajax.html b/lms/templates/conditional_ajax.html index 61f1095259..4e49f5d745 100644 --- a/lms/templates/conditional_ajax.html +++ b/lms/templates/conditional_ajax.html @@ -1,7 +1,6 @@
diff --git a/lms/templates/conditional_module.html b/lms/templates/conditional_module.html index 89923f879a..ff37a3521b 100644 --- a/lms/templates/conditional_module.html +++ b/lms/templates/conditional_module.html @@ -4,7 +4,7 @@ from django.core.urlresolvers import reverse def _message(reqm, message): return message.format(link="{url_name}".format( - url = reverse('jump_to', kwargs=dict(course_id=reqm.course_id, + url = reverse('jump_to', kwargs=dict(course_id=reqm.course_id.to_deprecated_string(), location=reqm.location.url())), url_name = reqm.display_name_with_default)) %> diff --git a/lms/templates/course.html b/lms/templates/course.html index 339df6bf8b..7ea104ff77 100644 --- a/lms/templates/course.html +++ b/lms/templates/course.html @@ -5,11 +5,11 @@ from django.core.urlresolvers import reverse from courseware.courses import course_image_url, get_course_about_section %> <%page args="course" /> -
+
%if course.is_newish: ${_("New")} %endif - +
diff --git a/lms/templates/courseware/course_about.html b/lms/templates/courseware/course_about.html index b542eca149..50da3af97b 100644 --- a/lms/templates/courseware/course_about.html +++ b/lms/templates/courseware/course_about.html @@ -2,7 +2,6 @@ <%! from django.core.urlresolvers import reverse from courseware.courses import course_image_url, get_course_about_section - from courseware.access import has_access from django.conf import settings from edxmako.shortcuts import marketing_link @@ -60,7 +59,7 @@ }; $("#add_to_cart_post").click(function(event){ $.ajax({ - url: "${reverse('add_course_to_cart', args=[course.id])}", + url: "${reverse('add_course_to_cart', args=[course.id.to_deprecated_string()])}", type: "POST", /* Rant: HAD TO USE COMPLETE B/C PROMISE.DONE FOR SOME REASON DOES NOT WORK ON THIS PAGE. */ complete: add_course_complete_handler @@ -83,7 +82,7 @@ if(xhr.status == 200) { location.href = "${reverse('dashboard')}"; } else if (xhr.status == 403) { - location.href = "${reverse('course-specific-register', args=[course.id])}?course_id=${course.id}&enrollment_action=enroll"; + location.href = "${reverse('course-specific-register', args=[course.id.to_deprecated_string()])}?course_id=${course.id.to_deprecated_string()}&enrollment_action=enroll"; } else if (xhr.status == 400) { //This means the user did not have permission $('#register_error').html("${perms_error}").css("display", "block"); } else { @@ -104,7 +103,7 @@ location.href = xhr.responseText; } } else if (xhr.status == 403) { - location.href = "${reverse('register_user')}?course_id=${course.id}&enrollment_action=enroll"; + location.href = "${reverse('register_user')}?course_id=${course.id.to_deprecated_string()}&enrollment_action=enroll"; } else { $('#register_error').html( (xhr.responseText ? xhr.responseText : 'An error occurred. Please try again later.') @@ -250,7 +249,7 @@ account=microsite.get_value('course_about_twitter_account', '@edxonline'), url=u"http://{domain}{path}".format( domain=site_domain, - path=reverse('about_course', args=[course.id]) + path=reverse('about_course', args=[course.id.to_deprecated_string()]) ) ).replace(u" ", u"+") tweet_action = u"http://twitter.com/intent/tweet?text={tweet_text}".format(tweet_text=tweet_text) @@ -265,7 +264,7 @@ platform=platform_name, url=u"http://{domain}{path}".format( domain=site_domain, - path=reverse('about_course', args=[course.id]), + path=reverse('about_course', args=[course.id.to_deprecated_string()]), ) ) ).replace(u" ", u"%20") @@ -340,7 +339,7 @@
- +
diff --git a/lms/templates/courseware/course_navigation.html b/lms/templates/courseware/course_navigation.html index 6bd94b23a2..3d9deb0483 100644 --- a/lms/templates/courseware/course_navigation.html +++ b/lms/templates/courseware/course_navigation.html @@ -23,7 +23,7 @@ def url_class(is_active): -
+
diff --git a/lms/templates/help_modal.html b/lms/templates/help_modal.html index 195cb9d903..d39ca20eba 100644 --- a/lms/templates/help_modal.html +++ b/lms/templates/help_modal.html @@ -99,7 +99,7 @@ % if course: - + % endif
diff --git a/lms/templates/instructor/instructor_dashboard_2/course_info.html b/lms/templates/instructor/instructor_dashboard_2/course_info.html index 57333c8dba..7c710037b8 100644 --- a/lms/templates/instructor/instructor_dashboard_2/course_info.html +++ b/lms/templates/instructor/instructor_dashboard_2/course_info.html @@ -16,17 +16,17 @@
  • - ${ section_data['course_org'] } + ${ section_data['course_id'].org }
  • - ${ section_data['course_num'] } + ${ section_data['course_id'].course }
  • - ${ section_data['course_name'] } + ${ section_data['course_id'].run }
  • diff --git a/lms/templates/instructor/instructor_dashboard_2/student_admin.html b/lms/templates/instructor/instructor_dashboard_2/student_admin.html index 1ff3e2727c..64c35a853f 100644 --- a/lms/templates/instructor/instructor_dashboard_2/student_admin.html +++ b/lms/templates/instructor/instructor_dashboard_2/student_admin.html @@ -30,16 +30,13 @@


    -

    ${_('Specify a particular problem in the course here by its url:')} - +

    ${_('Specify a particular problem in the course here by its location:')} +

    - ${_('You may use just the "urlname" if a problem, or "modulename/urlname" if not. (For example, if the location is {location1}, then just provide the {urlname1}. If the location is {location2}, then provide {urlname2}.)').format( - location1="i4x://university/course/problem/problemname", - urlname1="problemname", - location2="i4x://university/course/notaproblem/someothername", - urlname2="notaproblem/someothername") + ${_("You should provide the full location of a problem. A location will look like this: {location}").format( + location="location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525") }

    @@ -81,15 +78,12 @@

    - ${_("Specify a particular problem in the course here by its url:")} - + ${_("Specify a particular problem in the course here by its location:")} +

    - ${_('You may use just the "urlname" if a problem, or "modulename/urlname" if not. (For example, if the location is {location1}, then just provide the {urlname1}. If the location is {location2}, then provide {urlname2}.)').format( - location1="i4x://university/course/problem/problemname", - urlname1="problemname", - location2="i4x://university/course/notaproblem/someothername", - urlname2="notaproblem/someothername") + ${_("You should provide the full location of a problem. A location will look like this: {location}").format( + location="location:edX+Open_DemoX+problem+78c98390884243b89f6023745231c525") }

    diff --git a/lms/templates/navigation.html b/lms/templates/navigation.html index f54a897440..3f8a07347d 100644 --- a/lms/templates/navigation.html +++ b/lms/templates/navigation.html @@ -20,7 +20,7 @@ from status.status import get_site_status_msg <%block cached="False"> <% try: - course_id = course.id + course_id = course.id.to_deprecated_string() except: # can't figure out a better way to get at a possibly-defined course var course_id = None @@ -104,7 +104,7 @@ site_status_msg = get_site_status_msg(course_id) % if not settings.FEATURES['DISABLE_LOGIN_BUTTON']: % if course and settings.FEATURES.get('RESTRICT_ENROLL_BY_REG_METHOD') and course.enrollment_domain:

  • % else: @@ -27,7 +27,7 @@
  • ${_("Technical Requirements")}

    -

    ${_("Please make sure your browser is updated to the {a_start}most recent version possible{a_end}. Also, please make sure your web cam is plugged in, turned on, and allowed to function in your web browser (commonly adjustable in your browser settings).").format(a_start='', a_end="")}

    +

    ${_("Please make sure your browser is updated to the {a_start}most recent version possible{a_end}. Also, please make sure your web cam is plugged in, turned on, and allowed to function in your web browser (commonly adjustable in your browser settings).").format(a_start='', a_end="")}

diff --git a/lms/templates/verify_student/midcourse_reverify_dash.html b/lms/templates/verify_student/midcourse_reverify_dash.html index 3bed7ef7d3..9c0b0aae10 100644 --- a/lms/templates/verify_student/midcourse_reverify_dash.html +++ b/lms/templates/verify_student/midcourse_reverify_dash.html @@ -25,7 +25,9 @@

${item.course_name} (${item.course_number})

${_('Re-verify by {date}').format(date="" + item.date + "")}

-

Re-verify for ${item.course_number}

+

+ ${_("Re-verify for {course_number}").format(course_number=item.course_number)} +

% endfor @@ -42,7 +44,9 @@

${item.course_name} (${item.course_number})

${_('Re-verify by {date}').format(date="" + item.date + "")}

-

Re-verify for ${item.course_number}

+

+ ${_("Re-verify for {course_number}").format(course_number=item.course_number)} +

% endfor diff --git a/lms/templates/verify_student/photo_verification.html b/lms/templates/verify_student/photo_verification.html index f683ff905f..17170d04ef 100644 --- a/lms/templates/verify_student/photo_verification.html +++ b/lms/templates/verify_student/photo_verification.html @@ -27,7 +27,7 @@

${_("No Webcam Detected")}

-

${_("You don't seem to have a webcam connected. Double-check that your webcam is connected and working to continue registering, or select to {a_start} audit the course for free {a_end} without verifying.").format(a_start='', a_end="")}

+

${_("You don't seem to have a webcam connected. Double-check that your webcam is connected and working to continue registering, or select to {a_start} audit the course for free {a_end} without verifying.").format(a_start=''.format(course_modes_choose_url), a_end="")}

@@ -182,7 +182,7 @@ %if upgrade:
${_("You can always continue to audit the course without verifying.")}
%else: -
${_("You can always {a_start} audit the course for free {a_end} without verifying.").format(a_start='', a_end="")}
+
${_("You can always {a_start} audit the course for free {a_end} without verifying.").format(a_start=''.format(course_modes_choose_url), a_end="")}
%endif
diff --git a/lms/templates/verify_student/show_requirements.html b/lms/templates/verify_student/show_requirements.html index 8660db36aa..7b8caf70c2 100644 --- a/lms/templates/verify_student/show_requirements.html +++ b/lms/templates/verify_student/show_requirements.html @@ -168,12 +168,12 @@ %if upgrade: ${_("Missing something? You can always continue to audit this course instead.")} %else: - ${_("Missing something? You can always {a_start}audit this course instead{a_end}").format(a_start='', a_end="")} + ${_("Missing something? You can always {a_start}audit this course instead{a_end}").format(a_start=''.format(course_modes_choose_url), a_end="")} %endif
  1. - +
diff --git a/lms/templates/verify_student/verified.html b/lms/templates/verify_student/verified.html index 965fe498f1..cb61684493 100644 --- a/lms/templates/verify_student/verified.html +++ b/lms/templates/verify_student/verified.html @@ -12,7 +12,7 @@ var submitToPaymentProcessing = function(event) { event.preventDefault(); var xhr = $.post( - "/verify_student/create_order", + "${create_order_url}", { "course_id" : "${course_id}", },