remove code for supporting anchor_id on html textbooks, since it doesn't work
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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})
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -267,10 +267,6 @@ if settings.COURSEWARE_ENABLED:
|
||||
'staticbook.views.html_index', name="html_book"),
|
||||
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/chapter/(?P<chapter>[^/]*)/$',
|
||||
'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/?$',
|
||||
'courseware.views.index', name="courseware"),
|
||||
|
||||
Reference in New Issue
Block a user