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
7c2743d2
Commit
7c2743d2
authored
Dec 09, 2011
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sequential has basic functionality
parent
94657602
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
5 deletions
+24
-5
courseware/capa_module.py
+0
-2
courseware/views.py
+24
-3
No files found.
courseware/capa_module.py
View file @
7c2743d2
...
...
@@ -29,8 +29,6 @@ class LoncapaModule(XModule):
inner_html
=
self
.
lcp
.
get_html
()
content
=
{
'name'
:
self
.
name
,
'html'
:
inner_html
}
print
"XXXXXXXXXXXXXXXXXXXXXXXXXXX"
print
self
.
lcp
.
done
return
render_to_string
(
'problem.html'
,
{
'problem'
:
content
,
'id'
:
self
.
filename
,
'done'
:
self
.
lcp
.
done
})
...
...
courseware/views.py
View file @
7c2743d2
...
...
@@ -24,7 +24,7 @@ import urllib
from
django.conf
import
settings
from
content_parser
import
*
import
content_parser
template_imports
=
{
'urllib'
:
urllib
}
...
...
@@ -81,7 +81,7 @@ def render_accordion(request,course,chapter,section):
def
format_string
(
string
):
return
urllib
.
quote
(
string
.
replace
(
' '
,
'_'
))
toc
=
toc_from_xml
(
chapter
,
section
)
toc
=
content_parser
.
toc_from_xml
(
chapter
,
section
)
active_chapter
=
1
for
i
in
range
(
len
(
toc
)):
if
toc
[
i
][
'active'
]:
...
...
@@ -129,12 +129,32 @@ def vertical_module(request, module):
return
{
'js'
:
js
,
'content'
:
render_to_string
(
'vert_module.html'
,{
'items'
:
contents
})}
def
seq_module
(
request
,
module
):
''' Layout module which lays out content in a temporal sequence
'''
def
j
(
m
):
# jsonify contents so it can be embedded in a js array
# We also need to split </script> tags so they don't break
# mid-string
if
'js'
not
in
m
:
m
[
'js'
]
=
""
content
=
json
.
dumps
(
m
[
'content'
])
content
=
content
.
replace
(
'</script>'
,
'<"+"/script>'
)
return
{
'content'
:
content
,
'js'
:
m
[
'js'
]}
contents
=
[(
e
.
getAttribute
(
"name"
),
j
(
render_module
(
request
,
e
)))
\
for
e
in
module
.
childNodes
\
if
e
.
nodeType
==
1
]
js
=
""
.
join
([
e
[
1
][
'js'
]
for
e
in
contents
if
'js'
in
e
[
1
]])
return
{
'js'
:
js
+
render_to_string
(
'seq_module.js'
,{
'items'
:
contents
}),
'content'
:
render_to_string
(
'seq_module.html'
,{
'items'
:
contents
})}
modx_modules
=
{
'problem'
:
capa_module
.
LoncapaModule
}
def
render_x_module
(
request
,
xml_module
):
''' Generic module for extensions. This renders to HTML. '''
# Check if problem has an instance in DB
print
xml_module
module_id
=
xml_module
.
getAttribute
(
capa_module
.
LoncapaModule
.
id_attribute
)
s
=
StudentModule
.
objects
.
filter
(
student
=
request
.
user
,
module_id
=
module_id
)
if
len
(
s
)
==
0
:
...
...
@@ -178,6 +198,7 @@ module_types={'video':video_module,
'html'
:
html_module
,
'tab'
:
tab_module
,
'vertical'
:
vertical_module
,
'sequential'
:
seq_module
,
'problem'
:
render_x_module
}
#'lab':lab_module,
...
...
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