-
Notifications
You must be signed in to change notification settings - Fork 48
Creating An Idevice
An idevice has two classes: the Idevice class itself (which contains persistent fields to save values given by the content author) and the Block class which renders the idevice into HTML or XML.
Take a look at example idevice - add fields that you want to be persistent. In the Block class you need to implement:
renderPreview: This renders the preview style which is shown during the editing after the user has clicked OK.
- Note that any resources in the package are now in the relative dir resources/resname
- Call common.ideviceHeader(self, style, "preview") before starting HTML output and call common.ideviceFooter(self, style, "preview") before ending HTML output
renderView: This renders the HTML as it will be exported and used
-
Call common.ideviceHeader(self, style, "view") before starting HTML output and call common.ideviceFooter(self, style, "view") before ending HTML output</li>
renderEdit: This renders a form for the user to complete in EXE learning
process: Take the values from an http request during editing and set the fields on the Idevice object
renderXML (optional): Render in simple XML for usage on a basic feature phone (J2ME app Ustad Mobile).
IMPORTANT: If you are developing your idevices whilst running the distribution in standalone mode from source you MUST delete the config/idevices directory in order for your new class to be used
TODO: Howto Make a Hello World idevice sample
New styles have a +/- collapse/expand button next to them with Javascript using jquery. If your idevice represents an activity of some kind or something more than a block of text you should set the properties title and idevice.emphasis to Idevice.SomeEmphasis . This will create a container div that will be collapsed and the header will be left.
If idevice.emphasis = Idevice.NoEmphasis then any div inside with device_inner in it's class will be collapsed.
Given a name of NewIdevice and NewBlock make
in exe.webui.builtinblocks add a line:
from exe.webui.newblock Import NewBlock
in exe.engine.idevicestore:in function: __getFactoryExtendediDevices add a line:
from exe.engine.NewIdevice import NewIdeviceand
factoryExtendedIdevices.append(NewIdevice())
Categorization In exe/config.py, Config object field idevicesCategories. Is a dict with idevice lowercase name as key.