EduBlog Implementation: Difference between revisions

From OLPC
Jump to navigation Jump to search
Line 66: Line 66:
*Clean up retrieving images, and also push remote images
*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 CAPTCHA (used by Google Blogger may be used by others) - need to discuss how to handle
*Support for video: See [http://kamleitner.com/code/phptube-youtube-api-f-video-upload-download/ PHP Tube] and [http://code.google.com/apis/youtube/developers_guide_php.html#UploadingVideos Official Google PHP Docs]
*Support for video: See [http://kamleitner.com/code/phptube-youtube-api-f-video-upload-download/ PHP Tube] and [http://code.google.com/apis/youtube/developers_guide_php.html#UploadingVideos Official Google Docs]
*Support more flexible selection of image, blog, video host service
*Support more flexible selection of image, blog, video host service
*More plugins! [http://pear.php.net/package/Services_Blogging/docs/latest/Services_Blogging/Services_Blogging.html 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)
*More plugins! [http://pear.php.net/package/Services_Blogging/docs/latest/Services_Blogging/Services_Blogging.html 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)

Revision as of 18:59, 15 August 2008

This page is for documentation of the Educational Blogger Project code and discussion of future coding work. Feel free to use the talk page for any questions or comments. Information as of August 14, 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 a few branches which form the system when merged: tinyMCE w/ Sugar Theme, OU Blog (Not ours), OU Blog Teacher Approval, OU Blog Remote Blogging, Primary XO Theme and Authorization. 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. Authorization should be handled by the XS as it progresses. Excess Moodle code (other modules, etc.) should be removed from our git repository.

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. Files in the UI for users were changed to make the default editor tinyMCE also. 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) - Moodle seems to have taken interest in this as well.

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. Files are in the themes/sugar directory of tinyMCE home (lib/editor/tinymce/jscripts [verify]).

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
  • Icon clarity is bad. We should resave the svg's as 55px and remake the xcf and gif for the buttons.
  • 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. Hooks in lib.php functions handle now handle creating new blog links. This was last minute and needs to be fully implemented (namely update and delete).
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. The plugin for Google Blogger (blogger.php) requires the Zend GData Library which in turn requires phpxml (yum package php-xml [verify]). There is also a PEAR package we may want to transition this functionality to, but it doesn't support GData yet and doesn't seem to support images or video. Basic moral: a lot of new stuff came out after 2008 SoC, which should be evaluated.
Future Work with Remote Blog API

  • 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: See PHP Tube and Official Google Docs
  • 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. Theme files are in theme/primaryxo.

Authorization

XS Moodle will take care of this (hopefully soon) by doing a lookup of the MAC address. In the meantime, we are doing a simple auth plugin that does instant self registration. This is for TESTING ONLY and a really bad idea for actual systems. Files are in auth/beta.

Localization

Localization currently occurs in 3 areas. Moodle's localization files deal with most of the Moodle interface. TinyMCE also has its own localization settings somewhere in its directory. The Sugar theme enhances that and its files are in lib/editor/tinymce/jscripts/tiny_mce/themes/sugar/lang [verify]. OU Blog also has its own localization in mod/oublog/lang. Sugar Theme and OU Blog only have es and en. Moodle and tinyMCE have many more localization options. It is possible tinyMCE and Moodle localization may be merged come 2.0.

Write Upload (Switch to HTML Upload as Builds 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 (though this will need php to handle parsing data uri's for blog's to work on IE). 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.

However, even with newer builds that can generate HTML with embedded images, we still will need to clean up the HTML before posting. This is fully unimplemented and needs to be done!

Future Work with Write/HTML Upload

  • Fix image size bug
  • Clean up libabiword's html to by OU Blog and Blogger.com happy

Browse / Write Build 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.