Blogs
As I mentioned earlier, I've been working on an implementation of the Akismet spam filter for ATutor. This is now ready for download. The spam filter utilises Wordpress' Akismet spam prevention, and as such requires an Akismet API key to work properly. (My original post has some discussion on how to aquire this, including some correspondence with Akismet regarding pricing.) This means that ATutor will need to check with the Akismet servers whenever a new post is made to ensure it is legit. Should the Akismet servers be down, or the API key be invalid, or the Akismet servers return any other error, the post will be marked as not spam and allowed through the filter.
To install the spam filter, both the module and the patch needs to be installed. The patch will make some alterations to the following files:
- /include/vitals.inc.php
- /forum/new_thread.php
- /forum/delete_thread.php
- /forum/move_thread.php
The spam filter is only implemented for the forum as of yet. However, implementing it for other input forms is a rather small job and patches for this could easily be assembled following the example in forum/new_thread.php.
All new forum posts are now stored in a log that can be accessed from the administrator panel. Spam posts will be marked as such, and the administrator will have the option to clear these posts, inserting them into the forum and telling Akismet that these posts are legit (ham). The administrator also has the option to mark clean posts as spam, should which will remove them from the forum and tell Akismet that these posts are spam.
Developers, please note that the code that handles insertions of posts that are caught in the filter and are later cleared of their spam status is somewhat tangled. This is due to the way the forums handle insertions (and updates), especially with respect to post counts. If the forums in the future are rewritten/improved this code will need to be revisited.
Flowplayer is a great player for Flash video files (.flv) which we have used quite a lot the last six months, and will use a lot more in the coming months. As of ATutor 1.6.1 the media tag has improved so much that I wanted to add Flowplayer as an integrated part of the ATutor content creation process.
I've decided not to create this as a patch or module, as there are many different ways you can make use of Flowplayer in ATutor, and because we will probably improve on this integration in the future as well.
I am however describing it all in detail here, so you should be able to set this up yourself quite easily!
The first thing you have to do is download Flowplayer (this tutorial tested with version 2.2.1 of Flowplayer, but any version should work).
I unzipped and uploaded the whole folder at root level on my server, so it will always be there regardless of me upgrading ATutor or not.
The second thing you will have to do is refer to the flowplayer.min.js file in your theme's header. I'm using the Redux theme, so I edit the atutor/themes/Atutor-redux/include/header.inc.php file, and add the following within head:
<script type="text/javascript" src="/flowplayer/flashembed.min.js"></script> Note that the default path for this file in Flowplayer is /flowplayer/examples/js/flowplayer.min.js, I just moved it down a few directories.
Now, save this, and we are ready to continue. This time we first have to edit atutor/include/lib/output.inc.php to make ATutor insert the appropriate flowplayer code when wrapping a .flv file in the media tag. At around line 650, right after the 6 lines of code for the .mid format, and before the comment that reads // Executing the replace, add:
<?php
// .flv - uses Flowplayer from flowplayer.org (EXTERNAL)
preg_match_all("#\[media[0-9a-z\|]*\]http://([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[11],PREG_SET_ORDER);
$media_replace[11] ="<div id=\"flowplayerholder_##MEDIA1##\">Flash Player needed!</div>
<script type=\"text/javascript\">
// <![CDATA[
new flashembed(\"flowplayerholder_##MEDIA1##\", { src: \"http://www2.helsekompetanse.no/flowplayer/FlowPlayerLight.swf\", width: ##WIDTH##, height: ##HEIGHT## }, { config: { videoFile: \"http://##MEDIA1##.flv\", embedCode: \"can not be embedded\", initialScale: 'scale', controlsOverVideo: 'ease', loop: false, autoPlay: false } });
// ]]></script>";
// .flv - uses Flowplayer from flowplayer.org (INTERNAL)
preg_match_all("#\[media[0-9a-z\|]*\]([\w\./-]+)\.flv\[/media\]#i",$text,$media_matches[12],PREG_SET_ORDER);
$media_replace[12] ="<div id=\"flowplayerholder_##MEDIA1##\">Flash Player needed!</div>
<script type=\"text/javascript\">
// <![CDATA[
new flashembed(\"flowplayerholder_##MEDIA1##\", { src: \"http://www2.helsekompetanse.no/flowplayer/FlowPlayerLight.swf\", width: ##WIDTH##, height: ##HEIGHT## }, { config: { videoFile: \"".AT_BASE_HREF."get.php/##MEDIA1##.flv\", embedCode: \"can not be embedded\", initialScale: 'scale', controlsOverVideo: 'ease', loop: false, autoPlay: false } });
// ]]></script>";
?>(don't paste in the php start and end tag)
around 20 lines further down the code you will have to add the line
<?php
$media_input = str_replace("flowplayerholder_##MEDIA1##","flowplayerholder_".str_replace(":/","",$media[1]),$media_input);
?>so the end result is:
<?php
//replace media tags with embedded media for each media tag
$media_input = $media_replace[$i];
$media_input = str_replace("##WIDTH##","$width",$media_input);
$media_input = str_replace("##HEIGHT##","$height",$media_input);
$media_input = str_replace("flowplayerholder_##MEDIA1##","flowplayerholder_".str_replace(":/","",$media[1]),$media_input);
$media_input = str_replace("##MEDIA1##","$media[1]",$media_input);
$media_input = str_replace("##MEDIA2##","$media[2]",$media_input);
$text = str_replace($media[0],$media_input,$text);
?>This ensures that you can have more that one Flowplayer video in any content page, as they all get an unique ID.
This should add Flowplayer to ATutor, and you can test it by uploading a demo.flv file in your file manager and manually wrap it in in the media tag!
However, it's better that ATutor wraps the file in the media tag for you, and to make that happen, edit the include/html/filemanager_display.inc.php file. At around line 350 here you will see:
<?php
else if (ext == "mpg" || ext == "avi" || ext == "wmv" || ext == "mov" || ext == "swf" || ext == "mp3" || ext == "wav" || ext == "ogg" || ext == "mid") ;
?>which basically tells the filemanager to wrap the extensions listed in the media tag. Here we have to add .flv as one of these extensions, so simply add || ext == "flv" here. The end result should be something like:
<?php
else if (ext == "mpg" || ext == "avi" || ext == "wmv" || ext == "mov" || ext == "swf" || ext == "mp3" || ext == "wav" || ext == "ogg" || ext == "mid" || ext == "flv") ;
?>Assuming that you have done this, uploaded a .flv file called ubuntucast.flv to your course file manageer and clicked "insert", you would see this in your content editor:
[media]ubuntucast.flv[/media]
Assuming you wish this to display in 550 x 400 pixels rather than the default 425 x 350, you would edit this into the media tag, like:
[media|550|400]ubuntucast.flv[/media]
..and the video would show up like this in the content:
Note that this file is 22 Mb, so let me know if you cannot see it. Also note that in this example I have removed the embedCode: \"can not be embedded\", from output.inc.php, just to demonstrate how you can use Flowplayer to embed videos in other pages! (Hat tip: check the bottom right icon).
Or, check it out in an ATutor content page!
Further configuration of Flowplayer
Flowplayer is highly configurable, for instance you edit the look and feel by simply configuring which parameters to add in output.inc.php. Above I chose to have the controls over the video to start, and auto hide them by adding controlsOverVideo: 'ease' to the file. In addition there are tons of other options, including integration with streaming server and using playlists etc.
Enjoy!
Edit by Håvard Pedersen jan 09: Added support for playing flv files from external domains.

Add subscription icons to the forum subscribe / unsubscribe link
July 14, 2008 - 12:30 — Vegard A. JohansenSome time ago we added a small modification to the forum listings in ATutor, which adds a small visual cue to whether you are subscribed to a forum or not.
It's best explained by example. This is the way forums look by default:

While you see the "Subscribe" / "Unsubscribe" text, it's not very easy to see which you are subscribed to and which not at a glance.
Our modification changes this listing to:
![]()
..so there's a small envelope showing if you are not subscribed, and a stop sign if you are. It's a detail, but has proved to be quite useful - have a look at our demo server! (note: you have to be registered and enrolled to see it).
Today I made this as a patch so yo can add it yourself. The patch changes the forum/list.php and adds the two small icons to the same folder.
Finally we have our own demo server up! We will use this primarily to test our own features, modifications and themes, and also to have an additional place to show off ATutor!

As of now there are two demo courses available, the first is the Look at me, I'm a course! course where you can check out the very cool directory improvements that Gorzan made! (Note, you will have to register at the platform to see this).
In this course there is also the testing the test features tests, which is a small test where all question possibilities in ATutor is added.
The other course is Module 3 of the Medical Peace Work course that we made. Note that it's only used for demonstration features here, so see medicalpeacework.org if you wish to take the whole course. I've added this course as it has a distinct look and feel, and uses the "banner" feature on the front page, which the "look and me" course does not.
Please register on the demo server, and enroll in the courses! As of now we have not created an open demo account, nor an open instructor account, as this can be used at the official ATutor demo site. If you'd like this, or have any other comments, comment away, either in the blog comments here, or in the forums at the demo server!
TinyMCE, the default visual HTML editor in ATutor, has a nice feature that lets you add custom styles to your content from a drop down menu. Only problem is that there are no styles to choose from by default in ATutor.
Today I needed that feature, and had to find out how to add some styles here, and after poking around a bit I found that there are two possibilities:
The first is finding the /atutor/jscripts/tiny_mce/themes/advanced/skins/default/content.css file, and add styles there. I didn't really like this solution.
The second solution is a tiny bit more complicated, but suited my need better. You will first have to edit the atutor/include/lib/tinymce.inc.php:
Around line 58 you will see something like this:
echo 'theme : "advanced",
relative_urls : true,
content_css:"/atutor/themes/Atutor-redux/tinystyles.css",
convert_urls : true,What I added here is the:
content_css:"/atutor/themes/Atutor-redux/tinystyles.css",..where the path is the path to the CSS file you wish TinyMCE to use. I placed a file called tinystyles.css in my themes folder.
The second step is making this file available in your theme as well, so the browser can read the styles, and not only TinyMCE. Simply add the line:
<link rel="stylesheet" href="/atutor/themes/Atutor-redux/tinystyles.css" type="text/css" />
to your themes' header.inc.php file, along with the other CSS files.
The result is the following:

One important note: In Firefox, and possibly other browsers, you have to clear your browser cache to see the changes you do. Click tools -> Clear private data, and select cache
Allthough you can argue that each user should always choose for himself / herself which media player to use to play sound and video files over the web, this has several downsides too.
One downside is that it's hard to include a player you don't know the apperance of in your content design, and another (more important) downside is that many users does not have any media players set up on their computers. So they will be asked to configure iTunes / Windows Media Player / whatever just to listen to one small embedded file.
So, we created a patch that changes the way the media tag in ATutor works. If you add a mp3 file to your content with the media tag, this will open in a nice and small embedded Flash player created by 1 Pixel Out, and available under a generous Creative Commons license.
The patch changes include/lib/output.inc.php and themes/default/include/header.inc.php, adds a javascript file to jscripts and a .swf file to include.
It looks like this:
Thanks to Bob Dylan for letting us use one of his nicest songs to demonstrate this! Ahm.
For those wishing to install this without the patch, say to have the player files located outside the ATutor installation, here's how output.lib.php looks now:
<?php
// .mp3 flash player added by patch
preg_match_all("#\[media[0-9a-z\|]*\](.+[^\s\"]+).mp3\[/media\]#i",$text,$media_matches[7],PREG_SET_ORDER);
$media_replace[7] = "<object type=\"application/x-shockwave-flash\" data=\"".AT_BASE_HREF.AT_INCLUDE_PATH."player.swf\" id=\"audioplayer1\" height=\"24\" width=\"200\"><param name=\"movie\" value=\"".AT_BASE_HREF.AT_INCLUDE_PATH."player.swf\"><param name=\"FlashVars\" value=\"playerID=1&soundFile=##MEDIA1##.mp3\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"false\"><param name=\"wmode\" value=\"transparent\"></object>";
?>Change the data and value references to your liking, manually upload the javascript file and refer to it from your theme.
Or, just run the patch!
Subscribe to announcement newsfeed
I've been chanting about this announcement subscription hack of mine on the official forums for the better part of six months now. Why? Because I never could get this quite simple thing to install as it should on our production server, and when it finally did, it didn't work properly. However, after the introduction of the Patcher (thanks to Cindy) I revisited this once again, and it now seems to both install and function flawlessly. I've made the announcement subscription hack available as a patch which is ready to install on 1.6.1.
What this patch does is give members the option to subscribe to the announcement newsfeed in courses they are enrolled in, and then email them whenever a new announcement is made, much like the very similar functionality in the forums. The mail that is sent out uses the format_content() function in ATutor to parse HTML if the announcement contains any.
The patch automatically fixes the index.tmpl.php file in the default theme, and the newest ATutor-redux theme already has its index.tmpl.php file set up to handle this patch, but if you use a different theme you will need to add a few lines to this file:
<?php
if (file_exists(AT_INCLUDE_PATH."../editor/news_subscribe.php")){
$sql = "SELECT subscribe FROM ".TABLE_PREFIX."courses_members_subscription WHERE member_id=".$_SESSION['member_id']." AND course_id=".$_SESSION['course_id']." LIMIT 1";
$subscribed = mysql_fetch_assoc(mysql_query($sql));
if ($subscribed['subscribe']=="1"){
$sub_href = "../editor/news_subscribe.php?a=unsubscribe";
$sub_button = _AT('announcement_subscription_unsubscribe');
} else {
$sub_href = "../editor/news_subscribe.php?a=subscribe";
$sub_button = _AT('announcement_subscription_subscribe');
}
echo "<a href=$sub_href>$sub_button</a>";
}
?>Just insert this block where you want the button to appear.
New and improved directory
Responding to feedback from both users and superusers here at NST, I've created a new and improved member directory, also available as a patch for 1.6.1. I ended up tossing the old filter functions out the window and replacing them with a search bar which responds to usernames, first-, second,- and last names, phone numbers, group titles, and email adresses if these are set to public. The search bar uses ajax to display the results so everything looks very sleek and sezzy, but there is also a search button should javascript be disabled.
The new directory introduces two new javascripts, two new template files and a completely rewritten directory.php. One of the javascripts (xmlhttp.js) could be of some future interest, as this is where the XMLhttpObject is created and handled, and thus could be used for more ajax functionality should this be desired. Its found in /jscripts/ and is included by the new template files. The template files are only included into the default template, but since they don't already exist they should then be automagically be included in any templates where they aren't present. I encourage theme-makers to have a look-see at the theme files (directory.tmpl.php and directory.search.tmpl.php) because there is no doubt in my mind that they can still be improved upon, and I've left some explainatory comments in there so it shouldn't be very hard to understand. In fact, we're already planning some minor changes to go with the ATutor-redux theme.
Oh, and yes, both of these patches will of course be installed on our demo install of ATutor once we get that up and running :)
The updated ATutor Redux theme for 1.6.1 is now available for download! Please note that the Redux theme for 1.6 will not work on 1.6.1, so you need this update!
We have created a dedicated page for our theme work where you always will be able to find the latest version of the theme, as well as provide feedback on what you like and dislike about it.
The Redux theme is also the basis for this blog, which is based on Drupal, and we will have a demo site of Atutor with the theme up and running shortly!
Changelog for 1.6.1
- Qstats is now a part of ATutor 1.6.1 so all theme files under test_questions are removed, as well as a few other redundant files.
login.tmpl.phpis updated to work with the new password encryption method in 1.6.1- If the patch for announcement subscribe (watch this space in the coming days!) is installed, this will work in the theme.
Greg from ATRC just sent out the following mail, announcing ATutor 1.6.1! Get it while it's hot.
ATutor 1.6.1 is now available. ATutor users should upgrade their systems to take advantage of a number of security upgrades as well as a variety of new features.
New Features in ATutor 1.6.1
Patcher: Available as an addon module for version 1.6, the Patcher module has been integrated into ATutor as a standard module. Patcher allows administrators to update their systems with new features and patches issued at update.atutor.ca in between releases. It also allows developers to create patches for new features etc. that can easily be merged into ATutor to become a permanent part of the public source code, or to maintaining custom proprietary features across versions of ATutor. (Thanks in part to The Royal Danish Defense College)
WCAG 2.0 Conformance: The default theme has been updated to conform with the recently released WCAG 2.0 accessibility guidelines. Primary adjustments include the addition of fieldsets to group related form fields, and focus highlighting to make it easier to see where the cursor is located when navigating through ATutor using a keyboard. (see http://www.w3.org/TR/WCAG20/)
TinyMCE Editor Update: TinyMCE (the ATutor Visual Editor) has been updated to version 3.0.8, and that annoying conversion of saved content to a blob of text has now been resolved. TinyMCE also now preloads when the content editor is opened, so it is possible to switch between the text editor and visual editor without having to reload the page.
Custom HEAD for Content Pages: Content authors can now include custom HTML HEAD information with content pages, so custom styles or scripts, or references to styles or scripts, can be included to control the look and/or functionality of content. Includes added support for eXe created content, maintaining styles and scripting in content packages generated by the content authoring tool.
Fluid Theme: A new experimental version of the default theme has been added that integrates the Fluid libraries, allowing users to drag-and-drop interface components to a new location on the screen to suit their preferences (e.g. drag the menu from the left to right side). See the Fluid project at http://www.fluidproject.org) (Thanks to the Andrew W. Mellon Foundation)
Password Encryption: In addition to administrator password encryption added in 1.6, all users passwords are now encrypted
Media Tag Parameters: the [media] tag can now take height and width parameters to customize the size in which media displays. It also allows YouTube videos in languages other than English.
Pretty URLs: Administrators can enable Pretty URL to replace various URL variables with a more readable form, which search engines can now index so course content can be searched from Google etc.. Instructors can also define a course directory which gets added to the URL while in a course. Apache mod_rewrite can also be turned on to pretty URLs further. (Thanks to the Norwegian Centre for Telemedicine)
Auto Login and Enroll: After registering, new users are automatically logged into My Start Page. Administrators can set an enrolment trigger. When a new user follows the trigger link, they are automatically enrolled in the courses associated with the trigger when they register, creating one step registration and enrolment. (Thanks to the Norwegian Centre for Telemedicine)
Test Pass/Fail Feedback: Define a pass score for a test, and feedback for passed and failed attempts, and have the appropriate feedback displayed automatically when a student views their test results. (Thanks to The Royal Danish Defence College)
Resume Test Feature: Students can return to a test they started previously, and continue from where they left off.
New Modules
Gradebook: The long awaited ATutor Gradebook is now available as an addon module for ATutor 1.6.1. The Gradebook allows instructors to add ATutor tests and assignment, as well as external tests and assignment, combine data from multiple tests into a single Gradebook entry, export gradebook data, and filter data and generate printable reports. Students can review their marks from their personal Gradebook. The Gradebook module will become a standard module the next ATutor release. (Thanks to the Andrew W. Mellon Foundation)
EPortfolio: A module that integrates the Mahara ePortfolio application (http:/www.mahara.org) is now available for ATutor. Mahara is an open source e-portfolio, weblog, resume builder and social networking system, connecting users and creating online learner communities. Mahara is designed to provide users with the tools to demonstrate their life-long learning, skills and development over time to selected audiences.
OpenMeetings: This modules allow administrators to integrate the OpenMeetings (http://openmeetings.googlecode.com) software into ATutor, which provides synchronous audio/video/whiteboard/application-sharing capabilities to courses, and to groups within courses.
Google Talk: Adds instant messaging to ATutor for live chats (http://www.google.com/talk/)
Google Calendar Module: Users can integrate their personal Google Calendar into ATutor.(http://www.google.com/calendar/)
Certificate Module: Based on a pass score on a test, automatically issue students a certificate. (Thanks to the Fraser Health Authority, Vancouver)
Forum Archive Module: Instructors can export forums from finished courses as an HTML archive.
Translation
There are approximately 70 new language items added in this version of ATutor. Translators should login to MyATutor to update the languages they are maintaining.
MyATutor Translation
http://www.atutor.ca/my/

ATutor and canned meat products sold by the Hormel Foods Corporation since 1937
July 2, 2008 - 10:15 — gorzanSo, we've been worried about spam for a while now. Admittedly, ATutor is no phpBB, but it does have forum functionality as well as other user input areas. ATutor user account registration has no Captcha and no email confirmation, so when the spammers do decide to hit, they won't have to work very hard to ruin the system. Making restrictions on the registration process isn't really compatible with the way we wish to use ATutor either, so we figured the best thing to do is install a proper spam filter. Which is what I'm working on this week.
Having checked around a bit, we decided to use Akismet, which is the spam filter developed for WordPress. Vegard has been using it on his wordpress account for a while and says it seems to work very well, and having checked the stats and read the reviews I'm inclined to believe him. There are already Akismet implementations for a number of systems, so what I'm doing is just adapting the PHP 4 Akismet class for ATutor.
What the Akismet plugin does, really, is just provide a function which checks your comment against the Akismet servers and returns true or false (spam or not spam). Since all spam filters inevitably are wrong every now and then, however, I also have to store all comments in a backlog so that the administrator can override Akismet's decision and allow a comment that has been marked as spam (while also letting the Akismet servers know that this isn't spam, and by doing so improving the filter) or marking a spam comment that found its way through the filter as spam (again letting the Akismet servers know).
I'm implementing this as a ATutor Module, (although it'll also require a patch to be run, I'll post the installation instructions when I'm done) and using it will require an Akismet API Key, which is free if you use Akismet for your personal blog, but not for commercial use. The Akismet payment plan is based on Akismet being used as a spam filter in a blog and as such doesn't really apply very well to ATutor, so we're currently trying to work out a good solution with the Akismet people. As most ATutor users will most likely find themselves in a similar situation, I'll make sure to post the results of this dialogue here as well as the module.
I'll post everything here when it's done.