This page aggregates blogs and status info from Moodle developers. Please contact Helen if you'd like your feed added.

27 July, 2010

David Mudrak

Moodle development traffic 29/2010

Latest stable version 1.9.9+

There are 4 commits into the stable branch from the last development week (from Tue Jul 20 to Mon Jul 26) ♦ Dan Marsden removed a possibility to open SCORM player in a new browser window manually because it led to problems with communication between the SCO and the server and no grades were reported back (MDL-21333) ♦ Sam Hemelryk fixed HTML rendering issue in quiz module (MDL-20724) ♦ Petr Skoda improved isguestuser() core function which detects if the given user has logged in via “Login as guest” button. Such user has hard-coded username ‘guest’. But in MNet environments, just user name is not enough to uniquely identify user as there may be accounts with the same user name on different MNet peers. Therefore we must check the user’s mnethostid attribute and make sure it is really our local account to prevent reported problems with multiple guest accounts (MDL-22871) ♦ David Mudrak spotted two typos in the assignment module’s recent activity report. These typos accidentally eliminated each other so that the reporting of the recent activity for students in case of separate groups mode could not work but no error or false positive activity were displayed (e5bc356).

Future version Moodle 2.0 Preview 4

There are 284 commits into the main development branch from the last week. The list of Moodle 2.0 release blockers contains 19 unresolved issues. Thanks to our community QA testers, dozens of other issues have been discovered and fixed.

Quotes of the week

“That’s the second time in as many days I have brought up something and Petr has gone and removed it- I’d better watch out what I highlight next! :-D
Mary Cooch discovers dark side of QA testing

May git be with you

While my recent work on MNet remote enrolment  services for Moodle 2.0, I could not praise git more. Whenever dealing with some MNet development, one usually has to work on two separate instances of Moodle – server side and client side (aka service provider and service subscriber). This is roughly how I used git during the development. Let us say I have moodle.git clone in my ~/public_html/moodle20 directory. It is the checkout I use for everyday development tasks. I started with creating a new branch at the top of the latest upstream Moodle version. At the end of the day, this branch will contain all the commits to be pushed into Moodle CVS repository.

$ cd ~/public_html/moodle20/
$ git fetch
$ git branch mnet-integration origin/cvshead
$ git checkout mnet-integration

Then I prepared checkouts for the two clear installations of Moodle. Due to the lack of invention, let us call them A and B.

$ cd ~/public_html/
$ git clone moodle20 moodle20a
$ git clone moodle20 moodle20b

Thanks to the new CLI installer in Moodle 2.0, it was not actually needed to leave the pleasant dark shell window.

$ cd ~/public_html/moodle20a/
$ php admin/cli/install.php

And the work could start. After I set up both installations, I connected them into MNet network. Moodle A served as a course with user accounts and Moodle B was the one with courses. Simply said, remote enrolment services allows the administrator at Moodle A to enrol their users into remote courses at Moodle B. To make this work within the new enrolment framework in Moodle 2.0, changes had to be done on both of the sides – service provider (B in our scenario as it is the one with the courses) and service subscriber (A as the one with the users).

After a while, I had several commits in both checkouts. When I had a commit in A that I needed in B too, I just run

$ cd ~/public_html/moodle20b/
$ git fetch ../moodle20a
$ git cherry-pick 63891a8

When I finished, it was time to prepare commits to be sent into CVS. I went back to the repository with the integration branch and run

$ cd ~/public_html/moodle20/
$ git fetch ../moodle20a
$ gitk HEAD..FETCH_HEAD
$ git merge FETCH_HEAD
$ git fetch ../moodle20b
$ git merge FETCH_HEAD

git is clever enough to know that some commits from moodle20a were already included in moodle20b due to the cherry picking. Now I could go back to A and B and repeat the merging as many time as needed. So I ended with commits log like this. Sorry for different names of branches at the picture against the ones in the text. You can see how branches can be merged here, there and back again.

When I finished and was ready to publish my work, I rebased the integration branch against the up-to-date upstream head. Once the integration branch is rebased, the merging from the cloned branches can not work any more and would lead to conflicts, problems and duplicated commits. I rebased the branch accidentally so I know that git manual is really right about this. Rebasing is actually re-applying a sequence of commits. During the rebasing, commits order can be modified, commits can be meld into single commits etc. This allowed me to prepare a set of patches to be send into CVS using git cvsexportcommit command.

Post scriptum

When in Rome, do as the Romans. When in Moodle, use forums.

by David at 27 July, 2010 08:12 AM

19 July, 2010

Helen Foster

Moodle 2.0 QA Cycle 1 over 50%

A big thank you to everyone involved in Moodle 2.0 QA Cycle 1 to-date. According to the Moodle 2.0 QA Cycle 1 overview, over 50% of tests have passed so far!

To ensure the remaining tests pass as soon as possible, testers please

  • Make sure that each test failure is reported as an MDL issue for developers to investigate and fix, creating a new issue if necessary
  • Link the MDL issue to the QA test (MDLQA issue)

Once fixed, the QA test can be reset and then run again.

There’s still plenty of space in our testers group for more members, so if you’d like to get involved, please see the discussion Help needed with QA testing and the documentation QA testing.

With the help of our core developers, let’s aim for a 100% pass rate for the Moodle 2.0 QA Cycle 1 by the end of the week!


by Helen Foster at 19 July, 2010 03:54 PM

15 July, 2010

Patrick Malley

Moodle 2 YUI3 Custom Menu CSS Issues

I’ve been complaining a bit in the Moodle Tracker about the current implementation of “Custom Menus” that we’ve recently included in Moodle 2.0. This new feature allows users to easily input links and text to be displayed as a dropdown menu by themes that support the feature.

My first attempt to add a custom menu to a theme ended in frustration that Moodle 2 is loading the YUI3 default skin CSS in addition to the core CSS to make the menu function. What this means is that theme developers have to overwrite the skin CSS to change the look of the menu.

For example, the YUI3 skin applies a border around the entire menu. If I don’t want a border around a menu for a particular theme, I have to add a specific declaration to remove it. This is one of things that the new Moodle 2 theme engine was supposed to prevent. It’s tedious and, as I’ll point out below, buggy.

Unfortunately, there isn’t an easy fix to this problem, which is fine with me for the time being as long as I can still change the appearance of the menu to fit my themes.

Here’s a problem I’ve now encountered that I can’t seem to resolve on my own:

What you’re seeing is a new theme I’ve created for the core (called Fusion) that pulls the custom menu into the top of the header. You’ll notice the slight shift upward and to the left of the menu every time the theme loads. This is happening (I believe) because the YUI3 CSS is loading first (as it should), then my menu CSS is loading. YUI3 tells the browser to pad the menu. Fusion tells it not to.

At first, I thought this was the result of my having “Theme Developer Mode” turned on to disable the cache, but unfortunately, I’m still seeing this issue with “Theme Developer Mode” disabled.

As much as I’d like to see these skin styles removed from the menu, I realize that the Moodle 2 release has bigger problems that we need to focus on. Still, I need a solution to this problem. It doesn’t have to be perfect, it just has to work. Any ideas?

by Patrick Malley at 15 July, 2010 04:57 PM

13 July, 2010

Dan Marsden

SCORM Bug update

In preparation for Moodle 2.0 we’ve been going through all the outstanding SCORM bugs in the tracker and have merged many of the fixes into 1.9Stable – we’ve closed over 30 bugs in the past 3 weeks with a range of issues from grading to support of buggy SCORM packages. Piers has also been working on a new SCORM player to hopefully fix a range of issues people have had with the old one – it’s based on the new player that Petr Skoda wrote for the new IMSCP Module in Moodle 2.0.

2.0 is looking like a great release!

by dan at 13 July, 2010 12:19 AM

09 July, 2010

Tim Hunt

Book review: Moodle 1.9 Extension Development

It is a book that the community has needed for a long time, a book that tells you how to write Moodle code. Now it is finally here. Does it live up to expectations?

Yes, I think it does. The authors, Mike Churchward and Jonathan Moore, are two experienced Moodle developers (they both work for Canadian Moodle Partner Remote Learner) so they can write authoritatively on the subject.

One issue with a book like this is that the examples given are, necessarily, fairly basic. To illustrate key techniques and ideas, a book must explain using the simplest example that makes the point. The question is, when you come to solving real problems, will the techniques you have learned expand to cope? Well, this is where the experience of the authors counts. They are telling you the right way to do things that works for real applications, even if they are only using simple examples to illustrate them.

The book does a thorough job of covering just about every type of Moodle plugin there is. Of course, some plugin types get more space than others, with the two most important, blocks and activity modules getting the most space. Therefore, some other plugin types, like question types, and gradebook plugins, are covered rather briefly. Between the chapters on the different types of plugins are chapters on more general topics like security, accessing the database, and so on.

Anyone who has had code reviewed by me will know that I get really pedantic when I review something. As I was reading the book I made a list of minor errors, or points where I disagreed with the authors. From the 300 pages of the book, I only found 22 things to put on my list, and none of them are interesting enough to mention here. (I did send the list to Jonathan.) So, I think this book has a very high standard of accuracy.

This book does assume you already know how to program in PHP, and write HTML and CSS. I think that was the right decision. There are plenty of excellent books out there that will teach you to write general web application in PHP, and it would be silly to duplicate those in a book that is uniquely about writing code for Moodle.

It is unfortunate timing that this book was released only a few months before Moodle 2.0. Moodle 2.0 does change quite a lot of the rules for how to do Moodle development, and so a lot of the details in the book will soon be out of date. However, don't let that stop you from getting this book. We have just talked about how this book helps you make the jump from being a general PHP developer to being specifically a Moodle (1.9) developer. Well, from there to being a Moodle 2.0 developer is just another small step. You won't be wasting much time if you learn about Moodle 1.9 first, and anyway, some people will still be running Moodle 1.9 for some time to come, and it will be a while before there is a book about Moodle 2.0 development on sale.

This should go without saying, but programming is an activity that you actually need to do to understand. You won't become an expert Moodle programmer just be reading a book. You will become a Moodle programmer by actually trying to write Moodle code, and learning from your own mistakes, and from the code other people have written in the past. What a book like this will do for you is that it will help you avoid a lot of the really basic mistakes, and it will set you off on the right path. So it will make your own learning-by-doing much more efficient, but I cannot replace the doing. Also, I would like to point out that while this is the only book about Moodle development, it is certainly not the only resource to help you learn Moodle development. If you are interested in this book, you should also look at the Developer documentation on Moodle Docs and the Introduction to Moodle Programming course on http://dev.moodle.org/.

Overall, if you want to learn Moodle development, this is a good book to help you attain your goal. Sure, you can get a lot of the information for free online, but in this book the authors set it out clearly and in a logical order. The information in this book has been written by expert Moodle developers and then carefully reviewed, so you can read the book without being on your guard for misinformation. You would have to be more careful just using the information Google finds for you online. So, as I say, this book lives up to expectations. If you want a book on Moodle development, get this one, and don't worry too much about Moodle 2.0 making it out-of-date.

by Tim Hunt (noreply@blogger.com) at 09 July, 2010 10:33 PM

