Hi,
I am experiencing some
problems with wikis related to non-ASCII characters. I have learned
the hard way how to avoid been bitten by wikis, but I think there is
a lot of space to improve the module to pro-actively avoid some user
errors. Some of these errors can be attributed directly to what I think are bugs.
First of all, the problems
I will describe below arise when using groups or student wikis, with
names in Spanish and used in group mode (either visible or separate).
Such a wiki is actually a collection of wikis, one for each
group/student. The effect I see is that some times binary files
attached to the wikipage are loaded to the server, and links
displayed in the wiki "attachment" tab. But when users try to download the files, they
get an empty file (0 bytes). I have traced this problem to an anomaly
in the name of the directory where the files are stored.
a) Storage of attached files and non-canonical chars
Wikipages store the
dirname of that directory in a field. But sometimes the actual
directory name is different. Dirname is taken from the Wiki Name. The
problem arises when you use short sentences in Spanish to name the
Wiki. For instance "Grupo de trabajo del Caso Práctico"
becomes in a directory in the moddata filesystem called "Grupo
de trabajo del Caso Práctico" (with spaces, ";"
etc. Since the string literals for the wiki-stored dirname and the
actual dirname are not identical, all internal: references will fail.
In fact, the actual dirname may be illegal. In some occasions I have
ended with dirs I couldn't remove using Moodle file-manager: I got
warnings from OS telling that such file did not exists or the
operation was invalid.
I think that the name used to create the directory to store attached files should be "cleaned" before use, just to ensure is a valid POSIX dirname string. The cleaned string should be stored back in the wiki.
For instance, if you ever visit that directory with Moodle filemanager and click "rename", automatically all spaces in the name become "_". You cannot get the original name back. But wiki mechanisms is still pointing to "Grupo de Trabajo", while directory is "Grupo _de_Trabajo": all files stored get accessible.
b) Page Name field
When the Page Name field
is not empty this string is used as the name of the wikipage, and the
name of the directory to store attachments. Using this field, you can
name the wiki whatever you want, but ensure a valid POSIX string for
dirname. Conveniently, when any single page of a wiki is created,
this field is locked and the author cannot enter it any more. This is
the right behavior to ensure the wiki always points to the right
place in filesystem.
But there is a bug for
multiple wikis, group or student wikis. If you create a page for a
particular group the Page Name becomes non-editable. If you visit the
config form the Page Name field is no longer writable. But when you
save that form, the Page Name variable is reset to the full Wiki
Name. All new pages created from that moment on will use the illegal
string. And you cannot change Page Name. That means that files
attached to those pages become inaccessible.
I think that Page Name variable should be "frozen" upon creating any page in the wiki collection. The bug arises because Page Name is not set for wikipages not yet created, apparently. So, when re-visiting config page Page Name is set to Wiki Name, and used for subsequently created pages.Perhaps, in the case of group wikis initial pages should be created by default, even with blank spaces as content.
(You may need to visit the config page while some users have not created their initial pages to correct things like a typo in wiki name/description, if you forgot to activate binary file upload, to change permissions grantes to students etc.)
c) Wiki Initial Content:
According to the help
file, if you specify a file in that field, the content of that field
becomes teh initial content of all new wikipages. I have not seen
this, never!. If I put there a file name (either a valid HTML file or
just plain text file), I still get empty (uncreated) wikipages. The
only effect I see is that the wikipage is named as the file. The
directory name for attachment storage is also teh filename. Thus, I
end with directories named "wiki1.html" or
"contenido_inicial.txt" (literal, with points and
extensions, at least these are valid POSIX file name strings).
I have observed these
behaviors with Moodle v 1.4.3+ AND 1.5 dev. Perhaps I have
misunderstood something about wiki usage, but I have the strong
feeling that there are a couple of bugs messing this up. Before
reporting it in bugtracker I would like to see if any of you can
confirm thes eare really bugs. I would appreciate advice about how to
report this more concisely.
I wonder if any one have been able to import content to a wiki by pointing to an initial file (and, supposedly, importing all other files in the same dir as other wiki pages). I will love to be able to import a collection of image files (or HTML wrappers for images) and allow groups of students to add texts to them.
TIA,
- Enrique -