EduBlog Implementation

From OLPC
Revision as of 03:18, 9 August 2008 by Tarun2000 (talk | contribs)
Jump to navigation Jump to search

This page is for documentation of the Educational Blogger Project code and discussion of future coding work. Information as of August 8, 2008

EduBlog required the modification of a few different areas of Moodle 1.9 with OU Blog. The base is a weekly build. We should look for a more stable build and merge into that. The tinyMCE work may be useful for other XS based web apps and XS Moodle. Remote Blog API is headed for being an independent API that other apps can use for remote blogging. Ideally, I would like EduBlog to be split into five branches which form the system when merged: tinyMCE w/ Sugar Theme, OU Blog (Not ours), OU Blog Teacher Approval, OU Blog Remote Blogging and Primary XO Theme. Some partitioning of code is needed for this task which will aid in the maintainability of the system. Remote Blogging and Teacher Approval may be useful to others and perhaps can be merged upstream.

tinyMCE

TinyMCE was fit into Moodle 1.9 for three reasons: Moodle 2.0 will have tinyMCE as an editor option, tinyMCE supports themeing which the standard HTMLArea does not, other XS based apps can make use of the sugary Editor. Other available editors (Xinha, FCKEditor, others?) were not considered and may be worth a second look. We should keep track of where Moodle is headed and try to use their default editor if possible.

TinyMCE Integration

The integration of tinyMCE and Moodle is EXTREMELY messy, but should sort itself out with the release of Moodle 2.0. At present, it is based on a weekly build [will find out which one] that has partial support for multiple editors. No core tinyMCE code needed to be modified, but a new Sugar theme was created to model the Write interface. This means that upgrading to the latest tinyMCE would be trivial. The integration code spans a few files including moodlelib.php to get XO Browse recognized as being able to run the editor. Many files in lib/editor/2 were modified also to trim out extra code spit out on the web pages. Two new files uploadimage.php and uploadwrite.php handle uploads from the sugar theme. Both are in need of standard Moodle security checks. This area should be revisited after Moodle 2.0 is released with multiple editor support.

Future Work with tinyMCE Integration

  • tinyMCE forms need to have Moodle data in hidden fields
  • Look to Moodle 2.0 and figure out how to transition cleanly and smoothly
  • Try to implement the php compressor to optimize transfer of tinyMCE (reportedly 75% faster download)

TinyMCE Sugar Theme

The tinyMCE Sugar Theme gives tinyMCE a pretty Write-like interface. The idea was to model the editor after something the kids already know how to use. Most of the implementation is clean, with the exception of the file upload box which should be ripped out and placed in a plugin instead.

Future Work with Sugar Theme

  • IE is not supported, but should be. The cause is an annoying issue of how to create an Iframe and change the src with javascript. It is clearly possible since other portions of tinyMCE do this, but it has not been implemented in the Sugar Theme.
  • Moodle is not really supported, but should be. A few hidden fields need to be put in the forms for file upload in tinyMCE so that Moodle does not need to circumvent its internal security.
  • The XO bug preventing images from being resized needs to be fixed
  • The XO bug preventing preview from showing properly needs to be fixed - also need to send a patch upstream to MoxieCode about preview plugin
  • The file upload system should be a standalone plugin, not part of the sugar theme
  • Sugar Theme needs to make use of configuration settings for toolbars and buttons like other themes
  • Preview plugin and comboboxes needs to look more sugary and the buttons should have sugar tooltip graphics
  • Some icons are not correct (preview, image upload, write upload) and proper icons need to be made for these features
  • More options like emoticons and colors should be implemented
  • Remove dependency of getElementsByClassName and other general code cleanup

TinyMCE Plugins

At a minimum, we need to use the inlinepopups plugin for tinyMCE to work properly on the XO. We should create a more native style for inlinepopups instead of using clearlooks2. We also use a patched preview plugin (we should get that patch upstream AFAICT it was a bug). Many other useful plugins exist that we may want to integrate in the future: emoticons, video, flash, etc. A full list is on the tinyMCE website.