Sam Marshall

State of the browser

I just ran browser stats on the last week of web logs (kind of wanted to do trends, but haven't found any data earlier than that yet).

This might be of interest to Moodle people in general (as well as us) given that Moodle 2 ditches support for Internet Explorer 6.

Anyhow, here are the details for OU course web sites, considering only external use i.e. all our students and tutors. (For campus-based staff there is a specific computer policy which obviously biases the results.) These are calculated using a program I wrote, based on the number of requests to 'interesting' pages (excluding images, javascript, etc). Percentages exclude things like search engines, feed readers, anything else identified that isn't a browser, plus user agents my system doesn't recognise (approx 2% of total). For all browsers except IE, I picked a version that covers the vast majority of users and only included that version and above; older versions are in 'other'.

  • IE8: 39%
  • Firefox 3+: 22%
  • IE7: 19%
  • IE6 and below: 7%
  • Chrome 5+: 6%
  • Safari 4+: 5%
  • Mobile: 2%
  • Other: 1%

(Adds up to 101% due to rounding, sorry.)

Anyway, the good news is that on our system, IE6 is down below 7%. A year ago, it was double that. Eventually, that monster's really going to die!

Good luck anyone waiting for IE9 to become current so we can all use HTML5, though...

by Sam Marshall at 09 July, 2010 05:17 PM

06 July, 2010

Sam Marshall

Two things this post, first a part for almost-normal people, then one just for geeks, er, I mean, Moodle developers.

The almost-normal part: if you're reading this, you're seeing the OU blog activity module. So you might be interested in a change to OU blog in our upcoming release. In September we will launch public comments on OU blog, so that people without an OU login can leave comments on your post. If you turn this on, you (the blog author) will have to approve public comments, so that there isn't any spam. Want to learn more in harder-to-understand detail? Read this exciting functionality document (PDF). It hasn't been tested yet; hopefully the system doesn't completely fall over and get turned off before we release it. :)

Now the geek bit. Basically I wanted to warn about a Moodle coding antipattern. Here it is:

// $thing is some object we previously got 
// from the mdl_thing table. It has the
// current values of a row from that table.
$thing->numericfield = $newvalue;
update_record('thing', $thing);

Don't do that!

For those who didn't immediately go 'yeah duh, of course not' - here's why. Let's say the $thing has some other field you didn't change. When you call update_record, Moodle doesn't know you didn't change it, so it'll update that as well. Which means if it contains any apostrophes, it will create a database error; and you've just made an opportunity for an SQL injection attack.

Even if $thing currently doesn't have other fields (or they aren't text fields, or you manually addslashes to them), another field might be added to that table later - et voila! A lovely security hole in code you didn't even change.

So, the only correct way to use update_record is this pattern:

$update = (object)array('id' => $thing->id);
$update->numericfield = $newvalue;
update_record('thing', $update);

Well, you could use different syntax (and should probably check the return value), but basically, what I'm getting at is that you should always call update_record with an entirely new object that only contains the ID and the fields you are actually changing (which should have slashes added if required).

As you might have guessed, I'm not writing about this just for fun :) This precise hole was recently discovered in part of our VLE code (actually a part written by outsourcers, but I'm not saying we wouldn't have done it in house). I waited to make this post about it until our live server has been patched, so this security hole isn't in our system any more...

This hole wasn't discovered by developers or testers here, but by a student who reported something broken (which turned out to be related to an apostrophe in another data item). Luckily I don't think they realised it was a security hole! Anyway, many thanks going out to Jeanette Stephenson');UPDATE mdl_grade SET totalscore=100 WHERE userid=157790021;--!

:)

(Yes that is an old joke. And no the person who found the bug wasn't really called Jeanette Stephenson, and didn't really have that user id, I just made both up. But, if you do recognise yourself - I think rather unlikely since I was cagey about where this problem actually was - thanks. Really. :)

In reality there are some extra layers which might protect against actual attacks of this nature, but even so, I think Moodle 2 (which doesn't require you to get slashes right) will be a big security improvement. Still good practice not to update_record with all the fields, though!

 

 

 

 

by Sam Marshall at 06 July, 2010 04:53 PM

05 July, 2010

Helen Foster

New forums on moodle.org

Using Moodle now has two new forums:

Elsewhere in Using Moodle, Moodle HQ senior developer Sam Hemelryk announced his CSS theme tool block for Moodle 2.0 (a “phenomenal bit of work” according to Martin) and Moodle translation coordinator Koen Roggemans announced that the Moodle languages portal was ready for translators. Thanks to Moodle HQ developer David Mudrák for developing the Moodle languages portal translation tool AMOS.


by Helen Foster at 05 July, 2010 05:32 PM

01 July, 2010

David Mudrak

Moodle development traffic 25/2010

Latest stable version 1.9.9+

There are 17 commits into the stable branch from the last development week. Tim Hunt fixed problem with deleting quiz attempts, occurring in quizzes in group mode with a group currently selected (MDL-22847) and two other issues in quiz. Dan Marsden and Piers Harding backported a series of patches from Moodle 2.0. That patches fix various issues in SCORM module (MDL-22332, MDL-22340, MDL-22168, MDL-21333, MDL-17891, MDL-21551, MDL-22741, MDL-21492, MDL-21761, MDL-12834 and MDL-21306).

Future version Moodle 2.0 Preview 3

There were 159 commits into the main development branch in the last week. Microsoft contributed native SQL*Server adapter for their new SQL Server PHP driver (sqlsrv). PHP extension XML-RPC become required for Moodle 2.0 and the prerequisite was set in admin/environment.xml. Moodle uses XML-RPC extension for hub communication, web services and Moodle networking (MNet). There are already first reports from the community that this will be issue with some cheaper web hosting providers and even some core developers are not quite sure about this step, so the decision may not be final yet. On the other hand, Moodle is not trivial application and one should not expect it runs just everywhere (just because of memory requirements, at least).

Quotes of the week

“Loan calculator 2.0! Now with extra mortgage sales! Order now and get 2 licenses of Moodle 2.0 for free.”
David Mudrak can’t believe the Loan calculator block still survives in standard Moodle distribution

“Eventually there will be unicorns and rainbows and everyone gets a pony.”
Sam Marshall dreaming about the future when developers would be happy with how Internet Explorer renders Moodle 2.0 pages

Cleaning user input

Sanitizing data inserted by users is a must. Without proper cleaning, data submitted by users could break database integrity or contain SQL injection (and it is not just about hackers, parents are malicious, too). In Moodle, there are two basic functions that every developer MUST use before processing user input. These are required_param() or optional_param(). They both use clean_param() to make sure that the script does not get unwanted values. Developer declares what type the parameter is – for example PARAM_INT for integers, PARAM_BOOL for booleans, PARAM_FILE for safe file name etc. See the top of lib/moodlelib.php for the comprehensive list of them.
In most of cases, clean_param() just uses regular expressions to get rid of invalid characters. Sometimes it returns the original value without the dangerous parts (as in PARAM_ALPHANUM, for example) and sometimes it returns empty value if the parameter does not fit the conditions (as in PARAM_URL that either returns the original value if it is ok, or nothing).
In some cases, just formal syntax check is not enough. For example PARAM_LANG not only checks that the provided value is safe name of the language pack directory (by checking it against PARAM_SAFEDIR internally) but also checks that the given language is actually installed at the site. The same applies to PARAM_CAPABILITY, PARAM_AUTH or PARAM_THEME. As I realized recently (thanks to one of quite frequent discussions with Petr Škoda), this sort of checks must be implemented with extra care and security risks analysis. If clean_param() calls other core functions, we must know exactly what is happening with the value itself during its clean-up, especially when we rely on 3rd party libraries. The point is that parameters are usually checked before the script calls require_login() so that we do not know much about the current user’s rights yet. Therefore, parameter handling functions are potential doors into Moodle core system for anonymous users. Simple checks based on formal syntax rules are generally safer as they keep the request “ante portas” and additional validation can be done later during the script execution, for example when we already know who the user is, what capabilities she/he has, if the combination of all parameters is valid (like the submission, assessment, course module and the course must match).

Post scriptum

Moodle 2.0 translation portal http://lang.moodle.org is up and running in production mode now, language pack maintainers can start translate Moodle 2.0 now. Thank you all for being patient.

by David at 01 July, 2010 10:31 AM

28 June, 2010

Sam Marshall

Eclipse 3.6 for Moodle developers

Eclipse 'Helios' (3.6), which was released this month, includes the new version of PDT (PHP development tools). I tried this out for Moodle development at work today. In my workspace I've got about six copies of Moodle (various OU and core versions) plus the plugins CVS, plus a few Java projects kicking around. So it's a fairly large PHP workspace.

Good news:

1) The new DLTK indexing means that referencing PHP functions (i.e. ctrl-click to jump to definition) is lightning-quick.

2) There's a beta version of Git support as part of Helios - I wouldn't recommend using this until it hits 1.0 personally, and um I don't think it can do merge/pull yet which is a bit of a snag... but moving toward mainstream support is still great news.

Bad news:

1) It uses more RAM than 3.5; you definitely need to increase heap in eclipse.ini from Eclipse default (384MB) to at least 1GB. Note - on 32-bit windows, the max you can set for this is slightly over a gig even if you have 3+GB RAM, so use 64-bit if possible.

Sometimes I saw it peg the RAM at around the 1GB, dragging performance to a crawl; pretty sure this is a memory leak.

2) When editing PHP files I get frequent errors, mostly stack overflow somewhere in DLTK analysis.

3) Because the git stuff is beta, although it shouldn't affect these projects (they don't use git) I thought maybe it might, so I uninstalled that. Didn't make any difference.

Basically I am sure Eclipse Helios is a great release in general and for Java development but, not entirely surprisingly, the PDT folks (Zend I guess) have dropped the ball again; this will probably be better once they get it fixed, but right now it isn't ready for use. I've gone back to the previous version - it might not be able to to reliably find definitions of things, but at least it can usually keep up with my typing and doesn't show an error dialog every ten minutes.

Eclipse Helios SR1 (aka 3.6.1) is due on September 24th. If you're considering upgrading, that would seem like a good date to try. :)

by Sam Marshall at 28 June, 2010 12:00 PM

25 June, 2010

Helen Foster

New testers group in Using Moodle

Testers group iconOur Using Moodle course on moodle.org has a new group – Testers! Testers are active in the Moodle Tracker and help with quality assurance (QA).

So far I’ve been in contact with members of the testers group in the Tracker (created long ago) to check whether they wish to help with Moodle 2.0 testing, and if the answer is yes then I’ve added them to the testers group in Using Moodle.

If you’d like to help with Moodle 2.0 testing and be included in the testers group, please keep an eye on the Testing and QA forum (either by subscribing or via the RSS feed) for details to be posted soon of what needs doing.

Everyone is welcome to help with testing and QA to ensure Moodle 2.0 is the best release ever!

PS Thanks to developer Hubert Chathi for creating such a cool testers group icon :-)


by Helen Foster at 25 June, 2010 11:10 AM

22 June, 2010

David Mudrak

Moodle development traffic 24/2010

