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
bed7dbdb
Commit
bed7dbdb
authored
Mar 08, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix plumbing for anchors and chapters.
parent
49dee508
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
25 deletions
+19
-25
lms/djangoapps/staticbook/views.py
+2
-2
lms/templates/static_htmlbook.html
+12
-22
lms/urls.py
+5
-1
No files found.
lms/djangoapps/staticbook/views.py
View file @
bed7dbdb
...
...
@@ -69,7 +69,7 @@ def pdf_index(request, course_id, book_index, chapter=None, page=None):
'staff_access'
:
staff_access
})
@login_required
def
html_index
(
request
,
course_id
,
book_index
,
chapter
=
None
,
page
=
None
):
def
html_index
(
request
,
course_id
,
book_index
,
chapter
=
None
,
anchor_id
=
None
):
course
=
get_course_with_access
(
request
.
user
,
course_id
,
'load'
)
staff_access
=
has_access
(
request
.
user
,
course
,
'staff'
)
...
...
@@ -99,5 +99,5 @@ def html_index(request, course_id, book_index, chapter=None, page=None):
'course'
:
course
,
'textbook'
:
textbook
,
'chapter'
:
chapter
,
'
page'
:
page
,
'
anchor_id'
:
anchor_id
,
'staff_access'
:
staff_access
})
lms/templates/static_htmlbook.html
View file @
bed7dbdb
...
...
@@ -27,35 +27,22 @@
chapterToLoad
=
options
.
chapterNum
;
}
var
anchorToLoad
=
null
;
loadUrlAsIframe
=
function
htmlViewLoadUrlAsIframe
(
url
,
anchorId
)
{
if
(
anchorId
!=
null
)
{
var
newurl
=
url
+
"#"
+
anchorId
;
$
(
"#bookpage"
).
src
=
newurl
;
}
else
{
// $("#bookpage").src = url;
// $("#bookpage").append("
<
iframe
seamless
id
=
"bookpage-iframe"
src
=
" + url + "
\
"></iframe>"
)
parentElement
=
document
.
getElementById
(
'bookpage'
);
while
(
parentElement
.
hasChildNodes
())
parentElement
.
removeChild
(
parentElement
.
lastChild
);
$
(
'<iframe id="bookpage-iframe" src="'
+
url
+
'"></iframe>"'
)
// .css({'height':'40px','width':'200px'})
.
appendTo
(
'#bookpage'
);
}
};
if
(
options
.
chapters
)
{
anchorToLoad
=
options
.
anchor_id
;
}
loadUrl
=
function
htmlViewLoadUrl
(
url
,
anchorId
)
{
var
newurl
=
url
;
if
(
anchorId
!=
null
)
{
newurl
=
url
+
"#"
+
anchorId
;
}
// clear out previous load, if any:
parentElement
=
document
.
getElementById
(
'bookpage'
);
while
(
parentElement
.
hasChildNodes
())
parentElement
.
removeChild
(
parentElement
.
lastChild
);
// load new URL in:
$
(
'#bookpage'
).
load
(
url
);
$
(
'#bookpage'
).
load
(
newurl
);
// if there is an anchor set, then go to that location:
if
(
anchorId
!=
null
)
{
// TODO: add implementation....
}
};
...
...
@@ -105,6 +92,9 @@
%
if
chapter
is
not
None
:
options
.
chapterNum
=
$
{
chapter
};
%
endif
%
if
anchor_id
is
not
None
:
options
.
anchor_id
=
$
{
anchor_id
};
%
endif
$
(
'#outerContainer'
).
myHTMLViewer
(
options
);
});
...
...
lms/urls.py
View file @
bed7dbdb
...
...
@@ -287,7 +287,11 @@ if settings.COURSEWARE_ENABLED:
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/$'
,
'staticbook.views.html_index'
,
name
=
"html_book"
),
url
(
r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/htmlbook/(?P<book_index>[^/]*)/(?P<page>[^/]*)$'
,
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/?$'
,
...
...
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