diff --git a/common/static/js/vendor/pdf.js.REMOVED.git-id b/common/static/js/vendor/pdf.js.REMOVED.git-id new file mode 100644 index 0000000000..2c8e1c2562 --- /dev/null +++ b/common/static/js/vendor/pdf.js.REMOVED.git-id @@ -0,0 +1 @@ +14bab45163f93a24ad55d82faafc3e56bce0a222 \ No newline at end of file diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 24f3964713..a33cd76958 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -1,10 +1,12 @@ -from django.conf import settings +from lxml import etree + +# from django.conf import settings from django.contrib.auth.decorators import login_required from mitxmako.shortcuts import render_to_response from courseware.access import has_access from courseware.courses import get_course_with_access -from lxml import etree +from static_replace import replace_static_urls @login_required @@ -40,6 +42,19 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None): book_index = int(book_index) textbook = course.pdf_textbooks[book_index] + def remap_static_url(original_url, course): + input_url = "'" + original_url + "'" + output_url = replace_static_urls( + input_url, + course.metadata['data_dir'], + course_namespace=course.location + ) + # strip off the quotes again... + return output_url[1:-1] + + textbook['url'] = remap_static_url(textbook['url'], course) + # then remap all the chapter URLs as well, if they are provided. + # if page is None: # page = textbook.start_page diff --git a/lms/templates/static_pdfbook.html b/lms/templates/static_pdfbook.html index 29cf00d83f..0b7a7d38da 100644 --- a/lms/templates/static_pdfbook.html +++ b/lms/templates/static_pdfbook.html @@ -9,8 +9,7 @@ <%block name="js_extra"> - - + - -<%include file="/courseware/course_navigation.html" args="active_page='textbook/{0}'.format(book_index)" /> +<%include file="/courseware/course_navigation.html" args="active_page='pdftextbook/{0}'.format(book_index)" />
diff --git a/lms/urls.py b/lms/urls.py index de71366cda..578756e2f5 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -239,10 +239,11 @@ if settings.COURSEWARE_ENABLED: url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/pdfbook/(?P[^/]*)/(?P[^/]*)$', 'staticbook.views.pdf_index'), - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/pdfbook/(?P[^/]*)/chapter/(?P[^/]*)/$', - 'staticbook.views.pdf_index'), - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/pdfbook/(?P[^/]*)/chapter/(?P[^/]*)/(?P[^/]*)$', - 'staticbook.views.pdf_index'), +# Doesn't yet support loading individual chapters... +# url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/pdfbook/(?P[^/]*)/chapter/(?P[^/]*)/$', +# 'staticbook.views.pdf_index'), +# url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/pdfbook/(?P[^/]*)/chapter/(?P[^/]*)/(?P[^/]*)$', +# 'staticbook.views.pdf_index'), url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/courseware/?$', 'courseware.views.index', name="courseware"),