Latest stable version 1.9.9+

There are 5 trivial commits into the stable branch from the last development week (from Tuesday Jun 15 to Monday Jun 21). David Mudrák (also known as “I” in this blog ;-) ) fixed coding error producing PHP notice and improved a check of user context existence in the list of users (c36671d). Helen Foster fixed spelling typo in a Quiz help file, spotted by Stuart Mealor (MDL-22842). Tim Hunt fixed several broken $Id$ CVS tags.

Future version Moodle 2.0 Preview 3

There are 69 commits into the main development branch from the last week. The highlighted one for this week is Sam Hemelryk’s one which adds a new element – colour picker – available for administrator config screens (MDL-22806).

Quotes of the week

“Gentlemen, we have reached a milestone. The download is exactly 1,000,000 bytes. Now we have to get it in the right order.”
Martin Dougiamas knows the secret of sofware engineering

“We do not need any new API for fetching of course record – we have DML with MUST_EXIST flag which is the right way now; we should not include course/lib.php on each page anyway.”
Petr Škoda removed get_course_by_id(), get_course_by_idnumber() and get_course_by_shortname() from course/lib.php

Good morning, students, and welcome to the course

On Monday, Petr Škoda committed the enrolments patch he was working on recently. The patch is quite huge – it touches 225 files, removes 7603 lines of code and inserts 11019 lines. You can see the changes nicely at github. This patch was one of the last significant things to be included in Moodle 2.0 release so let us have a closer look at it.
Shortly said, the patch changes the enrolment implementation – that is where and how the information about the users participation in courses is kept. In old Moodle versions (up to 1.6) there used to be two database tables to hold the enrolment information – user_teachers and user_students. Each of these two tables represented a relationship with M:N cardinality between the table user and the table course, with some additional information (the start and end date of the enrolment etc). When Roles and capabilities were introduced in Moodle 1.7, these tables were dropped and the capability moodle/course:view started to control if the user is allowed to participate in the course.
Subsequently, it become clear that the implementation based purely on capabilities is not enough in some real scenarios.

  • There is a conceptual difference between “view the course” and “be seen as a course participant”. For example, you want to let school Inspectors to enter the course but nobody should be able to know about them. Therefore, hidden role assignments had to be introduced.
  • With the capability, it is pretty difficult – but not impossible – to manually order teachers names at the course information page (you know – all teachers in the course are equal, but some of them are more equal than others).
  • Many enrolment related information are kept in the course table and therefore must be shared by all enrolment plugins – for example the start/end dates of the enrolment availability, course cost, enrolment key etc.
  • Enrolments are not manageable with system-level groups of users.
  • Moodle should support common tasks like enrolling students in advance (so that the administrator can prepare the winter term enrolments during the summer), the enrolment can be temporarily disabled for the student or students should be given read-only access to the course after it has finished. These things are kind of doable in Moodle 1.x, though one could expect quite cleaner and more straight procedures from LMS.

Petr tried to deal with these and many other issues by re-designing the internal enrolment system. In fact, Moodle 2.0 did a small step back to pre-1.7 enrolment ages and now there is again a table to hold the list of all course participants – user_enrolments. This table holds the list of all users that participate in a given course – that is they should be listed as course participants (in most cases, these are good old teachers and students). The enrolment record has its state flag – at the moment it can be ENROL_USER_ACTIVE or ENROL_USER_SUSPENDED. See is_enrolled() function for details.
It must be said that the enrolment itself does not give the user any other privilege but to open the course home page. To submit assignments, post into forums or take a quiz, the user must have appropriate role assigned. Both edge cases are valid – enrolled user without any role (for example a student who finished the course or the learner with outdated subscription) and a user with a permission to visit the course without being considered as enrolled (for example the school headmaster or an inspector from the Minitrue). From the UI perspective, the users from user_enrolments table are called Participants or Enrolled users. The users without the record in the table who have the capability moodle/course:view (typically administrators, managers, inspectors etc) are called Other users.
Yet another big change is that enrolment plugins (that is manual enrolment, LDAP based enrolment, External database, PayPal etc.) now have instances in all courses they are used. All instances of enrolment plugins are registered in the table enrol. This table now contains columns that used to be in the table course. Therefore, every enrolment plugin instance can have its own configuration – like enrolment key, dates, expiry notification settings etc. The database table user_enrolments links the given user with the enrolment plugin instance (which in turn is linked with a course). Every instance is allowed to modify just own data – this helps to prevent situations like when a teacher manually unenrolled a student who was enrolled by an external system and the student got enrolled again during the next synchronisation. This is not allowed any more – one plugin can not modify data of an other one.
From the developer point of view, it is nice that you can get course participants again at SQL level (this was not possible before due to complex permissions algebra). This may rapidly increase the performance of some parts of Moodle.

Post scriptum

My lovely wife won a motor scooter in SMS contest! I may become 50 km/hour pirate of the roads. Yahgrr!

by David at 22 June, 2010 11:03 PM

21 June, 2010

Sam Marshall

Quick post to mention something I also posted in Moodle developer forums. I've been helping to investigate how much work it will be to move the OU from our current Moodle 1.9-based system to Moodle 2.

As part of that I converted the Structured Content module (oucontent), which is what displays textbook-like content within the OU VLE.

The non-techie version of this is 'it took about four or five days to convert this module'. If anyone's interested in the techie version, however, you can find it in this Word document which is my notes of the process.

by Sam Marshall at 21 June, 2010 10:08 AM

18 June, 2010

David Mudrak

Moodle development traffic 23/2010

Latest stable version 1.9.9+

There were 5 commits into the stable branch in the last development week (from Tuesday Jun 8 to Monday Jun 14). Martin Dougiamas bumped the version to 1.9.9 and fixed a potential memory overflow problem occurring during the activity import when a teacher is enrolled in many courses (MDL-19880). This fix caused a regression, spotted and patched by Alan Trick and committed by Eloy Lafuente (MDL-22740). Tim Hunt committed patch provided by Vadim Dvorovenko, fixing a typo causing breakage of the questions restore process (MDL-22720). Gordon Bateson committed a patch submitted by Ramon Eixarch, fixing questions import problem in case of Hotpot format JMatch and JMix (MDL-22726).
Security announcements for Moodle 1.9.9 were published yesterday at our MSA page. Moodle 1.9.9 fixes four security problems, two of them are considered critical and one of them major. Registered administrators were notified and encouraged to upgrade their sites before the detailed description of these issues was published, see Moodle security procedures for details.

Future version Moodle 2.0 Preview 3

There were 76 commits into the main development branch during the last week. Repository plugins mahara and remotemoodle were moved from standard distribution into contrib.

Quotes of the week

“Oh dear I’m a geek. New neighbours move into the next flat while their extension’s built. How do I welcome them? Let them connect to my wifi”
Tim Hunt

“Only people that truly hate PHP can program something with it. The others who love it are not programmers :-D
Petr Škoda

by David at 18 June, 2010 10:02 AM

10 June, 2010

Tim Hunt

Computational Knowledge

I spent today at the London Computational Knowledge Summit. A rather pretentious name for a meeting organised by Wolfram about Wolfram|Alpha, Mathematica, and what these sorts of tools can do. They way they see it is that if Google is a means to retrieve facts, Wolfram|Alpha aspires to be a way to use information. For example, governments have started dumping a lot of data into the public domain, but how easy is it for a citizen to extract meaningful information from that data?

For someone used to Moodle and open source, I was deeply struck by how Cathedral (as opposed to Bazaar) the whole Wolfram/Mathematica world is. That may be, in part, a natural consequence of when they started. Wolfram has been working on Mathematica for twenty years. That is an impressive achievement, and it means they have been working on it since before Linux was a gleam in Linus Torvald's eye. They started at a time when the commercial model was how most software was written, and they are clearly still an American commercial software development business at heart.

It is interesting to ask what would have happened of Mathematica had been GPL. Would it have developed more or less than it has as a commercial project? Wolfram would not have been able to pour as much money into it, but would a community have done as much, or more? I am not sure. Clearly the commercial model has been highly successful for driving the development of Mathematica. It is a very cool, and very sophisticated tool. On the other hand, one can dream about a world where the Mathematica engine is free, and as a result shipped on every OLPC XO. What effect would that have on the world over the next twenty years? (Quiz, can you name Mathematica's closes open source rival? I can, but only because it is used in STACK. Speaking of which, it was nice to renew my acquaintance with Chris Sangwin today.)

Another things that struck me about the Wolfram world is how insular it is. Some of the speakers we heard clearly spend all their time thinking about Mathematica. They have a really amazing tool, and, having what they hope is the ultimate sledge-hammer, they seem to view most problems as nuts to be cracked. It made me worry about whether the Moodle community seems that insular from the outside.

However, the day was not just about Maths and Mathematica, but more about the democratisation of knowledge. How can a concerned citizen reach meaningful conclusions about the world using the data that is now available? Conrad Wolfram set the scene by talking about this mission. He started with two slides, one showing a page from Principia Mathematica, and then a page from a modern mathematical paper. They both comprised text, diagrams and equation. Certainly, modern type-setting is better, and the diagrams are now in colour, but that is not much to show for 350 years progress. Is this the best way to publish scientific knowledge in the 21st Century? No, it isn't. For instance, it is silly to show a static graph. It should be a graph that the reader can manipulate, and the raw data should be hidden behind it in a form that you can extract to perform you own analyses on if you choose. Is the paper about a model? If so the model should be embedded there, and you should be able to experiment with varying the inputs and the assumptions to see what happens. If you are interested, you should be able to get at the source code to see exactly what was implemented. So, rather than a document being a static, one-way, low-bandwidth form of information transmission, it should be an interactive things that allows the "reader" to engage in a two-way dialogue.

Of course, Mathematica is the perfect tool for authoring such documents, or so Wolfram would like you to think. To encourage this, they are talking about a CDF - computational document format - which would be an 'open' standard based on a subset of Mathematica's capabilities, with a 'free' player for all common platforms. Think PDF and Adobe. Will it take off? Well, does the rest of the world trust Wolfram enough to adopt their format? Can the offer enough more than HTML5? I am not sure.

The next talk was by Andrew Dilnot from Oxford University. He talked very engagingly about the difficulty with statistics and gave some nice topical examples of the need to interpret numbers in context. Presented with a numerical fact, you need to ask some basic questions: is this big or small? going up or down? where did it come from? For example, the smoking ban has saved the NHS £8million. Well, that is small. The NHS annual budget is £100billion. Why are the media making such a big deal of the story? His talk could be summarised as: All numbers are wrong, but using numbers is still much better than not using numbers.

There were a couple of talks about that were more pretty than interesting. John Barrow from Cambridge talked about the history of scientific images, and Alan Joyce showed some of the cool things you can do with Mathematical. There were also some glimpses behind the scenes of Wolfram|Alpha. As I say, very Cathedral. There is no web spidering or crowd-sourcing here. At one end it is about Wolfram people going out and finding the most authoritative data sources they can get, and loading them into a format their Mathematica code can use. At they other end they are training the Alpha system to take natural language queries, decide which methods to apply to what date, and select visualisation to display the results, in order to automatically give the best possible answer to that question. They gave an interesting parallel for this. In the past, all actors had to appear on stage to whatever live audience could fit into the theatre. Today, film and television allow most people to see the best actors in the world. Can the expertise of the best thinkers in different fields be made accessible in a similar way? Well, that is their goal. The initial results are impressive, but these are only the very early stages of a highly ambitious project and there is a lot more to do.

In the afternoon, Conrad Wolfram talked about his thoughts on maths education. This has traditionally been focussed on teaching students how to perform computations by hand. But, said Conrad, this is only one part of what you need to know to be a mathematician. The full steps are:
  1. Ask an interesting question about the world.
  2. Translate that real world question into mathematics.
  3. Compute the solution.
  4. Translate that solution back into real-world terms, and find some way to validate whether your answer makes sense.
(OU Maths students, note the similarities to the Modelling cycle as taught in OU courses.) Historically, maths education has focussed on Step 3. However, these days computers are just better than humans at that. At the same time, there has never been a greater demand for people who are good at the other three steps (in business, to guide public policy, and so on). So we need to rethink the maths curriculum. To put it another way, is it cheating if you use Wolfram|Alpha to do your maths homework? Well, if it is, then we are probably assessing the wrong things.

At the end, Stephen Wolfram gave a presentation by video link summarising some of the themes of the day.

Overall, it was a very interesting day. While I don't think it quite lived up to its pretentious title, it was certainly more than just a Wolfram marketing exercise. I would like to thank the Open University for sending me. I can see myself using Wolfram|Alpha in future for certain sorts of queries, but it will not replace Google as my day-to-day search engine. (I don't think it aspires too.)

by Tim Hunt (noreply@blogger.com) at 10 June, 2010 10:46 AM

08 June, 2010

David Mudrak

Moodle development traffic 22/2010

Latest stable version 1.9.8+

There are 7 commits into the stable branch from the last development week. Most of them are just final cherries before the upcoming 1.9.9 release. Sam Hemelryk patched HTMLPurify library so that it does not normalise line breaks into \n. It seems that some text comparison checks are broken due to this operation done by PARAM_TEXT or PARAM_CLEAN (MDL-22654). I have committed Tim Lock’s patch that fixes SQL error in the Recent activity block caused by Workshop 1.x code at recent PostgreSQL servers (MDL-22448). Petr Škoda fixed a critical bug in setnew_password_and_mail() function, spotted by Tim Hunt. The function did not salt the password with hash_internal_user_password() when it was storing the newly generated one into the database.

Future version Moodle 2.0 Preview 3

There are 77 commits into the main development branch from the last week. We are tuning the code for the beta release. To highlight one issue for this week, Dongsheng Cai is converting all remaining legacy file upload forms into the new File+Repository APIs (MDL-22574), including bulk user imports, outcomes import, questions import etc.

Quotes of the week

“Writing proper documentation is part of the development task. Just throwing random code into CVS then abandoning it is not good enough. Particularly with a core library. The work is not finished until there are full PHPdoc comments, and an overview on Moodle Docs in my opinion.”
Tim Hunt discussing File API with Petr Škoda

“At least the file code seems to work, it is better than long spec with tons of docs and rubbish code that can not work :-)
Petr Škoda discussing File API with Tim Hunt

Do not include JavaScript too early

In Moodle 2.0 there is a new framework for including JavaScript code. Thanks to a bug reported by Miquel Escarrà (MDL-22651), I have realized kind of malicious aspect of the system. If developers requires a JavaScript module for page in a course context, they must do so after the current $PAGE was informed about the course. During the initial script setup, global variable $COURSE is set to the site course (front page) by default and it is re-set to the current course later, typically by calling require_login() which in turn calls $PAGE->set_course(). During the JS module registration, all needed strings are fetched by string_for_js() method of page_requirements_manager (accessed via magical $PAGE->requires). The problem is that the course may have set a forced language which overrides the currently selected language in the session. Therefore, if JS module is registered too early (before the $PAGE knowns the forced language), the strings are different than they should be: they are obtained from the language pack set in the current session and not from the language forced by the course. If the same string is fetched again (by another module, for example) later during the PHP script execution, when the forced language is already known, string_for_js() throws coding exception. Which is good because we want to know we did something wrong.
This sort of bugs are quite difficult to reproduce as they emerge in a very specific situation and environment. In this case, it helped that the reporter provided detailed description of his steps leading to the error.

Post scriptum

I am looking forward the Czech MoodleMoot 2010 in Brno later this week. @mootcz10 #mootcz10

by David at 08 June, 2010 10:58 PM

02 June, 2010

David Mudrak

Moodle development traffic 21/2010

Latest stable version 1.9.8+

There are 4 commits into the stable branch from the last week. I added an empty string ‘parentlanguage’ into English langconfig, because as a general rule, every string must be defined in English pack first (MDL-22575). The fact that parentlanguage was not defined required hard coded exceptions in the new translation system. And I do not like exceptions. However, this change introduced a regression – language import utility tried to fetch the parent language for English. Fortunately Eloy spotted and fixed it promptly (MDL-22585). Yet another regression, caused by the recent patch in the Assignment module, was fixed by Petr Škoda (MDL-22181).

Future version Moodle 2.0 Preview 3

There are 160 commits into the main development branch from the last development week. On Monday, the branch was tagged as Preview 3. Sam Hemelryk rewrote the blocks docking mechanism significantly (MDL-22560). In the new version, there is now better support for themes. The performance was improved. Docking mechanism is not completely based on YUI3.

Quotes of the week

“2.0 is getting fun to use now. Just need the last 90% of effort to finish the remaining 10% features.”
Martin Dougiamas

Post scriptum

My Linux machine uses two-state logic. Either it rocks, or it sucks.

by David at 02 June, 2010 10:01 PM

26 May, 2010

David Mudrak

Moodle development traffic 20/2010

Latest stable version 1.9.8+

There are 4 commits into the stable branch from the last development week. Sam Marshall fixed an accessibility issue, preventing IE users from navigating the page with keyboard (MDL-22518). Martin Dougiamas fixed the cases when getremoteaddr() returned NULL because the script was executed via CLI. The empty value violated the non-null constraint on lastip in user table and some scipts (for example LDAP authentication plugin) could not create new user accounts (MDL-19628). Petr Škoda committed Ye Chen’s patch that fixes critical bug in get_users_by_capability(). The symptoms of the bug include “No users were found with permissions to submit this assignment” in case of an assignment in group mode. HTML purifier has been upgraded to the version 4.1 and is available as an experimental feature for PHP5 servers.

Future version Moodle 2.0 Preview 2

There are 281 commits into the future release branch from the last week. Among many other improvements, the function get_string() now uses on disk cache to store the result of merging of standard language pack with the local customization and parent languages. Included YUI libraries have been upgraded to 3.1.1 and 2.8.1. The rotation of the vertical text (also known as the book spin) can be configured via string “thisdirectionvertical” in langconfig.php.

Quotes of the week

“Tracker going down for restart, java needs it monthly kick in the ass”
Jordan Tomkinson knows how to keep our servers up and running

“Going to commit patch which removes dirroot from config.php, yay!”
Petr Škoda is always happy when he is cleaning up Moodle source code

New Moodle development books

I like IT books and have dozen or two of them on the shelf in the office. I usually do not read most of them, though. Especially those just copying online documentation and manual pages. It is quite interesting trend that computer books have usually hundreds of pages while the real added valuable information could be compressed to five of ten pages of text. But the shelf full of thick computer books gives an impression that the guy really knows what he is talking about when asking you to turn it off and on again ;-)
Given that, I appreciate books that offer more than you can find online in API documentation. And I guess the new book on Moodle 1.9 development by Mike Churchward and Jonathan Moore from Remote Learner (U.S. and Canada Moodle Partner) can be the case. It was released by Packt Publishing together with yet another one by Paul James Gadsdon, dealing with Moodle custom themes development.
I have ordered both of them and am looking forward to see how they are written. According the sample chapters available, they look as promising guides and tutorials on the subject. Shall be noted that by buying Moodle books, you help support Moodle development as a percentage of all sales goes to the Moodle Trust.

by David at 26 May, 2010 09:31 AM

21 May, 2010

Sam Marshall

Here's an update on what we've been coding recently in the area of the OU where I work! I've done a few things, some of which may be of interest to other Moodle users, others not so much.

  • I fixed final glitches etc. in the courses dashboard for tutors (mentioned before; it uses a webservice to access information from our Moodle system, and other systems, about which forums a tutor can access across all courses and whether they contain unread messages, then displays all these links in one place for convenient access).
  • I wrote a block for the glossary in Moodle 2. Teachers can add this block to a glossary then use it to search all the other glossaries they can access. The idea is, if they want a glossary entry about something for a course they're writing, they can search all other courses to see if somebody already wrote one. I'd love if people try it out (and I'd love even more if you can manage to convince the Moodle HQ folk that it should be included in core Moodle).
    There will be a version of this feature in OU Moodle 1.9, but I haven't written that version yet. This development was part of our current project to learn more about coding for Moodle 2.0, which several developers here are involved in as we work out how to plan for a possible upgrade of our systems. Coding in Moodle 2 is definitely nicer than in 1.9, so I hope we can go ahead with it...
  • I updated the Java audio recording applet I have, which is designed for students to record themselves. It's basically just to save them having to download a standalone application; everything it does is local. Anyway, it now looks nicer (we didn't have graphic design resource, but I tidied it up based on the upcoming new OU styles that were already designed) and a few usability glitches have been ironed out. The applet's open source; you can get the code here, or try it out on this temporary prototype site. Assuming we don't find any horrible problems with it, this will be used to replace the current Audio Recording Tool for Languages courses.
  • I added support for .mp4 in more places in OU Moodle (it was already supported in some places). We're transitioning from .flv. Now we're going to be fully ready for the .mp4 video format just in time for it to become obsolete. Awesome!
  • Thanks to the current round of testing from our Technical Testing team, I fixed lots and lots of bugs in OU Moodle (for our June releases) including some in our publicly-available modules (ForumNG, OU wiki) and just a couple in core Moodle 1.9 and 2.0 as well.

I've done some other things in the last couple of weeks too, but I think I'll stop there; this is supposed to just give you an idea, not to be an exhaustive list... sorry about that! However, I should also mention the others on my team:

  • Ray has nearly finished auto-archiving for ForumNG. The idea is you can set forums to automatically delete discussions when they're inactive for a number of months. If you prefer, you can also make it move the discussions to another forum (presumably a hidden 'archive forum' or something). This means that very busy, very long-running forums won't eat up too much database space and won't reduce in performance as the number of discussions climbs into many thousands.
  • Mahmoud has nearly finished advanced search for ForumNG. In addition to the existing free-text search (powered by the ousearch block), you can search by date or by user (full name, partial name, or username).

I hope we'll do the public 'stable version' ForumNG release in a couple of weeks (shortly after the OU's update on June 1st). The idea is that this will be maintained in line with the fully-tested OU updates, rather than getting every new (and possibly broken) feature as soon as we finish it. So it won't have the two features mentioned above, but it should be useful if you want to run ForumNG on a major site.

