At the same time, I am going to change the disabled pop-up to an enabled one, to avoid the whole double-negative thing. Would that cause any problems I have not thought about?
Whatever you do, please could you avoid in the dropdown lists the IMHO illogical US style of date: month/day/year as shown in this screenshot from the YUI example? Can we have instead the more reasonable day/month/year usage as we have in Europe or the "computer" usage of year/month/day?
Thanks in advance,
Joseph
PS.- Sorry if my remark makes you go screaming at internationalisation issues.
Mike
I think the date formats are already catered for to an extent with:
$string['strftimedate'] = '%%d %%B %%Y';
but I do agree that the US time format is daft. How about a 25-Jan-09 format? Then even if it's Jan-25-09 at least there's no confusion.
Yes, seconding what is said by Joseph, i'd suggest that the dropdown uses a string from the lang packs (an existing one in langconfig.php would b a good candidate) to get its format, or alternatively to use for this purpose a (new) setting in Admin > Location > Location settings.
Cheers, Nicolas
@ Tim: I just updated my moodle 2.0 installation and there seems to be a bug in the open/close settings of all modules; the month dropdown list is empty (see attached screenshot). I expect this is due to the new introduction of the popup calendar not being quite finalised.
Joseph
So please could you do some debugging to try to work out what is going on, because it seems strange to me. Do dates appear OK elsewhere. (I know how can you check dates elsewhere if you cannot input them )
The problem is not with the popup calendar but months' names are NOT displayed anywhere in moodle when using English language. They are displayed in other languages OK. (see attached)
Weird,
Joseph
> Note that Moodle uses operating system locales to generate dates. Perhaps your computer does not have the English locale installed?
Tim, is this something new (and quite recent) in Moodle 2.0? I thought we had completely done away with all the problems caused by having to set "locales" in Moodle installations. I still do not undertand what "system locales" are and where on earth they are located on my computer... Anyway, here I can read:
Administration ► Language ► Language settings
Sitewide localelocale Default: Empty
Choose a sitewide locale - this will override the format and language of dates for all language packs (though names of days in calendar are not affected). You need to have this locale data installed on your operating system (eg for linux en_US.UTF-8 or es_ES.UTF-8). In most cases this field should be left blank.
I always leave this field blank on my (local) Windows install and everyting works fine. And why would I have to have English locale (whatever that is, again) installed on my French computer?
Sorry to insist but the "English months not displayed" bug I reported in my previous post really looks like a very recently introduced bug in moodle 2.0. Thanks for keeping me posted...
Joseph
Hi Joseph,
Just for info: I'm afraid I can't reproduce the behaviour you're describing on my Moodle 2.0dev: the month's names are displayed in english, as well as in other languages.
Do you have the most recently updated moodle 2.0 on your machine? The problem I report developed quite recently, and I regularly update my moodle 2.0 on my local machine. It is really weird an un-explainable.
Joseph
I have finally found the culprit. The bug only occurs in Windows. File lib/moodlelib.php, around line 1340 we have this:
if ($CFG->ostype == 'WINDOWS') {
if ($localewincharset = get_string('localewincharset')) {
$textlib = textlib_get_instance();
$datestring = $textlib->convert($datestring, $localewincharset, 'utf-8');
}
}
However, in lang file lang/en_utf8/langconfig.php, we have this line:$string['localewincharset'] = '';
It so happens that this string is the only empty string in moodle lang files...
In previous moode versions, the line
if ($localewincharset = get_string('localewincharset')) {
returned an empty string, hence the condition was not met and the current $datestring was not transformed.But, in moodle 2.0 maybe the get_string function has changed somewhere and
if ($localewincharset = get_string('localewincharset')) {
now returns a value of [ [ localewincharset ] ] for the variable localwincharse, hence the condition is met, but of course the transformation fails, hence the bug of months not being displayed. QED.Joseph
As a matter of fact, I'm wondering if that test is really any use. Whichever (European) language I am using I am finding that the Windows $datestring conversion is not needed. Are you sure it could not be dropped from the code?
Joseph
I forgot to say in my last post, thank you very much for finding the cause. You probably saved me hours of debugging.
Joseph
PS.- It did take me a few hours to track down that bug!
In our daily talk if I ask you "When were you born?" I expect you reply me with three information: a day, a month and an year.
If I ask you "When did you start to use Moodle?" I don't expect a day but only an answer with a month and an year or, at least, with the year only.
It shuld be fine if the developer could format the date field in mform in order to request a complete date or a "partial" date with only month and year.
Mike
Can you point me to where in the code you did this? I was looking in 'lib/form/dateselector.php', but I can't see anything in there that does this.
mike
Re: Changes to the formslib date selector
I don't know if this is the right place to ask, but is there a method I can use to have a date selector on the settings.php file of my module?.
I know I can use admin_setting_configselect(), but I haven't seen something like admin_setting_configdate_selector().
Thanks.
Re: Changes to the formslib date selector
Making a new subclass of admin_setting is pretty easy. In this case, the trick would be to output exactly the same HTML as a date selector in a formslib form. Then you could use exactly the same JavaScript code to make it flashy.