If you are having problems with Blackboard to moodle read this

If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
Number of replies: 20
Alot of people are having problems where after they import a black board course into moodle, the document links come in, but the link to nothing.
 
This is because BB encodes the filenames of certain file types.
 
I wrote the attached tool to help with this, it will take on or a group of archive or export files, and then decode the filenames and re save the archive.
A couple of people have tried it out and said it works.
 
Source code is available.
 
"With this app, export your bb course.  Make a copy of the zip file!! (This app will overwrite the original zip)
Install my app
Run the application, browse to the zip file and open it.  Click go!!
 
The other way is to select a group of files then right click them go to the Send To menu and sellect "Blackboard Filename Convertor"
 
Backup the exports if they are important as it overwrites them!!
 
Also you need the .net 2.0 framework installed smile

Remember all it does is unencode the filenames that bb changes, it is not an actual course convertor smile"
Average of ratings: -
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Scott Elliott -
Andrzej,

This sounds very interesting.  I have not needed to convert a Blackboard course in awhile now (woohoo Moodle!), but if this really is a common problem, there may be a another solution to the issue to consider.  Why don't you checkout the tool that is used to actually import the Blackboard course and see about adding your feature to that?

Thanks for your contribution!

Scott
In reply to Scott Elliott

Re: If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
I did, but I am not a PHPer and had no idea what to do smile
The conversion is very simple though, so with luck some clever spark will do it smile
 
Anyone intersted, get hold of me and I will tell you how to do it lol
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Michael Schurter -
Hi, I'm a .Net/Mono and PHP developer, so I'd be interested in converting your program!  I mainly use C#, but I know enough VB.NET that I should be able to convert that as well.

You can either post a zip of your source to the forums or e-mail me.

Thanks for the great tool!
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by ag uzzo -

Source code is available...could you post a zip here or email me.

In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
Here is the algorithm.
Function HexToStringW(ByVal strhex As String) As String
        Dim b As Byte
        Dim s As String = ""
        For inttemp As Integer = 0 To strhex.Length - 2 Step 2
            b = System.Convert.ToByte(strhex.Substring(inttemp, 2), 16)
            s &= Chr(b)
        Next
        Return s
End Function
 
Basically the system searches the zip file for any file that begins with @
It then takes the rest of the file name and converts each pair of letters into a corresponding character.
It then saves it back out.
 
The exe is virus free that I know of.  Also attached is the source code.
 
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Duane Hellums -
This problem appears to be caused only when there's a space in the file name, which causes it to be uuencoded (intentionally or accidentally).  Not sure if it's on the Blackboard side of the house, or BB's embedded zip program.  Pretty silly in this day and age...  I don't think the IMS CP standard calls for uuencoding of filenames, and if it does, it should work on both ends (uudecode in the LMS).

I tried manually renaming all the items to match each other, in the .dat, .xml, and .doc file, and zip them back up.  DIDN'T WORK!

I tried copying the course in BB, saving the Word Document files with 8.3 filenames and no spaces, deleting the original files, and export the course again (rather than manipulating the resulting zip file)--DIDN'T WORK!

                 "Sorry, the requested file could not be found"

I'm about ready to give up--been looking at that same error since I got the thing running, including 8 full hours today.  If I can't import BB classes, it will be a hard sell.  I'm assuming that of all the hundreds of people that have run into this problem or worked it, nobody has found a solution?
In reply to Duane Hellums

Re: If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
I take it you have not tested the tool I have provided.
 
It does not need to be installed on the server.  You can test it on a disconnected client machine with a few archives on it. 
 
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Duane Hellums -
I've both manually and programmatically (within BB6 prior to export) ensured there are no uuencoded filenames.  I confirmed that, in the zip file and the unzipped and deployed file listings on Moodle.

