Actions

Difference between revisions of "Developer Area/Import//Export/HTML Export"

From Mahara Wiki

< Developer Area‎ | Import//Export
(Created page with "Mahara's HTML export is implemented as a plugin for Mahara's "Export" plugin type. It allows Mahara to export portfolios …")
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Mahara's HTML export is implemented as a plugin for Mahara's [[../../../../Developer Area/Import//Export/Export API|"Export" plugin type]]. It allows Mahara to export portfolios as standalone HTML websites, easily viewed in a standard web browser. It is '''not''' possible to import from this format again.
+
Mahara's HTML export is implemented as a plugin for Mahara's [[../../../../Developer Area/Import%2f%2fExport/Export API|"Export" plugin type]]. It allows Mahara to export portfolios as standalone HTML websites, easily viewed in a standard web browser. It is '''not''' possible to import from this format again.
  
 
<div id="section_1">
 
<div id="section_1">
  
=== Architecture ===
+
===Architecture===
  
 
The HTML export plugin lives in <code>htdocs/export/html/</code>. The export plugin itself handles the exporting of Views, while offloading the export of Artefacts to the associated artefact plugins. If artefact plugins want to export data to the HTML export, they need to add an <code>export/html/lib.php</code> file which implements the class <code>HtmlExport</code> which extends <code>HtmlExportArtefactPlugin</code>.
 
The HTML export plugin lives in <code>htdocs/export/html/</code>. The export plugin itself handles the exporting of Views, while offloading the export of Artefacts to the associated artefact plugins. If artefact plugins want to export data to the HTML export, they need to add an <code>export/html/lib.php</code> file which implements the class <code>HtmlExport</code> which extends <code>HtmlExportArtefactPlugin</code>.
Line 9: Line 9:
 
</div><div id="section_2">
 
</div><div id="section_2">
  
=== Implementation ===
+
===Implementation===
  
 
A directory is set up in which the exported data should be generated. This is known to the exporter as <code>$this-&gt;rootdir</code>. In this directory, directories for artefact plugins, views and static data are set up.
 
A directory is set up in which the exported data should be generated. This is known to the exporter as <code>$this-&gt;rootdir</code>. In this directory, directories for artefact plugins, views and static data are set up.
Line 15: Line 15:
 
<div id="section_3">
 
<div id="section_3">
  
==== Artefacts ====
+
====Artefacts====
  
 
Each artefact plugin is in charge of exporting its own artefacts. Each one has a 'fileroot' property which points to the directory where it should write its files. The artefact plugin is free to write whatever it needs there, including creating any subdirectories.
 
Each artefact plugin is in charge of exporting its own artefacts. Each one has a 'fileroot' property which points to the directory where it should write its files. The artefact plugin is free to write whatever it needs there, including creating any subdirectories.
Line 25: Line 25:
 
</div><div id="section_4">
 
</div><div id="section_4">
  
==== Views ====
+
====Views====
  
 
The HTML export plugin exports Views itself. They appear in the <code>views/</code> subdirectory of the export.
 
The HTML export plugin exports Views itself. They appear in the <code>views/</code> subdirectory of the export.
Line 31: Line 31:
 
</div><div id="section_5">
 
</div><div id="section_5">
  
==== Export Homepage ====
+
====Export Homepage====
  
 
The homepage for the export provides a summary of all the exported information. It gets this information by polling all the artefact plugins for it, as well as asking itself for a summary of the Views exported.
 
The homepage for the export provides a summary of all the exported information. It gets this information by polling all the artefact plugins for it, as well as asking itself for a summary of the Views exported.
Line 37: Line 37:
 
</div><div id="section_6">
 
</div><div id="section_6">
  
==== Finishing up ====
+
====Finishing up====
  
 
The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.
 
The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.
  
</div></div>
+
 
 +
===Adjustments===
 +
 
 +
Currently the html export gives you the raw images/css files rather than fetching them directly from the theme.
 +
It would be better if we could tally up the themes/skins used and export them all within the export zip file and get the correct page using the correct theme/skin
 +
 
 +
Each artefact can have special templates for the html export.
 +
- at the very least we need to update them when we update the artefact they relate to (not to forget them).
 +
- also may need to create some more for artefacts/blocks that are not displaying correctly for the html export

Latest revision as of 17:22, 26 March 2015

Mahara's HTML export is implemented as a plugin for Mahara's "Export" plugin type. It allows Mahara to export portfolios as standalone HTML websites, easily viewed in a standard web browser. It is not possible to import from this format again.

Architecture

The HTML export plugin lives in htdocs/export/html/. The export plugin itself handles the exporting of Views, while offloading the export of Artefacts to the associated artefact plugins. If artefact plugins want to export data to the HTML export, they need to add an export/html/lib.php file which implements the class HtmlExport which extends HtmlExportArtefactPlugin.

Implementation

A directory is set up in which the exported data should be generated. This is known to the exporter as $this->rootdir. In this directory, directories for artefact plugins, views and static data are set up.

Artefacts

Each artefact plugin is in charge of exporting its own artefacts. Each one has a 'fileroot' property which points to the directory where it should write its files. The artefact plugin is free to write whatever it needs there, including creating any subdirectories.

If creating a templated file, such as an index.html for a directory, the artefact plugins should call $this->exporter->get_smarty($rootpath) to get the smarty object they need. The $rootpath is a relative path to the root of the export from where the file is to be written, and is used to create links in the templates back to the homepage of the export, among other things.

Artefact plugins should test that files/folders are able to be created, and throw SystemExceptions when they can't.

Views

The HTML export plugin exports Views itself. They appear in the views/ subdirectory of the export.

Export Homepage

The homepage for the export provides a summary of all the exported information. It gets this information by polling all the artefact plugins for it, as well as asking itself for a summary of the Views exported.

Finishing up

The export plugin copies smilies and other static files into the export, and generates a zipfile of all of the data.


Adjustments

Currently the html export gives you the raw images/css files rather than fetching them directly from the theme. It would be better if we could tally up the themes/skins used and export them all within the export zip file and get the correct page using the correct theme/skin

Each artefact can have special templates for the html export. - at the very least we need to update them when we update the artefact they relate to (not to forget them). - also may need to create some more for artefacts/blocks that are not displaying correctly for the html export