Commit 2d9deaf3 by Brian Wilson

remove code for supporting anchor_id on html textbooks, since it doesn't work

parent 123cfa33
...@@ -635,7 +635,7 @@ HTML-based Textbooks ...@@ -635,7 +635,7 @@ HTML-based Textbooks
Configuration 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 .. code-block:: json
......
...@@ -85,7 +85,7 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None): ...@@ -85,7 +85,7 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None):
@login_required @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. Display an HTML textbook.
...@@ -97,9 +97,6 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None): ...@@ -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. 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 Defaults to first chapter. Specifying this assumes that there are separate HTML files for
each chapter in a textbook. 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') course = get_course_with_access(request.user, course_id, 'load')
staff_access = has_access(request.user, course, 'staff') 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): ...@@ -131,5 +128,4 @@ def html_index(request, course_id, book_index, chapter=None, anchor_id=None):
'course': course, 'course': course,
'textbook': textbook, 'textbook': textbook,
'chapter': chapter, 'chapter': chapter,
'anchor_id': anchor_id,
'staff_access': staff_access}) 'staff_access': staff_access})
...@@ -26,32 +26,22 @@ ...@@ -26,32 +26,22 @@
// chapters, and it should be in-bounds. // chapters, and it should be in-bounds.
chapterToLoad = options.chapterNum; 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: // clear out previous load, if any:
parentElement = document.getElementById('bookpage'); parentElement = document.getElementById('bookpage');
while (parentElement.hasChildNodes()) while (parentElement.hasChildNodes())
parentElement.removeChild(parentElement.lastChild); parentElement.removeChild(parentElement.lastChild);
// load new URL in: // load new URL in:
$('#bookpage').load(url); $('#bookpage').load(url);
};
// if there is an anchor set, then go to that location: loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum) {
if (anchorId != null) {
// TODO: add implementation....
}
};
loadChapterUrl = function htmlViewLoadChapterUrl(chapterNum, anchorId) {
if (chapterNum < 1 || chapterNum > chapterUrls.length) { if (chapterNum < 1 || chapterNum > chapterUrls.length) {
return; return;
} }
var chapterUrl = chapterUrls[chapterNum-1]; var chapterUrl = chapterUrls[chapterNum-1];
loadUrl(chapterUrl, anchorId); loadUrl(chapterUrl);
}; };
// define navigation links for chapters: // define navigation links for chapters:
...@@ -64,15 +54,15 @@ ...@@ -64,15 +54,15 @@
}; };
for (var index = 1; index <= chapterUrls.length; index += 1) { for (var index = 1; index <= chapterUrls.length; index += 1) {
$("#htmlchapter-" + index).click(loadChapterUrlHelper(index)); $("#htmlchapter-" + index).click(loadChapterUrlHelper(index));
} }
} }
// finally, load the appropriate url/page // finally, load the appropriate url/page
if (urlToLoad != null) { if (urlToLoad != null) {
loadUrl(urlToLoad, anchorToLoad); loadUrl(urlToLoad);
} else { } else {
loadChapterUrl(chapterToLoad, anchorToLoad); loadChapterUrl(chapterToLoad);
} }
} }
})(jQuery); })(jQuery);
...@@ -92,9 +82,6 @@ ...@@ -92,9 +82,6 @@
%if chapter is not None: %if chapter is not None:
options.chapterNum = ${chapter}; options.chapterNum = ${chapter};
%endif %endif
%if anchor_id is not None:
options.anchor_id = ${anchor_id};
%endif
$('#outerContainer').myHTMLViewer(options); $('#outerContainer').myHTMLViewer(options);
}); });
......
...@@ -267,10 +267,6 @@ if settings.COURSEWARE_ENABLED: ...@@ -267,10 +267,6 @@ if settings.COURSEWARE_ENABLED:
'staticbook.views.html_index', name="html_book"), 'staticbook.views.html_index', name="html_book"),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/chapter/(?P<chapter>[^/]*)/$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/chapter/(?P<chapter>[^/]*)/$',
'staticbook.views.html_index'), 'staticbook.views.html_index'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/chapter/(?P<chapter>[^/]*)/(?P<anchor_id>[^/]*)/$',
'staticbook.views.html_index'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/(?P<anchor_id>[^/]*)/$',
'staticbook.views.html_index'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/courseware/?$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/courseware/?$',
'courseware.views.index', name="courseware"), 'courseware.views.index', name="courseware"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment