User:Hoggwild5/Calendar Class for MediaWiki

From mediawiki.org

Here's a link to Calendar.tar, which contains the following files:

  • /images/cal.gif -- a calendar icon file
  • Calendar.class.php -- the MediaWiki class file for the Calendar class
  • datetimepicker.js -- the javascript file for the popup calendar
  • rfnet.css -- the .css file used for formatting the popup calendar

The .css and .js files need to be added to your MediaWiki skins file.

The Calendar.class.php can be saved in /extensions/Calendar/Calendar.class.php, and script needs to be added to $wgAutoloadClasses like so:

$wgAutoloadClasses['Calendar'] = 'extensions/ProjectWiki/simplecalendar/Calendar.class.php';

The following global variables are also used with the calendar, and need to be set in LocalSettings.php:

  • $wgCalendarImagePath
  • $wgCalendarMondayFirst
  • $wgCalendarDateSeparator
  • $wgCalendarShowFullMonth
  • $wgCalendarShowMonthYearinHeading
  • $wgCalendarWeekdayChars
  • $wgCalendarLeadingZeros
  • $wgCalendarBgTheme

These settings are as follows:

  • $wgCalendarImagePath: the location of the calendar image file to use as a clickable calendar icon in your form **
  • $wgCalendarMondayFirst: setting this to true will create a popup calendar with Monday shown as the first day of the week; a setting of false will use Sunday as the first day
  • $wgCalendarDateSeparator: configures the character used to separate the month,day,year of the calendar
  • $wgCalendarShowMonthYearinHeading: turns the display of the month and year on or off in the calendar heading
  • $wgCalendarShowFullMonth: setting this to true displays the full month name in the calendar header; false displays the abbreviated name
  • $wgWeekdayChars: the number of characters to display for the days in the calendar (Ex: 1 displays S M T W T F S, 2 displays Su Mo Tu We Th Fr Sa)
  • $wgCalendarLeadingZeros: setting this to true will add leading zeros to months less than 10, and days less than 10.
  • $wgCalendarBgTheme: the location of an image file to use as the background for the calendar (optional).
    • note: this is for an image icon of a calendar to include as a clickable link on your custom form. There are a number of calendar icons available on the internet; I use one that is publicly available, that is approximately 16px square. If you can't locate one, the author of the javascript calendar has one in his calendar download file, located at www.rainforestnet.com.