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
5f237ab3
Commit
5f237ab3
authored
Sep 21, 2012
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make separate json and xml editing interfaces
parent
344ec952
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
13 deletions
+39
-13
common/lib/xmodule/xmodule/editing_module.py
+20
-3
common/lib/xmodule/xmodule/error_module.py
+2
-2
common/lib/xmodule/xmodule/js/src/raw/edit.coffee
+0
-5
common/lib/xmodule/xmodule/js/src/raw/edit/json.coffee
+7
-0
common/lib/xmodule/xmodule/js/src/raw/edit/xml.coffee
+7
-0
common/lib/xmodule/xmodule/raw_module.py
+3
-3
No files found.
common/lib/xmodule/xmodule/editing_module.py
View file @
5f237ab3
...
...
@@ -14,9 +14,6 @@ class EditingDescriptor(MakoModuleDescriptor):
"""
mako_template
=
"widgets/raw-edit.html"
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/raw/edit.coffee'
)]}
js_module_name
=
"RawDescriptor"
def
get_context
(
self
):
return
{
'module'
:
self
,
...
...
@@ -27,3 +24,23 @@ class EditingDescriptor(MakoModuleDescriptor):
# TODO: show both own metadata and inherited?
#'metadata' : self.own_metadata,
}
class
XMLEditingDescriptor
(
EditingDescriptor
):
"""
Module that provides a raw editing view of its data as XML. It does not perform
any validation of its definition
"""
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/raw/edit/xml.coffee'
)]}
js_module_name
=
"XMLEditingDescriptor"
class
JSONEditingDescriptor
(
EditingDescriptor
):
"""
Module that provides a raw editing view of its data as XML. It does not perform
any validation of its definition
"""
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/raw/edit/json.coffee'
)]}
js_module_name
=
"JSONEditingDescriptor"
common/lib/xmodule/xmodule/error_module.py
View file @
5f237ab3
...
...
@@ -5,7 +5,7 @@ import sys
from
lxml
import
etree
from
xmodule.x_module
import
XModule
from
xmodule.editing_module
import
EditingDescriptor
from
xmodule.editing_module
import
JSON
EditingDescriptor
from
xmodule.errortracker
import
exc_info_to_str
...
...
@@ -45,7 +45,7 @@ class NonStaffErrorModule(XModule):
})
class
ErrorDescriptor
(
EditingDescriptor
):
class
ErrorDescriptor
(
JSON
EditingDescriptor
):
"""
Module that provides a raw editing view of broken xml.
"""
...
...
common/lib/xmodule/xmodule/js/src/raw/edit.coffee
deleted
100644 → 0
View file @
344ec952
class
@
RawDescriptor
constructor
:
(
@
element
)
->
@
edit_box
=
$
(
".edit-box"
,
@
element
)
save
:
->
@
edit_box
.
val
()
common/lib/xmodule/xmodule/js/src/raw/edit/json.coffee
0 → 100644
View file @
5f237ab3
class
@
JSONEditingDescriptor
constructor
:
(
@
element
)
->
@
edit_box
=
CodeMirror
.
fromTextArea
(
$
(
".edit-box"
,
@
element
)[
0
],
{
mode
:
{
name
:
"javascript"
,
json
:
true
}
})
save
:
->
JSON
.
parse
@
edit_box
.
getValue
()
common/lib/xmodule/xmodule/js/src/raw/edit/xml.coffee
0 → 100644
View file @
5f237ab3
class
@
XMLEditingDescriptor
constructor
:
(
@
element
)
->
@
edit_box
=
CodeMirror
.
fromTextArea
(
$
(
".edit-box"
,
@
element
)[
0
],
{
mode
:
"xml"
})
save
:
->
@
edit_box
.
getValue
()
common/lib/xmodule/xmodule/raw_module.py
View file @
5f237ab3
from
lxml
import
etree
from
xmodule.editing_module
import
EditingDescriptor
from
xmodule.editing_module
import
XML
EditingDescriptor
from
xmodule.xml_module
import
XmlDescriptor
import
logging
import
sys
log
=
logging
.
getLogger
(
__name__
)
class
RawDescriptor
(
XmlDescriptor
,
EditingDescriptor
):
class
RawDescriptor
(
XmlDescriptor
,
XML
EditingDescriptor
):
"""
Module that provides a raw editing view of its data and children. It
requires that the definition xml is valid.
"""
@classmethod
def
definition_from_xml
(
cls
,
xml_object
,
system
):
return
{
'data'
:
etree
.
tostring
(
xml_object
)}
return
{
'data'
:
etree
.
tostring
(
xml_object
,
pretty_print
=
True
)}
def
definition_to_xml
(
self
,
resource_fs
):
try
:
...
...
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