From 2d9deaf38c6c17eabb6f7f8c6865bb71f9a024e6 Mon Sep 17 00:00:00 2001 From: Brian Wilson Date: Fri, 12 Apr 2013 11:53:06 -0400 Subject: [PATCH] remove code for supporting anchor_id on html textbooks, since it doesn't work --- doc/public/course_data_formats/course_xml.rst | 2 +- lms/djangoapps/staticbook/views.py | 6 +--- lms/templates/static_htmlbook.html | 29 +++++-------------- lms/urls.py | 4 --- 4 files changed, 10 insertions(+), 31 deletions(-) diff --git a/doc/public/course_data_formats/course_xml.rst b/doc/public/course_data_formats/course_xml.rst index 19d1e01ed3..22d96d1432 100644 --- a/doc/public/course_data_formats/course_xml.rst +++ b/doc/public/course_data_formats/course_xml.rst @@ -635,7 +635,7 @@ HTML-based Textbooks Configuration ------------- -HTML-based textbooks are configured at the course level in the policy file. The JSON markup consists of an array of maps, with each map corresponding to a separate textbook. There are two styles to presenting HTML-based material. The first way is as a single HTML on a tab, which requires only a tab title and a URL for configuration. A second way permits the display of multiple HTMLs that should be displayed together on a single view. For this view, a side panel of links is available on the left, allowing selection of a particular HTML to view. +HTML-based textbooks are configured at the course level in the policy file. The JSON markup consists of an array of maps, with each map corresponding to a separate textbook. There are two styles to presenting HTML-based material. The first way is as a single HTML on a tab, which requires only a tab title and a URL for configuration. A second way permits the display of multiple HTML files that should be displayed together on a single view. For this view, a side panel of links is available on the left, allowing selection of a particular HTML to view. .. code-block:: json diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index d3b5f28701..96fe338c8a 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -85,7 +85,7 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None): @login_required -def html_index(request, course_id, book_index, chapter=None, anchor_id=None): +def html_index(request, course_id, book_index, chapter=None): """ Display an HTML textbook. @@ -97,9 +97,6 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None): chapter: (optional) one-based index into the chapter array of textbook HTML files to display. Defaults to first chapter. Specifying this assumes that there are separate HTML files for each chapter in a textbook. - - anchor_id: (optional) id of the anchor to display within the HTML. Defaults to top of document. - (NOT IMPLEMENTED.) """ course = get_course_with_access(request.user, course_id, 'load') staff_access = has_access(request.user, course, 'staff') @@ -131,5 +128,4 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None): 'course': course, 'textbook': textbook, 'chapter': chapter, - 'anchor_id': anchor_id, 'staff_access': staff_access}) diff --git a/lms/templates/static_htmlbook.html b/lms/templates/static_htmlbook.html index 9500a379ac..830ddddca9 100644 --- a/lms/templates/static_htmlbook.html +++ b/lms/templates/static_htmlbook.html @@ -26,32 +26,22 @@ // chapters, and it should be in-bounds. chapterToLoad = options.chapterNum; } - var anchorToLoad = null; - if (options.chapters) { - anchorToLoad = options.anchor_id; - } - loadUrl = function htmlViewLoadUrl(url, anchorId) { + loadUrl = function htmlViewLoadUrl(url) { // clear out previous load, if any: parentElement = document.getElementById('bookpage'); while (parentElement.hasChildNodes()) parentElement.removeChild(parentElement.lastChild); // load new URL in: $('#bookpage').load(url); + }; - // if there is an anchor set, then go to that location: - if (anchorId != null) { - // TODO: add implementation.... - } - - }; - - loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum, anchorId) { + loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum) { if (chapterNum < 1 || chapterNum > chapterUrls.length) { return; } var chapterUrl = chapterUrls[chapterNum-1]; - loadUrl(chapterUrl, anchorId); + loadUrl(chapterUrl); }; // define navigation links for chapters: @@ -64,15 +54,15 @@ }; for (var index = 1; index <= chapterUrls.length; index += 1) { $("#htmlchapter-" + index).click(loadChapterUrlHelper(index)); - } + } } // finally, load the appropriate url/page if (urlToLoad != null) { - loadUrl(urlToLoad, anchorToLoad); + loadUrl(urlToLoad); } else { - loadChapterUrl(chapterToLoad, anchorToLoad); - } + loadChapterUrl(chapterToLoad); + } } })(jQuery); @@ -92,9 +82,6 @@ %if chapter is not None: options.chapterNum = ${chapter}; %endif - %if anchor_id is not None: - options.anchor_id = ${anchor_id}; - %endif $('#outerContainer').myHTMLViewer(options); }); diff --git a/lms/urls.py b/lms/urls.py index 4a0608720a..5a4d4fa852 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -267,10 +267,6 @@ if settings.COURSEWARE_ENABLED: 'staticbook.views.html_index', name="html_book"), url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/htmlbook/(?P[^/]*)/chapter/(?P[^/]*)/$', 'staticbook.views.html_index'), - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/htmlbook/(?P[^/]*)/chapter/(?P[^/]*)/(?P[^/]*)/$', - 'staticbook.views.html_index'), - url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/htmlbook/(?P[^/]*)/(?P[^/]*)/$', - 'staticbook.views.html_index'), url(r'^courses/(?P[^/]+/[^/]+/[^/]+)/courseware/?$', 'courseware.views.index', name="courseware"),