OU Blog

Two features were added to Open University's Blog Module: Teacher Approval and Remote Blogging. Affected files all reside in mod/oublog.

Teacher Approval

Core functionality is in locallib.php. The main areas modified include the functions oublog_approve_post, oublog_print_post, oublog_can_view_post and constants defined for selecting the approval type [this needs verification]. Form actions affected include approvepost.php and publishpost.php. Changes to the UI are contained in mod_form.php and post_form.php.
Future Work with Teacher Approval

  • Unify the channel for a post becoming public - currently each action needs to call functions in locallib. It should only need to call one function that means a post is going public.
  • Better communication between student and teacher - need to discuss
  • How to add extra options to the post (both approve and publish) in a less patchy way

Remote Blog Integration

Integration of the Remote Blog API is done through remotebloglib.php and calls to its functions from several oublog files. A few call member functions of the remoteblog class directly, and that dependency should be rerouted through remotebloglib.php. This goes alongvwith removing Moodle dependency from the API itself. The UI is handled by manageremoteblog.php and addremoteblog.php
Future Work with Remote Blog Integration

  • Clean Up
  • Captcha handling follows from changes to Remote Blog API
  • How to handle post failures from spotty connections (queue, cron, etc.) - need to discuss
  • Allow editing of remote blogs
  • What to do during delete (what if other blogs use this connection?)
  • Integrate as much as possible upstream

Remote Blog API

This API is intended to make oublog's access to any remote blog transparent to oublog. Currently only Blogger.com is partially supported. Files reside in mod/oublog/remoteblog. The abstract class oublog_remoteblog [verify] in remoteblog.php provides the base which plugin files need to extend. Any php file with the proper construct in that folder will be automatically recognized and used as a plugin for a remote blog system. Moodle dependency for form generation should be pushed into remotebloglib.php as well as parsing of image src's. The plugin for Google Blogger (blogger.php) requires the Zend GData Library which in turn requires phpxml (yum package php-xml [verify]).
Future Work with Remote Blog API

  • Need to remove Moodle dependency
  • Should fail cleanly if needed API's (Zend GData) are missing
  • Should fail cleanly if login or posting fails
  • Clean up retrieving images, and also push remote images
  • Support for CAPTCHA (used by Google Blogger may be used by others) - need to discuss how to handle
  • Support for video
  • Support more flexible selection of image, blog, video host service
  • More plugins! MetaWeblog may be a good start. Creating a plugin is nothing more than creating a subclass of oublog_remoteblog and overriding a few functions (see blogger.php)

XO Theme

A fork of Moodle's Primary theme [link it], the Primary XO Theme uses client side javascript to hide excess Moodle options. It may be better to do this stuff serverside, but until we sync up our code with Moodle, it helps keep things separated. Moodle theming is described more in ticket 7696 [er why can't i link this?]. We need to evaluate the best way to move forward in this area, perhaps by committing to the enhancement in 7696.

Write Upload (Remove as builds are upgraded)

Since the version of libabiword in build 656 only supports abw properly, we need to handle the conversion to HTML on the server. The easiest way is to install the latest abiword and use its export function. This can all be phased out once people upgrade their builds and can save as HTML properly and upload that rather than the abw file. The relevant files are lib/editor/2/uploadwrite.php [verify] and lib/abiwordlib.php. AbiWord 2.6.0 or greater is also required. This was last minute so it is messy and I'm sure buggy as well.

Browse / Write 656 Patches (Remove as builds are upgraded)

A bug with objectchooser.py prevents the selection of files to upload / insert. Patched version's WriteNew and BrowseNew are intended to overcome the issue until XO builds are upgraded (AFAIK 656 Update 1 is okay). No support aside from fixes to really severe issues will be provided for the patches.