Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
dcd32abc
Commit
dcd32abc
authored
Sep 19, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #729 from MITx/feature/dave/textbook_fixes
Fixing textbook bugs that didn't appear in 6.002x
parents
b3bde7d6
3cde783b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
common/lib/xmodule/xmodule/course_module.py
+9
-1
lms/djangoapps/staticbook/views.py
+6
-1
lms/templates/staticbook.html
+7
-3
No files found.
common/lib/xmodule/xmodule/course_module.py
View file @
dcd32abc
...
...
@@ -21,7 +21,15 @@ class CourseDescriptor(SequenceDescriptor):
self
.
title
=
title
self
.
book_url
=
book_url
self
.
table_of_contents
=
self
.
_get_toc_from_s3
()
self
.
start_page
=
int
(
self
.
table_of_contents
[
0
]
.
attrib
[
'page'
])
# The last page should be the last element in the table of contents,
# but it may be nested. So recurse all the way down the last element
last_el
=
self
.
table_of_contents
[
-
1
]
while
last_el
.
getchildren
():
last_el
=
last_el
[
-
1
]
self
.
end_page
=
int
(
last_el
.
attrib
[
'page'
])
@property
def
table_of_contents
(
self
):
...
...
lms/djangoapps/staticbook/views.py
View file @
dcd32abc
...
...
@@ -7,7 +7,7 @@ from courseware.courses import get_course_with_access
from
lxml
import
etree
@login_required
def
index
(
request
,
course_id
,
book_index
,
page
=
0
):
def
index
(
request
,
course_id
,
book_index
,
page
=
None
):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
...
...
@@ -15,10 +15,15 @@ def index(request, course_id, book_index, page=0):
textbook
=
course
.
textbooks
[
book_index
]
table_of_contents
=
textbook
.
table_of_contents
if
page
is
None
:
page
=
textbook
.
start_page
return
render_to_response
(
'staticbook.html'
,
{
'book_index'
:
book_index
,
'page'
:
int
(
page
),
'course'
:
course
,
'book_url'
:
textbook
.
book_url
,
'table_of_contents'
:
table_of_contents
,
'start_page'
:
textbook
.
start_page
,
'end_page'
:
textbook
.
end_page
,
'staff_access'
:
staff_access
})
def
index_shifted
(
request
,
course_id
,
page
):
...
...
lms/templates/staticbook.html
View file @
dcd32abc
<
%
inherit
file=
"main.html"
/>
<
%
namespace
name=
'static'
file=
'static_content.html'
/>
<
%
block
name=
"title"
><title>
Textbook – MITx 6.002x
</title></
%
block>
<
%
block
name=
"title"
><title>
${course.number} Textbook
</title></
%
block>
<
%
block
name=
"headextra"
>
<
%
static:css
group=
'course'
/>
...
...
@@ -38,14 +38,14 @@ function goto_page(n) {
function
prev_page
()
{
var
newpage
=
page
-
1
;
if
(
newpage
<
0
)
newpage
=
0
;
if
(
newpage
<
$
{
start_page
})
newpage
=
$
{
start_page
}
;
goto_page
(
newpage
);
log_event
(
"book"
,
{
"type"
:
"prevpage"
,
"new"
:
page
});
}
function
next_page
()
{
var
newpage
=
page
+
1
;
if
(
newpage
>
1008
)
newpage
=
1008
;
if
(
newpage
>
$
{
end_page
})
newpage
=
$
{
end_page
}
;
goto_page
(
newpage
);
log_event
(
"book"
,
{
"type"
:
"nextpage"
,
"new"
:
page
});
}
...
...
@@ -97,6 +97,10 @@ $("#open_close_accordion a").click(function(){
% for entry in table_of_contents:
${print_entry(entry)}
% endfor
## Don't delete this empty list item. Without it, Jquery.TreeView won't
## render the last list item as expandable.
<li></li>
</ul>
</section>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment