Extension talk:Calendar (Shane)

From mediawiki.org
Latest comment: 16 years ago by 194.25.86.194 in topic Starting day of the month
The following discussion has been transferred from Meta-Wiki.
Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).
Update. This extension has been tested on 1.5.0 and 1.6.3 and found to be working perfectly. I use it extensively. --Hansv 15:07, 25 April 2006 (UTC)Reply
Wow. I didn't even have a chance to test it yet, because I took down my own webserver. Nice! What syntax did you use? ---- Shane 17:30, 25 April 2006 (UTC)Reply
There are bugs. It only working for the current month. Updates are coming...
Should be working now. Follow the format on the main page. ---- Shane 21:23, 29 April 2006 (UTC)Reply

Styles[edit]

I installed this on my Wiki, but it looks pretty naff! You need to tell people how to get the styles the calendar uses (cal-header etc). JohanTheGhost 19:57, 1 May 2006 (UTC)Reply

Problem?[edit]

I get "Warning: call_user_func(wfCalendarExtension) [function.call-user-func]: First argument is expected to be a valid callback in C:\wiki\mediawiki\includes\Setup.php on line 327" whenever I put in the plugin. Is there something horrible and aweful I'm doing I shouldn't be, or is this a bug?

Calendar table is wrongly generated[edit]

some lines in the generated table (4th line -2nd week- to the end) don't have <tr> (but have </tr> in the end) Making it incompatible to simple browsers and XHTML. I would fix that but I dont think the autor want me changing it :P
SSPecteR, 04/05/2006

"today" is aways showd[edit]

Today is aways showed in the calendar, even if it is now the right year or month
SSPecteR, 04/05/2006

I know of the many problems.[edit]

Fix as needed. This is a very small project and it's during a time that I am moving to a new place in the world so my abialibility to work on this is very little. ---- Shane 21:05, 8 May 2006 (UTC)Reply

Demo site?[edit]

I would like to demo it before installing it. Is there a site where I can see it in action? Srumberg

Adding An Entry Error[edit]

I'm running mediawiki 1.6.8. If I click on a date to add an entry, it tries to go to the index.php page but it tells me

The requested URL /index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Screenshot[edit]

Could you please provide a screenshot of calendar working.

Additionnals lines to allow multi-language[edit]

Hello,

I have done some modifications on your extension to have differents languages on this calendar. I offer my modifications if you think that there are interresting.

I have only do french and english language possiblities. But it's very easy to add others as it's necessary. I use this function with extensions of Category:Internationalization_Extensions

1. Under the line :

$mwCalendar = new mwCalendar();

Add:

# Allows to choose appropriate language
$mwCalendar->dateLanguage();

2. Change:

var $wday_names = array("Sun","Mon","Tue","Wed","Thu","Fri","Sat");
var $wmonth_names = array("January","Febuary","March","April","May","June","July","August","September","October","November","December");

To:

var $wday_names; 
var $wmonth_names;

3. In the class 'mwCalendar', after declaration of variables for example, add the function:

/*
* Function witch allows to have differents languages for months and days
* By Sebastien C
*/
function dateLanguage ()
{
	global $wgUser;

	$lang = $wgUser->getOption('language');
			
	switch ($lang) {
	case $lang == "fr":
		$this->wday_names = array("D","L","M","M","J","V","S"); 
		$this->wmonth_names = array("Janvier","Fevrier","Mars","Avril","Mai","Juin","Juillet","Aout","Septembre","Octobre","Novembre","Decembre");
		break;
					
	case $lang == "en":
		$this->wday_names = array("S","M","T","W","T","F","S"); 
		$this->wmonth_names = array("January","February","March","April","May","June","July","August","September","October","November","December");
		break;
					
	default :
		$this->wday_names = array("S","M","T","W","T","F","S"); 
		$this->wmonth_names = array("January","February","March","April","May","June","July","August","September","October","November","December");
	}
}

Sébastien 09:48, 23 April 2007 (UTC)Reply

Starting day of the month[edit]

I have the strange problem, that every month from October 2007 on starts on Thursday. Any idea to fix it? J2w 21:46, 9 September 2007 (UTC)

Fix, simply use the original "dayOfWeek" Function

        function dayOfWeek($month,$year) 
        { 
                if ($month > 2) {
                                $month -= 2; 
                }
                else 
                { 
                                $month += 10; 
                                $year--; 
                } 
 
                $day =  ( floor((13 * $month - 1) / 5) + 
                                                $this->day + ($year % 100) + 
                                                floor(($year % 100) / 4) + 
                                                floor(($year / 100) / 4) - 2 * 
                                                floor($year / 100) + 77); 
 
                $weekday_number = (($day - 7 * floor($day / 7))); 
 
                return $weekday_number; 
  }

This one does not work

        function dayOfWeek($month,$year)
        { 
        $weekday_no = date("w", strtotime("1 ".$this->wmonth_names[$month - 1]." $year"));
        if ($weekday_no == 0) return 6;
        else return $weekday_no - 1;

194.25.86.194 13:02, 26 September 2007 (UTC)Reply