Finally, a side note: I just bought a tune called Theme From HTML (Steve Hill & Technikal; Dark by Design mix; on Masif). Playing it now. It's very ugly indeed. If you imagine the 4:4 kick/snare is your head and the bassline is a brick wall, it sounds just like coding HTML for Internet Explorer! Awesome.

by Sam Marshall at 21 May, 2010 09:54 PM

18 May, 2010

David Mudrak

Moodle development traffic 19/2010

Latest stable version 1.9.8+

There are 4 commits into the stable branch from the last development week. Tim Hunt fixed a wrong capability checking in Quiz module (MDL-22410) and several regressions in clean_param(), introduced when we were converting ereg to preg, because ereg functions are deprecated in PHP 5.3 (MDL-19418).
Martin Dougiamas committed a bunch of patches that kills the scripts expected to be included only, if they are called directly via URL (MDL-22388). During the initial setup of every script life time, Moodle core defines constant MOODLE_INTERNAL which shall be used to make sure that the script is included and not called directly (constants can’t be defined via URL even with bloody register_globals on). This trick helps to prevent libraries, forms definitions and other scripts from potential security holes. My mom told me not to talk to strangers so I personally prefer silent one-line check

defined('MOODLE_INTERNAL') || die();

instead of explaining the poor hacker that the direct access to the script is forbidden (Mahara uses this shorter form and I just like it).
Gordon Bateson found a way how to deal with an XHTML issue in Hotpot by using IFRAME instead of OBJECT for Internet Explorer, as HTML forms are not able to escape OBJECT in this browser.

Future version Moodle 2.0 Preview 2

There are 141 commits into the future release branch from the last week. It is now tagged as Preview 2. Since Preview 1, there are many improvements and bug fixes. Many thanks to all who help us with testing.

Quotes of the week

“Ha, some song just came on my radio station by a band called CSS. The song is called CSS Suxxx. Just when I was swearing at css”
Martin Dougiamas experiences reaffirmation from the world

Watch your back!

Backup and restore support used to be my not very favourite part of Moodle modules coding. I was kind of scared (and bored) by all those direct fwrite() calls to generate XML representation of the module data. With the new backup/restore framework, written by Eloy Lafuente, this is not true any more! Eloy has prepared really well designed system that deals with a lot of tasks automatically, yet in a flexible way. Following his tutorial on backup support for Moodle 2.0 activity modules, I was able to quickly hack a working prototype of Workshop backups.
What I like the most so far is the way how module just defines a description of its database structure and lets the core to actually fetch the data a convert them into XML representation. Given the necessary amount of information, new backup system is able to “automagically” handle all relations, references to other tables and including embedded files (only those really needed by the module, of course!).
There are still parts to finish both in Moodle core and in modules – most notably the ability to backup subplugins information and to restore 1.9 backups. But I can sleep well again as backup and restore is not nightmare any more for module developers.

Post scriptum

After more than eight years, one of the characteristic symbols of Moodle, the default user icon (yes, that very well known smiley cake), was replaced by a bland avatar for the standard theme in Moodle 2.0. That is ironic that the smiley actually replaced the original “shadowhead with something a bit more positive”. The story of the “f1.jpg” image and how it resisted various attempts to replace it is sometimes quite interesting. Anyway, I will miss it… So long!

by David at 18 May, 2010 09:55 PM

13 May, 2010

Tomaz Lasic

Invited

Our first demo course for the new Moodle Educational Demo Site has wrapped up nicely. Thanks to 40 participants from around the world, we generated some useful sample data and activities for people to see, dip in, even download and play with (now available at ‘standard’ Moodle Demo site ).

Most importantly, we hope that this course, and others like it in the future, helps people make the cognitive, personal leap from ‘this is just a piece of software‘ to ‘hey, that’s how I could (use it to) solve the X problem/realise the X idea/make X happen‘.

Here is the story, told in a clip.

Now, you are kindly invited to have your say in building resources like this, together with people who participated in Water!

Hear what the plan for edu-demo site is, then help us make it better in an ‘open microphone’ and shared whiteboard Elluminate session this Sunday/Monday (depending on your timezone).

I for one want Moodle to be the shining light not JUST in providing an awesomely flexible, #1 LMS but also in generating great ideas and examples from and for its huge community of users about of how to use it well where and when it matters most  – ‘on the ground’, with people.

Join us !

Huge thanks to Gavin Henrick and the team at Enovation Solutions (Irish/French Moodle Partners) for providing the use of Elluminate room for this occasion.

Session date & time across timezones

Session details (including technical)

Digg This  Reddit This  Stumble Now!  Buzz This  Vote on DZone  Share on Facebook  Bookmark this on Delicious  Kick It on DotNetKicks.com  Shout it  Share on LinkedIn  Bookmark this on Technorati  Post on Twitter  Google Buzz (aka. Google Reader)  

by human at 13 May, 2010 07:43 AM

11 May, 2010

David Mudrak

Moodle development traffic 18/2010

Latest stable version 1.9.8+

There are 4 commits into the stable branch from the last development week. Dan Marsden fixed a bug in SCORM backup/restore (MDL-22301) and yet another one which was caused by not using absolute file paths when including a PHP file (MDL-22340). In Moodle, the best way to include other files (typically libraries or forms definitions) is to include the main config.php via dirname(__FILE__) and then include all other files needed via their full path, using $CFG->dirroot or $CFG->libdir.
Eloy Lafuente updated the timezones database shipped with Moodle to version tzdata2010i (MDL-18576). This database contains information about the world’s time zones and daylight saving time and helps our in-built calendar to calculate correct dates and times for users from all around the world. Moodle uses so called Olson database, a public-domain collaborative compilation of timezones data, currently maintained by Paul Eggert.
Pierre Pichet committed a patch fixing buggy behaviour of calculated question type on duplicate (save as new question).

Future version Moodle 2.0 Preview 1

There are 158 commits into the future release branch from the last week. On Thursday, Martin Dougiamas announced the release of Moodle 2.0 Preview 1 version, the first milestone on about 10 weeks long track to reach final Moodle 2.0. See the preview release notes for more information.

Quotes of the week

“It is a good idea, so I put it in the tracker. The point of the tracker is that it remembers things, so we can forget about them.”
Tim Hunt on tracker.moodle.org

“I’m really looking forward to 2.1 and working on modules again.”
Martin Dougiamas knows that many of improvements in 2.0 lie in the dark deep of Moodle architecture internals and are never to be actually seen by users

Installing Moodle from the command line

I love Linux for many reasons and not only because it is free as in being free after drinking beer. Since the first days with Linux, I’ve been impressed by the power of command line utilities, following the Unix philosophy of doing just one thing, doing it well and cooperating with other small programs. From version 2.0, Moodle supports installation and upgrades from the command line. Of course I was happy I could spend some time on improving these routines a bit.
CLI programs for common administration tasks (installation, upgrade, switching the maintenance mode and resetting a forgotten user password are supported at the moment) can be found in admin/cli/ directory of standard Moodle 2.0 source code. You should run them as the same user as is used for the webserver process (apache or wwwrun are used usually).
This is an example of how I installed a fresh Moodle 2.0 at my notebook today:

$ php admin/cli/install.php --lang=en
--wwwroot=http://localhost/moodle20
--dataroot=/var/www/moodledata/moodle20
--dbname=moodle20 --dbuser=apache
--dbpass=xxxxxx --dbsocket

In this example, the script runs in an interactive mode, asking for all needed data and using the provided ones as default. There is also a possibility to execute the script in non-interactive mode, providing all required information as CLI parameters. Such an option may be interesting for hosting providers as it allows to automate the process of creating a new Moodle site.

Post scriptum

http://www.projectcartoon.com/cartoon/1

by David at 11 May, 2010 09:55 PM

Penny Leach

On loving (and hating) software, and how crippling it is to run in high heels

I have a well established (and well deserved) reputation for hating MySQL and being a Postgres fan. While this is functionally true, I want to examine what is actually behind it.

I tried to find an analogy recently to explain this to my friend Michel, and the best I could come up with was (and actually I think it fits perfectly) the following:

Imagine that you are an athlete. A runner. And you have the most amazing comfortable ergonomic shoes. These shoes fit you perfectly, they are tailored to exactly your body, the way you run. They help you run faster, they enable you to excel at the sport that you have chosen. Then imagine that for whatever reason, you join a running club, and this running club has a policy of running in high heels.

"But why would you do that?!", you exclaim in dismay. "When you could use these other shoes, which are much more comfortable and actually help you run faster".
"Ah well", they reply. "We've always run in high heels and it works fine for us".

That is how I feel whenever I have to touch MySQL.

I remember having seen one of Kathy Sierra's talks about creating passionate users - not sure where, maybe Webstock 2007. 'Passionate users' is something that may seem absurd to many computer users who struggle with daily computer use (I have written about this before), but the reality is that I am a passionate user. There are certain pieces of software that I use every day, and feel passionate about! While writing this blog post, I realised that what I'm really talking about here is tools - things that I use in my daily work as a software developer.

I honestly love working with Postgres. I love working with Git. There are actually times where I need to do something, or solve a problem, and I feel like this software helps me do it. After I solve the problem I am grateful to be able to work with such tools. This is where the random "I love postgres!" or "I love git" tweets come from.

This is a really important point - it's not that I hate MySQL (although I do), or CVS or SVN (also true) - it's that I actually love Postgres and Git, and when I need, for whatever reason, to work with Mysql or CVS or SVN, I really miss the features that make me love their competitors.

Of course, this fails to take into account that different pieces of software have different purposes and features, and this is a good thing, because diversity encourages competition which makes software improve. Interestingly, I don't know if I feel this way about all software - I love Vim, but I don't hate Emacs - I just don't use it. When I have to use Emacs (it happens), I am sometimes frustrated that it's different - but I blame myself for that (not knowing it well enough), rather than blaming the software for being substandard. I'm not sure if Vim is any better or worse than Emacs - Vim just suits me better. In the case of Mysql and Postgres, I actually think that Mysql is substandard, and similarly for Git and CVS or SVN.

There seems to be a scale for my reaction to using different software:
  • Love: I feel that the software is predictable, elegant and helps me achieve what I want and get my work done. I sometimes feel love for it when it's particularly helpful.
  • Ambivalence: I use the software, but don't feel particularly strongly about it.
  • Hatred: Using it actively hinders me working, because it is lacking features I need, or is unpredictable and unreliable. I feel despair when I have to use it.

Obviously, the two extremes are both forms of passion, although I'm sure that the first is what Kathy Sierra was talking about. But I wonder if the software that falls into the third category only exists when there is a competing piece of software that falls into the first category. If I had never used Postgres, would I hate MySQL so much? Probably not, although I might hate it a little bit. I'm sure people that have always run in high heels and never experienced how much easier it is to run in sneakers don't hate their high heels, because they don't know any different.

So the conclusion I must draw, is that I don't actually hate MySQL or CVS or SVN - I hate being forced to use tools that I consider to be substandard than their equivalents, which I actually love. To me this is such a black and white issue I am completely baffled when other people don't see it. Considering the way that most people interact with their computers, if software exists that actually makes people feel love - why on earth would they use anything else?

by penny@she.geek.nz (Penny) at 11 May, 2010 03:07 PM

04 May, 2010

David Mudrak

Moodle development traffic 17/2010

Latest stable version 1.9.8+

There are 10 commits into the stable branch from the last week. Half of them, committed by Dan Marsden, deal with various SCORM issues (MDL-22168, MDL-22046, MDL-21568, MDL-18202, MDL-21444). Tim Hunt fixed three Quiz issues (MDL-22241, MDL-20586, MDL-22257). Thanks to Gordon Bateson, Hotpot module now uses HTML OBJECT tag instead of IFRAME, due to XHTML 1.0 strict compatibility (MDL-17702).

Unstable development version 2.0dev

Total of 294 commits found their way into the future version branch last week. Several various subsystems and major patches were included – for example the new My home page, Moodle Hubs support and many others. Petr Škoda’s recent patch, that reimplements the whole enrolment subsystem and changes some of the key concepts of roles and their assignments, is still being reviewed in a separate branch. Martin Dougiamas is going to announce the release of Moodle 2.0 – Preview 1 version, just working on the release notes yet.

Quotes of the week

“Users will remember for almost forever a bad/broken release; but will quickly forget that a stable/fine/working release was a year late.”
Greg Mushial summarizes his experience from 40+ years involved in software development

“Beta version software is likely to be useful for internal demonstrations and previews to select customers. Some developers refer to this stage as a preview, a prototype, a technical preview (TP) or as an early access.”
Wikipedia, Software release life cycle

Help tooltips in Moodle 2.0

Among many other (and definitely more significant and more important) improvements in Moodle 2.0, there is a new way how the help tooltips are handled. From the users’ point of view, help is still available via those question mark icons. Instead of opening a pop-up window in the browser, Moodle 2.0 uses YUI3 overlay to display a “bubble” with the help text. The behaviour of the tooltip had been a subject of a discussion (MDL-22067) and at the end, it was decided to follow the functionality found in Mahara or Github.

From the developer’s point of view, help texts are not stored in separate files any more. In the dark past, help files used to play a role of inline help, documentation, manuals or even tutorials on using Moodle. Nowadays, with Moodle Documentation portal being actively growing thanks the community contributions, we are trying to revert helps to what they are supposed to be – useful hints on various user interface elements, their meaning and usage. Therefore, the help files are being migrated into proper Moodle strings in 2.0.

For every help, two strings must be defined. One for the label of the thing the help is describing. In the forms, this is the label of the input element in almost all cases. The second string is the help text itself. The identifier of the second string must be the same as the identifier of the first one, just with “_help” suffix, for example:

$string['subject'] = 'Subject';
$string['subject_help'] = 'Message subject will be used as a title at the message view page.';

Let us say we want to add such help in a Moodle form, for ‘msgsubject’ input field. You would probably have a code like:

$mform->addElement('text', 'msgsubject', get_string('subject', 'mymodule'));
$mform->addHelpButton('msgsubject', 'subject', 'mymodule');

That would use the string ’subject’ defined in your ‘mymodule’ language file as a title of the help and the string ’subject_help’ defined in the same file as the help text. To get the same result in Moodle 1.9, you would have the help defined in a HTML file, let us say help/messagesubject.html a the code in the form would look like:

$mform->setHelpButton('msgsubject', array('messagesubject', get_string('subject', 'mymodule'), 'mymodule');

To display a standalone help icon anywhere at your page, use help_icon() method of the core renderer instance:

echo $OUTPUT->help_icon('subject', 'mymodule');

Help strings can use Markdown syntax for basic HTML formatting. We use that just for producing bullet list from the lines starting with asterisk.

To give the translators something to start with instead of rewriting all help strings from scratch, we are copying the contents of the translated help files into new help strings wherever it is possible.

Post scriptum

I can’t think of anything to write here today :-)

by David at 04 May, 2010 08:51 PM

Tomaz Lasic

What makes a great Moodle course? Part 1 – What is a course?

What is a course?

Introduction

Reading Wikipedia like Britannica sucks. Reading Wikipedia like Wikipedia is mind-opening.

Cory Doctorow (http://www.edge.org/discourse/digital_maoism.html)

What is mind opening about reading Wikipedia? Click ‘Discussion’ on a popular or contentious Wikipedia entry and you’ll see. The history, variety of views, contributions, changes, updates, the links, the enormity of effort across even one entry will (probably?) ‘hit’ you. It’s free, intellectually brawling, universal, instantaneous and pretty damn accurate (I won’t elaborate on ‘truth’ of either – more on that some other time, blame the French ;-) ).

To borrow Doctorow’s quip – reading Moodle like a textbook sucks. Reading Moodle like Moodle is mind-opening. But how do you read Moodle? How do you know a good Moodle site or course when you see it (beyond a pretty theme …)? What set of skills and understanding do you need to read it? Create it?

These questions will be the focus of the next few posts, a series loosely called ‘What makes a great Moodle course?’ The aim is to flesh out a few core questions to help Moodle users not just create and participate in courses but to support and enhance sharing of courses through Moodle 2.0 ‘s new feature called Community Hub. And please, this is only a ‘thinkaloud’ …

The first post will explore a (not ‘the’) definition of a ‘course’ and invite you to ponder a particular view, long held by Martin Dougiamas, the creator and lead developer of Moodle. The next post or two in the series will explore the convergence of technological, content and pedagogical expertise in a great Moodle course, then imagine a great Moodle course as primarily a communication and creation tool. Finally, we will bring it all together and suggest some ‘point format’ guidelines for developing, nurturing and appraising Moodle courses.

Now, this may seem like an individual effort but I would hate it to be so. I would love to hear what YOU think makes a great Moodle course and share it in probably the easiest way possible by contributing to our SynchIn pad (a version of the old beloved Etherpad) or, of course, in the comments below. Because “we” know a lot more than “me” on this one ;-)

So … what is a course?

When asked this question, most people would probably answer something like “a course is a structured body of content and activities that students enrol in, complete tasks and get graded by the teacher to see how well they have done at the end of it.” Yes? No?

But what if you see a course essentially as a community (Martin’s remark that has lingered with me since my first few days at Moodle HQ). What if you even replace the word ‘course’ with the word ‘community’? A few things change …

Whether online, blended or offline, communities, particularly the most successful ones in terms of participation and engagement, have a lot in common:

  • They are not inert, linear, static, fully set and pre-determined things.
  • Roles of members are defined but flexible enough to cater for changes should the circumstances require so.
  • There are understood rules and consequences for breaching them in order for all to feel safe.
  • In a community (unlike a network, more on that perhaps another time…), one cannot just ‘(un)friend’ or ‘(dis)connect’ but learn to deal with, work things out.
  • Its members are responsible to each other in pursuing a common set of goals. Interdependence through contribution and participation is implicit and made explicit in its design.
  • There are multiple channels of communication, not just top-down announcements.
  • Participation and learning are active, done mostly through challenges, feedback and mastery not by passively going through the laid out material.
  • Changes, adjustments, improvements are essential and welcome at different levels and different areas – everyone improves, not just one type of members at one thing.

Sound like qualities of a good Moodle course? Well, sounds a lot like a party too… as Lee Lefeever of the CommonCraft fame explains the thing about online communities in his usually succinct way:

View more presentations from leelefever.

A blank Moodle course (well, an entire site really…) is essentially an incredibly versatile wiki, hence the Wikipedia reference at the start. By design, a wiki is a platform for a community. If imagined this way, the question then becomes not whether a (your?) course is a community or not, but rather how does a (your?) community cater for its members and their needs, passions, welfare and interests by using Moodle.

And when you see it like THAT, the imagination and mindset matter more than the technical skills. And so they should.

Digg This  Reddit This  Stumble Now!  Buzz This  Vote on DZone  Share on Facebook  Bookmark this on Delicious  Kick It on DotNetKicks.com  Shout it  Share on LinkedIn  Bookmark this on Technorati  Post on Twitter  Google Buzz (aka. Google Reader)  

by human at 04 May, 2010 03:19 PM

Sam Marshall

Hi! Since I'm late with another blog entry, here's a very short one: I thought you might like to see the initial design document for the forum advanced search feature.

This is still sort of subject to consultation, but not very, because we're about to start development (by which I mean, Mahmoud is). Still, if you see anything horrible in there you want to comment about, please feel free.

Design document (Word format)

 

by Sam Marshall at 04 May, 2010 10:33 AM

27 April, 2010

David Mudrak

Moodle development traffic 16/2010

Latest stable version 1.9.8+

There were 12 patches committed into to the stable branch during the last development week. Helen Foster once again reworded the help describing the behaviour of a recently added  gradebook feature as Elena Ivanova suggested (MDL-21218). Pasi Häkkinen discovered a malicious incorrect usage of HTML entity that led to Flash version detection being done by AJAX call at every page load instead of once per session and Petr Škoda promptly committed Pasi’s patch (MDL-22154). Dan Marsden backported Vlas Voloshin’s patch fixing the display format of exhibit time periods in SCORM 2004 packages (MDL-18835) and fixed yet another issue with First Access and Last Access dates in SCOs (MDL-16184, MDL-21423). Sam Marshall fixed a bug producing empty links when there was no group picture. Such empty links created an invisible tabstop which is confusing for screenreader and other keyboard users (MDL-22174). Tim Hunt backported some parts of unit test failure display improvements (MDL-22174). Eloy Lafuente fixed a bug in backup/restore machinery so the manually added links to the course main page are transformed into new URL, reported and tested by Larry Elchuck (MDL-22176). Petr Škoda committed a patch provided by Gordon Bridge. That fixed a bug in the Assignment module which overwrote the grade item identifier in the Gradebook with a number (column “id” of the Assignment module instance in course_modules) instead of the value defined for the activity in modedit form (column “idnumber” in that table). This critical bug had been reported before but could not be reproduced until Gordon described it in details and found the nasty line (MDL-22181).

Unstable development version 2.0dev

There are 141 commits into the main development branch last week. To highlight one, Eloy Lafuente merged first parts of the new backup/restore backend he was working on in a separate git repository recently. Sam Hemelryk is going to work on the backup/restore user interface. As many other parts of Moodle 2.0, backup/restore subsystem will be fully implemented during the beta period (which starts in six days!). The last huge  change that is going to land before the feature freeze next week is Petr Škoda’s new baby – the reimplementation of enrolment plugins. After that, Moodle 2.0 APIs and database structures should be considered more or less stabilised and the team will focus on fixing the regressions only.

Quotes of the week

“That github interface is very nice”
Martin Dougiamas after reviewing a patchset before it was committed into the main CVS repository

“Would be nice if core developers actually tried to run the code before they commit it into the repository.”
David Mudrak gives a hint on how to prevent the most obvious bugs

“Whoa, that was quick!”
Pasi Häkkinen found his bug fixed in 57 minutes after it had been reported

I am, YUI

