Commit 32c50090 by Piotr Mitros

Very draft/prototype edits. Moving CMS components in LMS.

parent 9906bd2b
...@@ -20,7 +20,9 @@ class Module(XModule): ...@@ -20,7 +20,9 @@ class Module(XModule):
@classmethod @classmethod
def get_xml_tags(c): def get_xml_tags(c):
return ["sequential", 'tab'] obsolete_tags = ["sequential", 'tab']
modern_tags = ["problemset", "videosequence"]
return obsolete_tags + modern_tags
def get_html(self): def get_html(self):
self.render() self.render()
......
...@@ -17,6 +17,39 @@ class XModule(object): ...@@ -17,6 +17,39 @@ class XModule(object):
''' Tags in the courseware file guaranteed to correspond to the module ''' ''' Tags in the courseware file guaranteed to correspond to the module '''
return [] return []
@classmethod(c):
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
or a CAPA input type '''
return ['xmodule']
def __init__(self, system = None, xml = None, item_id = None,
json = None, track_url=None, state=None):
''' In most cases, you must pass state or xml'''
if not item_id:
raise ValueError("Missing Index")
if not xml and not json:
raise ValueError("xml or json required")
if not system:
raise ValueError("System context required")
self.xml = xml
self.json = json
self.item_id = item_id
self.state = state
if system:
## These are temporary; we really should go
## through self.system.
self.ajax_url = system.ajax_url
self.tracker = system.track_function
self.filestore = system.filestore
self.render_function = system.render_function
self.system = system
### Functions used in the LMS
def get_completion(self): def get_completion(self):
''' This is mostly unimplemented. ''' This is mostly unimplemented.
It gives a progress indication -- e.g. 30 minutes of 1.5 hours watched. 3 of 5 problems done, etc. ''' It gives a progress indication -- e.g. 30 minutes of 1.5 hours watched. 3 of 5 problems done, etc. '''
...@@ -45,6 +78,12 @@ class XModule(object): ...@@ -45,6 +78,12 @@ class XModule(object):
''' '''
return "Unimplemented" return "Unimplemented"
# TODO:
# def get_header_js(self):
# ''' Filename of common js that needs to be included in the header
# '''
# raise NotImplementedError
def get_init_js(self): def get_init_js(self):
''' JavaScript code to be run when problem is shown. Be aware ''' JavaScript code to be run when problem is shown. Be aware
that this may happen several times on the same page that this may happen several times on the same page
...@@ -63,17 +102,30 @@ class XModule(object): ...@@ -63,17 +102,30 @@ class XModule(object):
get is a dictionary-like object ''' get is a dictionary-like object '''
return "" return ""
def __init__(self, system, xml, item_id, track_url=None, state=None): ### Functions used in the CMS
''' In most cases, you must pass state or xml''' def get_xml(self):
self.xml = xml ''' For conversions between JSON and legacy XML representations.
self.item_id = item_id '''
self.state = state if self.xml:
return self.xml
else:
raise NotImplementedError
if system: def get_json(self):
## These are temporary; we really should go ''' For conversions between JSON and legacy XML representations.
## through self.system. '''
self.ajax_url = system.ajax_url if self.json:
self.tracker = system.track_function raise NotImplementedError
self.filestore = system.filestore return self.json # TODO: Return context as well -- files, etc.
self.render_function = system.render_function else:
self.system = system raise NotImplementedError
def handle_cms_json(self):
raise NotImplementedError
def render(self, size):
''' Size: [thumbnail, small, full]
Small ==> what we drag around
Full ==> what we edit
'''
raise NotImplementedError
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment