Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated fullcalendar and added list views #384

Merged
merged 1 commit into from
Mar 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion Resources.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
'sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat',
'srf-ui-eventcalendar-label-today', 'srf-ui-eventcalendar-label-month',
'srf-ui-eventcalendar-label-week', 'srf-ui-eventcalendar-label-day',
'srf-ui-eventcalendar-label-listmonth', 'srf-ui-eventcalendar-label-listweek',
'srf-ui-eventcalendar-label-listday',
'srf-ui-eventcalendar-label-allday', 'srf-ui-eventcalendar-format-time',
'srf-ui-eventcalendar-format-time-agenda', 'srf-ui-eventcalendar-format-axis',
'srf-ui-eventcalendar-format-title-month', 'srf-ui-eventcalendar-format-title-week',
Expand Down Expand Up @@ -712,7 +714,10 @@

// fullCalendar
'ext.jquery.fullcalendar' => $moduleTemplate + [
'scripts' => 'resources/jquery/fullcalendar/fullcalendar.js',
'scripts' => [
'resources/jquery/fullcalendar/moment.js',
'resources/jquery/fullcalendar/fullcalendar.js'
],
'styles' => 'resources/jquery/fullcalendar/fullcalendar.css',
// If you have MW 1.20+ the definitions below will work but not for earlier
// MW installations
Expand Down
6 changes: 5 additions & 1 deletion formats/calendar/EventCalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,13 @@ public function getParamDefinitions( array $definitions ) {
$params['defaultview'] = [
'message' => 'srf-paramdesc-calendardefaultview',
'default' => 'month',
'values' => [ 'month', 'basicweek', 'basicday', 'agendaweek', 'agendaday' ]
'values' => [ 'month', 'basicweek', 'basicday', 'agendaweek', 'agendaday', 'listDay', 'listWeek', 'listMonth' ]
];

$params['views'] = [
'message' => 'srf-paramdesc-calendarviews',
'default' => 'month,basicWeek,agendaDay'
];
$params['firstday'] = [
'message' => 'srf-paramdesc-calendarfirstday',
'default' => 'Sunday',
Expand Down
30 changes: 24 additions & 6 deletions formats/calendar/resources/ext.srf.formats.eventcalendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@
that.theme = data.query.ask.parameters.theme === 'vector' ? 'ui' : 'fc';

that.defaultView = data.query.ask.parameters.defaultview.replace('day', 'Day').replace( 'week', 'Week' );
that.view = 'month,' + ( that.defaultView.indexOf( 'Week' ) === -1 ? 'basicWeek' : that.defaultView ) + ',' + ( that.defaultView.indexOf( 'Day' ) === -1 ? 'agendaDay' : that.defaultView );

that.view = data.query.ask.parameters.views;
that.firstday = $.inArray( data.query.ask.parameters.firstday, weekDay );

// Set calendar start
Expand Down Expand Up @@ -393,7 +393,10 @@
today: mw.msg( 'srf-ui-eventcalendar-label-today' ),
month: mw.msg( 'srf-ui-eventcalendar-label-month' ),
week: mw.msg( 'srf-ui-eventcalendar-label-week' ),
day: mw.msg( 'srf-ui-eventcalendar-label-day' )
day: mw.msg( 'srf-ui-eventcalendar-label-day' ),
listMonth: mw.msg( 'srf-ui-eventcalendar-label-listmonth' ),
listWeek: mw.msg( 'srf-ui-eventcalendar-label-listweek' ),
listDay: mw.msg( 'srf-ui-eventcalendar-label-listday' )
},
allDayText : mw.msg( 'srf-ui-eventcalendar-label-allday' ),
timeFormat : {
Expand Down Expand Up @@ -457,7 +460,10 @@
*/
fullCalendar: function( context, container, data ){
var self = this;

var holidays = [];
if ( typeof( self.defaults.holiday ) != 'undefined' ) {
holidays = self.defaults.holiday;
}
return {
/**
* Get the calendar rolling
Expand All @@ -484,16 +490,28 @@
buttonText: self.messages.buttonText,
allDayText: self.messages.allDayText,
timeFormat: self.messages.timeFormat,
titleFormat: self.messages.titleFormat,
columnFormat: self.messages.columnFormat,
views: {
month: {
titleFormat: self.messages.titleFormat.month,
columnHeaderFormat: self.messages.columnFormat.month
},
week: {
titleFormat: self.messages.titleFormat.week,
columnHeaderFormat: self.messages.columnFormat.week
},
day: {
titleFormat: self.messages.titleFormat.day,
columnHeaderFormat: self.messages.columnFormat.day
}
},
clickPopup: self.messages.clickPopup,
theme: self.defaults.theme === 'ui',
editable: false,
year: self.defaults.calendarStart.getFullYear(),
month: self.defaults.calendarStart.getMonth(),
date: self.defaults.calendarStart.getDate(),
eventColor: self.defaults.color,
eventSources: [ data.events , self.defaults.holiday ],
eventSources: [ data.events , holidays ],
eventRender: function( event, element, view ) {
that.event( event, element, view ).icon();
that.event( event, element, view ).description();
Expand Down
9 changes: 6 additions & 3 deletions i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,16 @@
"srf-ui-eventcalendar-label-month": "Month",
"srf-ui-eventcalendar-label-week": "Week",
"srf-ui-eventcalendar-label-day": "Day",
"srf-ui-eventcalendar-label-listmonth": "Month (list)",
"srf-ui-eventcalendar-label-listweek": "Week (list)",
"srf-ui-eventcalendar-label-listday": "Day (list)",
"srf-ui-eventcalendar-label-allday": "All day",
"srf-ui-eventcalendar-format-time": "h(:mm)t",
"srf-ui-eventcalendar-format-time-agenda": "H:mm( - H:mm)",
"srf-ui-eventcalendar-format-axis": "H:mm",
"srf-ui-eventcalendar-format-title-month": "MMMM yyyy",
"srf-ui-eventcalendar-format-title-week": "d [MMM][ yyyy]{ '—' d MMM yyyy}",
"srf-ui-eventcalendar-format-title-day": "dddd, d MMM, yyyy",
"srf-ui-eventcalendar-format-title-month": "MMMM YYYY",
"srf-ui-eventcalendar-format-title-week": "D MMM YYYY",
"srf-ui-eventcalendar-format-title-day": "dddd, D MMM, YYYY",
"srf-ui-eventcalendar-format-column-month": "ddd",
"srf-ui-eventcalendar-format-column-week": "ddd d/M",
"srf-ui-eventcalendar-format-column-day": "dddd d/M",
Expand Down
3 changes: 3 additions & 0 deletions i18n/qqq.json
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,9 @@
"srf-ui-eventcalendar-label-month": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-week": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-day": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-listmonth": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-listweek": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-listday": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-label-allday": "Text that will be displayed on buttons of the calendar header. See [http://www.semantic-mediawiki.org/wiki/Help:Event_calendar_format Event calendar format] and [http://arshaw.com/fullcalendar/docs/text/buttonText/ buttonText]",
"srf-ui-eventcalendar-format-time": "Determines the time-text that will be displayed on each event and is language dependent. For more see [http://arshaw.com/fullcalendar/docs/text/timeFormat/ here]",
"srf-ui-eventcalendar-format-time-agenda": "Determines the time-text that will be displayed on each event and is language dependent. For more see [http://arshaw.com/fullcalendar/docs/text/timeFormat/ here]",
Expand Down