All modern web applications use advanced JavaScript based techniques to increase the usability of the user interface. Things like inline editing, re-populating the parts of the page via AJAX calls or saving the forms without reloading the whole page are quite common for users today. To ease the integration of JavaScript and skip fiddling about with its different implementation in various browsers and their versions, web projects use some JavaScript frameworks like jQuery, Dojo Toolkit or YUI. The latter one, Yahoo! User Interface library, has been chosen as the official JavaScript framework for Moodle since long time ago. Moodle 2.0 ships with the most recent version YUI 3.1.0 while still providing a way how to use some widgets from earlier 2.8.0 version.

Moodle core does a lot of work for you behind the scene with including YUI libraries and their dependencies in correct location of HTML produced by your code. The most straightforward way to include JavaScript on your page is to define the code in the file module.js in your plugin directory. To avoid collisions of global variables and functions, all your code is supposed to be wrapped in a namespace. Since 2.0, we put all Moodle JavaScript code into a global M object and plugins are expected to use their own M.plugintype_pluginname namespace. For example if you write an activity module called foobar, all your JavaScript functions should be defined in M.mod_foobar namespace.

To include your code at the page and to initialize it from PHP, use $PAGE->requires->js_init_call(), providing the name of the initial JavaScript function as the first parameter. This initialization function must accept YUI instance object as the first parameter which we call Y, as is common in YUI 3. Once you have YUI instance, you can do whatever magic this library offers to you, including the possibility to load additional YUI modules with Y.use(). The ‘Hello world’ example of using YUI in Moodle 2.0 could look like this:

Let us say you are working on FooBar activity module. In your PHP script, for example /mod/foobar/view.php, add a line

$PAGE->requires->js_init_call('M.mod_foobar.init');

Then create the file /mod/foobar/module.js with the following contents

/**
 * @namespace
 */
M.mod_foobar = M.mod_foobar || {};

/**
 * This function is initialized from PHP
 *
 * @param {Object} Y YUI instance
 */
M.mod_foobar.init = function(Y) {
    alert('Hello world');
}

Or, instead of just displaying the alert, to modify the current HTML code (for example to add some elements via JavaScript or to remove some non-JS support code) just use

M.mod_foobar.init = function(Y) {
    Y.one('#mycustomholder').set('innerHTML', 'Hello world');
}

See YUI 3 documentation for more great examples. You may also find this blog post useful (I did, thanks Eloy for the link).

Post scriptum

I love xkcd.

by David at 27 April, 2010 09:45 PM

Helen Foster

Assorted links

Apologies for neglecting my blog recently, though glad to note I’m in good company (see sam marshall’s OU/Moodle blog).

You’ve most likely heard that we’re aiming to release Moodle 2.0 beta very soon, so we’re all trying our best to get everything done! I’ve been helping David Mudrak with the big language pack clean-up in Moodle 2.0 (MDL-15252) and am currently busy creating help strings from HTML files (see Development:Help strings).

For the non-twitter followers amongst you, here are a few links to interesting discussions on moodle.org in the past couple of weeks: a pedagogical discussion about testing, Moodle Philosophy (dating back to 2002), Ability to post anonymously, Office Add-in for Moodle (with replies from Microsoft Education Labs), Best way to share many links and Teaching moodle to teachers.

Finally, thanks to particularly helpful Moodler Mary Evans for her lovely poem Ode to Moodle Docs.


by Helen Foster at 27 April, 2010 01:44 PM

26 April, 2010

Patrick Malley

Moodle Theme Families

The deeper I delve into my work with Moodle 2.0 themes, the more impressed I am by its flexibility. Moodle 2.0 has a Base theme that includes only the most basic styles and layout. It’s designed as a starting point for all themes. However, as I realized over the weekend while working on my first 2.0 theme, this new Base theme is so basic that there is a lot of work between it and something I’d call finished.

I’m fast on a keyboard and familiar with Moodle’s selectors, and I’d estimate I logged over eight hours to get my new Boxxie theme only 80% complete. Working with the Base theme requires testing every page, block, and module from every role, setting, and browser. It’s a daunting task to say the least.

Therefore, with the help of Urs, I’m going to create a new theme family.

What this means exactly:

I’m going to create a new structural theme that uses Base as a parent. I’m then going to create all of my new themes as a child of that structural theme, cutting down the time it takes to create a theme to something much more reasonable.

Think of it this way: If coding a Moodle theme were building a house, Base is the foundation – the concrete that’s poured so your house doesn’t sink into the ground. My new structural theme is thus the frame of the house that’s built on top of that foundation to provide a place to hang your drywall, cupboards, and shelves. A child theme of this new structure is the house paint, shutters, and family pictures that you add at the end to make everything feel like it’s yours.

Thoughts?

by Patrick Malley at 26 April, 2010 08:36 PM

23 April, 2010

Sam Marshall

UK Moodle Moot 2010

Sorry, I have been totally neglecting this blog. It's so busy at work I don't have time to write entries...

Anyway, along with a bunch of other OU people, I went to the UK moodle moot last week. It was terrible! No, not the moot, but I had to get up at 07:00 one day and 06:30 the other day. It was like living in another time zone or something.

The moot was okay. I didn't like most of the keynotes. (And said so in a meeting afterwards... forgetting my boss had given one. Ooops.) But there were several interesting presentations, particularly one about how higher education institutions handle Moodle development and one about different models for funding open source development. I didn't give a presentation - I submitted a proposal but either it was rejected or they lost it. Oh well, it would only have been another boring demo of ForumNG anyhow!

More of a personal blog thing (but it's not like I'm writing this on work time)... I took my camera one day and took a few photos. I stuck the selected ones on Flickr which is where I put random collections of not very good photos... Anyway, if anyone's interested, there are 8 pictures starting here (click picture then use 'next' link at right to go through them):

Labs

The reflections in that are about the most people you'll see in any of them. I don't do pictures of people. :) But the moot was held in the University of London's Senate House building, which is a really impressive landmark building. Unfortunately, we tried, but we couldn't get to the top floor or anywhere near it... Ah well.

I'll try to do another post soon (...ish) about development work, which is of course ongoing!

by Sam Marshall at 23 April, 2010 09:38 PM

22 April, 2010

Tomaz Lasic

Serious fun in Water!

The world of water

The world of water: http://www.flickr.com/photos/snapr/484776493/

Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand.” (Chinese proverb)

At the start of this week, we opened Water! – a demo Moodle course designed to show not what Moodle can do but primarily what people can do with Moodle (while of course showing some Moodle features). Big difference between the two!

The response has been phenomenal! We got to ‘capacity crowd’ of 40 within 36 hours of me sending the first tweet about it. 40 people, mostly moodlers but not all, are happy to spend approximately two to four hours over the next few weeks and play students, most under fake names, to generate sample course data. And they seem to be really enjoying it (well, most of them at least…).

Water! is a very simple course about something that we all use and need – safe, clean, fresh drinking water. It does not require a great depth of content knowledge at all. It features just a few standard, out-of-the-box Moodle activities and it isn’t linear. Deliberately, NO knowledge of Moodle is necessary to participate – just a basic ability to click, link, upload and follow a few instructions. The only two things needed are an open mindset and imagination.

For now, Water! is there for us to gather sample data. Once we generate enough of it (posts, replies, answers, questions, attempts, submissions, comments, pictures, links etc…), we will then offer the course (together with sample data and explanation of every activity!) for free to anyone to enrol in and play in, even download for their own place of learning for people to get involved and have a play in this ready-made sandpit.

Because the Chinese proverb at the top is right on. Being a student in something first, where you get to see real examples, get to try and safely muck things up a little with others and just like others, but at the same time SEE and get ideas you could use in your own context is sorely needed in supporting our kids and educators. And not just in using Moodle either…

Now, this is the first taste of Moodle’s new educational demo site. The idea is to have courses like Water! in up to ten broad areas of learning (eg. Arts & Media, Maths, Language, Second Language, Natural Sciences etc). These courses will not go to great depth of content knowledge or technological knowledge (ie Moodle features), both of which often make things hard to understand, but to tickle that area that really makes it all go – sound pedagogical use.

I am passionate about Moodle but I am helluva lot more passionate about great teaching and learning with it.

PS. If you would like to give Moodle a try and actively participate as a ‘demo student’ in the upcoming courses similar to Water!, please head over to http://mec.moodle.net and create an account. I will register your email and send you a notice when the next course becomes open (as stated, Water! filled within 36 hours!) if you wish. NO Moodle experience necessary!


Digg This  Reddit This  Stumble Now!  Buzz This  Vote on DZone  Share on Facebook  Bookmark this on Delicious  Kick It on DotNetKicks.com  Shout it  Share on LinkedIn  Bookmark this on Technorati  Post on Twitter  Google Buzz (aka. Google Reader)  

by human at 22 April, 2010 03:59 PM

20 April, 2010

David Mudrak

Moodle development traffic 15/2010

Latest stable version 1.9.8+

There are 17 commits into the stable branch from the last week. Tim Hunt fixed a silly bug that led to bad performance problems in the grader report (MDL-22098). Andrew Davis fixed a regression in the gradebook overview report so it displays hidden items correctly now (MDL-21218). Iñaki Arenaza committed new upstream version of phpCAS library (MDL-20029).

Unstable development version 2.0dev

There are 70 commits into the main development branch from the last week. Martin Dougiamas has set-up Moodle 2.0-beta release day in HQ planning calendar to May 3rd 2010 and the team is focussing on bringing Moodle 2.0 beta down onto the runway. Hopefully the wind conditions are good for clear landing.

Quotes of the week

“What happened to ‘We will release a solid product when it is done.’ ???”
Tim Hunt thinks we should not promise any release dates

“Just 10 secs ago, by mistake, I emptied the block_instances table completely. It’s amazing how better Moodle 2.0 looks without blocks! A M A Z I N G !”
Eloy Lafuente improves the look and feel of future Moodle version

“Most of the things I put in Moodle to push my view of courses as communities have been ground down over the years.”
Martin Dougiamas stands alone against the world

The role who must not be named

While working on help files clean-up, Helen Foster re-opened an internal discussion on the “official” Moodle terminology. How should the role archetypes teacher and student be called in help and documentation? It is clear that these two do not fit everybody — for example when Moodle is used for company training. Martin hates the model these two terms promote and would prefer if Moodle highlighted course scenarios based on facilitation and moderation, instead of teaching. But it is difficult to come up with a word that would work for university and corporate as well as schools. There is an issue with using participant for students, too. As Helen noted, teachers are also participants, learning from their students so the term should be used for all users that have some role assigned in the course.
This question is not new kid on the block. We talked long and hard about this years ago and ended up having different people using different words in different places, says Martin. The point is that neither moderator nor participant are really used in common forums-speak. Folks tend to use teacher for the person who knows and student is the person that does not know, although the underlying principle of Moodle doesn’t work that way, Tomaz points.
Years have jaded me, sighs Martin. As our benevolent dictator for life, he makes an executive decision to use participants for all people with a role, teachers for people with some sort of a facilitation/editing role, students for people primarily there to learn, and users for people across the site. Dammit, everyone knows what they mean, he closes.
In the new translation interface I am currently finishing (to be available together with Moodle 2.0-beta), there is a way how to quickly filter all strings containing a given phrase. I can imagine Moodle partners offering a customized language packs for various clients (schools, universities, business) with all these keywords searched and replaced.

