Extension:Calendar (Barrylb)

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
Calendar

Release status: stable

Implementation Tag, Special page
Description These extensions add a <calendar/> tag and a new special page - Special:Events.
Author(s) Barrylb
MediaWiki 1.12
License Public domain
Download
Sample screenshot of the extension with fake events.

These extensions add a <calendar/> tag and a new special page - Special:Events.

You should place each event in its own article, with [[Category:Events]] and a category for the date, in the format [[Category:2006/07/13]]

You can use any article name you like, for example: [[Events/2006/07/13/Employee dinner]]

Each day on the calendar has a link to the Special:Events page to list all the events for that day. Beneath the calendar it optionally shows the next 5 upcoming events. The special page shows the events for a day or month. If you use <calendar>upcoming=off</calendar> it will not show the upcoming events part.

It is only designed to show the current month when shown on regular pages. The Special:Events page is used for the previous and next month links.

New features released August 2007:

  • Previous and next month links can now use AJAX to cycle through months without going to a separate page. Use <calendar>ajaxprevnext=on</calendar>. To combine with other options use a vertical bar - eg <calendar>ajaxprevnext=on|upcoming=off</calendar>
  • First day of the week is now Monday - you can easily change the code back to the previous default of Sunday though
  • Current day is now more visible by default
  • Various parts of the appearance are easier to change with the CSS stylesheets (highlighting weekends, current day, event days)

Contents

[edit] Usage

[edit] Adding a calendar event

Add the following to a page:

[[Category:Events]]

[[Category:2006/10/20]]

and that's it!

[edit] Adding a calendar to a page

Add the following to a page:

<calendar/>

or

<calendar>upcoming=off</calendar>

or

<calendar>calendar=off</calendar>

[edit] Calendar in Sidebar

I use this on the left column of my wiki and modified the Monobook.php file to include it.

Use the following lines in your MonoBook.php file: <div class="portlet" id="p-calendar"> <?php $this->msgWiki( 'Leftnav' ) ?> </div>. Place this just above the toolbox portlet <div class="portlet" id="p-tb">.

Then edit MediaWiki:Leftnav on your wiki and set its contents to <calendar /> or <calendar>upcoming=off</calendar> and it should work.

[edit] Files

Here are the files you need. You should place them in your extensions directory and include them in your LocalSettings.php. Add lines like

require_once("extensions/Calendar.php");
require_once("extensions/SpecialEvents.php");

Visit each of the links below and copy out the code:

  • Calendar.php
  • SpecialEvents.php
  • CSS changes - add to your site's MediaWiki:Common.css and customize to your liking (this is not the file under the skins/common directory in the file structure, but the actual MediaWiki:Common.css wiki page!)
  • Javascript code - add to your site's MediaWiki:Common.js if you want to use the AJAX feature for previous and next month links

You are welcome to contribute enhancements to these files. I release them to the public domain.

Personal tools