Moodle

Adding weekdays to moodleform date and date_time elements

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.1
  • Fix Version/s: None
  • Component/s: Forms Library
  • Labels:
    None
  • Environment:
    Should be universal (I've tested the JS on ie6,ff3,opera9.61 and safari3.1.2
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE

Description

Adds 3 letter day abbrieviations to the options in the day <select>. They are recalculated whenever the month or year is changed.

Not quite perfect in that if javascript isn't enabled the user will be left with the days of the week for only the current month/year but this doesn't stop data entry, just might confuse people

Activity

Hide
Mike Worth added a comment -

Have now partially rewritten it so that:

If javascript is not enabled, no weekday abbreviations are added at all
On page load all dateselectors and datetimeselectors have the right days added
The day lists only show enough days for the length of the month (ie november doesn't give 31st as an option), if javascript is disabled 31 are always shown

Attached is the new versions of dateselsector and datetimeselector plus a new weekdays.js file, all to go in lib/form

Show
Mike Worth added a comment - Have now partially rewritten it so that: If javascript is not enabled, no weekday abbreviations are added at all On page load all dateselectors and datetimeselectors have the right days added The day lists only show enough days for the length of the month (ie november doesn't give 31st as an option), if javascript is disabled 31 are always shown Attached is the new versions of dateselsector and datetimeselector plus a new weekdays.js file, all to go in lib/form
Hide
Mike Worth added a comment -

Just a very minor change- used the yui_yahoo and yui_event magic words instead of full paths; still works exactly the same as before

Show
Mike Worth added a comment - Just a very minor change- used the yui_yahoo and yui_event magic words instead of full paths; still works exactly the same as before
Hide
Mike Worth added a comment -

Now looks up the days of the week with get_string(), it gets the string from the calendar lang file but I assume that I can work with the assumption that it will always be there?

I've had to rename weekdaays.js to weekdays.js.php so that the php interpreter will process it, is this OK or will it cause problems somewhere?

Show
Mike Worth added a comment - Now looks up the days of the week with get_string(), it gets the string from the calendar lang file but I assume that I can work with the assumption that it will always be there? I've had to rename weekdaays.js to weekdays.js.php so that the php interpreter will process it, is this OK or will it cause problems somewhere?
Hide
Mike Worth added a comment -

I've got round to creating a proper patch file; find attached.

Show
Mike Worth added a comment - I've got round to creating a proper patch file; find attached.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: