From 0b03834f517f72645f329ea40c0d30c86102d107 Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Wed, 1 Aug 2012 17:13:58 -0400 Subject: [PATCH 1/2] XML based table of contents for books. --- lms/djangoapps/staticbook/views.py | 6 +- lms/templates/book_toc.html | 356 ------------------------- lms/templates/book_toc.xml | 413 +++++++++++++++++++++++++++++ lms/templates/staticbook.html | 19 +- 4 files changed, 435 insertions(+), 359 deletions(-) delete mode 100644 lms/templates/book_toc.html create mode 100644 lms/templates/book_toc.xml diff --git a/lms/djangoapps/staticbook/views.py b/lms/djangoapps/staticbook/views.py index 948e66b50c..cb15f5855e 100644 --- a/lms/djangoapps/staticbook/views.py +++ b/lms/djangoapps/staticbook/views.py @@ -2,12 +2,14 @@ from django.contrib.auth.decorators import login_required from mitxmako.shortcuts import render_to_response from courseware.courses import check_course - +from lxml import etree @login_required def index(request, course_id, page=0): course = check_course(course_id) - return render_to_response('staticbook.html', {'page': int(page), 'course': course}) + raw_table_of_contents = open('lms/templates/book_toc.xml', 'r') # TODO: This will need to come from S3 + table_of_contents = etree.parse(raw_table_of_contents).getroot() + return render_to_response('staticbook.html', {'page': int(page), 'course': course, 'table_of_contents': table_of_contents}) def index_shifted(request, course_id, page): diff --git a/lms/templates/book_toc.html b/lms/templates/book_toc.html deleted file mode 100644 index ed4794da65..0000000000 --- a/lms/templates/book_toc.html +++ /dev/null @@ -1,356 +0,0 @@ -
  • Contents ix -
  • Preamble i - - -
  • 1 The Circuit Abstraction 3 -
  • 2 Resistive Networks 53 -
  • 3 Network Theorems 119 -
  • 4 Analysis of Nonlinear Circuits 193 -
  • 5 The Digital Abstraction 243 -
  • 6 The MOSFET Switch 285 -
  • 7 The MOSFET Amplifier 331 -
  • 8 The Small Signal Model 405 -
  • 9 Energy Storage Elements 457 -
  • 10 First-order Transients 503 -
  • 11 Energy and Power in Digital Circuits 595 -
  • 12 Transients in Second Order Circuits 625 -
  • 13 Sinusoidal Steady State 703 -
  • 14 Sinusoidal Steady State: Resonance 777 -
  • 15 The Operational Amplifier Abstraction 837 -
  • 16 Diodes 905 -
  • A1 Maxwell's Equations and the LMD 927 -
  • B Trigonometric Functions & Identities 941 -
  • C Complex Numbers 947 -
  • D Solving Simultaneous Linear Equations 957 - - -
  • Answers to Selected Problems 959 -
  • Figure Acknowledgments 971 -
  • Index 973 diff --git a/lms/templates/book_toc.xml b/lms/templates/book_toc.xml new file mode 100644 index 0000000000..88dc016905 --- /dev/null +++ b/lms/templates/book_toc.xml @@ -0,0 +1,413 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lms/templates/staticbook.html b/lms/templates/staticbook.html index dbc5bb1cec..86f5e3de27 100644 --- a/lms/templates/staticbook.html +++ b/lms/templates/staticbook.html @@ -71,7 +71,24 @@ $("#open_close_accordion a").click(function(){ From bcdcd7341f775c3f07902d149f3d644874990eac Mon Sep 17 00:00:00 2001 From: Matthew Mongeau Date: Wed, 8 Aug 2012 11:39:39 -0400 Subject: [PATCH 2/2] include courseware js --- lms/templates/staticbook.html | 1 + 1 file changed, 1 insertion(+) diff --git a/lms/templates/staticbook.html b/lms/templates/staticbook.html index 86f5e3de27..804676de97 100644 --- a/lms/templates/staticbook.html +++ b/lms/templates/staticbook.html @@ -4,6 +4,7 @@ <%block name="headextra"> <%static:css group='course'/> +<%static:js group='courseware'/> <%block name="js_extra">