Post scriptum

make install && not war

by David at 20 April, 2010 09:52 PM

13 April, 2010

David Mudrak

Moodle development traffic 14/2010

Latest stable version 1.9.8+

There are 7 commits into the stable branch from the last week. Tim Hunt committed David Binney’s patch fixing a question bank SQL query at Oracle (MDL-21828). Iñaki Arenaza fixed an old issue when he committed his patches that significantly increase the quality of images produced by TeX filter. If the binaries of latex, dvips and convert are available at the system, Moodle can generate nice PNG formulas. Otherwise, “ugly” GIFs are created by mimetex (MDL-10197). Another Iñaki’s committed patch allows to use HTML editor when editing login page instructions (MDL-19053) and yet another one fixes small typo in CAS, DB and LDAP authentication plugins (MDL-18689).

Unstable development version 2.0dev

There are 160 commits at the main development branch from the last week, many of them done by Petr Škoda during the weekend strings clean-up. Patrick Malley added a new test theme called Boxxie based on his Greenie theme for Moodle 1.9. On Wed Apr 7 00:31:20 2010 UTC, the last ever run of Eloy’s installer_builder generated and committed strings for Moodle installer and was turned off. In the near feature, it will be replaced with a new script taking the data from our new strings repository called AMOS. So long installer_builder, and thanks for all the strings!

Quotes of the week

“I like git because it might actually force us to fix our sloppy/missing review processes before things hit CVS”
Petr Škoda guards the code against eager commits – get alarmed!

“NOBUG: Bombing BOM: BOM bombed”
Eloy Lafuente and his bombastic commit message

Milliseconds count

At the moment, I have 3,740,067  records (yes, 3.74 millions of records) in the new database repository of Moodle strings. The repository (basically one huge SQL table) contains one record per every modification of every single string that happened since Moodle 1.6 in any language. It takes approximately two hours to re-populate the table from our git mirrors of Moodle core and Moodle langs CVS repositories. There are some critical queries that are used quite frequently – for example to take a snapshot of the most recent string values for the given component, language and branch. That is, for example, “what is currently saved in lang/en/moodle.php at the main development branch?” (or what was there at the given timestamp). Writing this query was a big lesson for me. Not only it was actually for the first time I ever used an SQL subselect. Having so many records, the query optimising became very important as I refused to wait dozens of seconds to actually see some results (and I can imagine translators  would not be happy with such delays, too).

Basically, all Moodle strings and their history is now stored in one database table containing fields branch (integer code for Moodle branch, like 1900 representing MOODLE_19_STABLE), lang (language code like ‘es’), component (the string domain – or the file where the string is defined, like ‘forum’), stringid (the key is $string array), text (the string itself) and finally timestamp (since when the change described by this record  is valid). There are other fields defined in the table – to hold the author of the change, commit message, deletion flag and others. There is composited index created for fields  (component, language, branch).

This is the query I was using during the optimisation and performance comparison. It returns the most recent version from several branches, several languages and several components – which is exactly what I need for the new translation interface.

SELECT r.id, r.stringid, r.text, r.timemodified, r.deleted
  FROM  mdl_amos_repository r
  JOIN (SELECT branch,lang,component,stringid,
               MAX(timemodified) AS timemodified
          FROM mdl_amos_repository
         WHERE branch IN (2000,1900)
               AND lang IN ('en','cs')
               AND component IN ('moodle','workshop')
             GROUP BY  branch,lang,component,stringid) j
    ON (r.branch = j.branch
        AND r.lang =  j.lang
        AND r.component = j.component
        AND r.stringid = j.stringid
        AND  r.timemodified = j.timemodified)
  WHERE r.branch IN (2000,1900)
        AND r.lang IN ('en','cs')
        AND r.component IN ('moodle','workshop')
  ORDER BY  r.component, r.stringid, r.lang, r.branch;

The basic idea of the query is to get know (in subselect) which one is the most recent version of every string. Then (via the table self join) get some additional information about such string. I was experimenting with various variants of the query -like putting those WHERE conditions into the inner subselect or the outer main select. None of them was good enough until Petr Škoda gave me a world-saving hint: put the same WHERE conditions into both inner subselect and outer main select! The inner conditions help to filter the rows that are going to be aggregated by GROUP BY. The outer conditions help to join results quickly.

Using this, I managed to get to times like 1500ms at my laptop and 200ms at the testing server, both using PostgreSQL. First attempts to run the same query on MySQL led to significantly worse figures. I am going to do more tests to be sure that both engines have similar resources/conditions available. That massive usage of IN() is supposed to be a challenge for MySQL…

Post scriptum

I fell in love running Moodle 2.0 upgrading script via command line interface – see admin/cli/*.php scripts

by David at 13 April, 2010 09:59 PM

10 April, 2010

Helen Foster

Over 600 modules and plugins for Moodle

If you’re thinking of adding extra features to your Moodle site, you’ll most likely have taken a look in the Moodle modules and plugins database.

The modules and plugins database, “a comprehensive reference of all known Moodle modules, hacks and plugins”, was created four years ago and now contains 630 entries! The very first entry was added on 3 February 2006 and was the Database activity module itself.

Before going ahead and installing a contributed module or plugin, it’s important to take note of the following:

WARNING: Please be aware that some of these items have not been reviewed, and the quality and/or suitability for your Moodle site has not been checked. The modules here may have security problems, data-loss problems, interface problems or just plain not work. Please think carefully about maintenance before relying on contributed code in your production site, as some of this code may not work with future versions of Moodle.

(Source: modules and plugins database introduction)

Whilst the modules and plugins database allows comments and ratings, it’s clearly lacking a number of features for helping people make sensible choices about which module or plugin to install. Major improvements to the database are planned for the future (see Development:Modules and plugins improvements, MDLSITE-571 and MDLSITE-406), however the work will have to wait until after the release of Moodle 2.0.

For those of you who are twitter fans, twitter.com/moodleplugins tweets new entries to the modules and plugins database.


by Helen Foster at 10 April, 2010 10:53 AM

06 April, 2010

David Mudrak

Moodle development traffic 13/2010

Latest stable version 1.9.8+

There are 6 commits into MOODLE_19_STABLE from the last development week (from Tuesday to Monday). Tim Hunt fixed a gradebook bug occurring during repeated imports of grades that are normally pushed into the gradebook from activity modules or are calculated and can be overridden (MDL-21987). Petr Škoda fixed incorrect usage of E_ALL constants which lead to deprecation warnings in PHP 5.3 and therefore break output when generating images. Developers must use our DEBUG_xxx constants only (MDL-22006). I committed two patches that could not land at the stable branch during our recent code freeze. The first one may be useful for developers who are debugging some emailing feature in Moodle. It allows to divert all outgoing emails generated by Moodle to a single recipient (MDL-18903). The second one fixes a bug in multilang support for custom profile field labels (MDL-21845). Helen Foster (accessing CVS via command line as all real hackers do!) improved wording of a recently introduced gradebook option and added a missing help file for it (MDL-21218).

Unstable development version 2.0dev

There are 51 commits into the main development branch.

Quotes of the week

“It’s easier to say sorry than to ask permission”
Penny Leach on committing procedure

Pruning the trees of code

The spring comes to the central Europe. For gardeners, it is time to clean up the orchards and prune the apple trees (which may turn into kind of physical exercise both with and without the chain saw). For hackers, this season is perfect for cleaning up the source codes and getting rid of zombies hiding here and there. We are currently working on localization subsystem in Moodle and there was a good opportunity to remove some not-so-nice hacks and rules that were present for a long time.

If you have ever developed a plugin for Moodle 1.x, you probably know Moodle defines strings as items in an associative array, for example

$string['greeting'] = 'Hello world';

For some known reasons, there are several rules that developers must follow when adding new strings into the English language pack (and translators when editing the packages manually) at Moodle 1.x. Some of them are not much intuitive, like double quotes must be always escaped as in

$string['author'] = 'Petr \"skodak\" Skoda';

When you want to display a percentage sign, you must remember to actually type double %% to get just one:

$string['maxgrade'] = 'Max grade exceeds 100%%';

Replacing placeholders in Moodle with their values has been always done by eval(). So everybody had to properly quote all other occurrences of the dollar sign in order not to get it replaced by the real value of producing an error (or white screen of PHP death):

$string['greeting'] = 'Hello $a->firstname, how are you?';
$string['configerror'] = 'Your \$CFG->wwwroot is not correct';

As you can imagine, it was pretty easy to make a mistake. And various syntax-related mistakes were really done by developers and by translators as well.

Luckily, the format of $string[] items was significantly simplified for Moodle 2.0. The basic principle now is what you type is what you get. That means that developers no longer need to think too much about the $string syntax. In Moodle 2.x, all the following strings will be displayed as expected:

$string['author'] = 'Petr "skodak" Skoda';
$string['maxgrade'] = 'Max grade exceeds 100%';
$string['configerror'] = 'Your $CFG->wwwroot is not correct';

If the string contains a placeholder to be replaced with a value, it must be enclosed in curly brackets:

$string['foo'] = 'This {$a} will be replaced with a value';
$string['bar'] = 'This $a will be printed as a dollar sign followed by the a letter';

Good news is we no more use eval() on the whole string so it is much easier to detect and fix errors. Even better news is that all existing 1.x strings will be automatically converted into the new syntax format. The current plan is to switch to the new strings format during the next week, after we debug the new implementation of get_string() a bit and migrate all core strings into the new syntax.

by David at 06 April, 2010 09:59 PM

01 April, 2010

Helen Foster

Moodle.org turns upside down

If you’ve visited moodle.org today, you’re sure to have noticed something odd about the site. As someone (whose identity I won’t reveal!) messaged me:

Hi Helen, sorry to bother you, but I just logged in, via the Moodle.org front page and the panel on the right of the log in was, mostly, upside down. Weird! I know, I do not drink, nor do I smoke funny green cigarettes (I actually lead a singularly boring existence, apart from when I am Moodling :) ) but I am not imagining it. The blurb between the heading and the “this is not your school web site” was really upside down…

There were several reports of the problem in the Moodle Tracker (MDLSITE-895, MDLSITE-896 and MDLSITE-897), the forums (Everything upside down!! and Is the backwards text an April Fool’s day prank?) and even in Moodle Docs (Forum module revision).

As I posted on this day last year (Moodle 2.0 surprise), Moodle has a history of celebrating April Fools’ day. I hope you all had a laugh at Martin’s little trick!


by Helen Foster at 01 April, 2010 11:19 AM

Sources:  (feed) Dan Marsden   (feed) Dan Poltawski   (feed) David Mudrak   (feed) Eloy Lafuente   (feed) Helen Foster   (feed) Julian Ridden   (feed) Patrick Malley   (feed) Penny Leach   (feed) Petr Škoda   (feed) Sam Marshall   (feed) Tim Hunt   (feed) Tomaz Lasic 

Last updated: 31 July, 2010 05:20 AM (UTC)