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
2c2072da
Commit
2c2072da
authored
May 27, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted to use more semantic tags. Working snapshot.
parent
fbada1a9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
12 deletions
+25
-12
djangoapps/courseware/content_parser.py
+1
-0
djangoapps/courseware/modules/seq_module.py
+4
-3
djangoapps/courseware/modules/vertical_module.py
+1
-1
djangoapps/courseware/modules/x_module.py
+1
-1
djangoapps/courseware/views.py
+17
-6
templates/seq_module.js
+1
-1
No files found.
djangoapps/courseware/content_parser.py
View file @
2c2072da
...
...
@@ -218,6 +218,7 @@ def section_file(user, section, coursename=None, dironly=False):
Given a user and the name of a section, return that section.
This is done specific to each course.
If dironly=True then return the sections directory.
TODO: This is a bit weird; dironly should be scrapped.
'''
filename
=
section
+
".xml"
...
...
djangoapps/courseware/modules/seq_module.py
View file @
2c2072da
...
...
@@ -21,7 +21,7 @@ class Module(XModule):
@classmethod
def
get_xml_tags
(
c
):
obsolete_tags
=
[
"sequential"
,
'tab'
]
modern_tags
=
[
"
problemset"
,
"
videosequence"
]
modern_tags
=
[
"videosequence"
]
return
obsolete_tags
+
modern_tags
def
get_html
(
self
):
...
...
@@ -83,7 +83,8 @@ class Module(XModule):
params
=
{
'items'
:
self
.
contents
,
'id'
:
self
.
item_id
,
'position'
:
self
.
position
,
'titles'
:
self
.
titles
}
'titles'
:
self
.
titles
,
'tag'
:
self
.
xmltree
.
tag
}
# TODO/BUG: Destroy JavaScript should only be called for the active view
# This calls it for all the views
...
...
@@ -92,7 +93,7 @@ class Module(XModule):
# IDs to sequences.
destroy_js
=
""
.
join
([
e
[
'destroy_js'
]
for
e
in
self
.
contents
if
'destroy_js'
in
e
])
if
self
.
xmltree
.
tag
==
'sequential'
:
if
self
.
xmltree
.
tag
in
[
'sequential'
,
'videosequence'
]
:
self
.
init_js
=
js
+
render_to_string
(
'seq_module.js'
,
params
)
self
.
destroy_js
=
destroy_js
self
.
content
=
render_to_string
(
'seq_module.html'
,
params
)
...
...
djangoapps/courseware/modules/vertical_module.py
View file @
2c2072da
...
...
@@ -13,7 +13,7 @@ class Module(XModule):
@classmethod
def
get_xml_tags
(
c
):
return
[
"vertical"
]
return
[
"vertical"
,
"problemset"
]
def
get_html
(
self
):
return
render_to_string
(
'vert_module.html'
,{
'items'
:
self
.
contents
})
...
...
djangoapps/courseware/modules/x_module.py
View file @
2c2072da
...
...
@@ -17,7 +17,7 @@ class XModule(object):
''' Tags in the courseware file guaranteed to correspond to the module '''
return
[]
@classmethod
(
c
):
@classmethod
def
get_usage_tags
(
c
):
''' We should convert to a real module system
For now, this tells us whether we use this as an xmodule, a CAPA response type
...
...
djangoapps/courseware/views.py
View file @
2c2072da
...
...
@@ -60,7 +60,6 @@ def profile(request, student_id = None):
if
student_id
==
None
:
student
=
request
.
user
else
:
print
content_parser
.
user_groups
(
request
.
user
)
if
'course_admin'
not
in
content_parser
.
user_groups
(
request
.
user
):
raise
Http404
student
=
User
.
objects
.
get
(
id
=
int
(
student_id
))
...
...
@@ -184,16 +183,28 @@ def index(request, course=None, chapter="Using the System", section="Hints"):
log
.
exception
(
"Unable to parse courseware xml"
)
return
render_to_response
(
'courseware-error.html'
,
{})
dom_module
=
dom
.
xpath
(
"//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]/*[1]"
,
#dom_module = dom.xpath("//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]/*[1]",
dom_module
=
dom
.
xpath
(
"//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]"
,
course
=
course
,
chapter
=
chapter
,
section
=
section
)
#print "DM", dom_module
if
len
(
dom_module
)
==
0
:
module_wrapper
=
None
else
:
module_wrapper
=
dom_module
[
0
]
if
module_wrapper
==
None
:
module
=
None
elif
module_wrapper
.
get
(
"src"
):
module
=
content_parser
.
section_file
(
user
=
user
,
section
=
module_wrapper
.
get
(
"src"
),
coursename
=
course
)
else
:
module
=
dom_module
[
0
]
module
=
etree
.
XML
(
etree
.
tostring
(
module_wrapper
[
0
]))
# Copy the element out of the tree
module_ids
=
dom
.
xpath
(
"//course[@name=$course]/chapter[@name=$chapter]//section[@name=$section]//@id"
,
course
=
course
,
chapter
=
chapter
,
section
=
section
)
module_ids
=
[]
if
module
:
module_ids
=
module
.
xpath
(
"//@id"
,
course
=
course
,
chapter
=
chapter
,
section
=
section
)
if
user
.
is_authenticated
():
module_object_preload
=
list
(
StudentModule
.
objects
.
filter
(
student
=
user
,
...
...
@@ -305,7 +316,7 @@ def quickedit(request, id=None):
Maybe this should be moved into capa/views.py
Or this should take a "module" argument, and the quickedit moved into capa_module.
'''
print
"WARNING: UNDEPLOYABLE CODE. FOR DEV USE ONLY."
print
"WARNING: UNDEPLOYABLE CODE. FOR
CONTENT
DEV USE ONLY."
print
"In deployed use, this will only edit on one server"
print
"We need a setting to disable for production where there is"
print
"a load balanacer"
...
...
templates/seq_module.js
View file @
2c2072da
...
...
@@ -53,7 +53,7 @@ function disablePrev() {
function
$
{
id
}
goto
(
i
)
{
log_event
(
"seq_goto"
,
{
'old'
:
$
{
id
}
loc
,
'new'
:
i
,
'id'
:
'${id}'
});
postJSON
(
'${ MITX_ROOT_URL }/modx/
sequential
/${ id }/goto_position'
,
postJSON
(
'${ MITX_ROOT_URL }/modx/
${tag}
/${ id }/goto_position'
,
{
'position'
:
i
});
if
(
$
{
id
}
loc
!=-
1
)
...
...
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