Calendar extension
From Tech
Contents |
[edit] License
GPL.
[edit] Usage
The Calendar extension implements the following functions:
- calendar: Creats a table showing the monthly calendar.
- Example for application:
{{#calendar:
| title= Table header. Instead of a missing title the month and year are shown.
| prevLink= Text or link with the meaning of "previous". The text can contain place-holders.
| nextLink= Text or link with the meaning of "next". The text can contain place-holders.
| month= month to show. Possible values are 1 through 12. A missing month is substituted by the current month.
| year= year to show. A missing year is substituted by the current year.
Possible values are between 1970 and 2038.
| offset= offset to the given month/year in months.
| lang= Language of days and months names. Supported language codes are 'user' (user language) or
'content' (content language; default).
| highlightedDays= Highlighted days in addition to the current day. Values are separated by spaces.
| start= first day of week. Possible values are 0 (sundays) and 1 (mondays).
| position= defines additional floating. Possible values are (nothing), left, right and center
(case insensitive)
| 1= to 31= For every day a link can be specified
| titleLink= Link to the title. The link can contain place-holders. Do not use link parentheses.
| generalLinks= Identical links to all days. The links can contain place-holders. Do not use link parentheses.
generalLinks is overwritten by the options 1= to 31=
| dayCharsCount= maximum numbers of characters for weekday names
| monthCharsCount= maximum numbers of characters for month names
| tableWidth= width of the table. 'none' means no definition, 'default' the default width of 20em
You can also specify other CSS values like 50%, 300px or 30em.
| showToday= specify the highlightings of the today's day. 'true' is default.
'false' prevents highlighting
}}
- Place-holders for links:
$a - abbreviated weekday name $A - full weekday name $b - abbreviated month name $B - full month name $d - day of the month, range 01 to 31 $D - day of the month, range 1 to 31 $e - day of the month, range ' 1' to '31' $m - month as a decimal number, range 01 to 12 $M - next month as a decimal number, range 01 to 12 $n - abbreviated month name of the next month $N - full month name of the next month $o - year of the next month as a decimal number without a century, range 00 to 99 $O - year of the next month as a decimal number including the century $p - abbreviated month name of the previous month $P - full month name of the previous month $q - year of the previous month as a decimal number without a century, range 00 to 99 $Q - year of the previous month as a decimal number including the century $R - previous month as a decimal number, range 01 to 12 $y - year as a decimal number without a century, range 00 to 99 $Y - year as a decimal number including the century $% - Dollar sign (use it if necessary)
[edit] Installing Calendar
Download the Calendar extension from the SVN repository.
Copy Calendar.php and Calendar.css into the Calendar folder in the extensions folder of your MediaWiki installation. Then add the following line to your LocalSettings.php file (near the end):
require_once( "$IP/extensions/Calendar/Calendar.php" );
[edit] Used style classes
| November 2008 | ||||||
| Mon | Tue | Wed | Thu | Fri | Sat | Sun |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
In the Calendar directory you will find the file Calendar.css. It can be overwritten in Common.css or Monobook.css.
- class="calendar" -- for the table as a whole
- class="calLeft" -- left floating
- class="calRight" -- right floating
- class="prevNext" -- for previous and next links
- class="calTitle" -- for the table header
- class="sundays" -- highlighting for sundays
- class="today" -- highlighting for the date of today
- class="highlighted" -- additional highlighted dates
[edit] Style sheet source code
/* * Stylesheet for the Calendar extension * * @package MediaWiki * @subpackage Extensions * @author Roland Unger * @copyright © 2007 Roland Unger * @licence GNU General Public Licence 2.0 or later */ .calendar { text-align: center; background-color: #f5faff; border: 2px solid #cedff2; } .calWidth { width: 20em; } .calLeft { clear: left; float: left; margin: 0 1em 1em 0; } .calRight { clear: right; float: right; margin: 0 0 1em 1em; } .calCenter { margin: 0 auto; } .calendar .prevNext { background-color: #cedff2; } .calendar .calTitle { background-color: #cedff2; font-weight: bold; } .calendar td { color: #000; } .calendar .sundays { color: #ff0000; } .calendar .today { color: #7cfc00; } .calendar .highlighted { color: #ffa500; }
[edit] Known Problems
It is not possible to convert non-ASCII characters in month names to upper case characters. ucfirst() works only with ASCII characters but not with other Unicode characters.

