@login_required
def html_index(request, course_id, book_index, chapter=None):
 course_key = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 course = get_course_with_access(request.user, 'load', course_key)
 staff_access = bool(has_access(request.user, 'staff', course))
 notes_enabled = notes_enabled_for_course(course)
 book_index = int(book_index)
 if ((book_index < 0) or (book_index >= len(course.html_textbooks))):
  raise Http404('Invalid book index value: {0}'.format(book_index))
 textbook = course.html_textbooks[book_index]
 if ('url' in textbook):
  textbook['url'] = remap_static_url(textbook['url'], course)
 if ('chapters' in textbook):
  for entry in textbook['chapters']:
   entry['url'] = remap_static_url(entry['url'], course)
 student = request.user
 return render_to_response('static_htmlbook.html', {'book_index': book_index, 'course': course, 'textbook': textbook, 'chapter': chapter, 'student': student, 'staff_access': staff_access, 'notes_enabled': notes_enabled, 'storage': course.annotation_storage_url, 'token': retrieve_token(student.email, course.annotation_token_secret)})

@ login_required def html_index ( request , course_id , book_index , chapter = None ) : course_key = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) course = get_course_with_access ( request . user , 'load' , course_key ) staff_access = bool ( has_access ( request . user , 'staff' , course ) ) notes_enabled = notes_enabled_for_course ( course ) book_index = int ( book_index ) if ( ( book_index < 0 ) or ( book_index >= len ( course . html_textbooks ) ) ) : raise Http404 ( 'Invalid book index value: {0}' . format ( book_index ) ) textbook = course . html_textbooks [ book_index ] if ( 'url' in textbook ) : textbook [ 'url' ] = remap_static_url ( textbook [ 'url' ] , course ) if ( 'chapters' in textbook ) : for entry in textbook [ 'chapters' ] : entry [ 'url' ] = remap_static_url ( entry [ 'url' ] , course ) student = request . user return render_to_response ( 'static_htmlbook.html' , { 'book_index' : book_index , 'course' : course , 'textbook' : textbook , 'chapter' : chapter , 'student' : student , 'staff_access' : staff_access , 'notes_enabled' : notes_enabled , 'storage' : course . annotation_storage_url , 'token' : retrieve_token ( student . email , course . annotation_token_secret ) } )
display an html textbook .