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
248ce880
Commit
248ce880
authored
Mar 08, 2013
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make annotable module use the new xmodule format
parent
93db5acc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
11 deletions
+13
-11
common/lib/xmodule/xmodule/annotatable_module.py
+13
-11
No files found.
common/lib/xmodule/xmodule/annotatable_module.py
View file @
248ce880
...
...
@@ -8,6 +8,7 @@ from xmodule.raw_module import RawDescriptor
from
xmodule.modulestore.mongo
import
MongoModuleStore
from
xmodule.modulestore.django
import
modulestore
from
xmodule.contentstore.content
import
StaticContent
from
xblock.core
import
Scope
,
String
log
=
logging
.
getLogger
(
__name__
)
...
...
@@ -22,6 +23,18 @@ class AnnotatableModule(XModule):
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/annotatable/display.scss'
)]}
icon_class
=
'annotatable'
data
=
String
(
help
=
"XML data for the annotation"
,
scope
=
Scope
.
content
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
XModule
.
__init__
(
self
,
*
args
,
**
kwargs
)
xmltree
=
etree
.
fromstring
(
self
.
data
)
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
element_id
=
self
.
location
.
html_id
()
self
.
highlight_colors
=
[
'yellow'
,
'orange'
,
'purple'
,
'blue'
,
'green'
]
def
_get_annotation_class_attr
(
self
,
index
,
el
):
""" Returns a dict with the CSS class attribute to set on the annotation
and an XML key to delete from the element.
...
...
@@ -111,17 +124,6 @@ class AnnotatableModule(XModule):
return
self
.
system
.
render_template
(
'annotatable.html'
,
context
)
def
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
=
None
,
shared_state
=
None
,
**
kwargs
):
XModule
.
__init__
(
self
,
system
,
location
,
definition
,
descriptor
,
instance_state
,
shared_state
,
**
kwargs
)
xmltree
=
etree
.
fromstring
(
self
.
definition
[
'data'
])
self
.
instructions
=
self
.
_extract_instructions
(
xmltree
)
self
.
content
=
etree
.
tostring
(
xmltree
,
encoding
=
'unicode'
)
self
.
element_id
=
self
.
location
.
html_id
()
self
.
highlight_colors
=
[
'yellow'
,
'orange'
,
'purple'
,
'blue'
,
'green'
]
class
AnnotatableDescriptor
(
RawDescriptor
):
module_class
=
AnnotatableModule
...
...
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