While the uuencode issue is definitely a problem (I'm not asking everyone to rename their files in BB6, and prefer to not manually scrub every export), this may be a broader import issue/problem, since it doesn't work even WITH properly named files.  There's some magic missing somewhere.  Hopefully someone knows what it is, or it magically gets fixed in the next release.

I don't have any computers lying around that I care little enough about to be running unfamiliar programs on.  It's probably fine, I'm sure, but I'm not that kind of risk-taker smile

In reply to Duane Hellums

Re: If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
Must admit I had no problems after I renamed the files usign the tool.
I noticed that media files dont come accross properly though.
It would seem that the link to them is dynamic from the database and BB does not export the full path into the archive!
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Duane Hellums -
Indeed, BB is pretty unaware of Moodle, and likely will be for the foreseeable future...  If it's a linking problem on the database side, scrubbing the files from BB won't do any good.  All the BB6 exported zip files upload and deploy (unzip into the resource directory) fine, and the course structure looks alright, the links to files are what break, even for the files that aren't uuencoded (like syllabus.doc).  Problem exists regardless of same window or new window launch settings, etc. 
 
I successfully imported multiple IMS and SCORM packages.  Then again, their imsmanifest included IMS namespaces, etc.  The BB6 exported imsmanifest has BB-specific namespaces.  I'll try exporting a course consisting merely of text and html files, to see if that works.
 
By media files not coming across, do you mean stuff like .DOC?  That is the entire problem.  Does Moodle only support import of BB6 classes that don't have embedded learning objects in .DOC, .RTF, .PPT, .XLS formats, etc.?  I don't think we have any classes like that.
In reply to Duane Hellums

Re: If you are having problems with Blackboard to moodle read this

by andrzej marczewski -
No once i run the tool all docs, and xls come through fine.  The ones that seem to get lost due to how they are referenced are things like movie files or flash files.  They get linked with a variable reference in the database so the real path is not stored, just a reference to the path varaible.  This then gets put in the archive file, so you lose the resource!!
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by george zavrakas -

I have a problem i constract a Blackboard to moodle  convertor but i haven't a course from Blackboard course to check it can anyone sent anything

zavrakas@gmail.com subject:convertor

Thanks

In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Ellen Marie Murphy -
Hi Andrzej,

I'm not a sys admin so I'm not sure I understand how to use this file. Do I have the Sys Admin install it on the Blackboard server or the Moodle server? Where do I have him install it and how to I access it once it is installed.

Currently I access the Bb file through the "export course" link. Download the file and save it to my desktop. Then I use the "restore" feature of Moodle to bring the files in. At the present moment, I then go and manually fix all of the links. In other words, I go into the courses, select the edit icon for each item, look at the path it indicates (where the document is stored in Moodle--usually something like rs003344), browse to that location and select the document stored there. It's so time consuming!!!

Thanks,
Ellen
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Eric Bennett -
We were experiencing the same problem at our institution while transferring courses from Blackboard to Moodle. All of the files attached to the course were being imported to the filesystem with names like :
!4461746174656c20436f75727365204f75746c696e65.doc
but the front end was linking to the correct filename such as :
Datatel Course Outline.doc

A quick look at the filename shows that the Moodle import process was not converting the filename from a hexidecimal representation to standard text:
i.e. 44 = D
61 = a
74 = t
61 = a
(See a standard ASCII chart with hex values for further decoding)

So, I wrote a bit of quick code to convert the filenames before copying them to Moodle's data storage location. I've attached the lines of code below. Just insert them after line 80 in your 'moodlehtdocs\backup\bb\restore_bb.php' file. After doing this, you should be able to run the standard import process and your files should link up correctly.

I've also attached my restore_bb.php for reference. I should mention that we're currently running 7.1.3 and Moodle 1.9.


//this bit of code grabs all files in the directory,
//and if they start with !, performs the name conversion
if ($handle = opendir("course_files/$subdir")) {
 while ($file = readdir($handle)) {
 if(substr($file,0,1)=="!"){
 $outputfilename = "";
 $filebase = substr($file,1,strrpos($file,".")-1);
 $filenamesplit = str_split($filebase,2);
 foreach($filenamesplit as $hexvalue){
 $outputfilename .= chr(hexdec($hexvalue));
 }
 $outputfilename .= $fileext . strrchr($file,".");
 rename("course_files/$subdir/$file", "course_files/$subdir/$outputfilename");
 }
 }
 closedir($handle);
}
In reply to Eric Bennett

Re: If you are having problems with Blackboard to moodle read this

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Thanks Eric, I've filed this as MDL-15725 for evaluation. Can I have some trials/votes/confirmation that this will patch works for all BB files and should go into core?

While we're on the topic ... does anyone want to volunteer to maintain the BB import module?
In reply to Eric Bennett

Re: If you are having problems with Blackboard to moodle read this

by Carlos Villalba -
Thanks Eric that sure did it for me.
I am using 1.9 that upgraded from 1.8

Men, you're the best!


In reply to Eric Bennett

Re: If you are having problems with Blackboard to moodle read this

by Craig Douglas -
Eric,

Thanks very much for this code! It worked as expected!

One slight change would be to remove "$fileext . " on the line before rename() since it is an undeclared variable and it is not needed, I assume you moved two lines together and forgot to delete that bit. So the code now becomes:

//this bit of code grabs all files in the directory,
//and if they start with !, performs the name conversion
if ($handle = opendir("course_files/$subdir")) {
 while ($file = readdir($handle)) {
 if(substr($file,0,1)=="!"){
 $outputfilename = "";
 $filebase = substr($file,1,strrpos($file,".")-1);
 $filenamesplit = str_split($filebase,2);
 foreach($filenamesplit as $hexvalue){
 $outputfilename .= chr(hexdec($hexvalue));
 }
 $outputfilename .= strrchr($file,".");
 rename("course_files/$subdir/$file", "course_files/$subdir/$outputfilename");
 }
 }
 closedir($handle);
}


Both versions work, it's just this version doesn't give you a load of notices about undeclared variables when you try to import smile
In reply to Craig Douglas

Re: If you are having problems with Blackboard to moodle read this

by Chad Bergeron -
Thanks for the patch. I've got some large courses that did not cleanly import, exiting out of the process before the above code could kick in and clean up the files. If this happens to you, I have a small perl file you can run to do the same function from the terminal.

#!/usr/bin/perl

use strict;
use warnings;
use Cwd 'abs_path';
die "Usage: $0 dirname\n" unless @ARGV == 1;
my $startdir = shift;
fixdir(abs_path($startdir));
sub fixdir {
 my $dirname = shift;
 chdir($dirname) or die "Couldn't chdir '$dirname': $!\n";
 opendir(DIR, $dirname) or die "Couldn't open '$dirname': $!\n";
 my @fnames = grep { $_ ne "." and $_ ne ".." } readdir(DIR);
 closedir(DIR);
 my @subdirs;
 foreach my $fname (@fnames) {
 next if $fname eq "." or $fname eq "..";
 next unless $fname =~ /^\@([a-z0-9]*)(.*)/i;
 my($hexdata, $posthex) = ($1, $2);
 $hexdata =~ s/(..)/chr(hex($1))/ge;
 my $new_fname = $hexdata . $posthex;
 rename($fname, $new_fname) or warn "Couldn't rename '$fname' to '$new_fname': $!\n";
 $fname = $new_fname;
 } continue {
 push @subdirs, $fname if -d $fname;
 }
 fixdir("$dirname/$_") foreach @subdirs;
}
In reply to Eric Bennett

Re: Fix for filenames problem with Blackboard import

by Helen Foster -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Just to update anyone who is not watching MDL-15725, Dan has recently added a fix for filenames problem with Blackboard import to the latest 1.9.5+ and to HEAD. Please test the fix and provide feedback by commenting on MDL-15725. (You'll need a Moodle tracker account in order to do so.)
In reply to andrzej marczewski

Re: If you are having problems with Blackboard to moodle read this

by Bob Morris -
Has this been tested and does it work with .NET Framework 3.5?