Files
edx-platform/lms/templates/static_pdfbook.html
Dave St.Germain b0a7443570 updated pdf viewer
2014-03-20 17:00:41 -04:00

70 lines
1.8 KiB
HTML

<%! from django.utils.translation import ugettext as _ %>
<%inherit file="main.html" />
<%namespace name='static' file='static_content.html'/>
<%block name="pagetitle">${_('{course_number} Textbook').format(course_number=course.display_number_with_default) | h}</%block>
<%block name="nav_skip">#viewer-frame</%block>
<%block name="headextra">
<%static:css group='style-course-vendor'/>
<%static:css group='style-course'/>
<%static:js group='courseware'/>
</%block>
<%include file="/courseware/course_navigation.html" args="active_page='pdftextbook/{0}'.format(book_index)" />
<script>
$(function(){
$('a.chapter').click(function(e){
e.preventDefault();
var url = $(this).attr('rel');
$('#viewer-frame').attr({
'src': '${request.path}?viewer=true&file=' + url + '#zoom=page-fit',
'title': $(this).text()
});
$('#viewer-frame').focus();
});
});
</script>
<div class="book-wrapper">
%if 'chapters' in textbook:
<section class="book-sidebar" aria-label="${_('Textbook Navigation')}">
<ul id="booknav" tabindex="0">
% for (index, entry) in enumerate(textbook['chapters']):
<li>
<a class="chapter" rel="${entry['url']}" href="#">${entry.get('title')}</a>
</li>
% endfor
</ul>
</section>
%endif
<%
params = '&file='
label = ""
if 'url' in textbook:
params += textbook['url']
elif chapter is not None:
chap = textbook['chapters'][int(chapter) - 1]
else:
chap = textbook['chapters'][0]
params += chap['url']
label = chap['title']
if page is not None:
params += '&amp;page={}'.format(page)
%>
<div class="book">
<iframe
title="${label}"
id="viewer-frame"
src="${request.path}?viewer=true${params}#zoom=page-fit"
width="856"
height="1108"
frameborder="0"
seamless
tabindex="1"
aria-live="polite"></iframe>
</div>
</div>